콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
2 답글
7734 화면

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

관련 게시물 답글 화면 활동
1
3월 15
4914
3
5월 25
2696
0
5월 25
182
2
3월 24
1336
0
1월 23
1197