IDEMPIERE-4340 NPE in Auto Allocation (#129)

This commit is contained in:
Carlos Ruiz 2020-06-24 11:51:52 +02:00 committed by GitHub
parent 5662ab6080
commit 03fda36934
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -649,6 +649,8 @@ public class AllocationAuto extends SvrProcess
if (payment.getC_Currency_ID() != C_Currency_ID) if (payment.getC_Currency_ID() != C_Currency_ID)
continue; continue;
BigDecimal allocatedAmt = payment.getAllocatedAmt(); BigDecimal allocatedAmt = payment.getAllocatedAmt();
if (allocatedAmt == null)
allocatedAmt = Env.ZERO;
if (log.isLoggable(Level.INFO)) log.info(payment + ", Allocated=" + allocatedAmt); if (log.isLoggable(Level.INFO)) log.info(payment + ", Allocated=" + allocatedAmt);
BigDecimal availableAmt = payment.getPayAmt() BigDecimal availableAmt = payment.getPayAmt()
.add(payment.getDiscountAmt()) .add(payment.getDiscountAmt())
@ -709,6 +711,8 @@ public class AllocationAuto extends SvrProcess
if (payment.getC_Currency_ID() != C_Currency_ID) if (payment.getC_Currency_ID() != C_Currency_ID)
continue; continue;
BigDecimal allocatedAmt = payment.getAllocatedAmt(); BigDecimal allocatedAmt = payment.getAllocatedAmt();
if (allocatedAmt == null)
allocatedAmt = Env.ZERO;
// comment following lines to allow partial allocation // comment following lines to allow partial allocation
// if (allocatedAmt != null && allocatedAmt.signum() != 0) // if (allocatedAmt != null && allocatedAmt.signum() != 0)
// continue; // continue;
@ -841,7 +845,7 @@ public class AllocationAuto extends SvrProcess
else else
m_allocation.saveEx(); m_allocation.saveEx();
String message = Msg.parseTranslation(getCtx(), "@AllocationProcessed@ " + m_allocation.getDescription()); String message = Msg.parseTranslation(getCtx(), "@AllocationProcessed@ " + m_allocation.getDescription());
addLog(0, m_allocation.getDateAcct(), null, message); addLog(0, m_allocation.getDateAcct(), null, message, MAllocationHdr.Table_ID, m_allocation.getC_AllocationHdr_ID());
m_allocation = null; m_allocation = null;
return success; return success;
} // processAllocation } // processAllocation