From 6d1fb8ae6548a90a2d211a48e38e715109b2419a Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Fri, 3 Feb 2017 17:23:21 +0100 Subject: [PATCH] Unreserve before moving the quant, to avoid problems on the picking that booked the quant --- stock_quant_packages_moving_wizard/models/stock.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/stock_quant_packages_moving_wizard/models/stock.py b/stock_quant_packages_moving_wizard/models/stock.py index 8b0a56f1..a64d8ad5 100644 --- a/stock_quant_packages_moving_wizard/models/stock.py +++ b/stock_quant_packages_moving_wizard/models/stock.py @@ -29,6 +29,12 @@ def _prepare_move_to(self, dest_location): @api.one def move_to(self, dest_location): + # if the quant is reserved for another move, + # we should cleanly un-reserve it first, so that + # the picking that booked this quant comes back from + # available to waiting availability + if self.reservation_id: + self.reservation_id.do_unreserve() vals = self._prepare_move_to(dest_location) new_move = self.env['stock.move'].create(vals) # No group has write access on stock.quant -> we need sudo()