[IMP] base: do not update country on state change

In the partner form, when you change the state of the partner address and the country remains the same, it still triggers an update on the country field.

This change makes sure that the country is only updated when it has actually changed.

task-3143841

closes odoo/odoo#111230

Related: odoo/enterprise#36386
Related: odoo/upgrade#4277
Signed-off-by: Quentin De Paoli <qdp@odoo.com>
This commit is contained in:
Dylan Kiss (dyki)
2023-02-27 18:12:15 +01:00
parent d42a1736ca
commit ecfe8c890b
+1 -1
View File
@@ -474,7 +474,7 @@ class Partner(models.Model):
@api.onchange('state_id')
def _onchange_state(self):
if self.state_id.country_id:
if self.state_id.country_id and self.country_id != self.state_id.country_id:
self.country_id = self.state_id.country_id
@api.onchange('email')