[ADD] added onchange on country_id

bzr revid: bde@tinyerp.com-20120807101204-s7feg9o31fzodfty
This commit is contained in:
Bharat Devnani (OpenERP)
2012-08-07 15:42:04 +05:30
parent 0b1ef02059
commit 1756ab23ed
2 changed files with 9 additions and 2 deletions
+8 -1
View File
@@ -145,7 +145,14 @@ class res_company(osv.osv):
if vat: val.append(_('VAT: ')+vat)
if reg: val.append(_('Reg: ')+reg)
return {'value': {'rml_footer1':' | '.join(val)}}
def on_change_country(self, cr, uid, ids, country_id, context=None):
res_country_obj = self.pool.get('res.country')
if not country_id:
default_currency_id = self._get_euro(cr, uid, context=context)
return {'value': {'currency_id': default_currency_id}}
currency_id = res_country_obj.browse(cr, uid, country_id, context=context).currency_id.id
return {'value': {'currency_id': currency_id}}
def _search(self, cr, uid, args, offset=0, limit=None, order=None,
context=None, count=False, access_rights_uid=None):
+1 -1
View File
@@ -54,7 +54,7 @@
<field name="state_id" class="oe_no_button" placeholder="State" style="width: 24%%"/>
<field name="zip" placeholder="ZIP" style="width: 34%%"/>
</div>
<field name="country_id" placeholder="Country" class="oe_no_button"/>
<field name="country_id" placeholder="Country" class="oe_no_button" on_change="on_change_country(country_id)"/>
</div>
<field name="website" widget="url" placeholder="e.g. www.openerp.com"/>
</group>