Revert "[FIX] base: restrict state selection to the selected country"
[IMP] revert a serious usability issue: people creating an address can
not select a state: it's weird to have to set the country first.
This reverts commit 24aba6014c.
This commit is contained in:
@@ -351,6 +351,11 @@ class Partner(models.Model):
|
||||
result['value'] = {key: convert(self.parent_id[key]) for key in address_fields}
|
||||
return result
|
||||
|
||||
@api.onchange('state_id')
|
||||
def onchange_state(self):
|
||||
if self.state_id:
|
||||
self.country_id = self.state_id.country_id
|
||||
|
||||
@api.onchange('email')
|
||||
def onchange_email(self):
|
||||
if not self.image and not self._context.get('yaml_onchange') and self.email:
|
||||
|
||||
@@ -110,9 +110,7 @@
|
||||
<field name="street" placeholder="Street..." class="o_address_street"/>
|
||||
<field name="street2" placeholder="Street 2..." class="o_address_street"/>
|
||||
<field name="city" placeholder="City" class="o_address_city"/>
|
||||
<field name="state_id" class="o_address_state" placeholder="State"
|
||||
options='{"no_open": True}'
|
||||
domain="[('country_id', '=', country_id')]"/>
|
||||
<field name="state_id" class="o_address_state" placeholder="State" options='{"no_open": True}'/>
|
||||
<field name="zip" placeholder="ZIP" class="o_address_zip"/>
|
||||
<field name="country_id" placeholder="Country" class="o_address_country" options='{"no_open": True, "no_create": True}'/>
|
||||
</div>
|
||||
@@ -175,9 +173,7 @@
|
||||
<field name="city" placeholder="City" class="o_address_city"
|
||||
attrs="{'readonly': [('type', '=', 'contact'),('parent_id', '!=', False)]}"/>
|
||||
<field name="state_id" class="o_address_state" placeholder="State" options='{"no_open": True}'
|
||||
attrs="{'readonly': [('type', '=', 'contact'),('parent_id', '!=', False)]}"
|
||||
context="{'country_id': country_id, 'zip': zip}"
|
||||
domain="[('country_id', '=', country_id')]"/>
|
||||
attrs="{'readonly': [('type', '=', 'contact'),('parent_id', '!=', False)]}" context="{'country_id': country_id, 'zip': zip}"/>
|
||||
<field name="zip" placeholder="ZIP" class="o_address_zip"
|
||||
attrs="{'readonly': [('type', '=', 'contact'),('parent_id', '!=', False)]}"/>
|
||||
<field name="country_id" placeholder="Country" class="o_address_country" options='{"no_open": True, "no_create": True}'
|
||||
|
||||
Reference in New Issue
Block a user