[FIX] website: not fail when no dynamic filter is defined
Since [1] when only website is installed, dropping a dynamic snippet produces an error because no dynamic filter is defined and it tries to specify one selected by default. This commit avoids setting a default filter when there is none. It did work in 15.0 because the log was inside `_renderDynamicFiltersSelector` which contained an `if (dynamicFilters.length > 0)` that avoided the problem. In [2], when most of that logic was moved from the render method to the fetch method, that condition was lost. Steps to reproduce: - Install website only - Go to debug mode - Drop a "Dynamic Snippet" or a "Dynamic Carousel" => Traceback appears because there cannot be a default filter when there is no filter. [1]: https://github.com/odoo/odoo/commit/3355dc16235355fe51e894f14e275210464608c6 [2]: https://github.com/odoo/odoo/commit/9e0b398fe608e716835260c5f9923f933d723f8e opw-3166634 closes odoo/odoo#114068 X-original-commit: 8e23f08b1470ec5fe47a4459c4d3a8ad314c43b0 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
This commit is contained in:
@@ -154,6 +154,10 @@ const dynamicSnippetOptions = options.Class.extend({
|
||||
model_name: this.modelNameFilter,
|
||||
search_domain: this.contextualFilterDomain,
|
||||
}});
|
||||
if (!dynamicFilters.length) {
|
||||
// Additional modules are needed for dynamic filters to be defined.
|
||||
return;
|
||||
}
|
||||
for (let index in dynamicFilters) {
|
||||
this.dynamicFilters[dynamicFilters[index].id] = dynamicFilters[index];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user