Skip to content

Commit b37d65f

Browse files
committed
[FIX] website_product_pack: detailed displayed components price on website
1 parent 1ff0e9a commit b37d65f

File tree

4 files changed

+52
-0
lines changed

4 files changed

+52
-0
lines changed

website_sale_product_pack/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
from . import models
2+
from . import controllers
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
from . import main
2+
from . import variant
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
from odoo.http import request
2+
3+
from odoo.addons.website_sale.controllers.main import WebsiteSale
4+
5+
6+
class WebsiteSale(WebsiteSale):
7+
def shop(
8+
self,
9+
page=0,
10+
category=None,
11+
search="",
12+
min_price=0.0,
13+
max_price=0.0,
14+
ppg=False,
15+
**post
16+
):
17+
request.update_context(whole_pack_price=True)
18+
return super().shop(
19+
page=page,
20+
category=category,
21+
search=search,
22+
min_price=min_price,
23+
max_price=max_price,
24+
ppg=ppg,
25+
**post
26+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
from odoo import http
2+
3+
from odoo.addons.website_sale.controllers.variant import WebsiteSaleVariantController
4+
5+
6+
class WebsiteSaleVariantController(WebsiteSaleVariantController):
7+
@http.route(
8+
["/sale/get_combination_info_website"],
9+
type="json",
10+
auth="public",
11+
methods=["POST"],
12+
website=True,
13+
)
14+
def get_combination_info_website(
15+
self, product_template_id, product_id, combination, add_qty, **kw
16+
):
17+
if "context" in kw:
18+
kw["context"].update({"whole_pack_price": True})
19+
else:
20+
kw["context"] = {"whole_pack_price": True}
21+
return super(WebsiteSaleVariantController, self).get_combination_info_website(
22+
product_template_id, product_id, combination, add_qty, **kw
23+
)

0 commit comments

Comments
 (0)