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,6 +1121,9 @@ public class MInvoice extends X_C_Invoice implements DocAction
*/ */
public boolean testAllocation() public boolean testAllocation()
{ {
boolean change = false;
if ( isProcessed() ) {
BigDecimal alloc = getAllocatedAmt(); // absolute BigDecimal alloc = getAllocatedAmt(); // absolute
if (alloc == null) if (alloc == null)
alloc = Env.ZERO; alloc = Env.ZERO;
@ -1130,11 +1133,13 @@ public class MInvoice extends X_C_Invoice implements DocAction
if (isCreditMemo()) if (isCreditMemo())
total = total.negate(); total = total.negate();
boolean test = total.compareTo(alloc) == 0; boolean test = total.compareTo(alloc) == 0;
boolean change = test != isPaid(); change = test != isPaid();
if (change) if (change)
setIsPaid(test); setIsPaid(test);
log.fine("Paid=" + test log.fine("Paid=" + test
+ " (" + alloc + "=" + total + ")"); + " (" + alloc + "=" + total + ")");
}
return change; return change;
} // testAllocation } // testAllocation