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