Custom Frontend in Odoo 17 Using Controllers and QWeb

December 8, 2025 by
Custom Frontend in Odoo 17 Using Controllers and QWeb
Fazri Muhammad Yazid
| No comments yet

This guide shows how to build a simple custom frontend page in Odoo 17 through a dedicated module named custom_sgeede. The focus is on creating a clean public route using a controller, preparing a QWeb template to render the page, and exposing that page through a backend menu using a URL action. The steps illustrate how Odoo handles routing, template rendering, and menu integration, giving beginners a direct view of how to deliver custom frontend content without relying on the website builder.


Directory

custom_sgeede/
├── controllers/
│   ├── init.py
│   └── main.py
├── views/
│   └── sgeede_custom_page.xml
├── init.py
└── manifest.py


Step 1: Create Controller to render View

controllers/main.py

from odoo import http
from odoo.http import request

class SgeedeCustomController(http.Controller):
    @http.route('/my/custom-page', type='http', auth='public', website=True)
    def my_custom_page(self):
        return request.render('custom_sgeede.my_custom_page')

This file defines a simple controller.
The route /my/custom-page becomes a public URL that anyone can open.
When accessed, it loads a QWeb template named custom_sgeede.my_custom_page.


Step 2: Create the Template and Action

views/sgeede_custom_page.xml

<?xml version='1.0' encoding='utf-8'?>
<odoo>

    <template id="my_custom_page">
        <t t-call="web.frontend_layout">
            <!--
                no_header = True removes the default Odoo website header.
                no_footer = True removes the default Odoo website footer.
                Both are useful when you want a clean, empty page layout that
                does not show navigation menus or footer blocks.
            -->
            <t t-set="no_header" t-value="True"/>
            <t t-set="no_footer" t-value="True"/>
            <div class="container">
                <h1>My Custom Frontend Page</h1>
            </div>
        </t>
    </template>

    <record id="action_open_custom_front_end" model="ir.actions.act_url">
        <field name="name">Custom Frontend</field>
        <field name="type">ir.actions.act_url</field>
        <field name="url">/my/custom-page</field>
        <field name="target">self</field>
    </record>

    <menuitem
        id="menuitem_custom_frontend"
        action="action_open_custom_front_end"
        sequence="1"
    />

</odoo>

The act_url action allows backend users to open the frontend page directly from a menu item.


Step 3: Set Module Manifest

__manifest__.py

{

    "name": "SGEEDE Custom For Blog",

    "version": "17.0.1.0.0",

    "summary": "Custom module for SGEEDE Blog",

    "category": "Custom",

    "author": "SGEEDE",

    "website": "https://sgeede.com",

    "license": "LGPL-3",

    "depends": [

        "base",

        "sale",

        "web",

    ],

    "data": [

        "views/sgeede_custom_page.xml"

    ],

    "installable": True,

    "application": False,

}


Now you can upgrade the module and see the result.


Custom Frontend in Odoo 17 Using Controllers and QWeb
Fazri Muhammad Yazid December 8, 2025
Share this post
Archive
Sign in to leave a comment