From 59cddaf94e6d2e122925966fe5e28614144dd329 Mon Sep 17 00:00:00 2001 From: anozimada Date: Thu, 24 Oct 2013 14:25:07 +0700 Subject: [PATCH] IDEMPIERE-1467 set lines to 0 if voiding drafted GL Journal --- .../src/org/compiere/model/MJournal.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/org.adempiere.base/src/org/compiere/model/MJournal.java b/org.adempiere.base/src/org/compiere/model/MJournal.java index 5c06479477..6ae875d6f8 100644 --- a/org.adempiere.base/src/org/compiere/model/MJournal.java +++ b/org.adempiere.base/src/org/compiere/model/MJournal.java @@ -654,6 +654,19 @@ public class MJournal extends X_GL_Journal implements DocAction if (DOCSTATUS_Drafted.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); setDocAction(DOCACTION_None); ok_to_void = true;