Search code examples
odooodoo-8

How to implement the website theme to my template in odoo


I am fairly new to odoo, and for my internship i need to create a module with a website. For the website I am already able to display a small bit of text on an empty white page.

here is my current working code:

The Template:

<template id="moestuin_webpage">
    <div>
      <h1>Testje</h1>
    </div>
</template>

The Controller:

# -*- coding: utf-8 -*-
from openerp import http

class Moestuin(http.Controller):

@http.route('/moestuin/', auth='public')
def index(self, **kw):
    #return "Hello, world"
    return http.request.render('moestuin.moestuin_webpage')

As stated above, this results a white page displaying "Testje"

But whenever I try to add the website.layout (as seen from other modules) to my Template like this:

<template id="moestuin_webpage">
  <t t-call="website.layout">
    <div>
      <h1>Testje</h1>
    </div>
  </t>
</template>

I only get an error on my page

Internal Server Error

The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.

I searched everywhere for solutions, but I couldn't find anything.

Any ideas on how to get this to work, am I forgetting anything?


Solution

  • You have to fulfill all the steps from here: odoo website support

    • have the dependency correctly configured
    • use auth='public' and website=True in your route
    • now you can use t-call='website.layout