[IMP] quality_control_oca: black, isort, prettier

This commit is contained in:
Stefano Consolaro
2022-12-10 10:40:15 +01:00
parent 56c09dad64
commit 4ce21a1a22
14 changed files with 71 additions and 96 deletions

View File

@@ -6,19 +6,14 @@
Copyright 2017 Simone Rubino - Agile Business Group
Copyright 2021 Tecnativa - Carlos Roca
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo>
<data noupdate="1">
<odoo noupdate="1">
<record id="qc_test_template_category_generic" model="qc.test.category">
<field name="name">Generic</field>
</record>
<record id="qc_test_template_category_referenced" model="qc.test.category">
<field name="name">Referenced</field>
</record>
<record
forcecreate="True"
id="decimal_quality_control"
model="decimal.precision"
>
<record forcecreate="True" id="decimal_quality_control" model="decimal.precision">
<field name="name">Quality Control</field>
<field name="digits">5</field>
</record>
@@ -28,5 +23,4 @@
<field name="prefix">QC-</field>
<field name="padding">6</field>
</record>
</data>
</odoo>

View File

@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<data noupdate="1">
<odoo noupdate="1">
<record model="qc.test" id="qc_test_1">
<field name="name">Generic Test (demo)</field>
<field name="type">generic</field>
@@ -30,5 +29,4 @@
<field name="max_value" eval="10.0" />
<field name="uom_id" ref="uom.product_uom_unit" />
</record>
</data>
</odoo>

View File

@@ -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(

View File

@@ -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.",

View File

@@ -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.",
)

View File

@@ -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",

View File

@@ -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.",

View File

@@ -15,7 +15,7 @@
<group name="first" position="after">
<group name="qc" string="Quality control">
<field name="qc_triggers" nolabel="1">
<tree string="Quality control triggers" editable="bottom">
<tree editable="bottom">
<field
name="trigger"
options="{'no_create': True, 'no_edit': True, 'no_open': True}"

View File

@@ -18,7 +18,7 @@
<page name="inventory" position="inside">
<group name="qc" string="Quality control">
<field name="qc_triggers" nolabel="1">
<tree string="Quality control triggers" editable="bottom">
<tree editable="bottom">
<field
name="trigger"
options="{'no_create': True, 'no_edit': True, 'no_open': True}"

View File

@@ -10,7 +10,7 @@
<field name="name">qc.inspection.form</field>
<field name="model">qc.inspection</field>
<field name="arch" type="xml">
<form string="Inspection">
<form>
<header>
<button
name="action_draft"
@@ -86,12 +86,7 @@
<notebook>
<page string="Questions">
<field name="inspection_lines" nolabel="1">
<tree
string="Inspection lines"
editable="top"
delete="false"
create="false"
>
<tree editable="top" delete="false" create="false">
<field name="name" />
<field name="question_type" />
<field name="possible_ql_values" invisible="1" />
@@ -141,7 +136,7 @@
<field name="name">qc.inspection.tree</field>
<field name="model">qc.inspection</field>
<field name="arch" type="xml">
<tree string="Inspections">
<tree>
<field name="name" />
<field name="user" />
<field name="test" />
@@ -241,7 +236,6 @@
<tree
decoration-danger="success==False"
decoration-info="success==True"
string="Inspection lines"
delete="false"
create="false"
>

View File

@@ -10,7 +10,7 @@
<field name="name">qc.test.category.tree</field>
<field name="model">qc.test.category</field>
<field name="arch" type="xml">
<tree string="Test categories" editable="bottom">
<tree editable="bottom">
<field name="complete_name" />
<field name="name" />
<field name="parent_id" />

View File

@@ -35,7 +35,7 @@
</group>
</group>
<field name="test_lines" nolabel="1">
<tree string="Questions">
<tree>
<field name="sequence" widget="handle" />
<field name="name" />
<field name="type" />
@@ -57,7 +57,7 @@
<field name="name">qc.test.tree</field>
<field name="model">qc.test</field>
<field name="arch" type="xml">
<tree string="Tests">
<tree>
<field name="name" />
<field name="category" />
<field name="type" />
@@ -95,7 +95,7 @@
nolabel="1"
attrs="{'required': [('type','=','qualitative')]}"
>
<tree string="Question value" editable="bottom">
<tree editable="bottom">
<field name="name" />
<field name="ok" />
</tree>

View File

@@ -26,7 +26,7 @@
<field name="name">qc.trigger.tree</field>
<field name="model">qc.trigger</field>
<field name="arch" type="xml">
<tree string="Quality control triggers" editable="bottom">
<tree editable="bottom">
<field name="name" />
<field name="company_id" groups="base.group_multi_company" />
<field name="partner_selectable" />

View File

@@ -18,7 +18,7 @@ class QcInspectionSetTest(models.TransientModel):
_name = "qc.inspection.set.test"
_description = "Set test for inspection"
test = fields.Many2one(comodel_name="qc.test", string="Test")
test = fields.Many2one(comodel_name="qc.test")
def action_create_test(self):
inspection = self.env["qc.inspection"].browse(self.env.context["active_id"])