Browse Source

[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.
pull/1142/head
Martronic SA 5 years ago
committed by Pedro M. Baeza
parent
commit
98e32b8791
  1. 2
      web_widget_color/__manifest__.py
  2. 2
      web_widget_color/static/src/js/widget.js
  3. 2
      web_widget_color/static/src/xml/widget.xml

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

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

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

Loading…
Cancel
Save