-
-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX] sale_product_pack: pack price detailed in components
- Loading branch information
1 parent
e084208
commit 182a5d6
Showing
2 changed files
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
) |