details:   https://code.openbravo.com/erp/devel/pi/rev/12c3032e3ef1
changeset: 30653:12c3032e3ef1
user:      Naroa Iriarte <naroa.iriarte <at> openbravo.com>
date:      Tue Nov 15 11:08:06 2016 +0100
summary:   Fixed issue 34469: The manage variants record selection was not 
working fine.

When a record was selected and after that another action was done, the record 
which must remain selected, was not.
The problem was in the "ManageVariantsDS". There was a property which was not 
being set. In the client there is a place where it is searching the selected 
records by a "findByKey" method. This method was searching the property 
"primaryKeys" and it needs to have the id set. In this case, as it was not set, 
it was not returning anything and it was not being able to find the selected 
record. That was causing the problem of the unselected record.
The fix consists on implementing the "getDataSourceProperties" method and there 
set the needed properties of the datasource.

diffstat:

 src/org/openbravo/materialmgmt/ManageVariantsDS.java |  18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)

diffs (50 lines):

diff -r c6412f616d3b -r 12c3032e3ef1 
src/org/openbravo/materialmgmt/ManageVariantsDS.java
--- a/src/org/openbravo/materialmgmt/ManageVariantsDS.java      Tue Nov 15 
11:04:48 2016 +0100
+++ b/src/org/openbravo/materialmgmt/ManageVariantsDS.java      Tue Nov 15 
11:08:06 2016 +0100
@@ -36,16 +36,20 @@
 import org.openbravo.base.model.Entity;
 import org.openbravo.base.model.ModelProvider;
 import org.openbravo.base.model.Property;
+import org.openbravo.client.kernel.reference.UIDefinition;
+import org.openbravo.client.kernel.reference.UIDefinitionController;
 import org.openbravo.dal.core.OBContext;
 import org.openbravo.dal.service.OBCriteria;
 import org.openbravo.dal.service.OBDal;
 import org.openbravo.dal.service.OBQuery;
+import org.openbravo.model.ad.domain.Reference;
 import org.openbravo.model.common.plm.Characteristic;
 import org.openbravo.model.common.plm.CharacteristicValue;
 import org.openbravo.model.common.plm.Product;
 import org.openbravo.model.common.plm.ProductCharacteristic;
 import org.openbravo.model.common.plm.ProductCharacteristicConf;
 import org.openbravo.model.common.plm.ProductCharacteristicValue;
+import org.openbravo.service.datasource.DataSourceProperty;
 import org.openbravo.service.datasource.ReadOnlyDataSourceService;
 import org.openbravo.service.json.JsonUtils;
 import org.slf4j.Logger;
@@ -56,6 +60,7 @@
   private static final Logger log = 
LoggerFactory.getLogger(ManageVariantsDS.class);
   private static final int searchKeyLength = getSearchKeyColumnLength();
   private static final String MANAGE_VARIANTS_TABLE_ID = 
"147D4D709FAC4AF0B611ABFED328FA12";
+  private static final String ID_REFERENCE_ID = "13";
 
   private List<String> selectedIds = new ArrayList<String>();
   private HashMap<String, List<CharacteristicValue>> selectedChValues = new 
HashMap<String, List<CharacteristicValue>>();
@@ -444,4 +449,17 @@
     }
   }
 
+  @Override
+  public List<DataSourceProperty> getDataSourceProperties(Map<String, Object> 
parameters) {
+    List<DataSourceProperty> dataSourceProperties = new 
ArrayList<DataSourceProperty>();
+    final DataSourceProperty dsProperty = new DataSourceProperty();
+    Reference idReference = OBDal.getInstance().get(Reference.class, 
ID_REFERENCE_ID);
+    UIDefinition uiDefinition = 
UIDefinitionController.getInstance().getUIDefinition(idReference);
+    dsProperty.setId(true);
+    dsProperty.setName("id");
+    dsProperty.setUIDefinition(uiDefinition);
+    dataSourceProperties.add(dsProperty);
+    return dataSourceProperties;
+  }
+
 }

------------------------------------------------------------------------------
_______________________________________________
Openbravo-commits mailing list
Openbravo-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to