Skip to Content
Menu
This question has been flagged

I tip my hat off to the odoo documenation team.  There is quite a bit of documentation available, however there are some gaps that need filled in, especially for a newbie like me coming from a php background.  The biztech theme available for free helped me the most in figuring out how to modify, and use a basic bootstrap theme.

I have successfully created a theme, and installed it, and I have my homepage rendering to a custom bootstrap theme.  I think I've realized some limitations in the odoo xml theme framework.  I tried to do something simple, in my opinion, which is move the default navigation menu to a location under a parrallax header in the theme.  In php, and traditional cms, this wouldn't be a problem, since there are tags that allow you to place rendered content anywhere inside your theme.  odoo however uses template blocks, and there is not a master template file, that is used on every render(with variables inside for rendering content).

The closest thing is to override the default page layout, using a page definition, but there is not enough documentation of how the default page templates work.  You have to read the code, and there are obviously things I'm missing in the flow. 

I've tried doing a new homepage template using the page=True, and I had much greater control over how that page looked.  The problem with this approach, is the page editing was completely missing.  I could not figure out what t-call to do to include that.

xpath calls are only helpful on the website.layout, and don't help you on an inherited view.

For example, if I were to attempt to replace the existing header in the default layout with empty content, so I could move it later in the template flow, I would think the logical way would be an xpath search with replace.  this works for website.layout, but not if I just want the change on a single page.

<xpath expr="//div[@id='wrapwrap']/header" path is not found, if I use that inside a template, where inherit_id="website.homepage", but it works fine in website.layout.

So my next thought is to actually do this on website.layout, however use template variables to detect homepage.  how would I use a t-call="website.layout", but replace the resulting content based on a t-if homepage?



Avatar
Discard
Best Answer

Hello!
I've been struggling with the same matter. I want lighter or even non-existing <header> (navigation mainly) on the front page. I've tried both using xpath like you but indeed do not know how to choose it then only for ONE website page instead of all, and also with using t-extend but no luck so far...

(here the "frontpage" is the view name you can see if you look with "customize theme".

<?xml version="1.0" encoding="utf-8"?>

<templates>

<t t-extend="website.layout">

<t t-if="website.frontpage">

<t t-jquery="header" t-operation="replace">

<header>

<div class="navbar navbar-default navbar-static-top">

<div class="container">

<div class="collapse navbar-collapse navbar-top-collapse">

<ul class="nav navbar-nav navbar-right" id="top_menu">

<li class="dropdown" t-ignore="true" t-if="website.user_id != user_id" style="display:none;">

<a href="#" class="dropdown-toggle" data-toggle="dropdown">

<b>

<span t-esc="(len(user_id.name)&gt;25) and (user_id.name[:23]+'...') or user_id.name"/>

<span class="caret"></span>

</b>

</a>

<ul class="dropdown-menu js_usermenu" role="menu">

<li id="o_logout"><a t-attf-href="/web/session/logout?redirect=/" role="menuitem">Logout</a></li>

</ul>

</li>

</ul>

</div>

</div>

</div>

</header>

</t>

</t>

</t>

</templates>


Avatar
Discard
Related Posts Replies Views Activity
1
Dec 23
510
1
Dec 22
2979
1
Nov 22
3545
0
Sep 21
2381
0
Apr 21
846