From d9f6b6901d8a504e8033c30aeb07d10865c879bb Mon Sep 17 00:00:00 2001 From: Rahul Reddiar Date: Fri, 9 Jun 2023 06:53:25 +0000 Subject: [PATCH] [FIX] mrp: wo list view fix operation status Before this commit ================== Marking an operation as done rather than start and done, the status of subsequent immediate next linked work orders is not updated properly inside WO list view. Steps to Reproduce ================== - Create a bom product having more than one operations. - Create a MO and confirm it. - Inside WO list view select a single first operation of the recently created MO, and click on done, you will find that the status of subsequent operation (immediate next) is not updated properly. This happens because of the reservation state of the MO which has initial state as false and thus the status of work-order changes to 'waiting'. With this commit ================ Marking operation as done the status of subsequent linked work order gets updated properly. closes odoo/odoo#128881 Task: 3358125 X-original-commit: 0533577264413934179cc32e0cfe26cb324dd58a Signed-off-by: Arnold Moyaux (arm) --- addons/mrp/models/mrp_production.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/mrp/models/mrp_production.py b/addons/mrp/models/mrp_production.py index 56de3cac084..7859d37cb71 100644 --- a/addons/mrp/models/mrp_production.py +++ b/addons/mrp/models/mrp_production.py @@ -571,9 +571,9 @@ class MrpProduction(models.Model): @api.depends('state', 'move_raw_ids.state') def _compute_reservation_state(self): - self.reservation_state = False for production in self: if production.state in ('draft', 'done', 'cancel'): + production.reservation_state = False continue relevant_move_state = production.move_raw_ids._get_relevant_state_among_moves() # Compute reservation state according to its component's moves. @@ -584,6 +584,8 @@ class MrpProduction(models.Model): production.reservation_state = 'confirmed' elif relevant_move_state != 'draft': production.reservation_state = relevant_move_state + else: + production.reservation_state = False @api.depends('move_raw_ids', 'state', 'move_raw_ids.product_uom_qty') def _compute_unreserve_visible(self):