| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Odoo Apps Dependencies |
•
Contacts (contacts)
• Discuss (mail) |
| Lines of code | 12118 |
| Technical Name |
smart_city_selection_yb |
| License | LGPL-3 |
Smart City Selection
for Every Country
Replace Odoo's free-text city field with a validated, country-aware dropdown — for any country, any address structure, worldwide.
The problem
Free-text city fields break your data
When users type city names manually, no two records ever look the same. Reporting breaks, deduplication fails, and geographic analysis becomes impossible — for every database, in every country.
Typos & variant spellings
The same city entered a dozen different ways. Clean reporting becomes impossible.
Duplicate partner records
Deduplication engines miss matches when the city field doesn't align across records.
Broken geographic reporting
Group-by, heat maps, and pivot tables rely on exact values. Free text makes city-level insight meaningless.
Built for every address structure
Works with any country worldwide
Countries have different address structures — some use states, some don't, some you want to keep as free text. This module handles all of them, in the same Odoo database, without any conflict.
Country → State → City
Full three-level hierarchy. Select a country, then a state — the city list automatically narrows to only cities in that region. Works for any country that uses a state or province layer: USA, France, Brazil, India, Australia, and more.
Country → City (flat)
Many countries don't use states or provinces at all. The module supports a direct Country → City link — state is optional and never required if not configured. Works seamlessly for any country with a flat address structure.
Mixed — Dropdown & Free Text
Enable the validated dropdown only for countries that need it. For all others, Odoo's original free-text field stays untouched. No disruption, no forced migration, full backward compatibility — ideal for phased global rollouts.
Smarter form design
Address fields in the right order
Odoo's default layout puts Country at the bottom — after Street, City, and State. This means users fill in specific details before setting the geographic context that drives them. This module fixes the order so every field makes sense before you reach it.
Broad to specific — the only order that makes geographic sense.
Core capabilities
Everything you need
City Master List
One place to define all cities: name, short id/code (up to 6 chars), country, and optional state. Import thousands of cities in seconds using Odoo's native import tool.
Cascading Filter
The city dropdown narrows and filters automatically when a state is selected. Change the country — the list resets. No stale or invalid choices ever appear.
Bidirectional Sync
Picking a city auto-syncs with State and Country. Existing free-text city values are intelligently matched back to the city list on load — no manual remapping.
Per-Country Toggle
A single checkbox on any country record enables the dropdown. Flip it off — the city field returns to free text instantly. Adopt gradually, at your own pace.
State Required Enforcement
Respects Odoo's native "State Required" flag — enforced at save time on both the city record and the partner form for airtight data quality.
Search by Name or ID/Code
The city selector searches on both the city name and the administrative ID/Code — a single field that serves as an ID for some countries and a code for others — for fast, flexible lookups across any database size.
Role-Based Access
Security CSV included. Admins create and edit the city master list; regular users get read-only access — ensuring your validated data stays clean over time.
Logical Address Layout
The address form is reordered into a natural data-entry sequence: Country → State → City → ZIP → Street → Street 2. Cascading fields are grouped logically, reducing input errors.
Step 1 — Setup
Build your city list only once
-
1
Enable "Cities List" per country
Start here — Contacts → Configuration → Countries → choose a country → check the "Cities List" box. A country will not appear as a selectable option when adding cities until this is enabled. Leave it unchecked for any country you want to keep the city field as free text input.
-
2
Contacts → Configuration → Cities
A dedicated menu shows all your defined cities. Create them manually or bulk-import with Odoo's native import tool — any volume, any country.
-
3
Link to country — state is optional
Attach each city to a country. Add a state/region only if that country uses them. Both flat and hierarchical structures are fully supported.
Step 2 — Daily Use
One click — complete address
-
1
Select the country
As soon as a country with the "Cities List" option enabled is chosen, the city field switches from a text box to a validated smart dropdown.
-
2
Pick the region / state (if applicable)
For countries with states, the city list narrows automatically. For countries with a flat structure, skip straight to the city — zero friction.
-
3
Select city — address complete
Choosing a city instantly syncs State and Country. No extra clicks, no typos, no inconsistent records — ever again.
Use cases
Who is this built for?
Global & Multi-Country Companies
Manage partners across dozens of countries from one database. Enable validated dropdowns for the regions you need, keep free text everywhere else — zero disruption.
E-Commerce & Logistics
Reliable delivery addresses require validated cities. Eliminate failed shipments caused by inconsistent or misspelled city names — across any country you ship to.
CRM & Geographic Reporting
Standardized city names make group-by, filters, and geographic maps work correctly — enabling meaningful regional sales analysis at any scale.
Public Sector & Institutions
Government agencies and NGOs need standardized administrative geodata. Import your official city lists for any jurisdiction for full compliance and accuracy.
Odoo Implementers & Partners
Deliver cleaner client databases from day one. Add it to your standard deployment kit and preload verified city data for any country during onboarding.
Our partners were scattered across a dozen city variants in the CRM — same city, different spelling every single time. After installing this module and importing our city list, it took one afternoon to clean up years of messy data. Now every report, every filter, every map just works. It's the kind of fix that should have always been in Odoo.
Technical details
Compatibility & specs
| Odoo version | 19.0 |
|---|---|
| License | LGPL-3 |
| Dependencies | base contacts sales_team |
| New model | res.city_m2o |
| Extended models | res.partner res.country |
| Translations | Arabic (ar), French (fr) |
| Core override? | No — clean extension only |
| Installation | Drop in addons path and install. No mandatory config required. |
Before you deploy
Known Limitations
Two edge cases to be aware of when working with data imports.
Import: exact name matching
Country and state values in import files must match Odoo's exact stored names — including capitalization and accents. For example, if Odoo stores "Canada", importing with "canada" or "CANADA" will not match and the sync will fail. Always verify country and state names against your Odoo configuration before running a bulk import.
Release history
Version changelog
id_code field name mismatch across views and constraintres.city_m2o with name, id/code, country, optional state
Please log in to comment on this module