From 2cf234df6d9ddfe221a57b3729adcab39836fd14 Mon Sep 17 00:00:00 2001 From: Vandan Shah Date: Tue, 26 Sep 2017 19:01:58 +0530 Subject: [PATCH] [FIX] stock, mrp: don't allow to unlock when state 'cancel' When a picking or a manufacturing order is in state cancel, we shouldn't be able to modify it as we didn't move anything and it won't have any impact on stock --- addons/mrp/models/mrp_production.py | 2 +- addons/mrp/views/mrp_production_views.xml | 2 +- addons/stock/models/stock_picking.py | 1 + addons/stock/views/stock_picking_views.xml | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/addons/mrp/models/mrp_production.py b/addons/mrp/models/mrp_production.py index a5559383e4e..1f574c1d24e 100644 --- a/addons/mrp/models/mrp_production.py +++ b/addons/mrp/models/mrp_production.py @@ -526,7 +526,7 @@ class MrpProduction(models.Model): raw_moves = production.move_raw_ids.filtered(lambda x: x.state not in ('done', 'cancel')) (finish_moves | raw_moves)._action_cancel() - self.write({'state': 'cancel'}) + self.write({'state': 'cancel', 'is_locked': True}) return True def _cal_price(self, consumed_moves): diff --git a/addons/mrp/views/mrp_production_views.xml b/addons/mrp/views/mrp_production_views.xml index 0a714385fcd..b57b172ad4f 100644 --- a/addons/mrp/views/mrp_production_views.xml +++ b/addons/mrp/views/mrp_production_views.xml @@ -48,7 +48,7 @@