[IMP]remove callbacks from call method and improve related code.

bzr revid: vme@tinyerp.com-20121003103428-fnr942tzl065rcei
This commit is contained in:
Vidhin Mehta (OpenERP) 2012-10-03 16:04:28 +05:30
parent f6314c0907
commit 558ad0616a
3 changed files with 6 additions and 6 deletions

View File

@ -586,8 +586,8 @@ instance.web.DataSet = instance.web.CallbackEnabled.extend({
* @param {Function} error_callback
* @returns {$.Deferred}
*/
call: function (method, args, callback, error_callback) {
return this._model.call(method, args).then(callback, error_callback);
call: function (method, args) {
return this._model.call(method, args);
},
/**
* Calls an arbitrary method, with more crazy

View File

@ -82,14 +82,14 @@ $(document).ready(function () {
});
t.test('call', function (openerp) {
var ds = new openerp.web.DataSet({session: openerp.session}, 'mod');
t.expect(ds.call('frob', ['a', 'b', 42]), function (r) {
t.expect(ds.call('frob', ['a', 'b', 42]).then(function (r) {
strictEqual(r.method, 'frob');
strictEqual(r.args.length, 3);
deepEqual(r.args, ['a', 'b', 42]);
ok(_.isEmpty(r.kwargs));
});
}));
});
t.test('name_get').then(function (openerp) {
var ds = new openerp.web.DataSet({session: openerp.session}, 'mod');

View File

@ -136,7 +136,7 @@ instance.web_view_editor.ViewEditor = instance.web.Widget.extend({
var field_dataset = new instance.web.DataSetSearch(this, this.model, null, null);
var model_dataset = new instance.web.DataSetSearch(this, 'ir.model', null, null);
var view_string = "", field_name = false, self = this;
field_dataset.call( 'fields_get', [], function(fields) {
field_dataset.call( 'fields_get', []).then(function(fields) {
_.each(['name', 'x_name'], function(value) {
if (_.include(_.keys(fields), value)) {
field_name = value;
@ -539,7 +539,7 @@ instance.web_view_editor.ViewEditor = instance.web.Widget.extend({
var value = _.has(_CHILDREN, element) ? element : _.str.include(html_tag, element)?"html_tag":false;
property_to_check.push(value);
});
field_dataset.call( 'fields_get', [], function(result) {
field_dataset.call( 'fields_get', []).then(function(result) {
var fields = _.keys(result);
fields.push(" "),fields.sort();
self.on_add_node(property_to_check, fields);