forked from GetFluvo/fluvo
-
Notifications
You must be signed in to change notification settings - Fork 1
Pull request for issue #4 #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
google-labs-jules
wants to merge
5
commits into
master
Choose a base branch
from
feat/odf-data-quality-dashboard
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
680b133
feat: Create odf_data_quality_dashboard module
google-labs-jules[bot] a93bc21
Update modules/odf_data_quality_dashboard/models/odf_data_quality_iss…
bosd a2bb953
Update modules/odf_data_quality_dashboard/models/odf_data_quality_iss…
bosd 7a4e1d8
Update modules/odf_data_quality_dashboard/models/odf_data_quality_iss…
bosd a4dff3f
Update modules/odf_data_quality_dashboard/views/odf_data_quality_issu…
bosd File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| """Odoo module for the Data Quality Dashboard.""" | ||
|
|
||
| from . import models | ||
|
|
||
| __all__ = ["models"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| """Odoo module manifest for the Data Quality Dashboard.""" | ||
|
|
||
| { | ||
| "name": "ODF Data Quality Dashboard", | ||
| "summary": """ | ||
| Provides a dashboard to identify and manage data quality issues | ||
| after data import.""", | ||
| "author": "OdooDataFlow", | ||
| "website": "https://github.com/OdooDataFlow/odoo-data-flow", | ||
| "category": "Tools", | ||
| "version": "18.0.1.0.0", | ||
| "depends": ["base"], | ||
| "data": [ | ||
| "security/ir.model.access.csv", | ||
| "views/odf_data_quality_issue_views.xml", | ||
| "data/ir_cron_data.xml", | ||
| ], | ||
| "installable": True, | ||
| "application": True, | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <odoo> | ||
| <data noupdate="1"> | ||
| <!-- Scheduled action for nightly data quality checks --> | ||
| <record id="ir_cron_nightly_data_validation" model="ir.cron"> | ||
| <field name="name">Data Quality: Nightly Validation</field> | ||
| <field name="model_id" ref="model_odf_data_quality_issue"/> | ||
| <field name="state">code</field> | ||
| <field name="code">model._run_nightly_validation()</field> | ||
| <field name="user_id" ref="base.user_root"/> | ||
| <field name="interval_number">1</field> | ||
| <field name="interval_type">days</field> | ||
| <field name="numbercall">-1</field> | ||
| <field name="doall" eval="False"/> | ||
| </record> | ||
| </data> | ||
| </odoo> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| """Models for the Data Quality Dashboard module.""" | ||
|
|
||
| from . import odf_data_quality_issue | ||
|
|
||
| __all__ = ["odf_data_quality_issue"] |
85 changes: 85 additions & 0 deletions
85
modules/odf_data_quality_dashboard/models/odf_data_quality_issue.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| """Module to manage data quality issues.""" | ||
|
|
||
| from datetime import datetime, timedelta | ||
|
|
||
| from odoo import api, fields, models | ||
|
|
||
|
|
||
| class OdfDataQualityIssue(models.Model): | ||
| """Represents a data quality issue found in the system. | ||
|
|
||
| This model stores records of data inconsistencies or errors, | ||
| allowing users to track and resolve them in a structured manner. | ||
| """ | ||
|
|
||
| _name = "odf.data.quality.issue" | ||
| _description = "Data Quality Issue" | ||
| _order = "create_date desc" | ||
|
|
||
| name = fields.Char( | ||
| string="Title", | ||
| required=True, | ||
| help="A concise summary of the data quality issue.", | ||
| ) | ||
| issue_type = fields.Char( | ||
| string="Issue Type", | ||
| required=True, | ||
| help="The category of the issue, e.g., 'Invalid VAT'.", | ||
| ) | ||
| related_record = fields.Reference( | ||
| string="Related Record", | ||
| selection=[("res.partner", "Partner"), ("product.product", "Product")], | ||
| help="A reference to the record that has the data quality issue.", | ||
| ) | ||
| status = fields.Selection( | ||
| [ | ||
| ("todo", "To Do"), | ||
| ("in_progress", "In Progress"), | ||
| ("done", "Done"), | ||
| ], | ||
| string="Status", | ||
| default="todo", | ||
| required=True, | ||
| help="The current stage of the issue resolution process.", | ||
| ) | ||
| notes = fields.Text( | ||
| string="Notes", | ||
| help="Detailed comments or notes about the issue.", | ||
| ) | ||
|
|
||
| # ------------------------------------------------------------------------- | ||
| # Business Methods | ||
| # ------------------------------------------------------------------------- | ||
| @api.model | ||
| def _run_nightly_validation(self): | ||
| """Run all nightly data validation checks.""" | ||
| self._check_partners_with_missing_vat() | ||
|
|
||
| @api.model | ||
| def _check_partners_with_missing_vat(self): | ||
| """Check for partners created in the last 24h with missing VAT.""" | ||
| yesterday = datetime.now() - timedelta(days=1) | ||
| # Search for companies created in the last 24 hours without a VAT | ||
| partners = self.env["res.partner"].search( | ||
| [ | ||
| ("is_company", "=", True), | ||
| ("create_date", ">=", yesterday), | ||
| ("vat", "=", False), | ||
| ] | ||
| ) | ||
| vals_list = [] | ||
| for partner in partners: | ||
| vals_list.append( | ||
| { | ||
| "name": f"Missing VAT for Partner: {partner.name}", | ||
| "issue_type": "Missing VAT", | ||
| "related_record": f"res.partner,{partner.id}", | ||
| "status": "todo", | ||
| "notes": ( | ||
| f"The partner '{partner.name}' is a company but does " | ||
| "not have a VAT number." | ||
| ), | ||
| } | ||
| ) | ||
| if vals_list: | ||
| self.create(vals_list) | ||
2 changes: 2 additions & 0 deletions
2
modules/odf_data_quality_dashboard/security/ir.model.access.csv
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink | ||
| access_odf_data_quality_issue_user,odf.data.quality.issue.user,model_odf_data_quality_issue,base.group_user,1,1,1,1 |
78 changes: 78 additions & 0 deletions
78
modules/odf_data_quality_dashboard/views/odf_data_quality_issue_views.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <odoo> | ||
| <!-- Action --> | ||
| <record id="action_odf_data_quality_issue" model="ir.actions.act_window"> | ||
| <field name="name">Data Quality Issues</field> | ||
| <field name="res_model">odf.data.quality.issue</field> | ||
| <field name="view_mode">tree,kanban,form</field> | ||
| <field name="help" type="html"> | ||
| <p class="o_view_nocontent_smiling_face"> | ||
| No data quality issues found. Everything looks good! | ||
| </p> | ||
| </field> | ||
| </record> | ||
|
|
||
| <!-- Kanban View --> | ||
| <record id="view_odf_data_quality_issue_kanban" model="ir.ui.view"> | ||
| <field name="name">odf.data.quality.issue.kanban</field> | ||
| <field name="model">odf.data.quality.issue</field> | ||
| <field name="arch" type="xml"> | ||
| <kanban default_group_by="status" class="o_kanban_small_column"> | ||
| <field name="status"/> | ||
| <templates> | ||
| <t t-name="kanban-box"> | ||
| <div t-attf-class="oe_kanban_global_click"> | ||
| <div class="oe_kanban_details"> | ||
| <strong><field name="name"/></strong> | ||
| <div> | ||
| <span class="text-muted">Type: </span> | ||
| <field name="issue_type"/> | ||
| </div> | ||
| <div> | ||
| <span class="text-muted">Record: </span> | ||
| <field name="related_record"/> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </t> | ||
| </templates> | ||
| </kanban> | ||
| </field> | ||
| </record> | ||
|
|
||
| <!-- Form View --> | ||
| <record id="view_odf_data_quality_issue_form" model="ir.ui.view"> | ||
| <field name="name">odf.data.quality.issue.form</field> | ||
| <field name="model">odf.data.quality.issue</field> | ||
| <field name="arch" type="xml"> | ||
| <form string="Data Quality Issue"> | ||
| <sheet> | ||
| <group> | ||
| <field name="name"/> | ||
| <field name="issue_type"/> | ||
| <field name="related_record"/> | ||
| <field name="status"/> | ||
| </group> | ||
| <notebook> | ||
| <page string="Notes"> | ||
| <field name="notes"/> | ||
| </page> | ||
| </notebook> | ||
| </sheet> | ||
| </form> | ||
| </field> | ||
| </record> | ||
|
|
||
| <!-- Menu --> | ||
| <menuitem | ||
| id="menu_data_quality_root" | ||
| name="Data Quality" | ||
| sequence="99"/> | ||
|
|
||
| <menuitem | ||
| id="menu_data_quality_dashboard" | ||
| name="Dashboard" | ||
| parent="menu_data_quality_root" | ||
| action="action_odf_data_quality_issue" | ||
| sequence="10"/> | ||
| </odoo> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.