odoo onchange function call


.py

def onchange_get_business_type(self, cr, uid, ids, event_type, context=None):
    result = {
        'business_type': False
    }
    event_ids = self.pool.get('event.type').search(cr, uid, [('id', '=', event_type)],context=context)
    event_obj = self.pool.get('event.type').browse(cr, uid, event_ids, context=context)
    result['business_type'] = event_obj.business_type
    return {'value':  result}

 

.xml

<field name="event_type" on_change="onchange_get_business_type(event_type)"/>
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s