details: https://code.openbravo.com/erp/devel/pi/rev/73788ba5c162 changeset: 33786:73788ba5c162 user: Atul Gaware <atul.gaware <at> openbravo.com> date: Tue Apr 10 19:19:32 2018 +0530 summary: Fixes Issue 38202:Process Price Difference Adjustment creates a draft cost adjustment record when there is error in process it.
Added rollback in catch when there is error in processing cost adjustment to avoid creation of draft adjustment details: https://code.openbravo.com/erp/devel/pi/rev/5e5c3183b597 changeset: 33787:5e5c3183b597 user: Atul Gaware <atul.gaware <at> openbravo.com> date: Tue Apr 10 19:22:43 2018 +0530 summary: Fixes Issue 38203:Permanently adjusted transactions wrongly included in Cost Adjustment process. Before adding cost adjustment line for transaction, check is done whether a transaction has permanent cost flag set as true, if yes do not add cost adjustment line for it. diffstat: src/org/openbravo/costing/CostingAlgorithmAdjustmentImp.java | 16 ++++++------ src/org/openbravo/costing/PriceDifferenceByDateProcess.java | 3 +- 2 files changed, 10 insertions(+), 9 deletions(-) diffs (95 lines): diff -r d3745e2fcd89 -r 5e5c3183b597 src/org/openbravo/costing/CostingAlgorithmAdjustmentImp.java --- a/src/org/openbravo/costing/CostingAlgorithmAdjustmentImp.java Wed Apr 11 12:55:40 2018 +0200 +++ b/src/org/openbravo/costing/CostingAlgorithmAdjustmentImp.java Tue Apr 10 19:22:43 2018 +0530 @@ -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) 2014-2017 Openbravo SLU + * All portions are Copyright (C) 2014-2018 Openbravo SLU * All Rights Reserved. * Contributor(s): ______________________________________. ************************************************************************* @@ -257,7 +257,7 @@ return; } MaterialTransaction deptrx = invline.getMaterialMgmtMaterialTransactionList().get(0); - if (!deptrx.isCostCalculated()) { + if (!deptrx.isCostCalculated() || deptrx.isCostPermanent()) { return; } insertCostAdjustmentLine(deptrx, costAdjLine.getAdjustmentAmount(), _costAdjLine); @@ -295,7 +295,7 @@ continue; } MaterialTransaction prodtrx = pline.getMaterialMgmtMaterialTransactionList().get(0); - if (!prodtrx.isCostCalculated()) { + if (!prodtrx.isCostCalculated() || prodtrx.isCostPermanent()) { continue; } CostAdjustmentLine newCAL = insertCostAdjustmentLine(prodtrx, adjAmt, _costAdjLine); @@ -330,7 +330,7 @@ continue; } MaterialTransaction prodtrx = pline.getMaterialMgmtMaterialTransactionList().get(0); - if (!prodtrx.isCostCalculated()) { + if (!prodtrx.isCostCalculated() || prodtrx.isCostPermanent()) { continue; } insertCostAdjustmentLine(prodtrx, costAdjLine.getAdjustmentAmount(), _costAdjLine); @@ -354,7 +354,7 @@ } InternalConsumptionLine intCons = intConsVoidedList.get(0); MaterialTransaction voidedTrx = intCons.getMaterialMgmtMaterialTransactionList().get(0); - if (!voidedTrx.isCostCalculated()) { + if (!voidedTrx.isCostCalculated() || voidedTrx.isCostPermanent()) { return; } insertCostAdjustmentLine(voidedTrx, costAdjLine.getAdjustmentAmount(), _costAdjLine); @@ -373,7 +373,7 @@ if (movementTransaction.getId().equals(transaction.getId())) { continue; } - if (!movementTransaction.isCostCalculated()) { + if (!movementTransaction.isCostCalculated() || movementTransaction.isCostPermanent()) { continue; } insertCostAdjustmentLine(movementTransaction, costAdjLine.getAdjustmentAmount(), _costAdjLine); @@ -393,7 +393,7 @@ return; } for (MaterialTransaction trx : voidedinoutline.getMaterialMgmtMaterialTransactionList()) { - if (!trx.isCostCalculated()) { + if (!trx.isCostCalculated() || trx.isCostPermanent()) { continue; } insertCostAdjustmentLine(trx, costAdjLine.getAdjustmentAmount(), _costAdjLine); @@ -428,7 +428,7 @@ counter++; MaterialTransaction trx = (MaterialTransaction) trxs.get()[0]; - if (trx.isCostCalculated()) { + if (trx.isCostCalculated() && !trx.isCostPermanent()) { BigDecimal adjAmt = costAdjAmt.multiply(trx.getMovementQuantity().abs()).divide( inoutline.getMovementQuantity().abs(), precission, RoundingMode.HALF_UP); insertCostAdjustmentLine(trx, adjAmt, _costAdjLine); diff -r d3745e2fcd89 -r 5e5c3183b597 src/org/openbravo/costing/PriceDifferenceByDateProcess.java --- a/src/org/openbravo/costing/PriceDifferenceByDateProcess.java Wed Apr 11 12:55:40 2018 +0200 +++ b/src/org/openbravo/costing/PriceDifferenceByDateProcess.java Tue Apr 10 19:22:43 2018 +0530 @@ -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) 2014-2017 Openbravo SLU + * All portions are Copyright (C) 2014-2018 Openbravo SLU * All Rights Reserved. * Contributor(s): ______________________________________. ************************************************************************ @@ -74,6 +74,7 @@ jsonRequest.put("message", msg); jsonRequest.put("retryExecution", true); } catch (Exception e) { + OBDal.getInstance().rollbackAndClose(); log.error("Error Process Price Correction", e); try { ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Openbravo-commits mailing list Openbravo-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbravo-commits