Implement [2892393] - Flexibilize DocumentEngine getValidActions
https://sourceforge.net/tracker/?func=detail&aid=2892393&group_id=176962&atid=879335
This commit is contained in:
parent
5562699088
commit
d8d2972ba6
|
@ -0,0 +1,42 @@
|
|||
/******************************************************************************
|
||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
||||
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms version 2 of the GNU General Public License as published *
|
||||
* by the Free Software Foundation. This program is distributed in the hope *
|
||||
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU General Public License for more details. *
|
||||
* You should have received a copy of the GNU General Public License along *
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||
* For the text or an alternative of this public license, you may reach us *
|
||||
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
|
||||
* or via info@compiere.org or http://www.compiere.org/license.html *
|
||||
*****************************************************************************/
|
||||
package org.compiere.process;
|
||||
|
||||
|
||||
/**
|
||||
* Document Options Interface
|
||||
*
|
||||
* @author Carlos Ruiz
|
||||
*/
|
||||
public interface DocOptions
|
||||
{
|
||||
/**
|
||||
* Customize Valid Actions
|
||||
* @param docStatus
|
||||
* @param processing
|
||||
* @param orderType
|
||||
* @param isSOTrx
|
||||
* @param AD_Table_ID
|
||||
* @param docAction
|
||||
* @param options
|
||||
* @param index
|
||||
* @return Number of valid options
|
||||
*/
|
||||
public int customizeValidActions (String docStatus, Object processing,
|
||||
String orderType, String isSOTrx, int AD_Table_ID, String[] docAction, String[] options, int index);
|
||||
|
||||
} // DocAction
|
|
@ -34,6 +34,9 @@ import org.compiere.apps.ADialog;
|
|||
import org.compiere.apps.AEnv;
|
||||
import org.compiere.apps.ConfirmPanel;
|
||||
import org.compiere.model.GridTab;
|
||||
import org.compiere.model.MTable;
|
||||
import org.compiere.model.PO;
|
||||
import org.compiere.process.DocOptions;
|
||||
import org.compiere.process.DocumentEngine;
|
||||
import org.compiere.swing.CComboBox;
|
||||
import org.compiere.swing.CDialog;
|
||||
|
@ -232,6 +235,12 @@ public class VDocAction extends CDialog
|
|||
index = DocumentEngine.getValidActions(DocStatus, Processing, OrderType, IsSOTrx, m_AD_Table_ID,
|
||||
docActionHolder, options);
|
||||
|
||||
MTable table = MTable.get(Env.getCtx(), m_AD_Table_ID);
|
||||
PO po = table.getPO(Record_ID, null);
|
||||
if (po instanceof DocOptions)
|
||||
index = ((DocOptions) po).customizeValidActions(DocStatus, Processing, OrderType, IsSOTrx,
|
||||
m_AD_Table_ID, docActionHolder, options, index);
|
||||
|
||||
Integer doctypeId = (Integer)m_mTab.getValue("C_DocType_ID");
|
||||
if(doctypeId==null || doctypeId.intValue()==0){
|
||||
doctypeId = (Integer)m_mTab.getValue("C_DocTypeTarget_ID");
|
||||
|
|
|
@ -29,6 +29,9 @@ import org.adempiere.webui.component.Rows;
|
|||
import org.adempiere.webui.component.Window;
|
||||
import org.adempiere.webui.window.FDialog;
|
||||
import org.compiere.model.GridTab;
|
||||
import org.compiere.model.MTable;
|
||||
import org.compiere.model.PO;
|
||||
import org.compiere.process.DocOptions;
|
||||
import org.compiere.process.DocumentEngine;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.DB;
|
||||
|
@ -150,6 +153,12 @@ public class WDocActionPanel extends Window implements EventListener
|
|||
index = DocumentEngine.getValidActions(DocStatus, Processing, OrderType, IsSOTrx,
|
||||
m_AD_Table_ID, docActionHolder, options);
|
||||
|
||||
MTable table = MTable.get(Env.getCtx(), m_AD_Table_ID);
|
||||
PO po = table.getPO(gridTab.getRecord_ID(), null);
|
||||
if (po instanceof DocOptions)
|
||||
index = ((DocOptions) po).customizeValidActions(DocStatus, Processing, OrderType, IsSOTrx,
|
||||
m_AD_Table_ID, docActionHolder, options, index);
|
||||
|
||||
Integer doctypeId = (Integer)gridTab.getValue("C_DocType_ID");
|
||||
if(doctypeId==null || doctypeId.intValue()==0){
|
||||
doctypeId = (Integer)gridTab.getValue("C_DocTypeTarget_ID");
|
||||
|
|
Loading…
Reference in New Issue