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
- Accounting
- Inventory
- PoS
- Project management
- MRP
This question has been flagged
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';">
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign upRelated Posts | Replies | Views | Activity | |
---|---|---|---|---|
|
3
Apr 24
|
1972 | ||
|
0
Dec 19
|
4729 | ||
|
5
Oct 24
|
1962 | ||
color code in odoo tree view
Solved
|
|
3
Aug 22
|
4333 | |
|
3
Dec 17
|
2990 |
is there a méthode to change specific rows in tree view (condition) , but not all rows
thank you