mirror of
https://github.com/OCA/manufacture.git
synced 2025-01-28 16:37:15 +02:00
[MIG] quality_control_oca: Migration to 17.0
This commit is contained in:
@@ -106,6 +106,10 @@ Contributors
|
||||
|
||||
- Vicent Cubells
|
||||
|
||||
- `APSL-Nagarro <https://www.apsl.tech>`__:
|
||||
|
||||
- Antoni Marroig <amarroig@apsl.net>
|
||||
|
||||
Other credits
|
||||
-------------
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
{
|
||||
"name": "Quality Control OCA",
|
||||
"version": "16.0.1.2.0",
|
||||
"version": "17.0.1.0.0",
|
||||
"category": "Quality Control",
|
||||
"license": "AGPL-3",
|
||||
"summary": "Generic infrastructure for quality tests.",
|
||||
|
||||
@@ -38,22 +38,16 @@ class QcInspection(models.Model):
|
||||
string="Inspection number",
|
||||
required=True,
|
||||
default="/",
|
||||
readonly=True,
|
||||
states={"draft": [("readonly", False)]},
|
||||
copy=False,
|
||||
)
|
||||
date = fields.Datetime(
|
||||
required=True,
|
||||
readonly=True,
|
||||
copy=False,
|
||||
default=fields.Datetime.now,
|
||||
states={"draft": [("readonly", False)]},
|
||||
)
|
||||
object_id = fields.Reference(
|
||||
string="Reference",
|
||||
selection="object_selection_values",
|
||||
readonly=True,
|
||||
states={"draft": [("readonly", False)]},
|
||||
ondelete="set null",
|
||||
)
|
||||
product_id = fields.Many2one(
|
||||
@@ -63,17 +57,13 @@ 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", readonly=True)
|
||||
test = fields.Many2one(comodel_name="qc.test")
|
||||
inspection_lines = fields.One2many(
|
||||
comodel_name="qc.inspection.line",
|
||||
inverse_name="inspection_id",
|
||||
readonly=True,
|
||||
states={"ready": [("readonly", False)]},
|
||||
)
|
||||
internal_notes = fields.Text(string="Internal notes")
|
||||
external_notes = fields.Text(
|
||||
states={"success": [("readonly", True)], "failed": [("readonly", True)]},
|
||||
)
|
||||
external_notes = fields.Text()
|
||||
state = fields.Selection(
|
||||
[
|
||||
("draft", "Draft"),
|
||||
@@ -83,7 +73,6 @@ class QcInspection(models.Model):
|
||||
("failed", "Quality failed"),
|
||||
("canceled", "Canceled"),
|
||||
],
|
||||
readonly=True,
|
||||
default="draft",
|
||||
tracking=True,
|
||||
)
|
||||
@@ -94,15 +83,12 @@ class QcInspection(models.Model):
|
||||
)
|
||||
auto_generated = fields.Boolean(
|
||||
string="Auto-generated",
|
||||
readonly=True,
|
||||
copy=False,
|
||||
help="If an inspection is auto-generated, it can be canceled but not removed.",
|
||||
)
|
||||
company_id = fields.Many2one(
|
||||
comodel_name="res.company",
|
||||
string="Company",
|
||||
readonly=True,
|
||||
states={"draft": [("readonly", False)]},
|
||||
default=lambda self: self.env.company,
|
||||
)
|
||||
user = fields.Many2one(
|
||||
@@ -291,15 +277,13 @@ class QcInspectionLine(models.Model):
|
||||
inspection_id = fields.Many2one(
|
||||
comodel_name="qc.inspection", string="Inspection", ondelete="cascade"
|
||||
)
|
||||
name = fields.Char(string="Question", readonly=True)
|
||||
name = fields.Char(string="Question")
|
||||
product_id = fields.Many2one(
|
||||
comodel_name="product.product",
|
||||
related="inspection_id.product_id",
|
||||
store=True,
|
||||
)
|
||||
test_line = fields.Many2one(
|
||||
comodel_name="qc.test.question", string="Test question", readonly=True
|
||||
)
|
||||
test_line = fields.Many2one(comodel_name="qc.test.question", string="Test question")
|
||||
possible_ql_values = fields.Many2many(
|
||||
comodel_name="qc.test.question.value", string="Answers"
|
||||
)
|
||||
@@ -318,19 +302,16 @@ class QcInspectionLine(models.Model):
|
||||
min_value = fields.Float(
|
||||
string="Min",
|
||||
digits="Quality Control",
|
||||
readonly=True,
|
||||
help="Minimum valid value for a quantitative question.",
|
||||
)
|
||||
max_value = fields.Float(
|
||||
string="Max",
|
||||
digits="Quality Control",
|
||||
readonly=True,
|
||||
help="Maximum valid value for a quantitative question.",
|
||||
)
|
||||
test_uom_id = fields.Many2one(
|
||||
comodel_name="uom.uom",
|
||||
string="Test UoM",
|
||||
readonly=True,
|
||||
help="UoM for minimum and maximum values for a quantitative " "question.",
|
||||
)
|
||||
test_uom_category = fields.Many2one(
|
||||
@@ -344,7 +325,6 @@ class QcInspectionLine(models.Model):
|
||||
)
|
||||
question_type = fields.Selection(
|
||||
[("qualitative", "Qualitative"), ("quantitative", "Quantitative")],
|
||||
readonly=True,
|
||||
)
|
||||
valid_values = fields.Char(
|
||||
string="Valid values", store=True, compute="_compute_valid_values"
|
||||
|
||||
@@ -70,7 +70,7 @@ class QcTestQuestion(models.Model):
|
||||
"Question '%s' is not valid: "
|
||||
"you have to mark at least one value as OK."
|
||||
)
|
||||
% tc.name_get()[0][1]
|
||||
% tc.display_name
|
||||
)
|
||||
|
||||
@api.constrains("min_value", "max_value")
|
||||
@@ -82,7 +82,7 @@ class QcTestQuestion(models.Model):
|
||||
"Question '%s' is not valid: "
|
||||
"minimum value can't be higher than maximum value."
|
||||
)
|
||||
% tc.name_get()[0][1]
|
||||
% tc.display_name
|
||||
)
|
||||
|
||||
sequence = fields.Integer(required=True, default="10")
|
||||
|
||||
@@ -22,6 +22,5 @@ class QcTrigger(models.Model):
|
||||
partner_selectable = fields.Boolean(
|
||||
string="Selectable by partner",
|
||||
default=False,
|
||||
readonly=True,
|
||||
help="This technical field is to allow to filter by partner in triggers",
|
||||
)
|
||||
|
||||
@@ -10,3 +10,5 @@
|
||||
- Carlos Roca
|
||||
- [Trey Kilobytes de Soluciones SL](https://www.trey.es):
|
||||
- Vicent Cubells
|
||||
- [APSL-Nagarro](https://www.apsl.tech):
|
||||
- Antoni Marroig \<<amarroig@apsl.net>\>
|
||||
@@ -453,6 +453,10 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
|
||||
<li>Vicent Cubells</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference external" href="https://www.apsl.tech">APSL-Nagarro</a>:<ul>
|
||||
<li>Antoni Marroig <<a class="reference external" href="mailto:amarroig@apsl.net">amarroig@apsl.net</a>></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="other-credits">
|
||||
|
||||
@@ -15,28 +15,28 @@
|
||||
<button
|
||||
name="action_draft"
|
||||
type="object"
|
||||
attrs="{'invisible': [('state', '!=', 'canceled')]}"
|
||||
invisible="state != 'canceled'"
|
||||
string="Draft"
|
||||
/>
|
||||
<button
|
||||
name="action_todo"
|
||||
type="object"
|
||||
class="oe_highlight"
|
||||
states="draft"
|
||||
invisible="state != 'draft'"
|
||||
string="Mark todo"
|
||||
/>
|
||||
<button
|
||||
name="action_confirm"
|
||||
type="object"
|
||||
class="oe_highlight"
|
||||
states="ready"
|
||||
invisible="state != 'ready'"
|
||||
string="Confirm"
|
||||
icon="fa-check"
|
||||
/>
|
||||
<button
|
||||
name="action_approve"
|
||||
type="object"
|
||||
states="waiting"
|
||||
invisible="state != 'waiting'"
|
||||
class="oe_highlight"
|
||||
groups="quality_control_oca.group_quality_control_manager"
|
||||
string="Approve"
|
||||
@@ -44,7 +44,7 @@
|
||||
<button
|
||||
name="action_cancel"
|
||||
type="object"
|
||||
attrs="{'invisible': [('state', 'not in', ['waiting', 'ready', 'failed', 'success'])]}"
|
||||
invisible="state not in ['waiting', 'ready', 'failed', 'success']"
|
||||
string="Cancel"
|
||||
icon="fa-ban"
|
||||
/>
|
||||
@@ -52,6 +52,7 @@
|
||||
name="state"
|
||||
widget="statusbar"
|
||||
statusbar_visible="draft,waiting,success"
|
||||
readonly="1"
|
||||
/>
|
||||
</header>
|
||||
<sheet>
|
||||
@@ -61,51 +62,73 @@
|
||||
type="action"
|
||||
name="%(action_qc_inspection_set_test)d"
|
||||
icon="fa-bookmark-o"
|
||||
states="draft"
|
||||
invisible="state != 'draft'"
|
||||
string="Set test"
|
||||
/>
|
||||
</div>
|
||||
<h1>
|
||||
<label string="Inspection " for="name" />
|
||||
<field name="name" class="oe_inline" />
|
||||
<field
|
||||
name="name"
|
||||
class="oe_inline"
|
||||
readonly="state != 'draft'"
|
||||
/>
|
||||
</h1>
|
||||
<group>
|
||||
<group>
|
||||
<field name="test" />
|
||||
<field name="test" readonly="1" />
|
||||
<field name="user" />
|
||||
<field name="object_id" />
|
||||
<field name="object_id" readonly="state != 'draft'" />
|
||||
<field name="qty" />
|
||||
<field name="product_id" />
|
||||
</group>
|
||||
<group>
|
||||
<field name="date" />
|
||||
<field name="date" readonly="state != 'draft'" />
|
||||
<field name="success" />
|
||||
<field name="auto_generated" />
|
||||
<field name="auto_generated" readonly="1" />
|
||||
</group>
|
||||
</group>
|
||||
<notebook>
|
||||
<page string="Questions">
|
||||
<field name="inspection_lines" nolabel="1">
|
||||
<field
|
||||
name="inspection_lines"
|
||||
nolabel="1"
|
||||
readonly="state != 'ready'"
|
||||
>
|
||||
<tree editable="top" delete="false" create="false">
|
||||
<field name="name" />
|
||||
<field name="question_type" />
|
||||
<field name="possible_ql_values" invisible="1" />
|
||||
<field name="name" readonly="1" />
|
||||
<field name="question_type" readonly="1" />
|
||||
<field
|
||||
name="possible_ql_values"
|
||||
column_invisible="1"
|
||||
/>
|
||||
<field
|
||||
name="qualitative_value"
|
||||
attrs="{'readonly': [('question_type', '=', 'quantitative')]}"
|
||||
readonly="question_type == 'quantitative'"
|
||||
/>
|
||||
<field
|
||||
name="quantitative_value"
|
||||
attrs="{'readonly': [('question_type', '=', 'qualitative')]}"
|
||||
readonly="question_type == 'qualitative'"
|
||||
/>
|
||||
<field
|
||||
name="uom_id"
|
||||
groups="uom.group_uom"
|
||||
attrs="{'readonly': [('question_type', '=', 'qualitative')]}"
|
||||
readonly="question_type == 'qualitative'"
|
||||
/>
|
||||
<field
|
||||
name="test_uom_category"
|
||||
column_invisible="1"
|
||||
/>
|
||||
<field
|
||||
name="min_value"
|
||||
column_invisible="1"
|
||||
readonly="1"
|
||||
/>
|
||||
<field
|
||||
name="max_value"
|
||||
column_invisible="1"
|
||||
readonly="1"
|
||||
/>
|
||||
<field name="test_uom_category" invisible="1" />
|
||||
<field name="min_value" invisible="1" />
|
||||
<field name="max_value" invisible="1" />
|
||||
<field name="valid_values" />
|
||||
<field name="success" />
|
||||
</tree>
|
||||
@@ -116,7 +139,11 @@
|
||||
<field name="internal_notes" nolabel="1" />
|
||||
</group>
|
||||
<group string="External notes">
|
||||
<field name="external_notes" nolabel="1" />
|
||||
<field
|
||||
name="external_notes"
|
||||
nolabel="1"
|
||||
readonly="state in ['success', 'failed']"
|
||||
/>
|
||||
</group>
|
||||
</page>
|
||||
</notebook>
|
||||
@@ -243,21 +270,21 @@
|
||||
<field name="product_id" />
|
||||
<field name="name" />
|
||||
<field name="question_type" />
|
||||
<field name="possible_ql_values" invisible="1" />
|
||||
<field name="possible_ql_values" column_invisible="1" />
|
||||
<field
|
||||
name="qualitative_value"
|
||||
attrs="{'readonly': [('question_type', '=', 'quantitative')]}"
|
||||
readonly="question_type == 'quantitative'"
|
||||
/>
|
||||
<field
|
||||
name="quantitative_value"
|
||||
attrs="{'readonly': [('question_type', '=', 'qualitative')]}"
|
||||
readonly="question_type == 'qualitative'"
|
||||
/>
|
||||
<field
|
||||
name="uom_id"
|
||||
groups="uom.group_uom"
|
||||
attrs="{'readonly': [('question_type', '=', 'qualitative')]}"
|
||||
readonly="question_type == 'qualitative'"
|
||||
/>
|
||||
<field name="test_uom_category" invisible="1" />
|
||||
<field name="test_uom_category" column_invisible="1" />
|
||||
<field name="valid_values" />
|
||||
<field name="success" />
|
||||
</tree>
|
||||
|
||||
@@ -19,10 +19,7 @@
|
||||
<group>
|
||||
<group>
|
||||
<field name="type" />
|
||||
<field
|
||||
name="object_id"
|
||||
attrs="{'invisible': [('type','=','generic')]}"
|
||||
/>
|
||||
<field name="object_id" invisible="type == 'generic'" />
|
||||
<field name="active" />
|
||||
</group>
|
||||
<group>
|
||||
@@ -88,13 +85,13 @@
|
||||
name="qualitative"
|
||||
string="Answers"
|
||||
colspan="4"
|
||||
attrs="{'invisible': [('type', '!=', 'qualitative')]}"
|
||||
invisible="type != 'qualitative'"
|
||||
>
|
||||
<field
|
||||
name="ql_values"
|
||||
nolabel="1"
|
||||
colspan="2"
|
||||
attrs="{'required': [('type','=','qualitative')]}"
|
||||
required="type == 'qualitative'"
|
||||
>
|
||||
<tree editable="bottom">
|
||||
<field name="name" />
|
||||
@@ -105,7 +102,7 @@
|
||||
<div
|
||||
name="quantitative"
|
||||
align="center"
|
||||
attrs="{'invisible': [('type', '!=', 'quantitative')]}"
|
||||
invisible="type != 'quantitative'"
|
||||
>
|
||||
<h1 name="quantitative-data">
|
||||
<span name="quantitative-interval">
|
||||
@@ -113,14 +110,14 @@
|
||||
name="min_value"
|
||||
class="oe_inline"
|
||||
nolabel="1"
|
||||
attrs="{'required': [('type','=', 'quantitative')]}"
|
||||
required="type == 'quantitative'"
|
||||
/>
|
||||
<span> - </span>
|
||||
<field
|
||||
name="max_value"
|
||||
class="oe_inline"
|
||||
nolabel="1"
|
||||
attrs="{'required': [('type', '=', 'quantitative')]}"
|
||||
required="type == 'quantitative'"
|
||||
/>
|
||||
</span>
|
||||
<span name="quantitative-uom">
|
||||
@@ -128,7 +125,7 @@
|
||||
name="uom_id"
|
||||
class="oe_inline"
|
||||
nolabel="1"
|
||||
attrs="{'required': [('type', '=', 'quantitative')]}"
|
||||
required="type == 'quantitative'"
|
||||
/>
|
||||
</span>
|
||||
</h1>
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<group>
|
||||
<field name="name" />
|
||||
<field name="active" />
|
||||
<field name="partner_selectable" />
|
||||
<field name="partner_selectable" readonly="1" />
|
||||
</group>
|
||||
<group>
|
||||
<field name="company_id" groups="base.group_multi_company" />
|
||||
|
||||
Reference in New Issue
Block a user