<?xml version="1.0" encoding="utf-8"?>
<odoo>

    <template id="external_layout_footer_content" inherit_id="web.external_layout_footer_content">
        <xpath expr="//div[contains(@t-attf-class, 'o_footer_content')]" position="attributes">
            <attribute name="t-if">not custom_footer</attribute>
        </xpath>
        <xpath expr="//div[contains(@t-attf-class, 'o_footer_content')]" position="after">
            <div
                t-attf-class="o_footer_content {{footer_content_classes}}"
                t-if="custom_footer and company._localization_use_documents()"
            >
                <t t-out="custom_footer"/>
            </div>
        </xpath>
    </template>

    <template id="external_layout_standard" inherit_id="web.external_layout_standard" >
        <!-- support for custom header -->
        <xpath expr="//table" position="attributes">
            <attribute name="t-if">not custom_header</attribute>
        </xpath>
        <xpath expr="//table" position="after">
            <div t-if="custom_header and company._localization_use_documents()">
                <t t-call="#{custom_header}"/>
            </div>
        </xpath>
    </template>

    <template id="external_layout_bubble" inherit_id="web.external_layout_bubble">
        <!-- support for custom header -->
        <xpath expr="//table" position="attributes">
            <attribute name="t-if">not custom_header</attribute>
        </xpath>
        <xpath expr="//table" position="after">
            <div t-if="custom_header and company._localization_use_documents()">
                <t t-call="#{custom_header}"/>
            </div>
        </xpath>
    </template>

    <template id="external_layout_wave" inherit_id="web.external_layout_wave">
        <!-- support for custom header -->
        <xpath expr="//div[contains(@t-attf-class, 'header')]//div" position="attributes">
            <attribute name="t-if">not custom_header</attribute>
        </xpath>
        <xpath expr="//div[contains(@t-attf-class, 'header')]//div" position="after">
            <div t-if="custom_header and company._localization_use_documents()">
                <t t-call="#{custom_header}"/>
            </div>
        </xpath>
    </template>

    <template id="external_layout_folder" inherit_id="web.external_layout_folder">
        <!-- support for custom header -->
        <xpath expr="//div[contains(@t-attf-class, 'header')]//div[hasclass('o_folder_company_info')]" position="attributes">
            <attribute name="t-if">not custom_header</attribute>
        </xpath>
        <xpath expr="//div[contains(@t-attf-class, 'header')]//div[hasclass('o_folder_company_info')]" position="after">
            <div t-if="custom_header and company._localization_use_documents()">
                <t t-call="#{custom_header}"/>
            </div>
        </xpath>
    </template>

    <template id="external_layout_center" inherit_id="web.external_layout_center">
        <!-- support for custom header -->
        <xpath expr="//table" position="attributes">
            <attribute name="t-if">not custom_header</attribute>
        </xpath>
        <xpath expr="//table" position="after">
            <div t-if="custom_header and company._localization_use_documents()">
                <t t-call="#{custom_header}"/>
            </div>
        </xpath>
    </template>

    <template id="external_layout_dual" inherit_id="web.external_layout_dual">
        <!-- support for custom header -->
        <xpath expr="//table" position="attributes">
            <attribute name="t-if">not custom_header</attribute>
        </xpath>
        <xpath expr="//table" position="after">
            <div t-if="custom_header and company._localization_use_documents()">
                <t t-call="#{custom_header}"/>
            </div>
        </xpath>
    </template>

    <template id="external_layout_lines" inherit_id="web.external_layout_lines">
        <!-- support for custom header -->
        <xpath expr="//table" position="attributes">
            <attribute name="t-if">not custom_header</attribute>
        </xpath>
        <xpath expr="//table" position="after">
            <div t-if="custom_header and company._localization_use_documents()">
                <t t-call="#{custom_header}"/>
            </div>
        </xpath>
    </template>
</odoo>
