[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.
This commit is contained in:
Martronic SA
2018-12-18 10:36:27 +01:00
committed by Pedro M. Baeza
parent 0c4a5cca96
commit 98e32b8791
3 changed files with 3 additions and 3 deletions

View File

@@ -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, "

View File

@@ -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) {

View File

@@ -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}"
/>
</t>
<t t-if="widget.get('effective_readonly')">