<?xml version="1.0"?>
<openerp>
    <data>
        <menuitem name="Point of Sale" id="menu_point_root" sequence="21"
            icon="terp-partner"
            groups="group_pos_manager,group_pos_user,base.group_system"/>

        <record model="ir.ui.view" id="view_pos_pos_form">
            <field name="name">pos.order</field>
            <field name="model">pos.order</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Sales Order POS">
                    <group col="6" colspan="4">
                        <field name="name"/>
                        <field name="date_order"/>
                        <field name="shop_id" widget="selection"/>
                        <field name="partner_id" on_change="onchange_partner_pricelist(partner_id)"/>
                        <field name="contract_number" groups="base.group_extended"/>
                    </group>
                    <notebook colspan="4">
                        <page string="Sale Order">
                            <field name="lines" colspan="4" nolabel="1">
                                <tree string="Order lines" editable="bottom">
                                    <field name="product_id" on_change="onchange_product_id(parent.pricelist_id,product_id,qty,parent.partner_id)" width="275" />
                                    <field name="qty" on_change="onchange_qty(discount, qty, price_unit)"/>
                                    <field name="price_ded" on_change="onchange_ded(price_ded, price_subtotal_incl,price_unit)" invisible="1"/>
                                    <field name="price_unit" readonly="1"/>
                                    <field name="discount" on_change="onchange_discount(discount,price_unit)" />
                                    <field name="notice" on_change="onchange_dis(qty,price_subtotal_incl,discount)"/>
                                    <field name="price_subtotal" />
                                    <field name="price_subtotal_incl" sum="Subtotal"/>
                                </tree>
                                <form string="Order lines">
                                    <field name="product_id" on_change="onchange_product_id(parent.pricelist_id,product_id,qty,parent.partner_id)" width="275"/>
                                    <field name="qty"/>
                                    <field name="qty_rfd" groups="base.group_extended"/>
                                    <field name="discount" on_change="onchange_discount(discount,price_unit)" />
                                    <field name="price_ded" on_change="onchange_ded(price_ded, price_unit)" />
                                    <field name="price_unit"/>
                                    <field name="notice"/>
                                    <field name="serial_number"/>
                                </form>
                            </field>
                            <group colspan="4" col="7">
                                <field name="amount_tax"/>
                                <field name="amount_total"/>
                            </group>

                            <separator colspan="4"/>
                            <group colspan="4" col="6">
                                <field name="state" />
                                <button name="%(action_pos_payment)d" string="Make Payment" icon="terp-dolar" type="action" states="draft,advance" />
                                <button name="%(action_report_pos_receipt)d" string="Reprint" icon="gtk-print" type="action" states="paid,done,invoiced"/>
                                <button name="set_to_draft" string="Set to draft" states="paid" icon="gtk-execute" type="object" />
                                <button name="%(action_view_pos_return)d" string="Return Picking" type="action" icon="gtk-ok" states="paid"
                                    attrs="{'invisible':[('state','!=','paid'),('state','!=','invoiced')]}" context="{'return':'return'}" />
                            </group>
                        </page>
                        <page string="Payment">
                            <field name="statement_ids" colspan="4" nolabel="1">
                                <tree editable="bottom" string="Statement lines">
                                    <field name="amount"/>
                                    <field name="journal_id"/>
                                    <field name="statement_id" />
                                </tree>
                                <form string="Statement lines">
                                    <field name="account_id"/>
                                    <field name="amount"/>
                                    <field name="statement_id" domain="[('company_id','=',parent.company_id),('state','=','open')]"/>
                                </form>
                            </field>
                        </page>
                        <page string="Extra Info">
                            <group colspan="2" col="2" name="Type">
                                <separator string="Other Information" colspan="4"/>
                                <field name="user_salesman_id" />
                                <field name="company_id" groups="base.group_multi_company"/>
                                <field name="price_type" />
                                <field name="user_id" string="Salesman" groups="base.group_extended"/>
                            </group>
                            <group colspan="2" col="2" name="Type">
                                <separator string="Dates" colspan="4"/>
                                <field name="date_validation" />
                                <field name="date_payment" groups="base.group_extended"/>
                            </group>
                            <group colspan="4">
                                <field name="sale_journal" domain="[('type','=','sale')]" widget="selection" invisible="1"/>
                                <field name="pricelist_id" domain="[('type','=','sale')]" widget="selection" invisible="1"/>
                            </group>
                        </page>
                        <page string="Notes" >
                            <field colspan="4" name="note" nolabel="1"/>
                        </page>
                    </notebook>
                </form>
            </field>
        </record>
        <record model="ir.actions.act_window" id="action_pos_pos_form">
            <field name="name">Point of Sale</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">pos.order</field>
            <field name="view_type">form</field>
            <field name="view_id" ref="view_pos_pos_form"/>
            <field name="domain">[['date_order','>=',time.strftime('%Y-%m-%d')]]</field>
        </record>
        <record model="ir.ui.view" id="view_pos_order_tree">
            <field name="name">Sales</field>
            <field name="model">pos.order</field>
            <field name="type">tree</field>
            <field name="arch" type="xml">
                <tree string="POS Orders" colors="blue:state == 'draft';gray:state in ('done','cancel');black:state not in('done','cancel')">
                    <field name="name"/>
                    <field name="partner_id"/>
                    <field name="date_order"/>
                    <field name="date_validation"/>
                    <field name="date_payment"/>
                    <field name="user_id"/>
                    <field name="invoice_id"/>
                    <field name="amount_total" sum="Amount total"/>
                    <field name="company_id" groups="base.group_multi_company"/>
                    <field name="state"/>
                </tree>
            </field>
        </record>
        <record id="view_pos_order_filter" model="ir.ui.view">
            <field name="name">pos.order.list.select</field>
            <field name="model">pos.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')]"/>
                    <filter icon="terp-check" string="Running" domain="[('state','in',('payment','advance'))]"/>
                    <separator orientation="vertical"/>
                    <field name="name"/>
                    <field name="partner_id"/>
                    <field name="user_id"/>
                    <field name="date_order" string="Order date"/>
                    <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 string="" orientation="vertical"/>
                        <filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
                        <separator string="" orientation="vertical"/>
                        <filter string="Order Date" icon="terp-go-month" domain="[]" context="{'group_by':'date_order'}"/>
                    </group>
               </search>
            </field>
        </record>

        <menuitem name="Daily Operations" id="menu_point_of_sale" parent="menu_point_root" sequence="1" />
        <menuitem name="Sales Order" parent="menu_point_of_sale" id="menu_point_ofsale" action="action_pos_pos_form" sequence="1" groups="group_pos_manager,group_pos_user,base.group_system"/>
        <menuitem name="Products" id="menu_point_of_sale_product" parent="menu_point_root" sequence="15" />

        <menuitem action="product.product_normal_action" id="menu_pos_products" parent="menu_point_of_sale_product" sequence="2" name="Products"/>

        <!--  POS Order view (date_payment)  -->
         <record model="ir.actions.act_window" id="action_pos_pos_form_user">
            <field name="name">Point of Sale</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">pos.order</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
            <field name="view_id" ref="view_pos_order_tree"/>
            <field name="domain">['|',('state','=','advance')]</field>
            <field name="context">{"search_default_user_id":uid}</field>
            <field name="search_view_id" ref="view_pos_order_filter"/>

        </record>

        <record model="ir.actions.act_window" id="action_pos_order_tobinvoiced">
            <field name="name">Uninvoiced Sales</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">pos.order</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
            <field name="view_id" ref="view_pos_order_tree"/>
            <field name="domain">[('state','not in', ('invoiced','done')),('invoice_id','=',False)]</field>
            <field name="context">{"search_default_user_id":uid}</field>
            <field name="search_view_id" ref="view_pos_order_filter"/>

        </record>
        <menuitem name="Invoicing" id="menu_point_of_sale_invoicing" parent="menu_point_root" sequence="5" />
        <menuitem name="Uninvoiced Sales" action="action_pos_order_tobinvoiced" id="menu_point_of_sale_tobinvoiced" parent="menu_point_of_sale_invoicing"/>
        <record model="ir.actions.act_window" id="action_pos_order_accepted">
            <field name="name">Accepted Sales</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">pos.order</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
            <field name="domain">[('state','=', 'paid')]</field>
            <field name="context">{"search_default_user_id":uid}</field>
            <field name="search_view_id" ref="view_pos_order_filter"/>
        </record>
        <record model="ir.actions.act_window" id="action_pos_order_tree2">
            <field name="name">Point of Sale</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">pos.order</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
            <field name="domain">[('date_order','&lt;=', time.strftime('%Y-%m-%d 23:59:59'))]</field>
            <field name="context">{"search_default_user_id":uid}</field>
            <field name="search_view_id" ref="view_pos_order_filter"/>
        </record>

        <record model="ir.actions.act_window" id="action_pos_order_tree3">
            <field name="name">Point of Sale</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">pos.order</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
            <field name="context">{"search_default_user_id":uid}</field>
            <field name="search_view_id" ref="view_pos_order_filter"/>
        </record>
        <record model="ir.actions.act_window" id="action_pos_order_tree_open">
            <field name="name">Opened Sales</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">pos.order</field>
            <field name="view_type">form</field>
            <field name="view_mode">form,tree</field>
            <field name="context">{"search_default_user_id":uid}</field>
            <field name="search_view_id" ref="view_pos_order_filter"/>
        </record>

        <record model="ir.ui.view" id="view_pos_order_line">
            <field name="name">Sale lines</field>
            <field name="model">pos.order.line</field>
            <field name="type">tree</field>
            <field name="arch" type="xml">
                <tree string="POS Order lines">
                    <field name="product_id" readonly="1"/>
                    <field name="qty" readonly="1" sum="Total qty"/>
                    <field name="discount" readonly="1"/>
                    <field name="price_unit" readonly="1"/>
                    <field name="price_subtotal" readonly="1" sum="Sum of subtotals"/>
                    <field name="price_subtotal_incl" readonly="1" sum="Sum of subtotals"/>
                    <field name="create_date" readonly="1"/>
                </tree>
            </field>
        </record>

        <record model="ir.ui.view" id="view_pos_order_line_form">
            <field name="name">Sale line</field>
            <field name="model">pos.order.line</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="POS Order line">
                    <field name="product_id"  select="1"/>
                    <field name="qty"  select="1"/>
                    <field name="discount" />
                    <field name="price_unit" />
                    <field name="create_date"  select="1"/>
                </form>
            </field>
        </record>

        <record model="ir.actions.act_window" id="action_pos_order_line">
            <field name="name">Sale line</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">pos.order.line</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree</field>
            <field name="view_id" ref="view_pos_order_line"/>
        </record>

        <record model="ir.actions.act_window" id="action_pos_order_line_form">
            <field name="name">Sale line</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">pos.order.line</field>
            <field name="view_type">form</field>
            <field name="view_mode">form,tree</field>
            <field name="view_id" ref="view_pos_order_line_form"/>
        </record>

        <record model="ir.actions.act_window" id="action_pos_order_line_day">
            <field name="name">Sale line</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">pos.order.line</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree</field>
            <field name="view_id" ref="view_pos_order_line"/>
            <field name="domain">[('create_date', '&gt;=', time.strftime('%Y-%m-%d 00:00:00')),('create_date', '&lt;=', time.strftime('%Y-%m-%d 23:59:59'))]</field>
        </record>



        <!-- report -->

        <record model="ir.ui.view" id="view_pos_trans_user_form">
            <field name="name">report.trans.pos.user.form</field>
            <field name="model">report.transaction.pos</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="POS ">
                    <field name="user_id" select="1"/>
                    <field name="journal_id" select="1"/>
                    <field name="jl_id" select="1"/>
                    <field name="date_create" select="1" widget="date"/>
                    <field name="no_trans"/>
                    <field name="amount"/>
                    <field name="invoice_id"/>
                </form>
            </field>
        </record>


        <record model="ir.ui.view" id="view_trans_pos_user_tree">
            <field name="name">Sales by user</field>
            <field name="model">report.transaction.pos</field>
            <field name="type">tree</field>
            <field name="arch" type="xml">
                <tree string="POS">
                    <field name="date_create" widget="date" />
                    <field name="user_id"/>
                    <field name="journal_id"/>
                    <field name="jl_id"/>
                    <field name="no_trans" sum="Total Transaction"/>
                    <field name="amount" sum="Amount total"/>
                    <field name="product_nb" />
                    <field name="invoice_id"/>
                    <field name="disc"/>
                </tree>
            </field>
        </record>

        <record model="ir.ui.view" id="view_report_transaction_pos_calendar">
            <field name="name">report.transaction.pos.calendar</field>
            <field name="model">report.transaction.pos</field>
            <field name="type">calendar</field>
            <field eval="2" name="priority"/>
            <field name="arch" type="xml">
                <calendar color="user_id" date_start="date_create" string="POS Report">
                    <field name="journal_id"/>
                    <field name="amount"/>
                </calendar>
            </field>
         </record>

         <record model="ir.ui.view" id="view_report_transaction_pos_graph">
            <field name="name">report.transaction.pos.graph</field>
            <field name="model">report.transaction.pos</field>
            <field name="type">graph</field>
            <field eval="2" name="priority"/>
            <field name="arch" type="xml">
                <graph  type="bar" string="POS Report">
                    <field name="user_id" />
                    <field name="amount"/>
                    <field group="True" name="journal_id"/>
                </graph>
            </field>
         </record>

        <record model="ir.actions.act_window" id="action_trans_pos_tree_today">
            <field name="name">Sales by day</field>
            <field name="res_model">report.transaction.pos</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,calendar,form,graph</field>
            <field name="domain">[('date_create','=',time.strftime('%Y-%m-%d'))]</field>
        </record>


        <record model="ir.actions.act_window" id="action_trans_pos_tree_month">
            <field name="name">Sales by month</field>
            <field name="res_model">report.transaction.pos</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,calendar,form,graph</field>
            <field name="domain">[('date_create','like',time.strftime('%Y-%m'))]</field>
        </record>


        <record model="ir.actions.act_window" id="action_trans_pos_tree">
            <field name="name">Sales by user</field>
            <field name="res_model">report.transaction.pos</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,calendar,form,graph</field>
            <field name="view_id" ref="view_trans_pos_user_tree"/>
        </record>


        <record model="ir.ui.view" id="view_report_sales_by_user_pos_form">
            <field name="name">report.sales.by.user.pos.form</field>
            <field name="model">report.sales.by.user.pos</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="POS ">
                    <field name="date_order" select="1" widget="date"/>
                    <field name="qty"/>
                    <field name="amount"/>
                    <field name="user_id"/>
                </form>
            </field>
        </record>


        <record model="ir.ui.view" id="view_report_sales_by_user_pos_tree">
            <field name="name">report.sales.by.user.pos.tree</field>
            <field name="model">report.sales.by.user.pos</field>
            <field name="type">tree</field>
            <field name="arch" type="xml">
                <tree string="POS">
                    <field name="date_order" select="1" widget="date"/>
                    <field name="qty"/>
                    <field name="amount"/>
                    <field name="user_id"/>
                </tree>
            </field>
        </record>

        <record model="ir.ui.view" id="view_report_sales_by_user_pos_calendar">
            <field name="name">report.sales.by.user.pos.calendar</field>
            <field name="model">report.sales.by.user.pos</field>
            <field name="type">calendar</field>
            <field eval="2" name="priority"/>
            <field name="arch" type="xml">
                <calendar color="user_id" date_start="date_order" string="POS Report">
                    <field name="qty"/>
                    <field name="amount" />
                </calendar>
            </field>
         </record>

        <record model="ir.ui.view" id="view_report_sales_by_user_pos_graph">
            <field name="name">report.sales.by.user.pos.graph</field>
            <field name="model">report.sales.by.user.pos</field>
            <field name="type">graph</field>
            <field eval="2" name="priority"/>
            <field name="arch" type="xml">
                <graph  type="bar" string="Sales by User">
                    <field name="user_id" />
                    <field name="amount"/>
                </graph>
            </field>
         </record>

         <record model="ir.actions.act_window" id="action_report_sales_by_user_pos_today">
            <field name="name">Sales by User</field>
            <field name="res_model">report.sales.by.user.pos</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,calendar,form,graph</field>
            <field name="domain">[('date_order','=',time.strftime('%Y-%m-%d'))]</field>
         </record>


        <!-- Sales of user by month -->

        <record model="ir.ui.view" id="view_report_sales_by_user_pos_month_form">
            <field name="name">report.sales.by.user.pos.month.form</field>
            <field name="model">report.sales.by.user.pos.month</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="POS ">
                    <field name="date_order" select="1" widget="date"/>
                    <field name="qty"/>
                    <field name="amount"/>
                    <field name="user_id"/>
                </form>
            </field>
        </record>


        <record model="ir.ui.view" id="view_report_sales_by_user_pos_month_tree">
            <field name="name">report.sales.by.user.pos.month.tree</field>
            <field name="model">report.sales.by.user.pos.month</field>
            <field name="type">tree</field>
            <field name="arch" type="xml">
                <tree string="POS">
                    <field name="date_order" select="1" widget="date"/>
                    <field name="qty"/>
                    <field name="amount"/>
                    <field name="user_id"/>
                </tree>
            </field>
        </record>

        <record model="ir.ui.view" id="view_report_sales_by_user_pos_month_calendar">
            <field name="name">report.sales.by.user.pos.month.calendar</field>
            <field name="model">report.sales.by.user.pos.month</field>
            <field name="type">calendar</field>
            <field eval="2" name="priority"/>
            <field name="arch" type="xml">
                <calendar color="user_id" date_start="date_order" string="POS Report">
                    <field name="qty"/>
                    <field name="amount" />
                </calendar>
            </field>
         </record>

        <record model="ir.ui.view" id="view_report_sales_by_user_pos_month_graph">
            <field name="name">report.sales.by.user.pos.month.graph</field>
            <field name="model">report.sales.by.user.pos.month</field>
            <field name="type">graph</field>
            <field eval="2" name="priority"/>
            <field name="arch" type="xml">
                <graph  type="bar" string="Sales by User">
                    <field name="user_id" />
                    <field name="amount"/>
                </graph>
            </field>
         </record>


         <record model="ir.actions.act_window" id="action_report_sales_by_user_pos_month">
            <field name="name">Sales by User Monthly</field>
            <field name="res_model">report.sales.by.user.pos.month</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,calendar,form,graph</field>
            <field name="domain">[('date_order','like',time.strftime('%Y-%m'))]</field>
        </record>

        <!-- Sales by margin -->

        <record model="ir.ui.view" id="view_report_sales_by_margin_pos_form">
            <field name="name">report.sales.by.margin.pos.form</field>
            <field name="model">report.sales.by.margin.pos</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="POS ">
                    <field name="user_id"/>
                    <field name="product_name"/>
                    <field name="date_order" select="1" widget="date"/>
                    <field name="qty"/>
                    <field name="net_margin_per_qty"/>
                    <field name="total"/>
                </form>
            </field>
        </record>


        <record model="ir.ui.view" id="view_report_sales_by_margin_pos_tree">
            <field name="name">report.sales.by.margin.pos.tree</field>
            <field name="model">report.sales.by.margin.pos</field>
            <field name="type">tree</field>
            <field name="arch" type="xml">
                <tree string="POS">
                    <field name="user_id"/>
                    <field name="product_name"/>
                    <field name="date_order" select="1" widget="date"/>
                    <field name="qty"/>
                    <field name="net_margin_per_qty"/>
                    <field name="total"/>
                </tree>
            </field>
        </record>

        <record model="ir.ui.view" id="view_report_sales_by_margin_pos_calendar">
            <field name="name">report.sales.by.margin.pos.calendar</field>
            <field name="model">report.sales.by.margin.pos</field>
            <field name="type">calendar</field>
            <field eval="2" name="priority"/>
            <field name="arch" type="xml">
                <calendar color="user_id" date_start="date_order" string="Sales by User Margin">
                    <field name="product_name"/>
                    <field name="total" />
                </calendar>
            </field>
         </record>

        <record model="ir.ui.view" id="view_report_sales_by_margin_pos_graph">
            <field name="name">report.sales.by.margin.pos.graph</field>
            <field name="model">report.sales.by.margin.pos</field>
            <field name="type">graph</field>
            <field eval="2" name="priority"/>
            <field name="arch" type="xml">
                <graph  type="bar" string="Sales by User Margin" orientation="horizontal">
                    <field name="product_name" />
                    <field name="total" operator="+"/>
                </graph>
            </field>
         </record>

        <record model="ir.actions.act_window" id="action_report_sales_by_margin_pos_today">
            <field name="name">Sales by User Daily margin</field>
            <field name="res_model">report.sales.by.margin.pos</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,calendar,form,graph</field>
            <field name="domain">[('date_order','=',time.strftime('%Y-%m-%d'))]</field>
         </record>

         <record model="ir.ui.view" id="view_report_sales_by_margin_pos_month_form">
            <field name="name">report.sales.by.margin.pos.month.form</field>
            <field name="model">report.sales.by.margin.pos.month</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="POS ">
                    <field name="user_id"/>
                    <field name="product_name"/>
                    <field name="date_order" select="1" widget="date"/>
                    <field name="qty"/>
                    <field name="net_margin_per_qty"/>
                    <field name="total"/>
                </form>
            </field>
        </record>


        <record model="ir.ui.view" id="view_report_sales_by_margin_pos_month_tree">
            <field name="name">report.sales.by.margin.pos.month.tree</field>
            <field name="model">report.sales.by.margin.pos.month</field>
            <field name="type">tree</field>
            <field name="arch" type="xml">
                <tree string="POS">
                    <field name="user_id"/>
                    <field name="product_name"/>
                    <field name="date_order" select="1" widget="date"/>
                    <field name="qty"/>
                    <field name="net_margin_per_qty"/>
                    <field name="total"/>
                </tree>
            </field>
        </record>

        <record model="ir.ui.view" id="view_report_sales_by_margin_pos_month_calendar">
            <field name="name">report.sales.by.margin.pos.month.calendar</field>
            <field name="model">report.sales.by.margin.pos.month</field>
            <field name="type">calendar</field>
            <field eval="2" name="priority"/>
            <field name="arch" type="xml">
                <calendar color="user_id" date_start="date_order" string="Sales by User Margin">
                    <field name="product_name"/>
                    <field name="total" />
                </calendar>
            </field>
         </record>

        <record model="ir.ui.view" id="view_report_sales_by_margin_pos_month_graph">
            <field name="name">report.sales.by.margin.pos.month.graph</field>
            <field name="model">report.sales.by.margin.pos.month</field>
            <field name="type">graph</field>
            <field eval="2" name="priority"/>
            <field name="arch" type="xml">
                <graph  type="bar" string="Sales by User Margin" orientation="horizontal">
                    <field name="product_name" />
                    <field name="total" operator="+"/>
                </graph>
            </field>
         </record>

         <record model="ir.actions.act_window" id="action_report_sales_by_margin_pos_month">
            <field name="name">Sales by User Monthly margin</field>
            <field name="res_model">report.sales.by.margin.pos.month</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,calendar,form,graph</field>
            <field name="domain">[('date_order','like',time.strftime('%Y-%m'))]</field>
        </record>
        <!--  Sales by margin ends -->
        <record model="ir.ui.view" id="view_company_form_pos">
            <field name="name">view.company.form.pos</field>
            <field name="model">res.company</field>
            <field name="type">form</field>
            <field name="inherit_id" ref="base.view_company_form"/>
            <field name="arch" type="xml">
                <notebook position="inside">
                    <page string="Other">
                      <field  name="company_discount" colspan="4"/>
                      <field  name="max_diff" colspan="4"/>
                    </page>
                </notebook>
            </field>
           </record>

        <record id="product_normal_form_view" model="ir.ui.view">
            <field name="name">product.normal.form.inherit</field>
            <field name="model">product.product</field>
            <field name="type">form</field>
            <field name="inherit_id" ref="product.product_normal_form_view"/>
            <field name="arch" type="xml">
                  <field name="active" position="after">
                      <field name="income_pdt"/>
                      <field name="expense_pdt"/>
                      <field name="am_out"/>
                      <field name="disc_controle"/>
                  </field>
            </field>
        </record>

        <record id="product_input_output_form_view" model="ir.ui.view">
            <field name="name">product.normal.form.inherit</field>
            <field name="model">product.product</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Product">
                   <group colspan="4" col="6">
                    <group colspan="4" col="2">
                        <separator string="Product Description" colspan="4"/>
                        <field name="name" select="1"  />
                        <field groups="base.group_extended" name="variants" />
                    </group>
                    <group colspan="1" col="2">
                        <separator string="Codes" colspan="2"/>
                        <field name="default_code" select="1"/>
                        <field groups="base.group_extended" name="ean13"/>
                    </group>
                   </group>
                   <notebook colspan="4">
                        <page string="Information">
                          <group colspan="2" col="2" name="Type">
                            <separator string="Product Type" colspan="2"/>
                              <field name="categ_id" select="1"/>
                              <field name="property_account_income" select="1" string="Account" required="1"/>
                              <field name="type"/>
                            </group>
                            <group colspan="2" col="2" name="Miscelleanous">
                              <separator string="Miscelleanous" colspan="2"/>
                                  <field name="income_pdt"/>
                                  <field name="expense_pdt"/>
                            <field name="am_out"/>
                          <field name="disc_controle"/>
                                  <field name="company_id" groups="base.group_extended,base.group_multi_company"/>
                              </group>
                              <group colspan="2" col="2" name="Prices">
                                  <separator string="Prices" colspan="2"/>
                                  <field name="lst_price"/>
                                <field name="standard_price"/>
                             </group>
                        </page>
                   </notebook>
                </form>
            </field>
        </record>

        <menuitem name="Configuration" parent="menu_point_root"
            id="menu_point_config_product" sequence="25" groups="base.group_system"/>

        <record model="ir.actions.act_window" id="action_product_input">
            <field name="name">Products</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">product.product</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
            <field name="domain">[('income_pdt','=',True)]</field>
        </record>
        <record model="ir.actions.act_window.view" id="action_product_input_tree_tag">
            <field name="sequence" eval="1"/>
            <field name="view_mode">tree</field>
            <field name="view_id" ref="product.product_product_tree_view"/>
            <field name="act_window_id" ref="action_product_input"/>
        </record>
        <record model="ir.actions.act_window.view" id="action_product_input_form_tag">
            <field name="sequence" eval="2"/>
            <field name="view_mode">form</field>
            <field name="view_id" ref="product_input_output_form_view"/>
            <field name="act_window_id" ref="action_product_input"/>
        </record>
        <menuitem name="Products for Input Operations"
                    parent="menu_point_config_product"
                    action="action_product_input"
                    id="products_for_input_operations"
                    groups="base.group_system"/>

        <record model="ir.actions.act_window" id="action_product_output">
            <field name="name">Products</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">product.product</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
            <field name="domain">[('expense_pdt','=',True)]</field>
        </record>
        <record model="ir.actions.act_window.view" id="action_product_output_tree_tag">
            <field name="sequence" eval="1"/>
            <field name="view_mode">tree</field>
            <field name="view_id" ref="product.product_product_tree_view"/>
            <field name="act_window_id" ref="action_product_output"/>
        </record>
        <record model="ir.actions.act_window.view" id="action_product_output_form_tag">
            <field name="sequence" eval="2"/>
            <field name="view_mode">form</field>
            <field name="view_id" ref="product_input_output_form_view"/>
            <field name="act_window_id" ref="action_product_output"/>
        </record>
        <menuitem name="Products for Output Operations"
                    parent="menu_point_config_product"
                    action="action_product_output"
                    id="products_for_output_operations"
                    groups="base.group_system"/>

        <menuitem
            name="Input Operations" parent="menu_point_of_sale"
            string="Refloat"
            action="action_box_entries"
            id="menu_wizard_enter_jrnl" sequence="2" />

        <menuitem
            name="Output Operations" parent="menu_point_of_sale"
            string="Refloat"
            action="action_box_out"
            id="menu_wizard_enter_jrnl2" sequence="3" />

        <record model="ir.ui.view" id="view_pos_order_tree_all_sales_lines">
            <field name="name">POS Sales Lines</field>
            <field name="model">pos.order.line</field>
            <field name="type">tree</field>
            <field name="arch" type="xml">
                <tree string="POS Orders lines">
                    <field name="order_id" select="1" />
                    <field name="serial_number" select="1" />
                    <field name="create_date" select="1" />
                    <field name="product_id" select="1" />
                    <field name="qty" />
                    <field name="price_unit" />
                </tree>
            </field>
        </record>
         <record model="ir.actions.act_window" id="action_pos_all_sales_lines">
            <field name="name">All sales lines</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">pos.order.line</field>
            <field name="view_type">form</field>
            <field name="view_id" ref="view_pos_order_tree_all_sales_lines" />
        </record>

        <!--  Miscelleanous Operations/Reporting -->
        <menuitem name="Reporting" parent="menu_point_root" id="menu_point_rep" sequence="20" groups="group_pos_manager,base.group_system"/>
        <!-- Invoice -->

        <record model="ir.actions.act_window" id="action_pos_invoice">
            <field name="name">Invoices</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">account.invoice</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
            <field name="domain">[('origin','like','POS')]</field>
        </record>

        <menuitem icon="STOCK_PRINT" action="action_report_pos_payment_repport_date"
                id="menu_pos_payment_report_date" parent="menu_point_rep" sequence="8" groups="base.group_extended"/>
        <menuitem icon="STOCK_PRINT" action="action_report_pos_details"
                id="menu_pos_details" parent="menu_point_rep" sequence="6" />


    </data>
</openerp>
