Skip to content
Permalink
Browse files

[IMP] hr_expense: make some fields optional on expense sheets.

Since we change the expense sheet to an editable tree view, we had to add some fields on it since it doesn't open a form view anymore.
We take advantage of the optional fields on tree views to allow the user to remove some of those fields if they are not needed.

Task-1978580
  • Loading branch information...
MaxLarue committed Oct 9, 2019
1 parent 5f1037e commit 86cbd616150a8128b150c26ed19fff62279f037b
Showing with 19 additions and 18 deletions.
  1. +19 −18 addons/hr_expense/views/hr_expense_views.xml
@@ -30,19 +30,19 @@
<tree string="Expenses" decoration-bf="message_unread == True" class="o_expense_tree" js_class="hr_expense_tree" decoration-info="state == 'draft'" decoration-muted="state == 'cancel'" editable="bottom">
<field name="currency_id" invisible="True"/>
<field name="attachment_number" invisible="True"/>
<field name="date"/>
<field name="date" optional="show"/>
<field name="name"/>
<field name="employee_id"/>
<field name="sheet_id" invisible="not context.get('show_report', False)"/>
<field name="payment_mode"/>
<field name="analytic_account_id" groups="analytic.group_analytic_accounting"/>
<field name="company_id" groups="base.group_multi_company"/>
<field name="analytic_tag_ids" widget="many2many_tags" groups="analytic.group_analytic_tags"/>
<field name="total_amount" sum="Total Amount" widget="monetary" options="{'currency_field': 'currency_id'}"/>
<field name="employee_id" optional="show"/>
<field name="sheet_id" invisible="not context.get('show_report', False)" optional="show"/>
<field name="payment_mode" optional="show"/>
<field name="analytic_account_id" groups="analytic.group_analytic_accounting" optional="show"/>
<field name="company_id" groups="base.group_multi_company" optional="show"/>
<field name="analytic_tag_ids" widget="many2many_tags" groups="analytic.group_analytic_tags" optional="show"/>
<field name="total_amount" sum="Total Amount" widget="monetary" options="{'currency_field': 'currency_id'}" optional="show"/>
<button name="action_get_attachment_view" string="View Attached Documents" type="object" icon="fa-paperclip" attrs="{'invisible': [('attachment_number', '=', 0)]}"/>
<field name="message_unread" invisible="1"/>
<field name="state"/>
<field name="activity_exception_decoration" widget="activity_exception"/>
<field name="state" optional="show"/>
<field name="activity_exception_decoration" widget="activity_exception" optional="show"/>
</tree>
</field>
</record>
@@ -502,22 +502,23 @@
<page name="expenses" string="Expense">
<field name="expense_line_ids" nolabel="1" widget="many2many" domain="[('state', '=', 'draft'), ('employee_id', '=', employee_id), ('company_id', '=', company_id)]" options="{'reload_on_button': True}" context="{'form_view_ref' : 'hr_expense.hr_expense_view_form_without_header'}">
<tree decoration-danger="is_refused" editable="bottom">
<field name="date"/>
<field name="company_id" invisible="1"/>
<field name="date" optional="show"/>
<field name="name"/>
<field name="state" invisible="1"/>
<field name="analytic_account_id" domain="['|', ('company_id', '=', parent.company_id), ('company_id', '=', False)]" groups="analytic.group_analytic_accounting"/>
<field name="analytic_tag_ids" widget="many2many_tags" groups="analytic.group_analytic_tags"/>
<field name="analytic_account_id" domain="['|', ('company_id', '=', parent.company_id), ('company_id', '=', False)]" groups="analytic.group_analytic_accounting" optional="show"/>
<field name="analytic_tag_ids" widget="many2many_tags" groups="analytic.group_analytic_tags" optional="show"/>
<field name="message_unread" invisible="1"/>
<field name="attachment_number" string=" "/>
<button name="action_get_attachment_view" string="View Attachments" type="object" icon="fa-paperclip"/>
<field name="tax_ids" widget="many2many_tags" groups="account.group_account_user"/>
<field name="currency_id" invisible="1"/>
<field name="product_id" />
<field name="quantity" />
<field name="unit_amount" />
<field name="total_amount" string="Total" readonly="1"/>
<field name="product_id" optional="show"/>
<field name="quantity" optional="show"/>
<field name="unit_amount" optional="show"/>
<field name="total_amount" string="Total" readonly="1" optional="show"/>
<field name="company_currency_id" invisible="1"/>
<field name="total_amount_company" groups="base.group_multi_currency"/>
<field name="total_amount_company" groups="base.group_multi_currency" optional="show"/>
<field name="is_refused" invisible="True"/>
</tree>
</field>

0 comments on commit 86cbd61

Please sign in to comment.
You can’t perform that action at this time.