| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Odoo Apps Dependencies |
•
Contacts (contacts)
• Discuss (mail) |
| Lines of code | 394 |
| Technical Name |
az_l10n_es_autonomous_communities |
| License | AGPL-3 |
Spanish Autonomous Communities
Relate Spanish provinces, postal prefixes and autonomous communities in Odoo
This module extends Odoo Contacts to manage Spanish autonomous communities and automatically complete province, autonomous community and country from the first two digits of the Spanish postal code.
Main Features
Autonomous Community Management
- Creates the
res.country.communitymodel. - Adds a configuration menu under Contacts.
- Supports autonomous communities and autonomous cities.
- Allows manual administration from the Odoo backend.
Province and Postal Prefix Extension
- Extends
res.country.state. - Adds
autonomous_community_id. - Adds
l10n_es_postal_code_prefix. - Postal prefixes are stored as 2-character text values.
Automatic Address Completion
When a Spanish postal code is entered in a contact, the module reads the first two digits and completes the province, autonomous community and Spain as country whenever the prefix exists.
1. Postal Code
Enter a value such as 28013 or 46001 in the contact ZIP field.
2. Province
The matching province is found using the configured two-digit postal prefix.
3. Community and Country
The autonomous community and Spain are completed automatically.
Editable on Contacts
The contact form includes an editable autonomous community field, useful when the postal code or province is not known. If a province is selected manually, the autonomous community and country are completed from that province.
create() and write(), so data can also be completed
when contacts are created or updated through imports, APIs or automated processes.
Initial Spanish Data Load
The module loads the complete Spanish base data during installation using a post-init hook.
17
Autonomous communities
2
Autonomous cities
52
Province postal prefixes
Configuration
Go to Contacts → Configuration → Autonomous Communities to manage the communities.
The province list also displays and allows editing of l10n_es_postal_code_prefix and the
related autonomous community.
Technical Notes
- Existing Spanish provinces are searched by country plus code/name.
- Existing records are updated; missing records are created only when needed.
- Two-digit postal prefixes are stored as text to preserve leading zeroes.
Module
az_l10n_es_autonomous_communities
Please log in to comment on this module