[IMP] mrp: show+search lot/serial in workorder kanban

Adds the option to search workorders by lot or serial number and
displays the lot/serial number on the workorder kanban view
(if applicable).

Task: 2479234 (nrs 3,10)
Community PR: https://github.com/odoo/odoo/pull/114315
Enterprise PR: https://github.com/odoo/enterprise/pull/37764

Part-of: odoo/odoo#114315
This commit is contained in:
Pieter Claeys (clpi)
2023-05-25 16:28:55 +02:00
parent eb6aab7ad0
commit 7d73a070d5
2 changed files with 7 additions and 13 deletions
+3 -12
View File
@@ -115,9 +115,9 @@ class MrpWorkorder(models.Model):
'stock.move.line', 'workorder_id', 'Moves to Track',
help="Inventory moves for which you must scan a lot number at this work order")
finished_lot_id = fields.Many2one(
'stock.lot', string='Lot/Serial Number', compute='_compute_finished_lot_id',
inverse='_set_finished_lot_id', domain="[('product_id', '=', product_id), ('company_id', '=', company_id)]",
check_company=True)
'stock.lot', string='Lot/Serial Number', related='production_id.lot_producing_id',
domain="[('product_id', '=', product_id), ('company_id', '=', company_id)]",
readonly=False, check_company=True)
time_ids = fields.One2many(
'mrp.workcenter.productivity', 'workorder_id', copy=False)
is_user_working = fields.Boolean(
@@ -218,15 +218,6 @@ class MrpWorkorder(models.Model):
'replan': color_icon not in [False, 'text-primary']
})
@api.depends('production_id.lot_producing_id')
def _compute_finished_lot_id(self):
for workorder in self:
workorder.finished_lot_id = workorder.production_id.lot_producing_id
def _set_finished_lot_id(self):
for workorder in self:
workorder.production_id.lot_producing_id = workorder.finished_lot_id
@api.depends('production_id.qty_producing')
def _compute_qty_producing(self):
for workorder in self:
+4 -1
View File
@@ -8,6 +8,7 @@
<field name="production_id"/>
<field name="workcenter_id"/>
<field name="product_id"/>
<field name="finished_lot_id"/>
<filter string="Ready" name="ready" domain="[('state','=','ready')]"/>
<filter string="Waiting" name="waiting" domain="[('state','=','waiting')]"/>
<filter string="Pending" name="pending" domain="[('state','=','pending')]"/>
@@ -258,6 +259,7 @@
<field name="workcenter_id"/>
<field name="production_id"/>
<field name="product_id"/>
<field name="finished_lot_id"/>
<filter string="In Progress" name="progress" domain="[('state', '=', 'progress')]"/>
<filter string="Ready" name="ready" domain="[('state', '=', 'ready')]"/>
<filter string="Waiting" name="waiting" domain="[('state', '=', 'waiting')]"/>
@@ -415,6 +417,7 @@
<field name="date_start"/>
<field name="production_date"/>
<field name="product_uom_id" force_save="1"/>
<field name="finished_lot_id"/>
<field name="operation_id"/>
<templates>
<t t-name="kanban-box">
@@ -438,7 +441,7 @@
</div>
<div class="o_kanban_record_bottom">
<h5 class="oe_kanban_bottom_left">
<span><t t-out="record.product_id.value"/>, </span> <span><t t-out="record.qty_production.value"/> <t t-out="record.product_uom_id.value"/></span>
<span><t t-out="record.product_id.value"/>, </span> <span><t t-out="record.qty_production.value"/> <t t-out="record.product_uom_id.value"/><t t-if="record.finished_lot_id.value">, </t></span><span t-if="record.finished_lot_id.value" t-out="record.finished_lot_id.value"/>
</h5>
<div class="o_kanban_workorder_status">
<div class="o_kanban_record_bottom">