From 877e198a706e7ba03d5ae6dd9c6fc70e16b0c606 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Thu, 18 Apr 2019 15:31:47 +0200 Subject: [PATCH] IDEMPIERE-2687 Special case for journal documents with direct period --- org.adempiere.base/src/org/compiere/model/MPeriod.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/org.adempiere.base/src/org/compiere/model/MPeriod.java b/org.adempiere.base/src/org/compiere/model/MPeriod.java index 1bc8b69fc1..3f158f7269 100644 --- a/org.adempiere.base/src/org/compiere/model/MPeriod.java +++ b/org.adempiere.base/src/org/compiere/model/MPeriod.java @@ -373,6 +373,16 @@ public class MPeriod extends X_C_Period orgID = po.get_ValueAsInt(idxorg); } + if (tableID == MJournal.Table_ID || tableID == MJournalBatch.Table_ID) { + // special case for journal that has direct period + int periodID = po.get_ValueAsInt("C_Period_ID"); + MPeriod period = MPeriod.get(ctx, periodID); + boolean open = period.isOpen(docBaseType, dateAcct); + if (!open) + s_log.warning(period.getName() + ": Not open for " + docBaseType + " (" + dateAcct + ")"); + return open; + } + return isOpen(ctx, dateAcct, docBaseType, orgID); } // isOpen