From 0edd3ea5b4367de18bfd11332075f1cb0a71ff2c Mon Sep 17 00:00:00 2001 From: Jorge Pinna Puissant Date: Tue, 29 Jan 2019 09:56:19 +0000 Subject: [PATCH] [FIX] base_address_city: lost information when creating Partner from Lead Have a Lead with the contact informations (Customer Name, Street, Street 2, City, State, ZIP, Country) completed in the 'Followup' page. Before this commit, when the base_adress_city module was installed, the informations of the City, State and ZIP where lost when we try to create a new Partner from the Lead. Now, the informations are present in the Partner form; furthermore if the country allows enforce cities, the information is also present in the enforce city form. OPW-1932018 closes odoo/odoo#30644 --- addons/base_address_city/models/res_partner.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/addons/base_address_city/models/res_partner.py b/addons/base_address_city/models/res_partner.py index 7591299f3e2..f8f01119e7d 100644 --- a/addons/base_address_city/models/res_partner.py +++ b/addons/base_address_city/models/res_partner.py @@ -15,9 +15,10 @@ class Partner(models.Model): @api.onchange('city_id') def _onchange_city_id(self): - self.city = self.city_id.name - self.zip = self.city_id.zipcode - self.state_id = self.city_id.state_id + if self.city_id: + self.city = self.city_id.name + self.zip = self.city_id.zipcode + self.state_id = self.city_id.state_id @api.model def _fields_view_get_address(self, arch): @@ -37,7 +38,10 @@ class Partner(models.Model): }" />