From d6354defafcb6e8354f1c34aa69d0f708b88f75a Mon Sep 17 00:00:00 2001 From: Stefano Consolaro Date: Sat, 10 Dec 2022 10:40:15 +0100 Subject: [PATCH] [IMP] quality_control_oca: black, isort, prettier --- .../data/quality_control_data.xml | 40 +++++------- .../demo/quality_control_demo.xml | 62 +++++++++---------- quality_control_oca/models/qc_inspection.py | 10 +-- quality_control_oca/models/qc_test.py | 19 +++--- .../models/qc_test_category.py | 3 +- quality_control_oca/models/qc_trigger.py | 4 +- quality_control_oca/models/qc_trigger_line.py | 1 - .../views/product_category_view.xml | 2 +- .../views/product_template_view.xml | 2 +- .../views/qc_inspection_view.xml | 12 +--- .../views/qc_test_category_view.xml | 2 +- quality_control_oca/views/qc_test_view.xml | 6 +- quality_control_oca/views/qc_trigger_view.xml | 2 +- quality_control_oca/wizard/qc_test_wizard.py | 2 +- 14 files changed, 71 insertions(+), 96 deletions(-) diff --git a/quality_control_oca/data/quality_control_data.xml b/quality_control_oca/data/quality_control_data.xml index 1e4f542ca..4bd7d9ca5 100644 --- a/quality_control_oca/data/quality_control_data.xml +++ b/quality_control_oca/data/quality_control_data.xml @@ -6,27 +6,21 @@ Copyright 2017 Simone Rubino - Agile Business Group Copyright 2021 Tecnativa - Carlos Roca License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). --> - - - - Generic - - - Referenced - - - Quality Control - 5 - - - Quality inspection - qc.inspection - QC- - 6 - - + + + Generic + + + Referenced + + + Quality Control + 5 + + + Quality inspection + qc.inspection + QC- + 6 + diff --git a/quality_control_oca/demo/quality_control_demo.xml b/quality_control_oca/demo/quality_control_demo.xml index c70cf1428..ac29b1ab2 100644 --- a/quality_control_oca/demo/quality_control_demo.xml +++ b/quality_control_oca/demo/quality_control_demo.xml @@ -1,34 +1,32 @@ - - - - Generic Test (demo) - generic - - - - - Overall quality - - qualitative - - - Good - - - - - Bad - - - - - Size - - quantitative - - - - - + + + Generic Test (demo) + generic + + + + + Overall quality + + qualitative + + + Good + + + + + Bad + + + + + Size + + quantitative + + + + diff --git a/quality_control_oca/models/qc_inspection.py b/quality_control_oca/models/qc_inspection.py index 256eb6e78..885d841b0 100644 --- a/quality_control_oca/models/qc_inspection.py +++ b/quality_control_oca/models/qc_inspection.py @@ -43,7 +43,6 @@ class QcInspection(models.Model): copy=False, ) date = fields.Datetime( - string="Date", required=True, readonly=True, copy=False, @@ -64,17 +63,15 @@ class QcInspection(models.Model): help="Product associated with the inspection", ) qty = fields.Float(string="Quantity", default=1.0) - test = fields.Many2one(comodel_name="qc.test", string="Test", readonly=True) + test = fields.Many2one(comodel_name="qc.test", readonly=True) inspection_lines = fields.One2many( comodel_name="qc.inspection.line", inverse_name="inspection_id", - string="Inspection lines", readonly=True, states={"ready": [("readonly", False)]}, ) internal_notes = fields.Text(string="Internal notes") external_notes = fields.Text( - string="External notes", states={"success": [("readonly", True)], "failed": [("readonly", True)]}, ) state = fields.Selection( @@ -86,14 +83,12 @@ class QcInspection(models.Model): ("failed", "Quality failed"), ("canceled", "Canceled"), ], - string="State", readonly=True, default="draft", tracking=True, ) success = fields.Boolean( compute="_compute_success", - string="Success", help="This field will be marked if all tests have succeeded.", store=True, ) @@ -321,7 +316,7 @@ class QcInspectionLine(models.Model): help="Value of the result for a qualitative question.", domain="[('id', 'in', possible_ql_values)]", ) - notes = fields.Text(string="Notes") + notes = fields.Text() min_value = fields.Float( string="Min", digits="Quality Control", @@ -351,7 +346,6 @@ class QcInspectionLine(models.Model): ) question_type = fields.Selection( [("qualitative", "Qualitative"), ("quantitative", "Quantitative")], - string="Question type", readonly=True, ) valid_values = fields.Char( diff --git a/quality_control_oca/models/qc_test.py b/quality_control_oca/models/qc_test.py index 5b74967cd..00395cbc7 100644 --- a/quality_control_oca/models/qc_test.py +++ b/quality_control_oca/models/qc_test.py @@ -25,8 +25,8 @@ class QcTest(models.Model): if self.type == "generic": self.object_id = False - active = fields.Boolean("Active", default=True) - name = fields.Char(string="Name", required=True, translate=True) + active = fields.Boolean(default=True) + name = fields.Char(required=True, translate=True) test_lines = fields.One2many( comodel_name="qc.test.question", inverse_name="test", @@ -40,14 +40,12 @@ class QcTest(models.Model): fill_correct_values = fields.Boolean(string="Pre-fill with correct values") type = fields.Selection( [("generic", "Generic"), ("related", "Related")], - string="Type", required=True, default="generic", ) - category = fields.Many2one(comodel_name="qc.test.category", string="Category") + category = fields.Many2one(comodel_name="qc.test.category") company_id = fields.Many2one( comodel_name="res.company", - string="Company", default=lambda self: self.env.company, ) @@ -87,12 +85,11 @@ class QcTestQuestion(models.Model): % tc.name_get()[0][1] ) - sequence = fields.Integer(string="Sequence", required=True, default="10") - test = fields.Many2one(comodel_name="qc.test", string="Test") - name = fields.Char(string="Name", required=True, translate=True) + sequence = fields.Integer(required=True, default="10") + test = fields.Many2one(comodel_name="qc.test") + name = fields.Char(required=True, translate=True) type = fields.Selection( [("qualitative", "Qualitative"), ("quantitative", "Quantitative")], - string="Type", required=True, ) ql_values = fields.One2many( @@ -101,7 +98,7 @@ class QcTestQuestion(models.Model): string="Qualitative values", copy=True, ) - notes = fields.Text(string="Notes") + notes = fields.Text() min_value = fields.Float(string="Min", digits="Quality Control") max_value = fields.Float(string="Max", digits="Quality Control") uom_id = fields.Many2one(comodel_name="uom.uom", string="Uom") @@ -112,7 +109,7 @@ class QcTestQuestionValue(models.Model): _description = "Possible values for qualitative questions." test_line = fields.Many2one(comodel_name="qc.test.question", string="Test question") - name = fields.Char(string="Name", required=True, translate=True) + name = fields.Char(required=True, translate=True) ok = fields.Boolean( string="Correct answer?", help="When this field is marked, the answer is considered correct.", diff --git a/quality_control_oca/models/qc_test_category.py b/quality_control_oca/models/qc_test_category.py index 04402dd2a..1aa4541d1 100644 --- a/quality_control_oca/models/qc_test_category.py +++ b/quality_control_oca/models/qc_test_category.py @@ -29,7 +29,7 @@ class QcTestTemplateCategory(models.Model): _("Error! You can not create recursive categories.") ) - name = fields.Char("Name", required=True, translate=True) + name = fields.Char(required=True, translate=True) parent_id = fields.Many2one( comodel_name="qc.test.category", string="Parent category" ) @@ -42,7 +42,6 @@ class QcTestTemplateCategory(models.Model): string="Child categories", ) active = fields.Boolean( - string="Active", default=True, help="This field allows you to hide the category without removing it.", ) diff --git a/quality_control_oca/models/qc_trigger.py b/quality_control_oca/models/qc_trigger.py index fd0e93756..6c2d12940 100644 --- a/quality_control_oca/models/qc_trigger.py +++ b/quality_control_oca/models/qc_trigger.py @@ -12,8 +12,8 @@ class QcTrigger(models.Model): _name = "qc.trigger" _description = "Quality control trigger" - name = fields.Char(string="Name", required=True, translate=True) - active = fields.Boolean(string="Active", default=True) + name = fields.Char(required=True, translate=True) + active = fields.Boolean(default=True) company_id = fields.Many2one( comodel_name="res.company", string="Company", diff --git a/quality_control_oca/models/qc_trigger_line.py b/quality_control_oca/models/qc_trigger_line.py index 78010469f..0c0b6e959 100644 --- a/quality_control_oca/models/qc_trigger_line.py +++ b/quality_control_oca/models/qc_trigger_line.py @@ -33,7 +33,6 @@ class QcTriggerLine(models.AbstractModel): ) partners = fields.Many2many( comodel_name="res.partner", - string="Partners", help="If filled, the test will only be created when the action is done" " for one of the specified partners. If empty, the test will always be" " created.", diff --git a/quality_control_oca/views/product_category_view.xml b/quality_control_oca/views/product_category_view.xml index f87d2d17a..d0b39fae1 100644 --- a/quality_control_oca/views/product_category_view.xml +++ b/quality_control_oca/views/product_category_view.xml @@ -15,7 +15,7 @@ - + - + qc.inspection.form qc.inspection -
+