When someone is working with Odoo, one of the inevitable operations to perform is to create contact/customers in the ERP system. While creating a new contact, we need to enter the city, state, zip, and country of the contact like you see in the following image.
All our clients to whom we deploy the Odoo ERP system want to autocomplete these fields while creating a new contact. It was my job to provide this feature to our clients. So I search on the internet and found how to accomplish that on the odoo forum. I decided to write a blog post to explain the process.
This post is not a technical one. We will use two Odoo thirds party modules available from Odoo V8 to the latest version of Odoo at the time I am writing this piece of a blog post(Odoo V16) on the Odoo Apps Store. These two modules are Base Location Geonames Import and Location management (aka Better ZIP). Download the versions corresponding to your Odoo server and install them.
GeoNames is a database of names and locations of places around the world. It includes information such as geographic coordinates, population, and elevation. It is a free and open-source resource that can be used for mapping and geocoding.
The module “Base Location Geonames Import” downloads and import information on the countries you choose and import that information into the Odoo ERP System.
Once you have installed these modules, go to Contacts->Configuration->Import from Geonames.
Now, you will get the following window asking to select the list of countries that the module will download the list of cities from Geonames and create the location entries in the Odoo system if not found. Note that there are countries like mine (Cameroon) that don’t have their list of cities present yet in Geoname. So I choose South Africa and France for this tutorial because major of our clients that need this feature is based in France.
As Geonames is an open-source project, anyone can contribute more information regarding their country. After you press the button import, the module will download and automatically add this information to the system. It can take time depending on your internet speed.
Navigate now to the page where you create a new contact/customer and you’ll see a new field “Location Completion“, and you can autocomplete your addresses using that field as shown in the following image.
This is a very easy way to autocomplete addresses when knowing the ZIP code of the person/client.
Final thoughts
In this short tutorial, I have explained to you how to autocomplete addresses from Zip codes with the information provided by Geonames. Some countries do not have a list of their cities available in Geonames. In my upcoming posts, I would write a technical post to show you how you can import the list of cities in the Odoo system from an Excel/CSV file instead of from geonames.org.
If you like the type of content I am sharing, consider subscribing to my newsletter to don’t miss any content I pop out. Thanks for reading.
I am a Master’s student in computer science passionate about DevOps, Cloud Computing, AI, and BI. I am also a web developer, especially with Django and Laravel Frameworks. I love to share things that work for me with others to save them time searching through the internet to solve the same problem.