Hi Odoo developers,
I want to set a background color for a specific tree view in a one2many field.How can i achieve this or is there any custom application available for this?
Thanks
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Kế toán
- Tồn kho
- PoS
- Project
- MRP
Câu hỏi này đã bị gắn cờ
Hi,
You can try the following steps for getting color to one2many field
Include your one2many field inside a div like below
<div class="background_black">
<field name="order_lines" attrs="{'readonly': [('state','!=','draft')]}"
style="background-color: #404040 !important;">
<tree string="Laundry Order Lines" editable="bottom"
decoration-info="state == 'draft'"
colors="grey:state == 'done';black:state == 'extra_work';green:state == 'wash';">
<field name="product_id"/>
<field name="description"/>
<field name="qty"/>
<field name="washing_type"/>
<field name="extra_work" widget="many2many_tags"/>
<field name="state"/>
<field name="amount"/>
</tree>
</field>
</div>
Here one2many field name is order_lines and assign a class to div, in the above case it is background_black.
Now we have to define style for this div class in a css file.Define template for including the style file
<template id="assets_backend_tablet" name="Field Background" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<link rel="stylesheet" href="laundry_management/static/src/css/background.css"/>
</xpath>
</template>
laundry_management is the module name, you can use your module name.And define style like below
.background_black .o_list_view{
background-color: #404040 !important;
}
And we can get the one2many field like below
Hope it helps
I tried the above method in version 14 but it doesn't work as expected.
Did you defined State? If yes, why it is not there in status bar?
If Invisible, how the states are changed based on the condition? Finally, Can you share a working module for this?
Can u describe this part?
<tree string="Laundry Order Lines" editable="bottom"
decoration-info="state == 'draft'"
colors="grey:state == 'done';black:state == 'extra_work';green:state == 'wash';">
Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng kýBài viết liên quan | Trả lời | Lượt xem | Hoạt động | |
---|---|---|---|---|
|
3
thg 4 24
|
2400 | ||
|
0
thg 12 19
|
5680 | ||
Line background color in list view
Đã xử lý
|
|
5
thg 10 24
|
5818 | |
color code in odoo tree view
Đã xử lý
|
|
3
thg 8 22
|
7440 | |
|
3
thg 12 17
|
4178 |
is there a méthode to change specific rows in tree view (condition) , but not all rows
thank you