Skip to Content
मेन्यू
This question has been flagged
1 Reply
4361 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.

Avatar
Discard
Best Answer

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
Avatar
Discard
Related Posts Replies Views Activity
1
सित॰ 23
4977
10
जून 16
33091
1
अक्तू॰ 15
9281
4
अग॰ 15
3643
1
मार्च 15
4740