From 2c57c15491395e9edd0ad0cebcf3b12f6e02ee03 Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Thu, 2 Aug 2012 16:46:23 +0200 Subject: [IMP] Mass rename \t to 4 spaces bzr revid: nicolas.vanhoren@openerp.com-20120802144623-ykl5te005ytnv584 --- addons/web/static/src/js/data.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'addons/web/static/src/js/data.js') diff --git a/addons/web/static/src/js/data.js b/addons/web/static/src/js/data.js index fdb15d598af..2589afe5503 100644 --- a/addons/web/static/src/js/data.js +++ b/addons/web/static/src/js/data.js @@ -803,7 +803,7 @@ instance.web.DataSet = instance.web.OldWidget.extend( /** @lends openerp.web.Da return this.ids.length; }, alter_ids: function(n_ids) { - this.ids = n_ids; + this.ids = n_ids; }, }); instance.web.DataSetStatic = instance.web.DataSet.extend({ @@ -1042,7 +1042,7 @@ instance.web.BufferedDataSet = instance.web.DataSetStatic.extend({ self.cache.push({id: id, values: record}); } else { // I assume cache value is prioritary - cached.values = _.defaults(_.clone(cached.values), record); + cached.values = _.defaults(_.clone(cached.values), record); } }); return_records(); @@ -1067,7 +1067,7 @@ instance.web.BufferedDataSet = instance.web.DataSetStatic.extend({ return this._super(method, args, callback, error_callback); }, alter_ids: function(n_ids) { - this._super(n_ids); + this._super(n_ids); this.on_change(); }, }); -- cgit v1.2.3 From 183b85f750e8911d22d10304ad00c7b5c95e2fcf Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Tue, 14 Aug 2012 15:31:07 +0200 Subject: [IMP] Removed OldWidget in data.js bzr revid: nicolas.vanhoren@openerp.com-20120814133107-prmdonwh6f7gu276 --- addons/web/static/src/js/data.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'addons/web/static/src/js/data.js') diff --git a/addons/web/static/src/js/data.js b/addons/web/static/src/js/data.js index 2589afe5503..1cdb4a713f1 100644 --- a/addons/web/static/src/js/data.js +++ b/addons/web/static/src/js/data.js @@ -439,7 +439,7 @@ instance.web.data = { }) }; -instance.web.DataGroup = instance.web.OldWidget.extend( /** @lends openerp.web.DataGroup# */{ +instance.web.DataGroup = instance.web.CallbackEnabled.extend( /** @lends openerp.web.DataGroup# */{ /** * Management interface between views and grouped collections of OpenERP * records. @@ -451,9 +451,9 @@ instance.web.DataGroup = instance.web.OldWidget.extend( /** @lends openerp.web. * content of the current grouping level. * * @constructs instance.web.DataGroup - * @extends instance.web.OldWidget + * @extends instance.web.CallbackEnabled * - * @param {instance.web.OldWidget} parent widget + * @param {instance.web.CallbackEnabled} parent widget * @param {String} model name of the model managed by this DataGroup * @param {Array} domain search domain for this DataGroup * @param {Object} context context of the DataGroup's searches @@ -524,13 +524,13 @@ instance.web.StaticDataGroup = instance.web.GrouplessDataGroup.extend( /** @lend } }); -instance.web.DataSet = instance.web.OldWidget.extend( /** @lends openerp.web.DataSet# */{ +instance.web.DataSet = instance.web.CallbackEnabled.extend( /** @lends openerp.web.DataSet# */{ /** * DateaManagement interface between views and the collection of selected * OpenERP records (represents the view's state?) * * @constructs instance.web.DataSet - * @extends instance.web.OldWidget + * @extends instance.web.CallbackEnabled * * @param {String} model the OpenERP model this dataset will manage */ -- cgit v1.2.3 From 63e4d9b572f27a5cdfa347e159ebc7e39f240ce1 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Tue, 14 Aug 2012 17:29:00 +0200 Subject: [IMP] sed -i '' -e 's/connection/session/g' bzr revid: chs@openerp.com-20120814152900-8r84kyz0qy1hwkvz --- addons/web/static/src/js/data.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'addons/web/static/src/js/data.js') diff --git a/addons/web/static/src/js/data.js b/addons/web/static/src/js/data.js index 1cdb4a713f1..e360c922918 100644 --- a/addons/web/static/src/js/data.js +++ b/addons/web/static/src/js/data.js @@ -58,7 +58,7 @@ instance.web.Query = instance.web.Class.extend({ }, _execute: function () { var self = this; - return instance.connection.rpc('/web/dataset/search_read', { + return instance.session.rpc('/web/dataset/search_read', { model: this._model.name, fields: this._fields || false, domain: this._model.domain(this._filter), @@ -233,7 +233,7 @@ instance.web.Model = instance.web.Class.extend(/** @lends openerp.web.Model# */{ kwargs = args; args = []; } - return instance.connection.rpc('/web/dataset/call_kw', { + return instance.session.rpc('/web/dataset/call_kw', { model: this.name, method: method, args: args, @@ -256,7 +256,7 @@ instance.web.Model = instance.web.Class.extend(/** @lends openerp.web.Model# */{ * @param {String} signal signal to trigger on the workflow */ exec_workflow: function (id, signal) { - return instance.connection.rpc('/web/dataset/exec_workflow', { + return instance.session.rpc('/web/dataset/exec_workflow', { model: this.name, id: id, signal: signal @@ -282,7 +282,7 @@ instance.web.Model = instance.web.Class.extend(/** @lends openerp.web.Model# */{ */ context: function (context) { return new instance.web.CompoundContext( - instance.connection.user_context, this._context, context || {}); + instance.session.user_context, this._context, context || {}); }, /** * Button action caller, needs to perform cleanup if an action is returned @@ -292,7 +292,7 @@ instance.web.Model = instance.web.Class.extend(/** @lends openerp.web.Model# */{ * FIXME: remove when evaluator integrated */ call_button: function (method, args) { - return instance.connection.rpc('/web/dataset/call_button', { + return instance.session.rpc('/web/dataset/call_button', { model: this.name, method: method, domain_id: null, -- cgit v1.2.3 From 2b0fcb77753bda709a1abf6995874469985fd595 Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Tue, 14 Aug 2012 21:53:16 +0200 Subject: [WIP] groups drag'n drop + resequence bzr revid: fme@openerp.com-20120814195316-j66wn6yxta6yj0w9 --- addons/web/static/src/js/data.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'addons/web/static/src/js/data.js') diff --git a/addons/web/static/src/js/data.js b/addons/web/static/src/js/data.js index e360c922918..a2adc2429bd 100644 --- a/addons/web/static/src/js/data.js +++ b/addons/web/static/src/js/data.js @@ -805,6 +805,22 @@ instance.web.DataSet = instance.web.CallbackEnabled.extend( /** @lends openerp. alter_ids: function(n_ids) { this.ids = n_ids; }, + /** + * Resequence records. + * + * @param {Array} ids identifiers of the records to resequence + * @returns {$.Deferred} + */ + resequence: function (ids, options) { + options = options || {}; + return this.rpc('/web/dataset/resequence', { + model: this.model, + ids: ids, + context: this._model.context(options.context), + }).pipe(function (results) { + return results; + }); + }, }); instance.web.DataSetStatic = instance.web.DataSet.extend({ init: function(parent, model, context, ids) { -- cgit v1.2.3 From cc406bc6920513faf960a29a500409985c1ee5bd Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Tue, 14 Aug 2012 23:37:08 +0200 Subject: [WIP] Added group_by_field bzr revid: fme@openerp.com-20120814213708-zkm05nkr1pdf8qbu --- addons/web/static/src/js/data.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/web/static/src/js/data.js') diff --git a/addons/web/static/src/js/data.js b/addons/web/static/src/js/data.js index a2adc2429bd..2372c6bbff9 100644 --- a/addons/web/static/src/js/data.js +++ b/addons/web/static/src/js/data.js @@ -813,7 +813,7 @@ instance.web.DataSet = instance.web.CallbackEnabled.extend( /** @lends openerp. */ resequence: function (ids, options) { options = options || {}; - return this.rpc('/web/dataset/resequence', { + return instance.session.rpc('/web/dataset/resequence', { model: this.model, ids: ids, context: this._model.context(options.context), -- cgit v1.2.3 From 42dd77b782593dd997c8f08053e7a0eb2d9e17c0 Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Thu, 16 Aug 2012 19:39:50 +0200 Subject: [FIX] Debug: view_fields bzr revid: fme@openerp.com-20120816173950-9o6e0m2q7alfwh5d --- addons/web/static/src/js/data.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/web/static/src/js/data.js') diff --git a/addons/web/static/src/js/data.js b/addons/web/static/src/js/data.js index 2372c6bbff9..10fd727e57a 100644 --- a/addons/web/static/src/js/data.js +++ b/addons/web/static/src/js/data.js @@ -706,7 +706,7 @@ instance.web.DataSet = instance.web.CallbackEnabled.extend( /** @lends openerp. * @returns {$.Deferred} */ call_and_eval: function (method, args, domain_index, context_index, callback, error_callback) { - return this.rpc('/web/dataset/call', { + return instance.session.rpc('/web/dataset/call', { model: this.model, method: method, domain_id: domain_index == undefined ? null : domain_index, -- cgit v1.2.3 From 26fc26642920b6151537d095cf3f36ab4d657838 Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Thu, 6 Sep 2012 18:53:54 +0200 Subject: [ADD] Kanban: Added support for read_group's __fold bzr revid: fme@openerp.com-20120906165354-my4nps0822vbrn9d --- addons/web/static/src/js/data.js | 2 ++ 1 file changed, 2 insertions(+) (limited to 'addons/web/static/src/js/data.js') diff --git a/addons/web/static/src/js/data.js b/addons/web/static/src/js/data.js index 10fd727e57a..29e799e54c3 100644 --- a/addons/web/static/src/js/data.js +++ b/addons/web/static/src/js/data.js @@ -417,6 +417,7 @@ instance.web.data = { var group_size = fixed_group[grouping_field + '_count'] || fixed_group.__count || 0; var leaf_group = fixed_group.__context.group_by.length === 0; this.attributes = { + folded: !!(fixed_group.__fold), grouped_on: grouping_field, // if terminal group (or no group) and group_by_no_leaf => use group.__count length: group_size, @@ -494,6 +495,7 @@ instance.web.DataGroup = instance.web.CallbackEnabled.extend( /** @lends opener { __context: child_context, __domain: group.model.domain(), + folded: group.get('folded'), grouped_on: group.get('grouped_on'), length: group.get('length'), value: group.get('value'), -- cgit v1.2.3 From 2f1948389eacdeb09019f0ba85678932cc190f03 Mon Sep 17 00:00:00 2001 From: Antony Lesuisse Date: Fri, 28 Sep 2012 01:05:51 +0200 Subject: [IMP] data cleanups, rename data.Group prepare possible DataGroup removal in favor of QueryGroup bzr revid: al@openerp.com-20120927230551-zo16cjd5lkq11gec --- addons/web/static/src/js/data.js | 183 ++++++++++++++++++--------------------- 1 file changed, 84 insertions(+), 99 deletions(-) (limited to 'addons/web/static/src/js/data.js') diff --git a/addons/web/static/src/js/data.js b/addons/web/static/src/js/data.js index 29e799e54c3..55f152857c5 100644 --- a/addons/web/static/src/js/data.js +++ b/addons/web/static/src/js/data.js @@ -107,7 +107,7 @@ instance.web.Query = instance.web.Class.extend({ * Performs a groups read according to the provided grouping criterion * * @param {String|Array} grouping - * @returns {jQuery.Deferred> | null} + * @returns {jQuery.Deferred> | null} */ group_by: function (grouping) { if (grouping === undefined) { @@ -130,7 +130,7 @@ instance.web.Query = instance.web.Class.extend({ orderby: instance.web.serialize_sort(this._order_by) || false }).pipe(function (results) { return _(results).map(function (result) { - return new instance.web.data.Group( + return new instance.web.QueryGroup( self._model.name, grouping[0], result); }); }); @@ -194,7 +194,54 @@ instance.web.Query = instance.web.Class.extend({ } }); -instance.web.Model = instance.web.Class.extend(/** @lends openerp.web.Model# */{ +instance.web.QueryGroup = instance.web.Class.extend({ + init: function (model, grouping_field, read_group_group) { + // In cases where group_by_no_leaf and no group_by, the result of + // read_group has aggregate fields but no __context or __domain. + // Create default (empty) values for those so that things don't break + var fixed_group = _.extend( + {__context: {group_by: []}, __domain: []}, + read_group_group); + + var aggregates = {}; + _(fixed_group).each(function (value, key) { + if (key.indexOf('__') === 0 + || key === grouping_field + || key === grouping_field + '_count') { + return; + } + aggregates[key] = value || 0; + }); + + this.model = new instance.web.Model( + model, fixed_group.__context, fixed_group.__domain); + + var group_size = fixed_group[grouping_field + '_count'] || fixed_group.__count || 0; + var leaf_group = fixed_group.__context.group_by.length === 0; + this.attributes = { + folded: !!(fixed_group.__fold), + grouped_on: grouping_field, + // if terminal group (or no group) and group_by_no_leaf => use group.__count + length: group_size, + value: fixed_group[grouping_field], + // A group is open-able if it's not a leaf in group_by_no_leaf mode + has_children: !(leaf_group && fixed_group.__context['group_by_no_leaf']), + + aggregates: aggregates + }; + }, + get: function (key) { + return this.attributes[key]; + }, + subgroups: function () { + return this.model.query().group_by(this.model.context().group_by); + }, + query: function () { + return this.model.query.apply(this.model, arguments); + } +}); + +instance.web.Model = instance.web.Class.extend({ /** * @constructs instance.web.Model * @extends instance.web.Class @@ -302,7 +349,7 @@ instance.web.Model = instance.web.Class.extend(/** @lends openerp.web.Model# */{ }, }); -instance.web.Traverser = instance.web.Class.extend(/** @lends openerp.web.Traverser# */{ +instance.web.Traverser = instance.web.Class.extend({ /** * @constructs instance.web.Traverser * @extends instance.web.Class @@ -381,66 +428,7 @@ instance.web.Traverser = instance.web.Class.extend(/** @lends openerp.web.Traver }); -/** - * Utility objects, should never need to be instantiated from outside of this - * module - * - * @namespace - */ -instance.web.data = { - Group: instance.web.Class.extend(/** @lends openerp.web.data.Group# */{ - /** - * @constructs instance.web.data.Group - * @extends instance.web.Class - */ - init: function (model, grouping_field, read_group_group) { - // In cases where group_by_no_leaf and no group_by, the result of - // read_group has aggregate fields but no __context or __domain. - // Create default (empty) values for those so that things don't break - var fixed_group = _.extend( - {__context: {group_by: []}, __domain: []}, - read_group_group); - - var aggregates = {}; - _(fixed_group).each(function (value, key) { - if (key.indexOf('__') === 0 - || key === grouping_field - || key === grouping_field + '_count') { - return; - } - aggregates[key] = value || 0; - }); - - this.model = new instance.web.Model( - model, fixed_group.__context, fixed_group.__domain); - - var group_size = fixed_group[grouping_field + '_count'] || fixed_group.__count || 0; - var leaf_group = fixed_group.__context.group_by.length === 0; - this.attributes = { - folded: !!(fixed_group.__fold), - grouped_on: grouping_field, - // if terminal group (or no group) and group_by_no_leaf => use group.__count - length: group_size, - value: fixed_group[grouping_field], - // A group is open-able if it's not a leaf in group_by_no_leaf mode - has_children: !(leaf_group && fixed_group.__context['group_by_no_leaf']), - - aggregates: aggregates - }; - }, - get: function (key) { - return this.attributes[key]; - }, - subgroups: function () { - return this.model.query().group_by(this.model.context().group_by); - }, - query: function () { - return this.model.query.apply(this.model, arguments); - } - }) -}; - -instance.web.DataGroup = instance.web.CallbackEnabled.extend( /** @lends openerp.web.DataGroup# */{ +instance.web.DataGroup = instance.web.CallbackEnabled.extend({ /** * Management interface between views and grouped collections of OpenERP * records. @@ -472,50 +460,47 @@ instance.web.DataGroup = instance.web.CallbackEnabled.extend( /** @lends opener }, list: function (fields, ifGroups, ifRecords) { var self = this; - $.when(this.model.query(fields) - .order_by(this.sort) - .group_by(this.group_by)).then(function (groups) { - if (!groups) { - ifRecords(_.extend( - new instance.web.DataSetSearch( - self, self.model.name, - self.model.context(), - self.model.domain()), - {_sort: self.sort})); + var query = this.model.query(fields).order_by(this.sort).group_by(this.group_by); + $.when(query).then(function (querygroups) { + // leaf node + if (!querygroups) { + var ds = new instance.web.DataSetSearch(self, self.model.name, self.model.context(), self.model.domain()); + ds._sort = self.sort; + ifRecords(ds); return; } - ifGroups(_(groups).map(function (group) { + // internal node + var child_datagroups = _(querygroups).map(function (group) { var child_context = _.extend( {}, self.model.context(), group.model.context()); - return _.extend( - new instance.web.DataGroup( - self, self.model.name, group.model.domain(), - child_context, group.model._context.group_by, - self.level + 1), - { - __context: child_context, - __domain: group.model.domain(), - folded: group.get('folded'), - grouped_on: group.get('grouped_on'), - length: group.get('length'), - value: group.get('value'), - openable: group.get('has_children'), - aggregates: group.get('aggregates') - }, {sort: self.sort}); - })); + var child_dg = new instance.web.DataGroup( + self, self.model.name, group.model.domain(), + child_context, group.model._context.group_by, + self.level + 1); + child_dg.sort = self.sort; + // copy querygroup properties + child_dg.__context = child_context; + child_dg.__domain = group.model.domain(); + child_dg.folded = group.get('folded'); + child_dg.grouped_on = group.get('grouped_on'); + child_dg.length = group.get('length'); + child_dg.value = group.get('value'); + child_dg.openable = group.get('has_children'); + child_dg.aggregates = group.get('aggregates'); + return child_dg; + }); + ifGroups(child_datagroups); }); } }); -instance.web.ContainerDataGroup = instance.web.DataGroup.extend({ }); -instance.web.GrouplessDataGroup = instance.web.DataGroup.extend({ }); -instance.web.StaticDataGroup = instance.web.GrouplessDataGroup.extend( /** @lends openerp.web.StaticDataGroup# */ { +instance.web.StaticDataGroup = instance.web.DataGroup.extend({ /** - * A specialization of groupless data groups, relying on a single static + * A specialization of data groups, relying on a single static * dataset as its records provider. * * @constructs instance.web.StaticDataGroup - * @extends instance.web.GrouplessDataGroup + * @extends instance.web.DataGroup * @param {openep.web.DataSetStatic} dataset a static dataset backing the groups */ init: function (dataset) { @@ -526,7 +511,7 @@ instance.web.StaticDataGroup = instance.web.GrouplessDataGroup.extend( /** @lend } }); -instance.web.DataSet = instance.web.CallbackEnabled.extend( /** @lends openerp.web.DataSet# */{ +instance.web.DataSet = instance.web.CallbackEnabled.extend({ /** * DateaManagement interface between views and the collection of selected * OpenERP records (represents the view's state?) @@ -854,7 +839,7 @@ instance.web.DataSetStatic = instance.web.DataSet.extend({ this.set_ids(_.without.apply(null, [this.ids].concat(ids))); } }); -instance.web.DataSetSearch = instance.web.DataSet.extend(/** @lends openerp.web.DataSetSearch */{ +instance.web.DataSetSearch = instance.web.DataSet.extend({ /** * @constructs instance.web.DataSetSearch * @extends instance.web.DataSet @@ -1183,7 +1168,7 @@ instance.web.CompoundDomain = instance.web.Class.extend({ } }); -instance.web.DropMisordered = instance.web.Class.extend(/** @lends openerp.web.DropMisordered# */{ +instance.web.DropMisordered = instance.web.Class.extend({ /** * @constructs instance.web.DropMisordered * @extends instance.web.Class -- cgit v1.2.3 From a55cc6072a888deb871c2a25987454695d3f94b6 Mon Sep 17 00:00:00 2001 From: Antony Lesuisse Date: Fri, 28 Sep 2012 01:45:13 +0200 Subject: [IMP] callback2deferred part1 dataset.unlink bzr revid: al@openerp.com-20120927234513-3aohele9gcoxkha4 --- addons/web/static/src/js/data.js | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'addons/web/static/src/js/data.js') diff --git a/addons/web/static/src/js/data.js b/addons/web/static/src/js/data.js index 55f152857c5..55bc9239536 100644 --- a/addons/web/static/src/js/data.js +++ b/addons/web/static/src/js/data.js @@ -664,10 +664,8 @@ instance.web.DataSet = instance.web.CallbackEnabled.extend({ * @param {Function} callback function called with operation result * @param {Function} error_callback function called in case of deletion error */ - unlink: function(ids, callback, error_callback) { - return this._model.call('unlink', - [ids], {context: this._model.context()}) - .then(callback, error_callback); + unlink: function(ids) { + return this._model.call('unlink', [ids], {context: this._model.context()}); }, /** * Calls an arbitrary RPC method @@ -889,7 +887,7 @@ instance.web.DataSetSearch = instance.web.DataSet.extend({ }, unlink: function(ids, callback, error_callback) { var self = this; - return this._super(ids, function(result) { + return this._super(ids).then(function(result) { self.ids = _(self.ids).difference(ids); if (self._length) { self._length -= 1; @@ -898,9 +896,7 @@ instance.web.DataSetSearch = instance.web.DataSet.extend({ self.index = self.index <= self.ids.length - 1 ? self.index : (self.ids.length > 0 ? self.ids.length -1 : 0); } - if (callback) - callback(result); - }, error_callback); + }); }, size: function () { if (this._length !== undefined) { @@ -1113,9 +1109,9 @@ instance.web.ProxyDataSet = instance.web.DataSetSearch.extend({ return this._super.apply(this, arguments); } }, - unlink: function(ids, callback, error_callback) { + unlink: function(ids) { if (this.unlink_function) { - return this.unlink_function(ids, this._super).then(callback, error_callback); + return this.unlink_function(ids, this._super); } else { return this._super.apply(this, arguments); } -- cgit v1.2.3 From bd56a25475fe9b575d92ee8dfed2ed7fe31e9842 Mon Sep 17 00:00:00 2001 From: "Vidhin Mehta (OpenERP)" Date: Fri, 28 Sep 2012 11:46:49 +0530 Subject: [IMP]remove callbacks from call_and_eval method. bzr revid: vme@tinyerp.com-20120928061649-tj4u5alrpz9agubb --- addons/web/static/src/js/data.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'addons/web/static/src/js/data.js') diff --git a/addons/web/static/src/js/data.js b/addons/web/static/src/js/data.js index 55bc9239536..8b6ebe237b2 100644 --- a/addons/web/static/src/js/data.js +++ b/addons/web/static/src/js/data.js @@ -690,14 +690,14 @@ instance.web.DataSet = instance.web.CallbackEnabled.extend({ * @param {Function} error_callback * @returns {$.Deferred} */ - call_and_eval: function (method, args, domain_index, context_index, callback, error_callback) { + call_and_eval: function (method, args, domain_index, context_index) { return instance.session.rpc('/web/dataset/call', { model: this.model, method: method, domain_id: domain_index == undefined ? null : domain_index, context_id: context_index == undefined ? null : context_index, args: args || [] - }, callback, error_callback); + }); }, /** * Calls a button method, usually returning some sort of action -- cgit v1.2.3 From 7730c14855162bf57b1fd20d4524bf506ab2e8d5 Mon Sep 17 00:00:00 2001 From: "Vidhin Mehta (OpenERP)" Date: Fri, 28 Sep 2012 12:05:58 +0530 Subject: [IMP]remove callback from call_button and improve related code. bzr revid: vme@tinyerp.com-20120928063558-roez0oayft9l3y4n --- addons/web/static/src/js/data.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'addons/web/static/src/js/data.js') diff --git a/addons/web/static/src/js/data.js b/addons/web/static/src/js/data.js index 55bc9239536..260f37d24a1 100644 --- a/addons/web/static/src/js/data.js +++ b/addons/web/static/src/js/data.js @@ -708,9 +708,8 @@ instance.web.DataSet = instance.web.CallbackEnabled.extend({ * @param {Function} error_callback * @returns {$.Deferred} */ - call_button: function (method, args, callback, error_callback) { - return this._model.call_button(method, args) - .then(callback, error_callback); + call_button: function (method, args) { + return this._model.call_button(method, args); }, /** * Fetches the "readable name" for records, based on intrinsic rules @@ -1052,7 +1051,7 @@ instance.web.BufferedDataSet = instance.web.DataSetStatic.extend({ } return completion.promise(); }, - call_button: function (method, args, callback, error_callback) { + call_button: function (method, args) { var id = args[0][0], index; for(var i=0, len=this.cache.length; i Date: Fri, 28 Sep 2012 12:23:41 +0530 Subject: [IMP]remove callback from name_get function and improve related code. bzr revid: vme@tinyerp.com-20120928065341-uiu3nf7seu5sps53 --- addons/web/static/src/js/data.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'addons/web/static/src/js/data.js') diff --git a/addons/web/static/src/js/data.js b/addons/web/static/src/js/data.js index 55bc9239536..59f533a027c 100644 --- a/addons/web/static/src/js/data.js +++ b/addons/web/static/src/js/data.js @@ -719,10 +719,9 @@ instance.web.DataSet = instance.web.CallbackEnabled.extend({ * @param {Function} callback * @returns {$.Deferred} */ - name_get: function(ids, callback) { + name_get: function(ids) { return this._model.call('name_get', - [ids], {context: this._model.context()}) - .then(callback); + [ids], {context: this._model.context()}); }, /** * -- cgit v1.2.3 From 3b6d9b8cbca0d4e3b52ba9028202e0d195120c6a Mon Sep 17 00:00:00 2001 From: "Vidhin Mehta (OpenERP)" Date: Fri, 28 Sep 2012 12:45:42 +0530 Subject: [IMP]remove callback from name_search and improve related code. bzr revid: vme@tinyerp.com-20120928071542-dlt7sq8ayb2hqs8e --- addons/web/static/src/js/data.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'addons/web/static/src/js/data.js') diff --git a/addons/web/static/src/js/data.js b/addons/web/static/src/js/data.js index 55bc9239536..4c4097868f8 100644 --- a/addons/web/static/src/js/data.js +++ b/addons/web/static/src/js/data.js @@ -733,14 +733,14 @@ instance.web.DataSet = instance.web.CallbackEnabled.extend({ * @param {Function} callback function to call with name_search result * @returns {$.Deferred} */ - name_search: function (name, domain, operator, limit, callback) { + name_search: function (name, domain, operator, limit) { return this._model.call('name_search', { name: name || '', args: domain || false, operator: operator || 'ilike', context: this._model.context(), limit: limit || 0 - }).then(callback); + }); }, /** * @param name -- cgit v1.2.3 From bb5fd9ba81603f30e8b4ecc8d05cb8141ee54724 Mon Sep 17 00:00:00 2001 From: "Vidhin Mehta (OpenERP)" Date: Fri, 28 Sep 2012 15:10:07 +0530 Subject: [IMP]remove callback from name_create method and update related code. bzr revid: vme@tinyerp.com-20120928094007-mx5p402a1ehdl73f --- addons/web/static/src/js/data.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'addons/web/static/src/js/data.js') diff --git a/addons/web/static/src/js/data.js b/addons/web/static/src/js/data.js index 55bc9239536..447775da3d9 100644 --- a/addons/web/static/src/js/data.js +++ b/addons/web/static/src/js/data.js @@ -746,10 +746,9 @@ instance.web.DataSet = instance.web.CallbackEnabled.extend({ * @param name * @param callback */ - name_create: function(name, callback) { + name_create: function(name) { return this._model.call('name_create', - [name], {context: this._model.context()}) - .then(callback); + [name], {context: this._model.context()}); }, exec_workflow: function (id, signal, callback) { return this._model.exec_workflow(id, signal) -- cgit v1.2.3 From c768a2f226f95a73507a92430ed970b1b2126604 Mon Sep 17 00:00:00 2001 From: "Vidhin Mehta (OpenERP)" Date: Fri, 28 Sep 2012 15:14:23 +0530 Subject: [IMP]remove callback from exec_workflow method and update related code. bzr revid: vme@tinyerp.com-20120928094423-r7zpurqq0dbr6cyr --- addons/web/static/src/js/data.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'addons/web/static/src/js/data.js') diff --git a/addons/web/static/src/js/data.js b/addons/web/static/src/js/data.js index 55bc9239536..cab0cc76018 100644 --- a/addons/web/static/src/js/data.js +++ b/addons/web/static/src/js/data.js @@ -751,10 +751,9 @@ instance.web.DataSet = instance.web.CallbackEnabled.extend({ [name], {context: this._model.context()}) .then(callback); }, - exec_workflow: function (id, signal, callback) { + exec_workflow: function (id, signal) { return this._model.exec_workflow(id, signal) - .pipe(function (result) { return { result: result }; }) - .then(callback); + .pipe(function (result) { return { result: result }; }); }, get_context: function(request_context) { return this._model.context(request_context); -- cgit v1.2.3 From 768d769b2d3834f0dff606151b29e43bc623cb46 Mon Sep 17 00:00:00 2001 From: "Vidhin Mehta (OpenERP)" Date: Fri, 28 Sep 2012 15:42:43 +0530 Subject: [IMP]remove callbacks of create method from data.js bzr revid: vme@tinyerp.com-20120928101243-tg4litc304d6m7wg --- addons/web/static/src/js/data.js | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'addons/web/static/src/js/data.js') diff --git a/addons/web/static/src/js/data.js b/addons/web/static/src/js/data.js index 55bc9239536..7a7a721de3f 100644 --- a/addons/web/static/src/js/data.js +++ b/addons/web/static/src/js/data.js @@ -635,11 +635,10 @@ instance.web.DataSet = instance.web.CallbackEnabled.extend({ * @param {Function} error_callback function called in case of creation error * @returns {$.Deferred} */ - create: function(data, callback, error_callback) { + create: function(data) { return this._model.call('create', [data], {context: this._model.context()}) - .pipe(function (r) { return {result: r}; }) - .then(callback, error_callback); + .pipe(function (r) { return {result: r}; }); }, /** * Saves the provided data in an existing db record @@ -919,14 +918,12 @@ instance.web.BufferedDataSet = instance.web.DataSetStatic.extend({ on_default_get: function(res) { this.last_default_get = res; }, - create: function(data, callback, error_callback) { + create: function(data) { var cached = {id:_.uniqueId(this.virtual_id_prefix), values: data, defaults: this.last_default_get}; this.to_create.push(_.extend(_.clone(cached), {values: _.clone(cached.values)})); this.cache.push(cached); - var prom = $.Deferred().then(callback); - prom.resolve({result: cached.id}); - return prom.promise(); + return $.Deferred().resolve({result: cached.id}).promise(); }, write: function (id, data, options, callback) { var self = this; @@ -1095,9 +1092,9 @@ instance.web.ProxyDataSet = instance.web.DataSetSearch.extend({ return this._super.apply(this, arguments); } }, - create: function(data, callback, error_callback) { + create: function(data) { if (this.create_function) { - return this.create_function(data, this._super).then(callback, error_callback); + return this.create_function(data, this._super); } else { return this._super.apply(this, arguments); } -- cgit v1.2.3