Commit Graph
5 Commits
Author SHA1 Message Date
Rémi Rahir 376415052c [FIX] phone_validation, crm_phone_validation: Phone number parsing
Before this commit, when filing a phone number field on a model form (typically on website_form),
the module phonenumbers would try to parse the number against the country of the model.

However, this call fails when the number starts with 00 instead of + and that the model
doesn't have a country_id field or if said field is not set.

For this specific case, we chose to skip the number parsing altogether as providing a default
country to the parser can lead to a wrong parsing. i.e, phonenumbers.parse(+32477111111, 'US') will
find the number as US-based when it is a belgian number.

solves issue #22513

Also corrected a faulty behaviour where the option to have a number parsed in its international format
field `phone_international_format` on `res.company` was never properly assessed when the field comany_id of a
model was not present in the model's form view. Added company_id field on opportunity's form view for a proper fix.

Also fixed a syntax error in a logger.
2018-02-07 14:22:46 +01:00
Pierre Rousseau 637bfc2862 [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.
2018-01-17 09:28:49 +01:00
Jos De Graeve c749067165 [FIX] doc: mention pip3 instead of pip for python mod install suggestions
Do not suggest to use pip in the logger, the system administrator may use other
tools

Closes #19949
2017-10-10 10:10:44 +02:00
Jérome Maes 800d54e846 [FIX] phone_validation: bad code comparison
During the formating method, the country code
was compared to the country phone code. Indeed,
phonenumbers python lib return a `PhoneNumber`
object having a `country_code` attribute
refering to the country_phone_code, and not
the country_code (like odoo means).
Consequence: changing the country on a lead
did not make the phone validation work.

Thus, it was required to give both code (country
and country phone codes) to the phonenumbers API,
in order to make a correct verification.
2017-06-20 09:00:47 +02:00
Fabien Pinckaers 96a004710c [ADD] phone_validation: tool module allowing phone number validation
Using phonenumbers library this module adds tools methods as well as a
small mixin for models that want to activate phone number validation
and formatting.

Formatting can be done always using an international format or having
both national and international format. This is configured on the
company.

Note that phonenumbers library is optional. Installing this module without
having the lib installed just skip its use but should not crash.
2017-05-05 12:27:06 +02:00