[FIX] dataset methods to get their request context through Dataset#get_context

if they go directly through the embedded model, child classes to
DataSet don't get the occasion to override the generation/fetching of
the context, and e.g. relational fields thus don't work correctly (as
their field context isn't forwarded).

bzr revid: xmo@openerp.com-20121031143723-j4q0t8cbzttela1r
This commit is contained in:
Xavier Morel 2012-10-31 15:37:23 +01:00
parent 62f4d999f4
commit 2295ab0d5a
1 changed files with 7 additions and 7 deletions

View File

@ -471,7 +471,7 @@ instance.web.DataSet = instance.web.CallbackEnabled.extend({
default_get: function(fields, options) { default_get: function(fields, options) {
options = options || {}; options = options || {};
return this._model.call('default_get', return this._model.call('default_get',
[fields], {context: this._model.context(options.context)}); [fields], {context: this.get_context(options.context)});
}, },
/** /**
* Creates a new record in db * Creates a new record in db
@ -480,7 +480,7 @@ instance.web.DataSet = instance.web.CallbackEnabled.extend({
* @returns {$.Deferred} * @returns {$.Deferred}
*/ */
create: function(data) { create: function(data) {
return this._model.call('create', [data], {context: this._model.context()}); return this._model.call('create', [data], {context: this.get_context()});
}, },
/** /**
* Saves the provided data in an existing db record * Saves the provided data in an existing db record
@ -493,7 +493,7 @@ instance.web.DataSet = instance.web.CallbackEnabled.extend({
*/ */
write: function (id, data, options) { write: function (id, data, options) {
options = options || {}; options = options || {};
return this._model.call('write', [[id], data], {context: this._model.context(options.context)}).then(this.trigger('dataset_changed', id, data, options)); return this._model.call('write', [[id], data], {context: this.get_context(options.context)}).then(this.trigger('dataset_changed', id, data, options));
}, },
/** /**
* Deletes an existing record from the database * Deletes an existing record from the database
@ -501,7 +501,7 @@ instance.web.DataSet = instance.web.CallbackEnabled.extend({
* @param {Number|String} ids identifier of the record to delete * @param {Number|String} ids identifier of the record to delete
*/ */
unlink: function(ids) { unlink: function(ids) {
return this._model.call('unlink', [ids], {context: this._model.context()}).then(this.trigger('dataset_changed', ids)); return this._model.call('unlink', [ids], {context: this.get_context()}).then(this.trigger('dataset_changed', ids));
}, },
/** /**
* Calls an arbitrary RPC method * Calls an arbitrary RPC method
@ -532,7 +532,7 @@ instance.web.DataSet = instance.web.CallbackEnabled.extend({
* @returns {$.Deferred} * @returns {$.Deferred}
*/ */
name_get: function(ids) { name_get: function(ids) {
return this._model.call('name_get', [ids], {context: this._model.context()}); return this._model.call('name_get', [ids], {context: this.get_context()});
}, },
/** /**
* *
@ -556,7 +556,7 @@ instance.web.DataSet = instance.web.CallbackEnabled.extend({
* @param name * @param name
*/ */
name_create: function(name) { name_create: function(name) {
return this._model.call('name_create', [name], {context: this._model.context()}); return this._model.call('name_create', [name], {context: this.get_context()});
}, },
exec_workflow: function (id, signal) { exec_workflow: function (id, signal) {
return this._model.exec_workflow(id, signal); return this._model.exec_workflow(id, signal);
@ -606,7 +606,7 @@ instance.web.DataSet = instance.web.CallbackEnabled.extend({
return instance.session.rpc('/web/dataset/resequence', { return instance.session.rpc('/web/dataset/resequence', {
model: this.model, model: this.model,
ids: ids, ids: ids,
context: this._model.context(options.context), context: this.get_context(options.context),
}).pipe(function (results) { }).pipe(function (results) {
return results; return results;
}); });