diff options
| author | Nasreddin (bon) <bon@odoo.com> | 2021-01-21 10:40:54 +0000 |
|---|---|---|
| committer | Nasreddin (bon) <bon@odoo.com> | 2021-01-22 11:22:12 +0000 |
| commit | e452d30f739db39a088248a3109c8c49cff9d49f (patch) | |
| tree | e6c2b9c75d0d5ad077d7646681667ae8f56d7011 /addons/website/static/src | |
| parent | a27907e27fb99a523c7b2d58544c36073640511c (diff) | |
[FIX] website: Warning message on website if dynamic snippet 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
Log warning message if unexptected domain and return empty records set instead.
This commit also reverts commit 0de069b8ca9fb005ba5b076984f5677de25889ee that generated the issue.
opw-2440917
closes odoo/odoo#64847
Signed-off-by: LTU-Odoo <IT-Ideas@users.noreply.github.com>
Diffstat (limited to 'addons/website/static/src')
| -rw-r--r-- | addons/website/static/src/snippets/s_dynamic_snippet/000.js | 6 |
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 46b10ea0dc9..71b551738b5 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: async function () { + _getSearchDomain: function () { return []; }, /** * Fetches the data. * @private */ - _fetchData: async function () { + _fetchData: 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': await this._getSearchDomain() + 'search_domain': this._getSearchDomain() }, }) .then( |
