[MERGE] merge with dev-addons3 branch
[odoo/odoo.git] / addons / hr_timesheet_sheet / hr_timesheet_sheet_view.xml
index da5d169..35c20fd 100644 (file)
@@ -6,11 +6,13 @@
             <field name="model">hr_timesheet_sheet.sheet</field>
             <field name="type">tree</field>
             <field name="arch" type="xml">
-                <tree string="Timesheets">
+                <tree string="Timesheets"
+                    colors="blue:state == 'draft';grey:state == 'done'">
                     <field name="user_id"/>
                     <field name="date_from"/>
                     <field name="date_to"/>
                     <field name="name"/>
+                    <field name="department_id"/>
                     <field name="total_attendance" groups="hr_attendance.group_hr_attendance"/>
                     <field name="total_timesheet"/>
                     <field name="total_difference" groups="hr_attendance.group_hr_attendance"/>
                 </tree>
             </field>
         </record>
-
+       <record id="hr_timesheet_sheet_graph" model="ir.ui.view">
+         <field name="name">hr.timesheet.sheet.graph</field>
+         <field name="model">hr_timesheet_sheet.sheet</field>
+         <field name="type">graph</field>
+         <field name="arch" type="xml">
+             <graph string="Timesheets" type="bar">
+                 <field name="name"/>
+                 <field name="total_attendance" operator="+"/>
+                 <field name="total_timesheet" operator="+"/>
+             </graph>
+         </field>
+        </record>
         <record id="hr_timesheet_account_form" model="ir.ui.view">
             <field name="name">hr.timesheet.account.form</field>
             <field name="model">hr_timesheet_sheet.sheet.account</field>
@@ -28,7 +41,7 @@
                     <field name="sheet_id" select="1"/>
                     <field name="name" select="1"/>
                     <field name="total" sum="Total"/>
-                    <field name="invoice_rate" select="2"/>
+                    <field name="invoice_rate"/>
                 </form>
             </field>
         </record>
@@ -46,7 +59,7 @@
                 </tree>
             </field>
         </record>
-
+<!--
         <record id="hr_timesheet_day_form" model="ir.ui.view">
             <field name="name">hr.timesheet.day.form</field>
             <field name="model">hr_timesheet_sheet.sheet.day</field>
@@ -76,7 +89,7 @@
                 </tree>
             </field>
         </record>
-
+-->
         <record id="hr_timesheet_sheet_form" model="ir.ui.view">
             <field name="name">hr.timesheet.sheet.form</field>
             <field name="model">hr_timesheet_sheet.sheet</field>
                     <field name="date_from"/>
                     <field name="date_to"/>
                     <field name="company_id" select="1" groups="base.group_multi_company"/>
+                    <field name="department_id" groups="base.group_extended"/>
                     <notebook colspan="4">
                         <page string="Daily View">
                             <group col="6" colspan="4">
                             </group>
 
                             <field colspan="3" context="name=date_current,user_id=user_id" height="100" name="attendances_ids" nolabel="1" groups="hr_attendance.group_hr_attendance">
-                                <tree string="Attendances">
+                                <tree string="Attendances" editable="bottom">
                                     <field name="name"/>
                                     <field name="action"/>
                                     <field invisible="1" name="employee_id"/>
                                     <field name="total_difference" widget="float_time" groups="hr_attendance.group_hr_attendance"/>
                                 </tree>
                             </field>
-                            <field name="total_attendance" widget="float_time"/>
-                            <field name="total_timesheet" widget="float_time"/>
-                            <field name="total_difference" widget="float_time"/>
+                            <group colspan="4" col="6">
+                                <field name="total_attendance" widget="float_time"/>
+                                <field name="total_timesheet" widget="float_time"/>
+                                <field name="total_difference" widget="float_time"/>
+                            </group>
                         </page>
                     </notebook>
                     <field name="state"/>
             <field name="type">search</field>
             <field name="arch" type="xml">
                 <search string="Search Timesheet">
-                   <group col="10" colspan="4">
-                               <filter icon="terp-partner" string="My Timesheets" domain="[('user_id','=',uid)]" help="My Timesheet"/>
-                               <filter icon="terp-crm" string="My departments timesheets"  domain="[('user_id', 'child_of', [uid])]" help="My Departments Timesheet"/>
-                                               <separator orientation="vertical"/>
-                                               <filter icon="terp-crm" string="Unvalidated" domain="[('state','&lt;&gt;','done'),('date_to','&lt;',time.strftime('%%Y-%%m-%%d'))]" help="Unvalidated Timesheets"/>
-                               <separator orientation="vertical"/>
-                               <field name="state">
-                           <filter icon="terp-hr" domain="[('state','=','draft')]" help="Draft Timesheets"/>
-                           <filter icon="terp-hr" domain="[('state','=','confirm')]" help="Confirmed Timesheets"/>
-                                               </field>
-                                               <field name="name" select="1"/>
-                                               <field name="user_id" select="1" widget="selection"/>
-                   </group>
-               </search>
+                    <group col="10" colspan="4">
+                        <filter icon="terp-crm" string="In Draft" domain="[('state','in',('draft', 'new'))]" help="Unvalidated Timesheets"/>
+                        <filter icon="terp-crm" string="To Validate" domain="[('state','=','confirm')]" help="Confirmed Timesheets"/>
+                        <separator orientation="vertical"/>
+                        <field name="user_id" select="1" widget="selection"/>
+                        <field name="date_from"/>
+                        <field name="department_id" widget="selection">
+                            <filter icon="terp-crm"
+                                domain="[('department_id','=',context.get('department_id',False))]"
+                                help="My Departments Timesheet"/>
+                        </field>
+                    </group>
+                    <newline/>
+                    <group expand="1" string="Group By...">
+                        <filter string="Users" icon="terp-project" domain="[]" context="{'group_by':'user_id'}"/>
+                        <filter string="Department" icon="terp-project" domain="[]" context="{'group_by':'department_id'}"/>
+                    </group>
+                </search>
             </field>
         </record>
 
             <field name="res_model">hr_timesheet_sheet.sheet</field>
             <field name="view_type">form</field>
             <field name="view_id" eval="False"/>
+            <field name="context">{'search_default_my_timesheet':1, 'search_default_user_id':uid }</field>
             <field name="search_view_id" ref="view_hr_timesheet_sheet_filter"/>
         </record>
-        <menuitem 
-            action="act_hr_timesheet_sheet_form" 
-            id="menu_act_hr_timesheet_sheet_form" parent="hr.menu_hr_time"/>
+
+        <!--Time Tracking menu in project Management-->
+        <menuitem icon="terp-project" id="base.menu_main_pm" name="Project Management" sequence="1"/>
+          <menuitem
+             id="base.menu_project_management_time_tracking"
+             name="Time Tracking"
+             parent="base.menu_main_pm" sequence="3"/>
+         <menuitem action="hr_timesheet_sheet.act_hr_timesheet_sheet_form" id="menu_act_project_management_timesheet_sheet_form" parent="base.menu_project_management_time_tracking"
+             groups="hr.group_hr_manager" sequence="5"/>
+        <!--<menuitem id="next_id_60" name="Timesheets" parent="hr.menu_hr_root"/>-->
+        <menuitem action="act_hr_timesheet_sheet_form" id="menu_act_hr_timesheet_sheet_form" parent="hr_attendance.menu_hr_time_tracking"
+            groups="hr.group_hr_manager"/>
 
         <!--
             Company inheritancy
             <field name="inherit_id" ref="hr_timesheet.hr_timesheet_line_form"/>
             <field name="arch" type="xml">
                 <field name="date" position="after">
-                    <field name="sheet_id" select="2"/>
+                    <field name="sheet_id" />
                 </field>
             </field>
         </record>
             hr.attendance inheritancy
         -->
 
+        <record model="ir.ui.view" id="view_hr_attendance_filter">
+            <field name="name">view_hr_attendance_filter</field>
+            <field name="model">hr.attendance</field>
+            <field name="type">search</field>
+            <field name="inherit_id" ref="hr_attendance.view_hr_attendance_filter" />
+            <field name="arch" type="xml">
+                <field name="action" position="after">
+                    <field name="sheet_id" select="1" />
+                </field>
+            </field>
+        </record>
+
         <record id="view_attendance_form" model="ir.ui.view">
             <field name="name">hr.attendance.form</field>
             <field name="model">hr.attendance</field>
             <field name="inherit_id" ref="hr_attendance.view_attendance_form"/>
             <field name="arch" type="xml">
                 <field name="action_desc" position="after">
-                    <field name="sheet_id" select="2"/>
+                    <field name="sheet_id"/>
                 </field>
             </field>
         </record>
             <field name="type">tree</field>
             <field name="inherit_id" ref="hr_attendance.view_attendance_tree"/>
             <field name="arch" type="xml">
-                <field name="action_desc" position="after">
+                <field name="action" position="after">
+                    <field name="sheet_id"/>
+                </field>
+            </field>
+        </record>
+        <record id="view_attendance_tree_who" model="ir.ui.view">
+            <field name="name">hr.attendance.tree</field>
+            <field name="model">hr.attendance</field>
+            <field name="type">tree</field>
+            <field name="inherit_id" ref="hr_attendance.view_attendance_who"/>
+            <field name="arch" type="xml">
+                <field name="action" position="after">
                     <field name="sheet_id"/>
                 </field>
             </field>
         </record>
 
         <act_window domain="[('sheet_id', '=', active_id)]" id="act_hr_timesheet_sheet_sheet_by_day" name="Timesheet by Account" res_model="hr_timesheet_sheet.sheet.account" src_model="hr_timesheet_sheet.sheet"/>
-        <act_window domain="[('sheet_id', '=', active_id)]" id="act_hr_timesheet_sheet_sheet_by_account" name="Timesheet by Day" res_model="hr_timesheet_sheet.sheet.day" src_model="hr_timesheet_sheet.sheet"/>
+<!--         <act_window domain="[('sheet_id', '=', active_id)]" id="act_hr_timesheet_sheet_sheet_by_account" name="Timesheet by Day" res_model="hr_timesheet_sheet.sheet.day" src_model="hr_timesheet_sheet.sheet"/>  -->
 
 
         <act_window domain="[('sheet_id', '=', active_id)]" id="act_hr_timesheet_sheet_sheet_2_hr_analytic_timesheet" name="Timesheet Lines" res_model="hr.analytic.timesheet" src_model="hr_timesheet_sheet.sheet"/>
             </field>
         </record>
 
+       <!-- Timesheet Button on Employee Form -->
+       <act_window domain="[('user_id', '=', user_id)]" id="act_hr_employee_2_hr_timesheet" name="Timesheets" res_model="hr_timesheet_sheet.sheet" src_model="hr.employee"/>
+
     </data>
 </openerp>