diff --git a/issue18361002_40001.diff b/issue18361002_40001.diff new file mode 100644 index 0000000..b35f8dd --- /dev/null +++ b/issue18361002_40001.diff @@ -0,0 +1,65 @@ +# HG changeset patch +# User Guillem Barba +Allow to change the destination of internal shipment's moves + +issue4828 +review18361002 + +Index: shipment.py +=================================================================== + +--- a/trytond/trytond/modules/stock/shipment.py ++++ b/trytond/trytond/modules/stock/shipment.py +@@ -1784,9 +1784,15 @@ + | ~Eval('from_location') | ~Eval('to_location')), + }, + domain=[ +- ('from_location', 'child_of', [Eval('from_location', -1)], +- 'parent'), +- ('to_location', '=', Eval('to_location')), ++ If(Eval('state') == 'draft', [ ++ ('from_location', '=', Eval('from_location')), ++ ('to_location', '=', Eval('to_location')), ++ ], [ ++ ('from_location', 'child_of', [Eval('from_location', -1)], ++ 'parent'), ++ ('to_location', 'child_of', [Eval('to_location', -1)], ++ 'parent'), ++ ]), + ('company', '=', Eval('company')), + ], + depends=['state', 'from_location', 'to_location', 'planned_date', +@@ -1934,13 +1940,6 @@ + @Workflow.transition('draft') + def draft(cls, shipments): + Move = Pool().get('stock.move') +- Move.draft([m for s in shipments for m in s.moves]) +- +- @classmethod +- @ModelView.button +- @Workflow.transition('waiting') +- def wait(cls, shipments): +- Move = Pool().get('stock.move') + # First reset state to draft to allow update from and to location + Move.draft([m for s in shipments for m in s.moves]) + for shipment in shipments: +@@ -1952,6 +1951,18 @@ + }) + + @classmethod ++ @ModelView.button ++ @Workflow.transition('waiting') ++ def wait(cls, shipments): ++ Move = Pool().get('stock.move') ++ Move.draft([m for s in shipments for m in s.moves]) ++ for shipment in shipments: ++ for move in shipment.moves: ++ if move.state != 'done': ++ move.planned_date = shipment.planned_date ++ move.save() ++ ++ @classmethod + @Workflow.transition('assigned') + def assign(cls, shipments): + pass + diff --git a/series b/series index 5dced76..f36d659 100644 --- a/series +++ b/series @@ -59,3 +59,4 @@ issue20301003_1.diff #invoice_speedup.diff babi_multiprocess.diff domain_field.diff +issue18361002_40001.diff