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