[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>
66                         From <field name="date_from" />
67                         to <field name="date_to"/>
68                     </h2>
69                     <group col="4" colspan="4">
70                         <field name="name"/>
71                         <field name="total_attendance" widget="float_time"/>
72                         <field name="department_id"/>
73                         <field name="total_timesheet" widget="float_time"/>
74                         <field name="company_id" groups="base.group_multi_company"/>
75                         <field name="total_difference" widget="float_time"/>
76                         <field name="user_id" invisible="1"/>
77                     </group>
78                     <notebook>
79                         <page string="Daily">
80                             <group col="6" colspan="4">
81                                 <button name="button_dummy" string="Go to:" type="object" icon="terp-gtk-jump-to-ltr"/>
82                                 <field name="date_current" nolabel="1"/>
83                                 <label string=""/>
84                                 <button icon="terp-gtk-go-back-ltr" name="date_previous" string="" type="object"/>
85                                 <button name="date_today" string="Today" type="object" icon="terp-go-today"/>
86                                 <button icon="terp-gtk-go-back-rtl" name="date_next" string="" type="object"/>
87                             </group>
88                             <group colspan="4" col="3">
89                                 <field context="{'name':date_current,'user_id':user_id}" name="attendances_ids" nolabel="1">
90                                     <tree string="Attendances" editable="bottom">
91                                         <field name="name"/>
92                                         <field name="action"/>
93                                         <field invisible="1" name="employee_id"/>
94                                     </tree>
95                                 </field>
96                                 <group class="oe_right">
97                                     <button name="sign_in" string="Sign In" type="object" icon="terp-gtk-jump-to-ltr"/>
98                                     <button name="sign_out" string="Sign Out" type="object" icon="terp-gtk-jump-to-rtl"/>
99                                 </group>
100                             </group>
101                             
102                             <group col="4">
103                                 <field name="state_attendance"/>
104                                 <field name="total_attendance_day" widget="float_time"/>
105                             </group>
106                             <field colspan="4" context="{'date':date_current,'user_id':user_id}" domain="[('name','=',date_current)]" name="timesheet_ids" nolabel="1">
107                                 <tree editable="top" string="Timesheet Lines">
108                                     <field invisible="1" name="date"/>
109                                     <field domain="[('type','=','normal'), ('state', '&lt;&gt;', 'close')]" name="account_id" on_change="on_change_account_id(account_id)"/>
110                                     <field name="name"/>
111                                     <field name="unit_amount" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)" widget="float_time"/>
112                                     <field name="to_invoice" widget="selection"/>
113                                     <field invisible="1" name="journal_id"/>
114                                     <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)"/>
115                                     <field invisible="1" name="product_uom_id" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)"/>
116                                     <field invisible="1" name="amount"/>
117                                     <field invisible="1" name="general_account_id"/>
118                                     <field invisible="1" name="user_id" required="1"/>
119                                 </tree>
120                                 <form string="Timesheet Lines" version="7.0">
121                                     <field name="date"/>
122                                     <field domain="[('type','=','normal'), ('state', '&lt;&gt;', 'close')]" name="account_id" on_change="on_change_account_id(account_id)"/>
123                                     <field name="name"/>
124                                     <field name="unit_amount" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)" widget="float_time"/>
125                                     <field name="to_invoice"/>
126                                     <field name="journal_id"/>
127                                     <field name="product_id" domain="[('type','=','service')]" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)"/>
128                                     <field name="product_uom_id" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)"/>
129                                     <field name="amount"/>
130                                     <field name="general_account_id"/>
131                                     <field name="user_id" required="1"/>
132                                 </form>
133                             </field>
134                             <field name="total_difference_day" widget="float_time"/>
135                             <field name="total_timesheet_day" widget="float_time"/>
136                         </page>
137                         <page string="Summary">
138                             <field colspan="4" name="period_ids" nolabel="1">
139                                 <tree colors="red:total_difference&lt;0.1;blue:total_difference&gt;=0.1" string="Period">
140                                     <field name="name"/>
141                                     <field name="total_attendance" widget="float_time"/>
142                                     <field name="total_timesheet" widget="float_time"/>
143                                     <field name="total_difference" widget="float_time"/>
144                                 </tree>
145                             </field>
146                         </page>
147                     </notebook>
148                 </sheet>
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="type">search</field>
157             <field name="arch" type="xml">
158                 <search string="Search Timesheet">
159                     <group>
160                         <field name="date_from"/>
161                         <separator orientation="vertical"/>
162                         <filter icon="terp-document-new" string="In Draft" domain="[('state','in',('draft', 'new'))]" help="Unvalidated Timesheets"/>
163                         <filter icon="terp-camera_test" string="To Approve" domain="[('state','=','confirm')]" help="Confirmed Timesheets"/>
164                         <separator orientation="vertical"/>
165                         <field name="employee_id"/>
166                         <field name="department_id" widget="selection"/>
167                     </group>
168                     <newline/>
169                     <group expand="0" string="Group By...">
170                         <filter string="Employees" icon="terp-personal" domain="[]" context="{'group_by':'employee_id'}"/>
171                         <filter string="Department" icon="terp-personal+" domain="[]" context="{'group_by':'department_id'}"/>
172                     </group>
173                 </search>
174             </field>
175         </record>
176
177         <record id="act_hr_timesheet_sheet_form" model="ir.actions.act_window">
178             <field name="name">Timesheets</field>
179             <field name="type">ir.actions.act_window</field>
180             <field name="res_model">hr_timesheet_sheet.sheet</field>
181             <field name="view_type">form</field>
182             <field name="view_id" eval="False"/>
183             <field name="context">{'search_default_my_timesheet':1}</field>
184             <field name="search_view_id" ref="view_hr_timesheet_sheet_filter"/>
185             <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>
186         </record>
187
188         <menuitem action="act_hr_timesheet_sheet_form" id="menu_act_hr_timesheet_sheet_form" parent="hr_attendance.menu_hr_time_tracking"
189              sequence="2" groups="base.group_hr_user,base.group_hr_manager"/>
190
191         <!--
192             Company inheritancy
193         -->
194
195         <record id="hr_timesheet_sheet_company" model="ir.ui.view">
196             <field name="name">res.company.sheet</field>
197             <field name="model">res.company</field>
198             <field name="type">form</field>
199             <field name="inherit_id" ref="base.view_company_form"/>
200             <field name="arch" type="xml">
201                 <page string="Configuration" position="inside">
202                     <separator string="Timesheets" colspan="4"/>
203                     <field name="timesheet_range"/>
204                     <field name="timesheet_max_difference"/>
205                     <newline/>
206                 </page>
207             </field>
208         </record>
209
210         <!--
211             hr.analytic.timesheet inheritancy
212         -->
213
214         <record id="hr_timesheet_line_form" model="ir.ui.view">
215             <field name="name">hr.analytic.timesheet.form</field>
216             <field name="model">hr.analytic.timesheet</field>
217             <field name="type">form</field>
218             <field name="inherit_id" ref="hr_timesheet.hr_timesheet_line_form"/>
219             <field name="arch" type="xml">
220                 <field name="date" position="after">
221                     <field name="sheet_id" />
222                 </field>
223             </field>
224         </record>
225
226         <record id="hr_timesheet_line_search" model="ir.ui.view">
227             <field name="name">hr.analytic.timesheet.search</field>
228             <field name="model">hr.analytic.timesheet</field>
229             <field name="type">form</field>
230             <field name="inherit_id" ref="hr_timesheet.hr_timesheet_line_search"/>
231             <field name="arch" type="xml">
232                 <field name="user_id" position="before">
233                     <field name="sheet_id"/>
234                 </field>
235             </field>
236         </record>
237
238         <!--
239             hr.attendance inheritancy
240         -->
241
242         <record model="ir.ui.view" id="view_hr_attendance_filter">
243             <field name="name">view_hr_attendance_filter</field>
244             <field name="model">hr.attendance</field>
245             <field name="type">search</field>
246             <field name="inherit_id" ref="hr_attendance.view_hr_attendance_filter" />
247             <field name="arch" type="xml">
248                 <field name="employee_id" position="after">
249                     <field name="sheet_id"/>
250                 </field>
251             </field>
252         </record>
253
254         <record id="view_attendance_form" model="ir.ui.view">
255             <field name="name">hr.attendance.form</field>
256             <field name="model">hr.attendance</field>
257             <field name="type">form</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="type">tree</field>
269             <field name="inherit_id" ref="hr_attendance.view_attendance_tree"/>
270             <field name="arch" type="xml">
271                 <field name="action" position="after">
272                     <field name="sheet_id"/>
273                 </field>
274             </field>
275         </record>
276         <record id="view_attendance_tree_who" 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_who"/>
281             <field name="arch" type="xml">
282                 <field name="action" position="after">
283                     <field name="sheet_id"/>
284                 </field>
285             </field>
286         </record>
287
288         <act_window
289         context="{'search_default_sheet_id': [active_id]}"
290         id="act_hr_timesheet_sheet_sheet_by_account"
291         name="Timesheet by Account"
292         res_model="hr_timesheet_sheet.sheet.account"
293         src_model="hr_timesheet_sheet.sheet"/>
294
295         <act_window
296         context="{'search_default_sheet_id': [active_id]}"
297         id="act_hr_timesheet_sheet_sheet_by_day"
298         name="Timesheet by Day"
299         res_model="hr_timesheet_sheet.sheet.day"
300         src_model="hr_timesheet_sheet.sheet"/>
301
302         <act_window
303         context="{'search_default_sheet_id': [active_id]}"
304         id="act_hr_timesheet_sheet_sheet_2_hr_analytic_timesheet"
305         name="Timesheet Lines"
306         res_model="hr.analytic.timesheet"
307         src_model="hr_timesheet_sheet.sheet"/>
308
309
310         <act_window
311         context="{'search_default_sheet_id': [active_id]}"
312         id="act_hr_timesheet_sheet_sheet_2_hr_attendance"
313         name="Attendances"
314         res_model="hr.attendance"
315         src_model="hr_timesheet_sheet.sheet"/>
316
317         <record id="hr_timesheet_sheet_tree_simplified" model="ir.ui.view">
318             <field name="name">hr.timesheet.sheet.tree</field>
319             <field name="model">hr_timesheet_sheet.sheet</field>
320             <field name="type">tree</field>
321             <field eval="10" name="priority"/>
322             <field name="arch" type="xml">
323                 <tree colors="blue:state == 'draft';black:state in ('confirm','new');gray:state == 'done'" string="Timesheets">
324                     <field name="employee_id"/>
325                     <field name="date_from"/>
326                     <field name="date_to"/>
327                     <field name="department_id"/>
328                     <field name="total_attendance" widget="float_time"/>
329                     <field name="total_timesheet" widget="float_time"/>
330                     <field name="total_difference" widget="float_time"/>
331                     <field name="state"/>
332                 </tree>
333             </field>
334         </record>
335
336         <record id="hr_timesheet_day_tree" model="ir.ui.view">
337             <field name="name">hr.timesheet.day.tree</field>
338             <field name="model">hr_timesheet_sheet.sheet.day</field>
339             <field name="type">tree</field>
340             <field name="arch" type="xml">
341                 <tree colors="blue:total_difference&lt;0.1;red:total_difference&gt;=0.1" string="Period">
342                     <field name="name"/>
343                     <field name="total_attendance" widget="float_time" sum="Total Attendances"/>
344                     <field name="total_timesheet" widget="float_time" sum="Total Timesheet"/>
345                     <field name="total_difference" widget="float_time" sum="Total Difference"/>
346                 </tree>
347             </field>
348         </record>
349         
350   <!-- Timesheet Button on Employee Form -->
351   <act_window
352            context="{'search_default_employee_id': [active_id], 'default_employee_id': active_id}"
353            id="act_hr_employee_2_hr_timesheet" name="Timesheets" res_model="hr_timesheet_sheet.sheet" src_model="hr.employee"/>
354            
355       <record id="hr_timesheet_sheet_employee_extd_form" model="ir.ui.view">
356             <field name="name">hr.timesheet.sheet.employee.extd_form</field>
357             <field name="model">hr.employee</field>
358             <field name="inherit_id" ref="hr.view_employee_form"/>
359             <field name="arch" type="xml">
360                 <xpath expr="//div[@name='button_box']" position="inside">
361                     <button name="%(act_hr_employee_2_hr_timesheet)d" string="Timesheets" type="action"/>
362                 </xpath>
363             </field>
364         </record>
365
366     </data>
367 </openerp>