`_address_fields` are used by `update_address` [1], which is in turn
called by `_fields_sync` and `_children_sync`.
This mechanism is in charge of synchronizing parent/children address fields
for contacts of type == "contact", as they don't really have an address of
their own. They simply copy the address of their parent.
Without this fix, not only the zip_id is not sync'ed, but also in some cases
an exception may be raised by `_check_zip_id`, due to only some fields being
sync'ed but not all, creating inconsistencies between zip_id and other address
fields.
[1]: https://github.com/odoo/odoo/blob/20648ef21/odoo/addons/base/models/res_partner.py#L429
Steps:
- Open company form
- Set 'city completion' field
Get 'The state of the partner My Company differs from that in location X'
Disabling _check_zip while writing 'zip' fields from company, as incompatible with the sequence of write operations.
Automatic test is added too.
This module has now been refactored to be more consistent with what base_address_city offers to the location management.
Added dependency to contacts so that I could change the menu location for cities / zip management.
Now, every res.city record has a relation One2many to res.city.zip (old res.better.zip). This way, every zip has a realted city too.
Zips can be searched through city code, zip or city name (same as before).
Modified tests and deleted not needed tests.
Added sql contraints so that zips and cities are unique within it's country / state / city.