IDEMPIERE-3431 Posting error for Matched PO if invoice posted while MR is not posted. / integrating fixes from Heng Sin AP2-825
This commit is contained in:
parent
949c2b02cf
commit
df55d4649c
|
@ -0,0 +1,11 @@
|
|||
SET SQLBLANKLINES ON
|
||||
SET DEFINE OFF
|
||||
|
||||
-- Dec 18, 2018 10:50:26 AM MYT
|
||||
-- AP2-825 Match PO | M_MatchPO unposted in Prod
|
||||
INSERT INTO AD_Ref_List (AD_Ref_List_ID,AD_Ref_List_UU,Name,IsActive,CreatedBy,UpdatedBy,AD_Client_ID,Created,Updated,EntityType,AD_Reference_ID,Value,AD_Org_ID) VALUES (200448,'0630b5d2-0fe4-4ef8-9d2f-a14791c02c7d','Deferred','Y',100,100,0,TO_DATE('2018-12-18 10:50:25','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2018-12-18 10:50:25','YYYY-MM-DD HH24:MI:SS'),'D',234,'d',0)
|
||||
;
|
||||
|
||||
SELECT register_migration_script('201812181500_Ticket_AP2-825.sql') FROM dual
|
||||
;
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
-- Dec 18, 2018 10:50:26 AM MYT
|
||||
-- AP2-825 Match PO | M_MatchPO unposted in Prod
|
||||
INSERT INTO AD_Ref_List (AD_Ref_List_ID,AD_Ref_List_UU,Name,IsActive,CreatedBy,UpdatedBy,AD_Client_ID,Created,Updated,EntityType,AD_Reference_ID,Value,AD_Org_ID) VALUES (200448,'0630b5d2-0fe4-4ef8-9d2f-a14791c02c7d','Deferred','Y',100,100,0,TO_TIMESTAMP('2018-12-18 10:50:25','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2018-12-18 10:50:25','YYYY-MM-DD HH24:MI:SS'),'D',234,'d',0)
|
||||
;
|
||||
|
||||
SELECT register_migration_script('201812181500_Ticket_AP2-825.sql') FROM dual
|
||||
;
|
||||
|
|
@ -148,7 +148,7 @@ public class ClientAcctProcessor extends SvrProcess
|
|||
|
||||
StringBuilder sql = new StringBuilder("SELECT DISTINCT ProcessedOn FROM ").append(TableName)
|
||||
.append(" WHERE AD_Client_ID=? AND ProcessedOn<?")
|
||||
.append(" AND Processed='Y' AND Posted='N' AND IsActive='Y'");
|
||||
.append(" AND Processed='Y' AND Posted IN ('N','d') AND IsActive='Y'");
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
|
@ -202,7 +202,7 @@ public class ClientAcctProcessor extends SvrProcess
|
|||
sql.append("=?");
|
||||
else
|
||||
sql.append(" IS NULL OR ProcessedOn=0");
|
||||
sql.append(") AND Processed='Y' AND Posted='N' AND IsActive='Y'")
|
||||
sql.append(") AND Processed='Y' AND Posted IN ('N','d') AND IsActive='Y'")
|
||||
.append(" ORDER BY Created");
|
||||
//
|
||||
PreparedStatement pstmt = null;
|
||||
|
|
|
@ -199,6 +199,8 @@ public abstract class Doc
|
|||
public static final String STATUS_Posted = "Y";
|
||||
/** Document Status */
|
||||
public static final String STATUS_Error = "E";
|
||||
/** Document Status */
|
||||
public static final String STATUS_Deferred = "d";
|
||||
|
||||
|
||||
/**
|
||||
|
@ -539,7 +541,7 @@ public abstract class Doc
|
|||
if (!force)
|
||||
sql.append(" AND (Processing='N' OR Processing IS NULL)");
|
||||
if (!repost)
|
||||
sql.append(" AND Posted='N'");
|
||||
sql.append(" AND Posted IN ('N','d')");
|
||||
if (DB.executeUpdate(sql.toString(), trxName) == 1) {
|
||||
if (log.isLoggable(Level.INFO)) log.info("Locked: " + get_TableName() + "_ID=" + get_ID());
|
||||
} else {
|
||||
|
@ -558,7 +560,7 @@ public abstract class Doc
|
|||
if (isDeferPosting())
|
||||
{
|
||||
unlock();
|
||||
p_Status = STATUS_NotPosted;
|
||||
p_Status = STATUS_Deferred;
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -648,7 +650,7 @@ public abstract class Doc
|
|||
}
|
||||
|
||||
// Create Note
|
||||
if (!p_Status.equals(STATUS_Posted))
|
||||
if (!p_Status.equals(STATUS_Posted) && !p_Status.equals(STATUS_Deferred))
|
||||
{
|
||||
// Insert Note
|
||||
String AD_MessageValue = "PostingError-" + p_Status;
|
||||
|
|
|
@ -41,6 +41,7 @@ import org.compiere.model.MProduct;
|
|||
import org.compiere.model.MTax;
|
||||
import org.compiere.model.ProductCost;
|
||||
import org.compiere.model.X_M_InOut;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.Util;
|
||||
|
||||
|
@ -122,6 +123,24 @@ public class Doc_MatchPO extends Doc
|
|||
{
|
||||
m_deferPosting = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
String posted = DB.getSQLValueStringEx(getTrxName(), "SELECT Posted FROM M_MatchPO WHERE M_MatchPO_ID=?", m_matchPO.getM_MatchPO_ID());
|
||||
if (STATUS_Deferred.equals(posted))
|
||||
{
|
||||
int M_InOut_ID = DB.getSQLValueEx(getTrxName(), "SELECT M_InOut_ID FROM M_InOutLine WHERE M_InOutLine_ID=?", m_M_InOutLine_ID);
|
||||
MInOut inout = new MInOut(getCtx(), M_InOut_ID, getTrxName());
|
||||
if (inout.getDateAcct().after(m_matchPO.getDateAcct()))
|
||||
{
|
||||
m_matchPO.setDateAcct(inout.getDateAcct());
|
||||
m_matchPO.setDateTrx(inout.getDateAcct());
|
||||
setDateAcct(inout.getDateAcct());
|
||||
setDateDoc(inout.getDateAcct());
|
||||
m_matchPO.saveEx();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
} // loadDocumentDetails
|
||||
|
||||
|
|
|
@ -1867,7 +1867,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
|
|||
return DocAction.STATUS_Invalid;
|
||||
}
|
||||
matchPO++;
|
||||
if (!po.isPosted() && po.getM_InOutLine_ID() > 0) // match po don't post if receipt is not assigned, and it doesn't create avg po record
|
||||
if (!po.isPosted())
|
||||
addDocsPostProcess(po);
|
||||
|
||||
MMatchInv[] matchInvoices = MMatchInv.getInvoiceLine(getCtx(), line.getC_InvoiceLine_ID(), get_TrxName());
|
||||
|
|
|
@ -157,7 +157,7 @@ public class AcctProcessor extends AdempiereServer
|
|||
|
||||
StringBuffer sql = new StringBuffer ("SELECT DISTINCT ProcessedOn FROM ").append(TableName)
|
||||
.append(" WHERE AD_Client_ID=? AND ProcessedOn<?")
|
||||
.append(" AND Processed='Y' AND Posted='N' AND IsActive='Y'");
|
||||
.append(" AND Processed='Y' AND Posted IN ('N','d') AND IsActive='Y'");
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
|
@ -211,7 +211,7 @@ public class AcctProcessor extends AdempiereServer
|
|||
sql.append("=?");
|
||||
else
|
||||
sql.append(" IS NULL OR ProcessedOn=0");
|
||||
sql.append(") AND Processed='Y' AND Posted='N' AND IsActive='Y'")
|
||||
sql.append(") AND Processed='Y' AND Posted IN ('N','d') AND IsActive='Y'")
|
||||
.append(" ORDER BY Created");
|
||||
//
|
||||
PreparedStatement pstmt = null;
|
||||
|
|
Loading…
Reference in New Issue