IDEMPIERE-2372 Document Action Access not working for documents without C_DocType_ID

This commit is contained in:
Carlos Ruiz 2014-12-26 23:37:29 -05:00
parent f3b9db25f4
commit bc7b58145b
2 changed files with 26 additions and 0 deletions

View File

@ -34,6 +34,10 @@ import org.compiere.apps.ADialog;
import org.compiere.apps.AEnv; import org.compiere.apps.AEnv;
import org.compiere.apps.ConfirmPanel; import org.compiere.apps.ConfirmPanel;
import org.compiere.model.GridTab; 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.MTable;
import org.compiere.model.PO; import org.compiere.model.PO;
import org.compiere.process.DocOptions; import org.compiere.process.DocOptions;
@ -245,6 +249,15 @@ public class VDocAction extends CDialog
if(doctypeId==null || doctypeId.intValue()==0){ if(doctypeId==null || doctypeId.intValue()==0){
doctypeId = (Integer)m_mTab.getValue("C_DocTypeTarget_ID"); 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 (log.isLoggable(Level.FINE)) log.fine("get doctype: " + doctypeId);
if (doctypeId != null) { if (doctypeId != null) {
index = DocumentEngine.checkActionAccess(Env.getAD_Client_ID(Env.getCtx()), index = DocumentEngine.checkActionAccess(Env.getAD_Client_ID(Env.getCtx()),

View File

@ -35,7 +35,11 @@ import org.adempiere.webui.component.Window;
import org.adempiere.webui.event.DialogEvents; import org.adempiere.webui.event.DialogEvents;
import org.adempiere.webui.window.FDialog; import org.adempiere.webui.window.FDialog;
import org.compiere.model.GridTab; import org.compiere.model.GridTab;
import org.compiere.model.MAllocationHdr;
import org.compiere.model.MBankStatement;
import org.compiere.model.MClientInfo; import org.compiere.model.MClientInfo;
import org.compiere.model.MDocType;
import org.compiere.model.MProduction;
import org.compiere.model.MTable; import org.compiere.model.MTable;
import org.compiere.model.PO; import org.compiere.model.PO;
import org.compiere.process.DocOptions; import org.compiere.process.DocOptions;
@ -169,6 +173,15 @@ public class WDocActionPanel extends Window implements EventListener<Event>, Dia
if(doctypeId==null || doctypeId.intValue()==0){ if(doctypeId==null || doctypeId.intValue()==0){
doctypeId = (Integer)gridTab.getValue("C_DocTypeTarget_ID"); 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 (logger.isLoggable(Level.FINE)) logger.fine("get doctype: " + doctypeId);
if (doctypeId != null) { if (doctypeId != null) {
index = DocumentEngine.checkActionAccess(Env.getAD_Client_ID(Env.getCtx()), index = DocumentEngine.checkActionAccess(Env.getAD_Client_ID(Env.getCtx()),