Fixes Issue 28450: Costing Migration Process does not fail any more.
authorUnai Martirena <unai.martirena@openbravo.com>
Thu, 18 Dec 2014 13:29:41 +0100
changeset 25632 abaeb7e23435
parent 25631 dfdc7b880446
child 25633 64161cd2e0b0
Fixes Issue 28450: Costing Migration Process does not fail any more.

In the function insertTrxCosts() in CostingMigrationProcess.java while inserting m_transaction_cost records the column dateacct is filled in the following way:
* If the transaction is a goods shipment line, with the accounting date of the Shipment.
* If the transaction is not a goods shipment line, with the movement date of the transaction.
src/org/openbravo/costing/CostingMigrationProcess.java
--- a/src/org/openbravo/costing/CostingMigrationProcess.java	Wed Dec 17 18:33:43 2014 +0100
+++ b/src/org/openbravo/costing/CostingMigrationProcess.java	Thu Dec 18 13:29:41 2014 +0100
@@ -732,6 +732,7 @@
     insert.append(", " + TransactionCost.PROPERTY_COST);
     insert.append(", " + TransactionCost.PROPERTY_COSTDATE);
     insert.append(", " + TransactionCost.PROPERTY_CURRENCY);
+    insert.append(", " + TransactionCost.PROPERTY_ACCOUNTINGDATE);
     insert.append(" )\n select get_uuid()");
     insert.append(", t." + MaterialTransaction.PROPERTY_ACTIVE);
     insert.append(", t." + MaterialTransaction.PROPERTY_CLIENT);
@@ -744,6 +745,11 @@
     insert.append(", t." + MaterialTransaction.PROPERTY_TRANSACTIONCOST);
     insert.append(", t." + MaterialTransaction.PROPERTY_TRANSACTIONPROCESSDATE);
     insert.append(", t." + MaterialTransaction.PROPERTY_CURRENCY);
+    insert.append(", case when t." + MaterialTransaction.PROPERTY_GOODSSHIPMENTLINE
+        + " is null then t." + MaterialTransaction.PROPERTY_MOVEMENTDATE + " else t."
+        + MaterialTransaction.PROPERTY_GOODSSHIPMENTLINE + "."
+        + ShipmentInOutLine.PROPERTY_SHIPMENTRECEIPT + "." + ShipmentInOut.PROPERTY_ACCOUNTINGDATE
+        + " end");
     insert.append(" from  " + TransactionCost.ENTITY_NAME + " as tc ");
     insert.append("   right join tc." + TransactionCost.PROPERTY_INVENTORYTRANSACTION + " as t");
     insert.append(", " + User.ENTITY_NAME + " as u");