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,15 +1722,23 @@ 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)
{
MProduct product = line.getProduct();
if (product != null)
if (difference.signum() == 0 || line.getQtyReserved().signum() == 0)
{
Volume = Volume.add(product.getVolume().multiply(line.getQtyOrdered()));
Weight = Weight.add(product.getWeight().multiply(line.getQtyOrdered()));
MProduct product = line.getProduct();
if (product != null)
{
Volume = Volume.add(product.getVolume().multiply(line.getQtyOrdered()));
Weight = Weight.add(product.getWeight().multiply(line.getQtyOrdered()));
}
continue;
}
else if (line.getQtyOrdered().signum() < 0 && line.getQtyReserved().signum() > 0)
{
difference = line.getQtyReserved().negate();
}
continue;
}
if (log.isLoggable(Level.FINE)) log.fine("Line=" + line.getLine()