[IMP] billing project hours useable
[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         <record id="hr_timesheet_sheet_tree" model="ir.ui.view">
5             <field name="name">hr.timesheet.sheet.tree</field>
6             <field name="model">hr_timesheet_sheet.sheet</field>
7             <field name="type">tree</field>
8             <field name="arch" type="xml">
9                 <tree string="Timesheets"
10                     colors="blue:state == 'draft';gray:state == 'done'">
11                     <field name="user_id"/>
12                     <field name="date_from"/>
13                     <field name="date_to"/>
14                     <field name="name"/>
15                     <field name="department_id"/>
16                     <field name="total_attendance" groups="base.group_hr_attendance"/>
17                     <field name="total_timesheet"/>
18                     <field name="total_difference" groups="base.group_hr_attendance"/>
19                     <field name="state"/>
20                 </tree>
21             </field>
22         </record>
23        <record id="hr_timesheet_sheet_graph" model="ir.ui.view">
24          <field name="name">hr.timesheet.sheet.graph</field>
25          <field name="model">hr_timesheet_sheet.sheet</field>
26          <field name="type">graph</field>
27          <field name="arch" type="xml">
28              <graph string="Timesheets" type="bar">
29                  <field name="name"/>
30                  <field name="total_attendance" operator="+"/>
31                  <field name="total_timesheet" operator="+"/>
32              </graph>
33          </field>
34         </record>
35         <record id="hr_timesheet_account_form" model="ir.ui.view">
36             <field name="name">hr.timesheet.account.form</field>
37             <field name="model">hr_timesheet_sheet.sheet.account</field>
38             <field name="type">form</field>
39             <field name="arch" type="xml">
40                 <form string="Timesheet by Accounts">
41                     <field name="sheet_id" select="1"/>
42                     <field name="name" select="1" groups="base.group_extended"/>
43                     <field name="total" sum="Total"/>
44                     <field name="invoice_rate"/>
45                 </form>
46             </field>
47         </record>
48
49         <record id="hr_timesheet_account_tree" model="ir.ui.view">
50             <field name="name">hr.timesheet.account.tree</field>
51             <field name="model">hr_timesheet_sheet.sheet.account</field>
52             <field name="type">tree</field>
53             <field name="arch" type="xml">
54                 <tree string="Timesheet by Accounts">
55                     <field name="sheet_id"/>
56                     <field name="name" groups="base.group_extended"/>
57                     <field name="total" sum="Total"/>
58                     <field name="invoice_rate"/>
59                 </tree>
60             </field>
61         </record>
62
63         <record id="hr_timesheet_sheet_form" model="ir.ui.view">
64             <field name="name">hr.timesheet.sheet.form</field>
65             <field name="model">hr_timesheet_sheet.sheet</field>
66             <field name="type">form</field>
67             <field name="arch" type="xml">
68                 <form string="Timesheet">
69                     <group colspan="4" col="6">
70                         <field name="name"/>
71                         <field name="company_id" select="1" groups="base.group_multi_company"/>
72                         <field name="department_id" groups="base.group_extended"/>
73                         <newline/>
74                         <field name="user_id"/>
75                         <field name="date_from"/>
76                         <field name="date_to"/>
77                     </group>
78                     <notebook colspan="4">
79                         <page string="Daily View">
80                             <group col="6" colspan="4">
81                                 <button name="button_dummy" string="Go to:" type="object" icon="terp-gtk-jump-to-ltr"/>
82                                 <field name="date_current" nolabel="1"/>
83                                 <label string=""/>
84                                 <button icon="terp-gtk-go-back-ltr" name="date_previous" string="" type="object"/>
85                                 <button name="date_today" string="Today" type="object" icon="terp-go-today"/>
86                                 <button icon="terp-gtk-go-back-rtl" name="date_next" string="" type="object"/>
87                             </group>
88
89                             <field colspan="3" context="name=date_current,user_id=user_id" height="100" name="attendances_ids" nolabel="1" groups="base.group_hr_attendance">
90                                 <tree string="Attendances" editable="bottom">
91                                     <field name="name"/>
92                                     <field name="action"/>
93                                     <field invisible="1" name="employee_id"/>
94                                 </tree>
95                             </field>
96                             <group col="1" colspan="1" groups="base.group_hr_attendance">
97                                 <button name="sign_in" string="Sign In" type="object" icon="terp-gtk-jump-to-ltr"/>
98                                 <button name="sign_out" string="Sign Out" type="object" icon="terp-gtk-jump-to-rtl"/>
99                             </group>
100                             <field name="state_attendance" groups="base.group_hr_attendance"/>
101                             <field name="total_attendance_day" widget="float_time" groups="base.group_hr_attendance"/>
102                             <field colspan="4" context="date=date_current,user_id=user_id" domain="[('name','=',date_current)]" name="timesheet_ids" nolabel="1">
103                                 <tree editable="top" string="Timesheet">
104                                     <field invisible="1" name="date"/>
105                                     <field domain="[('type','=','normal'), ('state', '&lt;&gt;', 'close')]" name="account_id" on_change="on_change_account_id(account_id)"/>
106                                     <field name="name"/>
107                                     <field name="unit_amount" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)" widget="float_time"/>
108                                     <field name="to_invoice"/>
109                                     <field invisible="1" name="journal_id"/>
110                                     <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)"/>
111                                     <field invisible="1" name="product_uom_id" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)"/>
112                                     <field invisible="1" name="amount"/>
113                                     <field invisible="1" name="general_account_id"/>
114                                     <field invisible="1" name="user_id" required="1"/>
115                                 </tree>
116                                 <form string="Timesheet">
117                                     <field name="date"/>
118                                     <field domain="[('type','=','normal'), ('state', '&lt;&gt;', 'close')]" name="account_id" on_change="on_change_account_id(account_id)"/>
119                                     <field name="name"/>
120                                     <field name="unit_amount" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)" widget="float_time"/>
121                                     <field name="to_invoice"/>
122                                     <field name="journal_id"/>
123                                     <field name="product_id" domain="[('type','=','service')]" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)"/>
124                                     <field name="product_uom_id" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)"/>
125                                     <field name="amount"/>
126                                     <field name="general_account_id"/>
127                                     <field name="user_id" required="1"/>
128                                 </form>
129                             </field>
130                             <field name="total_difference_day" widget="float_time"/>
131                             <field name="total_timesheet_day" widget="float_time"/>
132                         </page>
133                         <page string="By Day">
134                             <field colspan="4" name="period_ids" nolabel="1">
135                                 <tree colors="red:total_difference&lt;0.1;blue:total_difference&gt;=0.1" string="Period">
136                                     <field name="name"/>
137                                     <field name="total_attendance" widget="float_time" groups="base.group_hr_attendance"/>
138                                     <field name="total_timesheet" widget="float_time"/>
139                                     <field name="total_difference" widget="float_time" groups="base.group_hr_attendance"/>
140                                 </tree>
141                             </field>
142                             <group colspan="4" col="6">
143                                 <field name="total_attendance" widget="float_time"/>
144                                 <field name="total_timesheet" widget="float_time"/>
145                                 <field name="total_difference" widget="float_time"/>
146                             </group>
147                         </page>
148                     </notebook>
149                     <field name="state"/>
150                     <group col="4" colspan="2">
151                         <button name="button_confirm" states="draft" string="Confirm" type="object" icon="terp-check"/>
152                         <button name="action_set_to_draft" states="done" string="Set to Draft" type="object" icon="terp-stock_effects-object-colorize"/>
153                         <button name="cancel" states="confirm" string="Refuse" type="workflow" icon="gtk-cancel"/>
154                         <button name="done" states="confirm" string="Approve" type="workflow" icon="terp-camera_test"/>
155                     </group>
156                 </form>
157             </field>
158         </record>
159
160         <record id="view_hr_timesheet_sheet_filter" model="ir.ui.view">
161             <field name="name">hr_timesheet_sheet.sheet.filter</field>
162             <field name="model">hr_timesheet_sheet.sheet</field>
163             <field name="type">search</field>
164             <field name="arch" type="xml">
165                 <search string="Search Timesheet">
166                     <group col="10" colspan="4">
167                         <filter icon="terp-document-new" string="In Draft" domain="[('state','in',('draft', 'new'))]" help="Unvalidated Timesheets"/>
168                         <filter icon="terp-camera_test" string="To Approve" domain="[('state','=','confirm')]" help="Confirmed Timesheets"/>
169                         <separator orientation="vertical"/>
170                         <field name="user_id" select="1"/>
171                         <field name="date_from"/>
172                         <field name="department_id" widget="selection">
173                             <filter icon="terp-personal+"
174                                 domain="[('department_id','=',context.get('department_id',False))]"
175                                 help="My Departments Timesheet"/>
176                         </field>
177                     </group>
178                     <newline/>
179                     <group expand="0" string="Group By...">
180                         <filter string="Users" icon="terp-personal" domain="[]" context="{'group_by':'user_id'}"/>
181                         <filter string="Department" icon="terp-personal+" domain="[]" context="{'group_by':'department_id'}"/>
182                     </group>
183                 </search>
184             </field>
185         </record>
186
187         <record id="act_hr_timesheet_sheet_form" model="ir.actions.act_window">
188             <field name="name">Timesheets</field>
189             <field name="type">ir.actions.act_window</field>
190             <field name="res_model">hr_timesheet_sheet.sheet</field>
191             <field name="view_type">form</field>
192             <field name="view_id" eval="False"/>
193             <field name="context">{'search_default_my_timesheet':1, 'search_default_user_id':uid }</field>
194             <field name="search_view_id" ref="view_hr_timesheet_sheet_filter"/>
195             <field name="help">Employees can encode their time spent on the different projects. A project is an analytic account and the time spent on a project generate costs on the analytic account.</field>
196         </record>
197
198         <!--Time Tracking menu in project Management-->
199         <menuitem icon="terp-project" id="base.menu_main_pm" name="Project" sequence="10"/>
200         <menuitem
201              id="base.menu_project_management_time_tracking"
202              name="Time Tracking"
203              parent="base.menu_main_pm" sequence="5"/>
204
205         <menuitem action="act_hr_timesheet_sheet_form" id="menu_act_hr_timesheet_sheet_form" parent="hr_attendance.menu_hr_time_tracking"
206              sequence="2"/>
207
208         <!--
209             Company inheritancy
210         -->
211
212         <record id="hr_timesheet_sheet_company" model="ir.ui.view">
213             <field name="name">res.company.sheet</field>
214             <field name="model">res.company</field>
215             <field name="type">form</field>
216             <field name="inherit_id" ref="base.view_company_form"/>
217             <field name="arch" type="xml">
218                 <page string="Configuration" position="inside">
219                     <separator string="Timesheets" colspan="4"/>
220                     <field name="timesheet_range"/>
221                     <field name="timesheet_max_difference"/>
222                     <newline/>
223                 </page>
224             </field>
225         </record>
226
227         <!--
228             hr.analytic.timesheet inheritancy
229         -->
230
231         <record id="hr_timesheet_line_form" model="ir.ui.view">
232             <field name="name">hr.analytic.timesheet.form</field>
233             <field name="model">hr.analytic.timesheet</field>
234             <field name="type">form</field>
235             <field name="inherit_id" ref="hr_timesheet.hr_timesheet_line_form"/>
236             <field name="arch" type="xml">
237                 <field name="date" position="after">
238                     <field name="sheet_id" />
239                 </field>
240             </field>
241         </record>
242         <!--
243             hr.attendance inheritancy
244         -->
245
246         <record model="ir.ui.view" id="view_hr_attendance_filter">
247             <field name="name">view_hr_attendance_filter</field>
248             <field name="model">hr.attendance</field>
249             <field name="type">search</field>
250             <field name="inherit_id" ref="hr_attendance.view_hr_attendance_filter" />
251             <field name="arch" type="xml">
252                 <field name="action" position="after">
253                     <field name="sheet_id" select="1" />
254                 </field>
255             </field>
256         </record>
257
258         <record id="view_attendance_form" model="ir.ui.view">
259             <field name="name">hr.attendance.form</field>
260             <field name="model">hr.attendance</field>
261             <field name="type">form</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="type">tree</field>
273             <field name="inherit_id" ref="hr_attendance.view_attendance_tree"/>
274             <field name="arch" type="xml">
275                 <field name="action" position="after">
276                     <field name="sheet_id"/>
277                 </field>
278             </field>
279         </record>
280         <record id="view_attendance_tree_who" model="ir.ui.view">
281             <field name="name">hr.attendance.tree</field>
282             <field name="model">hr.attendance</field>
283             <field name="type">tree</field>
284             <field name="inherit_id" ref="hr_attendance.view_attendance_who"/>
285             <field name="arch" type="xml">
286                 <field name="action" position="after">
287                     <field name="sheet_id"/>
288                 </field>
289             </field>
290         </record>
291
292         <act_window 
293         context="{'search_default_sheet_id': [active_id]}"
294         id="act_hr_timesheet_sheet_sheet_by_day" 
295         name="Timesheet by Account" 
296         res_model="hr_timesheet_sheet.sheet.account" 
297         src_model="hr_timesheet_sheet.sheet"/>
298
299         <act_window 
300         context="{'search_default_sheet_id': [active_id]}"
301         id="act_hr_timesheet_sheet_sheet_2_hr_analytic_timesheet" 
302         name="Timesheet Lines" 
303         res_model="hr.analytic.timesheet" 
304         src_model="hr_timesheet_sheet.sheet"/>
305         
306
307         <act_window 
308         context="{'search_default_sheet_id': [active_id]}"
309         id="act_hr_timesheet_sheet_sheet_2_hr_attendance" 
310         name="Attendances" 
311         res_model="hr.attendance" 
312         src_model="hr_timesheet_sheet.sheet"/>
313
314         <record id="hr_timesheet_sheet_tree_simplified" model="ir.ui.view">
315             <field name="name">hr.timesheet.sheet.tree.simplified</field>
316             <field name="model">hr_timesheet_sheet.sheet</field>
317             <field name="type">tree</field>
318             <field eval="20" name="priority"/>
319             <field name="arch" type="xml">
320                 <tree colors="blue:state in ('draft');black:state in ('confirm','new');gray:state in('done')" string="Timesheets">
321                     <field name="date_from"/>
322                     <field name="user_id"/>
323                     <field name="department_id" invisible="1"/>
324                     <field name="name"/>
325                     <field name="total_attendance"/>
326                     <field name="total_timesheet"/>
327                     <field name="state"/>
328                 </tree>
329             </field>
330         </record>
331         <record id="view_hr_timesheet_sheet_graph" model="ir.ui.view">
332             <field name="name">hr.timesheet.sheet.sheet.graph</field>
333             <field name="model">hr_timesheet_sheet.sheet</field>
334             <field name="type">graph</field>
335             <field name="arch" type="xml">
336                 <graph orientation="horizontal" string="Available Attendance" type="bar">
337                     <field name="name"/>
338                     <field name="total_attendance" operator="+"/>
339                 </graph>
340             </field>
341         </record>
342   <!-- Timesheet Button on Employee Form -->
343   <act_window domain="[('user_id', '=', user_id)]" id="act_hr_employee_2_hr_timesheet" name="Timesheets" res_model="hr_timesheet_sheet.sheet" src_model="hr.employee"/>
344
345     </data>
346 </openerp>