Odoo Help


how can I change the color of a field in list view based on the value of a boolean field in same view?

John Baldwin
on 2/17/15, 4:42 PM 1,248 views

I have a list view with a phone field named 'phone'.  I have a boolean on my form view for a "Do Not Call List" named 'dnc'. I've added dnc to my list view and made it invisible. I would like my phone field to be red where dnc==True. Everything I've tried fails. 

<record id="res_partner_view_tree" model="ir.ui.view">
            <field name="name">res.partner.view.tree</field>
            <field name="model">res.partner</field>
            <field eval="8" name="priority"/>
            <field name="inherit_id" ref="base.view_partner_tree"/>
            <field name="arch" type="xml">
                <xpath expr="//tree" position="replace">
                    <tree string="Contacts" colors="red:dnc=='1'">
                        <field name="display_name"/>
                        <field name="function" invisible="1"/>
                        <field name="street"/>
                        <field name="street2"/>
                        <field name="city"/>
                        <field name="state_id"/>
                        <field name="zip"/>
                        <field name="dnc"/>
                        <field name="phone"/>
                        <field name="email"/>
                        <field name="user_id" invisible="1"/>
                        <field name="is_company" invisible="1"/>
                        <field name="country_id" invisible="1"/>
                        <field name="parent_id" invisible="1"/>

John Baldwin
On 2/17/15, 4:50 PM

Found my mistake... bolleans have to be compared without ' '... 

<tree string="Contacts" colors="red:dnc==1"> <<<works.

About This Community

This platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 2/17/15, 4:42 PM
Seen: 1248 times
Last updated: 3/16/15, 8:10 AM