[IMP] add stat button for point of sale, email template
[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
44         <record model="ir.actions.act_window" id="act_hr_timesheet_sheet_sheet_2_hr_analytic_timesheet">
45             <field name="context">{'search_default_sheet_id': [active_id]}</field>
46             <field name="name">Timesheet Activities</field>
47             <field name="res_model">hr.analytic.timesheet</field>
48             <field name="src_model">hr_timesheet_sheet.sheet</field>
49         </record>
50
51
52         <record model="ir.actions.act_window" id="act_hr_timesheet_sheet_sheet_2_hr_attendance">
53             <field name="context">{'search_default_sheet_id': [active_id]}</field>
54             <field name="name">Attendances</field>
55             <field name="res_model">hr.attendance</field>
56             <field name="src_model">hr_timesheet_sheet.sheet</field>
57         </record>
58
59
60         <record id="hr_timesheet_sheet_form" model="ir.ui.view">
61             <field name="name">hr.timesheet.sheet.form</field>
62             <field name="model">hr_timesheet_sheet.sheet</field>
63             <field name="arch" type="xml">
64                 <form string="Timesheet" version="7.0">
65                 <header>
66                     <button name="button_confirm" states="draft" string="Submit to Manager" type="object" class="oe_highlight"/>
67                     <button name="done" states="confirm" string="Approve" type="workflow" groups="base.group_hr_user" class="oe_highlight"/>
68                     <button name="action_set_to_draft" states="done" string="Set to Draft" type="object" />
69                     <button name="cancel" states="confirm" string="Refuse" type="workflow" groups="base.group_hr_user" />
70                     <field name="state" widget="statusbar" statusbar_visible="new,confirm,done"/>
71                 </header>
72                 <sheet>
73                     <div class="oe_right oe_button_box" name="buttons">
74                         <button type="action"
75                             name="%(act_hr_timesheet_sheet_sheet_2_hr_analytic_timesheet)d"
76                             class="oe_stat_button"
77                             icon="fa-times">
78                             <field name="timesheet_activity_count" widget="statinfo" string="Timesheet Activities"/>
79                         </button>
80                         <button type="action" groups="base.group_hr_attendance"
81                             class="oe_stat_button" icon="fa-users"
82                             name="%(act_hr_timesheet_sheet_sheet_2_hr_attendance)d">
83                             <field name="attendance_count" widget="statinfo" string="Attendances"/>
84                         </button>
85                     </div>
86                     <div class="oe_title">
87                         <label for="employee_id" class="oe_edit_only"/>
88                         <h1><field name="employee_id" on_change="onchange_employee_id(employee_id)" class="oe_inline"/></h1>
89                         <field name="user_id" invisible="1"/>
90                     </div>
91                     <group>
92                         <group>
93                             <label for="date_from" string="Timesheet Period"/>
94                             <div><field name="date_from" class="oe_inline"/> to <field name="date_to" class="oe_inline"/></div>
95                             <field name="name" invisible="1"/>
96                             <field name="department_id" invisible="1"/>
97                             <field name="company_id" groups="base.group_multi_company"/>
98                         </group>
99                         <group groups="base.group_hr_attendance">
100                             <field name="total_attendance" widget="float_time"/>
101                             <field name="total_timesheet" widget="float_time"/>
102                             <field name="total_difference" widget="float_time"/>
103                         </group>
104                     </group>
105                     <notebook>
106                         <page string="Summary">
107                             <widget type="weekly_timesheet" attrs="{'readonly': [['state', 'not in', ['new', 'draft']]]}">
108                             </widget>
109                         </page>
110                         <page string="Details">
111                             <field context="{'employee_id': employee_id, 'user_id':user_id, 'timesheet_date_from': date_from, 'timesheet_date_to': date_to}" name="timesheet_ids" nolabel="1">
112                                 <tree editable="top" string="Timesheet Activities">
113                                     <field name="date"/>
114                                     <field domain="[('type','in',['normal', 'contract']), ('state', '&lt;&gt;', 'close'),('use_timesheets','=',1)]" name="account_id" on_change="on_change_account_id(account_id, user_id)" context="{'default_use_timesheets': 1}"/>
115                                     <field name="name"/>
116                                     <field name="unit_amount" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)" widget="float_time" string="Hours" sum="Hours"/>
117                                     <field name="to_invoice" widget="selection"/>
118                                     <field invisible="1" name="journal_id"/>
119                                     <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)"/>
120                                     <field invisible="1" name="product_uom_id" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)"/>
121                                     <field invisible="1" name="amount"/>
122                                     <field invisible="1" name="general_account_id"/>
123                                     <field invisible="1" name="user_id" required="1"/>
124                                 </tree>
125                                 <form string="Timesheet Activities" version="7.0">
126                                     <field name="date"/>
127                                     <field domain="[('type','=','normal'), ('state', '&lt;&gt;', 'close')]" name="account_id" on_change="on_change_account_id(account_id, user_id)"/>
128                                     <field name="name"/>
129                                     <field name="unit_amount" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)" widget="float_time"/>
130                                     <field name="to_invoice"/>
131                                     <field name="journal_id"/>
132                                     <field name="product_id" domain="[('type','=','service')]" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)"/>
133                                     <field name="product_uom_id" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)"/>
134                                     <field name="amount"/>
135                                     <field name="general_account_id"/>
136                                     <field name="user_id" required="1"/>
137                                 </form>
138                             </field>
139                         </page>
140                         <page string="Attendances" groups="base.group_hr_attendance">
141                             <group>
142                                 <field context="{'employee_id': employee_id, 'user_id':user_id}" name="attendances_ids" nolabel="1">
143                                     <tree string="Attendances" editable="bottom">
144                                         <field name="name"/>
145                                         <field name="action"/>
146                                         <field invisible="1" name="employee_id"/>
147                                     </tree>
148                                 </field>
149                                 <group>
150                                     <label for="state_attendance"/>
151                                     <div>
152                                         <field name="state_attendance"/>
153                                         <button name="attendance_action_change" attrs="{'invisible': [('state_attendance', '=', 'present')]}" type="object" string="Sign In" class="oe_link"/>
154                                         <button name="attendance_action_change" attrs="{'invisible': ['|', ('state_attendance','=',False), ('state_attendance', '=', 'absent')]}" type="object" string="Sign Out" class="oe_link"/>
155                                     </div>
156                                 </group>
157                             </group>
158                             <field name="period_ids">
159                                 <tree colors="red:total_difference&lt;0.1;blue:total_difference&gt;=0.1" string="Period">
160                                     <field name="name"/>
161                                     <field name="total_attendance" widget="float_time" sum="Attendances"/>
162                                     <field name="total_timesheet" widget="float_time" sum="Timesheets"/>
163                                     <field name="total_difference" widget="float_time" sum="Differences"/>
164                                 </tree>
165                             </field>
166                         </page>
167                     </notebook>
168                 </sheet>
169                 <div class="oe_chatter">
170                     <field name="message_ids" widget="mail_thread"/>
171                     <field name="message_follower_ids" widget="mail_followers"/>
172                 </div>
173                 </form>
174             </field>
175         </record>
176
177         <record id="view_hr_timesheet_sheet_filter" model="ir.ui.view">
178             <field name="name">hr_timesheet_sheet.sheet.filter</field>
179             <field name="model">hr_timesheet_sheet.sheet</field>
180             <field name="arch" type="xml">
181                 <search string="Search Timesheet">
182                     <field name="date_from"/>
183                     <filter name="new" string="In Draft" domain="[('state','in',('draft', 'new'))]" help="Unvalidated Timesheets"/>
184                     <filter name="to_approve" string="To Approve" domain="[('state','=','confirm')]" help="Confirmed Timesheets"/>
185                     <field name="employee_id"/>
186                     <field name="department_id"/>
187                     <group expand="0" string="Group By...">
188                         <filter string="Employees" icon="terp-personal" domain="[]" context="{'group_by':'employee_id'}"/>
189                         <filter string="Department" icon="terp-personal+" domain="[]" context="{'group_by':'department_id'}"/>
190                     </group>
191                 </search>
192             </field>
193         </record>
194
195         <record id="act_hr_timesheet_sheet_form" model="ir.actions.act_window">
196             <field name="name">Timesheets to Validate</field>
197             <field name="type">ir.actions.act_window</field>
198             <field name="res_model">hr_timesheet_sheet.sheet</field>
199             <field name="view_type">form</field>
200             <field name="view_id" eval="False"/>
201             <field name="context">{'search_default_to_approve':1}</field>
202             <field name="search_view_id" ref="view_hr_timesheet_sheet_filter"/>
203             <field name="help" type="html">
204               <p class="oe_view_nocontent_create">
205                 New timesheet to approve.
206               </p><p>
207                 You must record timesheets every day and confirm at the end
208                 of the week. Once the timesheet is confirmed, it should be
209                 validated by a manager.
210               </p><p>
211                 Timesheets can also be invoiced to customers, depending on the
212                 configuration of each project's related contract.
213               </p>
214             </field>
215         </record>
216
217         <menuitem action="act_hr_timesheet_sheet_form" id="menu_act_hr_timesheet_sheet_form" parent="hr_attendance.menu_hr_time_tracking"
218              sequence="2" groups="base.group_hr_user"/>
219
220         <!--
221             Company inheritancy
222         -->
223
224         <record id="hr_timesheet_sheet_company" model="ir.ui.view">
225             <field name="name">res.company.sheet</field>
226             <field name="model">res.company</field>
227             <field name="inherit_id" ref="base.view_company_form"/>
228             <field name="arch" type="xml">
229                 <xpath expr="//group[@name='account_grp']" position="after">
230                     <group name="timesheets_grp" string="Timesheets">
231                         <field name="timesheet_range"/>
232                         <field name="timesheet_max_difference"/>
233                     </group>
234                 </xpath>
235             </field>
236         </record>
237
238         <!--
239             hr.analytic.timesheet inheritancy
240         -->
241
242         <record id="hr_timesheet_line_form" model="ir.ui.view">
243             <field name="name">hr.analytic.timesheet.form</field>
244             <field name="model">hr.analytic.timesheet</field>
245             <field name="inherit_id" ref="hr_timesheet.hr_timesheet_line_form"/>
246             <field name="arch" type="xml">
247                 <field name="date" position="after">
248                     <field name="sheet_id" />
249                 </field>
250             </field>
251         </record>
252
253         <record id="hr_timesheet_line_search" model="ir.ui.view">
254             <field name="name">hr.analytic.timesheet.search</field>
255             <field name="model">hr.analytic.timesheet</field>
256             <field name="inherit_id" ref="hr_timesheet.hr_timesheet_line_search"/>
257             <field name="arch" type="xml">
258                 <field name="date" position="before">
259                     <field name="sheet_id"/>
260                 </field>
261             </field>
262         </record>
263
264         <!--
265             hr.attendance inheritancy
266         -->
267
268         <record model="ir.ui.view" id="view_hr_attendance_filter">
269             <field name="name">view_hr_attendance_filter</field>
270             <field name="model">hr.attendance</field>
271             <field name="inherit_id" ref="hr_attendance.view_hr_attendance_filter" />
272             <field name="arch" type="xml">
273                 <field name="employee_id" position="after">
274                     <field name="sheet_id"/>
275                 </field>
276             </field>
277         </record>
278
279         <record id="view_attendance_form" model="ir.ui.view">
280             <field name="name">hr.attendance.form</field>
281             <field name="model">hr.attendance</field>
282             <field name="inherit_id" ref="hr_attendance.view_attendance_form"/>
283             <field name="arch" type="xml">
284                 <field name="action_desc" position="after">
285                     <field name="sheet_id"/>
286                 </field>
287             </field>
288         </record>
289         <record id="view_attendance_tree" model="ir.ui.view">
290             <field name="name">hr.attendance.tree</field>
291             <field name="model">hr.attendance</field>
292             <field name="inherit_id" ref="hr_attendance.view_attendance_tree"/>
293             <field name="arch" type="xml">
294                 <field name="action" position="after">
295                     <field name="sheet_id"/>
296                 </field>
297             </field>
298         </record>
299         <record id="view_attendance_tree_who" model="ir.ui.view">
300             <field name="name">hr.attendance.tree</field>
301             <field name="model">hr.attendance</field>
302             <field name="inherit_id" ref="hr_attendance.view_attendance_who"/>
303             <field name="arch" type="xml">
304                 <field name="action" position="after">
305                     <field name="sheet_id"/>
306                 </field>
307             </field>
308         </record>
309
310         <act_window
311             context="{'search_default_sheet_id': [active_id]}"
312             id="act_hr_timesheet_sheet_sheet_by_account"
313             name="Timesheet by Account"
314             groups="base.group_hr_attendance"
315             res_model="hr_timesheet_sheet.sheet.account"
316             src_model="hr_timesheet_sheet.sheet"/>
317
318         <act_window
319             context="{'search_default_sheet_id': [active_id]}"
320             id="act_hr_timesheet_sheet_sheet_by_day"
321             name="Timesheet by Day"
322             groups="base.group_hr_attendance"
323             res_model="hr_timesheet_sheet.sheet.day"
324             src_model="hr_timesheet_sheet.sheet"/>
325
326         <record id="hr_timesheet_sheet_tree_simplified" model="ir.ui.view">
327             <field name="name">hr.timesheet.sheet.tree</field>
328             <field name="model">hr_timesheet_sheet.sheet</field>
329             <field eval="10" name="priority"/>
330             <field name="arch" type="xml">
331                 <tree colors="blue:state == 'draft';black:state in ('confirm','new');gray:state == 'done'" string="Timesheets">
332                     <field name="employee_id"/>
333                     <field name="date_from"/>
334                     <field name="date_to"/>
335                     <field name="department_id" invisible="1"/>
336                     <field name="total_attendance" widget="float_time" groups="base.group_hr_attendance"/>
337                     <field name="total_timesheet" widget="float_time"/>
338                     <field name="total_difference" widget="float_time" groups="base.group_hr_attendance"/>
339                     <field name="state"/>
340                 </tree>
341             </field>
342         </record>
343
344         <record id="hr_timesheet_day_tree" model="ir.ui.view">
345             <field name="name">hr.timesheet.day.tree</field>
346             <field name="model">hr_timesheet_sheet.sheet.day</field>
347             <field name="arch" type="xml">
348                 <tree colors="blue:total_difference&lt;0.1;red:total_difference&gt;=0.1" string="Period">
349                     <field name="name"/>
350                     <field name="total_attendance" widget="float_time" sum="Total Attendances" groups="base.group_hr_attendance"/>
351                     <field name="total_timesheet" widget="float_time" sum="Total Timesheet"/>
352                     <field name="total_difference" widget="float_time" sum="Total Difference" groups="base.group_hr_attendance"/>
353                 </tree>
354             </field>
355         </record>
356
357   <!-- Timesheet Button on Employee Form -->
358            
359     <record id="act_hr_employee_2_hr_timesheet" model="ir.actions.act_window">
360         <field name="res_model">hr_timesheet_sheet.sheet</field>
361         <field name="view_type">form</field>
362         <field name="name">Timesheets</field>
363         <field name="view_mode">tree,form</field>
364         <field name="context">{'search_default_employee_id': [active_id], 'default_employee_id': active_id}</field>
365     </record>
366          
367       <record id="hr_timesheet_sheet_employee_extd_form" model="ir.ui.view">
368             <field name="name">hr.timesheet.sheet.employee.extd_form</field>
369             <field name="model">hr.employee</field>
370             <field name="inherit_id" ref="hr_timesheet.hr_timesheet_employee_extd_form"/>
371             <field name="arch" type="xml">
372                 <xpath expr="//div[@name='button_box']" position="inside">
373                     <button name="%(act_hr_employee_2_hr_timesheet)d" 
374                         type="action"
375                         class="oe_stat_button"
376                         icon="fa-clock-o" 
377                         groups="base.group_hr_manager">
378                         <field name="timesheet_count" widget="statinfo" string="Timesheets"/>
379                     </button>
380                 </xpath>
381             </field>
382         </record>
383
384     </data>
385 </openerp>