summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/views/view_dialogs.js
diff options
context:
space:
mode:
authorAaron Bohy <aab@odoo.com>2017-03-27 11:41:05 +0200
committerAaron Bohy <aab@odoo.com>2017-04-11 19:44:38 +0200
commitc94b4b3b5fdbb234ad62111d5e44165e257f9a6b (patch)
tree451f8ba800904e63fc201f20fdf2bbd6f019ac67 /addons/web/static/src/js/views/view_dialogs.js
parent95919924698e8b8e2458c86d98ec2b61834c022f (diff)
[FIX] web: o2m: reset fieldsInfo after edition
One2Many fields edition (creation of new related records or edition of existing ones) needs a specific handling, because the related records aren't saved when the user clicks on 'Save' in the dialog, but when he clicks on 'Save' in the main form view. To make this work, the model (instance of BasicModel) and the representation of the edited record in the model must be given to the form in the dialog. Problem is that the fields to display in the kanban or list view and the form view in the dialog may be different, so when opening the dialog, the list of fields in the record is updated, and this list must be reset to its original value when the user closes the dialog. This last part wasn't done correctly before this commit, which causes tracebacks when the kanban/list view contained fields that weren't in the form view.
Diffstat (limited to 'addons/web/static/src/js/views/view_dialogs.js')
-rw-r--r--addons/web/static/src/js/views/view_dialogs.js12
1 files changed, 2 insertions, 10 deletions
diff --git a/addons/web/static/src/js/views/view_dialogs.js b/addons/web/static/src/js/views/view_dialogs.js
index 2275830fe33..7482426e067 100644
--- a/addons/web/static/src/js/views/view_dialogs.js
+++ b/addons/web/static/src/js/views/view_dialogs.js
@@ -136,15 +136,7 @@ var FormViewDialog = ViewDialog.extend({
}
this._super(parent, options);
},
- /**
- * If we changed some fieldsInfo, we need to restore them now.
- */
- destroy: function () {
- if (this.recordID && this.previousFieldProps) {
- this.model.setFieldProps(this.recordID, this.previousFieldProps);
- }
- this._super.apply(this, arguments);
- },
+
//--------------------------------------------------------------------------
// Public
//--------------------------------------------------------------------------
@@ -168,7 +160,7 @@ var FormViewDialog = ViewDialog.extend({
fields_view_def.then(function (viewInfo) {
if (self.recordID) {
- self.previousFieldProps = self.model.setFieldProps(self.recordID, viewInfo);
+ self.model.setFieldProps(self.recordID, viewInfo);
}
var formview = new FormView(viewInfo, {
modelName: self.res_model,