跳至内容
菜单
此问题已终结
3 回复
16564 查看

Hello,

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

Thanks.

形象
丢弃

did you find a solution ?!!

最佳答案

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

形象
丢弃
最佳答案

Use this module

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

形象
丢弃
最佳答案

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.

形象
丢弃
编写者

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.