vendor_payment_diff_amount/views/account_batch_payment_views.xml

51 lines
3.0 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- Add deduction lines field to batch payment line tree view -->
<record id="view_batch_payment_form_inherit_diff_amount" model="ir.ui.view">
<field name="name">account.batch.payment.form.inherit.diff.amount</field>
<field name="model">account.batch.payment</field>
<field name="inherit_id" ref="vendor_batch_payment_merge.view_batch_payment_form_inherit"/>
<field name="arch" type="xml">
<!-- Replace the tree view with one that includes a form view for deduction lines -->
<xpath expr="//field[@name='direct_payment_line_ids']" position="replace">
<field name="direct_payment_line_ids">
<tree editable="bottom">
<field name="partner_id" domain="parent.batch_type == 'outbound' and [('supplier_rank', '>', 0)] or [('customer_rank', '>', 0)]" options="{'no_create': True}"/>
<field name="amount" sum="Total"/>
<field name="expense_account_id"/>
<field name="amount_substract" sum="Total Deductions" optional="show"/>
<field name="memo"/>
<field name="date"/>
<field name="payment_id" readonly="1"/>
</tree>
<form>
<group>
<group name="payment_info">
<field name="partner_id" domain="parent.batch_type == 'outbound' and [('supplier_rank', '>', 0)] or [('customer_rank', '>', 0)]"/>
<field name="amount"/>
<field name="currency_id" invisible="1"/>
<field name="expense_account_id"/>
<field name="memo"/>
<field name="date"/>
<field name="payment_id" readonly="1"/>
</group>
</group>
<group string="Deductions" name="deductions">
<field name="deduction_line_ids" nolabel="1" context="{'default_currency_id': currency_id}">
<tree editable="bottom">
<field name="sequence" widget="handle"/>
<field name="substract_account_id" required="1"/>
<field name="name" placeholder="Description (optional)"/>
<field name="amount_substract" required="1" sum="Total"/>
<field name="currency_id" column_invisible="1"/>
</tree>
</field>
<field name="amount_substract" readonly="1"/>
</group>
</form>
</field>
</xpath>
</field>
</record>
</odoo>