summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/views/basic/basic_model.js
diff options
context:
space:
mode:
Diffstat (limited to 'addons/web/static/src/js/views/basic/basic_model.js')
-rw-r--r--addons/web/static/src/js/views/basic/basic_model.js11
1 files changed, 6 insertions, 5 deletions
diff --git a/addons/web/static/src/js/views/basic/basic_model.js b/addons/web/static/src/js/views/basic/basic_model.js
index d55109bde01..819eb978b48 100644
--- a/addons/web/static/src/js/views/basic/basic_model.js
+++ b/addons/web/static/src/js/views/basic/basic_model.js
@@ -777,14 +777,15 @@ var BasicModel = AbstractModel.extend({
if (newValue instanceof Array) {
rec._savePoint = newValue.slice(0);
} else {
- // save the viewType of edition, so that the correct readonly modifiers
- // can be evaluated when the record will be saved
- for (var fieldName in (rec._changes || {})) {
- rec._editionViewType[fieldName] = options.viewType;
- }
rec._savePoint = _.extend({}, newValue);
}
});
+
+ // save the viewType of edition, so that the correct readonly modifiers
+ // can be evaluated when the record will be saved
+ _.each((record._changes || {}), function (value, fieldName) {
+ record._editionViewType[fieldName] = options.viewType;
+ });
}
var shouldReload = 'reload' in options ? options.reload : true;
var method = self.isNew(record_id) ? 'create' : 'write';