Fixes Bug
28441:Validate Costing Rule doesn't fail if there prev transactions.
The process was failing while trying to create Transaction Cost records in initializeOldTrx and updateInventoriesCostAndProcessInitInventories processes. It was not setting any value to accounting date column, which is mandatory. This column has been populated in the following way: If the related transaction is a shipment the accounting date of the shipment is assigned, if not, the movement date of the transaction will be assigned.
--- a/src/org/openbravo/costing/CostingRuleProcess.java Wed Dec 17 16:22:29 2014 +0100
+++ b/src/org/openbravo/costing/CostingRuleProcess.java Wed Dec 17 18:33:43 2014 +0100
@@ -268,6 +268,9 @@
transactionCost.setOrganization(trx.getOrganization());
transactionCost.setCost(BigDecimal.ZERO);
transactionCost.setCurrency(trx.getClient().getCurrency());
+ transactionCost.setAccountingDate(trx.getGoodsShipmentLine() != null ? trx
+ .getGoodsShipmentLine().getShipmentReceipt().getAccountingDate() : trx
+ .getMovementDate());
List<TransactionCost> trxCosts = trx.getTransactionCostList();
trxCosts.add(transactionCost);
trx.setTransactionCostList(trxCosts);
@@ -516,6 +519,9 @@
transactionCost.setOrganization(trx.getOrganization());
transactionCost.setCost(BigDecimal.ZERO);
transactionCost.setCurrency(trx.getClient().getCurrency());
+ transactionCost.setAccountingDate(trx.getGoodsShipmentLine() != null ? trx
+ .getGoodsShipmentLine().getShipmentReceipt().getAccountingDate() : trx
+ .getMovementDate());
List<TransactionCost> trxCosts = trx.getTransactionCostList();
trxCosts.add(transactionCost);
trx.setTransactionCostList(trxCosts);