diff options
| author | Romain Derie <rde@odoo.com> | 2020-11-19 17:36:48 +0000 |
|---|---|---|
| committer | Romain Derie <rde@odoo.com> | 2020-11-27 16:54:00 +0000 |
| commit | 01fafecf98aba5886c5fe836e2a81f2551155f35 (patch) | |
| tree | 8540dfd9bce73b95bb525df731fd106693632023 /addons/website_sale/static | |
| parent | 759ddc180a7fa186d9ad36583ebd1f4857f584e7 (diff) | |
[FIX] website: ensure websites have snippet filters
Since the feature was implemented with the default snippets having a website_id
set to the default website, it means that every other websites won't have
snippet filters.
This commit bootstrap filters for every new created website.
Note that in master, multi-website and generic filters are handled with
550d2935bd.
opw-2381423
Closes #62041
Diffstat (limited to 'addons/website_sale/static')
| -rw-r--r-- | addons/website_sale/static/src/snippets/s_dynamic_snippet_products/options.js | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/addons/website_sale/static/src/snippets/s_dynamic_snippet_products/options.js b/addons/website_sale/static/src/snippets/s_dynamic_snippet_products/options.js index 5a92baed823..f059e78a861 100644 --- a/addons/website_sale/static/src/snippets/s_dynamic_snippet_products/options.js +++ b/addons/website_sale/static/src/snippets/s_dynamic_snippet_products/options.js @@ -21,16 +21,11 @@ const dynamicSnippetProductsOptions = s_dynamic_snippet_carousel_options.extend( onBuilt: function () { this._super.apply(this, arguments); this._rpc({ - model: 'ir.model.data', - method: 'search_read', - kwargs: { - domain: [['module', '=', 'website_sale'], ['model', '=', 'website.snippet.filter']], - fields: ['id', 'res_id'], - } + route: '/website_sale/snippet/options_filters' }).then((data) => { - if (data) { - this.$target.get(0).dataset.filterId = data[0].res_id; - this.$target.get(0).dataset.numberOfRecords = this.dynamicFilters[data[0].res_id].limit; + if (data.length) { + this.$target.get(0).dataset.filterId = data[0].id; + this.$target.get(0).dataset.numberOfRecords = this.dynamicFilters[data[0].id].limit; } }); }, |
