From c7ca783e242ba7963fbb847cb53c3b9be9203936 Mon Sep 17 00:00:00 2001 From: Pierre Masereel Date: Mon, 9 Oct 2017 11:51:57 +0200 Subject: [PATCH] [FIX] stock: picking action_cancel multi As the function 'action_cancel' is multi, we cannot set the value 'is_locked' to True by using '='. Because it will raise an error if self contains more or less than 1 record. To fix this we call the 'write' method which support all cases --- addons/stock/models/stock_picking.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/stock/models/stock_picking.py b/addons/stock/models/stock_picking.py index bc543eecc6f..33faf25e3b7 100644 --- a/addons/stock/models/stock_picking.py +++ b/addons/stock/models/stock_picking.py @@ -543,7 +543,7 @@ class Picking(models.Model): @api.multi def action_cancel(self): self.mapped('move_lines')._action_cancel() - self.is_locked = True + self.write({'is_locked': True}) return True @api.multi