diff options
| author | niv-openerp <nicolas.vanhoren@openerp.com> | 2012-05-16 15:01:42 +0200 |
|---|---|---|
| committer | niv-openerp <nicolas.vanhoren@openerp.com> | 2012-05-16 15:01:42 +0200 |
| commit | ab21c9ac815d7a0271493ea17698b60b001bc331 (patch) | |
| tree | 617d07f8cacd62a6ae26bef6ab40d9f1e8105f88 /addons/web/static/src/js/data.js | |
| parent | 57894a5361cadb6a4829de15de83a0b0ead88e16 (diff) | |
[imp] improved AbstractFormPopup
bzr revid: nicolas.vanhoren@openerp.com-20120516130142-quyvtv0s35uvbuug
Diffstat (limited to 'addons/web/static/src/js/data.js')
| -rw-r--r-- | addons/web/static/src/js/data.js | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/addons/web/static/src/js/data.js b/addons/web/static/src/js/data.js index 29e21400b25..fdb15d598af 100644 --- a/addons/web/static/src/js/data.js +++ b/addons/web/static/src/js/data.js @@ -1079,41 +1079,44 @@ instance.web.ProxyDataSet = instance.web.DataSetSearch.extend({ this.create_function = null; this.write_function = null; this.read_function = null; + this.default_get_function = null; + this.unlink_function = null; }, - read_ids: function () { + read_ids: function (ids, fields, options) { if (this.read_function) { - return this.read_function.apply(null, arguments); + return this.read_function(ids, fields, options, this._super); } else { return this._super.apply(this, arguments); } }, default_get: function(fields, options) { - return this._super(fields, options).then(this.on_default_get); + if (this.default_get_function) { + return this.default_get_function(fields, options, this._super); + } else { + return this._super.apply(this, arguments); + } }, - on_default_get: function(result) {}, create: function(data, callback, error_callback) { - this.on_create(data); if (this.create_function) { - return this.create_function(data, callback, error_callback); + return this.create_function(data, this._super).then(callback, error_callback); } else { - return $.async_when({"result": undefined}).then(callback); + return this._super.apply(this, arguments); } }, - on_create: function(data) {}, - write: function (id, data, options, callback) { - this.on_write(id, data); + write: function (id, data, options, callback, error_callback) { if (this.write_function) { - return this.write_function(id, data, options, callback); + return this.write_function(id, data, options, this._super).then(callback, error_callback); } else { - return $.async_when({"result": true}).then(callback); + return this._super.apply(this, arguments); } }, - on_write: function(id, data) {}, unlink: function(ids, callback, error_callback) { - this.on_unlink(ids); - return $.async_when({"result": true}).then(callback); + if (this.unlink_function) { + return this.unlink_function(ids, this._super).then(callback, error_callback); + } else { + return this._super.apply(this, arguments); + } }, - on_unlink: function(ids) {} }); instance.web.CompoundContext = instance.web.Class.extend({ |
