Silviaa
Silviaa

Reputation: 485

OpenERP Tree Structure : field_parent

Im trying to display the Purchase and Purchase Order Line in Tree structure. When I click on PO Tree structure i need the below Format

PO1
 PO1Line1
 Po1line2
PO2
 PO2Line1

Tried the Below Code :

<record id="view_purchase_list" model="ir.ui.view">
        <field name="name">purchase.order.tree</field>
        <field name="model">purchase.order</field>
         <field name="type">tree</field>
         <field name="field_parent">order_line</field>
        <field name="arch" type="xml">
            <tree fonts="bold:message_unread==True" colors="grey:state=='cancel';blue:state in ('wait','confirmed');red:state in ('except_invoice','except_picking')" string="purchase_form_action">
                <field name="message_unread" invisible="1"/>
                <field icon="icon" name="name" string="Reference"/>
                <field name="date_order" />
                <field name="partner_id"/>
                <field name="origin"/>
                <field name="amount_total" sum="Total amount"/>
                <field name="state"/>
                <field name="product_id" invisible="1"/>
            </tree>
        </field>
 </record>

 <record id="action_purchase_list" model="ir.actions.act_window">
    <field name="name">PO Tree Structure</field>
    <field name="type">ir.actions.act_window</field>
    <field name="res_model">purchase.order</field>
    <field name="view_type">tree</field>
    <field name="view_id" ref="view_purchase_list"/>
    <field name="domain">[('state','in',('draft','sent','confirmed'))]</field>
    <field name="search_view_id" ref="view_purchase_order_filter"/>
 </record>

 <menuitem action="action_purchase_list" id="menu_purchase_list"
        parent="menu_procurement_management"
        sequence="0"/>

Im Getting only the header details with Expand Button Any advice will be helpful

Upvotes: 0

Views: 915

Answers (1)

OmaL
OmaL

Reputation: 5044

Its not possible to get drop down list view with two different models.One way is you have to create your own module which customizes the tree and form functionalities which is the hard way. You can see an example in this link.

Other way is just the reverse process of what you have done here. You are creating the view for purchase order. by clicking on purchase order you want to list the purchase order lines. my opinion is you create a view of purchase order lines and use the field_parent as the 'order_id'.

Upvotes: 1

Related Questions