diff options
| author | Géry Debongnie <ged@odoo.com> | 2017-02-27 19:39:41 +0100 |
|---|---|---|
| committer | Aaron Bohy <aab@odoo.com> | 2017-04-11 19:44:38 +0200 |
| commit | 206453c83689ad0dc6ceec3686153ab79bf88660 (patch) | |
| tree | 4cffbfbcb5ca9467abf35f595caa24fbe7761a6b /addons/web/static/src/js/views/basic/basic_view.js | |
| parent | f79399bf7720e7a69b95fe2c548208b56b94ce29 (diff) | |
[FIX] web: various fixes with one2many/formviewdialogs
We share the basic model record between views, and we have to make sure
that everything is properly coordinated. The main issue solved by this
commit is the fact that we can now edit a one2many record, then close
the dialog, then edit it again and finally cancel the changes, which
bring us to the previous step.
Also, we had to slightly improve the AbstractView API
Diffstat (limited to 'addons/web/static/src/js/views/basic/basic_view.js')
| -rw-r--r-- | addons/web/static/src/js/views/basic/basic_view.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/addons/web/static/src/js/views/basic/basic_view.js b/addons/web/static/src/js/views/basic/basic_view.js index 947a3ad26b6..aea0b88dcf3 100644 --- a/addons/web/static/src/js/views/basic/basic_view.js +++ b/addons/web/static/src/js/views/basic/basic_view.js @@ -99,6 +99,7 @@ var BasicView = AbstractView.extend({ this.loadParams.fieldNames = fieldNames; this.loadParams.fields = fields; this.loadParams.limit = parseInt(arch.attrs.limit, 10) || params.limit; + this.recordID = params.recordID; }, //-------------------------------------------------------------------------- @@ -106,6 +107,19 @@ var BasicView = AbstractView.extend({ //-------------------------------------------------------------------------- /** + * In some cases, we already have a preloaded record + * + * @override + * @private + * @returns {Deferred} + */ + _loadData: function () { + if (this.recordID) { + return $.when(this.recordID); + } + return this._super.apply(this, arguments); + }, + /** * Visit all nodes in the arch field and process each fields * * @param {Object} arch |
