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/fields | |
| 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/fields')
| -rw-r--r-- | addons/web/static/src/js/fields/relational_fields.js | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/addons/web/static/src/js/fields/relational_fields.js b/addons/web/static/src/js/fields/relational_fields.js index 1915fa6c9ff..d8abf196722 100644 --- a/addons/web/static/src/js/fields/relational_fields.js +++ b/addons/web/static/src/js/fields/relational_fields.js @@ -853,20 +853,13 @@ var FieldOne2Many = FieldX2Many.extend({ */ _onOpenRecord: function (event) { var self = this; - this._super.apply(this, arguments); _.extend(event.data, { - on_save: function (record) { - // update in a form view opened from the o2m (kanban or non editable list) - var relRecord = _.find(self.value.data, function (d) { - return d.res_id === record.res_id; - }); - self._setValue({ - operation: 'UPDATE', - id: relRecord.id, - data: record.data, - }); + shouldSaveLocally: true, + on_saved: function () { + self._setValue({ operation: 'NOOP' }); }, }); + this._super.apply(this, arguments); }, }); @@ -926,10 +919,10 @@ var FieldMany2Many = FieldX2Many.extend({ * @param {OdooEvent} */ _onOpenRecord: function (event) { - this._super.apply(this, arguments); _.extend(event.data, { on_saved: this.trigger_up.bind(this, 'reload', {db_id: event.data.id}), }); + this._super.apply(this, arguments); }, }); |
