<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
        <record id="view_report_pos_order_tree" model="ir.ui.view">
            <field name="name">report.pos.order.tree</field>
            <field name="model">report.pos.order</field>
            <field name="arch" type="xml">
                <tree string="Point of Sale Analysis" create="false">
                    <field name="date" invisible="1"/>
                    <field name="user_id" invisible="1"/>
                    <field name="year" invisible="1"/>
                    <field name="day" invisible="1"/>
                    <field name="month" invisible="1"/>
                    <field name="partner_id" invisible="1"/>
                    <field name="product_id" invisible="1"/>
                    <field name="shop_id" invisible="1"/>
                    <!--<field name="journal_id" invisible="1"/>-->
                    <field name="company_id" invisible="1" groups="base.group_multi_company"/>
                    <field name="nbr" sum="# of Lines"/>
                    <field name="product_qty" sum="# of Qty"/>
                    <field name="average_price" sum="Average Price"/>
                    <field name="total_discount" sum="Total Discount"/>
                    <field name="price_total" sum="Total Price"/>
                    <field name="delay_validation"/>
                    <!--<field name="state" invisible="1"/>-->
                </tree>
            </field>
        </record>

        <record id="view_report_pos_order_search" model="ir.ui.view">
            <field name="name">report.pos.order.search</field>
            <field name="model">report.pos.order</field>
            <field name="arch" type="xml">
                <search string="Point of Sale Analysis">
                    <field name="date"/>
                    <filter icon="terp-dolar" string="Invoiced" domain="[('state','=',('invoiced'))]"/>
                    <filter icon="terp-dolar" string="Not Invoiced" domain="[('state','=',('paid'))]"/>
                    <separator/>
                    <filter icon="terp-go-year" string="Year" name="year" domain="[('year','=',time.strftime('%%Y'))]" help="POS ordered created during current year"/>
                    <separator/>
                    <filter icon="terp-go-today" string="Today" name="today" domain="[('date','=', time.strftime('%%Y-%%m-%%d'))]"
                         help="POS ordered created by today"/>
                    <separator/>
                    <filter icon="terp-personal" string="My Sales" help="My Sales" domain="[('user_id','=',uid)]"/>
                    <field name="partner_id"/>
                    <field name="user_id"/>
                    <field name="partner_id"/>
                    <field name="user_id"/>
                    <group expand="1" string="Group By...">
                        <filter string="Salesperson" icon="terp-personal" name="User" context="{'group_by':'user_id'}"/>
                        <filter string="Customer" icon="terp-personal" context="{'group_by':'partner_id'}"/>
                        <filter string="Product" icon="terp-accessories-archiver" context="{'group_by':'product_id'}"/>
                        <filter string="Day" icon="terp-go-today" context="{'group_by':'day'}" help="Day of order date"/>
                        <filter string="Month" icon="terp-go-month" context="{'group_by':'month'}" help="Month of order date"/>
                        <filter string="Year" icon="terp-go-year" context="{'group_by':'year'}" help="Year of order date"/>
                    </group>
                </search>
            </field>
        </record>

        <record id="action_report_pos_order_all" model="ir.actions.act_window">
            <field name="name">Orders Analysis</field>
            <field name="res_model">report.pos.order</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree</field>
            <field name="search_view_id" ref="view_report_pos_order_search"/>
            <field name="context">{'search_default_year':1,'search_default_today':1,'group_by_no_leaf':1,'group_by':['product_id']}</field>
        </record>

        <menuitem action="action_report_pos_order_all" id="menu_report_pos_order_all" parent="menu_point_rep" sequence="3"/>
    </data>
</openerp>
