Odoo Help

Welcome!

This community 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.

0

What makes an on-change functions before clicking?

By
Drees Far
on 7/21/15, 6:03 AM 277 views

Hello!!

Please, i work with on_change and get_inputs.

Here is my code:

PYTHON:

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

else:

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.append(inputs)

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

XML:

<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.

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

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