Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
Fairly new to python but learning and could use some experience here. I want to use python-phonenumbers class 'AsYouTypeFormatter' found here: https://github.com/daviddrysdale/python-phonenumbers/blob/dev/python/phonenumbers/asyoutypeformatter.py to format phone numbers into (xxx) xxx-xxxx US format as the user enters them. Can somebody please tell me if this is possible and maybe where to begin.
Formatting phone numbers in Odoo seems to be a nightmare. I found a few modules but they make the numbers clickable for telephony, I just want properly formatted numbers in the DB.
Thanks in advance for any help.
Yes, its possible. I think the requirement is to be done in odoo 8 right? Then you can create a compute field, which calls the function to format value in required format. For that compute function, the link you have given can be used. I can help you doing that or to create a custom module for you. Please contact for any queries: email@example.com, firstname.lastname@example.org.
Make sure that the code is accessable using import like any standard library (look up python path). Next up, make sure the formatted number is stored as something Odoo will still accept. If you want formatting and/or symbols other than number, you should likely create a char or text field on the partner. If I recall correctly, in Odoo the phone number field already is such a field.
Alternatively (and much easier) you could create an on_change method for the field. Then, if someone is finished typing in all the digits and skips to the next field, the number will be validated, formatted and returned to the field. Like an auto_correct functionality. On_change is default in Odoo.
About This Community
This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 12/30/14, 1:46 AM|
|Seen: 916 times|
|Last updated: 3/16/15, 8:10 AM|