Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

1

Tree view background color

By
aymen
on 9/27/13, 11:20 AM 2,990 views

Hello,

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

Thanks.

0
Abdullah Sofan
On 9/27/13, 6:30 PM

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.

aymen
on 9/30/13, 5:36 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

3 follower(s)

Stats

Asked: 9/27/13, 11:20 AM
Seen: 2990 times
Last updated: 3/16/15, 8:10 AM