Skip to content

Commit e362bb1

Browse files
committed
Merge PR #198 into 17.0
Signed-off-by pedrobaeza
2 parents f9ddffb + 436e424 commit e362bb1

File tree

1 file changed

+9
-17
lines changed

1 file changed

+9
-17
lines changed

Diff for: product_pack/models/product_pricelist.py

+9-17
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
class Pricelist(models.Model):
55
_inherit = "product.pricelist"
66

7-
def _get_product_price(self, product, quantity, uom=None, date=False, **kwargs):
7+
def _get_product_price(self, product, *args, **kwargs):
88
"""Compute the pricelist price for the specified pack product, qty & uom.
99
1010
:returns: unit price of the pack product + components,
@@ -20,32 +20,24 @@ def _get_product_price(self, product, quantity, uom=None, date=False, **kwargs):
2020
):
2121
pack_price = 0
2222
else:
23-
pack_price = self._compute_price_rule(
24-
product, quantity, uom=uom, date=date, **kwargs
25-
)[product.id][0]
23+
pack_price = self._compute_price_rule(product, *args, **kwargs)[
24+
product.id
25+
][0]
2626

2727
for line in product.sudo().pack_line_ids:
28-
pack_price += line._get_pack_line_price(
29-
self, quantity, uom=uom, date=date, **kwargs
30-
)
28+
pack_price += line._get_pack_line_price(self, *args, **kwargs)
3129
return pack_price
3230
else:
33-
return super()._get_product_price(
34-
product=product, quantity=quantity, uom=uom, date=date, **kwargs
35-
)
31+
return super()._get_product_price(product, *args, **kwargs)
3632

37-
def _get_products_price(self, products, quantity, uom=None, date=False, **kwargs):
33+
def _get_products_price(self, products, *args, **kwargs):
3834
"""Compute the pricelist price for the specified pack product, qty & uom.
3935
4036
:returns: unit price of the pack product + components,
4137
considering pricelist rules
4238
"""
4339
packs, no_packs = products.split_pack_products()
44-
res = super()._get_products_price(
45-
no_packs, quantity=quantity, uom=uom, date=date, **kwargs
46-
)
40+
res = super()._get_products_price(no_packs, *args, **kwargs)
4741
for pack in packs:
48-
res[pack.id] = self._get_product_price(
49-
product=pack, quantity=quantity, uom=uom, date=date, **kwargs
50-
)
42+
res[pack.id] = self._get_product_price(pack, *args, **kwargs)
5143
return res

0 commit comments

Comments
 (0)