diff --git a/CHANGELOG b/CHANGELOG index 3513822d2d..5b3046923d 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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 --git a/move.py b/move.py index 5bc753497f..5fc8be64c0 100644 --- a/move.py +++ b/move.py @@ -415,10 +415,10 @@ class Move(Workflow, ModelSQL, ModelView): ]) 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 --git a/shipment.py b/shipment.py index 69be4291b5..8aa875c6e1 100644 --- a/shipment.py +++ b/shipment.py @@ -394,6 +394,7 @@ class ShipmentIn(Workflow, ModelSQL, ModelView): # move will be made: move.planned_date = None move.company = incoming_move.company + move.origin = incoming_move return move @classmethod @@ -1123,6 +1124,7 @@ class ShipmentOut(Workflow, ModelSQL, ModelView): 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 @@ class ShipmentOutReturn(Workflow, ModelSQL, ModelView): # move will be made: move.planned_date = None move.company = incoming_move.company + move.origin = incoming_move return move @classmethod diff --git a/tests/scenario_stock_shipment_out.rst b/tests/scenario_stock_shipment_out.rst index 647ec8c95f..3a13ff96fa 100644 --- a/tests/scenario_stock_shipment_out.rst +++ b/tests/scenario_stock_shipment_out.rst @@ -108,6 +108,12 @@ Set the shipment state to waiting:: 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::