<?xml version="1.0" ?>
<openerp>
    <data>
    <record model="ir.ui.view" id="view_gtd_context_tree">
        <field name="name">project.gtd.context.tree</field>
        <field name="model">project.gtd.context</field>
        <field name="arch" type="xml">
            <tree string="Context">
                <field name="sequence" invisible="1"/>
                <field name="name"/>
            </tree>
        </field>
    </record>

    <record model="ir.ui.view" id="view_gtd_context_form">
        <field name="name">project.gtd.context.form</field>
        <field name="model">project.gtd.context</field>
        <field name="arch" type="xml">
            <form string="Context" version="7.0">
                <group col="4">
                    <field name="name"/>
                    <field name="sequence"/>
                </group>
            </form>
        </field>
    </record>

    <record model="ir.actions.act_window" id="open_gtd_context_tree">
        <field name="name">Contexts</field>
        <field name="res_model">project.gtd.context</field>
        <field name="help">Contexts are defined in the "Getting Things Done" methodology. It allows you to categorize your tasks according to the context in which they have to be done: at the office, at home, when I take my car, etc.</field>
    </record>

    <menuitem name="Contexts" id="menu_open_gtd_time_contexts"
                parent="project.menu_tasks_config" action="open_gtd_context_tree" groups="base.group_no_one"/>

    <record model="ir.ui.view" id="view_gtd_timebox_tree">
        <field name="name">project.gtd.timebox.tree</field>
        <field name="model">project.gtd.timebox</field>
        <field name="arch" type="xml">
            <tree string="Timebox">
                <field name="sequence" invisible="1"/>
                <field name="name"/>
                <field name="icon"/>
            </tree>
        </field>
    </record>

    <record model="ir.ui.view" id="view_gtd_timebox_form">
        <field name="name">project.gtd.timebox.form</field>
        <field name="model">project.gtd.timebox</field>
        <field name="arch" type="xml">
            <form string="Timeboxes" version="7.0">
                <group col="4" string="Timebox Definition">
                    <field name="name"/>
                    <field name="sequence"/>
                    <field name="icon"/>
                </group>
            </form>
        </field>
    </record>

    <record model="ir.actions.act_window" id="open_gtd_timebox_tree">
        <field name="name">Timeboxes</field>
        <field name="res_model">project.gtd.timebox</field>
        <field name="view_type">form</field>
        <field name="view_mode">tree,form</field>
        <field name="view_id" ref="view_gtd_timebox_tree"/>
        <field name="help">Timeboxes are defined in the "Getting Things Done" methodology. A timebox defines a period of time in order to categorize your tasks: today, this week, this month, long term.</field>
    </record>

    <menuitem name="Timeboxes" id="menu_open_gtd_time_timeboxes" parent="project.menu_tasks_config" action="open_gtd_timebox_tree" groups="base.group_no_one"/>

    <record model="ir.ui.view" id="project_task_tree">
        <field name="name">project.task.tree.timebox</field>
        <field name="model">project.task</field>
        <field name="inherit_id" ref="project.view_task_tree2" />
        <field name="arch" type="xml">
            <field name="remaining_hours" position="after">
                <field string="Timeframe" name="timebox_id" invisible=" not context.get('gtd', False)"/>
                <field name="context_id" invisible="not context.get('context_show', False)" widget="selection"/>
                <button name="do_reopen" states="done,cancelled" string="Reactivate" type="object" icon="gtk-convert" help="For reopening the tasks" invisible="not context.get('set_visible',False)"/>
            </field>
        </field>
    </record>

    <record model="ir.ui.view" id="project_task">
        <field name="name">project.task.form.timebox</field>
        <field name="model">project.task</field>
        <field name="inherit_id" ref="project.view_task_form2" />
        <field name="arch" type="xml">
            <field name="progress" position="after">
                <field name="context_id" widget="selection" options='{"no_open": True}'/>
                <field name="timebox_id" widget="selection" options='{"no_open": True}'  string="Timeframe"/>
            </field>
        </field>
    </record>

    <record id="view_task_gtd_search" model="ir.ui.view">
        <field name="name">project.task.gtd.search</field>
        <field name="model">project.task</field>
        <field name="priority">50</field>
        <field name="arch" type="xml">
           <search string="My Tasks">
                <field name="name" string="My Tasks"/>
                <filter name="open" string="In Progress" domain="[('state','in',('draft','open'))]" help="In Progress and draft tasks" icon="terp-camera_test"/>
                <filter string="Pending" domain="[('state','=','pending')]" context="{'show_delegated':False}" help="Pending Tasks" icon="terp-gtk-media-pause"/>
                <separator/>
                <filter name="message_unread" string="Unread Messages" domain="[('message_unread','=',True)]"/>
                <separator/>
                <filter string="Inbox" domain="[('timebox_id','=', False)]" help="Tasks having no timebox assigned yet"/>
                <group expand="0" string="Display">
                    <filter string="Show Context" name="context_show" context="{'context_show': True}" domain="[]" icon="terp-camera_test" help="Show the context field"/>
                    <filter string="Show Deadlines" context="{'deadline_visible': False}" domain="[]" help="Show only tasks having a deadline" icon="terp-gnome-cpu-frequency-applet+"/>
                </group>
            </search>
        </field>
    </record>
    <record model="ir.actions.act_window" id="open_gtd_task">
        <field name="name">My Tasks</field>
        <field name="res_model">project.task</field>
        <field name="search_view_id" ref="view_task_gtd_search"/>
        <field name="context">{'set_editable':True,'set_visible':True,'gtd':True,'user_invisible':True, "search_default_open": 1}</field>
        <field name="domain">[('user_id','=',uid)]</field>
        <field name="view_type">form</field>
        <field name="view_mode">kanban,tree,form,calendar,gantt,graph</field>
    </record>
    <menuitem action="open_gtd_task" id="menu_open_gtd_timebox_tree" parent="project.menu_project_management" sequence="10"/>


    </data>
</openerp>
