[IMP] : removed button from tree
[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','=','normal'), ('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="date"/>
33                     <field name="user_id" invisible="1"/>
34                     <field name="name"/>
35                     <field name="currency_id"/>
36                     <field name="amount"/>
37                     <field name="state"/>
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="type">tree</field>
46             <field name="arch" type="xml">
47                 <tree colors="blue:state == 'draft';black:state in ('confirm','accepted','invoiced','paid');gray:state == 'cancelled'"  string="Expenses" editable="top">
48                     <field name="employee_id"/>
49                     <field name="date"/>
50                     <field name="department_id"/>
51                     <field name="ref"/>
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">
67                     <group colspan="4" col="6">
68                         <field name="employee_id" on_change="onchange_employee_id(employee_id)"/>
69                         <field name="name"/>
70                         <field name="ref"/>
71                         <field name="date"/>
72                         <field name="currency_id"/>
73                         <field name="department_id"/>
74                         <field name="company_id" groups="base.group_multi_company"/>
75                     </group>
76                     <notebook colspan="4">
77                         <page string="Description">
78                             <newline/>
79                             <field colspan="4" name="line_ids" nolabel="1" context="{'currency_id': currency_id}">
80                                 <form string="Expense Lines">
81                                     <group col="6" colspan="4">
82                                         <field name="product_id" on_change="onchange_product_id(product_id, uom_id, parent.employee_id, context)" context="{'default_hr_expense_ok':1}"/>
83                                         <field name="name" colspan="4"/>
84                                         <newline/>
85                                         <field name="unit_amount"/>
86                                         <field name="unit_quantity"/>
87                                         <field name="uom_id" on_change="onchange_product_id(product_id, uom_id, parent.employee_id, context)"/>
88                                     </group>
89                                     <group colspan="2" col="2" groups="analytic.group_analytic_accounting">
90                                         <separator string="Customer Project" colspan="2"/>
91                                         <field domain="[('type','=','normal')]" name="analytic_account"/>
92                                     </group>
93                                     <group colspan="2" col="2">
94                                         <separator string="References" colspan="2"/>
95                                         <field name="date_value" />
96                                         <field name="ref"/>
97                                     </group>
98                                 </form>
99                             </field>
100                             <field name="state" widget="statusbar" statusbar_visible="draft,confirm,accepted,invoiced" statusbar_colors='{"confirm":"blue","cancelled":"red"}'/>
101                             <group col="6" colspan="2">
102                                 <button name="draft" states="confirm,cancelled" string="Set to Draft" type="workflow" icon="gtk-convert" groups="base.group_hr_user"/>
103                                 <button name="refuse" states="confirm,accepted" string="Refuse" type="workflow" icon="gtk-no" groups="base.group_hr_user" />
104                                 <button name="confirm" states="draft" string="Submit to Manager" type="workflow" icon="gtk-apply"/>
105                                 <button name="invoice" states="accepted" string="Invoice" type="object" icon="gtk-go-forward" groups="base.group_hr_user"/>
106                                 <button name="validate" states="confirm" string="Approve" type="workflow" icon="gtk-go-forward" groups="base.group_hr_user"/>
107                             </group>
108                         </page>
109                         <page string="Other Info">
110                             <group col="2" colspan="2">
111                             <separator colspan="2" string="Accounting Data"/>
112                             <field name="journal_id"/>
113                             <field name="invoice_id" context="{'type':'in_invoice', 'journal_type': 'purchase'}"/>
114                             </group>
115                             <group col="2" colspan="2" groups="base.group_no_one">
116                                 <separator colspan="2" string="Validation"/>
117                                 <field name="date_confirm" readonly = "1"/>
118                                 <field name="date_valid" readonly = "1"/>
119                                 <field name="user_valid"/>
120                             </group>
121                             <separator colspan="4" string="Notes"/>
122                             <field colspan="4" name="note" nolabel="1"/>
123                         </page>
124                     </notebook>
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="type">search</field>
134             <field name="arch" type="xml">
135                 <search string="Expense">
136                     <group>
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"
139                         help="Confirmed Expense"/>
140                       <filter icon="terp-dolar" domain="[('state','=','accepted')]" string="To Pay"
141                         help="Expenses to Invoice"/>
142                       <separator orientation="vertical"/>
143                       <filter icon="terp-go-month" string="This Month" name="this"
144                               domain="[('date','&lt;=',(datetime.date.today()+relativedelta(day=31)).strftime('%%Y-%%m-%%d')),('date','&gt;=',(datetime.date.today()-relativedelta(day=1)).strftime('%%Y-%%m-%%d'))]"/>
145                       <separator orientation="vertical"/>
146                       <field name="employee_id"/>
147                       <field name="date"/>
148                       <field name="department_id" widget="selection" string="Department" context="{'invisible_department': False}">
149                    <filter icon="terp-personal+" context="{'invisible_department': False}" domain="[('department_id','=',context.get('department_id',False))]" help="My Department"/>
150                     </field>
151                       <field name="name"/>
152                       <field name="user_id"  string="User">
153                       <filter icon="terp-personal+" domain="[('department_id','=',context.get('department_id',False))]"
154                             string="Expenses of My Department"/>
155                       </field>
156                 </group>
157                 <newline />
158                 <group expand="0" string="Group By...">
159                     <filter string="Employee" icon="terp-personal" domain="[]" context="{'group_by':'employee_id'}"/>
160                     <separator orientation="vertical"/>
161                     <filter string="Department" icon="terp-personal+" domain="[]" context="{'group_by':'department_id'}"/>
162                     <separator orientation="vertical"/>
163                     <filter string="Month" icon="terp-go-month" domain="[]" context="{'group_by':'date'}"/>
164                 </group>
165                 </search>
166             </field>
167         </record>
168
169         <record id="expense_all" model="ir.actions.act_window">
170             <field name="name">Expenses</field>
171             <field name="res_model">hr.expense.expense</field>
172             <field name="view_type">form</field>
173             <field name="search_view_id" ref="view_hr_expense_filter"/>
174             <field name="view_id" ref="view_expenses_tree"/>
175             <field name="help">The OpenERP expenses management module allows you to track the full flow. Every month, the employees record their expenses. At the end of the month, their managers validates the expenses sheets which creates costs on projects/analytic accounts. The accountant validates the proposed entries and the employee can be reimbursed. You can also reinvoice the customer at the end of the flow.</field>
176         </record>
177
178         <menuitem id="next_id_49" name="Expenses" sequence="15" parent="hr.menu_hr_root"/>
179         <menuitem action="expense_all" id="menu_expense_all" name="Expenses" parent="next_id_49"/>
180
181         <record id="view_product_hr_expense_form" model="ir.ui.view">
182             <field name="name">product.product.expense.form</field>
183             <field name="model">product.product</field>
184             <field name="inherit_id" ref="product.product_normal_form_view"/>
185             <field name="type">form</field>
186             <field name="arch" type="xml">
187             <field name="purchase_ok" position="after">
188             <field name="hr_expense_ok" on_change="on_change_hr_expense_ok(hr_expense_ok)"/>
189             </field>
190             </field>
191         </record>
192
193     </data>
194 </openerp>