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

i want to change the color and size text of an field inside the form view depending on the state , in know there is a possiblity to do so in tree view ,but how we can do the same in the form view ?

아바타
취소

hi, did you find any solution for this?

This Odoo app allows users to dynamically change the background and text color of any integer field based on a threshold value. The app introduces a customizable widget that automatically adjusts the visual representation of integer fields, allowing users to define their own colors for values below and above the threshold. Whether for financial figures, performance metrics, or other numeric values, users can easily tailor the display according to their preferences.
https://apps.odoo.com/apps/modules/17.0/mh_integer_field_color_widget

베스트 답변

Hi,
You can change the color and other css attributes of a field on the form view by using ‘style’ attribute inside fields. And if you want to show the colors or other attributes based on state you can use invisible attribute for the fields as like mentioned below.

<field name="test_field" style="background-color:red;font-size:60px;color:yellow;" attrs="{'invisible': [('state', '=', 'draft')]}"/>


<field name="test_field" style="background-color:red;font-size:60px;color:yellow;" attrs="{'invisible': [('state', '=', 'sale')]}"/>


Regards

아바타
취소