[IMP]Improve company view in settings and organise in group
[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>
66                         From <field name="date_from"/>
67                         to <field name="date_to"/>
68                     </h2>
69                     <group col="4">
70                         <field name="name"/>
71                         <field name="department_id"/>
72                         <field name="company_id" groups="base.group_multi_company"/>
73                         <field name="user_id" invisible="1"/>
74                     </group>
75                     <notebook>
76                         <page string="Daily">
77                             <group col="6" colspan="4">
78                                 <button name="button_dummy" string="Go to:" type="object" icon="terp-gtk-jump-to-ltr"/>
79                                 <field name="date_current" nolabel="1"/>
80                                 <label string=""/>
81                                 <button icon="terp-gtk-go-back-ltr" name="date_previous" string="" type="object"/>
82                                 <button name="date_today" string="Today" type="object" icon="terp-go-today"/>
83                                 <button icon="terp-gtk-go-back-rtl" name="date_next" string="" type="object"/>
84                             </group>
85
86                             <field colspan="3" context="{'name':date_current,'user_id':user_id}" height="100" name="attendances_ids" nolabel="1">
87                                 <tree string="Attendances" editable="bottom">
88                                     <field name="name"/>
89                                     <field name="action"/>
90                                     <field invisible="1" name="employee_id"/>
91                                 </tree>
92                             </field>
93                             <group col="4" colspan="1">
94                                 <field name="state_attendance"/>
95                                 <button name="sign_in" string="Sign In" type="object" icon="terp-gtk-jump-to-ltr"/>
96                                 <button name="sign_out" string="Sign Out" type="object" icon="terp-gtk-jump-to-rtl"/>
97                                 <field name="total_attendance_day" widget="float_time" colspan="4"/>
98                             </group>
99                             <field colspan="4" context="{'date':date_current,'user_id':user_id}" domain="[('name','=',date_current)]" name="timesheet_ids" nolabel="1">
100                                 <tree editable="top" string="Timesheet Lines">
101                                     <field invisible="1" name="date"/>
102                                     <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}"/>
103                                     <field name="name"/>
104                                     <field name="unit_amount" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)" widget="float_time"/>
105                                     <field name="to_invoice" widget="selection"/>
106                                     <field invisible="1" name="journal_id"/>
107                                     <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)"/>
108                                     <field invisible="1" name="product_uom_id" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)"/>
109                                     <field invisible="1" name="amount"/>
110                                     <field invisible="1" name="general_account_id"/>
111                                     <field invisible="1" name="user_id" required="1"/>
112                                 </tree>
113                                 <form string="Timesheet Lines" version="7.0">
114                                     <field name="date"/>
115                                     <field domain="[('type','=','normal'), ('state', '&lt;&gt;', 'close')]" name="account_id" on_change="on_change_account_id(account_id)"/>
116                                     <field name="name"/>
117                                     <field name="unit_amount" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)" widget="float_time"/>
118                                     <field name="to_invoice"/>
119                                     <field name="journal_id"/>
120                                     <field name="product_id" domain="[('type','=','service')]" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)"/>
121                                     <field name="product_uom_id" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)"/>
122                                     <field name="amount"/>
123                                     <field name="general_account_id"/>
124                                     <field name="user_id" required="1"/>
125                                 </form>
126                             </field>
127                             <field name="total_difference_day" widget="float_time"/>
128                             <field name="total_timesheet_day" widget="float_time"/>
129                         </page>
130                         <page string="Summary">
131                             <field colspan="4" name="period_ids" nolabel="1">
132                                 <tree colors="red:total_difference&lt;0.1;blue:total_difference&gt;=0.1" string="Period">
133                                     <field name="name"/>
134                                     <field name="total_attendance" widget="float_time"/>
135                                     <field name="total_timesheet" widget="float_time"/>
136                                     <field name="total_difference" widget="float_time"/>
137                                 </tree>
138                             </field>
139                             <group colspan="4" col="6">
140                                 <field name="total_attendance" widget="float_time"/>
141                                 <field name="total_timesheet" widget="float_time"/>
142                                 <field name="total_difference" widget="float_time"/>
143                             </group>
144                         </page>
145                     </notebook>
146                 </sheet>
147                 </form>
148             </field>
149         </record>
150
151         <record id="view_hr_timesheet_sheet_filter" model="ir.ui.view">
152             <field name="name">hr_timesheet_sheet.sheet.filter</field>
153             <field name="model">hr_timesheet_sheet.sheet</field>
154             <field name="type">search</field>
155             <field name="arch" type="xml">
156                 <search string="Search Timesheet">
157                     <group>
158                         <field name="date_from"/>
159                         <separator orientation="vertical"/>
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                         <separator orientation="vertical"/>
163                         <field name="employee_id"/>
164                         <field name="department_id" widget="selection"/>
165                     </group>
166                     <newline/>
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">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>
184         </record>
185
186         <menuitem action="act_hr_timesheet_sheet_form" id="menu_act_hr_timesheet_sheet_form" parent="hr_attendance.menu_hr_time_tracking"
187              sequence="2" groups="base.group_hr_user,base.group_hr_manager"/>
188
189         <!--
190             Company inheritancy
191         -->
192
193         <record id="hr_timesheet_sheet_company" model="ir.ui.view">
194             <field name="name">res.company.sheet</field>
195             <field name="model">res.company</field>
196             <field name="type">form</field>
197             <field name="inherit_id" ref="base.view_company_form"/>
198             <field name="arch" type="xml">
199                 <xpath expr="//group[@name='currency']" position="after">
200                     <group string="Timesheets">
201                         <field name="timesheet_range"/>
202                         <field name="timesheet_max_difference"/>
203                     </group>
204                 </xpath>
205             </field>
206         </record>
207
208         <!--
209             hr.analytic.timesheet inheritancy
210         -->
211
212         <record id="hr_timesheet_line_form" model="ir.ui.view">
213             <field name="name">hr.analytic.timesheet.form</field>
214             <field name="model">hr.analytic.timesheet</field>
215             <field name="type">form</field>
216             <field name="inherit_id" ref="hr_timesheet.hr_timesheet_line_form"/>
217             <field name="arch" type="xml">
218                 <field name="date" position="after">
219                     <field name="sheet_id" />
220                 </field>
221             </field>
222         </record>
223
224         <record id="hr_timesheet_line_search" model="ir.ui.view">
225             <field name="name">hr.analytic.timesheet.search</field>
226             <field name="model">hr.analytic.timesheet</field>
227             <field name="type">form</field>
228             <field name="inherit_id" ref="hr_timesheet.hr_timesheet_line_search"/>
229             <field name="arch" type="xml">
230                 <field name="user_id" position="before">
231                     <field name="sheet_id"/>
232                 </field>
233             </field>
234         </record>
235
236         <!--
237             hr.attendance inheritancy
238         -->
239
240         <record model="ir.ui.view" id="view_hr_attendance_filter">
241             <field name="name">view_hr_attendance_filter</field>
242             <field name="model">hr.attendance</field>
243             <field name="type">search</field>
244             <field name="inherit_id" ref="hr_attendance.view_hr_attendance_filter" />
245             <field name="arch" type="xml">
246                 <field name="employee_id" position="after">
247                     <field name="sheet_id"/>
248                 </field>
249             </field>
250         </record>
251
252         <record id="view_attendance_form" model="ir.ui.view">
253             <field name="name">hr.attendance.form</field>
254             <field name="model">hr.attendance</field>
255             <field name="type">form</field>
256             <field name="inherit_id" ref="hr_attendance.view_attendance_form"/>
257             <field name="arch" type="xml">
258                 <field name="action_desc" position="after">
259                     <field name="sheet_id"/>
260                 </field>
261             </field>
262         </record>
263         <record id="view_attendance_tree" model="ir.ui.view">
264             <field name="name">hr.attendance.tree</field>
265             <field name="model">hr.attendance</field>
266             <field name="type">tree</field>
267             <field name="inherit_id" ref="hr_attendance.view_attendance_tree"/>
268             <field name="arch" type="xml">
269                 <field name="action" position="after">
270                     <field name="sheet_id"/>
271                 </field>
272             </field>
273         </record>
274         <record id="view_attendance_tree_who" model="ir.ui.view">
275             <field name="name">hr.attendance.tree</field>
276             <field name="model">hr.attendance</field>
277             <field name="type">tree</field>
278             <field name="inherit_id" ref="hr_attendance.view_attendance_who"/>
279             <field name="arch" type="xml">
280                 <field name="action" position="after">
281                     <field name="sheet_id"/>
282                 </field>
283             </field>
284         </record>
285
286         <act_window
287         context="{'search_default_sheet_id': [active_id]}"
288         id="act_hr_timesheet_sheet_sheet_by_account"
289         name="Timesheet by Account"
290         res_model="hr_timesheet_sheet.sheet.account"
291         src_model="hr_timesheet_sheet.sheet"/>
292
293         <act_window
294         context="{'search_default_sheet_id': [active_id]}"
295         id="act_hr_timesheet_sheet_sheet_by_day"
296         name="Timesheet by Day"
297         res_model="hr_timesheet_sheet.sheet.day"
298         src_model="hr_timesheet_sheet.sheet"/>
299
300         <act_window
301         context="{'search_default_sheet_id': [active_id]}"
302         id="act_hr_timesheet_sheet_sheet_2_hr_analytic_timesheet"
303         name="Timesheet Lines"
304         res_model="hr.analytic.timesheet"
305         src_model="hr_timesheet_sheet.sheet"/>
306
307
308         <act_window
309         context="{'search_default_sheet_id': [active_id]}"
310         id="act_hr_timesheet_sheet_sheet_2_hr_attendance"
311         name="Attendances"
312         res_model="hr.attendance"
313         src_model="hr_timesheet_sheet.sheet"/>
314
315         <record id="hr_timesheet_sheet_tree_simplified" model="ir.ui.view">
316             <field name="name">hr.timesheet.sheet.tree</field>
317             <field name="model">hr_timesheet_sheet.sheet</field>
318             <field name="type">tree</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="type">tree</field>
338             <field name="arch" type="xml">
339                 <tree colors="blue:total_difference&lt;0.1;red:total_difference&gt;=0.1" string="Period">
340                     <field name="name"/>
341                     <field name="total_attendance" widget="float_time" sum="Total Attendances"/>
342                     <field name="total_timesheet" widget="float_time" sum="Total Timesheet"/>
343                     <field name="total_difference" widget="float_time" sum="Total Difference"/>
344                 </tree>
345             </field>
346         </record>
347
348   <!-- Timesheet Button on Employee Form -->
349   <act_window
350            context="{'search_default_employee_id': [active_id], 'default_employee_id': active_id}"
351            id="act_hr_employee_2_hr_timesheet" name="Timesheets" res_model="hr_timesheet_sheet.sheet" src_model="hr.employee"/>
352
353     </data>
354 </openerp>