Browse Source

Merge pull request #304 from andrius-preimantas/fix_web_widget_color_required_value

[FIX][web_widget_color] Do not force mandatory color on JS level
pull/307/head
Pedro M. Baeza 9 years ago
parent
commit
d7f4534f4c
  1. 2
      web_widget_color/static/src/js/widget.js
  2. 2
      web_widget_color/static/src/xml/widget.xml

2
web_widget_color/static/src/js/widget.js

@ -18,7 +18,7 @@ openerp.web_widget_color = function (instance) {
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()) {
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