changeset 91ce7eb1205c in modules/stock:6.0
details: https://hg.tryton.org/modules/stock?cmd=changeset&node=91ce7eb1205c
description:
Set effective date of outgoing moves to effective start date
The outgoing moves of an internal shipment with transit must use the
effective
start date when done.
issue11337
review397651002
(grafted from 8536360509ed74b63390ff550684510c2367ead7)
diffstat:
move.py | 7 ++++++-
tests/scenario_stock_shipment_internal.rst | 5 +++++
2 files changed, 11 insertions(+), 1 deletions(-)
diffs (42 lines):
diff -r 5a9de56af833 -r 91ce7eb1205c move.py
--- a/move.py Sat Apr 02 00:01:46 2022 +0200
+++ b/move.py Sun Apr 03 23:54:13 2022 +0200
@@ -618,8 +618,13 @@
def set_effective_date(self):
pool = Pool()
Date = pool.get('ir.date')
+ ShipmentInternal = pool.get('stock.shipment.internal')
- if not self.effective_date and self.shipment:
+ if (not self.effective_date
+ and isinstance(self.shipment, ShipmentInternal)
+ and self.to_location == self.shipment.transit_location):
+ self.effective_date = self.shipment.effective_start_date
+ elif not self.effective_date and self.shipment:
self.effective_date = self.shipment.effective_date
if not self.effective_date:
self.effective_date = Date.today()
diff -r 5a9de56af833 -r 91ce7eb1205c tests/scenario_stock_shipment_internal.rst
--- a/tests/scenario_stock_shipment_internal.rst Sat Apr 02 00:01:46
2022 +0200
+++ b/tests/scenario_stock_shipment_internal.rst Sun Apr 03 23:54:13
2022 +0200
@@ -181,15 +181,20 @@
>>> shipment.click('assign_try')
True
+ >>> shipment.effective_start_date = yesterday
>>> shipment.click('ship')
>>> incoming_move, = shipment.incoming_moves
>>> incoming_move.quantity
1.0
>>> shipment.outgoing_moves[0].state
'done'
+ >>> shipment.outgoing_moves[0].effective_date == yesterday
+ True
>>> shipment.click('done')
>>> shipment.incoming_moves[0].state
'done'
+ >>> shipment.incoming_moves[0].effective_date == today
+ True
Duplicate Internal Shipment::