Files
odoo-usability/hr_expense_usability/hr_expense_view.xml
Stéphane Bidoul (ACSONE) 55d977914e [10.0] hr_expense_usability improvements (#37)
* [FIX] hr_expense_usability: set default move number

Otherwise it's not possible to post the account move.

* [FIX] hr_expense_usability: prevent deleting draft move

This prevents deleting a draft account move that is linked
to an expense. Without this the expense could stay in posted
while the related move has been deleted, which is inconsitent
and impossible to recover for the user.

* [IMP] hr_expense_usability: preserve product/quantity on move line

When possible, preserve product and quantity on move line. This is
important when generating analytic lines to reinvoice expenses

* add contributor

* [FIX] hr_expense_usability: readonly account move on expense sheet

* [IMP] hr_expense_usablility: preserve employee name in move line name

This is important when reinvoicing expenses, so the correct label
is visible on the sale order.
2017-07-01 14:39:08 +02:00

169 lines
7.2 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!--
© 2014-2017 Akretion (http://www.akretion.com)
@author: Alexis de Lattre <alexis.delattre@akretion.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
<odoo>
<record id="hr_expense_form_view" model="ir.ui.view">
<field name="name">usability.hr.expense.form</field>
<field name="model">hr.expense</field>
<field name="inherit_id" ref="hr_expense.hr_expense_form_view"/>
<field name="arch" type="xml">
<label for="payment_mode" position="attributes">
<attribute name="invisible">1</attribute>
</label>
<field name="payment_mode" position="attributes">
<attribute name="invisible">1</attribute>
</field>
<field name="tax_ids" position="attributes">
<attribute name="groups"></attribute>
<attribute name="domain">[('type_tax_use', '=', 'purchase'), ('price_include', '=', True)]</attribute>
</field>
<field name="total_amount" position="before">
<field name="untaxed_amount_usability"/>
<field name="tax_amount"/>
</field>
<xpath expr="//field[@name='total_amount']/.." position="after">
<group name="company_currency">
<field name="company_currency_id" invisible="1"/>
<field name="untaxed_amount_company_currency"
groups="account.group_account_user"/>
<field name="total_amount_company_currency"/>
</group>
</xpath>
</field>
</record>
<record id="view_expenses_tree" model="ir.ui.view">
<field name="name">usability.hr.expense.tree</field>
<field name="model">hr.expense</field>
<field name="inherit_id" ref="hr_expense.view_expenses_tree"/>
<field name="arch" type="xml">
<field name="total_amount" position="attributes">
<attribute name="sum"></attribute>
</field>
<field name="total_amount" position="after">
<field name="total_amount_company_currency" sum="Total"/>
<field name="company_currency_id" invisible="1"/>
</field>
</field>
</record>
<record id="hr_expense_view_pivot" model="ir.ui.view">
<field name="name">usability.hr.expense.pivot</field>
<field name="model">hr.expense</field>
<field name="inherit_id" ref="hr_expense.hr_expense_view_pivot"/>
<field name="arch" type="xml">
<field name="total_amount" position="replace">
<field name="total_amount_company_currency" type="measure"/>
</field>
<field name="create_date" position="replace">
<field name="date" interval="month" type="col"/>
</field>
</field>
</record>
<record id="hr_expense_view_graph" model="ir.ui.view">
<field name="name">usability.hr.expense.graph</field>
<field name="model">hr.expense</field>
<field name="inherit_id" ref="hr_expense.hr_expense_view_graph"/>
<field name="arch" type="xml">
<field name="total_amount" position="replace">
<field name="total_amount_company_currency" type="measure"/>
</field>
<field name="create_date" position="replace">
<field name="date" interval="month" type="col"/>
</field>
</field>
</record>
<record id="view_hr_expense_sheet_form" model="ir.ui.view">
<field name="name">usability.hr.expense.sheet.form</field>
<field name="model">hr.expense.sheet</field>
<field name="inherit_id" ref="hr_expense.view_hr_expense_sheet_form"/>
<field name="arch" type="xml">
<field name="payment_mode" position="attributes">
<attribute name="invisible">1</attribute>
</field>
<field name="company_id" position="after">
<field name="untaxed_amount_company_currency" groups="account.group_account_user"/>
<field name="tax_amount_company_currency" groups="account.group_account_user"/>
<field name="total_amount_company_currency"/>
<field name="company_currency_id" invisible="1"/>
</field>
<xpath expr="//field[@name='expense_line_ids']/tree/field[@name='total_amount']" position="after">
<field name="currency_id" invisible="1"/>
<field name="company_currency_id" invisible="1"/>
<field name="untaxed_amount_company_currency" sum="Untaxed Total"/>
<field name="tax_amount_company_currency" sum="Tax Total"/>
<field name="total_amount_company_currency" sum="Total"/>
</xpath>
<xpath expr="//field[@name='expense_line_ids']/tree/field[@name='total_amount']" position="attributes">
<attribute name="sum"></attribute>
</xpath>
<xpath expr="//field[@name='expense_line_ids']/tree/field[@name='analytic_account_id']" position="before">
<field name="account_id" groups="account.group_account_user"/>
</xpath>
<field name="account_move_id" position="attributes">
<attribute name="invisible">0</attribute>
<attribute name="groups">account.group_account_user</attribute>
<attribute name="states">post</attribute>
<attribute name="readonly">1</attribute>
</field>
<button name="action_open_journal_entries" position="attributes">
<attribute name="attrs">{}</attribute>
<attribute name="invisible">1</attribute>
</button>
<button name="%(hr_expense.hr_expense_register_payment_wizard_action)d" position="attributes">
<attribute name="context">{'default_amount': total_amount_company_currency, 'partner_id': address_id}</attribute>
</button>
</field>
</record>
<record id="view_hr_expense_sheet_tree" model="ir.ui.view">
<field name="name">usability.hr.expense.sheet.tree</field>
<field name="model">hr.expense.sheet</field>
<field name="inherit_id" ref="hr_expense.view_hr_expense_sheet_tree"/>
<field name="arch" type="xml">
<!-- total_amount in sheet in completely wrong (sums several currencies without conversion) -->
<field name="total_amount" position="attributes">
<attribute name="invisible">1</attribute>
</field>
<field name="total_amount" position="after">
<field name="total_amount_company_currency"/>
<field name="company_currency_id" invisible="1"/>
</field>
</field>
</record>
<record id="view_hr_expense_sheet_pivot" model="ir.ui.view">
<field name="name">usability.hr.expense.sheet.pivot</field>
<field name="model">hr.expense.sheet</field>
<field name="inherit_id" ref="hr_expense.view_hr_expense_sheet_pivot"/>
<field name="arch" type="xml">
<field name="total_amount" position="replace">
<field name="total_amount_company_currency" type="measure"/>
</field>
</field>
</record>
<record id="view_hr_expense_sheet_graph" model="ir.ui.view">
<field name="name">usability.hr.expense.sheet.graph</field>
<field name="model">hr.expense.sheet</field>
<field name="inherit_id" ref="hr_expense.view_hr_expense_sheet_graph"/>
<field name="arch" type="xml">
<field name="total_amount" position="replace">
<field name="total_amount_company_currency" type="measure"/>
</field>
</field>
</record>
</odoo>