Fixes issue 32240: Read only doesn't work on some columns in grid view
authorInigo Sanchez <inigo.sanchez@openbravo.com>
Wed, 24 Feb 2016 15:43:32 +0100
changeset 28634 50d727a06177
parent 28633 216fb4e6048c
child 28635 689c4b6505ea
Fixes issue 32240: Read only doesn't work on some columns in grid view

The problem is caused because it was not take into account read only when other
logic (e.g. display logic) was being applied in an editing grid view.

In order to prevent this, it take into account when a field is checks as read
only. In this case, the field is show properly.
modules/org.openbravo.client.application/src/org/openbravo/client/application/templates/ob-view-form.js.ftl
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/templates/ob-view-form.js.ftl	Tue Feb 23 16:05:13 2016 +0530
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/templates/ob-view-form.js.ftl	Wed Feb 24 15:43:32 2016 +0100
@@ -12,7 +12,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2010-2015 Openbravo SLU
+ * All portions are Copyright (C) 2010-2016 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -39,11 +39,11 @@
             disabledFields, i;
             OB.Utilities.fixNull250(currentValues);
         <#list data.fieldHandler.fields as field>
-        <#if field.readOnlyIf != "" && field.showIf == "">
-        // Applying read only.
+        <#if !field.readOnly && field.readOnlyIf != "" && field.showIf == "">
+           // Applying read only logic.
            f.disableItem('${field.name}', ${field.readOnlyIf});
         <#else>
-        <#if field.readOnlyIf == "" && field.showIf != "">
+        <#if !field.readOnly && field.readOnlyIf == "" && field.showIf != "">
         // Applying display logic in grid.
         if (!this.view.isShowingForm) {
         <#if field.showIf == "false">
@@ -53,7 +53,7 @@
         </#if>
         }
         <#else>
-        <#if field.readOnlyIf != "" && field.showIf != "">
+        <#if !field.readOnly && field.readOnlyIf != "" && field.showIf != "">
         // Applying display logic and read only in grid/form.
         if (!this.view.isShowingForm) {
         <#if field.showIf == "false">