IDEMPIERE-3669 Drop shipment - Accounting processor posts customer shipment before MR resulting in posting error
This commit is contained in:
parent
7753c90af0
commit
47bf2d8a46
|
@ -22,20 +22,21 @@ import java.sql.ResultSet;
|
|||
import java.util.ArrayList;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.compiere.model.I_C_OrderLine;
|
||||
import org.compiere.model.I_M_InOutLine;
|
||||
import org.compiere.model.I_M_RMALine;
|
||||
import org.compiere.model.MConversionRate;
|
||||
import org.compiere.model.MOrderLandedCostAllocation;
|
||||
import org.compiere.model.MTax;
|
||||
import org.compiere.model.MCurrency;
|
||||
import org.compiere.model.MAccount;
|
||||
import org.compiere.model.MAcctSchema;
|
||||
import org.compiere.model.MConversionRate;
|
||||
import org.compiere.model.MCostDetail;
|
||||
import org.compiere.model.MCurrency;
|
||||
import org.compiere.model.MInOut;
|
||||
import org.compiere.model.MInOutLine;
|
||||
import org.compiere.model.MInOutLineMA;
|
||||
import org.compiere.model.MOrderLandedCostAllocation;
|
||||
import org.compiere.model.MOrderLine;
|
||||
import org.compiere.model.MProduct;
|
||||
import org.compiere.model.MTax;
|
||||
import org.compiere.model.ProductCost;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.Env;
|
||||
|
@ -69,6 +70,7 @@ public class Doc_InOut extends Doc
|
|||
private int m_Reversal_ID = 0;
|
||||
@SuppressWarnings("unused")
|
||||
private String m_DocStatus = "";
|
||||
private boolean m_deferPosting = false;
|
||||
|
||||
/**
|
||||
* Load Document Details
|
||||
|
@ -84,6 +86,25 @@ public class Doc_InOut extends Doc
|
|||
// Contained Objects
|
||||
p_lines = loadLines(inout);
|
||||
if (log.isLoggable(Level.FINE)) log.fine("Lines=" + p_lines.length);
|
||||
|
||||
if (inout.isSOTrx()) {
|
||||
MInOutLine[] lines = inout.getLines();
|
||||
for (MInOutLine line : lines) {
|
||||
I_C_OrderLine orderLine = line.getC_OrderLine();
|
||||
if (orderLine != null) {
|
||||
if (orderLine.getLink_OrderLine_ID() > 0) {
|
||||
// Defer posting if found the linked MR is not posted
|
||||
String sql = "SELECT COUNT(*) FROM M_InOutLine iol WHERE iol.C_OrderLine_ID=? AND EXISTS (SELECT * FROM M_InOut io WHERE io.M_InOut_ID=iol.M_InOut_ID AND io.IsSOTrx='N' AND io.Posted<>'Y')";
|
||||
int count = DB.getSQLValueEx(getTrxName(), sql, orderLine.getLink_OrderLine_ID());
|
||||
if (count > 0) {
|
||||
m_deferPosting = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
} // loadDocumentDetails
|
||||
|
||||
|
@ -959,4 +980,9 @@ public class Doc_InOut extends Doc
|
|||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDeferPosting() {
|
||||
return m_deferPosting;
|
||||
}
|
||||
} // Doc_InOut
|
||||
|
|
Loading…
Reference in New Issue