当前位置: 动力学知识库 > 问答 > 编程问答 >

openerp - Odoo 10 and fullcalendar resource view

问题描述:

I try to build a new view_type named schedule du manage a schedule with fullcalendar 2.x

I had a functional poc on a v8 instance but porting to v10 give me issues.

/*---------------------------------------------------------

* OpenERP web_schedule

*---------------------------------------------------------*/

odoo.define('web_schedule.ScheduleView', function (require) {

"use strict";

var core = require('web.core');

var data = require('web.data');

var form_common = require('web.form_common');

var formats = require('web.formats');

var Model = require('web.DataModel');

var time = require('web.time');

var utils = require('web.utils');

var View = require('web.View');

var local_storage = require('web.local_storage');

var CompoundDomain = data.CompoundDomain;

var _t = core._t;

var _lt = core._lt;

var QWeb = core.qweb;

function is_virtual_id(id) {

return typeof id === "string" && id.indexOf('-') >= 0;

}

function isNullOrUndef(value) {

return _.isUndefined(value) || _.isNull(value);

}

var ScheduleView = View.extend({

template: "ScheduleView",

display_name: _lt('Schedule'),

icon: 'fa-calendar',

init: function() {

this._super.apply(this, arguments);

this.shown = $.Deferred();

},

start: function() {

console.log('start');

this.$schedule = this.$el.find("#schedule");

this.shown.done(this._do_show_init.bind(this));

return this._super();

},

_do_show_init: function () {

console.log('_do_show_init')

this.init_calendar().then(function() {

$(window).trigger('resize');

});

},

init_calendar: function() {

console.log('init calendar')

var defs = [];

this.$schedule.fullCalendar(this.get_fc_init_options());

return $.when.apply($, defs);

},

get_fc_init_options: function () {

console.log('get_fc_init_options')

},

});

core.view_registry.add('schedule', ScheduleView);

return ScheduleView;

});

This code is an adaptation from web_calendar.js, a core module to manage the Odoo calendar.

My view is called, I have no error in my console except a depreciation warning with localtime and moment.js but nothing works.

My code only returns the console.log('start'); and never goes to this.shown.done(this._do_show_init.bind(this));

An idea ?

分享给朋友:
您可能感兴趣的文章:
随机阅读: