[IMP] hr*: rename model of config wizard to hr.config.settings
[odoo/odoo.git] / addons / hr_expense / hr_expense_view.xml
index cafe42f..66d2aa8 100644 (file)
             <field name="model">hr.expense.line</field>
             <field name="arch" type="xml">
                 <tree string="Expense Lines">
+                    <field name="sequence" invisible="1"/>
                     <field name="date_value"/>
                     <field name="name"/>
                     <field name="ref"/>
-                    <field domain="[('type','=','normal')]" name="analytic_account"/>
+                    <field domain="[('type','=','normal'), ('parent_id','!=',False)]" name="analytic_account" groups="analytic.group_analytic_accounting"/>
                     <field name="unit_amount"/>
                     <field name="unit_quantity"/>
-                    <field name="total_amount"/>
+                    <field name="total_amount" sum="Total"/>
                 </tree>
             </field>
         </record>
             <field name="type">tree</field>
             <field name="arch" type="xml">
                 <tree string="Expenses" colors="blue:state=='draft'">
-                    <field name="date"/>
                     <field name="employee_id"/>
-                    <field name="department_id" groups="base.group_extended"/>
-                    <field name="ref"/>
+                    <field name="date"/>
+                    <field name="user_id" invisible="1"/>
                     <field name="name"/>
+                    <field name="currency_id"/>
                     <field name="amount"/>
                     <field name="state"/>
                     <button name="confirm" states="draft" string="Confirm" type="workflow" icon="gtk-apply"/>
-                    <button name="refuse" states="confirm,draft,accepted" string="Refuse" type="workflow" icon="gtk-no"/>
+                    <button name="refuse" states="confirm,draft,accepted" string="Refuse" type="workflow" icon="gtk-no" groups="base.group_hr_user"/>
                 </tree>
             </field>
         </record>
             <field name="model">hr.expense.expense</field>
             <field name="type">tree</field>
             <field name="arch" type="xml">
-                <tree string="Expenses" editable="top">
-                    <field name="date"/>
+                <tree colors="blue:state == 'draft';black:state in ('confirm','accepted','invoiced','paid');gray:state == 'cancelled'"  string="Expenses" editable="top">
                     <field name="employee_id"/>
+                    <field name="date"/>
                     <field name="department_id" groups="base.group_extended"/>
                     <field name="ref"/>
                     <field name="name"/>
                     <field name="amount"/>
                     <field name="state"/>
                     <button name="confirm" states="draft" string="Confirm" type="workflow" icon="gtk-apply"/>
-                    <button name="refuse" states="confirm,draft,accepted" string="Refuse" type="workflow" icon="gtk-no"/>
+                    <button name="refuse" states="confirm,draft,accepted" string="Refuse" type="workflow" icon="gtk-no" groups="base.group_hr_user"/>
                 </tree>
             </field>
         </record>
             <field name="arch" type="xml">
                 <form string="Expenses Sheet">
                     <group colspan="4" col="6">
-                        <field name="name" select="1"/>
+                        <field name="employee_id" on_change="onchange_employee_id(employee_id)"/>
+                        <field name="name"/>
                         <field name="ref" groups="base.group_extended"/>
-                        <field name="date" select="1"/>
-                        <field name="amount"/>
+                        <field name="date"/>
                         <field name="currency_id"/>
                         <field name="department_id" groups="base.group_extended"/>
                         <field name="company_id" groups="base.group_multi_company"/>
                     </group>
                     <notebook colspan="4">
-                        <page string="Expense Sheet">
+                        <page string="Description">
                             <newline/>
-                            <field colspan="4" name="line_ids" nolabel="1">
+                            <field colspan="4" name="line_ids" nolabel="1" context="{'currency_id': currency_id}">
                                 <form string="Expense Lines">
-                                    <field name="product_id" on_change="onchange_product_id(product_id, uom_id, parent.employee_id)"/>
-                                    <field name="uom_id" on_change="onchange_product_id(product_id, uom_id, parent.employee_id)" widget="selection"/>
-                                    <field name="name" select="1"/>
-                                    <field name="date_value" select="1"/>
-                                    <field name="unit_quantity"/>
-                                    <field name="unit_amount"/>
-                                    <field name="ref"/>
-                                    <field name="sequence" groups="base.group_extended"/>
-                                    <field domain="[('type','=','normal')]" name="analytic_account" groups="base.group_extended"/>
-                                    <newline/>
-                                    <field name="total_amount"/>
+                                    <group col="6" colspan="4">
+                                        <field name="product_id" on_change="onchange_product_id(product_id, uom_id, parent.employee_id, context)"/>
+                                        <field name="name" colspan="4"/>
+                                        <newline/>
+                                        <field name="unit_amount"/>
+                                        <field name="unit_quantity"/>
+                                        <field name="uom_id" on_change="onchange_product_id(product_id, uom_id, parent.employee_id, context)"/>
+                                    </group>
+                                    <group colspan="2" col="2" groups="analytic.group_analytic_accounting">
+                                        <separator string="Customer Project" colspan="2"/>
+                                        <field domain="[('type','=','normal')]" name="analytic_account"/>
+                                    </group>
+                                    <group colspan="2" col="2">
+                                        <separator string="References" colspan="2"/>
+                                        <field name="date_value" />
+                                        <field name="ref"/>
+                                    </group>
                                 </form>
                             </field>
-                            <field name="state"/>
+                            <field name="state" widget="statusbar" statusbar_visible="draft,confirm,accepted,invoiced" statusbar_colors='{"confirm":"blue","cancelled":"red"}'/>
                             <group col="6" colspan="2">
-                                <button name="confirm" states="draft" string="Confirm" type="workflow" icon="gtk-apply"/>
-                                <button name="cancel" states="cancel" string="Cancel" type="workflow" icon="gtk-cancel"/>
-                                <button name="validate" states="confirm" string="Accept" type="workflow" icon="gtk-ok"/>
-                                <button name="invoice" states="accepted" string="Invoice" type="workflow" icon="gtk-execute"/>
-                                <button name="draft" states="confirm,cancelled" string="Set to Draft" type="workflow" icon="gtk-convert"/>
-                                <button name="refuse" states="confirm,draft,accepted" string="Refuse" type="workflow" icon="gtk-no"/>
+                                <button name="draft" states="confirm,cancelled" string="Set to Draft" type="workflow" icon="gtk-convert" groups="base.group_hr_user"/>
+                                <button name="refuse" states="confirm,accepted" string="Refuse" type="workflow" icon="gtk-no" groups="base.group_hr_user" />
+                                <button name="confirm" states="draft" string="Submit to Manager" type="workflow" icon="gtk-apply"/>
+                                <button name="invoice" states="accepted" string="Invoice" type="object" icon="gtk-go-forward" groups="base.group_hr_user"/>
+                                <button name="validate" states="confirm" string="Approve" type="workflow" icon="gtk-go-forward" groups="base.group_hr_user"/>
                             </group>
                         </page>
                         <page string="Other Info" groups="base.group_extended">
-                            <separator colspan="4" string="Accounting data"/>
+                            <group col="2" colspan="2">
+                            <separator colspan="2" string="Accounting data"/>
                             <field name="journal_id"/>
-                            <separator colspan="4" string="Validation"/>
-                            <field name="date_confirm" readonly = "1"/>
-                            <field name="date_valid" readonly = "1"/>
-                            <field name="user_valid"/>
-                            <field name="invoice_id"/>
+                            <field name="invoice_id" context="{'type':'in_invoice', 'journal_type': 'purchase'}"/>
+                            </group>
+                            <group col="2" colspan="2" groups="base.group_no_one">
+                                <separator colspan="2" string="Validation"/>
+                                <field name="date_confirm" readonly = "1"/>
+                                <field name="date_valid" readonly = "1"/>
+                                <field name="user_valid"/>
+                            </group>
                             <separator colspan="4" string="Notes"/>
                             <field colspan="4" name="note" nolabel="1"/>
                         </page>
             <field name="arch" type="xml">
                 <search string="Expense">
                     <group>
-                      <filter
-                        icon="terp-document-new"
-                        domain="[('state','=','draft')]"
-                        string="Draft"
-                        help="Draft Expense"/>
-                      <separator orientation="vertical"/>
-                      <filter
-                        icon="terp-gtk-go-back-rtl"
-                        domain="[('state','=','confirm')]"
-                        string="To Validate"
+                      <filter icon="terp-document-new" domain="[('state','=','draft')]" string="New" help="New Expense"/>
+                      <filter icon="terp-camera_test" domain="[('state','=','confirm')]" string="To Approve"
                         help="Confirmed Expense"/>
-                      <filter
-                        icon="terp-gtk-go-back-rtl"
-                        domain="[('state','=','accepted')]"
-                        string="To Pay"
+                      <filter icon="terp-dolar" domain="[('state','=','accepted')]" string="To Pay"
                         help="Expenses to Invoice"/>
                       <separator orientation="vertical"/>
-                      <field name="name" select='1'/>
-                      <field name="date" select='1'/>
-                      <field name="user_id" select="1" string="User">
-                      <filter icon="terp-personal+"
-                            domain="[('department_id','=',context.get('department_id',False))]"
+                      <filter icon="terp-go-month" string="This Month" name="this"
+                              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'))]"/>
+                      <separator orientation="vertical"/>
+                      <field name="employee_id"/>
+                      <field name="date"/>
+                      <field name="department_id" widget="selection" string="Department" context="{'invisible_department': False}">
+                   <filter icon="terp-personal+" context="{'invisible_department': False}" domain="[('department_id','=',context.get('department_id',False))]" help="My Department"/>
+                    </field>
+                      <field name="name"/>
+                      <field name="user_id"  string="User">
+                      <filter icon="terp-personal+" domain="[('department_id','=',context.get('department_id',False))]"
                             string="Expenses of My Department"/>
                       </field>
-                      <field name="department_id" widget="selection" groups="base.group_extended"/>
                 </group>
                 <newline />
                 <group expand="0" string="Group By...">
+                    <filter string="Employee" icon="terp-personal" domain="[]" context="{'group_by':'employee_id'}"/>
+                    <separator orientation="vertical"/>
                     <filter string="Department" icon="terp-personal+" domain="[]" context="{'group_by':'department_id'}"/>
-                    <filter string="User" icon="terp-personal" domain="[]" context="{'group_by':'user_id'}"/>
                     <separator orientation="vertical"/>
                     <filter string="Month" icon="terp-go-month" domain="[]" context="{'group_by':'date'}"/>
                 </group>
             <field name="name">Expenses</field>
             <field name="res_model">hr.expense.expense</field>
             <field name="view_type">form</field>
-            <field name="context">{"search_default_user_id":uid}</field>
             <field name="search_view_id" ref="view_hr_expense_filter"/>
+            <field name="view_id" ref="view_expenses_tree"/>
+            <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>
         </record>
 
-        <menuitem id="next_id_49" name="Expenses" sequence="8"
-           parent="hr.menu_hr_root"/>
-
-        <menuitem action="expense_all" id="menu_expense_all" name="Expenses"
-           parent="next_id_49" groups="hr.group_hr_manager"/>
+        <menuitem id="next_id_49" name="Expenses" sequence="15" parent="hr.menu_hr_root"/>
+        <menuitem action="expense_all" id="menu_expense_all" name="Expenses" parent="next_id_49"/>
 
         <record id="view_product_hr_expense_form" model="ir.ui.view">
-         <field name="name">product.product.expense.form</field>
-         <field name="model">product.product</field>
-         <field name="inherit_id" ref="product.product_normal_form_view"/>
-         <field name="type">form</field>
-         <field name="arch" type="xml">
+            <field name="name">product.product.expense.form</field>
+            <field name="model">product.product</field>
+            <field name="inherit_id" ref="product.product_normal_form_view"/>
+            <field name="type">form</field>
+            <field name="arch" type="xml">
             <field name="purchase_ok" position="after">
-               <field name="hr_expense_ok"/>
+            <field name="hr_expense_ok" on_change="on_change_hr_expense_ok(hr_expense_ok)"/>
             </field>
-         </field>
-      </record>
+            </field>
+        </record>
 
     </data>
 </openerp>