# HG changeset patch
# User Augusto Mauch <augusto.mauch@openbravo.com>
# Date 1362482106 -3600
# Node ID 7d8d61e27f6cbe9166f2362c88bc4fc8d0304e81
# Parent  8b09db1c33be55c862c68e45b3533bea7fe15daa
Fixes issue 23200: YesNo columns default value in Query Widgets works properly

The step where the 'N' and 'Y' values of YesNo columns were converted to false and true respectively was missing.

diff --git a/modules/org.openbravo.client.querylist/src/org/openbravo/client/querylist/QueryListDataSource.java b/modules/org.openbravo.client.querylist/src/org/openbravo/client/querylist/QueryListDataSource.java
--- a/modules/org.openbravo.client.querylist/src/org/openbravo/client/querylist/QueryListDataSource.java
+++ b/modules/org.openbravo.client.querylist/src/org/openbravo/client/querylist/QueryListDataSource.java
@@ -42,6 +42,7 @@
 import org.openbravo.base.exception.OBException;
 import org.openbravo.base.model.ModelProvider;
 import org.openbravo.base.model.domaintype.BigDecimalDomainType;
+import org.openbravo.base.model.domaintype.BooleanDomainType;
 import org.openbravo.base.model.domaintype.DateDomainType;
 import org.openbravo.base.model.domaintype.DomainType;
 import org.openbravo.base.model.domaintype.LongDomainType;
@@ -170,6 +171,9 @@
         }
 
         for (OBCQL_QueryColumn column : columns) {
+          UIDefinition uiDefinition = UIDefinitionController.getInstance().getUIDefinition(
+              column.getReference());
+          DomainType domainType = uiDefinition.getDomainType();
           // TODO: throw an exception if the display expression doesn't match any returned alias.
           for (int i = 0; i < queryAliases.length; i++) {
             if (queryAliases[i].equals(column.getDisplayExpression())
@@ -182,6 +186,11 @@
               if (value instanceof Date) {
                 value = xmlDateFormat.format(value);
               }
+
+              if (domainType instanceof BooleanDomainType) {
+                value = ((PrimitiveDomainType) domainType).createFromString((String) value);
+              }
+
               if (!isExport) {
                 data.put(queryAliases[i], value);
               } else {
