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

Hi friends,

I've added a new char field named 'partner_level' to res.partner model. This field will be computed based on some calculations and is set to 'Blue', 'Silver', 'Bronze', and 'Gold'. 

In the form view of a contact, I want to show this field not by its value but by the color of each one. For example, I want to use blue color instead of the word Blue.

My solution is to put some div with a corresponding background color in view and then hide or show them based on the value of the field.

Now, my problem is how can I set conditions in form view. 

How can I refer to the value of the field in this case?

Does anyone has a better solution to fix my issue?




아바타
취소
베스트 답변

Try to use 4 divs like this:





<div class="blue" attrs="{'invisible': [('partner_level', '!=', 'blue')]}"/>
<div class="silver" attrs="{'invisible': [('partner_level', '!=', 'silver')]}"/>
<div class="gold" attrs="{'invisible': [('partner_level', '!=', 'gold')]}"/>
<div class="bronze" attrs="{'invisible': [('partner_level', '!=', 'bronze')]}"/>




Note: don't forget to define those css classes and include them in your manifest
아바타
취소
관련 게시물 답글 화면 활동
1
3월 24
2598
1
6월 23
2830
0
3월 24
2924
2
12월 16
5331
2
2월 16
9716