changeset b073e3b07d1c in modules/product_kit:6.0
details: 
https://hg.tryton.org/modules/product_kit?cmd=changeset&node=b073e3b07d1c
description:
        Use planned shipping and delivery date for move planned date

        issue11185
        review364701002
        (grafted from a9bc9a58f16c01e591636107bb934d9d31409c64)
diffstat:

 purchase.py |  12 +-----------
 sale.py     |  12 +-----------
 2 files changed, 2 insertions(+), 22 deletions(-)

diffs (58 lines):

diff -r ab6d8621619c -r b073e3b07d1c purchase.py
--- a/purchase.py       Fri Oct 15 17:26:59 2021 +0200
+++ b/purchase.py       Sun Jan 30 13:14:44 2022 +0100
@@ -67,7 +67,6 @@
         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 @@
             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 -r ab6d8621619c -r b073e3b07d1c sale.py
--- a/sale.py   Fri Oct 15 17:26:59 2021 +0200
+++ b/sale.py   Sun Jan 30 13:14:44 2022 +0100
@@ -68,7 +68,6 @@
         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 @@
             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
 

Reply via email to