summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/src
diff options
context:
space:
mode:
authorqsm-odoo <qsm@odoo.com>2019-12-04 18:47:44 +0000
committerqsm-odoo <qsm@odoo.com>2019-12-05 10:59:48 +0000
commitd7f4289166b3d3d2f52b3769fbddad5f8a964907 (patch)
treed560f81d3bfb4fd60c137577762e042613c365cd /addons/web_editor/static/src
parentb62b686066f866d30603ac019f39419ba2e88767 (diff)
[FIX] web_editor: prevent setting values of non-activable methods
closes odoo/odoo#41404 X-original-commit: 6af602fa676db19260a828a3cfd0befe3ba1ef4e Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Diffstat (limited to 'addons/web_editor/static/src')
-rw-r--r--addons/web_editor/static/src/js/editor/snippets.options.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/addons/web_editor/static/src/js/editor/snippets.options.js b/addons/web_editor/static/src/js/editor/snippets.options.js
index ca8ef46b4d9..19e69958884 100644
--- a/addons/web_editor/static/src/js/editor/snippets.options.js
+++ b/addons/web_editor/static/src/js/editor/snippets.options.js
@@ -1331,6 +1331,9 @@ const SnippetOptionWidget = Widget.extend({
const methodsNames = widget.getMethodsNames();
const proms = methodsNames.map(async methodName => {
const value = await this._computeWidgetState(methodName, widget.getMethodsParams(methodName));
+ if (value === undefined) {
+ return;
+ }
const normalizedValue = this._normalizeWidgetValue(value);
widget.setValue(normalizedValue, methodName);
});
@@ -1351,10 +1354,12 @@ const SnippetOptionWidget = Widget.extend({
* Returns the string value that should be hold by the widget which is
* related to the given method name.
*
+ * If the value is irrelevant for a method, it must return undefined.
+ *
* @private
* @param {string} methodName
* @param {Object} params
- * @returns {Promise<string>|string}
+ * @returns {Promise<string|undefined>|string|undefined}
*/
_computeWidgetState: async function (methodName, params) {
switch (methodName) {