summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/views/basic/basic_model.js
diff options
context:
space:
mode:
authorAaron Bohy <aab@odoo.com>2017-04-14 11:22:07 +0200
committerAaron Bohy <aab@odoo.com>2017-04-14 22:36:55 +0200
commit0494d612749cd0b7e937d3828775ca54961a29b9 (patch)
tree74c7d00b31e2110ce06ed4b2ce7e9683a75dd640 /addons/web/static/src/js/views/basic/basic_model.js
parent2eda2a7296dd5aeaeae3cea82736d72534a22e1f (diff)
[FIX] web: readonly fields may be edited
The readonly attribute of a field in its description can be overriden in the views (e.g. with modifiers). So readonly fields may actually be edited from views in which there is a modifiers on their node overriding the default value. Before this rev., readonly fields couldn't be saved, even if they could be edited from views (with such modifiers). For instance, it wasn't possible to change the value of the partner_id field in a draft sale_order.
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.js9
1 files changed, 0 insertions, 9 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 71d6d6fa1ad..5472496307d 100644
--- a/addons/web/static/src/js/views/basic/basic_model.js
+++ b/addons/web/static/src/js/views/basic/basic_model.js
@@ -668,15 +668,6 @@ var BasicModel = AbstractModel.extend({
// make sure we don't write an undefined id
delete changes.id;
- // remove readonly fields from the list of changes
- if (method === 'write') {
- for (var fieldName in changes) {
- if (record.fields[fieldName].readonly) {
- delete changes[fieldName];
- }
- }
- }
-
// in the case of a write, only perform the RPC if there are changes to save
if (method === 'create' || Object.keys(changes).length) {
var args = method === 'write' ? [[record.data.id], changes] : [changes];