<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
        <record id="stock_picking_inherit_sale" model="ir.ui.view">
            <field name="name">stock.picking.form</field>
            <field name="model">stock.picking</field>
            <field name="inherit_id" ref="stock.view_picking_form"/>
            <field name="arch" type="xml">
                <field name="move_type" position="before">
                    <field name="sale_id"/>
                </field>
            </field>
        </record>

        <record id="stock_move_sale" model="ir.ui.view">
            <field name="name">stock.move.form</field>
            <field name="model">stock.move</field>
            <field name="inherit_id" ref="stock.view_move_form"/>
            <field name="arch" type="xml">
                 <xpath expr="//group[@name='origin_grp']"  position="inside">
                    <field name="sale_line_id"/>
                </xpath>
            </field>
        </record>

        <!--
        <act_window
            domain="[('sale_id', '=', active_id)]"
            id="act_sale_order_2_stock_picking"
            name="Picking"
            res_model="stock.picking"
            src_model="sale.order"
            context="{'contact_display': 'partner'}" />

       <record id="action_sale_picking_out_tree_view" model="ir.actions.act_window.view">
            <field eval="1" name="sequence"/>
            <field name="view_mode">tree</field>
            <field name="view_id" ref="stock.view_picking_out_tree"/>
            <field name="act_window_id" ref="act_sale_order_2_stock_picking"/>
        </record>

        <record id="action_sale_picking_out_form_view" model="ir.actions.act_window.view">
            <field eval="2" name="sequence"/>
            <field name="view_mode">form</field>
            <field name="view_id" ref="stock.view_picking_out_form"/>
            <field name="act_window_id" ref="act_sale_order_2_stock_picking"/>
        </record>
        -->

        <!-- Adding Sales Order Reference to outgoing picking -->

        <record id="stock_picking_out_inherit_sale" model="ir.ui.view">
            <field name="name">Outgoing picking Inherited</field>
            <field name="model">stock.picking.out</field>
            <field name="inherit_id" ref="stock.view_picking_out_form"/>
            <field name="arch" type="xml">
                <field name="move_type" position="after">
                    <field name="sale_id"/>
                </field>
            </field>
        </record>

        <!--  Add menu: Billing - Deliveries to invoice -->
        <record id="outgoing_picking_list_to_invoice" model="ir.actions.act_window">
            <field name="name">Deliveries to Invoice</field>
            <field name="res_model">stock.picking.out</field>
            <field name="type">ir.actions.act_window</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form,calendar</field>
            <field name="domain">[('type','=','out')]</field>
            <field name="context">{'default_type': 'out', 'contact_display': 'partner_address', 'search_default_to_invoice': 1, 'search_default_done': 1, 'default_invoice_state': '2binvoiced'}</field>
            <field name="search_view_id" ref="stock.view_picking_out_search"/>
        </record>
        <menuitem action="outgoing_picking_list_to_invoice" id="menu_action_picking_list_to_invoice" parent="base.menu_invoiced" groups="sale_stock.group_invoice_deli_orders" sequence="20"/>

    </data>
</openerp>
