<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <data>
        <record id="view_xml_invoice_reconcile_ir_attachment_tree" model="ir.ui.view">
            <field name="name">Reconcile XML</field>
            <field name="model">xml.invoice.reconcile</field>
            <field name="arch" type="xml">
                <tree string="Conciliar compras" editable="bottom" create="false">
                    <field name="attachment_id" readonly="1"/>
                    <field name="folio_factura" readonly="1"/>
                    <field name="client_rfc" invisible="1"/>
                    <field name="invoice_type" invisible="1"/>
                    <field name="invoice_id" required="1" domain="[('move_type','=', invoice_type),('partner_id.vat', '=', client_rfc)]"/>
                    <field name="date" readonly="1"/>
                    <field name="client_name" readonly="1"/>
                    <field name="amount" readonly="1"/>
                    <field name="reconcilled" invisible="1"/>
                    <button name="action_reconcile" attrs="{'invisible' : [('reconcilled','=', True)]}" string="Conciliar" type="object" class="oe_highlight"/> 
               </tree>
            </field>
        </record>
        <record id="action_xml_invoice_reconcile_view" model="ir.actions.act_window">
            <field name="name">Reconcile XML File</field>
            <field name="res_model">xml.invoice.reconcile</field>
            
            <field name="view_mode">tree</field>
            <field eval="view_xml_invoice_reconcile_ir_attachment_tree" name="view_id"/>
        </record>

        <record id="view_xml_payment_reconcile_ir_attachment_tree" model="ir.ui.view">
            <field name="name">Reconcile XML Payment</field>
            <field name="model">xml.invoice.reconcile</field>
            <field name="arch" type="xml">
                <tree string="Conciliar pagos" editable="bottom" create="false">
                    <field name="attachment_id" readonly="1"/>
                    <field name="folio_factura" readonly="1"/>
                    <field name="client_rfc" invisible="1"/>
                    <field name="payment_type" invisible="1"/>
                    <field name="payment_id" required="1" domain="[('payment_type','=', payment_type), ('partner_id.vat', '=', client_rfc)]" />
                    <field name="date" readonly="1"/>
                    <field name="client_name" readonly="1"/>
                    <field name="amount" readonly="1"/>
                    <field name="reconcilled" invisible="1"/>
                    <button name="action_reconcile" attrs="{'invisible' : [('reconcilled','=', True)]}" string="Conciliar" type="object" class="oe_highlight"/> 
               </tree>
            </field>
        </record>
        <record id="action_xml_payment_reconcile_view" model="ir.actions.act_window">
            <field name="name">Reconcile Payment XML File</field>
            <field name="res_model">xml.invoice.reconcile</field>
            <field name="view_mode">tree</field>
            <field eval="view_xml_payment_reconcile_ir_attachment_tree" name="view_id"/>
        </record>
    </data>
</odoo>
