<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2004-2011 Pexego Sistemas Informáticos. (http://pexego.es)
     Copyright 2014 Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>
     Copyright 2016 Antonio Espinosa <antonio.espinosa@tecnativa.com>
     License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>
    <record
        id="view_customer_account_invoice_add_refunds_details_form"
        model="ir.ui.view"
    >
        <field
            name="name"
        >Account invoice (customer) | add Refunds details (form)</field>
        <field name="model">account.move</field>
        <field name="inherit_id" ref="account.view_move_form" />
        <field name="arch" type="xml">
            <notebook position="inside">
                <page
                    name="refunds"
                    string="Refunds"
                    invisible="move_type not in ('in_invoice', 'out_invoice')"
                >
                    <field
                        name="refund_invoice_ids"
                        nolabel="1"
                        context="{'form_view_ref': 'account_invoice_refund_link.account_invoice_refund_form_view'}"
                    >
                        <list
                            decoration-info="state == 'draft'"
                            decoration-muted="state == 'cancel'"
                        >
                            <field name="partner_id" column_invisible="1" />
                            <field name="move_type" column_invisible="1" />
                            <field name="invoice_date" />
                            <field name="name" />
                            <field name="invoice_origin" />
                            <field name="ref" />
                            <field name="amount_total" string="Total" />
                            <field name="state" string="Status" />
                        </list>
                    </field>
                </page>
            </notebook>
            <field name="ref" position="after">
                <field name="reversed_entry_id" invisible="1" />
                <field name="move_type" invisible="1" />
                <field
                    name="reversed_entry_id"
                    string="Invoice reference"
                    readonly="1"
                    invisible="not reversed_entry_id or move_type not in ('in_refund', 'out_refund')"
                />
            </field>
        </field>
    </record>
    <record id="account_invoice_refund_form_view" model="ir.ui.view">
        <field name="name">account.invoice.refund.form.view</field>
        <field name="model">account.move</field>
        <field name="priority">999</field>
        <field name="arch" type="xml">
            <form string="Refund Invoices">
                <group>
                    <field name="company_id" invisible="1" />
                    <field name="move_type" invisible="1" />
                    <field name="partner_id" />
                    <field name="invoice_date" />
                    <field name="name" />
                    <field name="invoice_origin" />
                    <field name="ref" />
                    <field name="amount_total" string="Total" />
                    <field name="state" string="Status" />
                </group>
                <field name="invoice_line_ids" nolabel="1">
                    <list>
                        <field name="product_id" />
                        <field name="name" />
                        <field name="account_id" />
                        <field name="quantity" />
                        <field name="price_unit" />
                        <field name="discount" optional="hide" />
                        <field name="tax_ids" widget="many2many_tags" />
                        <field name="price_subtotal" />
                    </list>
                </field>
            </form>
        </field>
    </record>
</odoo>
