From bc7b58145b031abc819930220745f25bfa93b17a Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Fri, 26 Dec 2014 23:37:29 -0500 Subject: [PATCH] IDEMPIERE-2372 Document Action Access not working for documents without C_DocType_ID --- .../src/org/compiere/grid/ed/VDocAction.java | 13 +++++++++++++ .../org/adempiere/webui/panel/WDocActionPanel.java | 13 +++++++++++++ 2 files changed, 26 insertions(+) diff --git a/org.adempiere.ui.swing/src/org/compiere/grid/ed/VDocAction.java b/org.adempiere.ui.swing/src/org/compiere/grid/ed/VDocAction.java index 7e299fe7f9..f37421c97f 100644 --- a/org.adempiere.ui.swing/src/org/compiere/grid/ed/VDocAction.java +++ b/org.adempiere.ui.swing/src/org/compiere/grid/ed/VDocAction.java @@ -34,6 +34,10 @@ import org.compiere.apps.ADialog; import org.compiere.apps.AEnv; import org.compiere.apps.ConfirmPanel; import org.compiere.model.GridTab; +import org.compiere.model.MAllocationHdr; +import org.compiere.model.MBankStatement; +import org.compiere.model.MDocType; +import org.compiere.model.MProduction; import org.compiere.model.MTable; import org.compiere.model.PO; import org.compiere.process.DocOptions; @@ -245,6 +249,15 @@ public class VDocAction extends CDialog if(doctypeId==null || doctypeId.intValue()==0){ doctypeId = (Integer)m_mTab.getValue("C_DocTypeTarget_ID"); } + if (doctypeId == null && MAllocationHdr.Table_ID == m_AD_Table_ID) { + doctypeId = MDocType.getDocType(MDocType.DOCBASETYPE_PaymentAllocation); + } + if (doctypeId == null && MBankStatement.Table_ID == m_AD_Table_ID) { + doctypeId = MDocType.getDocType(MDocType.DOCBASETYPE_BankStatement); + } + if (doctypeId == null && MProduction.Table_ID == m_AD_Table_ID) { + doctypeId = MDocType.getDocType(MDocType.DOCBASETYPE_MaterialProduction); + } if (log.isLoggable(Level.FINE)) log.fine("get doctype: " + doctypeId); if (doctypeId != null) { index = DocumentEngine.checkActionAccess(Env.getAD_Client_ID(Env.getCtx()), diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/WDocActionPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/WDocActionPanel.java index 314528cada..2ed270bf31 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/WDocActionPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/WDocActionPanel.java @@ -35,7 +35,11 @@ import org.adempiere.webui.component.Window; import org.adempiere.webui.event.DialogEvents; import org.adempiere.webui.window.FDialog; import org.compiere.model.GridTab; +import org.compiere.model.MAllocationHdr; +import org.compiere.model.MBankStatement; import org.compiere.model.MClientInfo; +import org.compiere.model.MDocType; +import org.compiere.model.MProduction; import org.compiere.model.MTable; import org.compiere.model.PO; import org.compiere.process.DocOptions; @@ -169,6 +173,15 @@ public class WDocActionPanel extends Window implements EventListener, Dia if(doctypeId==null || doctypeId.intValue()==0){ doctypeId = (Integer)gridTab.getValue("C_DocTypeTarget_ID"); } + if (doctypeId == null && MAllocationHdr.Table_ID == m_AD_Table_ID) { + doctypeId = MDocType.getDocType(MDocType.DOCBASETYPE_PaymentAllocation); + } + if (doctypeId == null && MBankStatement.Table_ID == m_AD_Table_ID) { + doctypeId = MDocType.getDocType(MDocType.DOCBASETYPE_BankStatement); + } + if (doctypeId == null && MProduction.Table_ID == m_AD_Table_ID) { + doctypeId = MDocType.getDocType(MDocType.DOCBASETYPE_MaterialProduction); + } if (logger.isLoggable(Level.FINE)) logger.fine("get doctype: " + doctypeId); if (doctypeId != null) { index = DocumentEngine.checkActionAccess(Env.getAD_Client_ID(Env.getCtx()),