Skip to content
Permalink
Browse files

[FIX] mrp: delete only needed lines

workorder lines are deleted once their quantity is transfered into stock.move.lines. 
This commit ensure we only unlink lines that are empty.
  • Loading branch information...
Whenrow committed Mar 19, 2019
1 parent 8126a17 commit d4dc9ed5aaa5468f9b757e183afb4bf2614caf15
Showing with 4 additions and 1 deletion.
  1. +4 −1 addons/mrp/models/mrp_abstract_workorder.py
@@ -223,7 +223,9 @@ def _update_raw_moves(self):
if float_compare(line.qty_done, 0, precision_rounding=line.product_uom_id.rounding) > 0:
vals_list += line._create_extra_move_lines()

self.workorder_line_ids.unlink()
self.workorder_line_ids.filtered(
lambda line: float_is_zero(line.qty_done, precision_rounding=line.product_uom_id.rounding)
).unlink()
self.env['stock.move.line'].create(vals_list)


@@ -360,6 +362,7 @@ def _create_extra_move_lines(self):
if self.lot_id:
vals.update({'lot_id': self.lot_id.id})

self.qty_done = 0
vals_list.append(vals)

return vals_list

0 comments on commit d4dc9ed

Please sign in to comment.
You can’t perform that action at this time.