Added first setup
[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="arch" type="xml">
9                 <form string="Timesheet by Accounts" version="7.0">
10                     <group col="4">
11                         <field name="sheet_id"/>
12                         <field name="name" groups="analytic.group_analytic_accounting"/>
13                         <field name="total" sum="Total"/>
14                         <field name="invoice_rate"/>
15                     </group>
16                 </form>
17             </field>
18         </record>
19         <record id="hr_timesheet_account_filter" model="ir.ui.view">
20             <field name="name">hr.timesheet.account.filter</field>
21             <field name="model">hr_timesheet_sheet.sheet.account</field>
22             <field name="arch" type="xml">
23                 <search string="Search Account">
24                     <field name="name" groups="analytic.group_analytic_accounting"/>
25                     <field name="invoice_rate"/>
26                     <field name="sheet_id" />
27                 </search>
28             </field>
29         </record>
30         <record id="hr_timesheet_account_tree" model="ir.ui.view">
31             <field name="name">hr.timesheet.account.tree</field>
32             <field name="model">hr_timesheet_sheet.sheet.account</field>
33             <field name="arch" type="xml">
34                 <tree string="Timesheet by Accounts">
35                     <field name="sheet_id"/>
36                     <field name="name" groups="analytic.group_analytic_accounting"/>
37                     <field name="total" sum="Total"/>
38                     <field name="invoice_rate"/>
39                 </tree>
40             </field>
41         </record>
42
43         <record id="hr_timesheet_sheet_form" model="ir.ui.view">
44             <field name="name">hr.timesheet.sheet.form</field>
45             <field name="model">hr_timesheet_sheet.sheet</field>
46             <field name="arch" type="xml">
47                 <form string="Timesheet" version="7.0">
48                 <header>
49                     <button name="button_confirm" states="draft" string="Submit to Manager" type="object" class="oe_highlight"/>
50                     <button name="done" states="confirm" string="Approve" type="workflow" groups="base.group_hr_user" class="oe_highlight"/>
51                     <button name="action_set_to_draft" states="done" string="Set to Draft" type="object" />
52                     <button name="cancel" states="confirm" string="Refuse" type="workflow" groups="base.group_hr_user" />
53                     <field name="state" widget="statusbar" statusbar_visible="new,confirm,done"/>
54                 </header>
55                 <sheet>
56                     <label for="employee_id" class="oe_edit_only"/>
57                     <h1><field name="employee_id" on_change="onchange_employee_id(employee_id)"/></h1>
58                     <label for="date_from" class="oe_edit_only" string="Timesheet Period"/>
59                     <h2>From <field name="date_from"/> to <field name="date_to"/></h2>
60                     <group>
61                         <group>
62                             <field name="name"/>
63                             <field name="department_id"/>
64                             <field name="company_id" groups="base.group_multi_company"/>
65                         </group>
66                         <group>
67                             <field name="total_attendance" widget="float_time"/>
68                             <field name="total_timesheet" widget="float_time"/>
69                             <field name="total_difference" widget="float_time"/>
70                             <field name="user_id" invisible="1"/>
71                         </group>
72                     </group>
73                     <notebook>
74                         <page string="Weekly">
75                             <widget type="weekly_timesheet">
76                                 This is a test.
77                             </widget>
78                         </page>
79                         <page string="Daily">
80                             <group>
81                                 <div>
82                                     <button name="button_dummy" class="oe_inline" string="Go to" type="object" icon="terp-gtk-jump-to-ltr"/> :
83                                     <field name="date_current" class="oe_inline"/>
84                                 </div>
85                                 <div align="right">
86                                     <button class="oe_inline" icon="terp-gtk-go-back-ltr" name="date_previous" string="" type="object"/>
87                                     <button class="oe_inline" name="date_today" string="Today" type="object" icon="terp-go-today"/>
88                                     <button class="oe_inline" icon="terp-gtk-go-back-rtl" name="date_next" string="" type="object"/>
89                                 </div>
90                             </group>
91                             <group colspan="4" col="3">
92                                 <field context="{'name':date_current,'user_id':user_id}" name="attendances_ids" nolabel="1">
93                                     <tree string="Attendances" editable="bottom">
94                                         <field name="name"/>
95                                         <field name="action"/>
96                                         <field invisible="1" name="employee_id"/>
97                                     </tree>
98                                 </field>
99                                 <group>
100                                     <div align="right" groups="base.group_hr_manager">
101                                         <button name="attendance_action_change" attrs="{'invisible': [('state_attendance', '=', 'present')]}" type="object" string="Sign In"/>
102                                         <button name="attendance_action_change" attrs="{'invisible': ['|', ('state_attendance','=',False), ('state_attendance', '=', 'absent')]}" type="object" string="Sign Out"/>
103                                     </div>
104                                 </group>
105                             </group>
106                             <group col="4">
107                                 <field name="state_attendance"/>
108                             </group>
109                             <field colspan="4" context="{'date':date_current,'user_id':user_id}" domain="[('name','=',date_current)]" name="timesheet_ids" nolabel="1">
110                                 <tree editable="top" string="Timesheet Lines">
111                                     <field invisible="1" name="date"/>
112                                     <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}"/>
113                                     <field name="name"/>
114                                     <field name="unit_amount" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)" widget="float_time"/>
115                                     <field name="to_invoice" widget="selection"/>
116                                     <field invisible="1" name="journal_id"/>
117                                     <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)"/>
118                                     <field invisible="1" name="product_uom_id" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)"/>
119                                     <field invisible="1" name="amount"/>
120                                     <field invisible="1" name="general_account_id"/>
121                                     <field invisible="1" name="user_id" required="1"/>
122                                 </tree>
123                                 <form string="Timesheet Lines" version="7.0">
124                                     <field name="date"/>
125                                     <field domain="[('type','=','normal'), ('state', '&lt;&gt;', 'close')]" name="account_id" on_change="on_change_account_id(account_id)"/>
126                                     <field name="name"/>
127                                     <field name="unit_amount" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)" widget="float_time"/>
128                                     <field name="to_invoice"/>
129                                     <field name="journal_id"/>
130                                     <field name="product_id" domain="[('type','=','service')]" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)"/>
131                                     <field name="product_uom_id" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)"/>
132                                     <field name="amount"/>
133                                     <field name="general_account_id"/>
134                                     <field name="user_id" required="1"/>
135                                 </form>
136                             </field>
137                         </page>
138                         <page string="Summary">
139                             <field colspan="4" name="period_ids" nolabel="1">
140                                 <tree colors="red:total_difference&lt;0.1;blue:total_difference&gt;=0.1" string="Period">
141                                     <field name="name"/>
142                                     <field name="total_attendance" widget="float_time"/>
143                                     <field name="total_timesheet" widget="float_time"/>
144                                     <field name="total_difference" widget="float_time"/>
145                                 </tree>
146                             </field>
147                         </page>
148                     </notebook>
149                 </sheet>
150                 </form>
151             </field>
152         </record>
153
154         <record id="view_hr_timesheet_sheet_filter" model="ir.ui.view">
155             <field name="name">hr_timesheet_sheet.sheet.filter</field>
156             <field name="model">hr_timesheet_sheet.sheet</field>
157             <field name="arch" type="xml">
158                 <search string="Search Timesheet">
159                     <field name="date_from"/>
160                     <filter icon="terp-document-new" string="In Draft" domain="[('state','in',('draft', 'new'))]" help="Unvalidated Timesheets"/>
161                     <filter icon="terp-camera_test" string="To Approve" domain="[('state','=','confirm')]" help="Confirmed Timesheets"/>
162                     <field name="employee_id"/>
163                     <field name="department_id"/>
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" type="html">
181               <p class="oe_view_nocontent_create">
182                 Click to go to your timesheet. 
183               </p><p>
184                 You must record timesheets every day and confirm at the end
185                 of the week. Once the timesheet is confirmed, it his sent to
186                 the manager for validation.
187               </p><p>
188                 Timesheets can also be invoiced to customers, depending on the
189                 configuration of the project.
190               </p>
191             </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"/>
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="inherit_id" ref="base.view_company_form"/>
205             <field name="arch" type="xml">
206                 <xpath expr="//group[@name='account_grp']" position="after">
207                     <group name="timesheets_grp" string="Timesheets">
208                         <field name="timesheet_range"/>
209                         <field name="timesheet_max_difference"/>
210                     </group>
211                 </xpath>
212             </field>
213         </record>
214
215         <!--
216             hr.analytic.timesheet inheritancy
217         -->
218
219         <record id="hr_timesheet_line_form" model="ir.ui.view">
220             <field name="name">hr.analytic.timesheet.form</field>
221             <field name="model">hr.analytic.timesheet</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="inherit_id" ref="hr_timesheet.hr_timesheet_line_search"/>
234             <field name="arch" type="xml">
235                 <field name="date" position="before">
236                     <field name="sheet_id"/>
237                 </field>
238             </field>
239         </record>
240
241         <!--
242             hr.attendance inheritancy
243         -->
244
245         <record model="ir.ui.view" id="view_hr_attendance_filter">
246             <field name="name">view_hr_attendance_filter</field>
247             <field name="model">hr.attendance</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="inherit_id" ref="hr_attendance.view_attendance_form"/>
260             <field name="arch" type="xml">
261                 <field name="action_desc" position="after">
262                     <field name="sheet_id"/>
263                 </field>
264             </field>
265         </record>
266         <record id="view_attendance_tree" model="ir.ui.view">
267             <field name="name">hr.attendance.tree</field>
268             <field name="model">hr.attendance</field>
269             <field name="inherit_id" ref="hr_attendance.view_attendance_tree"/>
270             <field name="arch" type="xml">
271                 <field name="action" position="after">
272                     <field name="sheet_id"/>
273                 </field>
274             </field>
275         </record>
276         <record id="view_attendance_tree_who" model="ir.ui.view">
277             <field name="name">hr.attendance.tree</field>
278             <field name="model">hr.attendance</field>
279             <field name="inherit_id" ref="hr_attendance.view_attendance_who"/>
280             <field name="arch" type="xml">
281                 <field name="action" position="after">
282                     <field name="sheet_id"/>
283                 </field>
284             </field>
285         </record>
286
287         <act_window
288         context="{'search_default_sheet_id': [active_id]}"
289         id="act_hr_timesheet_sheet_sheet_by_account"
290         name="Timesheet by Account"
291         res_model="hr_timesheet_sheet.sheet.account"
292         src_model="hr_timesheet_sheet.sheet"/>
293
294         <act_window
295         context="{'search_default_sheet_id': [active_id]}"
296         id="act_hr_timesheet_sheet_sheet_by_day"
297         name="Timesheet by Day"
298         res_model="hr_timesheet_sheet.sheet.day"
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_2_hr_analytic_timesheet"
304         name="Timesheet Lines"
305         res_model="hr.analytic.timesheet"
306         src_model="hr_timesheet_sheet.sheet"/>
307
308
309         <act_window
310         context="{'search_default_sheet_id': [active_id]}"
311         id="act_hr_timesheet_sheet_sheet_2_hr_attendance"
312         name="Attendances"
313         res_model="hr.attendance"
314         src_model="hr_timesheet_sheet.sheet"/>
315
316         <record id="hr_timesheet_sheet_tree_simplified" model="ir.ui.view">
317             <field name="name">hr.timesheet.sheet.tree</field>
318             <field name="model">hr_timesheet_sheet.sheet</field>
319             <field eval="10" name="priority"/>
320             <field name="arch" type="xml">
321                 <tree colors="blue:state == 'draft';black:state in ('confirm','new');gray:state == 'done'" string="Timesheets">
322                     <field name="employee_id"/>
323                     <field name="date_from"/>
324                     <field name="date_to"/>
325                     <field name="department_id"/>
326                     <field name="total_attendance" widget="float_time"/>
327                     <field name="total_timesheet" widget="float_time"/>
328                     <field name="total_difference" widget="float_time"/>
329                     <field name="state"/>
330                 </tree>
331             </field>
332         </record>
333
334         <record id="hr_timesheet_day_tree" model="ir.ui.view">
335             <field name="name">hr.timesheet.day.tree</field>
336             <field name="model">hr_timesheet_sheet.sheet.day</field>
337             <field name="arch" type="xml">
338                 <tree colors="blue:total_difference&lt;0.1;red:total_difference&gt;=0.1" string="Period">
339                     <field name="name"/>
340                     <field name="total_attendance" widget="float_time" sum="Total Attendances"/>
341                     <field name="total_timesheet" widget="float_time" sum="Total Timesheet"/>
342                     <field name="total_difference" widget="float_time" sum="Total Difference"/>
343                 </tree>
344             </field>
345         </record>
346
347   <!-- Timesheet Button on Employee Form -->
348   <act_window
349            context="{'search_default_employee_id': [active_id], 'default_employee_id': active_id}"
350            id="act_hr_employee_2_hr_timesheet" name="Timesheets" res_model="hr_timesheet_sheet.sheet" src_model="hr.employee"/>
351            
352       <record id="hr_timesheet_sheet_employee_extd_form" model="ir.ui.view">
353             <field name="name">hr.timesheet.sheet.employee.extd_form</field>
354             <field name="model">hr.employee</field>
355             <field name="inherit_id" ref="hr_timesheet.hr_timesheet_employee_extd_form"/>
356             <field name="arch" type="xml">
357                 <xpath expr="//div[@name='button_box']" position="inside">
358                     <button name="%(act_hr_employee_2_hr_timesheet)d" string="Timesheets" type="action" groups="base.group_hr_manager"/>
359                 </xpath>
360             </field>
361         </record>
362
363     </data>
364 </openerp>