From 1c1894d6d976806be6951db54a3b741dfd093ece Mon Sep 17 00:00:00 2001 From: qsm-odoo Date: Wed, 27 Jan 2021 14:06:50 +0000 Subject: [PATCH] [FIX] web_editor: properly hide the custom colors section if needed The 'custom' key was not working anymore as a key to exclude the ability to choose a custom color from a color palette widget. It was thus appearing for choosing the transparent color for over-the-content headers... which is not possible to save right now. Part of https://github.com/odoo/odoo/pull/65139 closes odoo/odoo#65154 X-original-commit: 8f9eb57df5c6a253ee0702c0e1fb2016cab7eb1e Signed-off-by: Quentin Smetz (qsm) --- .../src/js/wysiwyg/widgets/color_palette.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/addons/web_editor/static/src/js/wysiwyg/widgets/color_palette.js b/addons/web_editor/static/src/js/wysiwyg/widgets/color_palette.js index b55d8aed6e0..fe97d3fa700 100644 --- a/addons/web_editor/static/src/js/wysiwyg/widgets/color_palette.js +++ b/addons/web_editor/static/src/js/wysiwyg/widgets/color_palette.js @@ -136,14 +136,17 @@ const ColorPaletteWidget = Widget.extend({ this._markSelectedColor(); // Colorpicker - let defaultColor = this.selectedColor; - if (defaultColor && !ColorpickerWidget.isCSSColor(defaultColor)) { - defaultColor = weUtils.getCSSVariableValue(defaultColor, this.style); + if (!this.options.excluded.includes('custom')) { + let defaultColor = this.selectedColor; + if (defaultColor && !ColorpickerWidget.isCSSColor(defaultColor)) { + defaultColor = weUtils.getCSSVariableValue(defaultColor, this.style); + } + this.colorPicker = new ColorpickerWidget(this, { + defaultColor: defaultColor, + }); + await this.colorPicker.prependTo($colorSection); } - this.colorPicker = new ColorpickerWidget(this, { - defaultColor: defaultColor, - }); - await this.colorPicker.prependTo($colorSection); + return res; }, /**