IDEMPIERE-1467 set lines to 0 if voiding drafted GL Journal

This commit is contained in:
anozimada 2013-10-24 14:25:07 +07:00
parent edcf53d198
commit 59cddaf94e
1 changed files with 13 additions and 0 deletions

View File

@ -654,6 +654,19 @@ public class MJournal extends X_GL_Journal implements DocAction
if (DOCSTATUS_Drafted.equals(getDocStatus()) if (DOCSTATUS_Drafted.equals(getDocStatus())
|| DOCSTATUS_Invalid.equals(getDocStatus())) || DOCSTATUS_Invalid.equals(getDocStatus()))
{ {
// set lines to 0
MJournalLine[] lines = getLines(false);
for (int i = 0; i < lines.length; i++) {
MJournalLine line = lines[i];
if (line.getAmtAcctDr().signum() != 0 || line.getAmtAcctCr().signum() != 0) {
line.setAmtAcctDr(Env.ZERO);
line.setAmtAcctCr(Env.ZERO);
line.setAmtSourceDr(Env.ZERO);
line.setAmtSourceCr(Env.ZERO);
line.setQty(Env.ZERO);
line.saveEx(get_TrxName());
}
}
setProcessed(true); setProcessed(true);
setDocAction(DOCACTION_None); setDocAction(DOCACTION_None);
ok_to_void = true; ok_to_void = true;