Skip to content

Commit

Permalink
[IMP] website_sale_product_assortment
Browse files Browse the repository at this point in the history
  • Loading branch information
SuShanVoong committed Feb 17, 2025
1 parent e016f16 commit 1b4f715
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
1 change: 1 addition & 0 deletions website_sale_product_assortment/controllers/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
from . import variant
from . import website_sale
from . import main
28 changes: 28 additions & 0 deletions website_sale_product_assortment/controllers/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
from odoo import http

from odoo.addons.website.controllers import main

from .website_sale import WebsiteSale


class Website(main.Website):
@http.route()
def autocomplete(
self,
options=None,
**kwargs,
):
(
allowed_product_ids,
assortment_restriction,
) = WebsiteSale()._get_products_allowed()
if assortment_restriction:
options["allowed_product_domain"] = [
("product_variant_ids", "in", list(allowed_product_ids))
]
values = super().autocomplete(
options=options,
**kwargs,

)
return values

0 comments on commit 1b4f715

Please sign in to comment.