Odoo Help


What makes an on-change functions before clicking?

Vale Trood
on 7/21/15, 6:03 AM 471 views


Please, i work with on_change and get_inputs.

Here is my code:


def get_inputs(self, cr, uid,ids, convention_id, company_id, context=None):

ret = []

if convention_id == False:

My_error_Msg = 'Please, select your CONVENTION'

raise osv.except_osv(_("Error!"), _(My_error_Msg))

return False


obj = self.pool.get('seetek.convention.categorie.line')

obj_ids = obj.search(cr, uid, [('convention_id', '=', convention_id)])

res = obj.read(cr, uid, obj_ids, ['nom','nature','id'], context)

for r in res :

inputs = {

'company_convention_categorie_id': r['id'],

'company_id': company_id,

'nom': r['nom'],

'nature': r['nature'],

'actif': True,



return ret

def on_change_convention_id(self, cr, uid, ids, convention_id, company_id, context=None):

res = {'value':{line_ids': self.get_inputs(cr, uid, ids, convention_id, company_id, context=context),



return res


<field name="convention_ids" on_change="on_change_convention_id(convention_ids,company_ids)" attrs="{'invisible': [('company_ids','=',False)]}"/>

My question is that, before i click on the convention_ids field the get_inputs functions and give me all the values??

Please, who can help?!

Thanks a lot in advance.

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 7/21/15, 6:03 AM
Seen: 471 times
Last updated: 7/21/15, 6:32 AM