2
votes
<record id="view_category_list" model="ir.ui.view">
        <field name="name">res.partner.category.tree</field>
        <field name="model">res.partner.category</field>
        <field name="type">tree</field>
        <field name="field_parent">child_ids</field>
        <field name="arch" type="xml">
            <tree string="Partner Categories">
                <field name="name"/>
                <field name="parent_id" invisible="1"/>
            </tree>
        </field>
</record>

<record id="action_category_list" model="ir.actions.act_window">
        <field name="name">Tree Structure</field>
        <field name="type">ir.actions.act_window</field>
        <field name="res_model">res.partner.category</field>
        <field name="view_type">tree</field>
</record>

<record id="action_category_list_view" model="ir.actions.act_window.view">
        <field eval="10" name="sequence"/>
        <field name="view_mode">tree</field>
        <field name="view_id" ref="view_cr_category_list"/>
        <field name="act_window_id" ref="action_category_list"/>
</record>


<menuitem 
    name="Tree structure" 
    action="action_category_list" 
    id="menuitem_category_list" 
    parent="menu_category_main"/>

Hi! In OpenERP, I have tree view for tree structure in example above. When I click on Tree structure menu item, I get tree structure view, but without indentation between parents and children. Please, can somebody explain me how to make indentation. Also, if somebody explain me how to color parents.

I tried following:

<tree colors="blue:parent_id==0"/>
<tree colors="blue:parent_id==None"/>
<tree colors="blue:parent_id==False"/>

but not working. Any advice will be helpful.Thanks

1

1 Answers

3
votes

Try the following XML code

<record id="view_category_list" model="ir.ui.view">
        <field name="name">res.partner.category.tree</field>
        <field name="model">res.partner.category</field>
        <field name="type">tree</field>
        <field name="field_parent">child_ids</field>
        <field name="arch" type="xml">
            <tree string="Partner Categories">
                <field name="name"/>
                <field name="parent_id" invisible="1"/>
            </tree>
        </field>
</record>

<record id="action_category_list" model="ir.actions.act_window">
        <field name="name">Tree Structure</field>
        <field name="type">ir.actions.act_window</field>
        <field name="res_model">res.partner.category</field>
        <field name="view_type">tree</field>
        <field name="view_id" ref="view_category_list"/>
        <field name="domain">[('parent_id','=',False)]</field>
</record>

<menuitem 
    name="Tree structure" 
    action="action_category_list" 
    id="menuitem_category_list" 
    parent="club_menu"/>