wip
[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" groups="base.group_hr_attendance"/>
68                             <field name="total_timesheet" widget="float_time"/>
69                             <field name="total_difference" widget="float_time" groups="base.group_hr_attendance"/>
70                             <field name="user_id" invisible="1"/>
71                         </group>
72                     </group>
73                     <notebook>
74                         <page string="Weekly">
75                             <widget type="weekly_timesheet">
76                             </widget>
77                         </page>
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" groups="base.group_hr_attendance">
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" groups="base.group_hr_manager,base.group_hr_attendance">
100                                         <button name="attendance_action_change" attrs="{'invisible': [('state_attendance', '=', 'present')]}" type="object" string="Sign In" groups="base.group_hr_attendance"/>
101                                         <button name="attendance_action_change" attrs="{'invisible': ['|', ('state_attendance','=',False), ('state_attendance', '=', 'absent')]}" type="object" string="Sign Out" groups="base.group_hr_attendance"/>
102                                     </div>
103                                 </group>
104                             </group>
105                             <group col="4">
106                                 <field name="state_attendance" groups="base.group_hr_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" groups="base.group_hr_attendance"/>
142                                     <field name="total_timesheet" widget="float_time"/>
143                                     <field name="total_difference" widget="float_time" groups="base.group_hr_attendance"/>
144                                 </tree>
145                             </field>
146                         </page>
147                     </notebook>
148                 </sheet>
149                 <div class="oe_chatter">
150                     <field name="message_ids" colspan="4" widget="mail_thread" nolabel="1"/>
151                     <field name="message_follower_ids" widget="mail_followers"/>
152                 </div>
153                 </form>
154             </field>
155         </record>
156
157         <record id="view_hr_timesheet_sheet_filter" model="ir.ui.view">
158             <field name="name">hr_timesheet_sheet.sheet.filter</field>
159             <field name="model">hr_timesheet_sheet.sheet</field>
160             <field name="arch" type="xml">
161                 <search string="Search Timesheet">
162                     <field name="date_from"/>
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                     <field name="employee_id"/>
166                     <field name="department_id"/>
167                     <group expand="0" string="Group By...">
168                         <filter string="Employees" icon="terp-personal" domain="[]" context="{'group_by':'employee_id'}"/>
169                         <filter string="Department" icon="terp-personal+" domain="[]" context="{'group_by':'department_id'}"/>
170                     </group>
171                 </search>
172             </field>
173         </record>
174
175         <record id="act_hr_timesheet_sheet_form" model="ir.actions.act_window">
176             <field name="name">Timesheets</field>
177             <field name="type">ir.actions.act_window</field>
178             <field name="res_model">hr_timesheet_sheet.sheet</field>
179             <field name="view_type">form</field>
180             <field name="view_id" eval="False"/>
181             <field name="context">{'search_default_my_timesheet':1}</field>
182             <field name="search_view_id" ref="view_hr_timesheet_sheet_filter"/>
183             <field name="help" type="html">
184               <p class="oe_view_nocontent_create">
185                 Click to go to your timesheet. 
186               </p><p>
187                 You must record timesheets every day and confirm at the end
188                 of the week. Once the timesheet is confirmed, it his sent to
189                 the manager for validation.
190               </p><p>
191                 Timesheets can also be invoiced to customers, depending on the
192                 configuration of the project.
193               </p>
194             </field>
195         </record>
196
197         <menuitem action="act_hr_timesheet_sheet_form" id="menu_act_hr_timesheet_sheet_form" parent="hr_attendance.menu_hr_time_tracking"
198              sequence="2" groups="base.group_hr_user"/>
199
200         <!--
201             Company inheritancy
202         -->
203
204         <record id="hr_timesheet_sheet_company" model="ir.ui.view">
205             <field name="name">res.company.sheet</field>
206             <field name="model">res.company</field>
207             <field name="inherit_id" ref="base.view_company_form"/>
208             <field name="arch" type="xml">
209                 <xpath expr="//group[@name='account_grp']" position="after">
210                     <group name="timesheets_grp" string="Timesheets">
211                         <field name="timesheet_range"/>
212                         <field name="timesheet_max_difference"/>
213                     </group>
214                 </xpath>
215             </field>
216         </record>
217
218         <!--
219             hr.analytic.timesheet inheritancy
220         -->
221
222         <record id="hr_timesheet_line_form" model="ir.ui.view">
223             <field name="name">hr.analytic.timesheet.form</field>
224             <field name="model">hr.analytic.timesheet</field>
225             <field name="inherit_id" ref="hr_timesheet.hr_timesheet_line_form"/>
226             <field name="arch" type="xml">
227                 <field name="date" position="after">
228                     <field name="sheet_id" />
229                 </field>
230             </field>
231         </record>
232
233         <record id="hr_timesheet_line_search" model="ir.ui.view">
234             <field name="name">hr.analytic.timesheet.search</field>
235             <field name="model">hr.analytic.timesheet</field>
236             <field name="inherit_id" ref="hr_timesheet.hr_timesheet_line_search"/>
237             <field name="arch" type="xml">
238                 <field name="date" position="before">
239                     <field name="sheet_id"/>
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="inherit_id" ref="hr_attendance.view_hr_attendance_filter" />
252             <field name="arch" type="xml">
253                 <field name="employee_id" position="after">
254                     <field name="sheet_id"/>
255                 </field>
256             </field>
257         </record>
258
259         <record id="view_attendance_form" model="ir.ui.view">
260             <field name="name">hr.attendance.form</field>
261             <field name="model">hr.attendance</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="inherit_id" ref="hr_attendance.view_attendance_tree"/>
273             <field name="arch" type="xml">
274                 <field name="action" position="after">
275                     <field name="sheet_id"/>
276                 </field>
277             </field>
278         </record>
279         <record id="view_attendance_tree_who" model="ir.ui.view">
280             <field name="name">hr.attendance.tree</field>
281             <field name="model">hr.attendance</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 eval="10" name="priority"/>
323             <field name="arch" type="xml">
324                 <tree colors="blue:state == 'draft';black:state in ('confirm','new');gray:state == 'done'" string="Timesheets">
325                     <field name="employee_id"/>
326                     <field name="date_from"/>
327                     <field name="date_to"/>
328                     <field name="department_id"/>
329                     <field name="total_attendance" widget="float_time" groups="base.group_hr_attendance"/>
330                     <field name="total_timesheet" widget="float_time"/>
331                     <field name="total_difference" widget="float_time" groups="base.group_hr_attendance"/>
332                     <field name="state"/>
333                 </tree>
334             </field>
335         </record>
336
337         <record id="hr_timesheet_day_tree" model="ir.ui.view">
338             <field name="name">hr.timesheet.day.tree</field>
339             <field name="model">hr_timesheet_sheet.sheet.day</field>
340             <field name="arch" type="xml">
341                 <tree colors="blue:total_difference&lt;0.1;red:total_difference&gt;=0.1" string="Period">
342                     <field name="name"/>
343                     <field name="total_attendance" widget="float_time" sum="Total Attendances" groups="base.group_hr_attendance"/>
344                     <field name="total_timesheet" widget="float_time" sum="Total Timesheet"/>
345                     <field name="total_difference" widget="float_time" sum="Total Difference" groups="base.group_hr_attendance"/>
346                 </tree>
347             </field>
348         </record>
349
350   <!-- Timesheet Button on Employee Form -->
351            
352     <record id="act_hr_employee_2_hr_timesheet" model="ir.actions.act_window">
353         <field name="res_model">hr_timesheet_sheet.sheet</field>
354         <field name="view_type">form</field>
355         <field name="name">Timesheets</field>
356         <field name="view_mode">tree,form</field>
357         <field name="context">{'search_default_employee_id': [active_id], 'default_employee_id': active_id}</field>
358     </record>
359          
360       <record id="hr_timesheet_sheet_employee_extd_form" model="ir.ui.view">
361             <field name="name">hr.timesheet.sheet.employee.extd_form</field>
362             <field name="model">hr.employee</field>
363             <field name="inherit_id" ref="hr_timesheet.hr_timesheet_employee_extd_form"/>
364             <field name="arch" type="xml">
365                 <xpath expr="//div[@name='button_box']" position="inside">
366                     <button name="%(act_hr_employee_2_hr_timesheet)d" string="Timesheets" type="action" groups="base.group_hr_manager"/>
367                 </xpath>
368             </field>
369         </record>
370
371     </data>
372 </openerp>