Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
3224 Lượt xem

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?



Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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,

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất
<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.

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 7 25
2001
1
thg 5 25
2153
1
thg 4 25
2510
1
thg 2 25
1791
0
thg 10 24
1524