mirror of
https://github.com/NaN-tic/trytond-patches.git
synced 2023-12-14 06:03:03 +01:00
65 lines
2.3 KiB
Diff
65 lines
2.3 KiB
Diff
# 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
|
|
|