IDEMPIERE-1140 Copy record uses wrong quantity when used in shipment line / receipt line - implemented:

- calculate running qty on same shipment/receipt - when user choose same order line twice the callout subtract the running qty of orderline
- callout set qty to 1 when using a serialized ASI
This commit is contained in:
Carlos Ruiz 2013-08-03 10:04:38 -05:00
parent d7dc94dbab
commit ad274f6ad2
1 changed files with 13 additions and 0 deletions

View File

@ -425,6 +425,13 @@ public class CalloutInOut extends CalloutEngine
//
mTab.setValue("C_UOM_ID", new Integer(ol.getC_UOM_ID()));
BigDecimal MovementQty = ol.getQtyOrdered().subtract(ol.getQtyDelivered());
BigDecimal runningqty = DB.getSQLValueBDEx(null, "SELECT SUM(MovementQty) FROM M_InOutLine WHERE M_InOut_ID=? AND M_InOutLine_ID!=? AND C_OrderLine_ID=?",
Env.getContextAsInt(ctx, WindowNo, "M_InOut_ID"),
Env.getContextAsInt(ctx, WindowNo, "M_InOutLine_ID"),
ol.get_ID());
if (runningqty != null) {
MovementQty = MovementQty.subtract(runningqty); // IDEMPIERE-1140
}
mTab.setValue("MovementQty", MovementQty);
BigDecimal QtyEntered = MovementQty;
if (ol.getQtyEntered().compareTo(ol.getQtyOrdered()) != 0)
@ -694,6 +701,12 @@ public class CalloutInOut extends CalloutEngine
mTab.setValue("M_Locator_ID", new Integer (selectedM_Locator_ID));
}
}
MAttributeSetInstance asi = MAttributeSetInstance.get(ctx, M_ASI_ID.intValue(), 0);
if (asi.getSerNo() != null) {
// serialized ASI - force qty yo 1 - IDEMPIERE-1140
mTab.setValue("MovementQty", Env.ONE);
mTab.setValue("QtyEntered", Env.ONE);
}
return "";
} // asi