<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <record id="res_config_settings_view_form" model="ir.ui.view">
        <field name="name">res.config.settings.view.form.inherit.l10n.es</field>
        <field name="model">res.config.settings</field>
        <field name="inherit_id" ref="l10n_es.res_config_settings_view_form"/>
        <field name="arch" type="xml">
            <xpath expr="//block[@name='spain_localization']" position="attributes">
                <attribute name="invisible">country_code != 'ES'</attribute>
            </xpath>
            <xpath expr="//block[@name='spain_localization']" position="inside">
                <!-- Invisible fields -->
                <field name="l10n_es_tbai_certificate_ids" invisible="1"/>
                <setting string="Registro de Libros connection TicketBAI" company_dependent="1">
                    <div class="content-group">
                        <div class="mt16">
                            <label for="l10n_es_tbai_tax_agency" class="o_light_label"/>
                            <field name="l10n_es_tbai_tax_agency"/>
                            <div class="text-muted" invisible="l10n_es_tbai_tax_agency">
                                No tax agency selected: TicketBAI not activated.
                            </div>
                            <div class="text-muted" invisible="not l10n_es_tbai_tax_agency">
                                Tax agency selected: invoices will be sent by TicketBAI.
                            </div>
                            <br/>
                            <div class="o_row">
                                <label for="l10n_es_tbai_test_env" class="o_light_label"/>
                                <field name="l10n_es_tbai_test_env"/>
                            </div>
                            <div class="text-muted" invisible="not l10n_es_tbai_test_env">
                                Test mode: EDI data is sent to separate test servers and is not considered official.
                            </div>
                            <div class="text-muted" invisible="l10n_es_tbai_test_env">
                                Production mode: EDI data is sent to the official agency servers.
                            </div>
                            <br/>
                            <div>
                                <button name="%(l10n_es_edi_tbai_certificate_action)d" type="action" class="oe_link">Manage certificates (TicketBAI)</button>
                            </div>
                        </div>
                    </div>
                </setting>
            </xpath>
        </field>
    </record>
</odoo>
