Fixes Issue 30259. When a Transaction is set as Permanent, avoid to modify
authorDavid Miguelez <david.miguelez@openbravo.com>
Fri, 26 Jun 2015 13:43:05 +0200
changeset 27159 f5b89bd131a9
parent 27158 b9068c9d09d1
child 27160 5c8a864ef970
Fixes Issue 30259. When a Transaction is set as Permanent, avoid to modify
it's Unitary Cost, since it will not be possible (it is checked later in the code)
src/org/openbravo/costing/CostingAlgorithmAdjustmentImp.java
--- a/src/org/openbravo/costing/CostingAlgorithmAdjustmentImp.java	Fri Jun 26 13:14:29 2015 +0200
+++ b/src/org/openbravo/costing/CostingAlgorithmAdjustmentImp.java	Fri Jun 26 13:43:05 2015 +0200
@@ -446,6 +446,14 @@
     BigDecimal adjAmt = BigDecimal.ZERO;
     TrxType calTrxType = TrxType.getTrxType(costAdjLine.getInventoryTransaction());
 
+    if (costAdjLine.getInventoryTransaction().isCostPermanent() && costAdjLine.isUnitCost()) {
+      costAdjLine.setCurrency((Currency) OBDal.getInstance().getProxy(Currency.ENTITY_NAME,
+          strCostCurrencyId));
+      costAdjLine.setAdjustmentAmount(adjAmt);
+      OBDal.getInstance().save(costAdjLine);
+      return;
+    }
+
     // Incoming transactions does not modify the calculated cost
     switch (calTrxType) {
     case ShipmentVoid: