[IMP]remove callbacks from call method and improve related code.
bzr revid: vme@tinyerp.com-20121003103428-fnr942tzl065rcei
This commit is contained in:
parent
f6314c0907
commit
558ad0616a
|
@ -586,8 +586,8 @@ instance.web.DataSet = instance.web.CallbackEnabled.extend({
|
||||||
* @param {Function} error_callback
|
* @param {Function} error_callback
|
||||||
* @returns {$.Deferred}
|
* @returns {$.Deferred}
|
||||||
*/
|
*/
|
||||||
call: function (method, args, callback, error_callback) {
|
call: function (method, args) {
|
||||||
return this._model.call(method, args).then(callback, error_callback);
|
return this._model.call(method, args);
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Calls an arbitrary method, with more crazy
|
* Calls an arbitrary method, with more crazy
|
||||||
|
|
|
@ -82,14 +82,14 @@ $(document).ready(function () {
|
||||||
});
|
});
|
||||||
t.test('call', function (openerp) {
|
t.test('call', function (openerp) {
|
||||||
var ds = new openerp.web.DataSet({session: openerp.session}, 'mod');
|
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.method, 'frob');
|
||||||
|
|
||||||
strictEqual(r.args.length, 3);
|
strictEqual(r.args.length, 3);
|
||||||
deepEqual(r.args, ['a', 'b', 42]);
|
deepEqual(r.args, ['a', 'b', 42]);
|
||||||
|
|
||||||
ok(_.isEmpty(r.kwargs));
|
ok(_.isEmpty(r.kwargs));
|
||||||
});
|
}));
|
||||||
});
|
});
|
||||||
t.test('name_get').then(function (openerp) {
|
t.test('name_get').then(function (openerp) {
|
||||||
var ds = new openerp.web.DataSet({session: openerp.session}, 'mod');
|
var ds = new openerp.web.DataSet({session: openerp.session}, 'mod');
|
||||||
|
|
|
@ -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 field_dataset = new instance.web.DataSetSearch(this, this.model, null, null);
|
||||||
var model_dataset = new instance.web.DataSetSearch(this, 'ir.model', null, null);
|
var model_dataset = new instance.web.DataSetSearch(this, 'ir.model', null, null);
|
||||||
var view_string = "", field_name = false, self = this;
|
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) {
|
_.each(['name', 'x_name'], function(value) {
|
||||||
if (_.include(_.keys(fields), value)) {
|
if (_.include(_.keys(fields), value)) {
|
||||||
field_name = 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;
|
var value = _.has(_CHILDREN, element) ? element : _.str.include(html_tag, element)?"html_tag":false;
|
||||||
property_to_check.push(value);
|
property_to_check.push(value);
|
||||||
});
|
});
|
||||||
field_dataset.call( 'fields_get', [], function(result) {
|
field_dataset.call( 'fields_get', []).then(function(result) {
|
||||||
var fields = _.keys(result);
|
var fields = _.keys(result);
|
||||||
fields.push(" "),fields.sort();
|
fields.push(" "),fields.sort();
|
||||||
self.on_add_node(property_to_check, fields);
|
self.on_add_node(property_to_check, fields);
|
||||||
|
|
Loading…
Reference in New Issue