diff --git a/stock.py b/stock.py index 96ba0d1cd3..c7d4b8ad90 100644 --- a/stock.py +++ b/stock.py @@ -51,6 +51,8 @@ class Move(metaclass=PoolMeta): config = Configuration(1) transit_locations = {} for move in moves: + if move.state in {'staging', 'draft'}: + continue company = move.company if company not in transit_locations: transit_location = config.get_multivalue( diff --git a/tests/scenario_product_cost_warehouse.rst b/tests/scenario_product_cost_warehouse.rst index b67e1da97c..9e36ae9663 100644 --- a/tests/scenario_product_cost_warehouse.rst +++ b/tests/scenario_product_cost_warehouse.rst @@ -139,10 +139,13 @@ Forbid direct move between warehouses:: >>> move.quantity = 1 >>> move.from_location = warehouse1.storage_location >>> move.to_location = warehouse2.storage_location - >>> move.save() # doctest: +IGNORE_EXCEPTION_DETAIL + >>> move.save() + >>> move.click('do') # doctest: +IGNORE_EXCEPTION_DETAIL Traceback (most recent call last): ... MoveValidationError: ... >>> move.to_location = transit - >>> move.save() + >>> move.click('do') + >>> move.state + 'done'