[FIX] product: prevent ValueError when computing quantity on a void recordset
Invoice lines do not necessarily have a product and therefore an UoM set on them. You could then compute quantityes on a void recordset. In that case we just return the quantity untouched. This is actually the old behavior of compute_quantity that is set back. See https://github.com/odoo/odoo/blob/01279359b9e5340d5ecb15f0fee186f039356374/addons/product/product.py#L164 . Closes #16377
This commit is contained in:
committed by
Thibault Delavallée
parent
e2f3e8c4b7
commit
40e9b7563f
@@ -90,6 +90,8 @@ class ProductUoM(models.Model):
|
||||
|
||||
@api.multi
|
||||
def _compute_quantity(self, qty, to_unit, round=True, rounding_method='UP'):
|
||||
if not self:
|
||||
return qty
|
||||
self.ensure_one()
|
||||
if self.category_id.id != to_unit.category_id.id:
|
||||
if self._context.get('raise-exception', True):
|
||||
|
||||
Reference in New Issue
Block a user