[FIX] remove the option from the user_id fields
[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="name" groups="analytic.group_analytic_accounting"/>
27                     <field name="invoice_rate"/>
28                     <field name="sheet_id" />
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                     <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,base.group_hr_manager"/>
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="type">form</field>
205             <field name="inherit_id" ref="base.view_company_form"/>
206             <field name="arch" type="xml">
207                 <xpath expr="//group[@name='account_grp']" position="after">
208                     <group name="timesheets_grp" string="Timesheets">
209                         <field name="timesheet_range"/>
210                         <field name="timesheet_max_difference"/>
211                     </group>
212                 </xpath>
213             </field>
214         </record>
215
216         <!--
217             hr.analytic.timesheet inheritancy
218         -->
219
220         <record id="hr_timesheet_line_form" model="ir.ui.view">
221             <field name="name">hr.analytic.timesheet.form</field>
222             <field name="model">hr.analytic.timesheet</field>
223             <field name="type">form</field>
224             <field name="inherit_id" ref="hr_timesheet.hr_timesheet_line_form"/>
225             <field name="arch" type="xml">
226                 <field name="date" position="after">
227                     <field name="sheet_id" />
228                 </field>
229             </field>
230         </record>
231
232         <record id="hr_timesheet_line_search" model="ir.ui.view">
233             <field name="name">hr.analytic.timesheet.search</field>
234             <field name="model">hr.analytic.timesheet</field>
235             <field name="type">form</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="type">search</field>
252             <field name="inherit_id" ref="hr_attendance.view_hr_attendance_filter" />
253             <field name="arch" type="xml">
254                 <field name="employee_id" position="after">
255                     <field name="sheet_id"/>
256                 </field>
257             </field>
258         </record>
259
260         <record id="view_attendance_form" model="ir.ui.view">
261             <field name="name">hr.attendance.form</field>
262             <field name="model">hr.attendance</field>
263             <field name="type">form</field>
264             <field name="inherit_id" ref="hr_attendance.view_attendance_form"/>
265             <field name="arch" type="xml">
266                 <field name="action_desc" position="after">
267                     <field name="sheet_id"/>
268                 </field>
269             </field>
270         </record>
271         <record id="view_attendance_tree" 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_tree"/>
276             <field name="arch" type="xml">
277                 <field name="action" position="after">
278                     <field name="sheet_id"/>
279                 </field>
280             </field>
281         </record>
282         <record id="view_attendance_tree_who" model="ir.ui.view">
283             <field name="name">hr.attendance.tree</field>
284             <field name="model">hr.attendance</field>
285             <field name="type">tree</field>
286             <field name="inherit_id" ref="hr_attendance.view_attendance_who"/>
287             <field name="arch" type="xml">
288                 <field name="action" position="after">
289                     <field name="sheet_id"/>
290                 </field>
291             </field>
292         </record>
293
294         <act_window
295         context="{'search_default_sheet_id': [active_id]}"
296         id="act_hr_timesheet_sheet_sheet_by_account"
297         name="Timesheet by Account"
298         res_model="hr_timesheet_sheet.sheet.account"
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_by_day"
304         name="Timesheet by Day"
305         res_model="hr_timesheet_sheet.sheet.day"
306         src_model="hr_timesheet_sheet.sheet"/>
307
308         <act_window
309         context="{'search_default_sheet_id': [active_id]}"
310         id="act_hr_timesheet_sheet_sheet_2_hr_analytic_timesheet"
311         name="Timesheet Lines"
312         res_model="hr.analytic.timesheet"
313         src_model="hr_timesheet_sheet.sheet"/>
314
315
316         <act_window
317         context="{'search_default_sheet_id': [active_id]}"
318         id="act_hr_timesheet_sheet_sheet_2_hr_attendance"
319         name="Attendances"
320         res_model="hr.attendance"
321         src_model="hr_timesheet_sheet.sheet"/>
322
323         <record id="hr_timesheet_sheet_tree_simplified" model="ir.ui.view">
324             <field name="name">hr.timesheet.sheet.tree</field>
325             <field name="model">hr_timesheet_sheet.sheet</field>
326             <field name="type">tree</field>
327             <field eval="10" name="priority"/>
328             <field name="arch" type="xml">
329                 <tree colors="blue:state == 'draft';black:state in ('confirm','new');gray:state == 'done'" string="Timesheets">
330                     <field name="employee_id"/>
331                     <field name="date_from"/>
332                     <field name="date_to"/>
333                     <field name="department_id"/>
334                     <field name="total_attendance" widget="float_time"/>
335                     <field name="total_timesheet" widget="float_time"/>
336                     <field name="total_difference" widget="float_time"/>
337                     <field name="state"/>
338                 </tree>
339             </field>
340         </record>
341
342         <record id="hr_timesheet_day_tree" model="ir.ui.view">
343             <field name="name">hr.timesheet.day.tree</field>
344             <field name="model">hr_timesheet_sheet.sheet.day</field>
345             <field name="type">tree</field>
346             <field name="arch" type="xml">
347                 <tree colors="blue:total_difference&lt;0.1;red:total_difference&gt;=0.1" string="Period">
348                     <field name="name"/>
349                     <field name="total_attendance" widget="float_time" sum="Total Attendances"/>
350                     <field name="total_timesheet" widget="float_time" sum="Total Timesheet"/>
351                     <field name="total_difference" widget="float_time" sum="Total Difference"/>
352                 </tree>
353             </field>
354         </record>
355
356   <!-- Timesheet Button on Employee Form -->
357   <act_window
358            context="{'search_default_employee_id': [active_id], 'default_employee_id': active_id}"
359            id="act_hr_employee_2_hr_timesheet" name="Timesheets" res_model="hr_timesheet_sheet.sheet" src_model="hr.employee"/>
360            
361       <record id="hr_timesheet_sheet_employee_extd_form" model="ir.ui.view">
362             <field name="name">hr.timesheet.sheet.employee.extd_form</field>
363             <field name="model">hr.employee</field>
364             <field name="inherit_id" ref="hr_timesheet.hr_timesheet_employee_extd_form"/>
365             <field name="arch" type="xml">
366                 <xpath expr="//div[@name='button_box']" position="inside">
367                     <button name="%(act_hr_employee_2_hr_timesheet)d" string="Timesheets" type="action"/>
368                 </xpath>
369             </field>
370         </record>
371
372     </data>
373 </openerp>