Odoo Help


This community 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.


How to add custom javascript in the tree view

Shivam Goyal
on 8/1/15, 2:33 PM 539 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"/>


Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)


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