Browse Source

FIX: clear field when number not set rather than leaving previous value

pull/13/head
Tristan Hill 10 years ago
parent
commit
55090639f1
  1. 16
      base_phone/static/src/js/phone_widget.js

16
base_phone/static/src/js/phone_widget.js

@ -21,14 +21,19 @@ openerp.base_phone = function (instance) {
var self = this;
var phone_num = this.get('value');
//console.log('BASE_PHONE phone_num = %s', phone_num);
var href = '#';
var href_text = '';
if (phone_num) {
this.$el.find('a.oe_form_uri')
.attr('href', 'tel:' + phone_num)
.text(formatInternational('', phone_num) || '');
href = 'tel:' + phone_num;
href_text = formatInternational('', phone_num) || '';
}
this.$el.find('a.oe_form_uri').attr('href', href).text(href_text);
var click2dial_text = '';
if (phone_num && !this.options.dial_button_invisible) {
click2dial_text = _t('Dial');
}
this.$el.find('#click2dial')
.text(phone_num && _t('Dial') || '')
.text(click2dial_text)
.on('click', function(ev) {
self.do_notify(
_t('Click2dial started'),
@ -66,7 +71,6 @@ openerp.base_phone = function (instance) {
});
});
}
}
},
on_button_clicked: function() {
location.href = 'tel:' + this.get('value');
@ -113,4 +117,4 @@ openerp.base_phone = function (instance) {
return res;
};
}
};
Loading…
Cancel
Save