IDEMPIERE-2629 M_StorageOnHand Qty and Total M_Transaction Qty did not match / fix error reported by Vassili Kouleshov https://groups.google.com/d/msg/idempiere/m6EvFnHqogA/AKiX-wv4AgAJ

This commit is contained in:
Carlos Ruiz 2017-04-05 15:08:31 +02:00
parent c8df3294bf
commit 02963854e0
1 changed files with 6 additions and 5 deletions

View File

@ -706,11 +706,6 @@ public class MStorageOnHand extends X_M_StorageOnHand
}
storage.addQtyOnHand(diffQtyOnHand);
if (storage.getQtyOnHand().signum() == -1) {
if (MWarehouse.get(Env.getCtx(), M_Warehouse_ID).isDisallowNegativeInv()) {
throw new AdempiereException(Msg.getMsg(ctx, "NegativeInventoryDisallowed"));
}
}
if (s_log.isLoggable(Level.FINE)) {
StringBuilder diffText = new StringBuilder("(OnHand=").append(diffQtyOnHand).append(") -> ").append(storage.toString());
s_log.fine(diffText.toString());
@ -729,6 +724,12 @@ public class MStorageOnHand extends X_M_StorageOnHand
new Object[] {addition, Env.getAD_User_ID(Env.getCtx()), getM_Product_ID(), getM_Locator_ID(), getM_AttributeSetInstance_ID(), getDateMaterialPolicy()},
get_TrxName());
load(get_TrxName());
if (getQtyOnHand().signum() == -1) {
MWarehouse wh = MWarehouse.get(Env.getCtx(), getM_Warehouse_ID());
if (wh.isDisallowNegativeInv()) {
throw new AdempiereException(Msg.getMsg(Env.getCtx(), "NegativeInventoryDisallowed"));
}
}
}
/**************************************************************************