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