Add patch for issue 4828

This commit is contained in:
Guillem Barba 2015-07-22 13:58:59 +02:00
parent 667aed8957
commit c460afc4c0
2 changed files with 66 additions and 0 deletions

65
issue18361002_40001.diff Normal file
View File

@ -0,0 +1,65 @@
# HG changeset patch
# User Guillem Barba <guillembarba@gmail.com>
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

1
series
View File

@ -59,3 +59,4 @@ issue20301003_1.diff
#invoice_speedup.diff
babi_multiprocess.diff
domain_field.diff
issue18361002_40001.diff