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

        <!-- User Connection -->
        <record model="ir.ui.view" id="view_user_connection_tree">
            <field name="name">user.connection.tree</field>
            <field name="model">res.users</field>
            <field name="type">tree</field>
            <field name="arch" type="xml">
                <tree string="Latest Connections">
                    <field name="name"/>
                    <field name="date"/>
                </tree>
            </field>
        </record>
        <record model="ir.actions.act_window" id="action_user_connection_tree">
            <field name="name">User Connections</field>
            <field name="res_model">res.users</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
            <field name="view_id" ref="view_user_connection_tree"></field>
        </record>

        <!-- Latest Activities -->
        <record model="ir.actions.act_window" id="action_latest_activities_tree">
            <field name="name">Latest Activities</field>
            <field name="res_model">res.log</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
        </record>

        <!--     Log report search view  -->
        <record id="view_res_log_report_filter" model="ir.ui.view">
            <field name="name">res.log.report.select</field>
            <field name="model">res.log.report</field>
            <field name="type">search</field>
            <field name="arch" type="xml">
                <search string="Log Analysis">
                    <group col="20" colspan="8">
                    <filter icon="terp-go-year" string="  Year  "
                        domain="[('create_date','&lt;=', time.strftime('%%Y-%%m-%%d')),('create_date','&gt;=',time.strftime('%%Y-01-01'))]"
                        help="Log created in current year"/>
                    <filter icon="terp-go-month" string="   Month   "
                        name="month"
                        domain="[('create_date','&lt;=',(datetime.date.today()+relativedelta(day=31)).strftime('%%Y-%%m-%%d')),('create_date','&gt;=',(datetime.date.today()-relativedelta(day=1)).strftime('%%Y-%%m-%%d'))]"
                        help="Log created in current month"/>
                    <filter icon="terp-go-month"
                         string="    Month-1    "
                         separator="1"
                         domain="[('create_date','&lt;=', (datetime.date.today() - relativedelta(day=31, months=1)).strftime('%%Y-%%m-%%d')),('create_date','&gt;=',(datetime.date.today() - relativedelta(day=1,months=1)).strftime('%%Y-%%m-%%d'))]"
                         help="Log created in last month"/>
                   </group>
                   <newline/>
                   <group  expand="1" string="Group By...">
                        <filter string="Model" icon="terp-go-home" context="{'group_by':'res_model'}" />
                            <separator orientation="vertical"/>
                        <filter string="Day" icon="terp-go-today"
                            domain="[]" context="{'group_by':'day'}"/>
                        <filter string="Month" icon="terp-go-month"
                            domain="[]" context="{'group_by':'month'}" />
                        <filter string="Year" icon="terp-go-year"
                            domain="[]" context="{'group_by':'name'}" />
                  </group>
               </search>
            </field>
        </record>

        <!--     Log report Tree view  -->
        <record id="view_res_log_report_tree" model="ir.ui.view">
            <field name="name">res.log.report.tree</field>
            <field name="model">res.log.report</field>
            <field name="type">tree</field>
            <field name="arch" type="xml">
            <tree string="Log Analysis">
                <field name="name" invisible="1"/>
                <field name="month" invisible="1"/>
                <field name="day" invisible="1"/>
                <field name="res_model" invisible="1"/>
                <field name="nbr" />
                <field name="creation_date" invisible="1"/>
             </tree>
            </field>
       </record>

       <record id="board_config_overview" model="ir.actions.client">
         <field name="name">Configuration Overview</field>
         <field name="tag">board.config.overview</field>
       </record>

        <!-- Monthly Activity per Document -->
        <record id="board_res_log_report_graph" model="ir.ui.view">
            <field name="name">board.res.log.report.graph</field>
            <field name="model">res.log.report</field>
            <field name="type">graph</field>
            <field name="arch" type="xml">
                <graph string="Monthly Activity per Document" type="bar">
                	<field name="res_model"/>
                	<field name="nbr" operator="+"/>
                </graph>
            </field>
        </record>
        <record id="board_monthly_res_log_report_action" model="ir.actions.act_window">
            <field name="name">Monthly Activity per Document</field>
            <field name="res_model">res.log.report</field>
            <field name="view_type">form</field>
            <field name="view_mode">graph,tree</field>
            <field name="domain">[('create_date','&gt;',(datetime.date.today()-datetime.timedelta(days=30)).strftime('%Y-%m-%d'))]</field>
            <field name="context">{'group_by':['res_model'],'group_by_no_leaf':1}</field>
            <field name="view_id" ref="board_res_log_report_graph"></field>
        </record>

        <!-- Weekly Global Activity -->
        <record id="board_weekly_res_log_report_graph" model="ir.ui.view">
            <field name="name">board.weekly.res.log.report.graph</field>
            <field name="model">res.log.report</field>
            <field name="type">graph</field>
            <field name="arch" type="xml">
                <graph string="Weekly Global Activity" type="bar">
                	<field name="day"/>
                	<field name="nbr" operator="+"/>
                </graph>
            </field>
        </record>
        <record id="board_weekly_res_log_report_action" model="ir.actions.act_window">
            <field name="name">Weekly Global Activity</field>
            <field name="res_model">res.log.report</field>
            <field name="view_type">form</field>
            <field name="view_mode">graph,tree</field>
            <field name="domain">[('create_date','&gt;',(datetime.date.today()-datetime.timedelta(days=7)).strftime('%Y-%m-%d'))]</field>
            <field name="context">{'group_by':['day'],'group_by_no_leaf':1}</field>
            <field name="view_id" ref="board_weekly_res_log_report_graph"></field>
        </record>

        <record id="board_administration_form" model="ir.ui.view">
            <field name="name">board.administration.form</field>
            <field name="model">board.board</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Administration Dashboard">
                    <hpaned position="100">
                        <child1>
                            <action width="510" name="%(action_user_connection_tree)d" string="User Connections" />
                            <action width="510" name="%(action_latest_activities_tree)d" string="Latest Activities" />
                        </child1>
                        <child2>
                          <action name="%(board_config_overview)d" string="Configuration Overview"/>
                            <action  name="%(board_monthly_res_log_report_action)d" string="Monthly Activity per Document"/>
                            <action  name="%(board_weekly_res_log_report_action)d" string="Weekly Global Activity" />
                        </child2>
                    </hpaned>
                </form>
            </field>
        </record>

        <record id="open_board_administration_form" model="ir.actions.act_window">
             <field name="name">Administration Dashboard</field>
            <field name="res_model">board.board</field>
            <field name="view_type">form</field>
            <field name="view_mode">form</field>
            <field name="view_id" ref="board_administration_form"/>
        </record>

        <menuitem id="base.menu_reporting" name="Reporting" parent="base.menu_administration" sequence="11"
            groups="base.group_extended"/>
        <menuitem id="board.admin_menu_dasboard" name="Dashboard" sequence="0" parent="base.menu_reporting"/>
        <menuitem id="menu_board_admin" action="open_board_administration_form" icon="terp-graph" parent="board.admin_menu_dasboard" />
        <menuitem icon="terp-administration" id="base.menu_administration" name="Administration" sequence="50" action="open_board_administration_form"/>

    </data>
</openerp>












