190 lines
10 KiB
XML
190 lines
10 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<odoo>
|
|
<!-- Expense Line Form View -->
|
|
<record id="hr_expense_view_form_inherit_receipt" model="ir.ui.view">
|
|
<field name="name">hr.expense.view.form.receipt</field>
|
|
<field name="model">hr.expense</field>
|
|
<field name="inherit_id" ref="hr_expense.hr_expense_view_form"/>
|
|
<field name="priority">1000</field>
|
|
<field name="arch" type="xml">
|
|
<!-- Remove all standard Submit Buttons -->
|
|
<xpath expr="(//header//button[@name='action_submit_expenses'])[1]" position="replace"/>
|
|
<xpath expr="(//header//button[@name='action_submit_expenses'])[1]" position="replace"/>
|
|
|
|
<!-- Remove all standard Attach Receipt widgets -->
|
|
<xpath expr="(//header//widget[@name='attach_document'])[1]" position="replace"/>
|
|
<xpath expr="(//header//widget[@name='attach_document'])[1]" position="replace"/>
|
|
|
|
<!-- Remove Split Expense to re-add with correct logic -->
|
|
<xpath expr="//header//button[@name='action_split_wizard']" position="replace"/>
|
|
|
|
<!-- Re-add ONLY one Create Report button as primary -->
|
|
<xpath expr="//header" position="inside">
|
|
<button name="action_submit_expenses"
|
|
string="Create Report"
|
|
type="object"
|
|
class="oe_highlight o_expense_submit"
|
|
invisible="sheet_id"
|
|
data-hotkey="v"/>
|
|
<widget name="attach_document"
|
|
string="Attach Receipt"
|
|
action="attach_document"
|
|
highlight="nb_attachment < 1 and payment_mode == 'own_account'"
|
|
invisible="sheet_id"/>
|
|
</xpath>
|
|
<xpath expr="//div[hasclass('oe_title')]" position="before">
|
|
<div class="oe_button_box" name="button_box">
|
|
<button name="action_view_realizations"
|
|
type="object"
|
|
class="oe_stat_button"
|
|
icon="fa-file-text-o"
|
|
invisible="realization_count == 0">
|
|
<field name="realization_count" widget="statinfo" string="Realization"/>
|
|
</button>
|
|
<!-- Button to create new realization if none exists -->
|
|
<button name="action_create_realization"
|
|
string="Realization"
|
|
type="object"
|
|
class="oe_stat_button"
|
|
icon="fa-plus-square-o"
|
|
invisible="payment_mode != 'company_account' or state != 'done' or realization_count != 0"/>
|
|
</div>
|
|
</xpath>
|
|
<xpath expr="//sheet" position="before">
|
|
<div class="alert alert-danger mb-2" role="alert" invisible="not receipt_overdue">
|
|
This receipt is <strong>Overdue</strong>! Please submit the original receipt as soon as possible.
|
|
</div>
|
|
</xpath>
|
|
<xpath expr="//field[@name='account_id']" position="after">
|
|
<field name="realization_count" invisible="1"/>
|
|
<field name="receipt_due_date" widget="date" invisible="not receipt_due_date"/>
|
|
<field name="receipt_received" widget="boolean_toggle" invisible="not receipt_due_date"/>
|
|
<field name="receipt_overdue" invisible="1"/>
|
|
</xpath>
|
|
</field>
|
|
</record>
|
|
|
|
<!-- Expense Line Tree View -->
|
|
<record id="view_expenses_tree_inherit_receipt" model="ir.ui.view">
|
|
<field name="name">hr.expense.tree.receipt</field>
|
|
<field name="model">hr.expense</field>
|
|
<field name="inherit_id" ref="hr_expense.view_expenses_tree"/>
|
|
<field name="arch" type="xml">
|
|
<xpath expr="//field[@name='state']" position="after">
|
|
<field name="receipt_due_date" optional="show" widget="remaining_days" decoration-danger="receipt_overdue"/>
|
|
<field name="receipt_received" optional="show" widget="boolean_toggle"/>
|
|
<field name="receipt_overdue" column_invisible="True"/>
|
|
</xpath>
|
|
</field>
|
|
</record>
|
|
|
|
<!-- Expense Search View -->
|
|
<record id="hr_expense_view_search_inherit_receipt" model="ir.ui.view">
|
|
<field name="name">hr.expense.search.receipt</field>
|
|
<field name="model">hr.expense</field>
|
|
<field name="inherit_id" ref="hr_expense.hr_expense_view_search"/>
|
|
<field name="arch" type="xml">
|
|
<xpath expr="//filter[@name='no_report']" position="after">
|
|
<separator/>
|
|
<filter string="Overdue Receipts" name="filter_receipt_overdue" domain="[('receipt_overdue', '=', True), ('receipt_received', '=', False)]"/>
|
|
<filter string="Receipt Received" name="filter_receipt_received" domain="[('receipt_received', '=', True)]"/>
|
|
<filter string="Receipt Missing" name="filter_receipt_missing" domain="[('receipt_received', '=', False), ('receipt_due_date', '!=', False)]"/>
|
|
</xpath>
|
|
<xpath expr="//group" position="inside">
|
|
<filter string="Receipt Status" name="group_receipt_status" context="{'group_by': 'receipt_received'}"/>
|
|
<filter string="Receipt Due Date" name="group_receipt_due" context="{'group_by': 'receipt_due_date'}"/>
|
|
</xpath>
|
|
</field>
|
|
</record>
|
|
|
|
<!-- Report Action: Overdue Receipts -->
|
|
<record id="action_hr_expense_overdue_receipts" model="ir.actions.act_window">
|
|
<field name="name">Overdue Receipts</field>
|
|
<field name="res_model">hr.expense</field>
|
|
<field name="view_mode">list,pivot,form</field>
|
|
<field name="domain">[('receipt_overdue', '=', True), ('receipt_received', '=', False)]</field>
|
|
<field name="context">{'search_default_group_receipt_due': 1}</field>
|
|
<field name="help" type="html">
|
|
<p class="o_view_nocontent_smiling_face">
|
|
No overdue receipts found!
|
|
</p><p>
|
|
This report shows all expenses that have been paid but the original receipts haven't been submitted yet.
|
|
</p>
|
|
</field>
|
|
</record>
|
|
|
|
<menuitem id="menu_hr_expense_overdue_receipts"
|
|
name="Overdue Receipts"
|
|
parent="hr_expense.menu_hr_expense_reports"
|
|
action="action_hr_expense_overdue_receipts"
|
|
sequence="20"/>
|
|
<record id="view_hr_expense_sheet_form_inherit_realization" model="ir.ui.view">
|
|
<field name="name">hr.expense.sheet.form.inherit.realization</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">
|
|
<!-- Restrict Posting to Accountants -->
|
|
<xpath expr="//button[@name='action_sheet_move_create']" position="attributes">
|
|
<attribute name="groups">account.group_account_invoice</attribute>
|
|
</xpath>
|
|
<xpath expr="//button[@name='action_register_payment']" position="attributes">
|
|
<attribute name="groups">account.group_account_invoice</attribute>
|
|
</xpath>
|
|
|
|
<xpath expr="//field[@name='expense_line_ids']/tree/field[@name='name']" position="after">
|
|
<field name="payment_mode" column_invisible="True"/>
|
|
<field name="realization_count" column_invisible="True"/>
|
|
<!-- Button to Add Receipt if none exists -->
|
|
<button name="action_create_realization"
|
|
string="Add Receipt"
|
|
type="object"
|
|
icon="fa-plus"
|
|
class="text-primary"
|
|
title="Add receipts for this expense"
|
|
invisible="payment_mode != 'company_account' or parent.state not in ['post', 'done'] or realization_count != 0"/>
|
|
<!-- Button to View Receipts if already exist -->
|
|
<button name="action_view_realizations"
|
|
string="View Receipts"
|
|
type="object"
|
|
icon="fa-external-link"
|
|
class="text-success"
|
|
title="View linked receipts"
|
|
invisible="payment_mode != 'company_account' or parent.state not in ['post', 'done'] or realization_count == 0"/>
|
|
</xpath>
|
|
</field>
|
|
</record>
|
|
|
|
<!-- Inherit Expense Report Tree View -->
|
|
<record id="view_hr_expense_sheet_tree_inherit_receipt" model="ir.ui.view">
|
|
<field name="name">hr.expense.sheet.tree.receipt</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">
|
|
<xpath expr="//field[@name='state']" position="before">
|
|
<field name="receipt_status" widget="badge"
|
|
decoration-info="receipt_status == 'pending'"
|
|
decoration-success="receipt_status == 'received'"
|
|
decoration-muted="receipt_status == 'none'"
|
|
optional="show"/>
|
|
</xpath>
|
|
</field>
|
|
</record>
|
|
|
|
<!-- Inherit Expense Report Search View -->
|
|
<record id="hr_expense_sheet_view_search_inherit_receipt" model="ir.ui.view">
|
|
<field name="name">hr.expense.sheet.search.receipt</field>
|
|
<field name="model">hr.expense.sheet</field>
|
|
<field name="inherit_id" ref="hr_expense.hr_expense_sheet_view_search"/>
|
|
<field name="arch" type="xml">
|
|
<xpath expr="//filter[@name='my_reports']" position="after">
|
|
<separator/>
|
|
<filter string="Pending Receipts" name="filter_receipt_pending" domain="[('receipt_status', '=', 'pending')]"/>
|
|
<filter string="Receipts Received" name="filter_receipt_received" domain="[('receipt_status', '=', 'received')]"/>
|
|
</xpath>
|
|
<xpath expr="//group[@name='group_filters']" position="inside">
|
|
<filter string="Receipt Status" name="group_receipt_status" context="{'group_by': 'receipt_status'}"/>
|
|
</xpath>
|
|
</field>
|
|
</record>
|
|
</odoo>
|