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

I need to set 'Everybody's Calendar' always check by default in the right side of odoo calendar. It's always on Administrator[Me] and i have to select 'everybody's calendar' to see the events.

Yenthe Van Ginneken said here https://www.odoo.com/fr_FR/forum/aide-1/question/where-is-the-code-for-the-everybody-s-calendars-boolean-in-the-calendar-app-150133 that the code for this is in _loadFilter but i can't figure how to do it.. Thank you!

I can't post a print, but here it is https://stackoverflow.com/questions/57115029/how-to-set-everybodys-calendar-by-default





아바타
취소
작성자 베스트 답변
    <record id="view_l10n_cu_calendar_event_calendar" model="ir.ui.view">
<field name="name">calendar.event.calendar</field>
<field name="model">calendar.event</field>
<field name="inherit_id" ref="calendar.view_calendar_event_calendar"/>
<field name="arch" type="xml">
<data>
<field name="partner_ids" position="replace" >
<field name="partner_ids"/>
</field>
</data>
</field>
</record>


아바타
취소

Where do you implement this in order to make this work on V 10 please?

베스트 답변

Can you help me work out how to do this in v17? 

아바타
취소
베스트 답변

Was able to 'default' to the All option (Everything/Everybody) by manually toggling the checkboxes during initialization. This results in selection loading twice but acheives desired affect. Leaving here for others:


odoo.define('service.CalendarModel', function (require) {

    "use strict"


var waitFor = function(selector, callback) {

    var element = $(selector);

    if (element.length) {

        callback(element);

    } else {

        setTimeout(function() {

            waitFor(selector, callback);

        }, 100);

    }

};


var CalendarModel = require('web.CalendarModel')


CalendarModel.include({

    /**

     * @override

     */

    init: function (context) {

        this._super.apply(this, arguments)

        // This is a hack to select 'Everything/Everybod's calendars' filters by default (instead of just 'Username [Me]')

        waitFor('.o_calendar_filter_item', function(filters) {

            filters.map(function() {

                var isAll = $(this).data('value') === 'all';

                var checkbox = $(this).find('.custom-control input').get(0);

                if (checkbox && (isAll && !checkbox.checked) || (!isAll && checkbox.checked)) {

                    return checkbox;

                }

            }).click();

        });

    }

})

});

아바타
취소

Can you specify which Odoo version you are using?

베스트 답변

here is my code for v14 . 

need to set "not_init" so it only calls on _loadFilter on initial load


var CalendarModel = require('web.CalendarModel')
CalendarModel.include({
   _loadFilter: function(filter){
       if (!filter.not_init){
           filter.not_init = true;
           filter.all = true;
       }
       return this._super(filter);
   },
});
아바타
취소
관련 게시물 답글 화면 활동
1
7월 19
4359
0
8월 19
3073
1
7월 19
267
1
5월 21
16047
1
4월 21
4812