Allow to change the destination of internal shipment's moves

issue4828
review18361002
This commit is contained in:
Guillem Barba committed 2015-07-28 08:14:03 +02:00
1 parent 827e5cc1c1
commit 5ad1b76d16
2 files changed
+24 -10

No files matched your search

+1
View File
@@ -1,3 +1,4 @@
* Allow to change the destination of internal shipment's moves
* Allow to modify internal shipment moves in waiting state
* Compute inventory lines in complete_lines() using new grouping() method
* Allow to re-compute cost price
+23 -10
View File
@@ -1784,9 +1784,15 @@ class ShipmentInternal(Workflow, ModelSQL, ModelView):
| ~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',
@@ -1933,13 +1939,6 @@ class ShipmentInternal(Workflow, ModelSQL, ModelView):
@ModelView.button
@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])
@@ -1951,6 +1950,20 @@ class ShipmentInternal(Workflow, ModelSQL, ModelView):
'planned_date': shipment.planned_date,
})
@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])
moves = []
for shipment in shipments:
for move in shipment.moves:
if move.state != 'done':
move.planned_date = shipment.planned_date
moves.append(move)
Move.save(moves)
@classmethod
@Workflow.transition('assigned')
def assign(cls, shipments):