[FIX] website_sale: fix traceback when selecting a product in website
This traceback arises when the user selects a product in website. To reproduce this issue: 1) Install 'website_sale' 2) Open website and click on shop 3) Set duration and click on any product category(eg: desk) 4) A traceback appears Error:'UnboundLocalError: local variable 'all_tags' referenced before assignment' On 'shop' method 'all_tags' was referenced before assignment form here https://github.com/odoo/odoo/blob/5ba7e9e16c45ba618bb728f336102454d844d144/addons/website_sale/controllers/main.py#L480-L481 sentry-4680583793 closes odoo/odoo#144297 Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
This commit is contained in:
@@ -398,14 +398,16 @@ class WebsiteSale(payment_portal.PaymentPortal):
|
||||
max_price = max_price if max_price >= available_min_price else available_max_price
|
||||
post['max_price'] = max_price
|
||||
|
||||
ProductTag = request.env['product.tag']
|
||||
if filter_by_tags_enabled and search_product:
|
||||
ProductTag = request.env['product.tag']
|
||||
all_tags = ProductTag.search(
|
||||
expression.AND([
|
||||
[('product_ids.is_published', '=', True), ('visible_on_ecommerce', '=', True)],
|
||||
website_domain
|
||||
])
|
||||
)
|
||||
else:
|
||||
all_tags = ProductTag
|
||||
|
||||
categs_domain = [('parent_id', '=', False)] + website_domain
|
||||
if search:
|
||||
|
||||
Reference in New Issue
Block a user