<openerp>
    <data>
        <menuitem icon="terp-partner" id="base.menu_base_partner" name="Sales" sequence="0" groups="base.group_sale_salesman,base.group_sale_manager"/>

        <menuitem id="base.menu_sales" name="Sales" parent="base.menu_base_partner" sequence="1"/>

        <menuitem id="base.menu_product" name="Products" parent="base.menu_base_partner" sequence="9"/>         

        <record id="view_shop_form" model="ir.ui.view">
            <field name="name">sale.shop</field>
            <field name="model">sale.shop</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Sales Shop">
                    <field name="name" select="1"/>
                    <field name="warehouse_id" required="1" select="1" widget="selection"/>
                    <field name="company_id" widget="selection" groups="base.group_multi_company"/>
                    <separator colspan="4" string="Accounting"/>
                    <field name="payment_default_id"/>
                    <field domain="[('type','=','sale')]" name="pricelist_id" select="1"/>
                    <field name="project_id" select="1" groups="analytic.group_analytic_accounting"/>
                </form>
            </field>
        </record>
        <record id="view_shop_tree" model="ir.ui.view">
            <field name="name">sale.shop</field>
            <field name="model">sale.shop</field>
            <field name="type">tree</field>
            <field name="arch" type="xml">
                <tree string="Sales Shop">
                    <field name="name"/>
                    <field name="warehouse_id"/>
                    <field name="pricelist_id"/>
                    <field name="project_id" groups="analytic.group_analytic_accounting"/>
                </tree>
            </field>
        </record>

        <record id="action_shop_form" model="ir.actions.act_window">
            <field name="name">Shop</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">sale.shop</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
            <field name="view_id" ref="view_shop_tree"/>
            <field name="help">If you have more than one shop reselling your company products, you can create and manage that from here. Whenever you will record a new quotation or sales order, it has to be linked to a shop. The shop also defines the warehouse from which the products will be delivered for each particular sales.</field>
        </record>

        <menuitem action="action_shop_form" id="menu_action_shop_form" parent="base.menu_sale_config_sales" sequence="0"/>

        <record id="view_sale_order_calendar" model="ir.ui.view">
            <field name="name">sale.order.calendar</field>
            <field name="model">sale.order</field>
            <field name="type">calendar</field>
            <field name="arch" type="xml">
                <calendar string="Sales Orders" color="state" date_start="date_order">
                    <field name="partner_id"/>
                    <field name="amount_total"/>
                </calendar>
            </field>
        </record>
        <record model="ir.ui.view" id="view_sale_order_graph">
            <field name="name">sale.order.graph</field>
            <field name="model">sale.order</field>
            <field name="type">graph</field>
            <field name="arch" type="xml">
                <graph string="Sales Orders" type="bar">
                    <field name="partner_id"/>
                    <field name="amount_total" operator="+"/>
                </graph>
            </field>
        </record>

        <record id="view_order_tree" model="ir.ui.view">
            <field name="name">sale.order.tree</field>
            <field name="model">sale.order</field>
            <field name="type">tree</field>
            <field name="priority">2</field>
            <field name="arch" type="xml">
                <tree string="Sales Orders" colors="grey:state=='cancel';blue:state in ('waiting_date','manual');red:state in ('invoice_except','shipping_except')">
                    <field name="name"/>
                    <field name="date_order"/>
                    <field name="client_order_ref" groups="base.group_extended"/>
                    <field name="partner_id"/>
                    <field name="user_id"/>
                    <field name="picked_rate" widget="progressbar"/>
                    <field name="invoiced_rate" widget="progressbar"/>
                    <field name="amount_untaxed" sum="Total Tax Excluded"/>
                    <field name="amount_total" sum="Total Tax Included"/>
                    <field name="state"/>
                </tree>
            </field>
        </record>

        <record id="view_order_form" model="ir.ui.view">
            <field name="name">sale.order.form</field>
            <field name="model">sale.order</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Sales Order">
                    <group col="6" colspan="4">
                        <field name="name"/>
                        <field name="date_order"/>
                        <field name="invoiced"/>
                        <field name="shop_id" on_change="onchange_shop_id(shop_id)" widget="selection"/>
                        <field name="client_order_ref"/>
                        <field name="shipped"/>
                    </group>
                    <notebook colspan="5">
                        <page string="Sales Order">
                            <field name="partner_id" on_change="onchange_partner_id(partner_id)" domain="[('customer','=',True)]" context="{'search_default_customer':1}" required="1"/>
                            <field domain="[('partner_id','=',partner_id)]" name="partner_order_id"/>
                            <field domain="[('partner_id','=',partner_id)]" name="partner_invoice_id" groups="base.group_extended"/>
                            <field domain="[('partner_id','=',partner_id)]" name="partner_shipping_id" groups="base.group_extended"/>
                            <field domain="[('type','=','sale')]" name="pricelist_id" groups="base.group_extended"/>
                            <field name="project_id" context="{'partner_id':partner_id, 'contact_id':partner_order_id, 'pricelist_id':pricelist_id, 'default_name':name}" groups="analytic.group_analytic_accounting" domain="[('parent_id','!=',False)]"/>
                            <newline/>
                            <field colspan="4" mode="tree,form,graph" name="order_line" nolabel="1" widget="one2many_list">
                                <form string="Sales Order Lines">
                                    <notebook>
                                        <page string="Order Line">
                                            <field colspan="4" context="{'partner_id':parent.partner_id, 'quantity':product_uom_qty, 'pricelist':parent.pricelist_id, 'shop':parent.shop_id, 'uom':product_uom}" name="product_id" on_change="product_id_change(parent.pricelist_id,product_id,product_uom_qty,product_uom,product_uos_qty,product_uos,name,parent.partner_id, False, True, parent.date_order, product_packaging, parent.fiscal_position, False, context)"/>
                                            <field context="{'partner_id':parent.partner_id, 'quantity':product_uom_qty, 'pricelist':parent.pricelist_id, 'shop':parent.shop_id, 'uom':product_uom}" name="product_uom_qty" on_change="product_id_change(parent.pricelist_id,product_id,product_uom_qty,product_uom,product_uos_qty,product_uos,name,parent.partner_id, False, False, parent.date_order, product_packaging, parent.fiscal_position, True, context)"/>
                                            <field name="product_uom" on_change="product_uom_change(parent.pricelist_id,product_id,product_uom_qty,product_uom,product_uos_qty,product_uos,name,parent.partner_id, False, False, parent.date_order, context)"/>
                                            <field groups="product.group_uos" name="product_uos_qty"/>
                                            <field groups="product.group_uos" name="product_uos"/>
                                            <field name="product_packaging" context="{'partner_id':parent.partner_id, 'quantity':product_uom_qty, 'pricelist':parent.pricelist_id, 'shop':parent.shop_id, 'uom':product_uom}" on_change="product_id_change(parent.pricelist_id,product_id,product_uom_qty,product_uom,product_uos_qty,product_uos,name,parent.partner_id, False, False, parent.date_order, product_packaging, parent.fiscal_position, False, context)" domain="[('product_id','=',product_id)]" groups="base.group_extended"/>

                                            <field colspan="4" name="name"/>
                                            <field name="price_unit"/>
                                            <field name="discount"/>
                                            <field name="type" groups="base.group_extended"/>
                                            <field name="delay" groups="base.group_extended"/>
                                            <newline/>
                                            <separator colspan="5" string="Taxes"/>
                                            <field colspan="4" name="tax_id" nolabel="1" domain="[('parent_id','=',False),('type_tax_use','&lt;&gt;','purchase')]"/>
                                            <group colspan="4" col="5" groups="base.group_extended">
                                                <separator colspan="5" string="States"/>
                                                <field name="state"/>
                                                <field name="invoiced"/>
                                                <group attrs="{'invisible':[('invoiced','=',True)]}">
                                                <button colspan="1" name="%(action_view_sale_order_line_make_invoice)d" states="confirmed" string="Make Invoices" type="action" icon="terp-document-new"/>
                                                 </group>
                                            </group>
                                        </page>
                                        <page groups="base.group_extended" string="Extra Info">
                                            <field name="th_weight"/>
                                            <field name="address_allotment_id"/>
                                            <field name="property_ids" colspan="4"/>
                                        </page>
                                        <page string="Notes">
                                            <field colspan="4" name="notes" nolabel="1"/>
                                        </page>
                                        <page string="History" groups="base.group_extended">
                                            <separator colspan="4" string="Invoice Lines"/>
                                            <field colspan="4" name="invoice_lines" nolabel="1"/>
                                            <separator colspan="4" string="Stock Moves"/>
                                            <field colspan="4" name="move_ids" nolabel="1" widget="many2many"/>
                                        </page>
                                    </notebook>
                                </form>
                                <tree string="Sales Order Lines">
                                    <field colspan="4" name="name"/>
                                    <field name="product_uom_qty" string="Qty"/>
                                    <field name="product_uom" string="UoM"/>
                                    <field name="discount"/>
                                    <field name="price_unit"/>
                                    <field name="price_subtotal"/>
                                </tree>
                            </field>
                            <newline/>
                            <group col="13" colspan="10">
                                <field name="amount_untaxed" sum="Untaxed amount"/>
                                <field name="amount_tax"/>
                                <field name="amount_total"/>
                                <button name="button_dummy" states="draft" string="Compute" type="object" icon="gtk-execute"/>
                                <button name="%(action_view_sale_advance_payment_inv)d" string="Advance Invoice" type="action" icon="gtk-execute" states="draft,manual" groups="base.group_extended"/>
                            </group>
                            <group col="13" colspan="4">
                                <field name="state"/>
                                <button name="invoice_recreate" states="invoice_except" string="Recreate Invoice" icon="gtk-go-forward"/>
                                <button name="invoice_corrected" states="invoice_except" string="Ignore Exception" icon="gtk-apply"/>
                                <button name="ship_recreate" states="shipping_except" string="Recreate Packing" icon="gtk-ok"/>
                                <button name="ship_corrected" states="shipping_except" string="Ignore Exception" icon="gtk-apply"/>
                                <button name="action_cancel" states="manual,progress" string="Cancel Order" type="object" icon="gtk-cancel"/>
                                <button name="manual_invoice" states="manual" string="Create Final Invoice" icon="gtk-go-forward" type="object"/>
                                <button name="ship_cancel" states="shipping_except" string="Cancel Order" icon="gtk-cancel"/>
                                <button name="action_cancel_draft" states="cancel" string="Set to Draft" type="object" icon="gtk-convert"/>
                                <button name="cancel" states="draft" string="Cancel Order" icon="gtk-cancel"/>
                                <button name="invoice_cancel" states="invoice_except" string="Cancel Order" icon="gtk-cancel"/>
                                <button name="order_confirm" states="draft" string="Confirm Order" icon="gtk-apply"/>
                            </group>
                        </page>
                        <page string="Other Information">
                            <group colspan="2" col="2" groups="base.group_extended" name="logistics">
                                <separator string="Logistic" colspan="2"/>
                                <field name="incoterm" widget="selection"/>
                                <field name="picking_policy" required="True"/>
                                <field name="order_policy" on_change="shipping_policy_change(order_policy)"/>
                                <field name="invoice_quantity" attrs="{'readonly':[('order_policy','in',('prepaid','picking'))]}"/>
                            </group>
                            <group colspan="2" col="2">
                                <separator string="References" colspan="2"/>
                                <field name="user_id"/>
                                <field groups="base.group_extended" name="origin"/>
                            </group>
                            <group colspan="2" col="2" groups="base.group_extended">
                                <separator string="Conditions" colspan="2"/>
                                <field name="payment_term" widget="selection"/>
                                <field name="fiscal_position" widget="selection"/>
                                <field name="company_id" widget="selection" groups="base.group_multi_company"/>
                            </group>
                            <group colspan="2" col="2" groups="base.group_extended">
                                <separator string="Dates" colspan="2"/>
                                <field name="create_date" widget="datetime"/>
                                <field name="date_confirm"/>
                            </group>
                            <separator colspan="4" string="Notes"/>
                            <field colspan="4" name="note" nolabel="1"/>
                        </page>
                        <page string="History" groups="base.group_extended">
                            <separator colspan="4" string="Invoices"/>
                            <field colspan="4" name="invoice_ids" nolabel="1" context="{'form_view_ref':'account.invoice_form'}"/>
                            <separator colspan="4" string="Packings"/>
                            <field colspan="4" name="picking_ids" nolabel="1"/>
                        </page>
                    </notebook>
                </form>
            </field>
        </record>

        <record id="view_sales_order_filter" model="ir.ui.view">
            <field name="name">sale.order.list.select</field>
            <field name="model">sale.order</field>
            <field name="type">search</field>
            <field name="arch" type="xml">
                <search string="Search Sales Order">
                    <filter icon="terp-document-new" string="Quotations" domain="[('state','=','draft')]" help="Sales Order that haven't yet been confirmed"/>
                    <filter icon="terp-check" string="Sales" domain="[('state','in',('manual','progress'))]"/>
                    <separator orientation="vertical"/>
                    <filter icon="terp-dolar_ok!" string="To Invoice" domain="[('state','=','manual')]" help="Sales Order ready to be invoiced"/>
                    <separator orientation="vertical"/>
                    <field name="name" select="1"/>
                    <field name="date_order" select="1" string="Order date"/>
                    <field name="partner_id" select="1"/>
                    <field name="user_id" select="1">
                        <filter domain="[('user_id','=',uid)]" help="My Sale Orders" icon="terp-personal"/>
                    </field>
                    <newline/>
                    <group expand="0" string="Group By..." colspan="11" col="11" groups="base.group_extended">
                        <filter string="Customer" icon="terp-personal" domain="[]" context="{'group_by':'partner_id'}"/>
                        <filter string="Salesman" icon="terp-personal" domain="[]" context="{'group_by':'user_id'}"/>
                        <separator orientation="vertical"/>
                        <filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
                        <separator orientation="vertical"/>
                        <filter string="Order Date" icon="terp-go-month" domain="[]" context="{'group_by':'date_order'}"/>
                    </group>
               </search>
            </field>
        </record>

        <record id="action_order_form" model="ir.actions.act_window">
            <field name="name">Sales Orders</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">sale.order</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form,calendar,graph</field>
            <field name="search_view_id" ref="view_sales_order_filter"/>
            <field name="context">{"search_default_user_id":uid}</field>
            <field name="help">Sales Orders help you manage quotations and orders from your customers. OpenERP suggests that you start by creating a quotation. Once it is confirmed, the quotation will be converted into a Sales Order. OpenERP can handle several types of products so that a sales order may trigger tasks, delivery orders, manufacturing orders, purchases and so on. Based on the configuration of the sales order, a draft invoice will be generated so that you just have to confirm it when you want to bill your customer.</field>
        </record>
        <menuitem action="action_order_form" id="menu_sale_order" parent="base.menu_sales" sequence="3" groups="base.group_sale_salesman,base.group_sale_manager"/>

        <record id="action_order_tree2" model="ir.actions.act_window">
            <field name="name">Sales in Exception</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">sale.order</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form,calendar,graph</field>
            <field name="domain">[('state','in',('shipping_except','invoice_except'))]</field>
            <field name="filter" eval="True"/>
            <field name="search_view_id" ref="view_sales_order_filter"/>
        </record>

        <record id="action_order_tree4" model="ir.actions.act_window">
            <field name="name">Sales Order in Progress</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">sale.order</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form,calendar,graph</field>
            <field name="domain">[('state','in',('progress','waiting_date','manual'))]</field>
            <field name="search_view_id" ref="view_sales_order_filter"/>
        </record>


        <record id="action_order_tree5" model="ir.actions.act_window">
            <field name="name">All Quotations</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">sale.order</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form,calendar,graph</field>
            <field name="domain">[('state','=','draft')]</field>
            <field name="search_view_id" ref="view_sales_order_filter"/>
        </record>

        <record id="action_order_tree" model="ir.actions.act_window">
            <field name="name">Old Quotations</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">sale.order</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form,calendar,graph</field>
            <field name="domain">[('state','=','draft'),('date_order','&lt;',time.strftime('%Y-%m-%d %H:%M:%S'))]</field>
            <field name="filter" eval="True"/>
            <field name="search_view_id" ref="view_sales_order_filter"/>
        </record>

        <record id="view_order_line_graph" model="ir.ui.view">
            <field name="name">sale.order.line.graph</field>
            <field name="model">sale.order.line</field>
            <field name="type">graph</field>
            <field name="arch" type="xml">
                <graph string="Sales Order Lines">
                    <field name="product_id"/>
                    <field name="price_subtotal" operator="+"/>
                </graph>
            </field>
        </record>

        <record id="view_order_line_tree" model="ir.ui.view">
            <field name="name">sale.order.line.tree</field>
            <field name="model">sale.order.line</field>
            <field name="type">tree</field>
            <field name="arch" type="xml">
                <tree string="Sales Order Lines">
                    <field name="order_id"/>
                    <field name="order_partner_id"/>
                    <field name="product_id"/>
                    <field name="product_uom_qty" string="Qty"/>
                    <field name="product_uom" string="UoM"/>
                    <field name="salesman_id"/>
                    <field name="price_subtotal" sum="Total"/>
                    <field name="state"/>
                    <field name="invoiced"/>
                </tree>
            </field>
        </record>
        <record id="view_order_line_form2" model="ir.ui.view">
            <field name="name">sale.order.line.form2</field>
            <field name="model">sale.order.line</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Sales Order Lines">
                    <group colspan="4" col="6">
                        <field name="order_id"/>
                        <field name="order_partner_id" readonly="1" invisible="1"/>
                        <field name="invoiced"/>

                        <field name="product_id" readonly="1"/>
                        <field name="product_uom_qty" readonly="1"/>
                        <field name="product_uom"/>

                        <field colspan="4" name="name" groups="base.group_extended"/>
                        <field name="company_id" groups="base.group_multi_company" readonly="1"/>
                    </group>
                    <separator colspan="4" string="Price"/>
                    <group colspan="4" col="6">
                        <field name="price_unit"/>
                        <field name="discount"/>
                        <field name="price_subtotal"/>
                    </group>
                    <separator colspan="4" string="Notes"/>
                    <field colspan="4" name="notes" nolabel="1"/>
                    <separator colspan="4"/>
                    <field name="state"/>
                    <group col="3" colspan="2">
                        <button name="button_cancel" string="Cancel" type="object" icon="gtk-cancel" states="confirmed,exception"/>
                        <button colspan="1" name="%(action_view_sale_order_line_make_invoice)d" string="Create Invoice" type="action" states="done" icon="gtk-go-forward" attrs="{'invisible': [('invoiced', '=', 1)]}"/>
                        <button name="button_done" string="Done" type="object" states="confirmed,exception" icon="gtk-go-forward"/>
                    </group>
                </form>
            </field>
        </record>

        <record id="view_sales_order_line_filter" model="ir.ui.view">
            <field name="name">sale.order.line.select</field>
            <field name="model">sale.order.line</field>
            <field name="type">search</field>
            <field name="arch" type="xml">
                <search string="Search Sales Order">
                    <filter icon="terp-dolar_ok!" string="To Invoice" domain="[('invoiced','&lt;&gt;', 1),('state','=','done')]" separator="1" help="Sale Order Lines ready to be invoiced"/>
                    <separator orientation="vertical"/>
                    <field name="order_id"/>
                    <field name="order_partner_id"/>
                    <field name="product_id"/>
                    <field name="salesman_id">
                        <filter icon="terp-personnal" domain="[('salesman_id','=',uid)]" help="Sales Order Lines related to a Sales Order of mine"/>
                    </field>
                    <newline/>
                    <group expand="context.get('report',False)" string="Group By..." colspan="9" col="8">
                        <filter string="Product" icon="terp-accessories-archiver" domain="[]" context="{'group_by':'product_id'}"/>
                        <filter string="Order" icon="terp-gtk-jump-to-rtl" domain="[]" context="{'group_by':'order_id'}"/>
                        <filter string="Salesman" icon="terp-personal" domain="[]" context="{'group_by':'salesman_id'}"/>
                        <filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
                    </group>
                </search>
            </field>
        </record>

        <record id="view_sales_order_uninvoiced_line_filter" model="ir.ui.view">
            <field name="name">sale.order.uninvoiced.line</field>
            <field name="model">sale.order.line</field>
            <field name="type">search</field>
            <field name="arch" type="xml">
                <search string="Search Uninvoiced Lines">
                    <filter icon="terp-gtk-go-back-rtl" string="To Do" domain="[('state','=','confirmed')]" name="sale order" help="Confirmed sale order lines, not yet delivered"/>
                    <filter icon="terp-dialog-close" string="Done" domain="[('state','=','done')]" name="sale_order_done" help="Sale order lines done"/>
                    <separator orientation="vertical"/>
                    <filter icon="terp-accessories-archiver" string="Shipped" domain="[('state','=','done')]" name="unshipped" help="Sale Order Lines that are in 'done' state"/>
                    <filter icon="terp-dolar_ok!" string="Uninvoiced" name="uninvoiced" domain="[('invoiced','&lt;&gt;', 1),('state','&lt;&gt;','draft'),('state','&lt;&gt;','cancel')]" help="Sale Order Lines that are confirmed, done or in exception state and haven't yet been invoiced"/>
                    <separator orientation="vertical"/>
                    <field name="order_id"/>
                    <field name="order_partner_id"/>
                    <field name="product_id"/>
                    <field name="salesman_id">
                        <filter icon="terp-personal" domain="[('salesman_id','=',uid)]" help="My Sales Order Lines"/>
                    </field>
                    <newline/>
                    <group expand="0" string="Group By..." colspan="9" col="8">
                        <filter string="Order" icon="terp-gtk-jump-to-rtl" domain="[]" context="{'group_by':'order_id'}" help="Order reference"/>
                        <filter string="Product" icon="terp-accessories-archiver" domain="[]" context="{'group_by':'product_id'}"/>
                        <separator orientation="vertical"/>
                        <filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
                    </group>
                </search>
            </field>
        </record>

        <record id="action_order_line_tree2" model="ir.actions.act_window">
            <field name="name">Lines to Invoice</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">sale.order.line</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form,graph</field>
            <field name="search_view_id" ref="view_sales_order_uninvoiced_line_filter"/>
            <field name="context">{"search_default_uninvoiced":1}</field>
            <field name="filter" eval="True"/>
            <field name="help">Here is a list of each sales order line to be invoiced. You can invoice sales orders partially, by lines of sales order. You do not need this list if you invoice from the delivery orders or if you invoice sales totally.</field>
        </record>

        <record id="action_order_line_tree3" model="ir.actions.act_window">
            <field name="name">Uninvoiced and Delivered Lines</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">sale.order.line</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form,graph</field>
            <field name="domain">[('invoiced','&lt;&gt;', 1),('state','=','done')]</field>
            <field name="filter" eval="True"/>
        </record>

        <act_window
            context="{'search_default_partner_id': [active_id], 'default_partner_id': active_id}"
            id="act_res_partner_2_sale_order"
            name="Quotations and Sales"
            groups="base.group_sale_salesman"
            res_model="sale.order"
            src_model="res.partner"/>

        <act_window
            context="{'search_default_product_id': [active_id], 'default_product_id': active_id}"
            id="action_order_line_product_tree"
            name="Sales Order Lines"
            res_model="sale.order.line"
            src_model="product.product"
            groups="base.group_sale_salesman"/>

        <menuitem id="menu_invoiced" name="Invoicing" parent="base.menu_base_partner" sequence="5" groups="-base.group_extended"/>
        <menuitem id="menu_invoicing_sales_order_lines" parent="menu_invoiced" action="action_order_line_tree2" sequence="2" groups="base.group_no_one"/>

        <!-- configartion view -->

        <record id="view_config_picking_policy" model="ir.ui.view">
            <field name="name">Set Up Your Invoicing Method</field>
            <field name="model">sale.config.picking_policy</field>
            <field name="type">form</field>
            <field name="inherit_id" ref="base.res_config_view_base"/>
            <field name="arch" type="xml">
              <data>
                <form position="attributes">
                  <attribute name="string">Sales Application Configuration</attribute>
                </form>
                <group colspan="4" col="8" position="replace">
                    <group colspan="8">
                        <separator string="How do you generate your costumer invoice ?"/>
                    </group>
                    <group colspan="8" col="2">
                        <label align="0.0" string="Based on Sales Orders" width="200" colspan="1"/>
                        <field name="sale_orders" on_change="onchange_order(sale_orders,deli_orders)" nolabel="1"/>
                        <label align="0.0" string="Based on Delivery Orders" width="200" colspan="1"/>
                        <field name="deli_orders" on_change="onchange_order(sale_orders,deli_orders)" nolabel="1"/>
                        <label align="0.0" string="Based on Task's Work" width="200" colspan="1"/>
                        <field name="task_work" nolabel="1"/>
                        <label align="0.0" string="Based on Timesheet" width="200" colspan="1"/>
                        <field name="timesheet" nolabel="1"/>
                    </group>
                    <group colspan="8">
                        <separator string="Options"/>
                    </group>
                    <group colspan="8">
                        <group colspan="4" col="2" attrs="{'invisible':['|',('sale_orders','!=',True),('deli_orders','!=',True)]}">
                            <label align="0.0" string="Main Method Based On" width="200" colspan="1"/>
                            <field name="order_policy" nolabel="1"/>
                        </group>
                        <group colspan="4" col="2" attrs="{'invisible':[('sale_orders','!=',True), ('deli_orders','!=',True)]}">
                            <label align="0.0" string="Do you charge the delivery" width="200" colspan="1"/>
                            <field name="charge_delivery" nolabel="1"/>
                        </group>
                        <group colspan="4" col="2" attrs="{'invisible':[('task_work','=',False),('timesheet','=',False)]}">
                            <label align="0.0" string="Main Working Time Unit" width="200" colspan="1"/>
                            <field name="time_unit" widget="selection" domain="[('category_id','=',3)]" nolabel="1"/>
                        </group>
                    </group>
                </group>
                <xpath expr="//button[@name=&quot;action_skip&quot;]" position="replace"/>
              </data>
            </field>
        </record>

        <record id="action_config_picking_policy" model="ir.actions.act_window">
            <field name="name">Set up your Invoicing Method</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">sale.config.picking_policy</field>
            <field name="view_id" ref="view_config_picking_policy"/>
            <field name="view_type">form</field>
            <field name="view_mode">form</field>
            <field name="target">new</field>
        </record>

        <!-- register configuration wizard -->
        <record id="config_wizard_step_sale_picking_policy" model="ir.actions.todo">
            <field name="action_id" ref="action_config_picking_policy"/>
            <field name="category_id" ref="base.category_sales_management_config"/>
        </record>

    </data>
</openerp>
