Do not include the current value if the combo is being computed because of a combo reload
authorAntonio Moreno <antonio.moreno@openbravo.com>
Mon, 03 Jan 2011 13:09:40 +0100
changeset 9513 9e16057d3d4b
parent 9512 d2f9e685c496
child 9514 5efd24dd658a
Do not include the current value if the combo is being computed because of a combo reload
modules/org.openbravo.client.application/src/org/openbravo/client/application/window/FormInitializationComponent.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/FormInitializationComponent.java	Mon Jan 03 12:43:37 2011 +0100
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/FormInitializationComponent.java	Mon Jan 03 13:09:40 2011 +0100
@@ -138,6 +138,9 @@
           }
         }
       }
+      if (mode.equals("CHANGE")) {
+        RequestContext.get().setRequestParameter("comboreload", "true");
+      }
       HashMap<String, JSONObject> columnValues = new HashMap<String, JSONObject>();
       HashMap<String, Field> columnsOfFields = new HashMap<String, Field>();
       ArrayList<String> allColumns = new ArrayList<String>();
--- a/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/UIDefinition.java	Mon Jan 03 12:43:37 2011 +0100
+++ b/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/UIDefinition.java	Mon Jan 03 13:09:40 2011 +0100
@@ -320,6 +320,8 @@
       RequestContext rq = RequestContext.get();
       VariablesSecureApp vars = rq.getVariablesSecureApp();
 
+      boolean comboreload = rq.getRequestParameter("comboreload") != null
+          && rq.getRequestParameter("comboreload").equals("true");
       String ref = field.getColumn().getReference().getId();
       String objectReference = "";
       if (field.getColumn().getReferenceSearchKey() != null) {
@@ -349,7 +351,7 @@
           clientList, 0);
       FieldProvider tabData = generateTabData(field.getTab().getADFieldList(), field, columnValue);
       comboTableData.fillParameters(tabData, field.getTab().getWindow().getId(), columnValue);
-      FieldProvider[] fps = comboTableData.select(getValueFromSession);
+      FieldProvider[] fps = comboTableData.select(getValueFromSession && !comboreload);
       ArrayList<FieldProvider> values = new ArrayList<FieldProvider>();
       values.addAll(Arrays.asList(fps));
       ArrayList<JSONObject> comboEntries = new ArrayList<JSONObject>();