Odoo Help


How to add custom javascript in the tree view

Shivam Goyal
on 8/1/15, 2:33 PM 1,352 views


I am trying to add some field for filtering the tree view exactly like journal items view. I have tried it before and it worked but i have no clue why it is not working this time. I am getting error on the front end "Uncaught TypeError: Cannot read property 'view_id' of undefined". Following are my files

mail_message.js --->

openerp.complaint_system = function (instance) {

var _t = instance.web._t,

_lt = instance.web._lt;

var QWeb = instance.web.qweb;

instance.web.complaint_system=instance.web.complaint_system || {};

instance.web.views.add('tree_mail_message_quickadds', 'instance.web.complaint_system.QuickAddListView');

instance.web.complaint_system.QuickAddListView = instance.web.ListView.extend({

init: function() {

this._super.apply(this, arguments);



var tmp = this._super.apply(this, arguments);



var self = this;

this._super.apply(this, arguments);

this.$el.parent().prepend(QWeb.render("MailMessageQuickAdd", {widget: this}));




xml file ---->

<record id="mail_message_tree_views" model="ir.ui.view">

<field name="name">Complaints</field>

<field name="model">mail.message</field>

<field name = "priority">100</field>

<field name="arch" type="xml">

<tree string="Logs" create="False" on_write="on_create_write" editable="top">

<field name = "date" />

<field name = "employee_id" />

<field name = "complaint" />




<record id="action_mail_message_all_a" model="ir.actions.act_window">

<field name="name">Complaints</field>

<field name="res_model">mail.message</field>

<field name= "view_type">form</field>

<field name= "view_mode">tree_mail_message_quickadds</field>

<field name = "view_id" ref = "mail_message_tree_views" />

<field name="search_view_id" ref="mail.view_message_search"/>


About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 8/1/15, 2:33 PM
Seen: 1352 times
Last updated: 8/1/15, 2:33 PM