diff options
| author | Géry Debongnie <ged@odoo.com> | 2017-07-05 13:41:24 +0200 |
|---|---|---|
| committer | Géry Debongnie <ged@odoo.com> | 2017-07-05 14:47:11 +0200 |
| commit | a43b0464b28ce53074b027469747e379bbb389c4 (patch) | |
| tree | 4166717ec907ca674adbf7035eeca1c8c08707c6 /addons/web/static/src/js/views/basic | |
| parent | 780ae8a808697cc156549e532614f8536cef2b1b (diff) | |
[FIX] web: better handling for readonly modifiers
Before this commit, the web client read the readonly in the modifiers,
and if no readonly was in the modifiers, it fell back to the field
property. But the field property was already taken into account in the
modifiers, so this was useless. And worse, in some case, it could cause
an issue. For example, a field with readonly=true, and readonly="0" in
the arch was considered readonly.
Diffstat (limited to 'addons/web/static/src/js/views/basic')
| -rw-r--r-- | addons/web/static/src/js/views/basic/basic_model.js | 7 |
1 files changed, 2 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 01b2a18091a..61c153e9032 100644 --- a/addons/web/static/src/js/views/basic/basic_model.js +++ b/addons/web/static/src/js/views/basic/basic_model.js @@ -2539,15 +2539,12 @@ var BasicModel = AbstractModel.extend({ */ _isFieldReadonly: function (record, fieldName, viewType) { var fieldInfo = record.fieldsInfo[viewType || record.viewType][fieldName]; - var modifiers; if (fieldInfo) { var rawModifiers = JSON.parse(fieldInfo.modifiers || "{}"); - modifiers = this._evalModifiers(record, rawModifiers); - } - if (modifiers && 'readonly' in modifiers) { + var modifiers = this._evalModifiers(record, rawModifiers); return modifiers.readonly; } else { - return record.fields[fieldName].readonly; + return false; } }, /** |
