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

Hi Friends,

I have wrote onchange function for the journals to viewed for different type of name fields.But the query retruns the values only after executing query in pgadmin

    def onchange_sequence(self, cr, uid, id, sequence_type, context=None):
        res = []
        if sequence_type:
#            value =  super(invoice_changes, self).onchange_sequence(cr, uid, id, sequence_type, context)
            cr.execute('select jl.journal_id\
                            from journal_type as jt\
                            left join journal_lines as jl on(jl.journ_id = jt.id)\
                            left join account_invoice as ai on (ai.sequence_type = jt.id)\
                            left join res_company as rc on (rc.id = jt.company_id)\
                            where ai.sequence_type = %s', (sequence_type,))
            for result in cr.fetchall():
                print "\n\n resultssssssssssssssssssssssssssssssssssssssssssssssss",result
                res.append(result[0])
            return {
                'domain': {
                      'journal_id': [('id', 'in', res)]
            } }
        return {}

 

please help me to resolve this problem

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

Does sequence_type  value is set with _defaults, so that the on_change can be triggered when value is available.  

If not try with adding a default value for sequence_type 

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

Well ... your super method call is above your query, so maybe you should switch that around? Chances are I'm not really getting what you are trying to achieve.

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
2
ก.พ. 23
4091
1
ม.ค. 22
4151
2
มี.ค. 15
5485
change between 2 Invoice formats แก้ไขแล้ว
1
ก.ค. 25
524
2
ก.ค. 25
669