hg merge release-2.1 (merge release2.1 into development)
This commit is contained in:
commit
3c1199f5bf
|
@ -1349,6 +1349,8 @@ public class MInOut extends X_M_InOut implements DocAction
|
||||||
{
|
{
|
||||||
BigDecimal toDelivered = oLine.getQtyOrdered()
|
BigDecimal toDelivered = oLine.getQtyOrdered()
|
||||||
.subtract(oLine.getQtyDelivered());
|
.subtract(oLine.getQtyDelivered());
|
||||||
|
if (toDelivered.signum() < 0) // IDEMPIERE-2889
|
||||||
|
toDelivered = Env.ZERO;
|
||||||
if (sLine.getMovementQty().compareTo(toDelivered) > 0)
|
if (sLine.getMovementQty().compareTo(toDelivered) > 0)
|
||||||
overReceipt = sLine.getMovementQty().subtract(
|
overReceipt = sLine.getMovementQty().subtract(
|
||||||
toDelivered);
|
toDelivered);
|
||||||
|
|
|
@ -2599,6 +2599,8 @@ public final class MRole extends X_AD_Role
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DB.close(rs, pstmt);
|
||||||
}
|
}
|
||||||
|
|
||||||
validOptions.toArray(options);
|
validOptions.toArray(options);
|
||||||
|
|
|
@ -186,9 +186,7 @@ public abstract class PO
|
||||||
*/
|
*/
|
||||||
public PO (Properties ctx, int ID, String trxName, ResultSet rs)
|
public PO (Properties ctx, int ID, String trxName, ResultSet rs)
|
||||||
{
|
{
|
||||||
if (ctx == null)
|
p_ctx = ctx != null ? ctx : Env.getCtx();
|
||||||
throw new IllegalArgumentException ("No Context");
|
|
||||||
p_ctx = ctx;
|
|
||||||
m_trxName = trxName;
|
m_trxName = trxName;
|
||||||
|
|
||||||
p_info = initPO(ctx);
|
p_info = initPO(ctx);
|
||||||
|
|
|
@ -563,8 +563,13 @@ public abstract class SvrProcess implements ProcessCall
|
||||||
*/
|
*/
|
||||||
private void unlock ()
|
private void unlock ()
|
||||||
{
|
{
|
||||||
|
boolean noContext = Env.getCtx().isEmpty() && Env.getCtx().getProperty("#AD_Client_ID") == null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
//save logging info even if context is lost
|
||||||
|
if (noContext)
|
||||||
|
Env.getCtx().put("#AD_Client_ID", m_pi.getAD_Client_ID());
|
||||||
|
|
||||||
MPInstance mpi = new MPInstance (getCtx(), m_pi.getAD_PInstance_ID(), null);
|
MPInstance mpi = new MPInstance (getCtx(), m_pi.getAD_PInstance_ID(), null);
|
||||||
if (mpi.get_ID() == 0)
|
if (mpi.get_ID() == 0)
|
||||||
{
|
{
|
||||||
|
@ -583,6 +588,11 @@ public abstract class SvrProcess implements ProcessCall
|
||||||
{
|
{
|
||||||
log.severe("unlock() - " + e.getLocalizedMessage());
|
log.severe("unlock() - " + e.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if (noContext)
|
||||||
|
Env.getCtx().remove("#AD_Client_ID");
|
||||||
|
}
|
||||||
} // unlock
|
} // unlock
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -916,19 +916,41 @@ public class MWFActivity extends X_AD_WF_Activity implements Runnable
|
||||||
processMsg = e.getMessage();
|
processMsg = e.getMessage();
|
||||||
setTextMsg(processMsg);
|
setTextMsg(processMsg);
|
||||||
// addTextMsg(e); // do not add the exception text
|
// addTextMsg(e); // do not add the exception text
|
||||||
setWFState (StateEngine.STATE_Terminated); // unlocks
|
boolean contextLost = false;
|
||||||
// Set Document Status
|
if (e instanceof AdempiereException && "Context lost".equals(e.getMessage()))
|
||||||
if (m_po != null && m_po instanceof DocAction && m_docStatus != null)
|
|
||||||
{
|
{
|
||||||
m_po.load(get_TrxName());
|
contextLost = true;
|
||||||
DocAction doc = (DocAction)m_po;
|
m_docStatus = DocAction.STATUS_Invalid;
|
||||||
doc.setDocStatus(m_docStatus);
|
|
||||||
m_po.saveEx();
|
|
||||||
}
|
}
|
||||||
if (m_process != null)
|
try {
|
||||||
{
|
if (contextLost)
|
||||||
m_process.setProcessMsg(this.getTextMsg());
|
{
|
||||||
m_process.saveEx();
|
Env.getCtx().setProperty("#AD_Client_ID", (m_po != null ? Integer.toString(m_po.getAD_Client_ID()) : "0") );
|
||||||
|
m_state = new StateEngine(WFSTATE_Running);
|
||||||
|
setProcessed(true);
|
||||||
|
setWFState (StateEngine.STATE_Aborted);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setWFState (StateEngine.STATE_Terminated); // unlocks
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set Document Status
|
||||||
|
if (m_po != null && m_po instanceof DocAction && m_docStatus != null)
|
||||||
|
{
|
||||||
|
m_po.load(get_TrxName());
|
||||||
|
DocAction doc = (DocAction)m_po;
|
||||||
|
doc.setDocStatus(m_docStatus);
|
||||||
|
m_po.saveEx();
|
||||||
|
}
|
||||||
|
if (m_process != null)
|
||||||
|
{
|
||||||
|
m_process.setProcessMsg(this.getTextMsg());
|
||||||
|
m_process.saveEx();
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
if (contextLost)
|
||||||
|
Env.getCtx().remove("#AD_Client_ID");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
|
|
@ -59,6 +59,9 @@ public class PipoDictionaryService implements IDictionaryService {
|
||||||
packIn = new PackIn();
|
packIn = new PackIn();
|
||||||
packIn.setPackageName(context.getBundle().getSymbolicName());
|
packIn.setPackageName(context.getBundle().getSymbolicName());
|
||||||
|
|
||||||
|
if (Env.getCtx().getProperty("#AD_Client_ID") == null) {
|
||||||
|
Env.getCtx().put("#AD_Client_ID", 0);
|
||||||
|
}
|
||||||
//get package version from file name suffix or bundle header
|
//get package version from file name suffix or bundle header
|
||||||
String packageVersion = null;
|
String packageVersion = null;
|
||||||
String fileName = packageFile.getName();
|
String fileName = packageFile.getName();
|
||||||
|
|
|
@ -904,13 +904,16 @@ public abstract class AbstractProcessDialog extends Window implements IProcessUI
|
||||||
|
|
||||||
if (Executions.getCurrent() == null)
|
if (Executions.getCurrent() == null)
|
||||||
{
|
{
|
||||||
Executions.schedule(getDesktop(), new EventListener<Event>()
|
if (getDesktop() != null)
|
||||||
{
|
{
|
||||||
@Override
|
Executions.schedule(getDesktop(), new EventListener<Event>()
|
||||||
public void onEvent(Event event) throws Exception {
|
{
|
||||||
doUnlockUI();
|
@Override
|
||||||
}
|
public void onEvent(Event event) throws Exception {
|
||||||
}, new Event("onUnLockUI"));
|
doUnlockUI();
|
||||||
|
}
|
||||||
|
}, new Event("onUnLockUI"));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
doUnlockUI();
|
doUnlockUI();
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,7 +111,7 @@ public abstract class CreateFrom implements ICreateFrom
|
||||||
{
|
{
|
||||||
sql = sql.append(" AND o.M_Warehouse_ID=? ");
|
sql = sql.append(" AND o.M_Warehouse_ID=? ");
|
||||||
}
|
}
|
||||||
sql = sql.append("ORDER BY o.DateOrdered");
|
sql = sql.append("ORDER BY o.DateOrdered,o.DocumentNo");
|
||||||
//
|
//
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
ResultSet rs = null;
|
ResultSet rs = null;
|
||||||
|
|
|
@ -192,7 +192,9 @@ public abstract class CreateFromShipment extends CreateFrom
|
||||||
|
|
||||||
Vector<Vector<Object>> data = new Vector<Vector<Object>>();
|
Vector<Vector<Object>> data = new Vector<Vector<Object>>();
|
||||||
StringBuilder sql = new StringBuilder("SELECT "
|
StringBuilder sql = new StringBuilder("SELECT "
|
||||||
+ "l.QtyOrdered-SUM(COALESCE(m.Qty,0))," // 1
|
+ "l.QtyOrdered-SUM(COALESCE(m.Qty,0))"
|
||||||
|
// subtract drafted lines from this or other orders IDEMPIERE-2889
|
||||||
|
+ "-COALESCE((SELECT SUM(MovementQty) FROM M_InOutLine iol JOIN M_InOut io ON iol.M_InOut_ID=io.M_InOut_ID WHERE l.C_OrderLine_ID=iol.C_OrderLine_ID AND io.Processed='N'),0)," // 1
|
||||||
+ "CASE WHEN l.QtyOrdered=0 THEN 0 ELSE l.QtyEntered/l.QtyOrdered END," // 2
|
+ "CASE WHEN l.QtyOrdered=0 THEN 0 ELSE l.QtyEntered/l.QtyOrdered END," // 2
|
||||||
+ " l.C_UOM_ID,COALESCE(uom.UOMSymbol,uom.Name)," // 3..4
|
+ " l.C_UOM_ID,COALESCE(uom.UOMSymbol,uom.Name)," // 3..4
|
||||||
+ " p.M_Locator_ID, loc.Value, " // 5..6
|
+ " p.M_Locator_ID, loc.Value, " // 5..6
|
||||||
|
|
Loading…
Reference in New Issue