How to remove full footer from odoo10? - odoo

I am using odoo10 community edition .
I try to remove full footer
<template id="default_footer_remove" inherit_id="website.footer_custom">
<xpath expr="//div[#id='footer']" position="attributes">
<attribute name="t-att-style">'display: none;'</attribute>
</xpath>
</template>
This is my code . it will remove the contents .
This is the footer before execute .
This is the image after execute.
How to remove full footer ?

In order to completely hide or remove the footer you should give the attribute to the parent tag: <footer> not to inner one.
Here is the footer part of default Odoo website layout:
<footer>
<div id="footer">
</div>
</footer>
So, you should give attribute to footer tag. In this piece of code I directly replace it with nothing:
<template id="default_footer_remove" inherit_id="website.layout">
<xpath expr="//footer" position="replace">
</xpath>
</template>

Here is an example of how you could remove the footer in Odoo 10 using the XML templating engine:
<template id="website.footer_custom" inherit_id="website.footer_custom"
name="Remove Footer" priority="1" >
<xpath expr="//div[#id='footer']" position="replace">
<div style="display: none;"></div>
</xpath>
</template>
This code uses the template tag with the id attribute set to "website.footer_custom" and inherit_id attribute set to "website.footer_custom" so it will override the existing template, and the xpath tag is then used to target the div element with the id "footer" and replace it with an empty div with a style attribute set to "display: none;", which effectively hides the footer from the website.
You would need to add this to a XML file inside an Odoo module and then install that module in Odoo.
Please note that this code will remove the entire footer, including all its content.

Related

Inherit a qweb template (t-name) in odoo 10

I am trying to extend a qweb template view. But it's not working.
Here is my code.
my_module/static/src/xml/website.xml
<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
<t t-extend="website.homepage_editor_welcome_message" >
<t t-jquery=".lead" t-operation="replace">
<p class="lead second_head">Let's start designing.</p>
</t>
</t>
</templates>
Here is the original code from the website module.
<div t-name="website.homepage_editor_welcome_message" class="container text-center o_homepage_editor_welcome_message">
<h2 class="mt0">Welcome to your <b>Homepage</b>!</h2>
<p class="lead">Let's start designing.</p>
<div class="o_tooltip_container">Follow all the <div class="o_tooltip bottom"/> signs to get your website ready in no time.</div>
</div>
And add the XML file in __manifest__.py like below.
'qweb': ['static/src/xml/website.xml'],
But no change in website.
How can i do it?
The only way I was able to find to be able to inherit a Qweb template declared with t-name is to redefine it in your custom module, change the code directly. You will be overriding the existing one.

Creating first view in Vue.js

I'm creating first view in Vuejs like this:
<template>
<p>Welcome to MyWebsite</p>
<p>These terms and conditions outline the rules and regulations for the use of MySite Website.</p> <br />
<span style="text-transform: capitalize;"> MySite</span> is located at:<br />
<address>Adresss , City<br />State - 00000, USA<br />
</address>
</template>
But I always get
Welcome to MyWebsite These terms and conditions outline
the rules and regulations for the use of MySite Website.
MySite is located
at: Adresss , CityState - 00000, USA
Component template should contain exactly one root element. If you are using v-if on multiple elements, use v-else-if to chain them
instead.
why it recommend me to use v-if? I don't understand what should I do there? Regards
Component template should contain exactly one root element.
<template>
<div><!-- ONLY ONE DIRECT CHILD IN THE TEMPLATE -->
<p>Welcome to MyWebsite</p>
<p>These terms and conditions outline the rules and regulations for the use of MySite Website.</p> <br />
<span style="text-transform: capitalize;"> MySite</span> is located at:<br />
<address>Adresss , City<br />State - 00000, USA<br /></address>
</div>
</template>
For similar reasons to why React can only render a single root node Vue.js requires the first thing in the <template> to be the opening of a containing element inside of which the rest of the template will be written. Vue.js is guessing this is what you want, but it's better to make it explicit. Thus, to fix it:
<template>
<div>
<p>Welcome to MyWebsite</p>
<p>These terms and conditions outline the rules and regulations for the use of MySite Website.</p> <br />
<span style="text-transform: capitalize;"> MySite</span> is located at:<br />
<address>Adresss , City<br />State - 00000, USA<br />
</address>
</div>
</template>
The root element refers to your components root div-like element which is <template></template>
So, vue is telling you that below these root components you should only have one element: which means,
<template>
<div>
// put everything here
</div>
</template>
As stated above, you need to encapsulate the content inside a unique block (div, section...).
<template>
<section>
....
</section>
</template>

How to change header and footer for odoo enterprise default report e.g. Profit and loss, Balance Sheet in PDF format

I am using odoo 9 enterprise version.
I have to customize header and footer of accounting reports e.g. Profit and loss, Balance Sheet in PDF file.
I searched a lot but seems helpless to customized header and footer.
Thanks in advance.
in Account reports where ever header and footer is not coming there odoo using to call report.internal_layout.by inheriting those report change report.external_layout.
this is my code for custom header and footer by inheriting odoo header and footer.
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<data>
<template id="external_layout_header_inherit_cr"
inherit_id="report.external_layout_header">
<xpath expr="//div[#class='header']" position="replace">
<div class="header">
<!-- you're code here -->
</div>
</xpath>
</template>
<template id="external_layout_footer_inherit_cr"
inherit_id="report.external_layout_footer">
<xpath expr="//div[#class='footer']" position="replace">
<div class="footer">
<!-- you're code here -->
</div>
</xpath>
</template>
</data>
</odoo>
now i'm changing odoo financial report by inherting it.
<template id="report_financial_inherit"
inherit_id="module_name.inherit_id">
<xpath expr="//t[#t-call='report.internal_layout']" position="replace">
<!-- here they are calling internal report only but i'm using
external layout becoz in external layout i have header and footer -->
<t t-call="report.external_layout">
<div class="page">
<!--add oddo financial report code/ your custom code-->
</div>
</t>
</xpath>
</template>
I hope you understand what actually work..or do.

Can't remove custom Odoo snippet

I created a custom snippet on Odoo 8. Basically it is a slideshow component from uikit that I want to insert as a content inside .row bootstrap elements, that is, inside another snippet. Below is my code. However, when I try to remove the slideshow snippet via the Website builder (not the HTML Editor), it still appears after saving. The only way I can remove it is by editing it from the HTML Editor. What could be wrong?
<openerp>
<data>
<template id="snippet_blocks" inherit_id="website.snippets" name="Snippet Blocks">
<!-- Create new group called Essentials-->
<xpath expr="div[1]/ul" position="inside">
<li>
Essentials
</li>
</xpath>
<xpath expr="div/div/div[#id='snippet_effect']" position="after">
<div id="snippet_essentials" class="tab-pane">
<!-- Slideshow Snippet -->
<div class="we_snippet">
<!-- Snippet thumnail-->
<div class="oe_snippet_thumbnail">
<img class="oe_snippet_thumbnail_img"
src="/sci5_website_essentials/static/img/slideshow.png"/>
<span class="oe_snippet_thumbnail_title">Slideshow</span>
</div>
<!-- Snippet code to insert-->
<div class="oe_snippet_body we_slideshow col-md-8 mb128">
<t t-call="sci5_website_essentials.snippet_slideshow"/>
</div>
</div>
</div>
</xpath>
</template>
<template id="snippet_options" inherit_id="website.snippet_options" name="Snippet Options">
<xpath expr="." position="inside">
<div data-snippet-option-id='snippet_essentials'
data-selector=".we_slideshow"
data-selector-siblings=".row > [class*='col-md-']"
data-selector-children=".row">
</div>
</xpath>
</template>
</data>
</openerp>
This is the snippet body:
<openerp>
<data>
<template id="snippet_slideshow" name="Slideshow">
<section class="snippet_slideshow">
<ul class="uk-slideshow" data-uk-slideshow="{autoplay:true}">
<li>
<img src="/website/static/src/img/library/business_conference.jpg"/>
</li>
<li>
<img src="/website/static/src/img/library/gears.png"/>
</li>
<li>
<img src="/website/static/src/img/library/engineer.jpg"/>
</li>
</ul>
</section>
</template>
</data>
</openerp>
I recently solved it by placing the snippet block's template to the snippets template itself. Apparently there is a problem with calling the subtemplate.
When I drag the snippet inside another snippet, I'm actually dragging the <t t-call="template_name"> tag into another snippet. It means that one cannot change the template right in where it is dragged but only by editing the subtemplate itself, which means that when it is dragged into some other template, the changes is inherited, and which is very unlikely expected.
Go to Settings, and clear all those snippet things from particular view file.
Settings -> General Settings -> User Interface -> Views
Then,
Find your
view & edit it
.
Clear template code which you cant to clear.
Note : Before delete any section please correct one time it.

Template inheritance in odoo

I want to create a new theme for odoo. I have done it by create a new module and install it. I see in this document here which said that odoo support template inheritance by using t-extend keyword. However I can't make it.
This is my customized template:
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template id="website.homepage" name="Homepage" page="True">
<div class="header">
<h1>FOO<h1>
<div class="main">
</div>
</div>
</template>
<template id="website.contact" name="Homepage" page="True">
<t t-extend="website.homepage">
<t t-jquery="div.main" t-operation="inner">
<h1>FOO 2</h1>
</t>
</t>
</template>
</data>
</openerp>
Template website.contact should have showed FOO and FOO 2 but it only showed FOO 2.
Please help me explain it. Thanks.
You use a syntax for client side templates, but those are server side templates. You use inheritance with server side templates this:
<template id="contact" inherit_id="website.homepage">
<xpath expr="//div[#class='main']" position="inside">
<h1>FOO 2</h1>
</xpath>
</template>
You can read more in the official documentation.
You are trying to create new theme.? and are you using odoo 8.0.? I am asking this because the link you posted is for OpenERP 7.0
So for Odoo 8.0 new documentation is available see here and for QWEB you can find it here QWEB.
Now Main thing if you are trying to create new theme for CMS or Website module then you must go through these steps.
Using Xpath here you can Inherit and make changes on parent tempaltes, examples follows.
<template id="homepage_extend" inherit_id="website.homepage">
<xpath expr="//div[#class='main']" position='inside'>
<h1>FOO 2</h1>
</xpath>
</template>
or try
<template id="homepage_extend" inherit_id="website.homepage">
<xpath expr="//div[#class='header']" position='replace'>
<div class="header">
<h1>FOO<h1>
<div class="main">
<h1>FOO 2</h1>
</div>
</div>
</xpath>
</template>
You can also try these by overriding that template like:
<template id="website.homepage">
<div class="header">
<h1>FOO<h1>
<div class="main">
<h1>FOO 2<h1>
</div>
</div>
</template>
while overriding don't forget to gave the exact id followed by module name.
Cheers !
In parent template, add <t t-raw="0"/> or <t t-raw="name"/>, template: ...code html...
https://www.odoo.com/documentation/9.0/reference/qweb.html
Hello Minh-Hung Nguyen,
Try this code,
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template id="website.homepage" name="Homepage" page="True">
<div class="header">
<h1>FOO<h1>
<div class="main">
</div>
</div>
</template>
<template id="website.contact" name="Homepage" page="True">
<t t-extend="website.homepage">
<!-- Use 'append' to add the h1 tag inside main div -->
<t t-jquery="main" t-operation="append">
<h1>FOO 2</h1>
</t>
</t>
</template>
</data>
</openerp>
I hope my answer is helpfull for you.