[costAdjs]trxs created by opening inventory of inventory amount update process: cost permanent=Y
authorMiguel A. Alsasua <miguel.alsasua@openbravo.com>
Fri, 19 Sep 2014 13:29:35 +0200
changeset 24914 79600686a7af
parent 24913 e10ca5e6571f
child 24915 3468ee1d35b8
[costAdjs]trxs created by opening inventory of inventory amount update process: cost permanent=Y
src/org/openbravo/costing/InventoryAmountUpdateProcess.java
src/org/openbravo/materialmgmt/InventoryCountProcess.java
--- a/src/org/openbravo/costing/InventoryAmountUpdateProcess.java	Fri Sep 19 11:53:32 2014 +0200
+++ b/src/org/openbravo/costing/InventoryAmountUpdateProcess.java	Fri Sep 19 13:29:35 2014 +0200
@@ -135,7 +135,7 @@
         try {
           while (invLines.next()) {
             final InventoryCount inventory = (InventoryCount) invLines.get()[0];
-            new InventoryCountProcess().processInventory(inventory, false);
+            new InventoryCountProcess().processInventory(inventory, false, true);
           }
         } finally {
           invLines.close();
--- a/src/org/openbravo/materialmgmt/InventoryCountProcess.java	Fri Sep 19 11:53:32 2014 +0200
+++ b/src/org/openbravo/materialmgmt/InventoryCountProcess.java	Fri Sep 19 13:29:35 2014 +0200
@@ -146,6 +146,11 @@
 
   public OBError processInventory(InventoryCount inventory, boolean checkReservationQty)
       throws OBException {
+    return processInventory(inventory, true, false);
+  }
+
+  public OBError processInventory(InventoryCount inventory, boolean checkReservationQty,
+      boolean checkPermanentCost) throws OBException {
     OBError msg = new OBError();
     msg.setType("Success");
     msg.setTitle(OBMessageUtils.messageBD("Success"));
@@ -180,6 +185,7 @@
     insert.append(", " + MaterialTransaction.PROPERTY_UPDATEDBY);
     insert.append(", " + MaterialTransaction.PROPERTY_MOVEMENTTYPE);
     insert.append(", " + MaterialTransaction.PROPERTY_CHECKRESERVEDQUANTITY);
+    insert.append(", " + MaterialTransaction.PROPERTY_ISCOSTPERMANENT);
     insert.append(", " + MaterialTransaction.PROPERTY_MOVEMENTDATE);
     insert.append(", " + MaterialTransaction.PROPERTY_STORAGEBIN);
     insert.append(", " + MaterialTransaction.PROPERTY_PRODUCT);
@@ -201,12 +207,23 @@
     insert.append(", u");
     insert.append(", 'I+'");
     // We have to set check reservation quantity flag equal to checkReservationQty
+    // InventoryCountLine.PROPERTY_ACTIVE-->> Y
+    // InventoryCountLine.PROPERTY_PHYSINVENTORY + "." + InventoryCount.PROPERTY_PROCESSED -->> N
     if (checkReservationQty) {
       insert.append(", e." + InventoryCountLine.PROPERTY_ACTIVE);
     } else {
       insert.append(", e." + InventoryCountLine.PROPERTY_PHYSINVENTORY + "."
           + InventoryCount.PROPERTY_PROCESSED);
     }
+    // We have to set check permanent cost flag
+    // InventoryCountLine.PROPERTY_ACTIVE-->> Y
+    // InventoryCountLine.PROPERTY_PHYSINVENTORY + "." + InventoryCount.PROPERTY_PROCESSED -->> N
+    if (checkPermanentCost) {
+      insert.append(", e." + InventoryCountLine.PROPERTY_ACTIVE);
+    } else {
+      insert.append(", e." + InventoryCountLine.PROPERTY_PHYSINVENTORY + "."
+          + InventoryCount.PROPERTY_PROCESSED);
+    }
     insert.append(", e." + InventoryCountLine.PROPERTY_PHYSINVENTORY + "."
         + InventoryCount.PROPERTY_MOVEMENTDATE);
     insert.append(", e." + InventoryCountLine.PROPERTY_STORAGEBIN);