mirror of
https://github.com/OCA/stock-logistics-warehouse.git
synced 2025-01-21 14:27:28 +02:00
Distinct full order picking
This commit is contained in:
committed by
Guewen Baconnier
parent
03cc9da743
commit
6c2d9f348b
@@ -22,13 +22,18 @@ class StockPicking(models.Model):
|
||||
('no', 'No'),
|
||||
(
|
||||
'last_picking',
|
||||
'Completion of this operation allows next operations to be '
|
||||
'processed.',
|
||||
'Last picking: Completion of this operation allows next '
|
||||
'operations to be processed.',
|
||||
),
|
||||
(
|
||||
'next_picking_ready',
|
||||
'Next operations are ready to be processed.',
|
||||
),
|
||||
(
|
||||
'full_order_picking',
|
||||
'Full order picking: You are processing a full order picking '
|
||||
'that will allow next operation to be processed'
|
||||
)
|
||||
],
|
||||
compute='_compute_completion_info',
|
||||
)
|
||||
@@ -50,9 +55,16 @@ class StockPicking(models.Model):
|
||||
depending_moves = picking.move_lines.mapped(
|
||||
'move_dest_ids.picking_id.move_lines.move_orig_ids'
|
||||
)
|
||||
# If all the depending moves are done or canceled then next picking
|
||||
# is ready to be processed
|
||||
if all(m.state in ('done', 'cancel') for m in depending_moves):
|
||||
picking.completion_info = 'next_picking_ready'
|
||||
continue
|
||||
# If all the depending moves are the moves on the actual picking
|
||||
# then it's a full order and next picking is ready to be processed
|
||||
if depending_moves == picking.move_lines:
|
||||
picking.completion_info = 'full_order_picking'
|
||||
continue
|
||||
# If there aren't any depending move from another picking that is
|
||||
# not done, then actual picking is the last to process
|
||||
other_depending_moves = (
|
||||
|
||||
@@ -134,12 +134,12 @@ class TestStockPickingCompletionInfo(SavepointCase):
|
||||
self.assertEqual(pick_move_1.state, 'confirmed')
|
||||
self.assertEqual(pick_move_2.state, 'confirmed')
|
||||
self.assertEqual(pick_order.state, 'confirmed')
|
||||
self.assertEqual(pick_order.completion_info, 'last_picking')
|
||||
self.assertEqual(pick_order.completion_info, 'full_order_picking')
|
||||
pick_order.action_assign()
|
||||
self.assertEqual(pick_move_1.state, 'assigned')
|
||||
self.assertEqual(pick_move_2.state, 'assigned')
|
||||
self.assertEqual(pick_order.state, 'assigned')
|
||||
self.assertEqual(pick_order.completion_info, 'last_picking')
|
||||
self.assertEqual(pick_order.completion_info, 'full_order_picking')
|
||||
wiz = self.env['stock.immediate.transfer'].create(
|
||||
{'pick_ids': [(4, pick_order.id)]}
|
||||
)
|
||||
@@ -223,12 +223,12 @@ class TestStockPickingCompletionInfo(SavepointCase):
|
||||
self.assertEqual(pick_move_1.state, 'confirmed')
|
||||
self.assertEqual(pick_move_2.state, 'confirmed')
|
||||
self.assertEqual(pick_order.state, 'confirmed')
|
||||
self.assertEqual(pick_order.completion_info, 'last_picking')
|
||||
self.assertEqual(pick_order.completion_info, 'full_order_picking')
|
||||
pick_order.action_assign()
|
||||
self.assertEqual(pick_move_1.state, 'assigned')
|
||||
self.assertEqual(pick_move_2.state, 'assigned')
|
||||
self.assertEqual(pick_order.state, 'assigned')
|
||||
self.assertEqual(pick_order.completion_info, 'last_picking')
|
||||
self.assertEqual(pick_order.completion_info, 'full_order_picking')
|
||||
# Process partially to create backorder
|
||||
pick_move_1.move_line_ids.qty_done = 1.0
|
||||
pick_move_2.move_line_ids.qty_done = \
|
||||
|
||||
@@ -24,6 +24,9 @@
|
||||
<div class="alert alert-warning" attrs="{'invisible': [('completion_info', '!=', 'last_picking')]}" role="alert">
|
||||
<field name="completion_info" nolabel="1" />
|
||||
</div>
|
||||
<div class="alert alert-primary" attrs="{'invisible': [('completion_info', '!=', 'full_order_picking')]}" role="alert">
|
||||
<field name="completion_info" nolabel="1" />
|
||||
</div>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
Reference in New Issue
Block a user