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

        <record id="view_task_history_graph" model="ir.ui.view">
            <field name="name">project.task.history.cumulative.graph</field>
            <field name="model">project.task.history.cumulative</field>
            <field name="arch" type="xml">
                <graph string="Project Tasks" type="bar" stacked="True">
                    <field name="type_id" type="row"/>
                    <field name="kanban_state" type="row"/>
                    <field name="date" interval="month" type="col"/>
                    <field name="nbr_tasks" type="measure"/>
                    <field name="planned_hours" type="measure"/>
                    <field name="remaining_hours" type="measure"/>
                </graph>
            </field>
        </record>

        <record id="view_task_history_search" model="ir.ui.view">
            <field name="name">project.task.history.cumulative.search</field>
            <field name="model">project.task.history.cumulative</field>
            <field name="arch" type="xml">
                <search string="Task's Analysis">
                    <field name="date"/>
                    <field name="project_id"/>
                    <field name="user_id"/>
                    <filter name="new" string="New" domain="[('type_id.sequence', '=', 1)]"/>
                    <separator/>
                    <filter name="kanban_blocked" string="Blocked" domain="[('kanban_state','=','blocked')]"/>
                    <filter name="kanban_ready" string="Ready" domain="[('kanban_state','=','done')]"/>
                    <separator/>
                    <filter string="My Tasks" domain="[('user_id','=',uid)]"/>
                    <filter string="Unassigned Tasks" domain="[('user_id','=',False)]"/>
                    <separator/>
                    <filter string="My Projects" domain="[('project_id.user_id','=',uid)]"/>
                    <group expand="1" string="Group By">
                        <filter string="Project" name="project" context="{'group_by':'project_id'}"/>
                        <filter string="Task" context="{'group_by':'task_id'}"/>
                        <filter string="Assigned to" name="User" context="{'group_by':'user_id'}"/>
                        <filter string="Stage" context="{'group_by':'type_id'}"/>
                        <filter string="Status" context="{'group_by':'kanban_state'}"/>
                        <separator/>
                        <filter string="Month" context="{'group_by':'date:month'}" help="Creation Date"/>
                    </group>
                </search>
            </field>
        </record>

        <record id="action_view_task_history_cumulative" model="ir.actions.act_window">
            <field name="name">Cumulative Flow</field>
            <field name="res_model">project.task.history.cumulative</field>
            <field name="view_type">form</field>
            <field name="view_mode">graph</field>
            <field name="view_id" ref="view_task_history_graph"/>
            <field name="filter" eval="False"/>
            <field name="context">{"search_default_open":1, "search_default_this_month": 1}</field>
        </record>
        <menuitem action="action_view_task_history_cumulative"
            id="menu_action_view_task_history_cumulative"
            parent="base.menu_project_report"/>

    </data>
</openerp>
