[FIX] mrp: archive QC linked to archived operation
Instead of the delete icon next to the operations in a BoM, create a button to archive the operation. Archiving an operation will also archive the corresponding Quality Check. closes odoo/odoo#77456 Task-id: 2619450 Community-pr: https://github.com/odoo/odoo/pull/76376 Enterprise-pr: https://github.com/odoo/enterprise/pull/20785 X-original-commit: 9761ef89ca0f12f2907d844451e56c4a833ee8ef Related: odoo/enterprise#21291 Signed-off-by: William Henrotin <Whenrow@users.noreply.github.com>
This commit is contained in:
@@ -176,6 +176,10 @@ class MrpBom(models.Model):
|
||||
raise UserError(_("You cannot create a new Bill of Material from here."))
|
||||
return super(MrpBom, self).name_create(name)
|
||||
|
||||
def toggle_active(self):
|
||||
self.with_context({'active_test': False}).operation_ids.toggle_active()
|
||||
return super().toggle_active()
|
||||
|
||||
def name_get(self):
|
||||
return [(bom.id, '%s%s' % (bom.code and '%s: ' % bom.code or '', bom.product_tmpl_id.display_name)) for bom in self]
|
||||
|
||||
|
||||
@@ -181,7 +181,7 @@
|
||||
</div>
|
||||
<field name="product_qty" class="oe_inline text-left" attrs="{'readonly': [('state', '!=', 'draft')], 'invisible': [('state', 'not in', ('draft', 'done'))]}"/>
|
||||
<button type="action" name="%(mrp.action_change_production_qty)d"
|
||||
context="{'default_mo_id': id}" class="oe_link oe_inline" attrs="{'invisible': ['|', ('state', 'in', ('draft', 'done','cancel')), ('id', '=', False)]}">
|
||||
context="{'default_mo_id': id}" class="oe_link oe_inline" style="margin: 0px; padding: 0px;" attrs="{'invisible': ['|', ('state', 'in', ('draft', 'done','cancel')), ('id', '=', False)]}">
|
||||
<field name="product_qty" class="oe_inline" attrs="{'readonly': [('state', '!=', 'draft')]}"/>
|
||||
</button>
|
||||
<label for="product_uom_id" string="" class="oe_inline"/>
|
||||
|
||||
@@ -27,6 +27,9 @@
|
||||
<field name="priority">1000</field>
|
||||
<field name="mode">primary</field>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//tree" position="attributes">
|
||||
<attribute name="delete">0</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='name']" position="before">
|
||||
<field name="sequence" widget="handle"/>
|
||||
</xpath>
|
||||
@@ -37,6 +40,9 @@
|
||||
<xpath expr="//field[@name='bom_product_template_attribute_value_ids']" position="attributes">
|
||||
<attribute name="attrs">{'column_invisible': [('parent.product_id', '!=', False)]}</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='bom_product_template_attribute_value_ids']" position="after">
|
||||
<button name="action_archive" class="btn-link" type="object" string="Archive Operation" icon="fa-times"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -129,6 +135,7 @@
|
||||
<field name="name"/>
|
||||
<field name="bom_id"/>
|
||||
<field name="workcenter_id"/>
|
||||
<filter string="Archived" name="inactive" domain="[('active', '=', False)]"/>
|
||||
<group>
|
||||
<filter string="Bill of Material" name="bom" context="{'group_by': 'bom_id'}"/>
|
||||
<filter string="Workcenter" name="workcenter" context="{'group_by': 'workcenter_id'}"/>
|
||||
|
||||
@@ -242,7 +242,6 @@
|
||||
<filter string="Waiting" name="waiting" domain="[('state', '=', 'waiting')]"/>
|
||||
<filter string="Pending" name="pending" domain="[('state', '=', 'pending')]"/>
|
||||
<filter string="Finished" name="finish" domain="[('state', '=', 'done')]"/>
|
||||
<filter string="Available" name="available" domain="[('production_availability', '=', 'assigned')]"/>
|
||||
<separator/>
|
||||
<filter string="Late" name="late" domain="['&', ('date_planned_start', '<', current_date), ('state', '=', 'ready')]"
|
||||
help="Production started late"/>
|
||||
@@ -472,7 +471,7 @@
|
||||
<field name="res_model">mrp.workorder</field>
|
||||
<field name="view_mode">tree,kanban,form,calendar,pivot,graph,gantt</field>
|
||||
<field name="search_view_id" ref="view_mrp_production_workorder_form_view_filter"/>
|
||||
<field name="context">{'search_default_ready': True, 'search_default_waiting': True, 'search_default_progress': True, 'search_default_pending': True}</field>
|
||||
<field name="context">{'search_default_ready': True, 'search_default_progress': True, 'search_default_pending': True}</field>
|
||||
<field name="help" type="html">
|
||||
<p class="o_view_nocontent_smiling_face">
|
||||
No work orders to do!
|
||||
|
||||
Reference in New Issue
Block a user