From ec93032df8fef9441939cb6aaf690ab4492be65f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 24 Sep 2023 16:49:52 +0200 Subject: [PATCH] Restore get purchase unit price 2f25450e11f6 removes it but it is needed for purchase_price_list module. --- modules/purchase/product.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/purchase/product.py b/modules/purchase/product.py index e815459d0d..373a992e2d 100644 --- a/modules/purchase/product.py +++ b/modules/purchase/product.py @@ -213,6 +213,9 @@ class Product(metaclass=PoolMeta): pattern['product'] = None yield from self.template.product_suppliers_used(**pattern) + def _get_purchase_unit_price(self, quantity=0): + return + @classmethod def get_purchase_price(cls, products, quantity=0): ''' @@ -249,7 +252,7 @@ class Product(metaclass=PoolMeta): last_purchase_prices = cls.get_last_purchase_price_uom(products) for product in products: - unit_price = None + unit_price = product._get_purchase_unit_price(quantity=quantity) default_uom = product.default_uom default_currency = currency if not uom or default_uom.category != uom.category: @@ -277,9 +280,10 @@ class Product(metaclass=PoolMeta): unit_price = Currency.compute( default_currency, unit_price, currency, round=False) - unit_price = round_price(unit_price) if unit_price is None: unit_price = last_purchase_prices[product.id] + else: + unit_price = round_price(unit_price) prices[product.id] = unit_price return prices