changeset 75556470974c in modules/purchase:default
details: https://hg.tryton.org/modules/purchase?cmd=changeset;node=75556470974c
description:
        Preserve original delivery date on backorders from future shipping

        issue8284
        review283401004
diffstat:

 purchase.py |  9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diffs (26 lines):

diff -r 2feb8dc28c32 -r 75556470974c purchase.py
--- a/purchase.py       Wed May 22 18:37:08 2019 +0200
+++ b/purchase.py       Wed Jun 05 09:57:35 2019 +0200
@@ -1437,6 +1437,7 @@
         '''
         pool = Pool()
         Move = pool.get('stock.move')
+        Date = pool.get('ir.date')
 
         if self.type != 'line':
             return
@@ -1471,8 +1472,12 @@
         move.unit_price = self.unit_price
         move.currency = self.purchase.currency
         if self.moves:
-            # backorder can not be planned
-            move.planned_date = None
+            # backorder can not be planned but delivery date could be used
+            # if set in the future
+            if self.delivery_date and self.delivery_date > Date.today():
+                move.planned_date = self.delivery_date
+            else:
+                move.planned_date = None
         else:
             move.planned_date = self.delivery_date
         move.invoice_lines = self._get_move_invoice_lines(move_type)

Reply via email to