IDEMPIERE-2063 Ticket #1004146: cannot remove reserve quantity off order

This commit is contained in:
Elaine Tan 2014-07-16 17:49:03 +08:00
parent 85ff580ba1
commit 300ae850ac
1 changed files with 14 additions and 6 deletions

View File

@ -1722,7 +1722,10 @@ public class MOrder extends X_C_Order implements DocAction
BigDecimal difference = target
.subtract(line.getQtyReserved())
.subtract(line.getQtyDelivered());
if (difference.signum() <= 0)
if (difference.signum() == 0 || line.getQtyOrdered().signum() < 0)
{
if (difference.signum() == 0 || line.getQtyReserved().signum() == 0)
{
MProduct product = line.getProduct();
if (product != null)
@ -1732,6 +1735,11 @@ public class MOrder extends X_C_Order implements DocAction
}
continue;
}
else if (line.getQtyOrdered().signum() < 0 && line.getQtyReserved().signum() > 0)
{
difference = line.getQtyReserved().negate();
}
}
if (log.isLoggable(Level.FINE)) log.fine("Line=" + line.getLine()
+ " - Target=" + target + ",Difference=" + difference