This question has been flagged
4564 Views

I am trying to implement custom dashboard page on webclient side within my module.
So, basically, I would like to have template with all web.client menus preloaded - and then I will just fill the html of the dashboard with any data I want (custom html)

In order to do this, I tried to create a custom controller, which will load custom template - where I am loading all necessary resources for web.client to show.

The template from bellow is loaded without any kind of javascript errors or similar (when i visit that controller). Unforunnately, nothing is loaded (i can see the blank page only), without any menus which are usually available as part of the webclient.

How I can implement a blank dashboard which will preload web.client menus and things automatically?

@http.route('/web/dashboard', type='http', auth='public', website=True)
    def render_dashboard_page(self):
        return http.request.render('mymodule.dashboard', {})

<template id="dashboard">
    <t t-call="web.layout">
        <t t-set="head_web">             <t t-call-assets="web.assets_common" t-js="false"/>
            <t t-call-assets="web.assets_backend" t-js="false"/>
            <t t-call-assets="web.assets_common" t-css="false"/>
            <t t-call-assets="web.assets_backend" t-css="false"/>
            <script type="text/javascript">
                odoo.define('web.web_client', function (require) {
                    var WebClient = require('web.WebClient');
                    var web_client = new WebClient();                            
                    $(function() {
                        web_client.setElement($(document.body));
                        web_client.start();
                    });
                    return web_client;
                });
            </script>
        </t>
        <t t-set="head" t-value="head_web + (head or '')"/>
        <t t-set="body_classname" t-value="'o_web_client'"/>
    
<div class="o_main"> <main class="o_main_content"/> </div>
    </t>
</template>
Avatar
Discard