changeset 40fe4e26830d in modules/stock:default
details: https://hg.tryton.org/modules/stock?cmd=changeset;node=40fe4e26830d
description:
Allow move as move's origin
issue8253
review269251028
diffstat:
CHANGELOG | 1 +
move.py | 6 +++---
shipment.py | 3 +++
tests/scenario_stock_shipment_out.rst | 6 ++++++
4 files changed, 13 insertions(+), 3 deletions(-)
diffs (68 lines):
diff -r cecf3090783d -r 40fe4e26830d CHANGELOG
--- a/CHANGELOG Mon Jul 08 17:10:34 2019 +0200
+++ b/CHANGELOG Mon Jul 08 17:18:14 2019 +0200
@@ -1,3 +1,4 @@
+* Allow move as move's origin
* Open product quantities by warehouse to show moves
Version 5.2.0 - 2019-05-06
diff -r cecf3090783d -r 40fe4e26830d move.py
--- a/move.py Mon Jul 08 17:10:34 2019 +0200
+++ b/move.py Mon Jul 08 17:18:14 2019 +0200
@@ -415,10 +415,10 @@
])
return [(None, '')] + [(m.model, m.name) for m in models]
- @staticmethod
- def _get_origin():
+ @classmethod
+ def _get_origin(cls):
'Return list of Model names for origin Reference'
- return ['stock.inventory.line']
+ return [cls.__name__, 'stock.inventory.line']
@classmethod
def get_origin(cls):
diff -r cecf3090783d -r 40fe4e26830d shipment.py
--- a/shipment.py Mon Jul 08 17:10:34 2019 +0200
+++ b/shipment.py Mon Jul 08 17:18:14 2019 +0200
@@ -394,6 +394,7 @@
# move will be made:
move.planned_date = None
move.company = incoming_move.company
+ move.origin = incoming_move
return move
@classmethod
@@ -1123,6 +1124,7 @@
company=move.company,
currency=move.currency,
unit_price=move.unit_price,
+ origin=move,
state='staging' if move.state == 'staging' else 'draft',
)
@@ -1746,6 +1748,7 @@
# move will be made:
move.planned_date = None
move.company = incoming_move.company
+ move.origin = incoming_move
return move
@classmethod
diff -r cecf3090783d -r 40fe4e26830d tests/scenario_stock_shipment_out.rst
--- a/tests/scenario_stock_shipment_out.rst Mon Jul 08 17:10:34 2019 +0200
+++ b/tests/scenario_stock_shipment_out.rst Mon Jul 08 17:18:14 2019 +0200
@@ -108,6 +108,12 @@
2
>>> len(shipment_out.inventory_moves)
2
+ >>> sorted(
+ ... [m.origin for m in shipment_out.inventory_moves],
+ ... key=lambda m: m.id) == \
+ ... sorted(
+ ... [m for m in shipment_out.outgoing_moves], key=lambda m: m.id)
+ True
Make 1 unit of the product available::