[IMP] website_sale: stop showing variant option when not active

Since this commit [1], we don't want to display the "List View of
Variants" option on the product page if option "Variants" in settings
was disabled. Now that the customize show menu options have become
snippet options in edit mode, the code to do this has been adapted.

[1]: https://github.com/odoo/odoo/commit/1cd63d81908511ee136f0ca2600d85eab48f258f

task-2710582
This commit is contained in:
Benjamin Vray
2022-06-24 10:28:05 +02:00
committed by qsm-odoo
parent 823d46fc6f
commit 22bc9e142d
2 changed files with 1 additions and 10 deletions
-9
View File
@@ -131,15 +131,6 @@ class Website(main.Website):
options['display_currency'] = request.website.currency_id
return super().autocomplete(search_type, term, order, limit, max_nb_chars, options)
@http.route()
def get_switchable_related_views(self, key):
views = super(Website, self).get_switchable_related_views(key)
if key == 'website_sale.product':
if not request.env.user.has_group('product.group_product_variant'):
view_product_variants = request.website.viewref('website_sale.product_variants')
views = [v for v in views if v['id'] != view_product_variants.id]
return views
@http.route()
def theme_customize_data(self, is_view_data, enable=None, disable=None, reset_view_arch=False):
super().theme_customize_data(is_view_data, enable, disable, reset_view_arch)
@@ -221,7 +221,7 @@
data-customize-website-views="website_sale.product_quantity"
data-no-preview="true"
data-reload="/"/>
<we-select string="Variants" data-no-preview="true" data-reload="/">
<we-select groups="product.group_product_variant" string="Variants" data-no-preview="true" data-reload="/">
<we-button data-customize-website-views="">Options</we-button>
<we-button data-customize-website-views="website_sale.product_variants">Products List</we-button>
</we-select>