From 3260b80cd84fe1bd902ad98e2a34661e1d9c0395 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 6 Mar 2020 23:53:19 +0100 Subject: [PATCH] Fill planned date for inventory move Shipments that create inventory moves should fill a planned date for them as we have a method to compute it. The probability is high to inventory the product once received. issue9043 review272871002 --- shipment.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/shipment.py b/shipment.py index ded5b97b5c..42b9f8252b 100644 --- a/shipment.py +++ b/shipment.py @@ -377,6 +377,7 @@ class ShipmentIn(ShipmentMixin, Workflow, ModelSQL, ModelView): 'Return inventory move for the incoming move' pool = Pool() Move = pool.get('stock.move') + Date = pool.get('ir.date') if incoming_move.quantity <= 0.0: return None move = Move() @@ -386,9 +387,7 @@ class ShipmentIn(ShipmentMixin, Workflow, ModelSQL, ModelView): move.from_location = incoming_move.to_location move.to_location = self.warehouse_storage move.state = Move.default_state() - # Product will be considered in stock only when the inventory - # move will be made: - move.planned_date = None + move.planned_date = max(self._move_planned_date[1], Date.today()) move.company = incoming_move.company move.origin = incoming_move return move @@ -1716,6 +1715,7 @@ class ShipmentOutReturn(ShipmentMixin, Workflow, ModelSQL, ModelView): 'Return inventory move for the incoming move' pool = Pool() Move = pool.get('stock.move') + Date = pool.get('ir.date') if incoming_move.quantity <= 0.0: return move = Move() @@ -1725,9 +1725,7 @@ class ShipmentOutReturn(ShipmentMixin, Workflow, ModelSQL, ModelView): move.from_location = incoming_move.to_location move.to_location = self.warehouse_storage move.state = Move.default_state() - # Product will be considered in stock only when the inventory - # move will be made: - move.planned_date = None + move.planned_date = max(self._get_move_planned_date[1], Date.today()) move.company = incoming_move.company move.origin = incoming_move return move