diff --git a/org.adempiere.base/src/org/compiere/model/MMovement.java b/org.adempiere.base/src/org/compiere/model/MMovement.java index 2614d6a421..31bc0ef42f 100644 --- a/org.adempiere.base/src/org/compiere/model/MMovement.java +++ b/org.adempiere.base/src/org/compiere/model/MMovement.java @@ -435,7 +435,8 @@ public class MMovement extends X_M_Movement implements DocAction M_AttributeSetInstanceTo_ID = ma.getM_AttributeSetInstance_ID(); } //Update Storage - if (!MStorageOnHand.add(getCtx(),locator.getM_Warehouse_ID(), + MLocator locatorTo = new MLocator (getCtx(), line.getM_LocatorTo_ID(), get_TrxName()); + if (!MStorageOnHand.add(getCtx(),locatorTo.getM_Warehouse_ID(), line.getM_LocatorTo_ID(), line.getM_Product_ID(), M_AttributeSetInstanceTo_ID, @@ -473,17 +474,13 @@ public class MMovement extends X_M_Movement implements DocAction // Fallback - We have ASI if (trxFrom == null) { - I_M_AttributeSetInstance asi = line.getM_AttributeSetInstance(); - Timestamp dateMPolicy= getMovementDate(); - dateMPolicy = asi.getCreated(); - MLocator locator = new MLocator (getCtx(), line.getM_Locator_ID(), get_TrxName()); //Update Storage if (!MStorageOnHand.add(getCtx(),locator.getM_Warehouse_ID(), line.getM_Locator_ID(), line.getM_Product_ID(), line.getM_AttributeSetInstance_ID(), - line.getMovementQty().negate(),dateMPolicy, get_TrxName())) + line.getMovementQty().negate(), null, get_TrxName())) { String lastError = CLogger.retrieveErrorString(""); m_processMsg = "Cannot correct Inventory OnHand (MA) - " + lastError; @@ -491,11 +488,12 @@ public class MMovement extends X_M_Movement implements DocAction } //Update Storage - if (!MStorageOnHand.add(getCtx(),locator.getM_Warehouse_ID(), + MLocator locatorTo = new MLocator (getCtx(), line.getM_LocatorTo_ID(), get_TrxName()); + if (!MStorageOnHand.add(getCtx(),locatorTo.getM_Warehouse_ID(), line.getM_LocatorTo_ID(), line.getM_Product_ID(), line.getM_AttributeSetInstanceTo_ID(), - line.getMovementQty(),dateMPolicy, get_TrxName())) + line.getMovementQty(), null, get_TrxName())) { String lastError = CLogger.retrieveErrorString(""); m_processMsg = "Cannot correct Inventory OnHand (MA) - " + lastError; diff --git a/org.adempiere.base/src/org/compiere/model/MStorageOnHand.java b/org.adempiere.base/src/org/compiere/model/MStorageOnHand.java index 997afc20c6..4f0e00b5b6 100644 --- a/org.adempiere.base/src/org/compiere/model/MStorageOnHand.java +++ b/org.adempiere.base/src/org/compiere/model/MStorageOnHand.java @@ -713,7 +713,7 @@ public class MStorageOnHand extends X_M_StorageOnHand if (M_AttributeSetInstance_ID > 0) { MAttributeSetInstance asi = new MAttributeSetInstance(ctx, M_AttributeSetInstance_ID, trxName); - dateMPolicy = asi.getCreated(); + dateMPolicy = asi.getCreated(); } else {