summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/data.js
diff options
context:
space:
mode:
authorniv-openerp <nicolas.vanhoren@openerp.com>2011-10-10 14:40:44 +0200
committerniv-openerp <nicolas.vanhoren@openerp.com>2011-10-10 14:40:44 +0200
commit33b4285d17235ced31a8190fa08c050843ca32c0 (patch)
tree5c7c5bab5740fca1fe50c614c64ebe1ab93350d3 /addons/web/static/src/js/data.js
parentca224b647cefbd752aff8f6cfacd27593ec874a8 (diff)
[imp] improved conceptually the preceding fix regarding o2m
bzr revid: nicolas.vanhoren@openerp.com-20111010124044-8c02gdeddceq78du
Diffstat (limited to 'addons/web/static/src/js/data.js')
-rw-r--r--addons/web/static/src/js/data.js16
1 files changed, 12 insertions, 4 deletions
diff --git a/addons/web/static/src/js/data.js b/addons/web/static/src/js/data.js
index dc0e21cf796..0410372f631 100644
--- a/addons/web/static/src/js/data.js
+++ b/addons/web/static/src/js/data.js
@@ -720,11 +720,19 @@ openerp.web.BufferedDataSet = openerp.web.DataSetStatic.extend({
});
openerp.web.BufferedDataSet.virtual_id_regex = /^one2many_v_id_.*$/;
-openerp.web.ReadOnlyDataSetSearch = openerp.web.DataSetSearch.extend({
+openerp.web.ProxyDataSet = openerp.web.DataSetSearch.extend({
init: function() {
this._super.apply(this, arguments);
this.create_function = null;
this.write_function = null;
+ this.read_function = null;
+ },
+ read_ids: function () {
+ if (this.read_function) {
+ return this.read_function.apply(null, arguments);
+ } else {
+ this._super.apply(this, arguments);
+ }
},
default_get: function(fields, callback) {
return this._super(fields, callback).then(this.on_default_get);
@@ -735,7 +743,7 @@ openerp.web.ReadOnlyDataSetSearch = openerp.web.DataSetSearch.extend({
if (this.create_function) {
return this.create_function(data, callback, error_callback);
} else {
- console.warn("trying to create a record using read only dataset");
+ console.warn("trying to create a record using default proxy dataset behavior");
var to_return = $.Deferred().then(callback);
setTimeout(function () {to_return.resolve({"result": undefined});}, 0);
return to_return.promise();
@@ -747,7 +755,7 @@ openerp.web.ReadOnlyDataSetSearch = openerp.web.DataSetSearch.extend({
if (this.write_function) {
return this.write_function(id, data, options, callback);
} else {
- console.warn("trying to write a record using read only dataset");
+ console.warn("trying to write a record using default proxy dataset behavior");
var to_return = $.Deferred().then(callback);
setTimeout(function () {to_return.resolve({"result": true});}, 0);
return to_return.promise();
@@ -756,7 +764,7 @@ openerp.web.ReadOnlyDataSetSearch = openerp.web.DataSetSearch.extend({
on_write: function(id, data) {},
unlink: function(ids, callback, error_callback) {
this.on_unlink(ids);
- console.warn("trying to unlink a record using read only dataset");
+ console.warn("trying to unlink a record using default proxy dataset behavior");
var to_return = $.Deferred().then(callback);
setTimeout(function () {to_return.resolve({"result": true});}, 0);
return to_return.promise();