<?xml version="1.0" encoding="utf-8"?>
<terp>
    <data>
        <menuitem icon="terp-project" id="menu_main" name="Project Management"/>
        <menuitem groups="base.group_admin" id="menu_definitions" name="Configuration" parent="project.menu_main" sequence="1"/>
        
        <!-- Project -->
        <record id="edit_project" model="ir.ui.view">
            <field name="name">project.project.form</field>
            <field name="model">project.project</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Project">
                    <notebook>
                        <page string="Administration">
                            <field name="name" select="1"/>
                            <group col="3" colspan="2">
                                <field name="active" select="2"/>
                                <button name="toggleActive" string="Toggle activity" type="object"/>
                            </group>
                            <field name="manager" select="1"/>
                            <field name="warn_manager"/>
                            <newline/>
                            <field name="priority"/>
                            <field name="parent_id"/>
                            <field name="date_start"/>
                            <field name="date_end"/>
                            <field name="planned_hours" widget="float_time"/>
                            <field name="effective_hours" widget="float_time"/>
                            <field name="timesheet_id"/>
                            <field name="state"/>
                            <separator colspan="4" string="Project's members"/>
                            <field colspan="4" name="members" nolabel="1"/>
                        </page>
                        <page groups="base.group_extended" string="Partner Info">
                            <field colspan="4" name="partner_id" on_change="onchange_partner_id(partner_id)" select="1"/>
                            <field domain="[('partner_id','=',partner_id)]" name="contact_id" select="2"/>
                            <field name="category_id" select="2"/>
                            <field name="pricelist_id"/>
                            <field name="warn_customer"/>
                            <field name="mode"/>
                            <field name="tariff"/>
                            <separator colspan="4" string="Mail texts"/>
                            <field name="warn_header"/>
                            <field name="warn_footer"/>
                            <group col="3" colspan="4">
                                <label string="Task: %%(name)s"/>
                                <label string="User: %%(user_id)s"/>
                                <label string="ID: %%(task_id)s"/>
                                <label string="Status: %%(state)s"/>
                                <label string="Date Start: %%(date_start)s"/>
                                <label string="Date Stop: %%(date_stop)s"/>
                            </group>
                            <separator colspan="4" string="Taxes"/>
                            <field colspan="4" name="tax_ids" nolabel="1"/>
                        </page>
                        <page string="Tasks">
                            <field colspan="4" name="tasks" nolabel="1" widget="one2many_list">
                                <form string="Task edition">
                                    <notebook>
                                        <page string="Task definition">
                                            <separator colspan="4" string="Task Information"/>
                                            <field name="name" select="1"/>
                                            <field name="active" select="1"/>
                                            <field name="sequence"/>
                                            <field name="priority" select="1"/>
                                            <field name="user_id" select="1"/>
                                            <field name="date_deadline" select="1"/>
                                            <field name="date_start" select="1"/>
                                            <field name="date_close" select="1"/>
                                            <field name="progress"/>
                                            <newline/>
                                            <field name="planned_hours" widget="float_time"/>
                                            <field name="effective_hours" widget="float_time"/>
                                            <separator colspan="4" string="Description"/>
                                            <field colspan="4" name="description" nolabel="1"/>
                                            
                                            <group col="11" colspan="4">
                                                <field name="state" select="1"/>
                                                <button name="do_draft" states="open" string="Set Draft" type="object"/>
                                                <button name="do_open" states="pending,draft" string="Open task" type="object"/>
                                                <button name="do_reopen" states="done,cancelled" string="Re-open" type="object"/>
                                                <button name="do_pending" states="open" string="Set pending" type="object"/>
                                                <button name="%(wizard_close_task)d" states="pending,open" string="Done" type="action"/>
                                                <button groups="base.group_extended" name="%(wizard_delegate_task)d" states="pending,open" string="Delegate" type="action"/>
                                                <button name="do_cancel" states="draft,open,pending" string="Cancel" type="object"/>
                                            </group>
                                        </page>
                                        <page string="Work done">
                                            <separator colspan="4" string="Work done"/>
                                            <field colspan="4" name="work_ids" nolabel="1"/>
                                        </page>
                                        <page string="Others">
                                            <separator colspan="4" string="Notes"/>
                                            <field colspan="4" name="invoice_id" readonly="True"/>
                                            <field colspan="4" name="notes" nolabel="1"/>
                                            <newline/>
                                            <field name="type"/>
                                            <field name="billable" select="1"/>
                                            <field name="start_sequence"/>
                                            <field colspan="4" name="child_ids" nolabel="1">
                                                <tree string="Delegated tasks">
                                                    <field name="name"/>
                                                    <field name="user_id"/>
                                                    <field name="date_deadline"/>
                                                    <field name="planned_hours" widget="float_time"/>
                                                    <field name="effective_hours" widget="float_time"/>
                                                    <field name="state"/>
                                                </tree>
                                            </field>
                                            <field colspan="4" name="parent_id"/>
                                        </page>
                                    </notebook>
                                </form>
                                <tree colors="red:date_deadline&lt;current_date and state=='draft';blue:date_deadline==current_date and state=='draft';grey:state=='cancel' or state=='close'" string="All tasks">
                                    <field name="sequence"/>
                                    <field name="name"/>
                                    <field name="user_id"/>
                                    <field name="date_deadline"/>
                                    <field name="planned_hours" widget="float_time"/>
                                    <field name="effective_hours" widget="float_time"/>
                                    <field name="state"/>
                                </tree>
                            </field>
                        </page>
                        <page string="Notes">
                            <field colspan="4" name="notes" nolabel="1"/>
                        </page>
                    </notebook>
                    <newline/>
                </form>
            </field>
        </record>
        <record id="view_project" model="ir.ui.view">
            <field name="name">project.project.tree</field>
            <field name="model">project.project</field>
            <field name="type">tree</field>
            <field name="field_parent">child_id</field>
            <field name="arch" type="xml">
                <tree string="Projects">
                    <field name="name"/>
                    <field name="manager"/>
                    <field name="partner_id"/>
                    <field name="planned_hours" widget="float_time"/>
                    <field name="effective_hours" widget="float_time"/>
                    <field name="state"/>
                </tree>
            </field>
        </record>
        <record id="open_view_all_project" model="ir.actions.act_window">
            <field name="name">All Projects</field>
            <field name="res_model">project.project</field>
            <field name="view_type">tree</field>
            <field name="domain">[('parent_id','=',False)]</field>
            <field name="view_id" ref="view_project"/>
        </record>
        <menuitem action="open_view_all_project" id="menu_all_project" parent="project.menu_main"/>
        
        <record id="open_view_all_project_unclosed" model="ir.actions.act_window">
            <field name="name">Unclosed projects</field>
            <field name="res_model">project.project</field>
            <field name="view_type">tree</field>
            <field name="domain">[('parent_id','=',False),('state','&lt;&gt;','cancelled'),('state','&lt;&gt;','done')]</field>
            <field name="view_id" ref="view_project"/>
        </record>
        <menuitem action="open_view_all_project_unclosed" id="menu_all_project_unclosed" parent="project.menu_all_project"/>
        
        
        <record id="open_view_all_project_unclosed_open" model="ir.actions.act_window">
            <field name="name">Open projects</field>
            <field name="res_model">project.project</field>
            <field name="view_type">tree</field>
            <field name="domain">[('parent_id','=',False),('state','=','open')]</field>
            <field name="view_id" ref="view_project"/>
        </record>
        <menuitem action="open_view_all_project_unclosed_open" id="menu_all_project_unclosed_open" parent="project.menu_all_project_unclosed"/>
        
        
        <record id="open_view_project_open" model="ir.actions.act_window">
            <field name="name">Open projects</field>
            <field name="res_model">project.project</field>
            <field name="view_type">form</field>
            <field name="domain">[('state','=','open')]</field>
            <field name="view_id" ref="view_project"/>
        </record>
        <menuitem id="next_id_54" name="Projects" parent="project.menu_definitions"/><menuitem action="open_view_project_open" id="menu_open_view_project_open" parent="next_id_54"/>
        
        
        <record id="open_view_project" model="ir.actions.act_window">
            <field name="name">Projects</field>
            <field name="res_model">project.project</field>
            <field name="view_type">form</field>
            <field name="domain">[]</field>
            <field name="view_id" ref="view_project"/>
        </record>
        <menuitem action="open_view_project" id="menu_open_view_project" parent="project.menu_definitions"/>
        
        <record id="view_task_work_form" model="ir.ui.view">
            <field name="name">project.task.work.form</field>
            <field name="model">project.task.work</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Task Work">
                    <field colspan="4" name="name" select="1"/>
                    <field name="hours" select="1" widget="float_time"/>
                    <field name="date" select="1"/>
                    <field name="user_id" select="1"/>
                </form>
            </field>
        </record>
        
        <record id="view_task_work_tree" model="ir.ui.view">
            <field name="name">project.task.work.tree</field>
            <field name="model">project.task.work</field>
            <field name="type">tree</field>
            <field name="arch" type="xml">
                <tree editable="top" string="Task Work">
                    <field name="date"/>
                    <field name="name"/>
                    <field name="hours" widget="float_time"/>
                    <field name="user_id"/>
                </tree>
            </field>
        </record>
        
        <record id="view_my_project" model="ir.ui.view">
            <field name="name">project.project.tree</field>
            <field name="model">project.project</field>
            <field name="type">tree</field>
            <field name="field_parent">child_id</field>
            <field name="arch" type="xml">
                <tree string="My projects">
                    <field name="name"/>
                    <field name="partner_id"/>
                    <field name="planned_hours" widget="float_time"/>
                    <field name="effective_hours" widget="float_time"/>
                    <field name="state"/>
                </tree>
            </field>
        </record>
        <record id="open_view_my_project" model="ir.actions.act_window">
            <field name="name">My projects</field>
            <field name="res_model">project.project</field>
            <field name="view_type">tree</field>
            <field name="domain">[('manager', '=', uid)]</field>
            <field name="view_id" ref="view_my_project"/>
        </record>
        <menuitem action="open_view_my_project" id="menu_open_view_my_project" parent="project.menu_main"/>
        
        
        <record id="open_view_my_project_open_unclosed" model="ir.actions.act_window">
            <field name="name">My unclosed projects</field>
            <field name="res_model">project.project</field>
            <field name="view_type">tree</field>
            <field name="domain">[('manager', '=', uid),('state','&lt;&gt;','cancelled'),('state','&lt;&gt;','done')]</field>
            <field name="view_id" ref="view_my_project"/>
        </record>
        <menuitem action="open_view_my_project_open_unclosed" id="menu_open_view_my_project_open_unclosed" parent="project.menu_open_view_my_project"/>
        
        
        <record id="open_view_my_project_open" model="ir.actions.act_window">
            <field name="name">My open projects</field>
            <field name="res_model">project.project</field>
            <field name="view_type">tree</field>
            <field name="domain">[('manager', '=', uid),('state','=','open')]</field>
            <field name="view_id" ref="view_my_project"/>
        </record>
        <menuitem action="open_view_my_project_open" id="menu_open_view_my_project_open" parent="project.menu_open_view_my_project_open_unclosed"/>
        
        <!-- Task -->
        <record id="view_task_form2" model="ir.ui.view">
            <field name="name">project.task.form</field>
            <field name="model">project.task</field>
            <field name="type">form</field>
            <field eval="2" name="priority"/>
            <field name="arch" type="xml">
                <form string="Task edition">
                    <notebook>
                        <page string="Information">
                            <field name="name" select="1"/>
                            <field name="project_id" required="1" select="1"/>
                            <field name="user_id" select="1"/>
                            <field name="priority"/>
                            <field name="date_deadline" select="2"/>
                            <field name="planned_hours" widget="float_time"/>
                            <separator colspan="4" string="Description"/>
                            <field colspan="4" name="description" nolabel="1" select="2"/>
                            <field name="effective_hours" widget="float_time"/>
                            <field name="progress"/>
                            <field colspan="4" name="work_ids" nolabel="1"/>
                            <newline/>
                            <group col="11" colspan="4">
                                <field name="state" select="1"/>
                                <button name="do_draft" states="open" string="Set Draft" type="object"/>
                                <button name="do_open" states="pending,draft" string="Open" type="object"/>
                                <button name="do_reopen" states="done,cancelled" string="Re-open" type="object"/>
                                <button name="do_pending" states="open" string="Set Pending" type="object"/>
                                <button groups="base.group_extended" name="%(wizard_delegate_task)d" states="pending,open" string="Delegate" type="action"/>
                                <button name="%(wizard_close_task)d" states="pending,open" string="Done" type="action"/>
                                <button name="do_cancel" states="draft,open,pending" string="Cancel" type="object"/>
                                
                            </group>
                        </page>
                        <page groups="base.group_extended" string="Delegations">
                            <field colspan="4" name="history" nolabel="1"/>
                            <field colspan="4" height="150" name="child_ids" nolabel="1">
                                <tree string="Delegated tasks">
                                    <field name="name"/>
                                    <field name="user_id"/>
                                    <field name="date_deadline"/>
                                    <field name="planned_hours" widget="float_time"/>
                                    <field name="effective_hours" widget="float_time"/>
                                    <field name="state"/>
                                </tree>
                            </field>
                            <field colspan="4" name="parent_id"/>
                        </page>
                        <page groups="base.group_extended" string="Extra Info">
                            <field name="date_start" select="2"/>
                            <field name="date_close" select="2"/>
                            <field name="type"/>
                            <field name="sequence"/>
                            <field name="active" select="2"/>
                            <field name="start_sequence"/>
                            <field name="partner_id" select="2"/>
                            <newline/>
                            <field name="invoice_id"/>
                            <field name="billable" select="2"/>
                            <separator colspan="4" string="Notes"/>
                            <field colspan="4" name="notes" nolabel="1"/>
                        </page>
                    </notebook>
                </form>
            </field>
        </record>
        <record id="view_task_tree2" model="ir.ui.view">
            <field name="name">project.task.tree</field>
            <field name="model">project.task</field>
            <field name="type">tree</field>
            <field eval="2" name="priority"/>
            <field name="arch" type="xml">
                <tree colors="grey:state in ('cancel','done');blue:state=='pending'" string="Tasks">
                    <field name="sequence"/>
                    <field name="name"/>
                    <field name="project_id"/>
                    <field name="user_id"/>
                    <field name="date_deadline"/>
                    <field name="planned_hours" sum="Planned hours" widget="float_time"/>
                    <field name="effective_hours" sum="Effective hours" widget="float_time"/>
                    <field name="priority"/>
                    <field name="state"/>
                </tree>
            </field>
        </record>
        
        <record id="view_task_calendar" model="ir.ui.view">
            <field name="name">project.task.calendar</field>
            <field name="model">project.task</field>
            <field name="type">calendar</field>
            <field eval="2" name="priority"/>
            <field name="arch" type="xml">
                <calendar color="user_id" date_delay="planned_hours" date_start="date_start" string="Tasks">
                    <field name="name"/>
                    <field name="project_id"/>
                </calendar>
            </field>
        </record>
        
        <record id="action_view_task" model="ir.actions.act_window">
            <field name="name">All Tasks</field>
            <field name="res_model">project.task</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form,calendar</field>
            <field eval="False" name="view_id"/>
        </record>
        <menuitem action="action_view_task" id="menu_action_view_task" parent="project.menu_main"/>
        
        <record id="action_view_task2" model="ir.actions.act_window">
            <field name="name">Unbilled closed tasks</field>
            <field name="res_model">project.task</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
            <field name="domain">[('state','=','done'), ('billable','=',True), ('invoice_id','=',False)]</field>
        </record>
        <menuitem groups="base.group_extended" id="menu_action_billable" name="Billable Tasks" parent="project.menu_action_view_task"/>
        
        <menuitem action="action_view_task2" id="menu_action_view_task2" parent="project.menu_action_billable"/>
        
        <record id="action_view_task3" model="ir.actions.act_window">
            <field name="name">Unbilled open tasks</field>
            <field name="res_model">project.task</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
            <field name="domain">[('state','=','open'), ('billable','=',True), ('invoice_id','=',False)]</field>
        </record>
        <menuitem action="action_view_task3" id="menu_action_view_task3" parent="project.menu_action_billable"/>
        
        <record id="action_view_task4" model="ir.actions.act_window">
            <field name="name">My Tasks</field>
            <field name="res_model">project.task</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
            <field name="domain">[('user_id', '=', uid)]</field>
        </record>
        <menuitem action="action_view_task4" id="menu_action_view_task4" parent="project.menu_main"/>
        
        <record id="action_view_task5_pending" model="ir.actions.act_window">
            <field name="name">My Pending Tasks</field>
            <field name="res_model">project.task</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
            <field name="domain">[('user_id', '=', uid),('state','=','pending')]</field>
        </record>
        <menuitem action="action_view_task5_pending" id="menu_tasks_yours_pending" parent="menu_action_view_task4"/>
        
        <record id="action_view_task5" model="ir.actions.act_window">
            <field name="name">My Open Tasks</field>
            <field name="res_model">project.task</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
            <field name="domain">[('user_id', '=', uid),('state','=','open')]</field>
        </record>
        <menuitem action="action_view_task5" id="menu_tasks_yours" parent="menu_action_view_task4"/>
        
        <record id="action_view_task5_prog" model="ir.actions.act_window">
            <field name="name">My Tasks in Progress</field>
            <field name="res_model">project.task</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
            <field name="domain">[('user_id', '=', uid),('state','=','open')]</field>
        </record>
        <menuitem action="action_view_task5_prog" id="menu_tasks_yours_prog" parent="menu_action_view_task4"/>

        <record id="action_view_task_new" model="ir.actions.act_window">
            <field name="name">New Task</field>
            <field name="res_model">project.task</field>
            <field name="view_type">form</field>
            <field name="view_mode">form,tree</field>
        </record>
        <menuitem action="action_view_task_new" id="menu_action_view_task_new" parent="menu_action_view_task4"/>
                
        <record id="action_view_task6" model="ir.actions.act_window">
            <field name="name">Open Tasks</field>
            <field name="res_model">project.task</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
            <field name="domain">[('state', '=', 'open')]</field>
        </record>
        <menuitem action="action_view_task6" id="menu_action_view_task6" parent="project.menu_action_view_task"/>
        
        <record id="action_view_task6_prog" model="ir.actions.act_window">
            <field name="name">Tasks in Progress</field>
            <field name="res_model">project.task</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
            <field name="domain">[('state', '=', 'progress')]</field>
        </record>
        <menuitem action="action_view_task6_prog" id="menu_action_view_task6_prog" parent="project.menu_action_view_task"/>
        
        <record id="action_view_task7" model="ir.actions.act_window">
            <field name="name">Unassigned Tasks</field>
            <field name="res_model">project.task</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
            <field name="domain">[('user_id', '=', False)]</field>
        </record>
        <menuitem action="action_view_task7" id="menu_action_view_task7" parent="project.menu_action_view_task"/>
        
        <!-- Opening task when double clicking on project -->
        <record id="dblc_proj" model="ir.actions.act_window">
            <field name="res_model">project.task</field>
            <field name="name">Project's tasks</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
            <field name="domain">[('project_id', 'child_of', [active_id])]</field>
        </record>
        <record id="ir_project_task_open" model="ir.values">
            <field eval=" 'tree_but_open'" name="key2"/>
            <field eval="'project.project'" name="model"/>
            <field name="name">View project's tasks</field>
            <field eval="'ir.actions.act_window,'+str(dblc_proj)" name="value"/>
            <field eval="True" name="object"/>
        </record>
        
        <!-- Task types -->
        <record id="task_type_edit" model="ir.ui.view">
            <field name="name">project.task.type.form</field>
            <field name="model">project.task.type</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Task type">
                    <field colspan="4" name="name" select="1"/>
                    <field colspan="4" name="description" select="1"/>
                </form>
            </field>
        </record>
        <record id="task_type_tree" model="ir.ui.view">
            <field name="name">project.task.type.tree</field>
            <field name="model">project.task.type</field>
            <field name="type">tree</field>
            <field name="arch" type="xml">
                <tree string="Task type">
                    <field name="name"/>
                </tree>
            </field>
        </record>
        <record id="open_task_type_form" model="ir.actions.act_window">
            <field name="name">Task Types</field>
            <field name="res_model">project.task.type</field>
            <field name="view_type">form</field>
            <field name="view_id" ref="task_type_tree"/>
        </record>
        <menuitem action="open_task_type_form" id="menu_task_types" parent="project.menu_definitions"/>
        
        <act_window domain="[('manager', '=', active_id)]" id="act_res_users_2_project_project" name="User's projects" res_model="project.project" src_model="res.users" view_mode="tree,form" view_type="form"/>
        
        <act_window domain="[('project_id', '=', active_id),('state', '&lt;&gt;', 'cancelled'),('state', '&lt;&gt;', 'done')]" id="act_project_project_2_project_task_opened" name="Opened tasks" res_model="project.task" src_model="project.project" view_mode="tree,form" view_type="form"/>
        
        <act_window domain="[('user_id', '=', active_id),('state', '&lt;&gt;', 'cancelled'),('state', '&lt;&gt;', 'done')]" id="act_res_users_2_project_task_opened" name="Assigned tasks" res_model="project.task" src_model="res.users" view_mode="tree,form" view_type="form"/>
        
        <act_window domain="[('user_id', '=', active_id),('date', '&gt;=', time.strftime('%Y-%m-01'))]" id="act_res_users_2_project_task_work_month" name="Month works" res_model="project.task.work" src_model="res.users" view_mode="tree,form" view_type="form"/>
        
    </data>
</terp>
