<?xml version="1.0" encoding="utf-8"?>
<odoo>

    <record id="view_account_payment_register_form" model="ir.ui.view">
        <field name="name">account.payment.register.form</field>
        <field name="model">account.payment.register</field>
        <field name="inherit_id" ref="account.view_account_payment_register_form"/>
        <field name="arch" type="xml">
            <group>
                <notebook invisible="not can_edit_wizard or (can_group_payments and not group_payment)">
                    <page name="latam_checks_page" string="Checks" invisible="payment_method_code not in ['in_third_party_checks', 'out_third_party_checks', 'return_third_party_checks', 'new_third_party_checks', 'own_checks']">
                        <group name="latam_checks" colspan="2">
                            <field name="l10n_latam_new_check_ids" invisible="payment_method_code not in ['new_third_party_checks', 'own_checks']" nolabel="1" colspan="2" >
                                <list editable="bottom">
                                    <field name="company_id" column_invisible="True"/>
                                    <field name="currency_id" column_invisible="True"/>
                                    <field name="name" />
                                    <field name="bank_account_id" column_invisible="parent.payment_method_code == 'own_checks'" options="{'no_create': True}"/>
                                    <field name="issuer_vat" column_invisible="parent.payment_method_code == 'own_checks'"/>
                                    <field name="payment_date"/>
                                    <field name="amount" />
                                </list>
                            </field>
                            <field name="l10n_latam_move_check_ids" invisible="payment_method_code not in ['in_third_party_checks', 'out_third_party_checks', 'return_third_party_checks']"
                                domain="
                                    [('payment_method_code', '=', 'new_third_party_checks'), ('current_journal_id', '=', journal_id), ('company_id', '=', company_id)]
                                        if payment_type == 'outbound' else
                                    [('payment_method_code', '=', 'new_third_party_checks'), ('current_journal_id', '=', False), ('company_id', '=', company_id)]" options="{'no_create': True}"
                                    nolabel="1" colspan="2">
                                <list name="existing_checks">
                                    <field name="company_id" column_invisible="True"/>
                                    <field name="currency_id" column_invisible="True"/>
                                    <field name="name" />
                                    <field name="bank_account_id" optional="hide"/>
                                    <field name="issuer_vat" optional="hide"/>
                                    <field name="payment_date" optional="show"/>
                                    <field name="amount"/>
                                </list>
                            </field>
                        </group>
                    </page>
                </notebook>
            </group>
            <div role="alert" position="after">
                <div role="alert" class="alert alert-info"
                        invisible="payment_method_code not in ['new_third_party_checks', 'in_third_party_checks', 'out_third_party_checks', 'return_third_party_checks', 'own_checks'] or can_edit_wizard and (not can_group_payments or can_group_payments and group_payment)">
                    <p>You can't use checks when paying invoices of different partners or same partner without grouping</p>
                </div>
            </div>
        </field>
    </record>

</odoo>
