[MIG] web_timeline module from v10 to v11

* Update Version in Manifest
* Remove enconding in .py files
* Rewrite the view definition according to version 11
This commit is contained in:
Martin Nicolas Cuesta
2018-04-13 15:22:01 -03:00
committed by CarlosRoca13
parent a55ef08f89
commit 38c2da502c
11 changed files with 781 additions and 553 deletions

View File

@@ -0,0 +1,58 @@
odoo.define('web_timeline.TimelineModel', function (require) {
"use strict";
var AbstractModel = require('web.AbstractModel');
var TimelineModel = AbstractModel.extend({
init: function () {
this._super.apply(this, arguments);
},
load: function (params) {
var self = this;
this.modelName = params.modelName;
this.fieldNames = params.fieldNames;
if (!this.preload_def) {
this.preload_def = $.Deferred();
$.when(
this._rpc({model: this.modelName, method: 'check_access_rights', args: ["write", false]}),
this._rpc({model: this.modelName, method: 'check_access_rights', args: ["unlink", false]}),
this._rpc({model: this.modelName, method: 'check_access_rights', args: ["create", false]}))
.then(function (write, unlink, create) {
self.write_right = write;
self.unlink_right = unlink;
self.create_right = create;
self.preload_def.resolve();
});
}
this.data = {
domain: params.domain,
context: params.context,
};
return this.preload_def.then(this._loadTimeline.bind(this));
},
_loadTimeline: function () {
var self = this;
return self._rpc({
model: self.modelName,
method: 'search_read',
context: self.data.context,
fields: self.fieldNames,
domain: self.data.domain,
})
.then(function (events) {
self.data.data = events;
self.data.rights = {
'unlink': self.unlink_right,
'create': self.create_right,
'write': self.write_right,
};
});
},
});
return TimelineModel;
});