[FIX] stock: multiple validation pick empty picking
Usecase to reproduce: - Create a picking with available quantity and another without - Confirm both picking - In list view, select the two picking and use the validate action Expected behavior: The first picking is validated and the second has been untouched Current behavior: The second picking is picked. That will prevent any further reservation It happens because on multiple records the error message for empty picking is bypassed and the picked is applied on it. Close #153983 closes odoo/odoo#155039 Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
This commit is contained in:
@@ -1173,7 +1173,16 @@ class Picking(models.Model):
|
||||
|
||||
def _pre_action_done_hook(self):
|
||||
for picking in self:
|
||||
if all(not move.picked for move in picking.move_ids):
|
||||
has_quantity = False
|
||||
has_pick = False
|
||||
for move in picking.move_ids:
|
||||
if move.picked:
|
||||
has_pick = True
|
||||
if move.quantity:
|
||||
has_quantity = True
|
||||
if has_quantity and has_pick:
|
||||
break
|
||||
if has_quantity and not has_pick:
|
||||
picking.move_ids.picked = True
|
||||
if not self.env.context.get('skip_backorder'):
|
||||
pickings_to_backorder = self._check_backorder()
|
||||
|
||||
Reference in New Issue
Block a user