[MERGE] lp:openobject-addons
[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" class="oe_highlight"/>
68                     <button name="done" states="confirm" string="Approve" type="workflow" groups="base.group_hr_user" class="oe_highlight"/>
69                     <button name="action_set_to_draft" states="done" string="Set to Draft" type="object" class="oe_form_button_return_flow"/>
70                     <button name="cancel" states="confirm" string="Refuse" type="workflow" groups="base.group_hr_user" class="oe_form_button_return_flow"/>
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">
82                         <field name="name"/>
83                         <field name="department_id"/>
84                         <field name="company_id" groups="base.group_multi_company"/>
85                         <field name="user_id" invisible="1"/>
86                     </group>
87                     <notebook>
88                         <page string="Daily">
89                             <group col="6" colspan="4">
90                                 <button name="button_dummy" string="Go to:" type="object" icon="terp-gtk-jump-to-ltr"/>
91                                 <field name="date_current" nolabel="1"/>
92                                 <label string=""/>
93                                 <button icon="terp-gtk-go-back-ltr" name="date_previous" string="" type="object"/>
94                                 <button name="date_today" string="Today" type="object" icon="terp-go-today"/>
95                                 <button icon="terp-gtk-go-back-rtl" name="date_next" string="" type="object"/>
96                             </group>
97
98                             <field colspan="3" context="{'name':date_current,'user_id':user_id}" height="100" name="attendances_ids" nolabel="1">
99                                 <tree string="Attendances" editable="bottom">
100                                     <field name="name"/>
101                                     <field name="action"/>
102                                     <field invisible="1" name="employee_id"/>
103                                 </tree>
104                             </field>
105                             <group col="4" colspan="1">
106                                 <field name="state_attendance"/>
107                                 <button name="sign_in" string="Sign In" type="object" icon="terp-gtk-jump-to-ltr"/>
108                                 <button name="sign_out" string="Sign Out" type="object" icon="terp-gtk-jump-to-rtl"/>
109                                 <field name="total_attendance_day" widget="float_time" colspan="4"/>
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','=','normal'), ('state', '&lt;&gt;', 'close')]" name="account_id" on_change="on_change_account_id(account_id)"/>
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                             <group colspan="4" col="6">
152                                 <field name="total_attendance" widget="float_time"/>
153                                 <field name="total_timesheet" widget="float_time"/>
154                                 <field name="total_difference" widget="float_time"/>
155                             </group>
156                         </page>
157                     </notebook>
158                 </sheet>
159                 </form>
160             </field>
161         </record>
162
163         <record id="view_hr_timesheet_sheet_filter" model="ir.ui.view">
164             <field name="name">hr_timesheet_sheet.sheet.filter</field>
165             <field name="model">hr_timesheet_sheet.sheet</field>
166             <field name="type">search</field>
167             <field name="arch" type="xml">
168                 <search string="Search Timesheet">
169                     <group>
170                         <filter icon="terp-document-new" string="In Draft" domain="[('state','in',('draft', 'new'))]" help="Unvalidated Timesheets"/>
171                         <filter icon="terp-camera_test" string="To Approve" domain="[('state','=','confirm')]" help="Confirmed Timesheets"/>
172                         <separator orientation="vertical"/>
173                         <field name="employee_id"/>
174                         <field name="date_from"/>
175                         <field name="department_id" widget="selection"/>
176                     </group>
177                     <newline/>
178                     <group expand="0" string="Group By...">
179                         <filter string="Employees" icon="terp-personal" domain="[]" context="{'group_by':'employee_id'}"/>
180                         <filter string="Department" icon="terp-personal+" domain="[]" context="{'group_by':'department_id'}"/>
181                     </group>
182                 </search>
183             </field>
184         </record>
185
186         <record id="act_hr_timesheet_sheet_form" model="ir.actions.act_window">
187             <field name="name">Timesheets</field>
188             <field name="type">ir.actions.act_window</field>
189             <field name="res_model">hr_timesheet_sheet.sheet</field>
190             <field name="view_type">form</field>
191             <field name="view_id" eval="False"/>
192             <field name="context">{'search_default_my_timesheet':1}</field>
193             <field name="search_view_id" ref="view_hr_timesheet_sheet_filter"/>
194             <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>
195         </record>
196
197         <menuitem action="act_hr_timesheet_sheet_form" id="menu_act_hr_timesheet_sheet_form" parent="hr_attendance.menu_hr_time_tracking"
198              sequence="2" groups="base.group_hr_user,base.group_hr_manager"/>
199
200         <!--
201             Company inheritancy
202         -->
203
204         <record id="hr_timesheet_sheet_company" model="ir.ui.view">
205             <field name="name">res.company.sheet</field>
206             <field name="model">res.company</field>
207             <field name="type">form</field>
208             <field name="inherit_id" ref="base.view_company_form"/>
209             <field name="arch" type="xml">
210                 <page string="Configuration" position="inside">
211                     <separator string="Timesheets" colspan="4"/>
212                     <field name="timesheet_range"/>
213                     <field name="timesheet_max_difference"/>
214                     <newline/>
215                 </page>
216             </field>
217         </record>
218
219         <!--
220             hr.analytic.timesheet inheritancy
221         -->
222
223         <record id="hr_timesheet_line_form" model="ir.ui.view">
224             <field name="name">hr.analytic.timesheet.form</field>
225             <field name="model">hr.analytic.timesheet</field>
226             <field name="type">form</field>
227             <field name="inherit_id" ref="hr_timesheet.hr_timesheet_line_form"/>
228             <field name="arch" type="xml">
229                 <field name="date" position="after">
230                     <field name="sheet_id" />
231                 </field>
232             </field>
233         </record>
234
235         <record id="hr_timesheet_line_search" model="ir.ui.view">
236             <field name="name">hr.analytic.timesheet.search</field>
237             <field name="model">hr.analytic.timesheet</field>
238             <field name="type">form</field>
239             <field name="inherit_id" ref="hr_timesheet.hr_timesheet_line_search"/>
240             <field name="arch" type="xml">
241                 <field name="date" position="after">
242                     <field name="sheet_id"/>
243                 </field>
244             </field>
245         </record>
246
247         <!--
248             hr.attendance inheritancy
249         -->
250
251         <record model="ir.ui.view" id="view_hr_attendance_filter">
252             <field name="name">view_hr_attendance_filter</field>
253             <field name="model">hr.attendance</field>
254             <field name="type">search</field>
255             <field name="inherit_id" ref="hr_attendance.view_hr_attendance_filter" />
256             <field name="arch" type="xml">
257                 <field name="action" position="after">
258                     <field name="sheet_id" />
259                 </field>
260             </field>
261         </record>
262
263         <record id="view_attendance_form" model="ir.ui.view">
264             <field name="name">hr.attendance.form</field>
265             <field name="model">hr.attendance</field>
266             <field name="type">form</field>
267             <field name="inherit_id" ref="hr_attendance.view_attendance_form"/>
268             <field name="arch" type="xml">
269                 <field name="action_desc" position="after">
270                     <field name="sheet_id"/>
271                 </field>
272             </field>
273         </record>
274         <record id="view_attendance_tree" model="ir.ui.view">
275             <field name="name">hr.attendance.tree</field>
276             <field name="model">hr.attendance</field>
277             <field name="type">tree</field>
278             <field name="inherit_id" ref="hr_attendance.view_attendance_tree"/>
279             <field name="arch" type="xml">
280                 <field name="action" position="after">
281                     <field name="sheet_id"/>
282                 </field>
283             </field>
284         </record>
285         <record id="view_attendance_tree_who" model="ir.ui.view">
286             <field name="name">hr.attendance.tree</field>
287             <field name="model">hr.attendance</field>
288             <field name="type">tree</field>
289             <field name="inherit_id" ref="hr_attendance.view_attendance_who"/>
290             <field name="arch" type="xml">
291                 <field name="action" position="after">
292                     <field name="sheet_id"/>
293                 </field>
294             </field>
295         </record>
296
297         <act_window
298         context="{'search_default_sheet_id': [active_id]}"
299         id="act_hr_timesheet_sheet_sheet_by_account"
300         name="Timesheet by Account"
301         res_model="hr_timesheet_sheet.sheet.account"
302         src_model="hr_timesheet_sheet.sheet"/>
303
304         <act_window
305         context="{'search_default_sheet_id': [active_id]}"
306         id="act_hr_timesheet_sheet_sheet_by_day"
307         name="Timesheet by Day"
308         res_model="hr_timesheet_sheet.sheet.day"
309         src_model="hr_timesheet_sheet.sheet"/>
310
311         <act_window
312         context="{'search_default_sheet_id': [active_id]}"
313         id="act_hr_timesheet_sheet_sheet_2_hr_analytic_timesheet"
314         name="Timesheet Lines"
315         res_model="hr.analytic.timesheet"
316         src_model="hr_timesheet_sheet.sheet"/>
317
318
319         <act_window
320         context="{'search_default_sheet_id': [active_id]}"
321         id="act_hr_timesheet_sheet_sheet_2_hr_attendance"
322         name="Attendances"
323         res_model="hr.attendance"
324         src_model="hr_timesheet_sheet.sheet"/>
325
326         <record id="hr_timesheet_sheet_tree_simplified" model="ir.ui.view">
327             <field name="name">hr.timesheet.sheet.tree</field>
328             <field name="model">hr_timesheet_sheet.sheet</field>
329             <field name="type">tree</field>
330             <field eval="10" name="priority"/>
331             <field name="arch" type="xml">
332                 <tree colors="blue:state == 'draft';black:state in ('confirm','new');gray:state == 'done'" string="Timesheets">
333                     <field name="employee_id"/>
334                     <field name="date_from"/>
335                     <field name="date_to"/>
336                     <field name="department_id"/>
337                     <field name="total_attendance" widget="float_time"/>
338                     <field name="total_timesheet" widget="float_time"/>
339                     <field name="total_difference" widget="float_time"/>
340                     <field name="state"/>
341                 </tree>
342             </field>
343         </record>
344         <record id="view_hr_timesheet_sheet_graph" model="ir.ui.view">
345             <field name="name">hr.timesheet.sheet.sheet.graph</field>
346             <field name="model">hr_timesheet_sheet.sheet</field>
347             <field name="type">graph</field>
348             <field name="arch" type="xml">
349                 <graph orientation="horizontal" string="Available Attendance" type="bar">
350                     <field name="name"/>
351                     <field name="total_attendance" operator="+"/>
352                 </graph>
353             </field>
354         </record>
355
356         <record id="hr_timesheet_day_tree" model="ir.ui.view">
357             <field name="name">hr.timesheet.day.tree</field>
358             <field name="model">hr_timesheet_sheet.sheet.day</field>
359             <field name="type">tree</field>
360             <field name="arch" type="xml">
361                 <tree colors="blue:total_difference&lt;0.1;red:total_difference&gt;=0.1" string="Period">
362                     <field name="name"/>
363                     <field name="total_attendance" widget="float_time" sum="Total Attendances"/>
364                     <field name="total_timesheet" widget="float_time" sum="Total Timesheet"/>
365                     <field name="total_difference" widget="float_time" sum="Total Difference"/>
366                 </tree>
367             </field>
368         </record>
369
370   <!-- Timesheet Button on Employee Form -->
371   <act_window
372            context="{'search_default_employee_id': [active_id], 'default_employee_id': active_id}"
373            id="act_hr_employee_2_hr_timesheet" name="Timesheets" res_model="hr_timesheet_sheet.sheet" src_model="hr.employee"/>
374
375     </data>
376 </openerp>