diff --git a/CHANGELOG b/CHANGELOG index dd98a280b9..5f679393eb 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,4 @@ +* Add 'staging' state to stock move * Apply stock_assign of compute_quantity_query only on outgoing moves * Add domain on location's parent and childs * Do not filter out inactive products from stock computation diff --git a/doc/index.rst b/doc/index.rst index 8c92d51ac9..bc2fb0c4fa 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -82,6 +82,11 @@ A move can be in one of this states: Assigned move can be cancelled. To revert a move in state Done, an opposite move must be created. +* Staging + + A phantom state used to create in advance move that should not be taken for + stock computation. + Product Quantities ++++++++++++++++++ diff --git a/move.py b/move.py index fdc35a312c..678b4a5e71 100644 --- a/move.py +++ b/move.py @@ -195,6 +195,7 @@ class Move(Workflow, ModelSQL, ModelView): }, depends=['state']) state = fields.Selection([ + ('staging', 'Staging'), ('draft', 'Draft'), ('assigned', 'Assigned'), ('done', 'Done'), @@ -266,6 +267,7 @@ class Move(Workflow, ModelSQL, ModelView): 'no_origin': 'The stock move "%s" has no origin.', }) cls._transitions |= set(( + ('staging', 'draft'), ('draft', 'assigned'), ('draft', 'done'), ('draft', 'cancel'), @@ -640,7 +642,8 @@ class Move(Workflow, ModelSQL, ModelView): vlist = [x.copy() for x in vlist] for vals in vlist: - assert vals.get('state', 'draft') == 'draft' + assert vals.get('state', cls.default_state() + ) in ['draft', 'staging'] product = Product(vals['product']) uom = Uom(vals['uom']) diff --git a/shipment.py b/shipment.py index 91273a9415..bd267e8da9 100644 --- a/shipment.py +++ b/shipment.py @@ -1080,6 +1080,7 @@ class ShipmentOut(Workflow, ModelSQL, ModelView): company=move.company, currency=move.currency, unit_price=move.unit_price, + state='staging' if move.state == 'staging' else 'draft', ) @classmethod