콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
8320 화면

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
8230
0
6월 25
437
2
6월 25
521
0
4월 25
945
Odoo icon change 해결 완료
2
1월 25
1285