[IMP]:onchange state country selected automatically

bzr revid: aja@tinyerp.com-20121025093809-k907f1m17cvg648o
This commit is contained in:
ajay javiya (OpenERP) 2012-10-25 15:08:09 +05:30
parent 9582a8bc82
commit e23ade6f5d
2 changed files with 4 additions and 1 deletions

View File

@ -562,6 +562,9 @@ class res_partner(osv.osv, format_address):
address_format = '%(company_name)s\n' + address_format
return address_format % args
def onchange_state(self, cr, uid, ids, state_id, context=None):
state=self.pool.get('res.country.state').browse(cr, uid, state_id, context)
return {'value':{'country_id':state.country_id.id,'zip':''}}
# res.partner.address is deprecated; it is still there for backward compability only and will be removed in next version
class res_partner_address(osv.osv):
_table = "res_partner"

View File

@ -162,7 +162,7 @@
<field name="street2"/>
<div class="address_format">
<field name="city" placeholder="City" style="width: 40%%"/>
<field name="state_id" class="oe_no_button" placeholder="State" style="width: 37%%" options='{"no_open": True}'/>
<field name="state_id" class="oe_no_button" placeholder="State" style="width: 37%%" options='{"no_open": True}' on_change="onchange_state(state_id)"/>
<field name="zip" placeholder="ZIP" style="width: 20%%"/>
</div>
<field name="country_id" placeholder="Country" class="oe_no_button" options='{"no_open": True}'/>