From 77b449fd008a69dc63de4cfb8ecc332fa7180f90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 30 Jan 2022 13:14:44 +0100 Subject: [PATCH] Use planned shipping and delivery date for move planned date issue11185 review364701002 (grafted from a9bc9a58f16c01e591636107bb934d9d31409c64) --HG-- branch : 6.0 --- purchase.py | 12 +----------- sale.py | 12 +----------- 2 files changed, 2 insertions(+), 22 deletions(-) diff --git a/purchase.py b/purchase.py index 526b2b1f24..1fcfcd7602 100644 --- a/purchase.py +++ b/purchase.py @@ -67,7 +67,6 @@ class LineComponent( from trytond.modules.purchase.exceptions import PartyLocationError pool = Pool() Move = pool.get('stock.move') - Date = pool.get('ir.date') if (self.quantity >= 0) != (move_type == 'in'): return @@ -98,16 +97,7 @@ class LineComponent( move.unit_price = round_price( self.line.unit_price * self.price_ratio) move.currency = self.line.purchase.currency - if self.moves: - # backorder can not be planned but shipping date could be used - # if set in the future - if (self.line.delivery_date - and self.line.delivery_date > Date.today()): - move.planned_date = self.line.shipping_date - else: - move.planned_date = None - else: - move.planned_date = self.line.delivery_date + move.planned_date = self.line.planned_delivery_date move.origin = self return move diff --git a/sale.py b/sale.py index 4c42dab012..47a564ca17 100644 --- a/sale.py +++ b/sale.py @@ -68,7 +68,6 @@ class LineComponent( from trytond.modules.sale.exceptions import PartyLocationError pool = Pool() Move = pool.get('stock.move') - Date = pool.get('ir.date') if (shipment_type == 'out') != (self.quantity >= 0): return @@ -98,16 +97,7 @@ class LineComponent( move.unit_price = round_price( self.line.unit_price * self.price_ratio) move.currency = self.line.sale.currency - if self.moves: - # backorder can not be planned but shipping date could be used - # if set in the future - today = Date.today() - if self.line.shipping_date and self.line.shipping_date > today: - move.planned_date = self.line.shipping_date - else: - move.planned_date = today - else: - move.planned_date = self.line.shipping_date + move.planned_date = self.line.planned_shipping_date move.origin = self return move