diff --git a/move.py b/move.py index 5a9ed2410a..4dc3d9277d 100644 --- a/move.py +++ b/move.py @@ -474,10 +474,12 @@ class Move(Workflow, ModelSQL, ModelView): return ((from_type != 'storage' and to_type == 'storage') or (from_type == 'storage' and to_type != 'storage')) - @fields.depends('from_location') + @fields.depends('from_location', 'quantity') def on_change_with_assignation_required(self, name=None): if self.from_location: - return self.from_location.type in {'storage', 'view'} + return ( + self.quantity + and self.from_location.type in {'storage', 'view'}) @staticmethod def _get_shipment(): diff --git a/shipment.py b/shipment.py index 718642a4de..3558155449 100644 --- a/shipment.py +++ b/shipment.py @@ -1249,6 +1249,9 @@ class ShipmentOut(ShipmentAssignMixin, Workflow, ModelSQL, ModelView): def pick(cls, shipments): pool = Pool() Move = pool.get('stock.move') + Move.delete([ + m for s in shipments for m in s.inventory_moves + if m.state == 'staging']) Move.do([m for s in shipments for m in s.inventory_moves]) cls._sync_inventory_to_outgoing(shipments, quantity=True) @@ -1350,6 +1353,9 @@ class ShipmentOut(ShipmentAssignMixin, Workflow, ModelSQL, ModelView): Move = pool.get('stock.move') Date = pool.get('ir.date') + Move.delete([ + m for s in shipments for m in s.outgoing_moves + if m.state == 'staging']) Move.do([m for s in shipments for m in s.outgoing_moves]) cls.write([s for s in shipments if not s.effective_date], { 'effective_date': Date.today(),