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