Skip to content

Commit

Permalink
[FIX] product_pack: include product pack price
Browse files Browse the repository at this point in the history
  • Loading branch information
ALopez-Adhoc committed Dec 2, 2024
1 parent c2f1367 commit 3a375ce
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 27 deletions.
4 changes: 2 additions & 2 deletions product_pack/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@ The options of this field are the followings:
| **Detailed per components** | Yes, with their prices | Components + Pack | Applies to the price of the pack and | Yes, configurable |
| | | | the components | |
+-----------------------------+-----------------------------+---------------------------------+-----------------------------------------+----------------------+
| **Detailed - Totalized** | Yes, with their prices at 0 | Components | Applies to the total (pack + components)| No |
| **Detailed - Totalized** | Yes, with their prices at 0 | Components + Pack | Applies to the total (pack + components)| No |
+-----------------------------+-----------------------------+---------------------------------+-----------------------------------------+----------------------+
| **Detailed - Ignored** | Yes, with their prices at 0 | Only Pack | Applies to the pack | No |
+-----------------------------+-----------------------------+---------------------------------+-----------------------------------------+----------------------+
| **No detailed** | No | Components | Applies to the total (pack + components)| No |
| **No detailed** | No | Components + Pack | Applies to the total (pack + components)| No |
+-----------------------------+-----------------------------+---------------------------------+-----------------------------------------+----------------------+

**Note:** If pricelist enabled, Odoo will display the price according to the corresponding pricelist. In the case of a pricelist with discount policy "Show public price & discount to the customer" keep in mind that the "Non Detailed" and "Detailed - Totalized in main product" packs do not display the discount.
Expand Down
15 changes: 3 additions & 12 deletions product_pack/models/product_pricelist.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,9 @@ def _get_product_price(self, product, quantity, uom=None, date=False, **kwargs):
"""
self and self.ensure_one()
if product._is_pack_to_be_handled():
# NOTE: This exception is to avoid adding the list price of the packs
# "totalized" and "non detailed". Should be removed to solve the issue #169.
if (
product.pack_type == "non_detailed"
or product.pack_component_price == "totalized"
):
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, quantity, uom=uom, date=date, **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
Expand Down
12 changes: 1 addition & 11 deletions product_pack/models/product_product.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,7 @@ def _compute_product_lst_price(self):
if uom:
uom = self.env["uom.uom"].browse([uom])
for product in packs:
# NOTE: This exception is to avoid adding the list price of the packs
# "totalized" and "non detailed". Should be removed to solve the issue #169.
if (
product.pack_type == "non_detailed"
or product.pack_component_price == "totalized"
):
list_price = 0
else:
list_price = product._price_compute("list_price", uom=uom).get(
product.id
)
list_price = product.price_compute("list_price", uom=uom).get(product.id)
list_price += sum(
product.pack_line_ids._pack_line_price_compute(
"list_price", uom=uom
Expand Down
4 changes: 2 additions & 2 deletions product_pack/readme/USAGE.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ The options of this field are the followings:
| **Detailed per components** | Yes, with their prices | Components + Pack | Applies to the price of the pack and | Yes, configurable |
| | | | the components | |
+-----------------------------+-----------------------------+---------------------------------+-----------------------------------------+----------------------+
| **Detailed - Totalized** | Yes, with their prices at 0 | Components | Applies to the total (pack + components)| No |
| **Detailed - Totalized** | Yes, with their prices at 0 | Components + Pack | Applies to the total (pack + components)| No |
+-----------------------------+-----------------------------+---------------------------------+-----------------------------------------+----------------------+
| **Detailed - Ignored** | Yes, with their prices at 0 | Only Pack | Applies to the pack | No |
+-----------------------------+-----------------------------+---------------------------------+-----------------------------------------+----------------------+
| **No detailed** | No | Components | Applies to the total (pack + components)| No |
| **No detailed** | No | Components + Pack | Applies to the total (pack + components)| No |
+-----------------------------+-----------------------------+---------------------------------+-----------------------------------------+----------------------+

**Note:** If pricelist enabled, Odoo will display the price according to the corresponding pricelist. In the case of a pricelist with discount policy "Show public price & discount to the customer" keep in mind that the "Non Detailed" and "Detailed - Totalized in main product" packs do not display the discount.

0 comments on commit 3a375ce

Please sign in to comment.