Skip to content

Commit

Permalink
[FIX] website_product_pack: detailed displayed components price on we…
Browse files Browse the repository at this point in the history
…bsite
  • Loading branch information
augusto-weiss authored and bruno-zanotti committed Jul 11, 2024
1 parent 0eaf236 commit 9d6cd98
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 0 deletions.
1 change: 1 addition & 0 deletions website_sale_product_pack/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
from . import models
from . import controllers
2 changes: 2 additions & 0 deletions website_sale_product_pack/controllers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import main
from . import variant
26 changes: 26 additions & 0 deletions website_sale_product_pack/controllers/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
from odoo.http import request

from odoo.addons.website_sale.controllers.main import WebsiteSale


class WebsiteSale(WebsiteSale):
def shop(
self,
page=0,
category=None,
search="",
min_price=0.0,
max_price=0.0,
ppg=False,
**post,
):
request.update_context(whole_pack_price=True)
return super().shop(
page=page,
category=category,
search=search,
min_price=min_price,
max_price=max_price,
ppg=ppg,
**post,
)
34 changes: 34 additions & 0 deletions website_sale_product_pack/controllers/variant.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
from odoo import http

from odoo.addons.website_sale.controllers.variant import WebsiteSaleVariantController


class WebsiteSaleVariantController(WebsiteSaleVariantController):
@http.route(
"/website_sale/get_combination_info",
type="json",
auth="public",
methods=["POST"],
website=True,
)
def get_combination_info_website(
self,
product_template_id,
product_id,
combination,
add_qty,
parent_combination=None,
**kw,
):
if "context" in kw:
kw["context"].update({"whole_pack_price": True})

Check warning on line 24 in website_sale_product_pack/controllers/variant.py

View check run for this annotation

Codecov / codecov/patch

website_sale_product_pack/controllers/variant.py#L24

Added line #L24 was not covered by tests
else:
kw["context"] = {"whole_pack_price": True}
return super().get_combination_info_website(
product_template_id,
product_id,
combination,
add_qty,
parent_combination=parent_combination,
**kw,
)

0 comments on commit 9d6cd98

Please sign in to comment.