コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
8134 ビュー

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 ?

著作者

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

著作者 最善の回答

I've found a solution:

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

    module.CalendarView.include({
        init_scheduler: function() {
            var readonly =this.fields_view.arch.attrs.ReadOnly
            if(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

アバター
破棄
関連投稿 返信 ビュー 活動
1
8月 22
8108
0
6月 25
242
2
6月 25
331
0
4月 25
802
2
1月 25
1076