Page 1 of 1

Process Problem being called by ValidatorOrder

PostPosted: Wed Mar 19, 2014 12:57 am
by edilsondneto
Hello Anyone,

I'm a problem in the validator c_order, I call a process to convert a proposal/quote in a sales order. When I call this process the order still in transaction, and I think it causes an infinite loop. Anyone have any idea what should I do?

public class ValidatorOrder implements ModelValidator


processQuoteCopy(order, doctype);


* Method Process C_Order QuoteCopy
* @param pi ProcessInfo
public static boolean processQuoteCopy(MOrder order, MDocType dt) {

// need to commit in order to allow jasper to view the data
Trx trx = Trx.get(order.get_TableName(), true);

Timestamp dateCurrent = (new Timestamp(System.currentTimeMillis()));

// Create instance parameters. I e the parameters you want to send to the process.
ProcessInfoParameter pi1 = new ProcessInfoParameter("C_Order_ID", (BigDecimal.valueOf(order.getC_Order_ID())), "","","");
// ProcessInfoParameter pi2 = new ProcessInfoParameter("C_DocType_ID", (BigDecimal.valueOf(dt.getlcr_DocTypeSO_ID())), "","","");
ProcessInfoParameter pi2 = new ProcessInfoParameter("C_DocType_ID",
(BigDecimal.valueOf(MSysConfig.getIntValue("LCR_ALWAYS_CONVERT_QUOTE_AUTOMATIC_DOCTYPE", 0))), "", "", "");
ProcessInfoParameter pi3 = new ProcessInfoParameter("DateDoc", dateCurrent, "","","");
ProcessInfoParameter pi4 = new ProcessInfoParameter("IsCloseDocument", true, "","","");

// Create a process info instance. This is a composite class containing the parameters.
ProcessInfo pi = new ProcessInfo("", 0,0,0);
pi.setParameter(new ProcessInfoParameter[] {pi1, pi2, pi3, pi4});

// Lookup process in the AD, in this case by value
MProcess pr = new Query(Env.getCtx(), MProcess.Table_Name, "value=?", null)
.setParameters(new Object[]{"QuoteCopy"})
if (pr==null) {
//log.warning("This process " + pr.getName() + " not exists. ");
return false;

// Create an instance of the actual process class.
CopyOrder process = new CopyOrder();

// Create process instance (mainly for logging/sync purpose)
MPInstance mpi = new MPInstance(Env.getCtx(), 0, null);

// Connect the process to the process instance.

//"Iniciando processo " + pr.getName());
boolean result = process.startProcess(order.getCtx(), pi, trx);
return result;