Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
4627 มุมมอง

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.

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

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
อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
ก.ย. 23
5339
How to use On change function? แก้ไขแล้ว
10
มิ.ย. 16
33561
1
ต.ค. 15
9713
4
ส.ค. 15
4004
1
มี.ค. 15
5072