add message_followers_ids
[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"/>
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','invoiced','paid');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="invoice" states="accepted" string="Invoice" type="object" 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                     <field name="state" widget="statusbar" statusbar_visible="draft,confirm,accepted" statusbar_colors='{"confirm":"blue","cancelled":"red"}'/>
70                 </header>
71                 <sheet>
72                     <group>
73                         <group>
74                             <field name="employee_id" on_change="onchange_employee_id(employee_id)"/>
75                             <field name="date"/>
76                             <field name="department_id"/>
77                             <field name="company_id" groups="base.group_multi_company"/>
78                         </group>
79                         <group>
80                             <field name="name"/>
81                             <field name="user_valid"/>
82                             <field name="currency_id"/>
83                         </group>
84                     </group>
85                     <notebook>
86                         <page string="Description">
87                             <field name="line_ids" context="{'currency_id': currency_id}">
88                                 <form string="Expense Lines" version="7.0">
89                                     <group>
90                                         <group>
91                                             <field name="product_id" on_change="onchange_product_id(product_id, uom_id, parent.employee_id, context)" context="{'default_hr_expense_ok':1}"/>
92                                             <field name="name"/>
93                                             <field name="ref"/>
94                                             <field domain="[('type','=','normal')]" name="analytic_account" groups="analytic.group_analytic_accounting"/>
95                                         </group>
96                                         <group>
97                                             <field name="unit_amount"/>
98                                             <label for="unit_quantity"/>
99                                             <div>
100                                                 <field name="unit_quantity" class="oe_inline"/> 
101                                                 <field name="uom_id" on_change="onchange_product_id(product_id, uom_id, parent.employee_id, context)" class="oe_inline"/>
102                                             </div>
103                                             <field name="date_value" />
104                                         </group>
105                                     </group>
106                                 </form>
107                             </field>
108                             <separator string="Notes"/>
109                             <field name="note" placeholder="Free Notes"/>
110                         </page>
111                         <page string="Other Info">
112                             <group>
113                                 <group string="Accounting Data">
114                                     <field name="journal_id"/>
115                                     <field name="invoice_id" context="{'type':'in_invoice', 'journal_type': 'purchase'}"/>
116                                 </group>
117                             </group>
118                         </page>
119                     </notebook>
120                 </sheet>
121                 <div class="oe_chatter">
122                     <field name="message_ids" widget="mail_thread"/>
123                     <field name="message_follower_ids" widget="mail_followers"/>
124                 </div>
125                 </form>
126             </field>
127         </record>
128
129
130         <record id="view_hr_expense_filter" model="ir.ui.view">
131             <field name="name">hr.expense.expense.filter</field>
132             <field name="model">hr.expense.expense</field>
133             <field name="arch" type="xml">
134                 <search string="Expense">
135                     <field name="name" string="Expenses"/>
136                     <field name="date"/>
137                     <filter icon="terp-document-new" domain="[('state','=','draft')]" string="New" help="New Expense"/>
138                     <filter icon="terp-camera_test" domain="[('state','=','confirm')]" string="To Approve" help="Confirmed Expense"/>
139                     <filter icon="terp-dolar" domain="[('state','=','accepted')]" string="To Pay" help="Expenses to Invoice"/>
140                     <field name="employee_id"/>
141                     <field name="department_id" string="Department" context="{'invisible_department': False}"/>
142                     <field name="user_id"  string="User"/>
143                     <group expand="0" string="Group By...">
144                         <filter string="Employee" icon="terp-personal" domain="[]" context="{'group_by':'employee_id'}"/>
145                         <filter string="Department" icon="terp-personal+" domain="[]" context="{'group_by':'department_id'}"/>
146                         <filter string="Month" icon="terp-go-month" domain="[]" context="{'group_by':'date'}"/>
147                     </group>
148                 </search>
149             </field>
150         </record>
151
152         <record id="expense_all" model="ir.actions.act_window">
153             <field name="name">Expenses</field>
154             <field name="res_model">hr.expense.expense</field>
155             <field name="view_type">form</field>
156             <field name="search_view_id" ref="view_hr_expense_filter"/>
157             <field name="view_id" ref="view_expenses_tree"/>
158             <field name="help" type="html">
159               <p class="oe_view_nocontent_create">
160                 Click to register new expenses. 
161               </p><p>
162                 OpenERP will ensure the whole process is followed; the expense
163                 sheet is validated by manager(s), the employee is reimbursed
164                 from his expenses, some expenses must be re-invoiced to the
165                 customers.
166               </p>
167             </field>
168         </record>
169
170         <menuitem id="next_id_49" name="Expenses" sequence="15" parent="hr.menu_hr_root"/>
171         <menuitem action="expense_all" id="menu_expense_all" name="Expenses" parent="next_id_49"/>
172
173         <record id="view_product_hr_expense_form" model="ir.ui.view">
174             <field name="name">product.product.expense.form</field>
175             <field name="model">product.product</field>
176             <field name="inherit_id" ref="product.product_normal_form_view"/>
177             <field name="arch" type="xml">
178             <field name="purchase_ok" position="after">
179             <field name="hr_expense_ok" on_change="on_change_hr_expense_ok(hr_expense_ok)"/>
180             </field>
181             </field>
182         </record>
183
184     </data>
185 </openerp>