Odoo Help

0

On_chnage call on drop down

By
neeraj
on 4/10/14, 5:16 AM 1,041 views

I need a solution when i call on_changed function from drop down changed then it should fetch the data from the table and update data into second drop down. Could you please give me the sample code of tow related drop down.

0

Jagdish Panchal

--Jagdish Panchal--
Jagdish Panchal
2684
| 5 4 6
Gandhinagar, India
--Jagdish Panchal--

OpenERP Developer

Jagdish Panchal
On 4/10/14, 5:38 AM

Hi,

Refer this code

def onchange_chart_id(self, cr, uid, ids, chart_account_id=False, context=None):
    res = {}
    if chart_account_id:
        company_id = self.pool.get('account.account').browse(cr, uid, chart_account_id, context=context).company_id.id
        now = time.strftime('%Y-%m-%d')
        domain = [('company_id', '=', company_id), ('date_start', '<', now), ('date_stop', '>', now)]
        fiscalyears = self.pool.get('account.fiscalyear').search(cr, uid, domain, limit=1)
        res['value'] = {'company_id': company_id, 'fiscalyear_id': fiscalyears and fiscalyears[0] or False}
    return res

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

Register

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

0 follower(s)

Stats

Asked: 4/10/14, 5:16 AM
Seen: 1041 times
Last updated: 3/16/15, 8:10 AM