This question has been flagged
2 Replies
2722 Views

Hi,

I just started with odoo 10 community. I was working on an external footer for my company documents. I wanted to change the default footer odoo created for me based on my company info. 


I wanted to remove the following code:

 <ul t-if="not company.custom_footer" class="list-inline" name="financial_infos">
              <li t-if="company.vat">VAT No.: <span t-field="company.vat"/>&amp;bull;</li>
               <li t-if="company.bank_ids[0].acc_number">    Account: <span t-field="company.bank_ids[0].acc_number"/></li>
</ul>

Once the code was removed and I tried to save the template I got the following error:

Error while validating constraintElement '<xpath expr="//ul[@name='financial_infos']">' cannot be located in parent viewError context:View `external_layout_footer`[view_id: 437, xml_id: account.external_layout_footer, model: n/a, parent_id: 256]

I don't know what to do about it. Any thoughts?



Avatar
Discard
Best Answer

Hello Marcin,

Add Custom footer and for include custom layout and include layout in report template

<!------Footer---->
<template id="external_layout_footer_ept">
    <div class="footer">
        <div class="text-center" style="border-top: 1px solid black;">
            <ul t-if="not company.custom_footer" class="list-inline">
                <li t-if="company.phone">Phone: <span t-field="company.phone"/></li>

                <li t-if="company.fax and company.phone">&amp;bull;</li>
                <li t-if="company.fax">Fax: <span t-field="company.fax"/></li>

                <li t-if="company.email and company.fax or company.email and company.phone">&amp;bull;</li>
                <li t-if="company.email">Email: <span t-field="company.email"/></li>

                <li t-if="company.website and company.email or company.website and company.fax or company.website and company.phone">&amp;bull;</li>
                <li t-if="company.website">Website: <span t-field="company.website"/></li>
            </ul>

            <t t-if="company.custom_footer">
                <span t-raw="company.rml_footer"/>
            </t>

            <ul class="list-inline">
                <li>Page:</li>
                <li><span class="page"/></li>
                <li>/</li>
                <li><span class="topage"/></li>
            </ul>
        </div>
    </div>      
</template>

<!-- Layout -->
<template id="external_layout_ept">
	<t t-name="external_layout_ept">
	<t t-if="not o and doc">
		<t t-set="o" t-value="doc"/>
		</t>
	<t t-set="company" t-value="o.company_id"/>
	<t t-if="o and 'type' in o and o.type in ['out_invoice','out_refund']">
			<t t-if="o and o.sudo().company_id.parent_id">
				<t t-set="company" t-value="o.sudo().company_id.parent_id"/>
			</t>
	 	</t>
	 
   
   <t t-call="report.external_layout_header"/>

	<t t-raw="0"/>
	<t t-call="module_name.external_layout_footer_ept"/>    		 
	</t>
</template>


<!-----------Report(second line where layout is call)------------->
<t t-call="report.external_layout">  <!---Already There----->
<t t-call="module_name.external_layout_ept"> <!-----Replace with above one------->

Thanks,

Avatar
Discard
Best Answer
<xpath expr="//ul[@name='financial_infos']">' cannot be located

This means Odoo is looking for the element you removed.  You need to put it back, and in your change make it invisible or override it.

Avatar
Discard