Odoo Help


How can I get object attribute in js script?

Bonnet Denis
on 2/25/13, 11:46 AM 1,974 views

I want to extend calendar view with a read-only field but I don't know how I can get this field in JS file.

I think I can use instance var:

openerp.web_calendar = function(instance) {
    var _t = instance.web._t,
    _lt = instance.web._lt;
    var QWeb = instance.web.qweb; 

But I dont understand how it's working. If someone can help me.

Which field you want to make it readonly? or the calendar view ?

Yug Faa
on 3/31/14, 8:02 AM

I want to set all the calendarView at ReadOnly. I create a module that do this. Anyway thanks for your answer.

Bonnet Denis
on 3/31/14, 11:11 AM

Bonnet Denis

--Bonnet Denis--
| 5 6 8
St avé, France
--Bonnet Denis--

CEO/ODOO expert at Talyes.in

Bonnet Denis
On 3/31/14, 11:09 AM

I've found a solution:

openerp.readOnlyCalendar = function(instance){
    var module = instance.web_calendar // loading the namespace of the 'web_calendar' module

        init_scheduler: function() {
            var readonly =this.fields_view.arch.attrs.ReadOnly
                scheduler.config.readonly= true;
            this._super();  // calling the original CalendarView.init_scheduler() method

I use this code in a custom module: lp:~eirhylien/server-env-tools/readOnlyCalendar

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: 2/25/13, 11:46 AM
Seen: 1974 times
Last updated: 3/16/15, 8:10 AM