summaryrefslogtreecommitdiff
path: root/addons/website/static/src/snippets
diff options
context:
space:
mode:
authorNasreddin (bon) <bon@odoo.com>2021-01-05 13:56:06 +0000
committerNasreddin (bon) <bon@odoo.com>2021-01-06 08:25:27 +0000
commit0de069b8ca9fb005ba5b076984f5677de25889ee (patch)
treed2229d2db7cdabc5c09d05632d10bcb4d0e4a2f4 /addons/website/static/src/snippets
parent0024b592b2d589138f34e27c724b8d471d213a4d (diff)
[FIX] website,website_sale: Dynamic products isn't visible if category deleted
Issue - Install "Ecommerce" app - Go to 'Shop' page and edit it - Add a "Dynamic Products" block - Click on it to edit it : - Select any template - Select `Desks` as product category - Save - Go to "Website -> Configuration -> eCommerce Categories" - Delete the "Desks" category - Go back to Shop page Error : "Record does not exist or has been deleted". Cause The search domain is looking for child categories of dataset.productCategoryId (who does not exist anymore in the above case). `child_of` do a browse() to fetch the records, and therefore generate an error if category not found. Solution Check if dataset.productCategoryId exist before updating domain. opw-2416231 closes odoo/odoo#64090 Signed-off-by: LTU-Odoo <IT-Ideas@users.noreply.github.com>
Diffstat (limited to 'addons/website/static/src/snippets')
-rw-r--r--addons/website/static/src/snippets/s_dynamic_snippet/000.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/addons/website/static/src/snippets/s_dynamic_snippet/000.js b/addons/website/static/src/snippets/s_dynamic_snippet/000.js
index 71b551738b5..46b10ea0dc9 100644
--- a/addons/website/static/src/snippets/s_dynamic_snippet/000.js
+++ b/addons/website/static/src/snippets/s_dynamic_snippet/000.js
@@ -94,14 +94,14 @@ const DynamicSnippet = publicWidget.Widget.extend({
* domain if needed.
* @private
*/
- _getSearchDomain: function () {
+ _getSearchDomain: async function () {
return [];
},
/**
* Fetches the data.
* @private
*/
- _fetchData: function () {
+ _fetchData: async function () {
if (this._isConfigComplete()) {
return this._rpc(
{
@@ -110,7 +110,7 @@ const DynamicSnippet = publicWidget.Widget.extend({
'filter_id': parseInt(this.$el.get(0).dataset.filterId),
'template_key': this.$el.get(0).dataset.templateKey,
'limit': parseInt(this.$el.get(0).dataset.numberOfRecords),
- 'search_domain': this._getSearchDomain()
+ 'search_domain': await this._getSearchDomain()
},
})
.then(