Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][IMP] website_sale_product_assortment: Fix the behavior of the website's search function for product assortments. #1023

Open
wants to merge 1 commit into
base: 16.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
26 changes: 26 additions & 0 deletions website_sale_product_assortment/controllers/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
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,
):
(

Check warning on line 15 in website_sale_product_assortment/controllers/main.py

View check run for this annotation

Codecov / codecov/patch

website_sale_product_assortment/controllers/main.py#L15

Added line #L15 was not covered by tests
allowed_product_ids,
assortment_restriction,
) = WebsiteSale()._get_products_allowed()
if assortment_restriction:
options["allowed_product_domain"] = [

Check warning on line 20 in website_sale_product_assortment/controllers/main.py

View check run for this annotation

Codecov / codecov/patch

website_sale_product_assortment/controllers/main.py#L20

Added line #L20 was not covered by tests
("product_variant_ids", "in", list(allowed_product_ids))
]
return super().autocomplete(

Check warning on line 23 in website_sale_product_assortment/controllers/main.py

View check run for this annotation

Codecov / codecov/patch

website_sale_product_assortment/controllers/main.py#L23

Added line #L23 was not covered by tests
options=options,
**kwargs,
)