Fixes bug 29080: getStartingDate() method does not fail in Costing Background.
authorUnai Martirena <unai.martirena@openbravo.com>
Thu, 26 Feb 2015 15:23:25 +0100
changeset 26085 ecf72f76195b
parent 26084 ca0b1242f774
child 26086 67607f6caaee
Fixes bug 29080: getStartingDate() method does not fail in Costing Background.

An OBQuery is being executed in getStartingDate() method inside AverageAlgorithm. There are 2 parameters in this OBQuery that are not setting properly, 'client' and 'org'. The whereclause is filtering by 'id' of these properties and instead of passing the id of these objects, the object was being passed to the OBQuery. These sometimes works but other times don't, so this has been changed to always setting the id's as parameters.
src/org/openbravo/costing/AverageAlgorithm.java
--- a/src/org/openbravo/costing/AverageAlgorithm.java	Thu Feb 26 15:56:04 2015 +0100
+++ b/src/org/openbravo/costing/AverageAlgorithm.java	Thu Feb 26 15:23:25 2015 +0100
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2012-2014 Openbravo SLU
+ * All portions are Copyright (C) 2012-2015 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  *************************************************************************
@@ -198,9 +198,9 @@
     }
     // FIXME: remove when manufacturing costs are fully migrated
     if (product.isProduction()) {
-      costQry.setNamedParameter("client", costOrg.getClient());
+      costQry.setNamedParameter("client", costOrg.getClient().getId());
     } else {
-      costQry.setNamedParameter("org", costOrg);
+      costQry.setNamedParameter("org", costOrg.getId());
     }
 
     List<Costing> costList = costQry.list();