[IMP] useability timesheets
[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
44         <record model="ir.actions.act_window" id="act_hr_timesheet_sheet_sheet_2_hr_analytic_timesheet">
45             <field name="context">{'search_default_sheet_id': [active_id]}</field>
46             <field name="name">Timesheet Activities</field>
47             <field name="res_model">hr.analytic.timesheet</field>
48             <field name="src_model">hr_timesheet_sheet.sheet</field>
49         </record>
50
51
52         <record model="ir.actions.act_window" id="act_hr_timesheet_sheet_sheet_2_hr_attendance">
53             <field name="context">{'search_default_sheet_id': [active_id]}</field>
54             <field name="name">Attendances</field>
55             <field name="res_model">hr.attendance</field>
56             <field name="src_model">hr_timesheet_sheet.sheet</field>
57         </record>
58
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="arch" type="xml">
64                 <form string="Timesheet" version="7.0">
65                 <header>
66                     <button name="button_confirm" states="draft" string="Submit to Manager" type="object" class="oe_highlight"/>
67                     <button name="done" states="confirm" string="Approve" type="workflow" groups="base.group_hr_user" class="oe_highlight"/>
68                     <button name="action_set_to_draft" states="done" string="Set to Draft" type="object" />
69                     <button name="cancel" states="confirm" string="Refuse" type="workflow" groups="base.group_hr_user" />
70                     <field name="state" widget="statusbar" statusbar_visible="new,confirm,done"/>
71                 </header>
72                 <sheet>
73                     <div class="oe_right oe_button_box" name="buttons">
74                         <button type="action"
75                             name="%(act_hr_timesheet_sheet_sheet_2_hr_analytic_timesheet)d"
76                             string="Timesheet Activities" />
77                         <button type="action" groups="base.group_hr_attendance"
78                             name="%(act_hr_timesheet_sheet_sheet_2_hr_attendance)d"
79                             string="Attendances" />
80                     </div>
81                     <div class="oe_title">
82                         <label for="employee_id" class="oe_edit_only"/>
83                         <h1><field name="employee_id" on_change="onchange_employee_id(employee_id)" class="oe_inline"/></h1>
84                     </div>
85                     <group>
86                         <group>
87                             <label for="date_from" string="Timesheet Period"/>
88                             <div><field name="date_from" class="oe_inline"/> to <field name="date_to" class="oe_inline"/></div>
89                             <field name="name" invisible="1"/>
90                             <field name="department_id" invisible="1"/>
91                             <field name="company_id" groups="base.group_multi_company"/>
92                         </group>
93                         <group groups="base.group_hr_attendance">
94                             <field name="total_attendance" widget="float_time"/>
95                             <field name="total_timesheet" widget="float_time"/>
96                             <field name="total_difference" widget="float_time"/>
97                             <field name="user_id" invisible="1"/>
98                         </group>
99                     </group>
100                     <notebook>
101                         <page string="Summary">
102                             <widget type="weekly_timesheet">
103                             </widget>
104                         </page>
105                         <page string="Details">
106                             <field context="{'user_id':user_id, 'timesheet_date_from': date_from, 'timesheet_date_to': date_to}" name="timesheet_ids" nolabel="1">
107                                 <tree editable="top" string="Timesheet Activities">
108                                     <field name="date"/>
109                                     <field domain="[('type','in',['normal', 'contract']), ('state', '&lt;&gt;', 'close'),('use_timesheets','=',1)]" name="account_id" on_change="on_change_account_id(account_id, user_id)" context="{'default_use_timesheets': 1}"/>
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" string="Hours" sum="Hours"/>
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 Activities" 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, user_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                         </page>
135                         <page string="Attendances" groups="base.group_hr_attendance">
136                             <group>
137                                 <field context="{'user_id':user_id}" name="attendances_ids" nolabel="1">
138                                     <tree string="Attendances" editable="bottom">
139                                         <field name="name"/>
140                                         <field name="action"/>
141                                         <field invisible="1" name="employee_id"/>
142                                     </tree>
143                                 </field>
144                                 <group>
145                                     <label for="state_attendance"/>
146                                     <div>
147                                         <field name="state_attendance"/>
148                                         <button name="attendance_action_change" attrs="{'invisible': [('state_attendance', '=', 'present')]}" type="object" string="Sign In" class="oe_link"/>
149                                         <button name="attendance_action_change" attrs="{'invisible': ['|', ('state_attendance','=',False), ('state_attendance', '=', 'absent')]}" type="object" string="Sign Out" class="oe_link"/>
150                                     </div>
151                                 </group>
152                             </group>
153                             <field name="period_ids">
154                                 <tree colors="red:total_difference&lt;0.1;blue:total_difference&gt;=0.1" string="Period">
155                                     <field name="name"/>
156                                     <field name="total_attendance" widget="float_time" sum="Attendances"/>
157                                     <field name="total_timesheet" widget="float_time" sum="Timesheets"/>
158                                     <field name="total_difference" widget="float_time" sum="Differences"/>
159                                 </tree>
160                             </field>
161                         </page>
162                     </notebook>
163                 </sheet>
164                 <div class="oe_chatter">
165                     <field name="message_ids" colspan="4" widget="mail_thread" nolabel="1"/>
166                     <field name="message_follower_ids" widget="mail_followers"/>
167                 </div>
168                 </form>
169             </field>
170         </record>
171
172         <record id="view_hr_timesheet_sheet_filter" model="ir.ui.view">
173             <field name="name">hr_timesheet_sheet.sheet.filter</field>
174             <field name="model">hr_timesheet_sheet.sheet</field>
175             <field name="arch" type="xml">
176                 <search string="Search Timesheet">
177                     <field name="date_from"/>
178                     <filter name="new" string="In Draft" domain="[('state','in',('draft', 'new'))]" help="Unvalidated Timesheets"/>
179                     <filter name="to_approve" string="To Approve" domain="[('state','=','confirm')]" help="Confirmed Timesheets"/>
180                     <field name="employee_id"/>
181                     <field name="department_id"/>
182                     <group expand="0" string="Group By...">
183                         <filter string="Employees" icon="terp-personal" domain="[]" context="{'group_by':'employee_id'}"/>
184                         <filter string="Department" icon="terp-personal+" domain="[]" context="{'group_by':'department_id'}"/>
185                     </group>
186                 </search>
187             </field>
188         </record>
189
190         <record id="act_hr_timesheet_sheet_form" model="ir.actions.act_window">
191             <field name="name">Timesheets to Validate</field>
192             <field name="type">ir.actions.act_window</field>
193             <field name="res_model">hr_timesheet_sheet.sheet</field>
194             <field name="view_type">form</field>
195             <field name="view_id" eval="False"/>
196             <field name="context">{'search_default_to_approve':1}</field>
197             <field name="search_view_id" ref="view_hr_timesheet_sheet_filter"/>
198             <field name="help" type="html">
199               <p class="oe_view_nocontent_create">
200                 New timesheet to approve.
201               </p><p>
202                 You must record timesheets every day and confirm at the end
203                 of the week. Once the timesheet is confirmed, it should be
204                 validated by a manager.
205               </p><p>
206                 Timesheets can also be invoiced to customers, depending on the
207                 configuration of each project's related contract.
208               </p>
209             </field>
210         </record>
211
212         <menuitem action="act_hr_timesheet_sheet_form" id="menu_act_hr_timesheet_sheet_form" parent="hr_attendance.menu_hr_time_tracking"
213              sequence="2" groups="base.group_hr_user"/>
214
215         <!--
216             Company inheritancy
217         -->
218
219         <record id="hr_timesheet_sheet_company" model="ir.ui.view">
220             <field name="name">res.company.sheet</field>
221             <field name="model">res.company</field>
222             <field name="inherit_id" ref="base.view_company_form"/>
223             <field name="arch" type="xml">
224                 <xpath expr="//group[@name='account_grp']" position="after">
225                     <group name="timesheets_grp" string="Timesheets">
226                         <field name="timesheet_range"/>
227                         <field name="timesheet_max_difference"/>
228                     </group>
229                 </xpath>
230             </field>
231         </record>
232
233         <!--
234             hr.analytic.timesheet inheritancy
235         -->
236
237         <record id="hr_timesheet_line_form" model="ir.ui.view">
238             <field name="name">hr.analytic.timesheet.form</field>
239             <field name="model">hr.analytic.timesheet</field>
240             <field name="inherit_id" ref="hr_timesheet.hr_timesheet_line_form"/>
241             <field name="arch" type="xml">
242                 <field name="date" position="after">
243                     <field name="sheet_id" />
244                 </field>
245             </field>
246         </record>
247
248         <record id="hr_timesheet_line_search" model="ir.ui.view">
249             <field name="name">hr.analytic.timesheet.search</field>
250             <field name="model">hr.analytic.timesheet</field>
251             <field name="inherit_id" ref="hr_timesheet.hr_timesheet_line_search"/>
252             <field name="arch" type="xml">
253                 <field name="date" position="before">
254                     <field name="sheet_id"/>
255                 </field>
256             </field>
257         </record>
258
259         <!--
260             hr.attendance inheritancy
261         -->
262
263         <record model="ir.ui.view" id="view_hr_attendance_filter">
264             <field name="name">view_hr_attendance_filter</field>
265             <field name="model">hr.attendance</field>
266             <field name="inherit_id" ref="hr_attendance.view_hr_attendance_filter" />
267             <field name="arch" type="xml">
268                 <field name="employee_id" position="after">
269                     <field name="sheet_id"/>
270                 </field>
271             </field>
272         </record>
273
274         <record id="view_attendance_form" model="ir.ui.view">
275             <field name="name">hr.attendance.form</field>
276             <field name="model">hr.attendance</field>
277             <field name="inherit_id" ref="hr_attendance.view_attendance_form"/>
278             <field name="arch" type="xml">
279                 <field name="action_desc" position="after">
280                     <field name="sheet_id"/>
281                 </field>
282             </field>
283         </record>
284         <record id="view_attendance_tree" model="ir.ui.view">
285             <field name="name">hr.attendance.tree</field>
286             <field name="model">hr.attendance</field>
287             <field name="inherit_id" ref="hr_attendance.view_attendance_tree"/>
288             <field name="arch" type="xml">
289                 <field name="action" position="after">
290                     <field name="sheet_id"/>
291                 </field>
292             </field>
293         </record>
294         <record id="view_attendance_tree_who" model="ir.ui.view">
295             <field name="name">hr.attendance.tree</field>
296             <field name="model">hr.attendance</field>
297             <field name="inherit_id" ref="hr_attendance.view_attendance_who"/>
298             <field name="arch" type="xml">
299                 <field name="action" position="after">
300                     <field name="sheet_id"/>
301                 </field>
302             </field>
303         </record>
304
305         <act_window
306             context="{'search_default_sheet_id': [active_id]}"
307             id="act_hr_timesheet_sheet_sheet_by_account"
308             name="Timesheet by Account"
309             groups="base.group_hr_attendance"
310             res_model="hr_timesheet_sheet.sheet.account"
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_by_day"
316             name="Timesheet by Day"
317             groups="base.group_hr_attendance"
318             res_model="hr_timesheet_sheet.sheet.day"
319             src_model="hr_timesheet_sheet.sheet"/>
320
321         <record id="hr_timesheet_sheet_tree_simplified" model="ir.ui.view">
322             <field name="name">hr.timesheet.sheet.tree</field>
323             <field name="model">hr_timesheet_sheet.sheet</field>
324             <field eval="10" name="priority"/>
325             <field name="arch" type="xml">
326                 <tree colors="blue:state == 'draft';black:state in ('confirm','new');gray:state == 'done'" string="Timesheets">
327                     <field name="employee_id"/>
328                     <field name="date_from"/>
329                     <field name="date_to"/>
330                     <field name="department_id" invisible="1"/>
331                     <field name="total_attendance" widget="float_time" groups="base.group_hr_attendance"/>
332                     <field name="total_timesheet" widget="float_time"/>
333                     <field name="total_difference" widget="float_time" groups="base.group_hr_attendance"/>
334                     <field name="state"/>
335                 </tree>
336             </field>
337         </record>
338
339         <record id="hr_timesheet_day_tree" model="ir.ui.view">
340             <field name="name">hr.timesheet.day.tree</field>
341             <field name="model">hr_timesheet_sheet.sheet.day</field>
342             <field name="arch" type="xml">
343                 <tree colors="blue:total_difference&lt;0.1;red:total_difference&gt;=0.1" string="Period">
344                     <field name="name"/>
345                     <field name="total_attendance" widget="float_time" sum="Total Attendances" groups="base.group_hr_attendance"/>
346                     <field name="total_timesheet" widget="float_time" sum="Total Timesheet"/>
347                     <field name="total_difference" widget="float_time" sum="Total Difference" groups="base.group_hr_attendance"/>
348                 </tree>
349             </field>
350         </record>
351
352   <!-- Timesheet Button on Employee Form -->
353            
354     <record id="act_hr_employee_2_hr_timesheet" model="ir.actions.act_window">
355         <field name="res_model">hr_timesheet_sheet.sheet</field>
356         <field name="view_type">form</field>
357         <field name="name">Timesheets</field>
358         <field name="view_mode">tree,form</field>
359         <field name="context">{'search_default_employee_id': [active_id], 'default_employee_id': active_id}</field>
360     </record>
361          
362       <record id="hr_timesheet_sheet_employee_extd_form" model="ir.ui.view">
363             <field name="name">hr.timesheet.sheet.employee.extd_form</field>
364             <field name="model">hr.employee</field>
365             <field name="inherit_id" ref="hr_timesheet.hr_timesheet_employee_extd_form"/>
366             <field name="arch" type="xml">
367                 <xpath expr="//div[@name='button_box']" position="inside">
368                     <button name="%(act_hr_employee_2_hr_timesheet)d" string="Timesheets" type="action" groups="base.group_hr_manager"/>
369                 </xpath>
370             </field>
371         </record>
372
373     </data>
374 </openerp>