[SOLVED] Creating your own "view" without auxiliary tags – ODOO


I have a question – is it possible to make my own view without using auxiliary tags?
For example, I want to make my own table (or multiple tables on the same page)
Is it possible to implement this without using the "tree" tag?


Yes you can, The Odoo team talked about it in one of their livestreams.

You basically inherit the ir.ui.view model
and under /static/src/js you define the view like:

odoo.define('hello_world_view.HelloWorldView', function (require) {
"use strict";

var HelloWorldRenderer = AbstractRenderer.extend({
    className: "o_hello_world_view",
    _render: function () {
        //render code

You will also need to extend the rest of the js methods
Then you will need to import the js file:

<template id="assets_backend" name="hello world assets" inherit_id="web.assets_backend">
    <xpath expr="." position="inside">
        <script type="text/javascript" src="/hello_world_view/static/src/js/hello_world_view.js"/>
        <link rel="stylesheet" type="text/scss" href="/hello_world_view/static/src/scss/hello_world_view.scss"/>

And finally you can call your view like:

 <record model="ir.actions.act_window" id="first_hello_world_view">
        <field name="name">Hello World</field>
        <field name="res_model">res.partner</field>
        <field name="view_mode">hello_world</field>
        <field name="view_id" ref="hello_world_view_1"/>

If you need to go into detail you can watch the stream here

And this is a link to the github repo for for the full code of this example.

Answered By – Amine El Amri

Answer Checked By – Katrina (BugsFixing Volunteer)

Leave a Reply

Your email address will not be published.