[MERGE] Merge with main branch
[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';grey: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="hr_attendance.group_hr_attendance"/>
17                     <field name="total_timesheet"/>
18                     <field name="total_difference" groups="hr_attendance.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"/>
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"/>
57                     <field name="total" sum="Total"/>
58                     <field name="invoice_rate"/>
59                 </tree>
60             </field>
61         </record>
62 <!--
63         <record id="hr_timesheet_day_form" model="ir.ui.view">
64             <field name="name">hr.timesheet.day.form</field>
65             <field name="model">hr_timesheet_sheet.sheet.day</field>
66             <field name="type">form</field>
67             <field name="arch" type="xml">
68                 <form string="Timesheet by Days">
69                     <field name="sheet_id" select="1"/>
70                     <field name="name" select="1"/>
71                     <field name="total_timesheet"/>
72                     <field name="total_attendance" groups="hr_attendance.group_hr_attendance"/>
73                     <field name="total_difference" groups="hr_attendance.group_hr_attendance"/>
74                 </form>
75             </field>
76         </record>
77
78         <record id="hr_timesheet_day_tree" model="ir.ui.view">
79             <field name="name">hr.timesheet.day.tree</field>
80             <field name="model">hr_timesheet_sheet.sheet.day</field>
81             <field name="type">tree</field>
82             <field name="arch" type="xml">
83                 <tree colors="red:total_difference&lt;0.1;blue:total_difference&gt;=0.1" string="Timesheet by Days">
84                     <field name="sheet_id"/>
85                     <field name="name"/>
86                     <field name="total_timesheet" sum="Total Timesheet"/>
87                     <field name="total_attendance" sum="Total Attendance" groups="hr_attendance.group_hr_attendance"/>
88                     <field name="total_difference" sum="Total Difference" groups="hr_attendance.group_hr_attendance"/>
89                 </tree>
90             </field>
91         </record>
92 -->
93         <record id="hr_timesheet_sheet_form" model="ir.ui.view">
94             <field name="name">hr.timesheet.sheet.form</field>
95             <field name="model">hr_timesheet_sheet.sheet</field>
96             <field name="type">form</field>
97             <field name="arch" type="xml">
98                 <form string="Timesheet">
99                     <field name="name"/>
100                     <field name="user_id"/>
101                     <field name="date_from"/>
102                     <field name="date_to"/>
103                     <field name="company_id" select="1" groups="base.group_multi_company"/>
104                     <field name="department_id"/>
105                     <notebook colspan="4">
106                         <page string="Daily View">
107                             <group col="6" colspan="4">
108                                 <button name="button_dummy" string="Go to:" type="object" icon="gtk-redo"/>
109                                 <field name="date_current" nolabel="1"/>
110                                 <label string=""/>
111                                 <button icon="gtk-media-previous" name="date_previous" string="" type="object"/>
112                                 <button name="date_today" string="Today" type="object" icon="gtk-home"/>
113                                 <button icon="gtk-media-next" name="date_next" string="" type="object"/>
114                             </group>
115
116                             <field colspan="3" context="name=date_current,user_id=user_id" height="100" name="attendances_ids" nolabel="1" groups="hr_attendance.group_hr_attendance">
117                                 <tree string="Attendances" editable="bottom">
118                                     <field name="name"/>
119                                     <field name="action"/>
120                                     <field invisible="1" name="employee_id"/>
121                                 </tree>
122                             </field>
123                             <group col="1" colspan="1" groups="hr_attendance.group_hr_attendance">
124                                 <button name="sign_in" string="Sign In" type="object" icon="gtk-go-back"/>
125                                 <button name="sign_out" string="Sign Out" type="object" icon="gtk-go-forward"/>
126                             </group>
127
128                             <field name="state_attendance" groups="hr_attendance.group_hr_attendance"/>
129                             <field name="total_attendance_day" widget="float_time" groups="hr_attendance.group_hr_attendance"/>
130                             <field colspan="4" context="date=date_current,user_id=user_id" domain="[('name','=',date_current)]" name="timesheet_ids" nolabel="1">
131                                 <tree editable="top" string="Timesheet">
132                                     <field invisible="1" name="date"/>
133                                     <field domain="[('type','=','normal'), ('state', '&lt;&gt;', 'close')]" name="account_id" on_change="on_change_account_id(account_id)"/>
134                                     <field name="name"/>
135                                     <field name="unit_amount" on_change="on_change_unit_amount(product_id, unit_amount, product_uom_id)" widget="float_time"/>
136                                     <field name="to_invoice"/>
137                                     <field invisible="1" name="journal_id"/>
138                                     <field invisible="1" name="product_id"/>
139                                     <field invisible="1" name="product_uom_id" on_change="on_change_unit_amount(product_id, unit_amount, product_uom_id)"/>
140                                     <field name="amount"/>
141                                     <field name="general_account_id"/>
142                                     <field invisible="1" name="user_id" required="1"/>
143                                 </tree>
144                                 <form string="Timesheet">
145                                     <field name="date"/>
146                                     <field domain="[('type','=','normal'), ('state', '&lt;&gt;', 'close')]" name="account_id" on_change="on_change_account_id(account_id)"/>
147                                     <field name="name"/>
148                                     <field name="unit_amount" on_change="on_change_unit_amount(product_id, unit_amount, product_uom_id)" widget="float_time"/>
149                                     <field name="to_invoice"/>
150                                     <field invisible="1" name="journal_id"/>
151                                     <field invisible="1" name="product_id"/>
152                                     <field invisible="1" name="product_uom_id" on_change="on_change_unit_amount(product_id, unit_amount, product_uom_id)"/>
153                                     <field name="amount"/>
154                                     <field name="general_account_id"/>
155                                     <field name="user_id" required="1"/>
156                                 </form>
157                             </field>
158                             <field name="total_difference_day" widget="float_time"/>
159                             <field name="total_timesheet_day" widget="float_time"/>
160                         </page>
161                         <page string="By Day">
162                             <field colspan="4" name="period_ids" nolabel="1">
163                                 <tree colors="red:total_difference&lt;0.1;blue:total_difference&gt;=0.1" string="Period">
164                                     <field name="name"/>
165                                     <field name="total_attendance" widget="float_time" groups="hr_attendance.group_hr_attendance"/>
166                                     <field name="total_timesheet" widget="float_time"/>
167                                     <field name="total_difference" widget="float_time" groups="hr_attendance.group_hr_attendance"/>
168                                 </tree>
169                             </field>
170                             <group colspan="4" col="6">
171                                 <field name="total_attendance" widget="float_time"/>
172                                 <field name="total_timesheet" widget="float_time"/>
173                                 <field name="total_difference" widget="float_time"/>
174                             </group>
175                         </page>
176                     </notebook>
177                     <field name="state"/>
178                     <group col="4" colspan="2">
179                         <button name="button_confirm" states="draft" string="Confirm" type="object" icon="gtk-execute"/>
180                         <button name="action_set_to_draft" states="done" string="Set to Draft" type="object" icon="gtk-convert"/>
181                         <button name="cancel" states="confirm" string="Refuse" type="workflow" icon="gtk-stop"/>
182                         <button name="done" states="confirm" string="Accept" type="workflow" icon="gtk-apply"/>
183                     </group>
184                 </form>
185             </field>
186         </record>
187
188         <record id="view_hr_timesheet_sheet_filter" model="ir.ui.view">
189             <field name="name">hr_timesheet_sheet.sheet.filter</field>
190             <field name="model">hr_timesheet_sheet.sheet</field>
191             <field name="type">search</field>
192             <field name="arch" type="xml">
193                 <search string="Search Timesheet">
194                     <group col="10" colspan="4">
195                         <separator orientation="vertical"/>
196                         <filter icon="terp-crm" string="In Draft" domain="[('state','in',('draft', 'new'))]" help="Unvalidated Timesheets"/>
197                         <filter icon="terp-crm" string="To Validate" domain="[('state','=','confirm')]" help="Confirmed Timesheets"/>
198                         <separator orientation="vertical"/>
199                         <field name="user_id" select="1" widget="selection"/>
200                         <field name="date_from"/>
201                         <field name="department_id" widget="selection">
202                             <filter icon="terp-crm"
203                                 domain="[('department_id','=',context.get('department_id',False))]"
204                                 help="My Departments Timesheet"/>
205                         </field>
206                     </group>
207                     <newline/>
208                     <group expand="1" string="Group By..." colspan="4" col="20">
209                         <filter string="Users" icon="terp-project" domain="[]" context="{'group_by':'user_id'}"/>
210                         <filter string="Department" icon="terp-project" domain="[]" context="{'group_by':'department_id'}"/>
211                     </group>
212                 </search>
213             </field>
214         </record>
215
216         <record id="act_hr_timesheet_sheet_form" model="ir.actions.act_window">
217             <field name="name">Timesheets</field>
218             <field name="type">ir.actions.act_window</field>
219             <field name="res_model">hr_timesheet_sheet.sheet</field>
220             <field name="view_type">form</field>
221             <field name="view_id" eval="False"/>
222             <field name="context">{'search_default_my_timesheet':1, 'search_default_user_id':uid }</field>
223             <field name="search_view_id" ref="view_hr_timesheet_sheet_filter"/>
224         </record>
225
226         <!--Time Tracking menu in project Management-->
227         <menuitem icon="terp-project" id="base.menu_main_pm" name="Project Management" sequence="1"/>
228           <menuitem
229              id="base.menu_project_management_time_tracking"
230              name="Time Tracking"
231              parent="base.menu_main_pm" sequence="3"/>
232          <menuitem action="hr_timesheet_sheet.act_hr_timesheet_sheet_form" id="menu_act_project_management_timesheet_sheet_form" parent="base.menu_project_management_time_tracking"
233              groups="hr.group_hr_manager" sequence="5"/>
234         <!--<menuitem id="next_id_60" name="Timesheets" parent="hr.menu_hr_root"/>-->
235         <menuitem action="act_hr_timesheet_sheet_form" id="menu_act_hr_timesheet_sheet_form" parent="hr_attendance.menu_hr_time_tracking"
236             groups="hr.group_hr_manager"/>
237
238         <!--
239             Company inheritancy
240         -->
241
242         <record id="hr_timesheet_sheet_company" model="ir.ui.view">
243             <field name="name">res.company.sheet</field>
244             <field name="model">res.company</field>
245             <field name="type">form</field>
246             <field name="inherit_id" ref="base.view_company_form"/>
247             <field name="arch" type="xml">
248                 <page string="Configuration" position="inside">
249                     <separator string="Timesheets" colspan="4"/>
250                     <field name="timesheet_range"/>
251                     <field name="timesheet_max_difference"/>
252                     <newline/>
253                 </page>
254             </field>
255         </record>
256
257         <!--
258             hr.analytic.timesheet inheritancy
259         -->
260
261         <record id="hr_timesheet_line_form" model="ir.ui.view">
262             <field name="name">hr.analytic.timesheet.form</field>
263             <field name="model">hr.analytic.timesheet</field>
264             <field name="type">form</field>
265             <field name="inherit_id" ref="hr_timesheet.hr_timesheet_line_form"/>
266             <field name="arch" type="xml">
267                 <field name="date" position="after">
268                     <field name="sheet_id" />
269                 </field>
270             </field>
271         </record>
272         <!--
273             hr.attendance inheritancy
274         -->
275
276         <record model="ir.ui.view" id="view_hr_attendance_filter">
277             <field name="name">view_hr_attendance_filter</field>
278             <field name="model">hr.attendance</field>
279             <field name="type">search</field>
280             <field name="inherit_id" ref="hr_attendance.view_hr_attendance_filter" />
281             <field name="arch" type="xml">
282                 <field name="action" position="after">
283                     <field name="sheet_id" select="1" />
284                 </field>
285             </field>
286         </record>
287
288         <record id="view_attendance_form" model="ir.ui.view">
289             <field name="name">hr.attendance.form</field>
290             <field name="model">hr.attendance</field>
291             <field name="type">form</field>
292             <field name="inherit_id" ref="hr_attendance.view_attendance_form"/>
293             <field name="arch" type="xml">
294                 <field name="action_desc" position="after">
295                     <field name="sheet_id"/>
296                 </field>
297             </field>
298         </record>
299         <record id="view_attendance_tree" model="ir.ui.view">
300             <field name="name">hr.attendance.tree</field>
301             <field name="model">hr.attendance</field>
302             <field name="type">tree</field>
303             <field name="inherit_id" ref="hr_attendance.view_attendance_tree"/>
304             <field name="arch" type="xml">
305                 <field name="action" position="after">
306                     <field name="sheet_id"/>
307                 </field>
308             </field>
309         </record>
310         <record id="view_attendance_tree_who" model="ir.ui.view">
311             <field name="name">hr.attendance.tree</field>
312             <field name="model">hr.attendance</field>
313             <field name="type">tree</field>
314             <field name="inherit_id" ref="hr_attendance.view_attendance_who"/>
315             <field name="arch" type="xml">
316                 <field name="action" position="after">
317                     <field name="sheet_id"/>
318                 </field>
319             </field>
320         </record>
321
322         <act_window domain="[('sheet_id', '=', active_id)]" id="act_hr_timesheet_sheet_sheet_by_day" name="Timesheet by Account" res_model="hr_timesheet_sheet.sheet.account" src_model="hr_timesheet_sheet.sheet"/>
323 <!--         <act_window domain="[('sheet_id', '=', active_id)]" id="act_hr_timesheet_sheet_sheet_by_account" name="Timesheet by Day" res_model="hr_timesheet_sheet.sheet.day" src_model="hr_timesheet_sheet.sheet"/>  -->
324
325
326         <act_window domain="[('sheet_id', '=', active_id)]" id="act_hr_timesheet_sheet_sheet_2_hr_analytic_timesheet" name="Timesheet Lines" res_model="hr.analytic.timesheet" src_model="hr_timesheet_sheet.sheet"/>
327
328         <act_window domain="[('sheet_id', '=', active_id)]" id="act_hr_timesheet_sheet_sheet_2_hr_attendance" name="Attendances" res_model="hr.attendance" src_model="hr_timesheet_sheet.sheet"/>
329
330         <record id="hr_timesheet_sheet_tree_simplified" model="ir.ui.view">
331             <field name="name">hr.timesheet.sheet.tree.simplified</field>
332             <field name="model">hr_timesheet_sheet.sheet</field>
333             <field name="type">tree</field>
334             <field eval="20" name="priority"/>
335             <field name="arch" type="xml">
336                 <tree string="Timesheets">
337                     <field name="date_from"/>
338                     <field name="user_id"/>
339                     <field name="name"/>
340                     <field name="total_attendance"/>
341                     <field name="total_timesheet"/>
342                     <field name="state"/>
343                 </tree>
344             </field>
345         </record>
346
347         <!-- Timesheet Button on Employee Form -->
348         <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"/>
349
350     </data>
351 </openerp>