Fix [ 1953184 ] Validate BP marks draft invoice as paid

This commit is contained in:
Carlos Ruiz 2008-05-01 05:19:22 +00:00
parent 1738aedbcc
commit d0036eff0e
1 changed files with 19 additions and 14 deletions

View File

@ -1121,20 +1121,25 @@ public class MInvoice extends X_C_Invoice implements DocAction
*/ */
public boolean testAllocation() public boolean testAllocation()
{ {
BigDecimal alloc = getAllocatedAmt(); // absolute boolean change = false;
if (alloc == null)
alloc = Env.ZERO; if ( isProcessed() ) {
BigDecimal total = getGrandTotal(); BigDecimal alloc = getAllocatedAmt(); // absolute
if (!isSOTrx()) if (alloc == null)
total = total.negate(); alloc = Env.ZERO;
if (isCreditMemo()) BigDecimal total = getGrandTotal();
total = total.negate(); if (!isSOTrx())
boolean test = total.compareTo(alloc) == 0; total = total.negate();
boolean change = test != isPaid(); if (isCreditMemo())
if (change) total = total.negate();
setIsPaid(test); boolean test = total.compareTo(alloc) == 0;
log.fine("Paid=" + test change = test != isPaid();
+ " (" + alloc + "=" + total + ")"); if (change)
setIsPaid(test);
log.fine("Paid=" + test
+ " (" + alloc + "=" + total + ")");
}
return change; return change;
} // testAllocation } // testAllocation