Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
3 Odpowiedzi
16360 Widoki

Hello,

I'm asking if there is a way to put a specific background color for some fields on the tree view.

Thanks.

Awatar
Odrzuć

did you find a solution ?!!

Najlepsza odpowiedź

Hi,

Yes, it is possible to put a specific background color for some fields on the tree view in Odoo by using the List View Background Color app available on the Odoo app store.

You can refer to the following link to access the app on the Odoo app store:

https://apps.odoo.com/apps/modules/16.0/listview_change_background_color/

This app helps to Change The Color Of Important Or Favorite Records From Listview / Treeview. Which Helps To Save Your Time In Search The Records Manually All The Time. No Need To Worry, Now You Can Review Most Priority Records Very Easily And Quickly. It Is Available For Any Listview / Treeview. You Can Customize Color Based Upon Relevant Records And Needs.

Regards

Awatar
Odrzuć
Najlepsza odpowiedź

Use this module

https://apps.odoo.com/apps/modules/12.0/web_tree_dynamic_colored_field/

Awatar
Odrzuć
Najlepsza odpowiedź

I think you need to see this: forum.openerp.com/forum/topic28208.html

Below is how he did it:

Original code, form sale.view.xml: Code:

<record id="view_order_tree" model="ir.ui.view">
            <field name="name">sale.order.tree</field>
            <field name="model">sale.order</field>
            <field name="type">tree</field>
            <field name="priority">2</field>
            <field name="arch" type="xml">
                <tree string="Sales Orders" colors="grey:state=='cancel';blue:state in ('waiting_date','manual');red:state in ('invoice_except','shipping_except')">
                    <field name="name"/>
                    <field name="date_order"/>....

New code, in myfile.xml :

Code:

 <!-- Tree view. Replace colors -->
        <record id="sale_view_order_tree_inherit1" model="ir.ui.view">
            <field name="name">sale.view.order.tree.inherit1</field>
            <field name="model">sale.order</field>
            <field name="type">tree</field>
            <field name="inherit_id" ref="sale.view_order_tree"/>
            <field name="arch" type="xml">
                <xpath expr="//tree[@string='Sales Orders']" position="attributes">
                    <attribute name="colors">grey:state=='cancel';orange:state in ('waiting_date','manual');red:state in ('invoice_except','shipping_except')</attribute>
                </xpath>
            </field>
        </record>

I hope this helps you.

Awatar
Odrzuć
Autor

Hello, Thank you for your answer, but it's not that my problem. I need to change the background color for some column not the color of values.