fixed bug 36066: no updateable AD definition can be overwritten by role config
authorAsier Lostalé <asier.lostale@openbravo.com>
Fri, 02 Jun 2017 12:07:16 +0200
changeset 32601 2a9757a3a0aa
parent 32600 944c8f82ef0d
child 32602 553e257f85e8
fixed bug 36066: no updateable AD definition can be overwritten by role config

* Take into account when applying role config at tab level if column is read
only, read only field was already considered.
* When applying role config at field level, take into accout both field and
column
modules/org.openbravo.client.application/src/org/openbravo/client/application/WindowSettingsActionHandler.java
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/WindowSettingsActionHandler.java	Fri Oct 06 09:56:55 2017 +0200
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/WindowSettingsActionHandler.java	Fri Jun 02 12:07:16 2017 +0200
@@ -131,7 +131,8 @@
               jTab.put("fields", jFields);
               final Set<String> fields = new TreeSet<String>();
               for (Field field : tabAccess.getTab().getADFieldList()) {
-                if (!field.isReadOnly() && !field.isShownInStatusBar()) {
+                if (!field.isReadOnly() && !field.isShownInStatusBar()
+                    && field.getColumn().isUpdatable()) {
                   final Property property = KernelUtils.getProperty(entity, field);
                   if (property != null) {
                     fields.add(property.getName());
@@ -144,8 +145,10 @@
                   if (property != null) {
                     final String name = KernelUtils.getProperty(entity, fieldAccess.getField())
                         .getName();
-                    jFields.put(name, fieldAccess.isEditableField());
-                    fields.remove(name);
+                    if (fields.contains(name)) {
+                      jFields.put(name, fieldAccess.isEditableField());
+                      fields.remove(name);
+                    }
                   }
                 }
               }