Skip to content

Commit

Permalink
[FIX] sale_product_pack: pack price detailed in components
Browse files Browse the repository at this point in the history
  • Loading branch information
augusto-weiss committed Sep 7, 2023
1 parent e084208 commit 182a5d6
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions product_pack/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
from . import product_pack_line
from . import product_product
from . import product_template
from . import product_pricelist
23 changes: 23 additions & 0 deletions product_pack/models/product_pricelist.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from odoo import models


class PricelistItem(models.Model):
_inherit = "product.pricelist.item"

def _compute_price(self, product, quantity, uom, date, currency=None):
if product.pack_ok and self.compute_price == "fixed":
pricelist = self.pricelist_id
price = 0.0
for pack_line in product.sudo().pack_line_ids:
price += pricelist._get_product_price(
pack_line.product_id, pack_line.quantity
)
return price
else:
return super()._compute_price(
product=product,
quantity=quantity,
uom=uom,
date=date,
currency=currency,
)

0 comments on commit 182a5d6

Please sign in to comment.