From 7d73a070d5e7939c1bc1dcf3d2cd4480e3fb71a6 Mon Sep 17 00:00:00 2001 From: "Pieter Claeys (clpi)" Date: Fri, 24 Feb 2023 15:32:30 +0000 Subject: [PATCH] [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 --- addons/mrp/models/mrp_workorder.py | 15 +++------------ addons/mrp/views/mrp_workorder_views.xml | 5 ++++- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/addons/mrp/models/mrp_workorder.py b/addons/mrp/models/mrp_workorder.py index d5d40384a59..1fcc9ca6f47 100644 --- a/addons/mrp/models/mrp_workorder.py +++ b/addons/mrp/models/mrp_workorder.py @@ -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: diff --git a/addons/mrp/views/mrp_workorder_views.xml b/addons/mrp/views/mrp_workorder_views.xml index 5bbbc2670c8..6fea3f086ae 100644 --- a/addons/mrp/views/mrp_workorder_views.xml +++ b/addons/mrp/views/mrp_workorder_views.xml @@ -8,6 +8,7 @@ + @@ -258,6 +259,7 @@ + @@ -415,6 +417,7 @@ + @@ -438,7 +441,7 @@
- , + , ,