[MERGE] trunk
[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'">
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"/>
34                     <field name="currency_id" groups="base.group_multi_currency"/>
35                     <field name="amount"/>
36                     <field name="state"/>
37                 </tree>
38             </field>
39         </record>
40
41         <record id="view_editable_expenses_tree" model="ir.ui.view">
42             <field name="name">hr.expense.expense.tree</field>
43             <field name="model">hr.expense.expense</field>
44             <field name="arch" type="xml">
45                 <tree colors="blue:state == 'draft';black:state in ('confirm','accepted','done');gray:state == 'cancelled'"  string="Expenses" editable="top">
46                     <field name="employee_id"/>
47                     <field name="date"/>
48                     <field name="department_id"/>
49                     <field name="name"/>
50                     <field name="amount"/>
51                     <field name="state"/>
52                     <button name="confirm" states="draft" string="Confirm" type="workflow" icon="gtk-apply"/>
53                     <button name="refuse" states="confirm,draft,accepted" string="Refuse" type="workflow" icon="gtk-no" groups="base.group_hr_user"/>
54                 </tree>
55             </field>
56         </record>
57
58         <record id="view_expenses_form" model="ir.ui.view">
59             <field name="name">hr.expense.form</field>
60             <field name="model">hr.expense.expense</field>
61             <field name="arch" type="xml">
62                 <form string="Expenses Sheet" version="7.0">
63                 <header>
64                     <button name="confirm" states="draft" string="Submit to Manager" type="workflow" class="oe_highlight"/>
65                     <button name="validate" states="confirm" string="Approve" type="workflow" groups="base.group_hr_user" class="oe_highlight"/>
66                     <button name="draft" states="confirm,cancelled" string="Set to Draft" type="workflow" groups="base.group_hr_user" />
67                     <button name="done" states="accepted" string="Generate Accounting Entries" type="workflow" groups="account.group_account_invoice" class="oe_highlight"/>
68                     <button name="action_view_receipt" states="done" string="Open Receipt" type="object"/>
69                     <button name="refuse" states="confirm,accepted" string="Refuse" type="workflow" groups="base.group_hr_user" />
70                     <field name="state" widget="statusbar" statusbar_visible="draft,confirm,accepted,done" statusbar_colors='{"confirm":"blue","cancelled":"red"}'/>
71                 </header>
72                 <sheet>
73                     <group>
74                         <group>
75                             <field name="employee_id" on_change="onchange_employee_id(employee_id)"/>
76                             <field name="date"/>
77                             <field name="department_id"/>
78                             <field name="company_id" groups="base.group_multi_company"/>
79                         </group>
80                         <group>
81                             <field name="name"/>
82                             <field name="user_valid" attrs="{'invisible': [('state','=','draft')]}"/>
83                             <field name="currency_id" groups="base.group_multi_currency" on_change="onchange_currency_id(currency_id, company_id)"/>
84                         </group>
85                     </group>
86                     <notebook>
87                         <page string="Description">
88                             <field name="line_ids" context="{'currency_id': currency_id}">
89                                 <form string="Expense Lines" version="7.0">
90                                     <group>
91                                         <group>
92                                             <field name="product_id" on_change="onchange_product_id(product_id, context)" context="{'default_hr_expense_ok':1}"/>
93                                             <field name="name"/>
94                                             <field name="ref"/>
95                                             <field domain="[('type','=','normal')]" name="analytic_account" groups="analytic.group_analytic_accounting"/>
96                                         </group>
97                                         <group>
98                                             <field name="unit_amount"/>
99                                             <label for="unit_quantity"/>
100                                             <div>
101                                                 <field name="unit_quantity" class="oe_inline"/> 
102                                                 <field name="uom_id" on_change="onchange_uom(product_id, uom_id, context)" class="oe_inline"/>
103                                             </div>
104                                             <field name="date_value" />
105                                         </group>
106                                     </group>
107                                 </form>
108                                 <tree string="Expense Lines" editable="bottom">
109                                     <field name="sequence" invisible="1"/>
110                                     <field name="product_id" on_change="onchange_product_id(product_id, context)" context="{'default_hr_expense_ok':1}"/>
111                                     <field name="date_value" string="Expense Date"/>
112                                     <field name="name"/>
113                                     <field name="ref"/>
114                                     <field domain="[('type','in',['normal','contract']), ('parent_id','!=',False)]" name="analytic_account" groups="analytic.group_analytic_accounting"/>
115                                     <field name="uom_id" on_change="onchange_uom(product_id, uom_id, context)"/>
116                                     <field name="unit_amount"/>
117                                     <field name="unit_quantity"/>
118                                     <field name="total_amount" sum="Total"/>
119                                 </tree>
120                             </field>
121                             <group>
122                                 <div>
123                                     <separator string="Notes"/>
124                                     <field name="note" placeholder="Free Notes"/>
125                                 </div>
126                                 <group class="oe_subtotal_footer oe_right">
127                                     <field name="amount" widget="monetary" options="{'currency_field': 'currency_id'}" class="oe_subtotal_footer_separator"/>
128                                 </group>
129                             </group>
130                         </page>
131                         <page string="Accounting" groups="account.group_account_user">
132                             <group>
133                                 <group string="Accounting Data">
134                                     <field name="journal_id" widget="selection" domain="[('type', '=', 'purchase')]"/>
135                                     <field name="voucher_id" context="{'form_view_ref': 'account_voucher.view_purchase_receipt_form'}"/>
136                                 </group>
137                             </group>
138                         </page>
139                     </notebook>
140                 </sheet>
141                 <div class="oe_chatter">
142                     <field name="message_follower_ids" widget="mail_followers"/>
143                     <field name="message_ids" widget="mail_thread"/>
144                 </div>
145                 </form>
146             </field>
147         </record>
148
149
150         <record id="view_hr_expense_filter" model="ir.ui.view">
151             <field name="name">hr.expense.expense.filter</field>
152             <field name="model">hr.expense.expense</field>
153             <field name="arch" type="xml">
154                 <search string="Expense">
155                     <field name="name" string="Expenses"/>
156                     <field name="date"/>
157                     <filter icon="terp-document-new" domain="[('state','=','draft')]" string="New" help="New Expense"/>
158                     <filter icon="terp-camera_test" domain="[('state','=','confirm')]" string="To Approve" help="Confirmed Expenses"/>
159                     <filter icon="terp-dolar" domain="[('state','=','accepted')]" string="To Pay" help="Expenses to Invoice"/>
160                     <separator/>
161                     <filter domain="[('user_id', '=', uid)]" string="My Expenses"/>
162                     <field name="employee_id"/>
163                     <field name="department_id" string="Department" context="{'invisible_department': False}"/>
164                     <group expand="0" string="Group By...">
165                         <filter string="Employee" icon="terp-personal" domain="[]" context="{'group_by':'employee_id'}"/>
166                         <filter string="Department" icon="terp-personal+" domain="[]" context="{'group_by':'department_id'}"/>
167                         <filter string="Month" icon="terp-go-month" domain="[]" context="{'group_by':'date'}"/>
168                     </group>
169                 </search>
170             </field>
171         </record>
172
173         <record id="expense_all" model="ir.actions.act_window">
174             <field name="name">Expenses</field>
175             <field name="res_model">hr.expense.expense</field>
176             <field name="view_type">form</field>
177             <field name="search_view_id" ref="view_hr_expense_filter"/>
178             <field name="view_id" ref="view_expenses_tree"/>
179             <field name="help" type="html">
180               <p class="oe_view_nocontent_create">
181                 Click to register new expenses. 
182               </p><p>
183                 OpenERP will ensure the whole process is followed; the expense
184                 sheet is validated by manager(s), the employee is reimbursed
185                 from his expenses, some expenses must be re-invoiced to the
186                 customers.
187               </p>
188             </field>
189         </record>
190
191
192         <record id="view_product_hr_expense_form" model="ir.ui.view">
193             <field name="name">product.product.expense.form</field>
194             <field name="model">product.product</field>
195             <field name="inherit_id" ref="product.product_normal_form_view"/>
196             <field name="arch" type="xml">
197                 <div name="options" position="inside">
198                     <field name="hr_expense_ok" on_change="on_change_hr_expense_ok(hr_expense_ok)"/>
199                     <label for="hr_expense_ok"/>
200                 </div>
201             </field>
202         </record>
203
204         <record id="hr_expense_product" model="ir.actions.act_window">
205             <field name="name">Products</field>
206             <field name="res_model">product.product</field>
207             <field name="view_type">form</field>
208             <field name="view_mode">kanban,tree,form</field>
209             <field name="context">{"default_hr_expense_ok":1}</field>
210             <field name="domain">[('hr_expense_ok','=',True)]</field>
211             <field name="search_view_id" ref="product.product_search_form_view"/>
212         </record>
213
214         <menuitem id="menu_product_hr_config_expense" name="Expenses" parent="hr.menu_hr_configuration"/>
215         <menuitem id="menu_hr_product" name="Products" parent="menu_product_hr_config_expense" action="hr_expense_product"/>
216         <menuitem id="next_id_49" name="Expenses" sequence="15" parent="hr.menu_hr_root"/>
217         <menuitem action="expense_all" id="menu_expense_all" name="Expenses" parent="next_id_49"/>
218
219     </data>
220 </openerp>