Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
7714 มุมมอง

In order to change the Odoo branding, I have made a simple module and try to inherit the website footer copyright template.

This is the original view:

<?xml version="1.0"?>

<data inherit_id="website.layout" name="Footer Copyright">

<xpath expr="//div[contains(@id, 'footer')]" position="inside">

<div class="container mt16 mb8">

<div class="pull-right" t-ignore="true" t-if="not editable">

Create a <a href="http://www.odoo.com/page/website-builder">free website</a> with

<a class="label label-danger" href="http://www.odoo.com/page/website-builder">Odoo</a>

</div>

<div class="pull-left text-muted" itemscope="itemscope" itemtype="http://schema.org/Organization">

Copyright &amp;copy; <span t-field="res_company.name" itemprop="name">Company name</span>

</div>

</div>

</xpath>

</data>

 and this is what I tried to do:

<openerp>

<data>

<template id="tw_layout_footer_copyright" inherit_id="website.layout_footer_copyright">

<xpath expr="//div[@class='container mt16 mb8']/div[@class='pull-right']" position="replace"/>

<div class="pull-right" t-ignore="true" t-if="not editable">

Powered by <a class="label label-danger" href="http://www.odoo.com">Odoo</a>,

provided by <a class="label label-danger" href="http://www.twanda.com">twanda AG</a>.

</div>

<xpath expr="//div[@class='pull-left text-muted']" position="replace"/>

<div class="pull-left text-muted">

Copyright &amp;copy; <span t-esc="time.strftime('%Y')"></span> <span t-field="res_company.name">Company name</span>

</div>

</template>

</data>

</openerp>

This is the error I got:

ParseError: "Invalid view definition

Error details:
Element '<div class="pull-right" t-ignore="true" t-if="not editable">' cannot be located in parent view

Error context:
View `tw_layout_footer_copyright`
[view_id: 520, xml_id: n/a, model: n/a, parent_id: 234]
None" while parsing None:4, near
<data inherit_id="website.layout_footer_copyright">
                <xpath expr="//div[@class='container mt16 mb8']/div[@class='pull-right']" position="replace"/>
 			<div class="pull-right" t-ignore="true" t-if="not editable">
	   	             Powered by <a class="label label-danger" href="http://www.odoo.com">Odoo</a>,
	                     provided by <a class="label label-danger" href="http://www.twanda.com">twanda AG</a>.
 	     	        </div>
		<xpath expr="//div[@class='pull-left text-muted']" position="replace"/>
			<div class="pull-left text-muted">
		             Copyright &amp;copy; <span t-esc="time.strftime('%Y')"/> <span t-field="res_company.name">Company name</span>
 		        </div>
        </data>

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

<openerp>

<data>

<template id="tw_layout_footer_copyright" inherit_id="website.layout">

<xpath expr="//div[@class='container mt16 mb8']/div[@class='pull-right']" position="replace">

<div class="pull-right" t-ignore="true" t-if="not editable">

Powered by <a class="label label-danger" href="http://www.odoo.com">Odoo</a>,

provided by <a class="label label-danger" href="http://www.twanda.com">twanda AG</a>.

</div>

</xpath>

<xpath expr="//div[@class='pull-left text-muted']" position="replace">

<div class="pull-left text-muted">

Copyright &amp;copy; <span t-esc="time.strftime('%Y')"></span> <span t-field="res_company.name">Company name</span>

</div>

</xpath>

</template>

</data>

</openerp>

อวตาร
ละทิ้ง
ผู้เขียน

Thank you very much, it works, but now I have a double copyright footer, that means that the original copyright footer website.layout_footer_copyright which I can find under Settings/Technical/User Interface/Views is not being replaced.

Related Posts ตอบกลับ มุมมอง กิจกรรม
0
ม.ค. 24
39
1
มิ.ย. 19
8442
Change existing xpath expression in Odoo แก้ไขแล้ว
1
พ.ย. 18
8457
How to replace a title with xpath? แก้ไขแล้ว
6
ธ.ค. 23
20421
2
ก.พ. 24
3545