[IMP] stock_quant_manual_assign: make qty_done fill optional

There are cases where auto-filling of qty_done of stock move line is not desirable.
e.g. you assign quants manually for some of the moves in a picking and not the others,
in such case you need to go over all the moves in the picking to either remove qty_done
or fill it in to proceed with the validation of the entire moves. Auto-fill behavior is
also troublesome when this function is used in a manufacturing order. i.e. having
qty_done of the component move live messes up the outcome of the production.
This commit is contained in:
Yoshi Tashiro
2021-01-13 17:05:18 +08:00
committed by Alexis de Lattre
parent 4207ed7f71
commit ae5744c083
8 changed files with 58 additions and 3 deletions

View File

@@ -61,9 +61,10 @@ class AssignManualQuants(models.TransientModel):
move._do_unreserve()
for line in self.quants_lines:
line._assign_quant_line()
# Auto-fill all lines as done
for ml in move.move_line_ids:
ml.qty_done = ml.product_qty
if move.picking_type_id.auto_fill_qty_done:
# Auto-fill all lines as done
for ml in move.move_line_ids:
ml.qty_done = ml.product_qty
move._recompute_state()
move.mapped("picking_id")._compute_state()
return {}