changeset 8536360509ed in modules/stock:default
details: https://hg.tryton.org/modules/stock?cmd=changeset&node=8536360509ed
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
diffstat:
move.py | 7 ++++++-
tests/scenario_stock_shipment_internal.rst | 5 +++++
2 files changed, 11 insertions(+), 1 deletions(-)
diffs (42 lines):
diff -r 975715989ff8 -r 8536360509ed move.py
--- a/move.py Sat Apr 02 00:01:46 2022 +0200
+++ b/move.py Sun Apr 03 23:54:13 2022 +0200
@@ -609,8 +609,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:
with Transaction().set_context(company=self.company.id):
diff -r 975715989ff8 -r 8536360509ed 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::