[FIX] stock: scrap and validate

- Sell 4 units of a product in stock
- On the picking, create a scrap for 1 unit
- Validate
- In the immediate transfer wizard, validate

The scrap is reset to zero.

This is because the wizard overwrite the done quantity with the reserved
quantity (0.0).

If the move is already done, there is no reason to overwrite the
quantity.

opw-1958514

closes odoo/odoo#32410

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
Nicolas Martinelli
2019-04-04 09:19:23 +00:00
parent 82d733d68c
commit f1744a31a1
@@ -22,7 +22,7 @@ class StockImmediateTransfer(models.TransientModel):
picking.action_assign()
if picking.state != 'assigned':
raise UserError(_("Could not reserve all requested products. Please use the \'Mark as Todo\' button to handle the reservation manually."))
for move in picking.move_lines:
for move in picking.move_lines.filtered(lambda m: m.state not in ['done', 'cancel']):
for move_line in move.move_line_ids:
move_line.qty_done = move_line.product_uom_qty
if picking._check_backorder():