Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
8169 มุมมอง

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

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
ส.ค. 22
8115
0
มิ.ย. 25
287
2
มิ.ย. 25
359
0
เม.ย. 25
818
Odoo icon change แก้ไขแล้ว
2
ม.ค. 25
1124