Hi friends!!
Please who can help me?
I am really unable to resolve the problem.
In fact, i didnt understand the reason why the onchange is called when i press on the button create not on the field convention_id?!
Here is the code.
please help
XML:
<field name="convention_id" on_change="on_change_conventions_id(convention_id,company_id)" attrs="{'invisible': [('company_id','=',False)]}"/>
Python:
def get_inputs(self, cr, uid,ids, convention_id, company_id, context=None):
ret = []
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,
}
ret += [inputs]
return ret
def on_change_conventions_id(self, cr, uid, ids, convention_id, company_id, context=None):
res = {'value':{'seetek_line_ids': self.get_inputs(cr, uid, ids, convention_id, company_id, context=context),
}
}
return res