Wednesday, August 20, 2014

Change colors for Tree view in OpenERP 6

We can do this by inheriting the tree view, maybe our tree view has some color settings, but we can override  tree view attribute to have another color settings like this example:


The code like this will help:

<record model="ir.ui.view" id="project_workitem_task_tree_view">
            <field name="name">Project Task Tracker Tree</field>
            <field name="model">project.task</field>
            <field name="inherit_id" ref="project.view_task_tree2" />
            <field name="type">tree</field>
            <field name="arch" type="xml">
            <tree position="attributes">
   <attribute name="colors">red:project_workitem_action=='Check-in';black:project_workitem_action=='Check-out'</attribute>
</tree>
            <field name="name" position="before">
<button name="%(action_check_in_out_task)d" type='action' string='Check in / Check out' icon="terp-project" attrs="{'invisible':[('state','!=','open')]}"/>
<field name="project_workitem_action"></field>
                    <field name="last_check_out" widget="date"></field>
                <field name="last_check_out_calc" invisible="1"></field>  
</field>
</field>
       </record>

No comments:

Post a Comment