customer_cogs_expense_account/views/account_move_views.xml
2025-11-25 21:43:35 +07:00

63 lines
3.2 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- Extend account.move.line tree view to show account source -->
<record id="view_move_line_tree_inherit_customer_account" model="ir.ui.view">
<field name="name">account.move.line.tree.inherit.customer.account</field>
<field name="model">account.move.line</field>
<field name="inherit_id" ref="account.view_move_line_tree"/>
<field name="arch" type="xml">
<!-- Add account_source field after the account_id field -->
<xpath expr="//field[@name='account_id']" position="after">
<field name="account_source" optional="show"
decoration-info="account_source == 'Customer'"
decoration-muted="account_source == 'Product Category'"/>
</xpath>
</field>
</record>
<!-- Extend account.move.line form view to show account source -->
<record id="view_move_line_form_inherit_customer_account" model="ir.ui.view">
<field name="name">account.move.line.form.inherit.customer.account</field>
<field name="model">account.move.line</field>
<field name="inherit_id" ref="account.view_move_line_form"/>
<field name="arch" type="xml">
<!-- Add account_source field after the account_id field -->
<xpath expr="//field[@name='account_id']" position="after">
<field name="account_source" readonly="1"/>
<field name="used_customer_specific_account" invisible="1"/>
</xpath>
</field>
</record>
<!-- Extend account.move form view to show account source in line tree -->
<record id="view_move_form_inherit_customer_account" model="ir.ui.view">
<field name="name">account.move.form.inherit.customer.account</field>
<field name="model">account.move</field>
<field name="inherit_id" ref="account.view_move_form"/>
<field name="arch" type="xml">
<!-- Add account_source to invoice line tree view -->
<xpath expr="//field[@name='invoice_line_ids']" position="attributes">
<attribute name="context">{'default_account_source': False}</attribute>
</xpath>
</field>
</record>
<!-- Add search filter for account source -->
<record id="view_account_move_line_filter_inherit_customer_account" model="ir.ui.view">
<field name="name">account.move.line.search.inherit.customer.account</field>
<field name="model">account.move.line</field>
<field name="inherit_id" ref="account.view_account_move_line_filter"/>
<field name="arch" type="xml">
<!-- Add filters for account source -->
<xpath expr="//search" position="inside">
<filter string="Customer Account" name="customer_account"
domain="[('account_source', '=', 'Customer')]"
help="Journal entries using customer-specific accounts"/>
<filter string="Product Category Account" name="category_account"
domain="[('account_source', '=', 'Product Category')]"
help="Journal entries using product category accounts"/>
</xpath>
</field>
</record>
</odoo>