<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>

    <record model="ir.ui.view" id="sale_margin_sale_order">
        <field name="name">sale.order.margin.view.form</field>
        <field name="type">form</field>
        <field name="model">sale.order</field>
        <field name="inherit_id" ref="sale.view_order_form" />
        <field name="arch" type="xml">
            <field name="amount_total" position="after">
                <field name="margin"/>
            </field>
        </field>
    </record>
    
    <record model="ir.ui.view" id="sale_margin_sale_order_line">
        <field name="name">sale.order.line.margin.view.form</field>
        <field name="type">form</field>
        <field name="model">sale.order</field>
        <field name="inherit_id" ref="sale.view_order_form" />
        <field name="arch" type="xml">
            <xpath expr="/form/notebook/page/field[@name='order_line']/form/notebook/page/field[@name='price_unit']" position="after">
                <field name="purchase_price"/>
            </xpath>
        </field>
    </record>
    
    <record model="ir.ui.view" id="sale_margin_sale_order_line_form">
        <field name="name">sale.order.line.tree.margin.view.form</field>
        <field name="type">form</field>
        <field name="model">sale.order</field>
        <field name="inherit_id" ref="sale.view_order_form" />
        <field name="arch" type="xml">
           <xpath expr="/form/notebook/page/field[@name='order_line']/tree/field[@name='price_unit']" position="after">
                <field name="purchase_price"/>
            </xpath>
        </field>
    </record>
    
    <record model="ir.ui.view" id="sale_margin_sale_order_tree">
        <field name="name">sale.order.margin.view.tree</field>
        <field name="type">tree</field>
        <field name="model">sale.order</field>
        <field name="inherit_id" ref="sale.view_order_tree" />
        <field name="arch" type="xml">
            <field name="state" position="after">
                <field name="margin"/>
            </field>
        </field>
    </record>
   
    <record model="ir.ui.view" id="sale_margin_sale_order_line_tree">
        <field name="name">sale.order.margin.line.view.tree</field>
        <field name="type">tree</field>
        <field name="model">sale.order.line</field>
        <field name="inherit_id" ref="sale.view_order_line_tree" />
        <field name="arch" type="xml">
            <field name="price_subtotal" position="after">
                <field name="margin"/>
            </field>
        </field>
    </record>    
    
    
    <record model="ir.ui.view" id="view_picking_margin_out_form">
        <field name="name">picking.margin.view.form</field>
        <field name="type">form</field>
        <field name="model">stock.picking</field>
        <field name="inherit_id" ref="stock.view_picking_out_form" />
        <field name="arch" type="xml">
        <xpath expr="/form/notebook/page[@string='Additional info']" position="after">
            <page string="Customer Invoices">
               <field colspan="4" name="invoice_ids" nolabel="1"/>
            </page>    
        </xpath>
        </field>
    </record>
    
</data>
</openerp>
