Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
4 Trả lời
47159 Lượt xem

I m trying to find a solution to give color to fields in form view. For now i have given color to the label .

But i also want to color the value that is there for that field.Is there any widget that i can use to get color or do i have to create a css for it.

Ảnh đại diện
Huỷ bỏ

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

Câu trả lời hay nhất

You can just use inline css to get your goal
Like:

<field name="operator" style="background:Blue;" attrs="{'readonly':[('state', '=', 'done')]}"/>

if you need to give color for your letters, then use style="color:Red;" 

Ảnh đại diện
Huỷ bỏ

Note: For W3C compliant CSS: If you define the color property, you must also define the background-color. I needed to do this with Odoo v11.

Câu trả lời hay nhất

If you want you color to depend from a color field, check out https://www.dator.lu/blog/blog-1/color-char-field-4

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi ,

For that you need to create css and give the class name to the field.

ex: In Css file

.text_value_color {

    color: #052EF9;

}

In xml :

<field name="name" class="text_value_color"/>

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

It is a hint for you ?

https://www.odoo.com/forum/help-1/question/107387

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 9 22
7501
2
thg 12 23
12773
3
thg 7 22
23154
0
thg 6 22
2719
2
thg 6 21
18590