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

Hi, I need to define the domain when the view appears (no action required, it should be automatic).

I'm trying to include some functionality on default_get, but I'm not getting results. I mean, in an on_change function you can return domain, but in default_get only the dictionary with values is accepted. 

Any suggestion?

This is the function as I have now.

def get_customer(self):
            cust = customer_in_pricelist.get_customer()
            if cust:
                return {'domain': [('cus_id', '=', cust)]}
            return {'domain': [('cus_id', '=', 0)]}

อวตาร
ละทิ้ง
ผู้เขียน

I'm trying to use fields_view_get but I'm a bit lost.

ผู้เขียน คำตอบที่ดีที่สุด

Solved changing for fields_view_get:

 

def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
           if context is None:
                context = {}
            res = super(bdd_quotations,self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu)
            res['fields']['pr_id']['domain'] = [('cus_id','=',customer_in_pricelist.get_customer())]
            return res

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

Try a functional field (store = False), which returns value for your filtering critteria,

then can use this field to filter it in xml

อวตาร
ละทิ้ง

Good Suggestion, it helps

Related Posts ตอบกลับ มุมมอง กิจกรรม
1
มี.ค. 15
5379
naked domain set up แก้ไขแล้ว
3
ก.ค. 25
4338
0
พ.ค. 25
893
2
มี.ค. 24
2162
0
ม.ค. 23
1754