[FIX]onchange method for state
bzr revid: vja@tinyerp.com-20121129072334-mz4ydyni8toz1u8p
This commit is contained in:
parent
098ac4cf11
commit
f3d09104f9
|
@ -123,7 +123,7 @@ class res_company(osv.osv):
|
|||
'street2': fields.function(_get_address_data, fnct_inv=_set_address_data, size=128, type='char', string="Street2", multi='address'),
|
||||
'zip': fields.function(_get_address_data, fnct_inv=_set_address_data, size=24, type='char', string="Zip", multi='address'),
|
||||
'city': fields.function(_get_address_data, fnct_inv=_set_address_data, size=24, type='char', string="City", multi='address'),
|
||||
'state_id': fields.function(_get_address_data, fnct_inv=_set_address_data, type='many2one', domain="[('country_id', '=', country_id)]", relation='res.country.state', string="Fed. State", multi='address'),
|
||||
'state_id': fields.function(_get_address_data, fnct_inv=_set_address_data, type='many2one', relation='res.country.state', string="Fed. State", multi='address'),
|
||||
'bank_ids': fields.one2many('res.partner.bank','company_id', 'Bank Accounts', help='Bank accounts related to this company'),
|
||||
'country_id': fields.function(_get_address_data, fnct_inv=_set_address_data, type='many2one', relation='res.country', string="Country", multi='address'),
|
||||
'email': fields.function(_get_address_data, fnct_inv=_set_address_data, size=64, type='char', string="Email", multi='address'),
|
||||
|
@ -160,7 +160,11 @@ class res_company(osv.osv):
|
|||
res += '\n%s: %s' % (title, ', '.join(name for id, name in account_names))
|
||||
|
||||
return {'value': {'rml_footer': res, 'rml_footer_readonly': res}}
|
||||
|
||||
def onchange_state(self, cr, uid, ids, state_id, context=None):
|
||||
if state_id:
|
||||
country_id = self.pool.get('res.country.state').browse(cr, uid, state_id, context).country_id.id
|
||||
return {'value':{'country_id':country_id}}
|
||||
return {}
|
||||
def on_change_country(self, cr, uid, ids, country_id, context=None):
|
||||
currency_id = self._get_euro(cr, uid, context=context)
|
||||
if country_id:
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
<field name="street2"/>
|
||||
<div>
|
||||
<field name="city" placeholder="City" style="width: 40%%"/>
|
||||
<field name="state_id" class="oe_no_button" placeholder="State" style="width: 24%%" options='{"no_open": True}'/>
|
||||
<field name="state_id" class="oe_no_button" placeholder="State" on_change="onchange_state(state_id)" style="width: 24%%" options='{"no_open": True}'/>
|
||||
<field name="zip" placeholder="ZIP" style="width: 34%%"/>
|
||||
</div>
|
||||
<field name="country_id" placeholder="Country" class="oe_no_button" options='{"no_open": True}' on_change="on_change_country(country_id)"/>
|
||||
|
|
Loading…
Reference in New Issue