diff --git a/base_location/__manifest__.py b/base_location/__manifest__.py
index be7444a75..dfb0b4634 100644
--- a/base_location/__manifest__.py
+++ b/base_location/__manifest__.py
@@ -4,7 +4,7 @@
{
"name": "Location management (aka Better ZIP)",
- "version": "14.0.1.0.1",
+ "version": "14.0.1.1.0",
"depends": ["base_address_city", "contacts"],
"author": (
"Camptocamp,"
diff --git a/base_location/models/res_partner.py b/base_location/models/res_partner.py
index 7dbec234d..4a6eb3e7e 100644
--- a/base_location/models/res_partner.py
+++ b/base_location/models/res_partner.py
@@ -9,9 +9,6 @@ from odoo.exceptions import ValidationError
class ResPartner(models.Model):
_inherit = "res.partner"
- allowed_zip_ids = fields.Many2many(
- comodel_name="res.city.zip", compute="_compute_allowed_zip_ids"
- )
zip_id = fields.Many2one(
comodel_name="res.city.zip",
string="ZIP Location",
@@ -19,7 +16,9 @@ class ResPartner(models.Model):
compute="_compute_zip_id",
readonly=False,
store=True,
- domain="[('id', 'in', allowed_zip_ids)]",
+ domain="[('city_id', '=?', city_id), "
+ "('city_id.country_id', '=?', country_id), "
+ "('city_id.state_id', '=?', state_id)]",
)
city_id = fields.Many2one(
index=True, # add index for performance
@@ -34,15 +33,6 @@ class ResPartner(models.Model):
)
state_id = fields.Many2one(compute="_compute_state_id", readonly=False, store=True)
- @api.depends("city_id")
- def _compute_allowed_zip_ids(self):
- for record in self:
- if record.city_id:
- domain = [("city_id", "=", record.city_id.id)]
- else:
- domain = []
- record.allowed_zip_ids = self.env["res.city.zip"].search(domain)
-
@api.depends("state_id", "country_id")
def _compute_zip_id(self):
"""Empty the zip auto-completion field if data mismatch when on UI."""
diff --git a/base_location/views/res_partner_view.xml b/base_location/views/res_partner_view.xml
index 14288c6c4..2fa118d38 100644
--- a/base_location/views/res_partner_view.xml
+++ b/base_location/views/res_partner_view.xml
@@ -6,7 +6,7 @@
-
+
-
+