[FIX] stock: remove empty move line

_set_quantity_done_prepare_vals is call to (re)create move line
during some onchange/compute. But it never removed empty line.
Then remove empty line (when no reserved quantity and no done quantity)

task-2278147

X-original-commit: a1ab74d6cd75cee64fcd432d387180299fd64c72
This commit is contained in:
Rémy Voet (ryv)
2020-07-16 13:02:13 +00:00
committed by Arnold Moyaux
parent 09fa76afff
commit 8a8d5eba09
+5
View File
@@ -1570,6 +1570,11 @@ class StockMove(models.Model):
if float_compare(qty, 0.0, precision_rounding=self.product_uom.rounding) <= 0:
break
for ml in self.move_line_ids:
if float_is_zero(ml.product_uom_qty, precision_rounding=ml.product_uom_id.rounding) and float_is_zero(ml.qty_done, precision_rounding=ml.product_uom_id.rounding):
res.append((2, ml.id))
if float_compare(qty, 0.0, precision_rounding=self.product_uom.rounding) > 0:
if self.product_id.tracking != 'serial':
vals = self._prepare_move_line_vals(quantity=0)