Fixed issue 34893: The GL item section of add payment was not working fine
authorNaroa Iriarte <naroa.iriarte@openbravo.com>
Wed, 11 Jan 2017 15:27:22 +0100
changeset 31493 f43dcd2fc7a5
parent 31492 291808b5cd55
child 31494 ed52b01e833e
Fixed issue 34893: The GL item section of add payment was not working fine

The grid of the G/L item section of the Add payment process was not workinf fine. The problem was that it was shown as sortable and as filterable and it must not be filterable nor sortable. This has been caused by the changeset[1]. This proyect set every column as sortable and as filterable and so was the problem.
To fix this the values of "canSort" and "canFilter" have been changed in the needed cases, which are the ones that satisfy the condition of having the canDelete property or the canAdd property set to yes and are in Pick and Execute window.
The code which handles the logic has been moved from the OBViewFieldHandler.getGridFieldProperties() to UIDefinition.getGridFieldProperties().

[1]http://code.openbravo.com/erp/devel/pi/rev/afa165be3e5900d1114d33e5106114d0e089876a
modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewFieldHandler.java
modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/UIDefinition.java
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewFieldHandler.java	Fri Dec 30 00:38:50 2016 +0100
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewFieldHandler.java	Wed Jan 11 15:27:22 2017 +0100
@@ -1226,14 +1226,6 @@
 
     public String getGridFieldProperties() {
       String props = uiDefinition.getGridFieldProperties(field);
-      if (!props.contains("canFilter") && field.getTab().isObuiappCanDelete()
-          && field.getTab().getWindow().getWindowType().equals("OBUIAPP_PickAndExecute")) {
-        props = props + ", canFilter: false";
-      }
-      if (!props.contains("canSort") && field.getTab().isObuiappCanAdd()
-          && field.getTab().getWindow().getWindowType().equals("OBUIAPP_PickAndExecute")) {
-        props = props + ", canSort: false";
-      }
       return props;
     }
 
--- a/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/UIDefinition.java	Fri Dec 30 00:38:50 2016 +0100
+++ b/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/UIDefinition.java	Wed Jan 11 15:27:22 2017 +0100
@@ -404,8 +404,17 @@
     // value is properly selected.
     result.append(", selectOnClick: true");
 
-    Boolean canSort = (Boolean) readGridConfigurationSetting("canSort");
-    Boolean canFilter = (Boolean) readGridConfigurationSetting("canFilter");
+    Boolean canSort;
+    Boolean canFilter;
+
+    if ((field.getTab().isObuiappCanAdd() || field.getTab().isObuiappCanDelete())
+        && field.getTab().getWindow().getWindowType().equals("OBUIAPP_PickAndExecute")) {
+      canSort = false;
+      canFilter = false;
+    } else {
+      canSort = (Boolean) readGridConfigurationSetting("canSort");
+      canFilter = (Boolean) readGridConfigurationSetting("canFilter");
+    }
 
     if (canSort != null) {
       result.append(", canSort: " + canSort.toString());