Merge branch 'master' of https://github.com/odoo/odoo
[odoo/odoo.git] / addons / hr_expense / hr_expense_view.xml
1 <?xml version="1.0" encoding="utf-8"?>
2 <openerp>
3     <data>
4
5         <!-- Expenses -->
6
7         <record id="view_expenses_line_tree" model="ir.ui.view">
8             <field name="name">hr.expense.line.tree</field>
9             <field name="model">hr.expense.line</field>
10             <field name="arch" type="xml">
11                 <tree string="Expense Lines">
12                     <field name="sequence" invisible="1"/>
13                     <field name="date_value"/>
14                     <field name="name"/>
15                     <field name="ref"/>
16                     <field domain="[('type','in',['normal','contract']), ('parent_id','!=',False)]" name="analytic_account" groups="analytic.group_analytic_accounting"/>
17                     <field name="unit_amount"/>
18                     <field name="unit_quantity"/>
19                     <field name="total_amount" sum="Total"/>
20                 </tree>
21             </field>
22         </record>
23
24         <record id="view_expenses_tree" model="ir.ui.view">
25             <field name="name">hr.expense.expense.tree</field>
26             <field name="model">hr.expense.expense</field>
27             <field name="arch" type="xml">
28                 <tree string="Expenses" colors="blue:state=='draft'" fonts="bold: message_unread == True">
29                     <field name="employee_id"/>
30                     <field name="department_id" invisible="1"/>
31                     <field name="date"/>
32                     <field name="user_id" invisible="1"/>
33                     <field name="name" string="Expense Sheet"/>
34                     <field name="currency_id" groups="base.group_multi_currency"/>
35                     <field name="amount" sum="Total Amount"/>
36                     <field name="state"/>
37                     <field name="message_unread" invisible="1"/>
38                 </tree>
39             </field>
40         </record>
41
42         <record id="view_editable_expenses_tree" model="ir.ui.view">
43             <field name="name">hr.expense.expense.tree</field>
44             <field name="model">hr.expense.expense</field>
45             <field name="arch" type="xml">
46                 <tree colors="blue:state == 'draft';black:state in ('confirm','accepted','done');gray:state == 'cancelled'"  string="Expenses" editable="top">
47                     <field name="employee_id"/>
48                     <field name="date"/>
49                     <field name="department_id"/>
50                     <field name="name" string="Expense Sheet"/>
51                     <field name="amount"/>
52                     <field name="state"/>
53                     <button name="confirm" states="draft" string="Confirm" type="workflow" icon="gtk-apply"/>
54                     <button name="refuse" states="confirm,draft,accepted" string="Refuse" type="workflow" icon="gtk-no" groups="base.group_hr_user"/>
55                 </tree>
56             </field>
57         </record>
58
59         <record id="view_expenses_form" model="ir.ui.view">
60             <field name="name">hr.expense.form</field>
61             <field name="model">hr.expense.expense</field>
62             <field eval="25" name="priority"/>
63             <field name="arch" type="xml">
64                 <form string="Expenses Sheet">
65                 <header>
66                     <button name="confirm" states="draft" string="Submit to Manager" type="workflow" class="oe_highlight"/>
67                     <button name="validate" states="confirm" string="Approve" type="workflow" groups="base.group_hr_user" class="oe_highlight"/>
68                     <button name="refuse" states="confirm,accepted" string="Refuse" type="workflow" groups="base.group_hr_user" />
69                     <button name="draft" states="confirm,cancelled" string="Set to Draft" type="workflow" groups="base.group_hr_user" />
70                     <button name="done" states="accepted" string="Generate Accounting Entries" type="workflow" groups="account.group_account_invoice,account.group_account_user" class="oe_highlight"/>
71                     <button name="action_view_move" states="done" string="Open Accounting Entries" type="object" groups="account.group_account_invoice,account.group_account_user"/>
72                     <field name="state" widget="statusbar" statusbar_visible="draft,confirm,accepted,done,paid" statusbar_colors='{"confirm":"blue","cancelled":"red"}'/>
73                 </header>
74                 <sheet>
75                     <group>
76                         <group>
77                             <field name="employee_id" on_change="onchange_employee_id(employee_id)"/>
78                             <field name="date"/>
79                             <field name="department_id"/>
80                             <field name="company_id" groups="base.group_multi_company"/>
81                         </group>
82                         <group>
83                             <field name="name" string="Expense Sheet" placeholder="e.g. Business travel at Chicago"/>
84                             <field name="user_valid" attrs="{'invisible': [('state','=','draft')]}" context="{'default_groups_ref': ['base.group_user', 'base.group_partner_manager', 'base.group_hr_user']}"/>
85                             <field name="currency_id" groups="base.group_multi_currency" on_change="onchange_currency_id(currency_id, company_id)"/>
86                         </group>
87                         <group>
88                             <field name="journal_id" widget="selection" attrs="{'readonly':[('state','=','done')]}" domain="[('type', '=', 'purchase')]" string="Journal" groups="account.group_account_user"/>
89                             <field name="employee_payable_account_id" widget="selection" attrs="{'readonly':[('state','=','done')]}" domain="[('type', '=', 'payable')]" groups="account.group_account_user"/>
90                         </group>
91                         <group>
92                             <label class="oe_grey" groups="account.group_account_user" string="If this field is empty, entries will be generated in the purchase journal."/>
93                         </group>
94                     </group>
95                     <notebook>
96                         <page string="Expense Lines">
97                             <field name="line_ids" context="{'currency_id': currency_id, 'default_analytic_account': context.get('analytic_account', '')}">
98                                 <form string="Expense Lines">
99                                     <group>
100                                         <group>
101                                             <field name="product_id" on_change="onchange_product_id(product_id, context)" context="{'default_hr_expense_ok':1}"/>
102                                             <field name="name"/>
103                                             <field name="ref"/>
104                                             <field domain="[('type','=','normal')]" name="analytic_account" groups="analytic.group_analytic_accounting"/>
105                                         </group>
106                                         <group>
107                                             <field name="unit_amount"/>
108                                             <label for="unit_quantity"/>
109                                             <div>
110                                                 <field name="unit_quantity" class="oe_inline"/> 
111                                                 <field name="uom_id" on_change="onchange_uom(product_id, uom_id, context)" class="oe_inline"/>
112                                             </div>
113                                             <field name="date_value" />
114                                         </group>
115                                     </group>
116                                 </form>
117                                 <tree string="Expense Lines" editable="bottom">
118                                     <field name="sequence" invisible="1"/>
119                                     <field name="product_id" on_change="onchange_product_id(product_id, context)" context="{'default_hr_expense_ok':1}"/>
120                                     <field name="date_value" string="Expense Date"/>
121                                     <field name="name" string="Description"/>
122                                     <field name="ref"/>
123                                     <field domain="[('type','in',['normal','contract'])]" name="analytic_account" groups="analytic.group_analytic_accounting"/>
124                                     <field name="uom_id" on_change="onchange_uom(product_id, uom_id, context)"/>
125                                     <field name="unit_amount"/>
126                                     <field name="unit_quantity"/>
127                                     <field name="total_amount" sum="Total"/>
128                                 </tree>
129                             </field>
130                             <group>
131                                 <div>
132                                     <separator string="Description"/>
133                                     <field name="note" placeholder="Free Notes"/>
134                                 </div>
135                                 <group class="oe_subtotal_footer oe_right">
136                                     <field name="amount" widget="monetary" options="{'currency_field': 'currency_id'}" class="oe_subtotal_footer_separator"/>
137                                 </group>
138                             </group>
139                         </page>
140                     </notebook>
141                 </sheet>
142                 <div class="oe_chatter">
143                     <field name="message_follower_ids" widget="mail_followers"/>
144                     <field name="message_ids" widget="mail_thread"/>
145                 </div>
146                 </form>
147             </field>
148         </record>
149
150
151         <record id="view_hr_expense_filter" model="ir.ui.view">
152             <field name="name">hr.expense.expense.filter</field>
153             <field name="model">hr.expense.expense</field>
154             <field name="arch" type="xml">
155                 <search string="Expense">
156                     <field name="name" string="Expenses"/>
157                     <field name="date"/>
158                     <field name="employee_id"/>
159                     <field name="department_id" string="Department" context="{'invisible_department': False}"/>
160                     <filter domain="[('state','=','draft')]" string="New" help="New Expense"/>
161                     <filter domain="[('state','=','confirm')]" string="To Approve" name="confirm" help="Confirmed Expenses"/>
162                     <filter domain="[('state','=','accepted')]" string="To Pay" name="approved" help="Expenses to Invoice"/>
163                     <separator />
164                     <filter domain="[('user_id', '=', uid)]" string="My Expenses"/>
165                     <separator />
166                     <filter string="New Mail" name="message_unread" domain="[('message_unread','=',True)]"/>
167                     <group expand="0" string="Group By">
168                         <filter string="Employee" domain="[]" context="{'group_by':'employee_id'}"/>
169                         <filter string="Department" domain="[]" context="{'group_by':'department_id'}"/>
170                         <filter string="Expenses Month" domain="[]" context="{'group_by':'date'}" help="Expenses by Month"/>
171                     </group>
172                 </search>
173             </field>
174         </record>
175
176         <record id="expense_all" model="ir.actions.act_window">
177             <field name="name">Expenses</field>
178             <field name="res_model">hr.expense.expense</field>
179             <field name="view_type">form</field>
180             <field name="search_view_id" ref="view_hr_expense_filter"/>
181             <field name="view_id" ref="view_expenses_tree"/>
182             <field name="help" type="html">
183               <p class="oe_view_nocontent_create">
184                 Click to register new expenses. 
185               </p><p>
186                 Odoo will ensure the whole process is followed; the expense
187                 sheet is validated by manager(s), the employee is reimbursed
188                 from his expenses, some expenses must be re-invoiced to the
189                 customers.
190               </p>
191             </field>
192         </record>
193
194         <record id="view_product_hr_expense_form" model="ir.ui.view">
195             <field name="name">product.template.expense.form</field>
196             <field name="model">product.template</field>
197             <field name="inherit_id" ref="product.product_template_form_view"/>
198             <field name="arch" type="xml">
199                 <div name="options" position="inside">
200                     <div>
201                         <field name="hr_expense_ok"/>
202                         <label for="hr_expense_ok"/>
203                     </div>
204                 </div>
205             </field>
206         </record>
207
208         <record id="hr_expense_product" model="ir.actions.act_window">
209             <field name="name">Expense Products</field>
210             <field name="res_model">product.product</field>
211             <field name="view_type">form</field>
212             <field name="view_mode">kanban,tree,form</field>
213             <field name="context">{"default_hr_expense_ok":1}</field>
214             <field name="domain">[('hr_expense_ok','=',True)]</field>
215             <field name="search_view_id" ref="product.product_search_form_view"/>
216             <field name="help" type="html">
217               <p class="oe_view_nocontent_create">
218                 Click to create a new expense category. 
219              </p>
220             </field>
221         </record>
222
223         <record id="action_approved_expense" model="ir.actions.act_window">
224             <field name="name">Expenses</field>
225             <field name="res_model">hr.expense.expense</field>
226             <field name="view_type">form</field>
227             <field name="view_mode">tree,form</field>
228             <field name="view_id" ref="view_expenses_tree"/>
229             <field name="domain">[('state','=','accepted')]</field> 
230         </record>
231         
232         <record id="action_request_approve_expense" model="ir.actions.act_window">
233             <field name="name">Expenses to Approve</field>
234             <field name="res_model">hr.expense.expense</field>
235             <field name="view_type">form</field>
236             <field name="context">{'search_default_confirm':1, 'needaction_menu_ref': 'hr_expense.menu_expense_all'}</field>
237             <field name="search_view_id" ref="view_hr_expense_filter"/>
238             <field name="view_id" ref="view_expenses_tree"/>
239             <field name="help" type="html">
240               <p class="oe_view_nocontent_create">
241                 Click to register new expenses. 
242               </p><p>
243                 OpenERP will ensure the whole process is followed; the expense
244                 sheet is validated by manager(s), the employee is reimbursed
245                 from his expenses, some expenses must be re-invoiced to the
246                 customers.
247               </p>
248             </field>
249         </record>
250         
251         <menuitem id="menu_expense_approved" parent="account.menu_finance_payables" action="action_approved_expense" sequence="8"/> 
252         <menuitem id="menu_hr_product" name="Expense Products" parent="hr.menu_hr_configuration_expenses" action="hr_expense_product" groups="base.group_hr_manager"/>
253         <menuitem id="next_id_49" name="Expenses" sequence="15" parent="hr.menu_hr_root"/>
254         <menuitem action="expense_all" id="menu_expense_all" name="Expenses" parent="next_id_49"/>
255         <menuitem action="action_request_approve_expense" id="menu_expense_to_approve" name="Expenses to Approve" parent="next_id_49" groups="base.group_hr_user"/>
256         
257     </data>
258 </openerp>