diff --git a/product.py b/product.py index 0ff6d703a0..fbc76892a2 100644 --- a/product.py +++ b/product.py @@ -144,21 +144,22 @@ class Product(metaclass=PoolMeta): user = User(Transaction().user) for product in products: - prices[product.id] = product._get_sale_unit_price( - quantity=quantity) - if uom and product.default_uom.category == uom.category: - prices[product.id] = Uom.compute_price( - product.default_uom, prices[product.id], uom) - else: - prices[product.id] = Uom.compute_price( - product.default_uom, prices[product.id], product.sale_uom) - if currency and user.company: + unit_price = product._get_sale_unit_price(quantity=quantity) + if unit_price is not None: + if uom and product.default_uom.category == uom.category: + unit_price = Uom.compute_price( + product.default_uom, unit_price, uom) + else: + unit_price = Uom.compute_price( + product.default_uom, unit_price, product.sale_uom) + if currency and user.company and unit_price is not None: if user.company.currency != currency: date = Transaction().context.get('sale_date') or today with Transaction().set_context(date=date): - prices[product.id] = Currency.compute( - user.company.currency, prices[product.id], + unit_price = Currency.compute( + user.company.currency, unit_price, currency, round=False) + prices[product.id] = unit_price return prices @property diff --git a/sale.py b/sale.py index 1e34d4b57b..1e8b845d22 100644 --- a/sale.py +++ b/sale.py @@ -1310,7 +1310,7 @@ class SaleLine(TaxableMixin, sequence_ordered(), ModelSQL, ModelView): self._get_context_sale_price()): unit_price = Product.get_sale_price([self.product], self.quantity or 0)[self.product.id] - if unit_price: + if unit_price is not None: unit_price = round_price(unit_price) return unit_price