details: https://code.openbravo.com/erp/devel/pi/rev/1f26de8763c0 changeset: 25493:1f26de8763c0 user: Alvaro Ferraz <alvaro.ferraz <at> openbravo.com> date: Mon Dec 01 16:49:43 2014 +0100 summary: Fixes bug 28286 LandedCostLineAmt should always be created in the same order
In order to help JUnit tests assert landed cost, an orderBy clause has been added when creating Landed Cost Receipt Line Amount lines, to be always created in the same order. details: https://code.openbravo.com/erp/devel/pi/rev/4ae6c365fd3e changeset: 25494:4ae6c365fd3e user: Alvaro Ferraz <alvaro.ferraz <at> openbravo.com> date: Mon Dec 01 16:50:51 2014 +0100 summary: Fixes bug 28308 LandedCost Accounting should always be created in the same order In order to help JUnit tests assert landed cost accounting, an orderBy clause has been added when creating Landed Cost Accounting lines, to be created always in the same order details: https://code.openbravo.com/erp/devel/pi/rev/51adc29c2514 changeset: 25495:51adc29c2514 user: Alvaro Ferraz <alvaro.ferraz <at> openbravo.com> date: Mon Dec 01 16:54:02 2014 +0100 summary: Fixes bug 28266 ParentCostAdjustmentLine should always be assigned in the same order In order to help JUnit tests assert Cost Adjustment lines, an orderBy clause has been added when assigning the field "Parent Cost Adjustment Line" to follow always the same order details: https://code.openbravo.com/erp/devel/pi/rev/5bb50e44ea69 changeset: 25496:5bb50e44ea69 user: Alvaro Ferraz <alvaro.ferraz <at> openbravo.com> date: Mon Dec 01 16:55:05 2014 +0100 summary: Related to Issue 28148 Cost Adjustment Lines created ordered by trxprocessdate In order to help JUnit tests assert Cost Adjustment lines, an orderBy clause has been added when creating cost adjustment lines of type Landed Cost to follow always the same order diffstat: src/org/openbravo/costing/CostAdjustmentProcess.java | 3 ++- src/org/openbravo/costing/LCMatchingProcess.java | 5 +++++ src/org/openbravo/costing/LandedCostDistributionByAmount.java | 3 ++- src/org/openbravo/costing/LandedCostProcess.java | 5 ++++- src/org/openbravo/erpCommon/ad_forms/DocLineLandedCost_data.xsql | 2 +- 5 files changed, 14 insertions(+), 4 deletions(-) diffs (73 lines): diff -r 107d831cf383 -r 5bb50e44ea69 src/org/openbravo/costing/CostAdjustmentProcess.java --- a/src/org/openbravo/costing/CostAdjustmentProcess.java Thu Dec 04 16:58:28 2014 +0100 +++ b/src/org/openbravo/costing/CostAdjustmentProcess.java Mon Dec 01 16:55:05 2014 +0100 @@ -249,8 +249,9 @@ critLines.createAlias(CostAdjustmentLine.PROPERTY_COSTADJUSTMENT, "ca"); critLines.add(Restrictions.eq("ca.id", strCostAdjustmentId)); critLines.add(Restrictions.eq(CostAdjustmentLine.PROPERTY_ISRELATEDTRANSACTIONADJUSTED, false)); + critLines.addOrder(Order.asc("trx." + MaterialTransaction.PROPERTY_TRANSACTIONPROCESSDATE)); + critLines.addOrder(Order.asc(CostAdjustmentLine.PROPERTY_ADJUSTMENTAMOUNT)); critLines.addOrder(Order.asc("trx." + MaterialTransaction.PROPERTY_MOVEMENTDATE)); - critLines.addOrder(Order.asc("trx." + MaterialTransaction.PROPERTY_TRANSACTIONPROCESSDATE)); critLines.setMaxResults(1); return (CostAdjustmentLine) critLines.uniqueResult(); } diff -r 107d831cf383 -r 5bb50e44ea69 src/org/openbravo/costing/LCMatchingProcess.java --- a/src/org/openbravo/costing/LCMatchingProcess.java Thu Dec 04 16:58:28 2014 +0100 +++ b/src/org/openbravo/costing/LCMatchingProcess.java Mon Dec 01 16:55:05 2014 +0100 @@ -152,10 +152,15 @@ StringBuffer hql = new StringBuffer(); hql.append(" select sum(rla." + LCReceiptLineAmt.PROPERTY_AMOUNT + ") as amt"); hql.append(" , rla." + LCReceipt.PROPERTY_GOODSSHIPMENTLINE + ".id as receipt"); + hql.append(" , (select " + MaterialTransaction.PROPERTY_TRANSACTIONPROCESSDATE + " from " + + MaterialTransaction.ENTITY_NAME + " as transaction where " + + MaterialTransaction.PROPERTY_GOODSSHIPMENTLINE + ".id = rla." + + LCReceipt.PROPERTY_GOODSSHIPMENTLINE + ".id) as trxprocessdate"); hql.append(" from " + LCReceiptLineAmt.ENTITY_NAME + " as rla"); hql.append(" where rla." + LCReceiptLineAmt.PROPERTY_LANDEDCOSTCOST + " = :lcc"); hql.append(" and rla." + LCReceiptLineAmt.PROPERTY_ISMATCHINGADJUSTMENT + " = true "); hql.append(" group by rla." + LCReceipt.PROPERTY_GOODSSHIPMENTLINE + ".id"); + hql.append(" order by trxprocessdate, amt"); Query qryLCRLA = OBDal.getInstance().getSession().createQuery(hql.toString()); qryLCRLA.setParameter("lcc", lcCost); diff -r 107d831cf383 -r 5bb50e44ea69 src/org/openbravo/costing/LandedCostDistributionByAmount.java --- a/src/org/openbravo/costing/LandedCostDistributionByAmount.java Thu Dec 04 16:58:28 2014 +0100 +++ b/src/org/openbravo/costing/LandedCostDistributionByAmount.java Mon Dec 01 16:55:05 2014 +0100 @@ -145,7 +145,8 @@ qry.append(" and lcr." + LCReceipt.PROPERTY_LANDEDCOST + ".id = :landedCost"); qry.append(" group by lcr.id, iol.id, trx." + MaterialTransaction.PROPERTY_CURRENCY + ".id"); if (doOrderBy) { - qry.append(" order by sum(tc." + TransactionCost.PROPERTY_COST + ")"); + qry.append(" order by iol." + ShipmentInOutLine.PROPERTY_LINENO); + qry.append(" , sum(tc." + TransactionCost.PROPERTY_COST + ")"); } Query qryReceiptCosts = OBDal.getInstance().getSession().createQuery(qry.toString()); diff -r 107d831cf383 -r 5bb50e44ea69 src/org/openbravo/costing/LandedCostProcess.java --- a/src/org/openbravo/costing/LandedCostProcess.java Thu Dec 04 16:58:28 2014 +0100 +++ b/src/org/openbravo/costing/LandedCostProcess.java Mon Dec 01 16:55:05 2014 +0100 @@ -165,7 +165,10 @@ } private void distributeAmounts(LandedCost landedCost) { - for (LandedCostCost lcCost : landedCost.getLandedCostCostList()) { + OBCriteria<LandedCostCost> criteria = OBDal.getInstance().createCriteria(LandedCostCost.class); + criteria.add(Restrictions.eq(LandedCostCost.PROPERTY_LANDEDCOST, landedCost)); + criteria.addOrderBy(LandedCostCost.PROPERTY_LINENO, true); + for (LandedCostCost lcCost : criteria.list()) { log.debug("Start Distributing lcCost {}", lcCost.getIdentifier()); // Load distribution algorithm LandedCostDistributionAlgorithm lcDistAlg = getDistributionAlgorithm(lcCost diff -r 107d831cf383 -r 5bb50e44ea69 src/org/openbravo/erpCommon/ad_forms/DocLineLandedCost_data.xsql --- a/src/org/openbravo/erpCommon/ad_forms/DocLineLandedCost_data.xsql Thu Dec 04 16:58:28 2014 +0100 +++ b/src/org/openbravo/erpCommon/ad_forms/DocLineLandedCost_data.xsql Mon Dec 01 16:55:05 2014 +0100 @@ -45,7 +45,7 @@ AND IOL.M_LOCATOR_ID = L.M_LOCATOR_ID AND LCR.ISMATCHADJUSTMENT = 'N' AND LCC.M_LANDEDCOST_ID = ? - ORDER BY IO.DOCUMENTNO, IO.M_INOUT_ID, IOL.LINE + ORDER BY LCC.LINE, IO.DOCUMENTNO, IO.M_INOUT_ID, IOL.LINE ]]> </Sql> <Parameter name="LC_Receiptline_Amt"/> ------------------------------------------------------------------------------ Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration & more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk _______________________________________________ Openbravo-commits mailing list Openbravo-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbravo-commits