[IMP]remove callbacks from call method and improve related code.
authorVidhin Mehta (OpenERP) <vme@tinyerp.com>
Wed, 3 Oct 2012 10:34:28 +0000 (16:04 +0530)
committerVidhin Mehta (OpenERP) <vme@tinyerp.com>
Wed, 3 Oct 2012 10:34:28 +0000 (16:04 +0530)
bzr revid: vme@tinyerp.com-20121003103428-fnr942tzl065rcei

addons/web/static/src/js/data.js
addons/web/static/test/fulltest/dataset.js
addons/web_view_editor/static/src/js/view_editor.js

index 2b82e61..cf4b29a 100644 (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
index d276f4e..f7e64fb 100644 (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');
index 73d07ef..e65f0ab 100644 (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);