<odoo>
    <!-- Issuer Form view -->
    <record id="view_cfdi_issuer" model="ir.ui.view">
        <field name="name">Emisor de CFDIs</field>
        <field name="model">l10n_mx_cfdi.issuer</field>
        <field name="arch" type="xml">
            <form>
                <header>
                    <button
                        name="register_issuer"
                        string="Registrar"
                        type="object"
                        class="oe_highlight"
                        attrs="{'invisible': [('registered', '=', True)]}"
                    />

                    <button
                        name="unregister_issuer"
                        string="Cancelar registro"
                        type="object"
                        attrs="{'invisible': [('registered', '=', False)]}"
                    />
                </header>
                <sheet>


                    <group>
                        <group>
                            <field name="name" required="True" />
                            <field name="fiscal_name" />
                            <field name="vat" />
                            <field name="country_id" invisible="1" />
                            <field name="zip" />
                            <field name="tax_regime" />
                        </group>
                        <group>
                            <field name="service_id" />
                            <field name="company_id" groups="base.group_system" />
                            <field name="use_origin_document_sequence" />
                            <field
                                name="invoice_sequence_id"
                                attrs="{'invisible': [('use_origin_document_sequence', '=', True)]}"
                            />
                            <field
                                name="payment_sequence_id"
                                attrs="{'invisible': [('use_origin_document_sequence', '=', True)]}"
                            />
                            <field
                                name="refund_sequence_id"
                                attrs="{'invisible': [('use_origin_document_sequence', '=', True)]}"
                            />
                            <field name="transfer_sequence_id" />
                        </group>
                    </group>
                    <group>
                        <field name="logo_url" />
                        <field name="certificate_file" />
                        <field name="key_file" />
                        <field name="key_password" password="True" />
                        <field name="registered" attrs="{'readonly': [(1, '=', 1)]}" />
                    </group>
                    <!-- warning message with alert-danger class -->
                    <div
                        class="alert alert-danger"
                        role="alert"
                        attrs="{'invisible': [('registered', '=', True)]}"
                    >
                        <i
                            class="fa fa-exclamation-triangle mr-2"
                            role="img"
                            aria-label="Alert"
                            title="Alert"
                        />
                        <span
                        >El emisor no está registrado con el proveedor de facturación.</span>
                    </div>
                    <!-- warning message with alert-success class -->

                    <div
                        class="alert alert-success"
                        role="alert"
                        attrs="{'invisible': [('registered', '=', False)]}"
                    >
                        <i
                            class="fa fa-check-circle mr-2"
                            role="img"
                            aria-label="Alert"
                            title="Alert"
                            attrs="{'invisible': [('registered', '=', False)]}"
                        />
                        <span>El emisor está registrado y listo para ser usado.</span>
                    </div>
                </sheet>
            </form>
        </field>
    </record>

    <!-- CSD action -->
    <record id="action_l10n_mx_cfdi_issuer" model="ir.actions.act_window">
        <field name="name">Emisores</field>
        <field name="res_model">l10n_mx_cfdi.issuer</field>
        <field name="view_mode">tree,form</field>
    </record>

    <menuitem
        id="menu_cfdi_issuer"
        name="Emisores"
        parent="l10n_mx_cfdi.cfdi_menu"
        groups="base.group_user"
        action="action_l10n_mx_cfdi_issuer"
    />

</odoo>
