[FIX] Chatter: fixed suggested recipients, when having no email, unchecking the box...
[odoo/odoo.git] / addons / hr_expense / hr_expense_view.xml
index 36ebd20..0793168 100644 (file)
@@ -6,7 +6,6 @@
 
         <record id="view_expenses_line_tree" model="ir.ui.view">
             <field name="name">hr.expense.line.tree</field>
-            <field name="type">tree</field>
             <field name="model">hr.expense.line</field>
             <field name="arch" type="xml">
                 <tree string="Expense Lines">
@@ -25,7 +24,6 @@
         <record id="view_expenses_tree" model="ir.ui.view">
             <field name="name">hr.expense.expense.tree</field>
             <field name="model">hr.expense.expense</field>
-            <field name="type">tree</field>
             <field name="arch" type="xml">
                 <tree string="Expenses" colors="blue:state=='draft'">
                     <field name="employee_id"/>
@@ -33,8 +31,8 @@
                     <field name="date"/>
                     <field name="user_id" invisible="1"/>
                     <field name="name"/>
-                    <field name="currency_id"/>
-                    <field name="amount"/>
+                    <field name="currency_id" groups="base.group_multi_currency"/>
+                    <field name="amount" sum="Total Amount"/>
                     <field name="state"/>
                 </tree>
             </field>
@@ -43,9 +41,8 @@
         <record id="view_editable_expenses_tree" model="ir.ui.view">
             <field name="name">hr.expense.expense.tree</field>
             <field name="model">hr.expense.expense</field>
-            <field name="type">tree</field>
             <field name="arch" type="xml">
-                <tree colors="blue:state == 'draft';black:state in ('confirm','accepted','invoiced','paid');gray:state == 'cancelled'"  string="Expenses" editable="top">
+                <tree colors="blue:state == 'draft';black:state in ('confirm','accepted','done');gray:state == 'cancelled'"  string="Expenses" editable="top">
                     <field name="employee_id"/>
                     <field name="date"/>
                     <field name="department_id"/>
 
         <record id="view_expenses_form" model="ir.ui.view">
             <field name="name">hr.expense.form</field>
-            <field name="type">form</field>
             <field name="model">hr.expense.expense</field>
+            <field eval="25" name="priority"/>
             <field name="arch" type="xml">
                 <form string="Expenses Sheet" version="7.0">
                 <header>
                     <button name="confirm" states="draft" string="Submit to Manager" type="workflow" class="oe_highlight"/>
                     <button name="validate" states="confirm" string="Approve" type="workflow" groups="base.group_hr_user" class="oe_highlight"/>
-                    <button name="draft" states="confirm,cancelled" string="Set to Draft" type="workflow" groups="base.group_hr_user" />
-                    <button name="invoice" states="accepted" string="Invoice" type="object" groups="base.group_hr_user" class="oe_highlight"/>
                     <button name="refuse" states="confirm,accepted" string="Refuse" type="workflow" groups="base.group_hr_user" />
-                    <field name="state" widget="statusbar" statusbar_visible="draft,confirm,accepted" statusbar_colors='{"confirm":"blue","cancelled":"red"}'/>
+                    <button name="draft" states="confirm,cancelled" string="Set to Draft" type="workflow" groups="base.group_hr_user" />
+                    <button name="done" states="accepted" string="Generate Accounting Entries" type="workflow" groups="account.group_account_invoice" class="oe_highlight"/>
+                    <button name="action_view_receipt" states="done" string="Open Accounting Entries" type="object" groups="account.group_account_invoice"/>
+                    <field name="state" widget="statusbar" statusbar_visible="draft,confirm,accepted,done,paid" statusbar_colors='{"confirm":"blue","cancelled":"red"}'/>
                 </header>
                 <sheet>
                     <group>
                         </group>
                         <group>
                             <field name="name"/>
-                            <field name="user_valid"/>
-                            <field name="currency_id"/>
+                            <field name="user_valid" attrs="{'invisible': [('state','=','draft')]}"/>
+                            <field name="currency_id" groups="base.group_multi_currency" on_change="onchange_currency_id(currency_id, company_id)"/>
                         </group>
                     </group>
                     <notebook>
                         <page string="Description">
-                            <field name="line_ids" context="{'currency_id': currency_id}">
+                            <field name="line_ids" context="{'currency_id': currency_id, 'default_analytic_account': context.get('analytic_account')}">
                                 <form string="Expense Lines" version="7.0">
                                     <group>
                                         <group>
-                                            <field name="product_id" on_change="onchange_product_id(product_id, uom_id, parent.employee_id, context)" context="{'default_hr_expense_ok':1}"/>
+                                            <field name="product_id" on_change="onchange_product_id(product_id, context)" context="{'default_hr_expense_ok':1}"/>
                                             <field name="name"/>
                                             <field name="ref"/>
                                             <field domain="[('type','=','normal')]" name="analytic_account" groups="analytic.group_analytic_accounting"/>
                                             <label for="unit_quantity"/>
                                             <div>
                                                 <field name="unit_quantity" class="oe_inline"/> 
-                                                <field name="uom_id" on_change="onchange_product_id(product_id, uom_id, parent.employee_id, context)" class="oe_inline"/>
+                                                <field name="uom_id" on_change="onchange_uom(product_id, uom_id, context)" class="oe_inline"/>
                                             </div>
                                             <field name="date_value" />
                                         </group>
                                     </group>
                                 </form>
+                                <tree string="Expense Lines" editable="bottom">
+                                    <field name="sequence" invisible="1"/>
+                                    <field name="product_id" on_change="onchange_product_id(product_id, context)" context="{'default_hr_expense_ok':1}"/>
+                                    <field name="date_value" string="Expense Date"/>
+                                    <field name="name"/>
+                                    <field name="ref"/>
+                                    <field domain="[('type','in',['normal','contract'])]" name="analytic_account" groups="analytic.group_analytic_accounting"/>
+                                    <field name="uom_id" on_change="onchange_uom(product_id, uom_id, context)"/>
+                                    <field name="unit_amount"/>
+                                    <field name="unit_quantity"/>
+                                    <field name="total_amount" sum="Total"/>
+                                </tree>
                             </field>
-                            <separator string="Notes"/>
-                            <field name="note" placeholder="Free Notes"/>
+                            <group>
+                                <div>
+                                    <separator string="Notes"/>
+                                    <field name="note" placeholder="Free Notes"/>
+                                </div>
+                                <group class="oe_subtotal_footer oe_right">
+                                    <field name="amount" widget="monetary" options="{'currency_field': 'currency_id'}" class="oe_subtotal_footer_separator"/>
+                                </group>
+                            </group>
                         </page>
-                        <page string="Other Info">
+                        <page string="Accounting" groups="account.group_account_user">
                             <group>
                                 <group string="Accounting Data">
-                                    <field name="journal_id"/>
-                                    <field name="invoice_id" context="{'type':'in_invoice', 'journal_type': 'purchase'}"/>
+                                    <field name="journal_id" widget="selection" domain="[('type', '=', 'purchase')]"/>
+                                    <field name="account_move_id"/>
+                                    <field name="voucher_id" invisible="1" context="{'form_view_ref': 'account_voucher.view_purchase_receipt_form'}"/>
                                 </group>
                             </group>
                         </page>
                     </notebook>
                 </sheet>
                 <div class="oe_chatter">
+                    <field name="message_follower_ids" widget="mail_followers"/>
                     <field name="message_ids" widget="mail_thread"/>
                 </div>
                 </form>
         <record id="view_hr_expense_filter" model="ir.ui.view">
             <field name="name">hr.expense.expense.filter</field>
             <field name="model">hr.expense.expense</field>
-            <field name="type">search</field>
             <field name="arch" type="xml">
                 <search string="Expense">
-                    <group>
-                      <field name="name" string="Expenses"/>
-                      <separator orientation="vertical"/>
-                      <field name="date"/>
-                      <separator orientation="vertical"/>
-                      <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-dolar" domain="[('state','=','accepted')]" string="To Pay" help="Expenses to Invoice"/>
-                      <separator orientation="vertical"/>
-                      <field name="employee_id"/>
-                      <field name="department_id" widget="selection" string="Department" context="{'invisible_department': False}"/>
-                      <field name="user_id"  string="User"/>
-                </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'}"/>
-                    <separator orientation="vertical"/>
-                    <filter string="Month" icon="terp-go-month" domain="[]" context="{'group_by':'date'}"/>
-                </group>
+                    <field name="name" string="Expenses"/>
+                    <field name="date"/>
+                    <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 Expenses"/>
+                    <filter icon="terp-dolar" domain="[('state','=','accepted')]" string="To Pay" help="Expenses to Invoice"/>
+                    <separator/>
+                    <filter domain="[('user_id', '=', uid)]" string="My Expenses"/>
+                    <field name="employee_id"/>
+                    <field name="department_id" string="Department" context="{'invisible_department': False}"/>
+                    <group expand="0" string="Group By...">
+                        <filter string="Employee" icon="terp-personal" domain="[]" context="{'group_by':'employee_id'}"/>
+                        <filter string="Department" icon="terp-personal+" domain="[]" context="{'group_by':'department_id'}"/>
+                        <filter string="Month" icon="terp-go-month" domain="[]" context="{'group_by':'date'}"/>
+                    </group>
                 </search>
             </field>
         </record>
             <field name="view_type">form</field>
             <field name="search_view_id" ref="view_hr_expense_filter"/>
             <field name="view_id" ref="view_expenses_tree"/>
-            <field name="help">
-                Click here to create a new expense.
-                &lt;p&gt;
-                After validation of your expense, you will be able to re-invoice costs to your customers.
+            <field name="help" type="html">
+              <p class="oe_view_nocontent_create">
+                Click to register new expenses. 
+              </p><p>
+                OpenERP will ensure the whole process is followed; the expense
+                sheet is validated by manager(s), the employee is reimbursed
+                from his expenses, some expenses must be re-invoiced to the
+                customers.
+              </p>
             </field>
         </record>
 
-        <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="purchase_ok" position="after">
-            <field name="hr_expense_ok" on_change="on_change_hr_expense_ok(hr_expense_ok)"/>
-            </field>
+                <div name="options" position="inside">
+                    <field name="hr_expense_ok"/>
+                    <label for="hr_expense_ok"/>
+                </div>
             </field>
         </record>
 
+        <record id="hr_expense_product" model="ir.actions.act_window">
+            <field name="name">Products</field>
+            <field name="res_model">product.product</field>
+            <field name="view_type">form</field>
+            <field name="view_mode">kanban,tree,form</field>
+            <field name="context">{"default_hr_expense_ok":1}</field>
+            <field name="domain">[('hr_expense_ok','=',True)]</field>
+            <field name="search_view_id" ref="product.product_search_form_view"/>
+        </record>
+
+        <menuitem id="menu_hr_product" name="Expense Categories" parent="hr.menu_hr_configuration" action="hr_expense_product"/>
+        <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"/>
+
     </data>
 </openerp>