From 0494d612749cd0b7e937d3828775ca54961a29b9 Mon Sep 17 00:00:00 2001 From: Aaron Bohy Date: Fri, 14 Apr 2017 11:22:07 +0200 Subject: [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. --- addons/web/static/src/js/views/basic/basic_model.js | 9 --------- 1 file changed, 9 deletions(-) (limited to 'addons/web/static/src/js/views/basic/basic_model.js') 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]; -- cgit v1.2.3