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