From 98e32b879127ff1bb47e1ea046af218418523428 Mon Sep 17 00:00:00 2001 From: Martronic SA Date: Tue, 18 Dec 2018 10:36:27 +0100 Subject: [PATCH] [10.0] web_widget_color allow empty values (#1130) * check the imput only if something has been entered in the field, don't check it if the value is empty as the field might not be required. * don't require a value and let Odoo if the field has to be required or not. --- web_widget_color/__manifest__.py | 2 +- web_widget_color/static/src/js/widget.js | 2 +- web_widget_color/static/src/xml/widget.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/web_widget_color/__manifest__.py b/web_widget_color/__manifest__.py index e90ef2d0c..62786e0f1 100644 --- a/web_widget_color/__manifest__.py +++ b/web_widget_color/__manifest__.py @@ -8,7 +8,7 @@ { 'name': "Web Widget Color", 'category': "web", - 'version': "10.0.1.0.0", + 'version': "10.0.1.0.1", "author": "Savoir-faire Linux, " "Anybox, " "Taktik SA, " diff --git a/web_widget_color/static/src/js/widget.js b/web_widget_color/static/src/js/widget.js index 589ff3643..e2f7af78c 100644 --- a/web_widget_color/static/src/js/widget.js +++ b/web_widget_color/static/src/js/widget.js @@ -22,7 +22,7 @@ odoo.define('web.web_widget_color', function(require) { widget_class: 'oe_form_field_color', is_syntax_valid: function () { var $input = this.$('input'); - if (!this.get("effective_readonly") && $input.size() > 0) { + if (!this.get("effective_readonly") && $input.size() > 0 && $input.val().length>0) { var val = $input.val(); var isOk = /^#[0-9A-F]{6}$/i.test(val); if (!isOk) { diff --git a/web_widget_color/static/src/xml/widget.xml b/web_widget_color/static/src/xml/widget.xml index 82c043b42..4f2afcbd9 100644 --- a/web_widget_color/static/src/xml/widget.xml +++ b/web_widget_color/static/src/xml/widget.xml @@ -9,7 +9,7 @@ t-att-autofocus="widget.node.attrs.autofocus" t-att-placeholder="widget.node.attrs.placeholder" t-att-maxlength="widget.field.size" - class="color {hash:true}" + class="color {hash:true, required:false}" />