[FIX] base_address_extended: enforce city in "Contacts & Addresses"

Steps to reproduce:
-Install "base_address_extended" module ("base_address_city" in 15.0)
-Go to an already existing contact.
-Add a new address to this contact.
-Use a country that enforces cities (contact>configuration>countries).
-No drop menu for cities is displayed.

Bug:
unable to select all the city fields in the inherited XML views

Fix:
selected the correct city fields

opw-2960154

closes odoo/odoo#103775

X-original-commit: 829541fa509f84cf4c8b0e22181770267a3e6e59
Signed-off-by: Quentin De Paoli <qdp@odoo.com>
Signed-off-by: Walid Hanniche (waha) <waha@odoo.com>
This commit is contained in:
Walid HANNICHE (waha)
2022-10-21 17:17:07 +02:00
parent d4e3a44a35
commit d0d7dbb00d
@@ -74,6 +74,22 @@
attrs="{'invisible': [('country_enforce_cities', '=', False)], 'readonly': [('type', '=', 'contact'),('parent_id', '!=', False)]}"
context="{'default_country_id': country_id, 'default_state_id': state_id, 'default_zipcode': zip}"/>
</field>
<xpath expr="//field[@name='child_ids']//form//field[@name='city']" position="attributes">
<attribute name="attrs">
{'invisible': [('country_enforce_cities', '=', True), '|', ('city_id', '!=', False), ('city', 'in', ('',False))],
'readonly': [('type', '=', 'contact'), ('parent_id', '!=', False)]}
</attribute>
</xpath>
<xpath expr="//field[@name='child_ids']//form//field[@name='city']" position="before">
<field name="country_enforce_cities" invisible="1"/>
<field name="city_id"
placeholder="City"
class="o_address_city"
domain="[('country_id', '=', country_id)]"
attrs="{'invisible': [('country_enforce_cities', '=', False)], 'readonly': [('type', '=', 'contact'),('parent_id', '!=', False)]}"
context="{'default_country_id': country_id, 'default_state_id': state_id, 'default_zipcode': zip}"/>
</xpath>
</field>
</record>