diff --git a/base_phone/fields.py b/base_phone/fields.py index 8b241aa..859d50f 100644 --- a/base_phone/fields.py +++ b/base_phone/fields.py @@ -45,8 +45,8 @@ class Phone(fields.Char): res_parse = phonenumbers.parse(res) res = phonenumbers.format_number( res_parse, phonenumbers.PhoneNumberFormat.INTERNATIONAL) - narrow_no_break_space = u'\u202f' - res = res.replace(' ', narrow_no_break_space) + no_break_space = u'\u00A0' + res = res.replace(' ', no_break_space) except: pass # print 'cache value', res @@ -57,9 +57,6 @@ def convert_phone_field(value, country_code): _logger.debug( 'convert_phone_field value=%s country=%s', value, country_code) try: - narrow_no_break_space = u'\u202f' - # phonenumbers.parse fails with narrow_no_break_space - value = value.replace(narrow_no_break_space, '') res_parse = phonenumbers.parse( value, country_code) _logger.debug('res_parse=%s', res_parse) diff --git a/base_phone/static/src/js/phone_widget.js b/base_phone/static/src/js/phone_widget.js index 4f2c53e..ab56ef9 100644 --- a/base_phone/static/src/js/phone_widget.js +++ b/base_phone/static/src/js/phone_widget.js @@ -28,7 +28,7 @@ var FieldPhone = formwidgets.FieldChar.extend({ var raw_phone_num = ''; if (phone_num) { // remove non-breaking-space - raw_phone_num = phone_num.replace(/ /g, ''); + raw_phone_num = phone_num.replace(/ /g, ''); raw_phone_num = raw_phone_num.replace(/-/g, ''); this.$el.find('a.oe_form_uri').attr('href', 'tel:' + raw_phone_num).text(phone_num); } @@ -101,7 +101,8 @@ var FieldFax = formwidgets.FieldChar.extend({ var fax_num = this.get('value'); // console.log('BASE_PHONE fax_num = %s', fax_num); if (fax_num) { - var raw_fax_num = fax_num.replace(/ /g, ''); + var raw_fax_num = fax_num.replace(/ /g, ''); + raw_fax_num = raw_fax_num.replace(/-/g, ''); this.$el.find('a').attr('href', 'fax:' + raw_fax_num).text(fax_num); } else {