<?xml version="1.0" encoding="utf-8" ?>
<!--
  Copyright 2023 Akretion France (http://www.akretion.com/)
  @author: Alexis de Lattre <alexis.delattre@akretion.com>
  License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
<odoo>

<record id="account_move_line_reconcile_manual_form" model="ir.ui.view">
    <field name="model">account.move.line.reconcile.manual</field>
    <field name="arch" type="xml">
            <form>
                    <div
                    class="alert alert-warning"
                    role="alert"
                    attrs="{'invisible': [('partner_count', '&lt;', 2)]}"
                >
                            You are trying to reconcile journal items from <field
                        name="partner_count"
                    /> different partners: make sure it is intented.
            </div>
                    <group name="main">
                            <field name="account_id" />
                            <field name="count" />
                            <field name="total_debit" />
                            <field name="total_credit" />
                            <field name="state" invisible="1" />
                            <field name="company_id" invisible="1" />
                            <field name="company_currency_id" invisible="1" />
                            <field name="partner_count" invisible="1" />
                            <field name="partner_id" invisible="1" />
                    </group>
                    <group name="writeoff" string="Write-off" states="writeoff">
                            <field
                        name="writeoff_journal_id"
                        widget="selection"
                        attrs="{'required': [('state', '=', 'writeoff')]}"
                    />
                            <field
                        name="writeoff_date"
                        attrs="{'required': [('state', '=', 'writeoff')]}"
                        options="{'datepicker': {'warn_future': true}}"
                    />
                            <field name="writeoff_ref" />
                            <field name="writeoff_amount" />
                            <field name="writeoff_type" />
                            <field
                        name="writeoff_account_id"
                        attrs="{'required': [('state', '=', 'writeoff')]}"
                    />
                            <field
                        name="writeoff_analytic_account_id"
                        groups="analytic.group_analytic_accounting"
                    />
                    </group>
                    <footer>
                            <button
                        name="full_reconcile"
                        type="object"
                        attrs="{'invisible': ['|', ('state', '!=', 'start'), ('writeoff_type', '!=', 'none')]}"
                        class="btn-primary"
                        string="Full Reconcile"
                    />
                            <button
                        name="partial_reconcile"
                        type="object"
                        attrs="{'invisible': ['|', ('state', '!=', 'start'), ('writeoff_type', '=', 'none')]}"
                        class="btn-primary"
                        string="Partial Reconcile"
                    />
                            <button
                        name="go_to_writeoff"
                        type="object"
                        attrs="{'invisible': ['|', ('state', '!=', 'start'), ('writeoff_type', '=', 'none')]}"
                        class="btn-primary"
                        string="Reconcile with Write-off"
                    />
                            <button
                        name="reconcile_with_writeoff"
                        type="object"
                        states="writeoff"
                        class="btn-primary"
                        string="Reconcile with Write-off"
                    />
                            <button special="cancel" string="Cancel" />
                    </footer>
        </form>
    </field>
</record>

<record id="account_move_line_reconcile_manual_action" model="ir.actions.act_window">
    <field name="name">Reconcile</field>
    <field name="res_model">account.move.line.reconcile.manual</field>
    <field name="view_mode">form</field>
    <field name="target">new</field>
</record>

</odoo>
