IDEMPIERE-2435 Open Balance is wrong calculated with payment selection

This commit is contained in:
Carlos Ruiz 2015-02-04 11:02:34 -05:00
parent 80c885c5b4
commit 1e9681173a
1 changed files with 3 additions and 2 deletions

View File

@ -1957,13 +1957,14 @@ public class MPayment extends X_C_Payment
if (log.isLoggable(Level.INFO)) log.info(toString());
// Charge Handling
boolean createdAllocationRecords = false;
if (getC_Charge_ID() != 0)
{
setIsAllocated(true);
}
else
{
allocateIt(); // Create Allocation Records
createdAllocationRecords = allocateIt(); // Create Allocation Records
testAllocation();
}
@ -1973,7 +1974,7 @@ public class MPayment extends X_C_Payment
// MProject project = new MProject(getCtx(), getC_Project_ID());
}
// Update BP for Prepayments
if (getC_BPartner_ID() != 0 && getC_Invoice_ID() == 0 && getC_Charge_ID() == 0 && MPaymentAllocate.get(this).length == 0)
if (getC_BPartner_ID() != 0 && getC_Invoice_ID() == 0 && getC_Charge_ID() == 0 && MPaymentAllocate.get(this).length == 0 && !createdAllocationRecords)
{
MBPartner bp = new MBPartner (getCtx(), getC_BPartner_ID(), get_TrxName());
DB.getDatabase().forUpdate(bp, 0);