[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
This commit is contained in:
@@ -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)],
|
||||
|
||||
Reference in New Issue
Block a user