diff options
| author | Jorge Pinna Puissant <jpp@odoo.com> | 2019-01-29 09:56:19 +0000 |
|---|---|---|
| committer | Jorge Pinna Puissant <jpp@odoo.com> | 2019-01-29 13:18:24 +0000 |
| commit | 0edd3ea5b4367de18bfd11332075f1cb0a71ff2c (patch) | |
| tree | 346774b30c02c307da38ac0182123385b93f3953 | |
| parent | b6f11ace836e946eeeae110cdb08d16d80546238 (diff) | |
[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
| -rw-r--r-- | addons/base_address_city/models/res_partner.py | 12 |
1 files 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): }" /> <field name='city_id' placeholder="%(placeholder)s" string="%(placeholder)s" - context="{'default_country_id': country_id}" + context="{'default_country_id': country_id, + 'default_name': city, + 'default_zipcode': zip, + 'default_state_id': state_id}" domain="[('country_id', '=', country_id)]" attrs="{ 'invisible': [('country_enforce_cities', '=', False)], |
