Related to ISSUE-43105: Code Review changes
authorDavid Miguelez <david.miguelez@openbravo.com>
Fri, 07 Feb 2020 13:49:11 +0100
changeset 37042 4fdc3c57705c
parent 37041 eb0604a6f614
child 37043 321d0d9d12be
Related to ISSUE 43105: Code Review changes
* Use ids instead of objects in hql query
* Changed names of variables to better reflect
that they refer to ids
src/org/openbravo/costing/LandedCostDistributionByAmount.java
--- a/src/org/openbravo/costing/LandedCostDistributionByAmount.java	Tue Feb 04 09:50:25 2020 +0100
+++ b/src/org/openbravo/costing/LandedCostDistributionByAmount.java	Fri Feb 07 13:49:11 2020 +0100
@@ -144,10 +144,10 @@
             " where tc.unitCost = true" +
             "   and iol.movementQuantity >= 0" +
             "   and ((lcr.goodsShipmentLine is not null" +
-            "   and lcr.goodsShipmentLine = iol)" +
+            "   and lcr.goodsShipmentLine.id = iol.id)" +
             "   or (lcr.goodsShipmentLine is null" +
-            "   and lcr.goodsShipment = iol.shipmentReceipt))" +
-            "   and lcr.landedCost.id = :landedCost" +
+            "   and lcr.goodsShipment.id = iol.shipmentReceipt.id))" +
+            "   and lcr.landedCost.id = :landedCostId" +
             " group by lcr.id" +
             "   , iol.id" +
             "   , trx.currency.id" +
@@ -164,7 +164,7 @@
     return OBDal.getInstance()
         .getSession()
         .createQuery(hql, Object[].class)
-        .setParameter("landedCost", landedCost.getId())
+        .setParameter("landedCostId", landedCost.getId())
         .scroll();
   }