diff --git a/modules/purchase_blanket_agreement/purchase.py b/modules/purchase_blanket_agreement/purchase.py index 559bc8598c..65c2760a36 100644 --- a/modules/purchase_blanket_agreement/purchase.py +++ b/modules/purchase_blanket_agreement/purchase.py @@ -837,9 +837,10 @@ class Line(metaclass=PoolMeta): pool = Pool() Uom = pool.get('product.uom') if self.unit.category == line.unit.category: - return Uom.compute_qty( - self.unit, (self.actual_quantity or self.quantity), line.unit, - round=round) + quantity = ( + self.actual_quantity if self.actual_quantity is not None + else self.quantity) + return Uom.compute_qty(self.unit, quantity, line.unit, round=round) return 0 diff --git a/modules/purchase_secondary_unit/purchase.py b/modules/purchase_secondary_unit/purchase.py index 13ebf31e6b..caed97a5e6 100644 --- a/modules/purchase_secondary_unit/purchase.py +++ b/modules/purchase_secondary_unit/purchase.py @@ -359,8 +359,11 @@ class LineBlanketAgreement(metaclass=PoolMeta): quantity = super().quantity_for_blanket_agreement(line, round=round) if (self.secondary_unit and self.secondary_unit.category == line.unit.category): + purchase_line_quantity = ( + self.actual_quantity if self.actual_quantity is not None + else self.quantity) quantity = Uom.compute_qty( - self.unit, (self.actual_quantity or self.quantity), line.unit, + self.unit, purchase_line_quantity, line.unit, factor=self.secondary_uom_factor, rate=self.secondary_uom_rate, round=round) diff --git a/modules/sale_blanket_agreement/sale.py b/modules/sale_blanket_agreement/sale.py index 39f2242d12..6eee5426e7 100644 --- a/modules/sale_blanket_agreement/sale.py +++ b/modules/sale_blanket_agreement/sale.py @@ -773,9 +773,10 @@ class Line(metaclass=PoolMeta): pool = Pool() Uom = pool.get('product.uom') if self.unit.category == line.unit.category: - return Uom.compute_qty( - self.unit, (self.actual_quantity or self.quantity), line.unit, - round=round) + quantity = ( + self.actual_quantity if self.actual_quantity is not None + else self.quantity) + return Uom.compute_qty(self.unit, quantity, line.unit, round=round) return 0 diff --git a/modules/sale_secondary_unit/sale.py b/modules/sale_secondary_unit/sale.py index 5ba76ae163..33bd7c5f85 100644 --- a/modules/sale_secondary_unit/sale.py +++ b/modules/sale_secondary_unit/sale.py @@ -308,8 +308,11 @@ class LineBlanketAgreement(metaclass=PoolMeta): quantity = super().quantity_for_blanket_agreement(line, round=round) if (self.secondary_unit and self.secondary_unit.category == line.unit.category): + sale_line_quantity = ( + self.actual_quantity if self.actual_quantity is not None + else self.quantity) quantity = Uom.compute_qty( - self.unit, (self.actual_quantity or self.quantity), line.unit, + self.unit, sale_line_quantity, line.unit, factor=self.secondary_uom_factor, rate=self.secondary_uom_rate, round=round)