[MERGE] merge with main addons
[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="type">tree</field>
10             <field name="model">hr.expense.line</field>
11             <field name="arch" type="xml">
12                 <tree string="Expense Lines">
13                     <field name="sequence" invisible="1"/>
14                     <field name="date_value"/>
15                     <field name="name"/>
16                     <field name="ref"/>
17                     <field domain="[('type','in',['normal','contract']), ('parent_id','!=',False)]" name="analytic_account" groups="analytic.group_analytic_accounting"/>
18                     <field name="unit_amount"/>
19                     <field name="unit_quantity"/>
20                     <field name="total_amount" sum="Total"/>
21                 </tree>
22             </field>
23         </record>
24
25         <record id="view_expenses_tree" model="ir.ui.view">
26             <field name="name">hr.expense.expense.tree</field>
27             <field name="model">hr.expense.expense</field>
28             <field name="type">tree</field>
29             <field name="arch" type="xml">
30                 <tree string="Expenses" colors="blue:state=='draft'">
31                     <field name="employee_id"/>
32                     <field name="department_id" invisible="1"/>
33                     <field name="date"/>
34                     <field name="user_id" invisible="1"/>
35                     <field name="name"/>
36                     <field name="currency_id"/>
37                     <field name="amount"/>
38                     <field name="state"/>
39                 </tree>
40             </field>
41         </record>
42
43         <record id="view_editable_expenses_tree" model="ir.ui.view">
44             <field name="name">hr.expense.expense.tree</field>
45             <field name="model">hr.expense.expense</field>
46             <field name="type">tree</field>
47             <field name="arch" type="xml">
48                 <tree colors="blue:state == 'draft';black:state in ('confirm','accepted','done');gray:state == 'cancelled'"  string="Expenses" editable="top">
49                     <field name="employee_id"/>
50                     <field name="date"/>
51                     <field name="department_id"/>
52                     <field name="name"/>
53                     <field name="amount"/>
54                     <field name="state"/>
55                     <button name="confirm" states="draft" string="Confirm" type="workflow" icon="gtk-apply"/>
56                     <button name="refuse" states="confirm,draft,accepted" string="Refuse" type="workflow" icon="gtk-no" groups="base.group_hr_user"/>
57                 </tree>
58             </field>
59         </record>
60
61         <record id="view_expenses_form" model="ir.ui.view">
62             <field name="name">hr.expense.form</field>
63             <field name="type">form</field>
64             <field name="model">hr.expense.expense</field>
65             <field name="arch" type="xml">
66                 <form string="Expenses Sheet" version="7.0">
67                 <header>
68                     <button name="confirm" states="draft" string="Submit to Manager" type="workflow" class="oe_highlight"/>
69                     <button name="validate" states="confirm" string="Approve" type="workflow" groups="base.group_hr_user" class="oe_highlight"/>
70                     <button name="draft" states="confirm,cancelled" string="Set to Draft" type="workflow" groups="base.group_hr_user" />
71                     <button name="done" states="accepted" string="Generate Account Entry" type="workflow" groups="account.group_account_invoice" class="oe_highlight"/>
72                     <button name="action_view_receipt" states="done" string="Open Receipt" type="object"/>
73                     <button name="refuse" states="confirm,accepted" string="Refuse" type="workflow" groups="base.group_hr_user" />
74                     <field name="state" widget="statusbar" statusbar_visible="draft,confirm,accepted,done" statusbar_colors='{"confirm":"blue","cancelled":"red"}'/>
75                 </header>
76                 <sheet>
77                     <group>
78                         <group>
79                             <field name="employee_id" on_change="onchange_employee_id(employee_id)"/>
80                             <field name="date"/>
81                             <field name="department_id"/>
82                             <field name="company_id" groups="base.group_multi_company"/>
83                         </group>
84                         <group>
85                             <field name="name"/>
86                             <field name="user_valid"/>
87                             <field name="currency_id"/>
88                         </group>
89                     </group>
90                     <notebook>
91                         <page string="Description">
92                             <field name="line_ids" context="{'currency_id': currency_id}">
93                                 <form string="Expense Lines" version="7.0">
94                                     <group>
95                                         <group>
96                                             <field name="product_id" on_change="onchange_product_id(product_id, uom_id, parent.employee_id, context)" context="{'default_hr_expense_ok':1}"/>
97                                             <field name="name"/>
98                                             <field name="ref"/>
99                                             <field domain="[('type','=','normal')]" name="analytic_account" groups="analytic.group_analytic_accounting"/>
100                                         </group>
101                                         <group>
102                                             <field name="unit_amount"/>
103                                             <label for="unit_quantity"/>
104                                             <div>
105                                                 <field name="unit_quantity" class="oe_inline"/> 
106                                                 <field name="uom_id" on_change="onchange_product_id(product_id, uom_id, parent.employee_id, context)" class="oe_inline"/>
107                                             </div>
108                                             <field name="date_value" />
109                                         </group>
110                                     </group>
111                                 </form>
112                             </field>
113                             <group>
114                                 <div>
115                                     <separator string="Notes"/>
116                                     <field name="note" placeholder="Free Notes"/>
117                                 </div>
118                                 <group class="oe_subtotal_footer">
119                                     <field name="amount"/>
120                                 </group>
121                             </group>
122                         </page>
123                         <page string="Other Info">
124                             <group>
125                                 <group string="Accounting Data">
126                                     <field name="journal_id" widget="selection" domain="[('type', 'in', ('purchase','purchase_refund'))]"/>
127                                     <field name="voucher_id" context="{'form_view_ref': 'account_voucher.view_purchase_receipt_form'}"/>
128                                 </group>
129                             </group>
130                         </page>
131                     </notebook>
132                 </sheet>
133                 <div class="oe_chatter">
134                     <field name="message_ids" widget="mail_thread"/>
135                 </div>
136                 </form>
137             </field>
138         </record>
139
140
141         <record id="view_hr_expense_filter" model="ir.ui.view">
142             <field name="name">hr.expense.expense.filter</field>
143             <field name="model">hr.expense.expense</field>
144             <field name="type">search</field>
145             <field name="arch" type="xml">
146                 <search string="Expense">
147                     <group>
148                       <field name="name" string="Expenses"/>
149                       <separator orientation="vertical"/>
150                       <field name="date"/>
151                       <separator orientation="vertical"/>
152                       <filter icon="terp-document-new" domain="[('state','=','draft')]" string="New" help="New Expense"/>
153                       <filter icon="terp-camera_test" domain="[('state','=','confirm')]" string="To Approve" help="Confirmed Expense"/>
154                       <filter icon="terp-dolar" domain="[('state','=','accepted')]" string="To Pay" help="Expenses to Invoice"/>
155                       <separator orientation="vertical"/>
156                       <field name="employee_id"/>
157                       <field name="department_id" widget="selection" string="Department" context="{'invisible_department': False}"/>
158                       <field name="user_id"  string="User"/>
159                 </group>
160                 <newline />
161                 <group expand="0" string="Group By...">
162                     <filter string="Employee" icon="terp-personal" domain="[]" context="{'group_by':'employee_id'}"/>
163                     <separator orientation="vertical"/>
164                     <filter string="Department" icon="terp-personal+" domain="[]" context="{'group_by':'department_id'}"/>
165                     <separator orientation="vertical"/>
166                     <filter string="Month" icon="terp-go-month" domain="[]" context="{'group_by':'date'}"/>
167                 </group>
168                 </search>
169             </field>
170         </record>
171
172         <record id="expense_all" model="ir.actions.act_window">
173             <field name="name">Expenses</field>
174             <field name="res_model">hr.expense.expense</field>
175             <field name="view_type">form</field>
176             <field name="search_view_id" ref="view_hr_expense_filter"/>
177             <field name="view_id" ref="view_expenses_tree"/>
178             <field name="help">
179                 Click here to create a new expense.
180                 &lt;p&gt;
181                 After validation of your expense, you will be able to re-invoice costs to your customers.
182             </field>
183         </record>
184
185         <menuitem id="next_id_49" name="Expenses" sequence="15" parent="hr.menu_hr_root"/>
186         <menuitem action="expense_all" id="menu_expense_all" name="Expenses" parent="next_id_49"/>
187
188         <record id="view_product_hr_expense_form" model="ir.ui.view">
189             <field name="name">product.product.expense.form</field>
190             <field name="model">product.product</field>
191             <field name="inherit_id" ref="product.product_normal_form_view"/>
192             <field name="type">form</field>
193             <field name="arch" type="xml">
194             <field name="purchase_ok" position="after">
195             <field name="hr_expense_ok" on_change="on_change_hr_expense_ok(hr_expense_ok)"/>
196             </field>
197             </field>
198         </record>
199
200     </data>
201 </openerp>