Skip to Content
Menu
This question has been flagged
2 Replies
4019 Views

Hi everyone !

I'm Odoo newbie. Can everyone tell me how to change color of field on form view depends its value. I use colors='color:field==value' but it not working.

record id="demo_mask_form" model="ir.ui.view">

            <field name="name">Mask</field>

            <field name="model">demo.mask</field>

            <field name="arch" type="xml">

                <form string="Điểm" colors="red:result=='Fail';green:result=='Pass'">

                    <sheet>

                        <group>

                            <group>

                                <field name="student_code"/>

                                <field name="block_number"/>

                                <field name="year"/>


                            </group>

                            <group>

                                <field name="average"/>

                                <field name="result"/>

                            </group>

                        </group>

                        <notebook>

                            <page string="Điểm Số">

                                <field name="sub_mask_line">

                                    <tree editable="bottom">

                                        <field name="line_sub"/>

                                        <field name="mask_n"/>

                                    </tree>

                                </field>

                            </page>

                        </notebook>

                    </sheet>

                </form>

            </field>

        </record>


Avatar
Discard
Best Answer

Hello,

What you want to do ?

If you want to change color of string in tree view than you can do like below :

<tree ="Điểm" colors="red:result=='Fail';green:result=='Pass'">
I think it's help you. and for form view you may be add conditional css for this.

Avatar
Discard
Author Best Answer

Thanks for your answer colors='color:field==value'  also not working on tree view, I use  Colorize field app it working.

https://apps.odoo.com/apps/modules/8.0/web_tree_dynamic_colored_field/
Avatar
Discard