[MERGE] auto-follow Sales Team, Projet, HR Manager
[odoo/odoo.git] / addons / hr_timesheet_sheet / hr_timesheet_sheet_view.xml
1 <?xml version="1.0" encoding="utf-8"?>
2 <openerp>
3     <data>
4
5         <record id="hr_timesheet_account_form" model="ir.ui.view">
6             <field name="name">hr.timesheet.account.form</field>
7             <field name="model">hr_timesheet_sheet.sheet.account</field>
8             <field name="arch" type="xml">
9                 <form string="Timesheet by Accounts" version="7.0">
10                     <group col="4">
11                         <field name="sheet_id"/>
12                         <field name="name" groups="analytic.group_analytic_accounting"/>
13                         <field name="total" sum="Total"/>
14                         <field name="invoice_rate"/>
15                     </group>
16                 </form>
17             </field>
18         </record>
19         <record id="hr_timesheet_account_filter" model="ir.ui.view">
20             <field name="name">hr.timesheet.account.filter</field>
21             <field name="model">hr_timesheet_sheet.sheet.account</field>
22             <field name="arch" type="xml">
23                 <search string="Search Account">
24                     <field name="name" groups="analytic.group_analytic_accounting"/>
25                     <field name="invoice_rate"/>
26                     <field name="sheet_id" />
27                 </search>
28             </field>
29         </record>
30         <record id="hr_timesheet_account_tree" model="ir.ui.view">
31             <field name="name">hr.timesheet.account.tree</field>
32             <field name="model">hr_timesheet_sheet.sheet.account</field>
33             <field name="arch" type="xml">
34                 <tree string="Timesheet by Accounts">
35                     <field name="sheet_id"/>
36                     <field name="name" groups="analytic.group_analytic_accounting"/>
37                     <field name="total" sum="Total"/>
38                     <field name="invoice_rate"/>
39                 </tree>
40             </field>
41         </record>
42
43         <record id="hr_timesheet_sheet_form" model="ir.ui.view">
44             <field name="name">hr.timesheet.sheet.form</field>
45             <field name="model">hr_timesheet_sheet.sheet</field>
46             <field name="arch" type="xml">
47                 <form string="Timesheet" version="7.0">
48                 <header>
49                     <button name="button_confirm" states="draft" string="Submit to Manager" type="object" class="oe_highlight"/>
50                     <button name="done" states="confirm" string="Approve" type="workflow" groups="base.group_hr_user" class="oe_highlight"/>
51                     <button name="action_set_to_draft" states="done" string="Set to Draft" type="object" />
52                     <button name="cancel" states="confirm" string="Refuse" type="workflow" groups="base.group_hr_user" />
53                     <field name="state" widget="statusbar" statusbar_visible="new,confirm,done"/>
54                 </header>
55                 <sheet>
56                     <label for="employee_id" class="oe_edit_only"/>
57                     <h1><field name="employee_id" on_change="onchange_employee_id(employee_id)"/></h1>
58                     <label for="date_from" class="oe_edit_only" string="Timesheet Period"/>
59                     <h2>From <field name="date_from"/> to <field name="date_to"/></h2>
60                     <group>
61                         <group>
62                             <field name="name"/>
63                             <field name="department_id"/>
64                             <field name="company_id" groups="base.group_multi_company"/>
65                         </group>
66                         <group>
67                             <field name="total_attendance" widget="float_time" groups="base.group_hr_attendance"/>
68                             <field name="total_timesheet" widget="float_time"/>
69                             <field name="total_difference" widget="float_time" groups="base.group_hr_attendance"/>
70                             <field name="user_id" invisible="1"/>
71                         </group>
72                     </group>
73                     <notebook>
74                         <page string="Daily">
75                             <group>
76                                 <div>
77                                     <button name="button_dummy" class="oe_inline" string="Go to" type="object" icon="terp-gtk-jump-to-ltr"/> :
78                                     <field name="date_current" class="oe_inline"/>
79                                 </div>
80                                 <div align="right">
81                                     <button class="oe_inline" icon="terp-gtk-go-back-ltr" name="date_previous" string="" type="object"/>
82                                     <button class="oe_inline" name="date_today" string="Today" type="object" icon="terp-go-today"/>
83                                     <button class="oe_inline" icon="terp-gtk-go-back-rtl" name="date_next" string="" type="object"/>
84                                 </div>
85                             </group>
86                             <group colspan="4" col="3">
87                                 <field context="{'name':date_current,'user_id':user_id}" name="attendances_ids" nolabel="1" groups="base.group_hr_attendance">
88                                     <tree string="Attendances" editable="bottom">
89                                         <field name="name"/>
90                                         <field name="action"/>
91                                         <field invisible="1" name="employee_id"/>
92                                     </tree>
93                                 </field>
94                                 <group>
95                                     <div align="right" groups="base.group_hr_manager,base.group_hr_attendance">
96                                         <button name="attendance_action_change" attrs="{'invisible': [('state_attendance', '=', 'present')]}" type="object" string="Sign In" groups="base.group_hr_attendance"/>
97                                         <button name="attendance_action_change" attrs="{'invisible': ['|', ('state_attendance','=',False), ('state_attendance', '=', 'absent')]}" type="object" string="Sign Out" groups="base.group_hr_attendance"/>
98                                     </div>
99                                 </group>
100                             </group>
101                             <group col="4">
102                                 <field name="state_attendance" groups="base.group_hr_attendance"/>
103                             </group>
104                             <field colspan="4" context="{'date':date_current,'user_id':user_id}" domain="[('name','=',date_current)]" name="timesheet_ids" nolabel="1">
105                                 <tree editable="top" string="Timesheet Lines">
106                                     <field invisible="1" name="date"/>
107                                     <field domain="[('type','in',['normal', 'contract']), ('state', '&lt;&gt;', 'close'),('use_timesheets','=',1)]" name="account_id" on_change="on_change_account_id(account_id)" context="{'default_use_timesheets': 1}"/>
108                                     <field name="name"/>
109                                     <field name="unit_amount" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)" widget="float_time"/>
110                                     <field name="to_invoice" widget="selection"/>
111                                     <field invisible="1" name="journal_id"/>
112                                     <field invisible="1" name="product_id" domain="[('type','=','service')]" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)"/>
113                                     <field invisible="1" name="product_uom_id" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)"/>
114                                     <field invisible="1" name="amount"/>
115                                     <field invisible="1" name="general_account_id"/>
116                                     <field invisible="1" name="user_id" required="1"/>
117                                 </tree>
118                                 <form string="Timesheet Lines" version="7.0">
119                                     <field name="date"/>
120                                     <field domain="[('type','=','normal'), ('state', '&lt;&gt;', 'close')]" name="account_id" on_change="on_change_account_id(account_id)"/>
121                                     <field name="name"/>
122                                     <field name="unit_amount" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)" widget="float_time"/>
123                                     <field name="to_invoice"/>
124                                     <field name="journal_id"/>
125                                     <field name="product_id" domain="[('type','=','service')]" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)"/>
126                                     <field name="product_uom_id" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)"/>
127                                     <field name="amount"/>
128                                     <field name="general_account_id"/>
129                                     <field name="user_id" required="1"/>
130                                 </form>
131                             </field>
132                         </page>
133                         <page string="Summary">
134                             <field colspan="4" name="period_ids" nolabel="1">
135                                 <tree colors="red:total_difference&lt;0.1;blue:total_difference&gt;=0.1" string="Period">
136                                     <field name="name"/>
137                                     <field name="total_attendance" widget="float_time" groups="base.group_hr_attendance"/>
138                                     <field name="total_timesheet" widget="float_time"/>
139                                     <field name="total_difference" widget="float_time" groups="base.group_hr_attendance"/>
140                                 </tree>
141                             </field>
142                         </page>
143                     </notebook>
144                 </sheet>
145                 <div class="oe_chatter">
146                     <field name="message_ids" colspan="4" widget="mail_thread" nolabel="1"/>
147                     <field name="message_follower_ids" widget="mail_followers"/>
148                 </div>
149                 </form>
150             </field>
151         </record>
152
153         <record id="view_hr_timesheet_sheet_filter" model="ir.ui.view">
154             <field name="name">hr_timesheet_sheet.sheet.filter</field>
155             <field name="model">hr_timesheet_sheet.sheet</field>
156             <field name="arch" type="xml">
157                 <search string="Search Timesheet">
158                     <field name="date_from"/>
159                     <filter icon="terp-document-new" string="In Draft" domain="[('state','in',('draft', 'new'))]" help="Unvalidated Timesheets"/>
160                     <filter icon="terp-camera_test" string="To Approve" domain="[('state','=','confirm')]" help="Confirmed Timesheets"/>
161                     <field name="employee_id"/>
162                     <field name="department_id"/>
163                     <group expand="0" string="Group By...">
164                         <filter string="Employees" icon="terp-personal" domain="[]" context="{'group_by':'employee_id'}"/>
165                         <filter string="Department" icon="terp-personal+" domain="[]" context="{'group_by':'department_id'}"/>
166                     </group>
167                 </search>
168             </field>
169         </record>
170
171         <record id="act_hr_timesheet_sheet_form" model="ir.actions.act_window">
172             <field name="name">Timesheets</field>
173             <field name="type">ir.actions.act_window</field>
174             <field name="res_model">hr_timesheet_sheet.sheet</field>
175             <field name="view_type">form</field>
176             <field name="view_id" eval="False"/>
177             <field name="context">{'search_default_my_timesheet':1}</field>
178             <field name="search_view_id" ref="view_hr_timesheet_sheet_filter"/>
179             <field name="help" type="html">
180               <p class="oe_view_nocontent_create">
181                 Click to go to your timesheet. 
182               </p><p>
183                 You must record timesheets every day and confirm at the end
184                 of the week. Once the timesheet is confirmed, it his sent to
185                 the manager for validation.
186               </p><p>
187                 Timesheets can also be invoiced to customers, depending on the
188                 configuration of the project.
189               </p>
190             </field>
191         </record>
192
193         <menuitem action="act_hr_timesheet_sheet_form" id="menu_act_hr_timesheet_sheet_form" parent="hr_attendance.menu_hr_time_tracking"
194              sequence="2" groups="base.group_hr_user"/>
195
196         <!--
197             Company inheritancy
198         -->
199
200         <record id="hr_timesheet_sheet_company" model="ir.ui.view">
201             <field name="name">res.company.sheet</field>
202             <field name="model">res.company</field>
203             <field name="inherit_id" ref="base.view_company_form"/>
204             <field name="arch" type="xml">
205                 <xpath expr="//group[@name='account_grp']" position="after">
206                     <group name="timesheets_grp" string="Timesheets">
207                         <field name="timesheet_range"/>
208                         <field name="timesheet_max_difference"/>
209                     </group>
210                 </xpath>
211             </field>
212         </record>
213
214         <!--
215             hr.analytic.timesheet inheritancy
216         -->
217
218         <record id="hr_timesheet_line_form" model="ir.ui.view">
219             <field name="name">hr.analytic.timesheet.form</field>
220             <field name="model">hr.analytic.timesheet</field>
221             <field name="inherit_id" ref="hr_timesheet.hr_timesheet_line_form"/>
222             <field name="arch" type="xml">
223                 <field name="date" position="after">
224                     <field name="sheet_id" />
225                 </field>
226             </field>
227         </record>
228
229         <record id="hr_timesheet_line_search" model="ir.ui.view">
230             <field name="name">hr.analytic.timesheet.search</field>
231             <field name="model">hr.analytic.timesheet</field>
232             <field name="inherit_id" ref="hr_timesheet.hr_timesheet_line_search"/>
233             <field name="arch" type="xml">
234                 <field name="date" position="before">
235                     <field name="sheet_id"/>
236                 </field>
237             </field>
238         </record>
239
240         <!--
241             hr.attendance inheritancy
242         -->
243
244         <record model="ir.ui.view" id="view_hr_attendance_filter">
245             <field name="name">view_hr_attendance_filter</field>
246             <field name="model">hr.attendance</field>
247             <field name="inherit_id" ref="hr_attendance.view_hr_attendance_filter" />
248             <field name="arch" type="xml">
249                 <field name="employee_id" position="after">
250                     <field name="sheet_id"/>
251                 </field>
252             </field>
253         </record>
254
255         <record id="view_attendance_form" model="ir.ui.view">
256             <field name="name">hr.attendance.form</field>
257             <field name="model">hr.attendance</field>
258             <field name="inherit_id" ref="hr_attendance.view_attendance_form"/>
259             <field name="arch" type="xml">
260                 <field name="action_desc" position="after">
261                     <field name="sheet_id"/>
262                 </field>
263             </field>
264         </record>
265         <record id="view_attendance_tree" model="ir.ui.view">
266             <field name="name">hr.attendance.tree</field>
267             <field name="model">hr.attendance</field>
268             <field name="inherit_id" ref="hr_attendance.view_attendance_tree"/>
269             <field name="arch" type="xml">
270                 <field name="action" position="after">
271                     <field name="sheet_id"/>
272                 </field>
273             </field>
274         </record>
275         <record id="view_attendance_tree_who" model="ir.ui.view">
276             <field name="name">hr.attendance.tree</field>
277             <field name="model">hr.attendance</field>
278             <field name="inherit_id" ref="hr_attendance.view_attendance_who"/>
279             <field name="arch" type="xml">
280                 <field name="action" position="after">
281                     <field name="sheet_id"/>
282                 </field>
283             </field>
284         </record>
285
286         <act_window
287         context="{'search_default_sheet_id': [active_id]}"
288         id="act_hr_timesheet_sheet_sheet_by_account"
289         name="Timesheet by Account"
290         res_model="hr_timesheet_sheet.sheet.account"
291         src_model="hr_timesheet_sheet.sheet"/>
292
293         <act_window
294         context="{'search_default_sheet_id': [active_id]}"
295         id="act_hr_timesheet_sheet_sheet_by_day"
296         name="Timesheet by Day"
297         res_model="hr_timesheet_sheet.sheet.day"
298         src_model="hr_timesheet_sheet.sheet"/>
299
300         <act_window
301         context="{'search_default_sheet_id': [active_id]}"
302         id="act_hr_timesheet_sheet_sheet_2_hr_analytic_timesheet"
303         name="Timesheet Lines"
304         res_model="hr.analytic.timesheet"
305         src_model="hr_timesheet_sheet.sheet"/>
306
307
308         <act_window
309         context="{'search_default_sheet_id': [active_id]}"
310         id="act_hr_timesheet_sheet_sheet_2_hr_attendance"
311         name="Attendances"
312         res_model="hr.attendance"
313         src_model="hr_timesheet_sheet.sheet"/>
314
315         <record id="hr_timesheet_sheet_tree_simplified" model="ir.ui.view">
316             <field name="name">hr.timesheet.sheet.tree</field>
317             <field name="model">hr_timesheet_sheet.sheet</field>
318             <field eval="10" name="priority"/>
319             <field name="arch" type="xml">
320                 <tree colors="blue:state == 'draft';black:state in ('confirm','new');gray:state == 'done'" string="Timesheets">
321                     <field name="employee_id"/>
322                     <field name="date_from"/>
323                     <field name="date_to"/>
324                     <field name="department_id"/>
325                     <field name="total_attendance" widget="float_time" groups="base.group_hr_attendance"/>
326                     <field name="total_timesheet" widget="float_time"/>
327                     <field name="total_difference" widget="float_time" groups="base.group_hr_attendance"/>
328                     <field name="state"/>
329                 </tree>
330             </field>
331         </record>
332
333         <record id="hr_timesheet_day_tree" model="ir.ui.view">
334             <field name="name">hr.timesheet.day.tree</field>
335             <field name="model">hr_timesheet_sheet.sheet.day</field>
336             <field name="arch" type="xml">
337                 <tree colors="blue:total_difference&lt;0.1;red:total_difference&gt;=0.1" string="Period">
338                     <field name="name"/>
339                     <field name="total_attendance" widget="float_time" sum="Total Attendances" groups="base.group_hr_attendance"/>
340                     <field name="total_timesheet" widget="float_time" sum="Total Timesheet"/>
341                     <field name="total_difference" widget="float_time" sum="Total Difference" groups="base.group_hr_attendance"/>
342                 </tree>
343             </field>
344         </record>
345
346   <!-- Timesheet Button on Employee Form -->
347            
348     <record id="act_hr_employee_2_hr_timesheet" model="ir.actions.act_window">
349         <field name="res_model">hr_timesheet_sheet.sheet</field>
350         <field name="view_type">form</field>
351         <field name="name">Timesheets</field>
352         <field name="view_mode">tree,form</field>
353         <field name="context">{'search_default_employee_id': [active_id], 'default_employee_id': active_id}</field>
354     </record>
355          
356       <record id="hr_timesheet_sheet_employee_extd_form" model="ir.ui.view">
357             <field name="name">hr.timesheet.sheet.employee.extd_form</field>
358             <field name="model">hr.employee</field>
359             <field name="inherit_id" ref="hr_timesheet.hr_timesheet_employee_extd_form"/>
360             <field name="arch" type="xml">
361                 <xpath expr="//div[@name='button_box']" position="inside">
362                     <button name="%(act_hr_employee_2_hr_timesheet)d" string="Timesheets" type="action" groups="base.group_hr_manager"/>
363                 </xpath>
364             </field>
365         </record>
366
367     </data>
368 </openerp>