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

Hi All,

I have 3 classes (say class1, class2, class3). In class1, I have a checkbox (say cb1) and a many2one field (say field1). If the check box is True, the many2one field must load data from class2 (fields.many2one('class2','field1')). if checkbox is False, the many2one field must load data from class3 (fields.many2one('class3','field1')). Is it possible. Please help me with a solution. Thank you in advance.

 

 

Regards,

Emon.

 

아바타
취소
베스트 답변

Based on your requirement form view add  two different class many2one field. Based on condition hide one and shows others.

Example,

'class2_id':fields.many2one('table1', 'Table1'),

'class3_id:fields.many2one('table2', 'Table2'),

<field name="class2_id" attrs="{'invisible':[('ischeck','=',False)]}"/>

<field name="class3_id" attrs="{'invisible':[('ischeck','=',True)]}"/>

아바타
취소
작성자 베스트 답변

Thank you for the answer Prakash. But In my scenerio, I have only one field which must be linked with multiple classes. It must be saved in the single column in the table.

아바타
취소

In single column using domain you can filter value.

관련 게시물 답글 화면 활동
3
9월 25
1952
2
2월 25
6524
1
11월 22
16448
3
8월 22
13794
2
8월 22
4992