Merge from trunk
bzr revid: mit@openerp.com-20120111122421-5mywxemtnp0e7an8
This commit is contained in:
@@ -36,7 +36,7 @@ openerp.web.Notification = openerp.web.Widget.extend(/** @lends openerp.web.Not
|
||||
|
||||
});
|
||||
|
||||
openerp.web.Dialog = openerp.web.OldWidget.extend(/** @lends openerp.web.Dialog# */{
|
||||
openerp.web.Dialog = openerp.web.Widget.extend(/** @lends openerp.web.Dialog# */{
|
||||
dialog_title: "",
|
||||
identifier_prefix: 'dialog',
|
||||
/**
|
||||
@@ -46,9 +46,12 @@ openerp.web.Dialog = openerp.web.OldWidget.extend(/** @lends openerp.web.Dialog#
|
||||
* @param parent
|
||||
* @param options
|
||||
*/
|
||||
init: function (parent, options) {
|
||||
init: function (parent, options, content) {
|
||||
var self = this;
|
||||
this._super(parent);
|
||||
if (content) {
|
||||
this.$element = content instanceof $ ? content : $(content);
|
||||
}
|
||||
this.dialog_options = {
|
||||
modal: true,
|
||||
destroy_on_close: true,
|
||||
@@ -72,6 +75,11 @@ openerp.web.Dialog = openerp.web.OldWidget.extend(/** @lends openerp.web.Dialog#
|
||||
if (options) {
|
||||
_.extend(this.dialog_options, options);
|
||||
}
|
||||
if (this.dialog_options.autoOpen) {
|
||||
this.open();
|
||||
} else {
|
||||
this.$element.dialog(this.get_options());
|
||||
}
|
||||
},
|
||||
get_options: function(options) {
|
||||
var self = this,
|
||||
@@ -103,11 +111,6 @@ openerp.web.Dialog = openerp.web.OldWidget.extend(/** @lends openerp.web.Dialog#
|
||||
return parseInt(val, 10);
|
||||
}
|
||||
},
|
||||
start: function () {
|
||||
this.$element.dialog(this.dialog_options);
|
||||
this._super();
|
||||
return this;
|
||||
},
|
||||
open: function(options) {
|
||||
// TODO fme: bind window on resize
|
||||
if (this.template) {
|
||||
@@ -195,13 +198,12 @@ openerp.web.CrashManager = openerp.web.CallbackEnabled.extend({
|
||||
}
|
||||
var dialog = new openerp.web.Dialog(this, {
|
||||
title: "OpenERP " + _.str.capitalize(this.error.type),
|
||||
autoOpen: true,
|
||||
width: '80%',
|
||||
height: '50%',
|
||||
min_width: '800px',
|
||||
min_height: '600px',
|
||||
buttons: buttons
|
||||
}).start();
|
||||
}).open();
|
||||
dialog.$element.html(QWeb.render('CrashManagerError', {session: openerp.connection, error: error}));
|
||||
},
|
||||
});
|
||||
@@ -782,8 +784,7 @@ openerp.web.Header = openerp.web.Widget.extend(/** @lends openerp.web.Header# *
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
this.dialog.start().open();
|
||||
}).open();
|
||||
action_manager.appendTo(this.dialog);
|
||||
action_manager.render(this.dialog);
|
||||
},
|
||||
@@ -793,8 +794,7 @@ openerp.web.Header = openerp.web.Widget.extend(/** @lends openerp.web.Header# *
|
||||
this.dialog = new openerp.web.Dialog(this, {
|
||||
title: _t("Change Password"),
|
||||
width : 'auto'
|
||||
});
|
||||
this.dialog.start().open();
|
||||
}).open();
|
||||
this.dialog.$element.html(QWeb.render("Change_Pwd", self));
|
||||
this.dialog.$element.find("form[name=change_password_form]").validate({
|
||||
submitHandler: function (form) {
|
||||
|
||||
@@ -293,16 +293,16 @@ openerp.web.DataSet = openerp.web.Widget.extend( /** @lends openerp.web.DataSet
|
||||
*
|
||||
* @param {Array} ids identifiers of the records to read
|
||||
* @param {Array} fields fields to read and return, by default all fields are returned
|
||||
* @param {Function} callback function called with read result
|
||||
* @returns {$.Deferred}
|
||||
*/
|
||||
read_ids: function (ids, fields, callback) {
|
||||
read_ids: function (ids, fields, options) {
|
||||
var options = options || {};
|
||||
return this.rpc('/web/dataset/get', {
|
||||
model: this.model,
|
||||
ids: ids,
|
||||
fields: fields,
|
||||
context: this.get_context()
|
||||
}, callback);
|
||||
context: this.get_context(options.context)
|
||||
});
|
||||
},
|
||||
/**
|
||||
* Read a slice of the records represented by this DataSet, based on its
|
||||
@@ -312,22 +312,20 @@ openerp.web.DataSet = openerp.web.Widget.extend( /** @lends openerp.web.DataSet
|
||||
* @params {Object} options
|
||||
* @param {Number} [options.offset=0] The index from which selected records should be returned
|
||||
* @param {Number} [options.limit=null] The maximum number of records to return
|
||||
* @param {Function} callback function called with read_slice result
|
||||
* @returns {$.Deferred}
|
||||
*/
|
||||
read_slice: function (fields, options, callback) {
|
||||
return null;
|
||||
read_slice: function (fields, options) {
|
||||
return null;
|
||||
},
|
||||
/**
|
||||
* Reads the current dataset record (from its index)
|
||||
*
|
||||
* @params {Array} [fields] fields to read and return, by default all fields are returned
|
||||
* @param {Object} [options.context] context data to add to the request payload, on top of the DataSet's own context
|
||||
* @params {Function} callback function called with read_index result
|
||||
* @returns {$.Deferred}
|
||||
*/
|
||||
read_index: function (fields, options, callback) {
|
||||
var def = $.Deferred().then(callback);
|
||||
read_index: function (fields, options) {
|
||||
var def = $.Deferred();
|
||||
if (_.isEmpty(this.ids)) {
|
||||
def.reject();
|
||||
} else {
|
||||
@@ -344,15 +342,16 @@ openerp.web.DataSet = openerp.web.Widget.extend( /** @lends openerp.web.DataSet
|
||||
* Reads default values for the current model
|
||||
*
|
||||
* @param {Array} [fields] fields to get default values for, by default all defaults are read
|
||||
* @param {Function} callback function called with default_get result
|
||||
* @param {Object} [options.context] context data to add to the request payload, on top of the DataSet's own context
|
||||
* @returns {$.Deferred}
|
||||
*/
|
||||
default_get: function(fields, callback) {
|
||||
default_get: function(fields, options) {
|
||||
var options = options || {};
|
||||
return this.rpc('/web/dataset/default_get', {
|
||||
model: this.model,
|
||||
fields: fields,
|
||||
context: this.get_context()
|
||||
}, callback);
|
||||
context: this.get_context(options.context)
|
||||
});
|
||||
},
|
||||
/**
|
||||
* Creates a new record in db
|
||||
@@ -504,14 +503,14 @@ openerp.web.DataSetStatic = openerp.web.DataSet.extend({
|
||||
// all local records
|
||||
this.ids = ids || [];
|
||||
},
|
||||
read_slice: function (fields, options, callback) {
|
||||
read_slice: function (fields, options) {
|
||||
// TODO remove fields from options
|
||||
var self = this,
|
||||
offset = options.offset || 0,
|
||||
limit = options.limit || false,
|
||||
fields = fields || false;
|
||||
var end_pos = limit && limit !== -1 ? offset + limit : this.ids.length;
|
||||
return this.read_ids(this.ids.slice(offset, end_pos), fields, callback);
|
||||
return this.read_ids(this.ids.slice(offset, end_pos), fields);
|
||||
},
|
||||
set_ids: function (ids) {
|
||||
this.ids = ids;
|
||||
@@ -558,10 +557,9 @@ openerp.web.DataSetSearch = openerp.web.DataSet.extend(/** @lends openerp.web.D
|
||||
* @param {Array} [options.domain] domain data to add to the request payload, ANDed with the dataset's domain
|
||||
* @param {Number} [options.offset=0] The index from which selected records should be returned
|
||||
* @param {Number} [options.limit=null] The maximum number of records to return
|
||||
* @param {Function} callback function called with read_slice result
|
||||
* @returns {$.Deferred}
|
||||
*/
|
||||
read_slice: function (fields, options, callback) {
|
||||
read_slice: function (fields, options) {
|
||||
var self = this;
|
||||
var options = options || {};
|
||||
var offset = options.offset || 0;
|
||||
@@ -577,7 +575,7 @@ openerp.web.DataSetSearch = openerp.web.DataSet.extend(/** @lends openerp.web.D
|
||||
self.ids = result.ids;
|
||||
self.offset = offset;
|
||||
return result.records;
|
||||
}).then(callback);
|
||||
});
|
||||
},
|
||||
get_domain: function (other_domain) {
|
||||
if (other_domain) {
|
||||
@@ -631,8 +629,8 @@ openerp.web.BufferedDataSet = openerp.web.DataSetStatic.extend({
|
||||
this.reset_ids([]);
|
||||
this.last_default_get = {};
|
||||
},
|
||||
default_get: function(fields, callback) {
|
||||
return this._super(fields).then(this.on_default_get).then(callback);
|
||||
default_get: function(fields, options) {
|
||||
return this._super(fields, options).then(this.on_default_get);
|
||||
},
|
||||
on_default_get: function(res) {
|
||||
this.last_default_get = res;
|
||||
@@ -700,7 +698,7 @@ openerp.web.BufferedDataSet = openerp.web.DataSetStatic.extend({
|
||||
this.delete_all = false;
|
||||
},
|
||||
on_change: function() {},
|
||||
read_ids: function (ids, fields, callback) {
|
||||
read_ids: function (ids, fields, options) {
|
||||
var self = this;
|
||||
var to_get = [];
|
||||
_.each(ids, function(id) {
|
||||
@@ -714,7 +712,7 @@ openerp.web.BufferedDataSet = openerp.web.DataSetStatic.extend({
|
||||
to_get.push(id);
|
||||
}
|
||||
});
|
||||
var completion = $.Deferred().then(callback);
|
||||
var completion = $.Deferred();
|
||||
var return_records = function() {
|
||||
var records = _.map(ids, function(id) {
|
||||
return _.extend({}, _.detect(self.cache, function(c) {return c.id === id;}).values, {"id": id});
|
||||
@@ -727,7 +725,7 @@ openerp.web.BufferedDataSet = openerp.web.DataSetStatic.extend({
|
||||
completion.resolve(records);
|
||||
};
|
||||
if(to_get.length > 0) {
|
||||
var rpc_promise = this._super(to_get, fields, function(records) {
|
||||
var rpc_promise = this._super(to_get, fields, options).then(function(records) {
|
||||
_.each(records, function(record, index) {
|
||||
var id = to_get[index];
|
||||
var cached = _.detect(self.cache, function(x) {return x.id === id;});
|
||||
@@ -776,8 +774,8 @@ openerp.web.ProxyDataSet = openerp.web.DataSetSearch.extend({
|
||||
return this._super.apply(this, arguments);
|
||||
}
|
||||
},
|
||||
default_get: function(fields, callback) {
|
||||
return this._super(fields, callback).then(this.on_default_get);
|
||||
default_get: function(fields, options) {
|
||||
return this._super(fields, options).then(this.on_default_get);
|
||||
},
|
||||
on_default_get: function(result) {},
|
||||
create: function(data, callback, error_callback) {
|
||||
|
||||
@@ -74,7 +74,7 @@ openerp.web.DataExport = openerp.web.Dialog.extend({
|
||||
}
|
||||
return this.exports.read_slice(['name'], {
|
||||
domain: [['resource', '=', this.dataset.model]]
|
||||
}, function (export_list) {
|
||||
}).then(function (export_list) {
|
||||
if (!export_list.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ openerp.web.DataImport = openerp.web.Dialog.extend({
|
||||
'fields_get', [], function (fields) {
|
||||
self.graft_fields(fields);
|
||||
self.ready.push(new openerp.web.DataSet(self, self.model)
|
||||
.default_get(_.pluck(self.fields, 'id'), function (fields) {
|
||||
.default_get(_.pluck(self.fields, 'id')).then(function (fields) {
|
||||
_.each(fields, function(val, key) {
|
||||
if (val) {
|
||||
self.fields_with_defaults.push(key);
|
||||
|
||||
@@ -47,7 +47,7 @@ openerp.web.ViewEditor = openerp.web.Widget.extend({
|
||||
{text: _t("Remove"), click: function() { self.do_delete_view(); }},
|
||||
{text: _t("Close"), click: function() { self.view_edit_dialog.close(); }}
|
||||
]
|
||||
}).start().open();
|
||||
}).open();
|
||||
this.main_view_id = this.parent.fields_view.view_id;
|
||||
this.action_manager = new openerp.web.ActionManager(this);
|
||||
this.action_manager.appendTo(this.view_edit_dialog);
|
||||
@@ -92,8 +92,7 @@ openerp.web.ViewEditor = openerp.web.Widget.extend({
|
||||
}},
|
||||
{text: _t("Cancel"), click: function () { self.create_view_dialog.close(); }}
|
||||
]
|
||||
});
|
||||
this.create_view_dialog.start().open();
|
||||
}).open();
|
||||
var view_widget = [{'name': 'view_name', 'string':'View Name', 'type': 'char', 'required': true, 'value' : this.model + '.custom_' + Math.round(Math.random() * 1000)},
|
||||
{'name': 'view_type', 'string': 'View Type', 'type': 'selection', 'required': true, 'value': 'Form', 'selection': [['',''],['tree', 'Tree'],['form', 'Form'],['graph', 'Graph'],['calendar', 'Calender']]},
|
||||
{'name': 'proirity', 'string': 'Priority', 'type': 'float', 'required': true, 'value':'16'}];
|
||||
@@ -125,7 +124,7 @@ openerp.web.ViewEditor = openerp.web.Widget.extend({
|
||||
}
|
||||
});
|
||||
if (field_name) {
|
||||
model_dataset.read_slice(['name','field_id'], {"domain": [['model','=',self.model]]}, function(records) {
|
||||
model_dataset.read_slice(['name','field_id'], {"domain": [['model','=',self.model]]}).then(function(records) {
|
||||
if (records) {view_string = records[0].name;}
|
||||
var arch = _.str.sprintf("<?xml version='1.0'?>\n<%s string='%s'>\n\t<field name='%s'/>\n</%s>", values.view_type, view_string, field_name, values.view_type);
|
||||
var vals = {'model': self.model, 'name': values.view_name, 'priority': values.priority, 'type': values.view_type, 'arch': arch};
|
||||
@@ -228,12 +227,12 @@ openerp.web.ViewEditor = openerp.web.Widget.extend({
|
||||
get_arch: function() {
|
||||
var self = this;
|
||||
var view_arch_list = [];
|
||||
this.dataset.read_ids([parseInt(self.main_view_id)], ['arch', 'type'], function(arch) {
|
||||
this.dataset.read_ids([parseInt(self.main_view_id)], ['arch', 'type']).then(function(arch) {
|
||||
if (arch.length) {
|
||||
var arch_object = self.parse_xml(arch[0].arch, self.main_view_id);
|
||||
self.main_view_type = arch[0].type == 'tree'? 'list': arch[0].type;
|
||||
view_arch_list.push({"view_id": self.main_view_id, "arch": arch[0].arch});
|
||||
self.dataset.read_slice([], {domain: [['inherit_id','=', parseInt(self.main_view_id)]]}, function(result) {
|
||||
self.dataset.read_slice([], {domain: [['inherit_id','=', parseInt(self.main_view_id)]]}).then(function(result) {
|
||||
_.each(result, function(res) {
|
||||
view_arch_list.push({"view_id": res.id, "arch": res.arch});
|
||||
self.inherit_view(arch_object, res);
|
||||
@@ -382,7 +381,7 @@ openerp.web.ViewEditor = openerp.web.Widget.extend({
|
||||
self.edit_xml_dialog.close();
|
||||
}}
|
||||
]
|
||||
}).start().open();
|
||||
}).open();
|
||||
var no_property_att = [];
|
||||
_.each(_PROPERTIES, function(val, key) {
|
||||
if (! val.length) no_property_att.push(key);
|
||||
@@ -769,8 +768,7 @@ openerp.web.ViewEditor = openerp.web.Widget.extend({
|
||||
}},
|
||||
{text: _t("Cancel"), click: function () { self.edit_node_dialog.close(); }}
|
||||
]
|
||||
});
|
||||
this.edit_node_dialog.start().open();
|
||||
}).open();
|
||||
var _PROPERTIES_ATTRIBUTES = {
|
||||
'name' : {'name':'name', 'string': 'Name', 'type': 'char'},
|
||||
'string' : {'name':'string', 'string': 'String', 'type': 'char'},
|
||||
@@ -896,7 +894,7 @@ openerp.web.ViewEditor = openerp.web.Widget.extend({
|
||||
}},
|
||||
{text: _t("Cancel"), click: function() { self.add_node_dialog.close(); }}
|
||||
]
|
||||
}).start().open();
|
||||
}).open();
|
||||
this.add_node_dialog.$element.append('<table id="rec_table" style="width:420px" class="oe_forms"><tbody><tr></tbody></table>');
|
||||
var table_selector = self.add_node_dialog.$element.find('table[id=rec_table] tbody');
|
||||
_.each(render_list, function(node) {
|
||||
@@ -916,7 +914,7 @@ openerp.web.ViewEditor = openerp.web.Widget.extend({
|
||||
table_selector.find("td[id^=]").attr("width","100px");
|
||||
self.add_node_dialog.$element.find('#new_field').click(function() {
|
||||
model_data = new openerp.web.DataSetSearch(self,'ir.model', null, null);
|
||||
model_data.read_slice([], {domain: [['model','=', self.model]]}, function(result) {
|
||||
model_data.read_slice([], {domain: [['model','=', self.model]]}).then(function(result) {
|
||||
self.render_new_field(result[0].id);
|
||||
});
|
||||
});
|
||||
@@ -940,7 +938,7 @@ openerp.web.ViewEditor = openerp.web.Widget.extend({
|
||||
controller.do_set_readonly.add_last(function(){
|
||||
action_manager.stop();
|
||||
new_fields_name = new openerp.web.DataSetSearch(self,'ir.model.fields', null, null);
|
||||
new_fields_name.read_ids([controller.datarecord.id], ['name'], function(result) {
|
||||
new_fields_name.read_ids([controller.datarecord.id], ['name']).then(function(result) {
|
||||
self.add_node_dialog.$element.find('select[id=field_value]').append($("<option selected></option>").attr("value", result[0].name).text(result[0].name));
|
||||
_.detect(self.add_widget,function(widget){
|
||||
widget.name == "field_value"? widget.selection.push(result[0].name): false;
|
||||
|
||||
@@ -625,7 +625,7 @@ openerp.web.form.SidebarAttachments = openerp.web.Widget.extend({
|
||||
['res_model', '=', this.view.dataset.model],
|
||||
['res_id', '=', this.view.datarecord.id],
|
||||
['type', 'in', ['binary', 'url']]
|
||||
])).read_slice(['name', 'url', 'type'], {}, this.on_attachments_loaded);
|
||||
])).read_slice(['name', 'url', 'type'], {}).then(this.on_attachments_loaded);
|
||||
}
|
||||
},
|
||||
on_attachments_loaded: function(attachments) {
|
||||
@@ -1698,9 +1698,8 @@ openerp.web.form.dialog = function(content, options) {
|
||||
height: 'auto',
|
||||
min_width: '800px'
|
||||
}, options || {});
|
||||
options.autoOpen = true;
|
||||
var dialog = new openerp.web.Dialog(null, options).open();
|
||||
return dialog.$element.html(content);
|
||||
var dialog = new openerp.web.Dialog(null, options, content).open();
|
||||
return dialog.$element;
|
||||
};
|
||||
|
||||
openerp.web.form.FieldMany2One = openerp.web.form.Field.extend({
|
||||
|
||||
@@ -1016,14 +1016,13 @@ openerp.web.ListView.List = openerp.web.Class.extend( /** @lends openerp.web.Lis
|
||||
[record.get('id')],
|
||||
_.pluck(_(this.columns).filter(function (r) {
|
||||
return r.tag === 'field';
|
||||
}), 'name'),
|
||||
function (records) {
|
||||
_(records[0]).each(function (value, key) {
|
||||
record.set(key, value, {silent: true});
|
||||
});
|
||||
record.trigger('change', record);
|
||||
}
|
||||
);
|
||||
}), 'name')
|
||||
).then(function (records) {
|
||||
_(records[0]).each(function (value, key) {
|
||||
record.set(key, value, {silent: true});
|
||||
});
|
||||
record.trigger('change', record);
|
||||
});
|
||||
},
|
||||
/**
|
||||
* Renders a list record to HTML
|
||||
@@ -1303,7 +1302,7 @@ openerp.web.ListView.Groups = openerp.web.Class.extend( /** @lends openerp.web.L
|
||||
var fields = _.pluck(_.select(this.columns, function(x) {return x.tag == "field"}), 'name');
|
||||
var options = { offset: page * limit, limit: limit, context: {bin_size: true} };
|
||||
//TODO xmo: investigate why we need to put the setTimeout
|
||||
$.async_when().then(function() {dataset.read_slice(fields, options , function (records) {
|
||||
$.async_when().then(function() {dataset.read_slice(fields, options).then(function (records) {
|
||||
// FIXME: ignominious hacks, parents (aka form view) should not send two ListView#reload_content concurrently
|
||||
if (self.records.length) {
|
||||
self.records.reset(null, {silent: true});
|
||||
|
||||
@@ -86,7 +86,7 @@ openerp.web.TreeView = openerp.web.View.extend(/** @lends openerp.web.TreeView#
|
||||
'toolbar': has_toolbar
|
||||
}));
|
||||
|
||||
this.dataset.read_slice(this.fields_list(), {}, function (records) {
|
||||
this.dataset.read_slice(this.fields_list()).then(function(records) {
|
||||
if (!has_toolbar) {
|
||||
// WARNING: will do a second read on the same ids, but only on
|
||||
// first load so not very important
|
||||
@@ -192,7 +192,7 @@ openerp.web.TreeView = openerp.web.View.extend(/** @lends openerp.web.TreeView#
|
||||
getdata: function (id, children_ids) {
|
||||
var self = this;
|
||||
|
||||
self.dataset.read_ids(children_ids, this.fields_list(), function (records) {
|
||||
self.dataset.read_ids(children_ids, this.fields_list()).then(function(records) {
|
||||
_(records).each(function (record) {
|
||||
self.records[record.id] = record;
|
||||
});
|
||||
|
||||
@@ -137,7 +137,6 @@ session.web.ActionManager = session.web.Widget.extend({
|
||||
this.dialog = new session.web.Dialog(this, { width: '80%' });
|
||||
if(on_close)
|
||||
this.dialog.on_close.add(on_close);
|
||||
this.dialog.start();
|
||||
} else {
|
||||
this.dialog_viewmanager.stop();
|
||||
}
|
||||
@@ -519,7 +518,7 @@ session.web.ViewManagerAction = session.web.ViewManager.extend(/** @lends oepner
|
||||
}
|
||||
});
|
||||
if (!(self.action.id in self.session.hidden_menutips)) {
|
||||
Users.read_ids([this.session.uid], ['menu_tips'], function(users) {
|
||||
Users.read_ids([this.session.uid], ['menu_tips']).then(function(users) {
|
||||
var user = users[0];
|
||||
if (!(user && user.id === self.session.uid)) {
|
||||
return;
|
||||
@@ -918,7 +917,7 @@ session.web.TranslateDialog = session.web.Dialog.extend({
|
||||
this.languages = null;
|
||||
this.languages_loaded = $.Deferred();
|
||||
(new session.web.DataSetSearch(this, 'res.lang', this.view.dataset.get_context(),
|
||||
[['translatable', '=', '1']])).read_slice(['code', 'name'], { sort: 'id' }, this.on_languages_loaded);
|
||||
[['translatable', '=', '1']])).read_slice(['code', 'name'], { sort: 'id' }).then(this.on_languages_loaded);
|
||||
},
|
||||
start: function() {
|
||||
var self = this;
|
||||
|
||||
@@ -106,7 +106,6 @@
|
||||
float:right;
|
||||
}
|
||||
.openerp .dhx_cal_prev_button:hover, .openerp .dhx_cal_prev_button:active, .openerp .dhx_cal_today_button:hover, .openerp .dhx_cal_today_button:active, .openerp .dhx_cal_next_button:hover, .openerp .dhx_cal_next_button:active {
|
||||
|
||||
}
|
||||
|
||||
.openerp .dhx_mini_calendar .dhx_cal_prev_button, .openerp .dhx_mini_calendar .dhx_cal_next_button, .openerp .dhx_mini_calendar .dhx_cal_today_button {
|
||||
|
||||
@@ -171,7 +171,7 @@ openerp.web_calendar.CalendarView = openerp.web.View.extend({
|
||||
}
|
||||
},
|
||||
reload_event: function(id) {
|
||||
this.dataset.read_ids([id], _.keys(this.fields), this.on_events_loaded);
|
||||
this.dataset.read_ids([id], _.keys(this.fields)).then(this.on_events_loaded);
|
||||
},
|
||||
get_color: function(key) {
|
||||
if (this.color_map[key]) {
|
||||
@@ -392,7 +392,7 @@ openerp.web_calendar.CalendarView = openerp.web.View.extend({
|
||||
offset: 0,
|
||||
domain: self.get_range_domain(),
|
||||
context: self.last_search[1]
|
||||
}, function(events) {
|
||||
}).then(function(events) {
|
||||
self.dataset_events = events;
|
||||
self.on_events_loaded(events);
|
||||
});
|
||||
|
||||
@@ -296,8 +296,10 @@ openerp.web_dashboard.ConfigOverview = openerp.web.View.extend({
|
||||
'|', ['groups_id', '=', false],
|
||||
['groups_id', 'in', record['groups_id']]];
|
||||
return $.when(
|
||||
self.dataset.read_slice(['state', 'action_id', 'category_id'],{
|
||||
domain: todos_filter }),
|
||||
self.dataset.read_slice(
|
||||
['state', 'action_id', 'category_id'],
|
||||
{ domain: todos_filter }
|
||||
),
|
||||
self.dataset.call('progress').pipe(
|
||||
function (arg) { return arg; }, null))
|
||||
}, null).then(this.on_records_loaded);
|
||||
@@ -373,8 +375,8 @@ openerp.web_dashboard.Widget = openerp.web.View.extend(/** @lends openerp.web_da
|
||||
},
|
||||
start: function () {
|
||||
this._super();
|
||||
return new openerp.web.DataSet(this, 'res.widget').read_ids(
|
||||
[this.widget_id], ['title'], this.on_widget_loaded);
|
||||
var ds = new openerp.web.DataSet(this, 'res.widget');
|
||||
return ds.read_ids([this.widget_id], ['title']).then(this.on_widget_loaded);
|
||||
},
|
||||
on_widget_loaded: function (widgets) {
|
||||
var widget = widgets[0];
|
||||
@@ -403,7 +405,7 @@ openerp.web_dashboard.ApplicationTiles = openerp.web.Widget.extend({
|
||||
openerp.webclient.menu.do_hide_secondary();
|
||||
var domain = [['application','=',true], ['state','=','installed'], ['name', '!=', 'base']];
|
||||
var ds = new openerp.web.DataSetSearch(this, 'ir.module.module',{},domain);
|
||||
ds.read_slice(['id'], {}, function(result) {
|
||||
ds.read_slice(['id']).then(function(result) {
|
||||
if(result.length) {
|
||||
self.on_installed_database();
|
||||
} else {
|
||||
@@ -418,7 +420,7 @@ openerp.web_dashboard.ApplicationTiles = openerp.web.Widget.extend({
|
||||
on_installed_database: function() {
|
||||
var self = this;
|
||||
var ds = new openerp.web.DataSetSearch(this, 'ir.ui.menu', null, [['parent_id', '=', false]]);
|
||||
var r = ds.read_slice( ['name', 'web_icon_data', 'web_icon_hover_data', 'module'], {}, function (applications) {
|
||||
var r = ds.read_slice( ['name', 'web_icon_data', 'web_icon_hover_data', 'module']).then(function (applications) {
|
||||
//// Create a matrix of 3*x applications
|
||||
//var rows = [];
|
||||
//while (applications.length) {
|
||||
|
||||
@@ -422,7 +422,7 @@ openerp.web_graph.GraphView = openerp.web.View.extend({
|
||||
} else {
|
||||
self.abscissa = self.first_field;
|
||||
}
|
||||
return self.dataset.read_slice(self.list_fields(), {}, $.proxy(self, 'schedule_chart'));
|
||||
return self.dataset.read_slice(self.list_fields()).then($.proxy(self, 'schedule_chart'));
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
@@ -162,7 +162,7 @@ openerp.web_kanban.KanbanView = openerp.web.View.extend({
|
||||
group_aggregates[value] = group.aggregates[key];
|
||||
});
|
||||
var dataset = new openerp.web.DataSetSearch(self, self.dataset.model, group.context, group.domain);
|
||||
dataset.read_slice(self.fields_keys, {'domain': group.domain, 'context': group.context}, function(records) {
|
||||
dataset.read_slice(self.fields_keys, {'domain': group.domain, 'context': group.context}).then(function(records) {
|
||||
self.dataset.ids.push.apply(self.dataset.ids, dataset.ids);
|
||||
groups_array[index] = new openerp.web_kanban.KanbanGroup(self, records, group_value, group_name, group_aggregates);
|
||||
if (!remaining--) {
|
||||
@@ -175,7 +175,7 @@ openerp.web_kanban.KanbanView = openerp.web.View.extend({
|
||||
do_process_dataset: function(dataset) {
|
||||
var self = this;
|
||||
this.do_clear_groups();
|
||||
this.dataset.read_slice(this.fields_keys, {}, function(records) {
|
||||
this.dataset.read_slice(this.fields_keys).then(function(records) {
|
||||
var groups = [];
|
||||
while (records.length) {
|
||||
for (var i = 0; i < self.default_nr_columns; i++) {
|
||||
@@ -491,7 +491,7 @@ openerp.web_kanban.KanbanRecord = openerp.web.Widget.extend({
|
||||
},
|
||||
do_reload: function() {
|
||||
var self = this;
|
||||
this.view.dataset.read_ids([this.id], this.view.fields_keys, function(records) {
|
||||
this.view.dataset.read_ids([this.id], this.view.fields_keys).then(function(records) {
|
||||
if (records.length) {
|
||||
self.set_record(records[0]);
|
||||
self.do_render();
|
||||
|
||||
@@ -27,7 +27,7 @@ openerp.web_mobile.FormView = openerp.web.Widget.extend({
|
||||
}
|
||||
this.dataset = new openerp.web.DataSetSearch(this, model, null, null);
|
||||
var context = new openerp.web.CompoundContext(this.dataset.get_context());
|
||||
this.dataset.read_slice([],{}, function (result) {
|
||||
this.dataset.read_slice([]).then(function (result) {
|
||||
for (var i = 0; i < result.length; i++) {
|
||||
if (result[i].id == id) {
|
||||
self.datarecord = result[i];
|
||||
@@ -73,7 +73,7 @@ openerp.web_mobile.FormView = openerp.web.Widget.extend({
|
||||
var list_ids = [];
|
||||
var datasearch = new openerp.web.DataSetSearch(self, rel_field.relation, rel_field.context);
|
||||
datasearch.domain=[['id', 'in', rel_ids]];
|
||||
datasearch.read_slice(['name'], {context:rel_field.context, domain: datasearch.domain, limit:80}, function(listrec){
|
||||
datasearch.read_slice(['name'], {context:rel_field.context, domain: datasearch.domain, limit:80}).then(function(listrec){
|
||||
_.each(listrec, function(i) {
|
||||
list_ids.push(i.id);
|
||||
});
|
||||
|
||||
@@ -33,7 +33,7 @@ openerp.web_mobile.ListView = openerp.web.Widget.extend({
|
||||
var list_ids = [];
|
||||
var datasearch = new openerp.web.DataSetSearch(self, self.action.res_model,self.action.context);
|
||||
datasearch.domain = self.action.domain;
|
||||
datasearch.read_slice(['name'], {context:datasearch.context, domain: datasearch.domain, limit:80}, function(listresult){
|
||||
datasearch.read_slice(['name'], {context:datasearch.context, domain: datasearch.domain, limit:80}).then(function(listresult){
|
||||
_.each(listresult, function(i) {
|
||||
list_ids.push(i.id);
|
||||
});
|
||||
|
||||
@@ -286,7 +286,7 @@ openerp.web_process = function (openerp) {
|
||||
$(this).dialog('destroy');
|
||||
}}
|
||||
]
|
||||
}).start().open();
|
||||
}).open();
|
||||
|
||||
action_manager.appendTo(dialog.$element);
|
||||
action_manager.do_action({
|
||||
|
||||
Reference in New Issue
Block a user