From 1d34ed0777f8b16c42b1134dfb823010bdf1e3a5 Mon Sep 17 00:00:00 2001 From: mav-adhoc Date: Tue, 10 Dec 2024 17:07:23 -0300 Subject: [PATCH] [FIX] args in _get_product_price method --- product_pack/models/product_pricelist.py | 26 ++++++++---------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/product_pack/models/product_pricelist.py b/product_pack/models/product_pricelist.py index 8a42cf6b3..6ac821138 100644 --- a/product_pack/models/product_pricelist.py +++ b/product_pack/models/product_pricelist.py @@ -4,7 +4,7 @@ class Pricelist(models.Model): _inherit = "product.pricelist" - def _get_product_price(self, product, quantity, uom=None, date=False, **kwargs): + def _get_product_price(self, product, *args, **kwargs): """Compute the pricelist price for the specified pack product, qty & uom. :returns: unit price of the pack product + components, @@ -20,32 +20,24 @@ def _get_product_price(self, product, quantity, uom=None, date=False, **kwargs): ): pack_price = 0 else: - pack_price = self._compute_price_rule( - product, quantity, uom=uom, date=date, **kwargs - )[product.id][0] + pack_price = self._compute_price_rule(product, *args, **kwargs)[ + product.id + ][0] for line in product.sudo().pack_line_ids: - pack_price += line._get_pack_line_price( - self, quantity, uom=uom, date=date, **kwargs - ) + pack_price += line._get_pack_line_price(self, *args, **kwargs) return pack_price else: - return super()._get_product_price( - product=product, quantity=quantity, uom=uom, date=date, **kwargs - ) + return super()._get_product_price(product, *args, **kwargs) - def _get_products_price(self, products, quantity, uom=None, date=False, **kwargs): + def _get_products_price(self, products, *args, **kwargs): """Compute the pricelist price for the specified pack product, qty & uom. :returns: unit price of the pack product + components, considering pricelist rules """ packs, no_packs = products.split_pack_products() - res = super()._get_products_price( - no_packs, quantity=quantity, uom=uom, date=date, **kwargs - ) + res = super()._get_products_price(no_packs, *args, **kwargs) for pack in packs: - res[pack.id] = self._get_product_price( - product=pack, quantity=quantity, uom=uom, date=date, **kwargs - ) + res[pack.id] = self._get_product_price(pack, *args, **kwargs) return res