[FIX] mrp: fix the unbuild button

We get a traceback when we try to unbuild a MO
due to a inexistant field call (scrap_qty) instead
of product_qty -> 8458cc1867.
Fix the issue.

closes odoo/odoo#44249

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
This commit is contained in:
Rémy Voet (ryv)
2020-01-30 08:31:19 +00:00
parent f99c2520a9
commit 237afe8e50
+1 -1
View File
@@ -276,7 +276,7 @@ class MrpUnbuild(models.Model):
self.ensure_one()
precision = self.env['decimal.precision'].precision_get('Product Unit of Measure')
available_qty = self.env['stock.quant']._get_available_quantity(self.product_id, self.location_id, self.lot_id, strict=True)
unbuild_qty = self.product_uom_id._compute_quantity(self.scrap_qty, self.product_id.uom_id)
unbuild_qty = self.product_uom_id._compute_quantity(self.product_qty, self.product_id.uom_id)
if float_compare(available_qty, unbuild_qty, precision_digits=precision) >= 0:
return self.action_unbuild()
else: