IDEMPIERE-3135 Bug Completing Bank Statements when using calendar & accounting periods per org: A potential wrong/test validation for open period is being performed in the class: BankStatement / IDEMPIERE-480

This commit is contained in:
Carlos Ruiz 2018-05-15 09:04:45 +02:00
parent b2dfbc8113
commit 83f5ee7d17
1 changed files with 10 additions and 8 deletions

View File

@ -312,23 +312,25 @@ public class MBankStatement extends X_C_BankStatement implements DocAction
} }
// Lines // Lines
BigDecimal total = Env.ZERO; BigDecimal total = Env.ZERO;
Timestamp minDate = getStatementDate(); // IDEMPIERE-480 changed the way accounting is posted, now lines post just with the accounting date of the statement header
Timestamp maxDate = minDate; // so, it is unnecessary to validate the period of lines
// Timestamp minDate = getStatementDate();
// Timestamp maxDate = minDate;
for (int i = 0; i < lines.length; i++) for (int i = 0; i < lines.length; i++)
{ {
MBankStatementLine line = lines[i]; MBankStatementLine line = lines[i];
if (!line.isActive()) if (!line.isActive())
continue; continue;
total = total.add(line.getStmtAmt()); total = total.add(line.getStmtAmt());
if (line.getDateAcct().before(minDate)) // if (line.getDateAcct().before(minDate))
minDate = line.getDateAcct(); // minDate = line.getDateAcct();
if (line.getDateAcct().after(maxDate)) // if (line.getDateAcct().after(maxDate))
maxDate = line.getDateAcct(); // maxDate = line.getDateAcct();
} }
setStatementDifference(total); setStatementDifference(total);
setEndingBalance(getBeginningBalance().add(total)); setEndingBalance(getBeginningBalance().add(total));
MPeriod.testPeriodOpen(getCtx(), minDate, MDocType.DOCBASETYPE_BankStatement, 0); // MPeriod.testPeriodOpen(getCtx(), minDate, MDocType.DOCBASETYPE_BankStatement, getAD_Org_ID());
MPeriod.testPeriodOpen(getCtx(), maxDate, MDocType.DOCBASETYPE_BankStatement, 0); // MPeriod.testPeriodOpen(getCtx(), maxDate, MDocType.DOCBASETYPE_BankStatement, getAD_Org_ID());
m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_PREPARE); m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_PREPARE);
if (m_processMsg != null) if (m_processMsg != null)