1003528 GL Bug? Reversed payment showing up on Payment Allocation. Fixed reverse accrual of payment.

This commit is contained in:
Heng Sin Low 2013-12-03 17:57:54 +08:00
parent 548d0d1791
commit c436141c39
1 changed files with 32 additions and 36 deletions

View File

@ -2429,7 +2429,6 @@ public final class MPayment extends X_C_Payment
}
//
setC_Invoice_ID(0);
if (!accrual)
setIsAllocated(false);
} // deallocate
@ -2626,17 +2625,15 @@ public final class MPayment extends X_C_Payment
setReversal_ID(reversal.getC_Payment_ID());
StringBuilder info = new StringBuilder(reversal.getDocumentNo());
if (!accrual)
{
// Create automatic Allocation
MAllocationHdr alloc = new MAllocationHdr (getCtx(), false,
getDateTrx(), getC_Currency_ID(),
( accrual ? dateAcct : getDateTrx() ),
getC_Currency_ID(),
Msg.translate(getCtx(), "C_Payment_ID") + ": " + reversal.getDocumentNo(), get_TrxName());
alloc.setAD_Org_ID(getAD_Org_ID());
if (!alloc.save())
log.warning("Automatic allocation - hdr not saved");
else
{
alloc.saveEx(get_TrxName());
// Original Allocation
MAllocationLine aLine = new MAllocationLine (alloc, getPayAmt(true),
Env.ZERO, Env.ZERO, Env.ZERO);
@ -2651,7 +2648,7 @@ public final class MPayment extends X_C_Payment
aLine.setPaymentInfo(reversal.getC_Payment_ID(), 0);
if (!aLine.save(get_TrxName()))
log.warning("Automatic allocation - reversal line not saved");
}
// added AdempiereException by zuhri
if (!alloc.processIt(DocAction.ACTION_Complete))
throw new AdempiereException("Failed when processing document - " + alloc.getProcessMsg());
@ -2659,7 +2656,6 @@ public final class MPayment extends X_C_Payment
alloc.saveEx(get_TrxName());
//
info.append(" - @C_AllocationHdr_ID@: ").append(alloc.getDocumentNo());
}
// Update BPartner
if (getC_BPartner_ID() != 0)