[FIX] phone_validation: fix behavior with prefix option

This commit fixes the behaviour of the phone_format function when phone_international_format is set to prefix.
This commit is contained in:
Pierre Rousseau
2018-01-17 09:28:49 +01:00
committed by Rémi Rahir
parent 733ce266ef
commit 637bfc2862
2 changed files with 1 additions and 6 deletions
@@ -43,11 +43,10 @@ try:
else:
_logger.warning(_('Unable to format %s:\n%s') % number, e)
return number
if always_international and phone_nbr.country_code != country_phone_code:
if always_international or phone_nbr.country_code != country_phone_code:
phone_fmt = phonenumbers.PhoneNumberFormat.INTERNATIONAL
else:
phone_fmt = phonenumbers.PhoneNumberFormat.NATIONAL
return phonenumbers.format_number(phone_nbr, phone_fmt)
except ImportError:
@@ -1,8 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
The purpose of this view is to move the VAT field at the top of the
company form. That way, the user will fill it first
-->
<odoo>
<record id="res_company_view_form_phone_validation" model="ir.ui.view">
<field name="name">res.company.view.form.phone_validation</field>