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