Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

[9.0]My first simple module: Element div cannot be located in parent view

By
Ermin Trevisan
on 4/11/16, 11:45 AM 530 views

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>

0
CatsandDogs
On 4/12/16, 2:52 AM

<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.

Ermin Trevisan
on 4/12/16, 3:20 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 4/11/16, 11:45 AM
Seen: 530 times
Last updated: 4/12/16, 2:52 AM