IDEMPIERE-3838 GL Journal post result in the Accounting Schema of the document

This commit is contained in:
Diego Ruiz 2018-12-14 12:49:53 +01:00
parent c0005f0246
commit 7e1d17e490
2 changed files with 22 additions and 1 deletions

View File

@ -615,6 +615,7 @@ public class WAcctViewer extends Window implements EventListener<Event>
private void dynInit (int AD_Table_ID, int Record_ID)
{
m_data.validateAcctSchemas(Record_ID);
m_data.fillAcctSchema(selAcctSchema );
selAcctSchema.addEventListener(Events.ON_SELECT, this);

View File

@ -21,6 +21,8 @@
package org.adempiere.webui.acct;
import static org.compiere.model.SystemIDs.REFERENCE_POSTING_TYPE;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
@ -36,9 +38,9 @@ import org.adempiere.webui.component.Listbox;
import org.compiere.model.MAcctSchema;
import org.compiere.model.MAcctSchemaElement;
import org.compiere.model.MFactAcct;
import org.compiere.model.MJournal;
import org.compiere.model.MLookupFactory;
import org.compiere.model.MRefList;
import static org.compiere.model.SystemIDs.*;
import org.compiere.report.core.RColumn;
import org.compiere.report.core.RModel;
import org.compiere.util.CLogger;
@ -179,6 +181,24 @@ public class WAcctViewerData
Env.clearWinContext(WindowNo);
} // dispose
/**
* GL Journal only posts in one Accounting Schema
* if the record is a GL Journal, remove the others from the array
* @param Record_ID
*/
protected void validateAcctSchemas(int Record_ID)
{
if (Record_ID > 0 && AD_Table_ID == MJournal.Table_ID) {
MJournal journal = new MJournal(Env.getCtx(), Record_ID, null);
if (journal != null) {
ASchemas = new MAcctSchema[1];
ASchemas[0] = MAcctSchema.get(Env.getCtx(), journal.getC_AcctSchema_ID());
ASchema = ASchemas[0];
}
}
} // validateAcctSchemas
/**************************************************************************
* Fill Accounting Schema
* @param cb Listbox to be filled