hg merge release-6.2 (merge release6.2 into default)
This commit is contained in:
commit
392abbc764
|
@ -0,0 +1,46 @@
|
||||||
|
SET SQLBLANKLINES ON
|
||||||
|
SET DEFINE OFF
|
||||||
|
|
||||||
|
-- IDEMPIERE-4006 Wrong matched PO quanity for vendor credit memo
|
||||||
|
-- Sep 23, 2019, 4:25:35 PM SGT
|
||||||
|
UPDATE AD_Column SET IsMandatory='N',Updated=TO_DATE('2019-09-23 16:25:35','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=6505
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Sep 23, 2019, 4:25:44 PM SGT
|
||||||
|
ALTER TABLE M_MatchInv MODIFY M_InOutLine_ID NUMBER(10) DEFAULT NULL
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Sep 23, 2019, 4:25:44 PM SGT
|
||||||
|
ALTER TABLE M_MatchInv MODIFY M_InOutLine_ID NULL
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Sep 23, 2019, 4:26:11 PM SGT
|
||||||
|
INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,PrintName,EntityType,AD_Element_UU) VALUES (203364,0,0,'Y',TO_DATE('2019-09-23 16:26:10','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-09-23 16:26:10','YYYY-MM-DD HH24:MI:SS'),100,'Ref_MatchInv_ID','Referenced Match Invoice','Referenced Match Invoice','D','95682836-1311-42ee-b981-554da51f518d')
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Sep 23, 2019, 4:27:21 PM SGT
|
||||||
|
INSERT INTO AD_Column (AD_Column_ID,Version,Name,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Reference_Value_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure,FKConstraintType,IsHtml) VALUES (214052,0,'Referenced Match Invoice',472,'Ref_MatchInv_ID',10,'N','N','N','N','N',0,'N',30,200018,0,0,'Y',TO_DATE('2019-09-23 16:27:20','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-09-23 16:27:20','YYYY-MM-DD HH24:MI:SS'),100,203364,'Y','N','D','N','N','N','Y','54d57989-da02-4888-baba-0209ce4e61e9','Y',0,'N','N','N','N')
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Sep 23, 2019, 4:27:26 PM SGT
|
||||||
|
UPDATE AD_Column SET FKConstraintName='RefMatchInv_MMatchInv', FKConstraintType='N',Updated=TO_DATE('2019-09-23 16:27:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=214052
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Sep 23, 2019, 4:27:26 PM SGT
|
||||||
|
ALTER TABLE M_MatchInv ADD Ref_MatchInv_ID NUMBER(10) DEFAULT NULL
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Sep 23, 2019, 4:27:27 PM SGT
|
||||||
|
ALTER TABLE M_MatchInv ADD CONSTRAINT RefMatchInv_MMatchInv FOREIGN KEY (Ref_MatchInv_ID) REFERENCES m_matchinv(m_matchinv_id) DEFERRABLE INITIALLY DEFERRED
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Sep 23, 2019, 4:28:40 PM SGT
|
||||||
|
INSERT INTO AD_Field (AD_Field_ID,Name,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,ColumnSpan) VALUES (206179,'Referenced Match Invoice',408,214052,'Y',10,150,'N','N','N','N',0,0,'Y',TO_DATE('2019-09-23 16:28:39','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-09-23 16:28:39','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','ad6ec9e2-b188-4f85-aa0b-6fb90e0dc51d','Y',150,2)
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Sep 23, 2019, 4:29:39 PM SGT
|
||||||
|
UPDATE AD_Field SET SeqNo=65, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, SeqNoGrid=65, XPosition=4, IsToolbarButton=NULL,Updated=TO_DATE('2019-09-23 16:29:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=206179
|
||||||
|
;
|
||||||
|
|
||||||
|
SELECT register_migration_script('201909241620_IDEMPIERE-4006.sql') FROM dual
|
||||||
|
;
|
|
@ -0,0 +1,43 @@
|
||||||
|
-- IDEMPIERE-4006 Wrong matched PO quanity for vendor credit memo
|
||||||
|
-- Sep 23, 2019, 4:25:35 PM SGT
|
||||||
|
UPDATE AD_Column SET IsMandatory='N',Updated=TO_TIMESTAMP('2019-09-23 16:25:35','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=6505
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Sep 23, 2019, 4:25:44 PM SGT
|
||||||
|
INSERT INTO t_alter_column values('m_matchinv','M_InOutLine_ID','NUMERIC(10)',null,'NULL')
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Sep 23, 2019, 4:25:44 PM SGT
|
||||||
|
INSERT INTO t_alter_column values('m_matchinv','M_InOutLine_ID',null,'NULL',null)
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Sep 23, 2019, 4:26:11 PM SGT
|
||||||
|
INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,PrintName,EntityType,AD_Element_UU) VALUES (203364,0,0,'Y',TO_TIMESTAMP('2019-09-23 16:26:10','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-09-23 16:26:10','YYYY-MM-DD HH24:MI:SS'),100,'Ref_MatchInv_ID','Referenced Match Invoice','Referenced Match Invoice','D','95682836-1311-42ee-b981-554da51f518d')
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Sep 23, 2019, 4:27:21 PM SGT
|
||||||
|
INSERT INTO AD_Column (AD_Column_ID,Version,Name,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Reference_Value_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure,FKConstraintType,IsHtml) VALUES (214052,0,'Referenced Match Invoice',472,'Ref_MatchInv_ID',10,'N','N','N','N','N',0,'N',30,200018,0,0,'Y',TO_TIMESTAMP('2019-09-23 16:27:20','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-09-23 16:27:20','YYYY-MM-DD HH24:MI:SS'),100,203364,'Y','N','D','N','N','N','Y','54d57989-da02-4888-baba-0209ce4e61e9','Y',0,'N','N','N','N')
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Sep 23, 2019, 4:27:26 PM SGT
|
||||||
|
UPDATE AD_Column SET FKConstraintName='RefMatchInv_MMatchInv', FKConstraintType='N',Updated=TO_TIMESTAMP('2019-09-23 16:27:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=214052
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Sep 23, 2019, 4:27:26 PM SGT
|
||||||
|
ALTER TABLE M_MatchInv ADD COLUMN Ref_MatchInv_ID NUMERIC(10) DEFAULT NULL
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Sep 23, 2019, 4:27:27 PM SGT
|
||||||
|
ALTER TABLE M_MatchInv ADD CONSTRAINT RefMatchInv_MMatchInv FOREIGN KEY (Ref_MatchInv_ID) REFERENCES m_matchinv(m_matchinv_id) DEFERRABLE INITIALLY DEFERRED
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Sep 23, 2019, 4:28:40 PM SGT
|
||||||
|
INSERT INTO AD_Field (AD_Field_ID,Name,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,ColumnSpan) VALUES (206179,'Referenced Match Invoice',408,214052,'Y',10,150,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2019-09-23 16:28:39','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-09-23 16:28:39','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','ad6ec9e2-b188-4f85-aa0b-6fb90e0dc51d','Y',150,2)
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Sep 23, 2019, 4:29:39 PM SGT
|
||||||
|
UPDATE AD_Field SET SeqNo=65, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, SeqNoGrid=65, XPosition=4, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-09-23 16:29:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=206179
|
||||||
|
;
|
||||||
|
|
||||||
|
SELECT register_migration_script('201909241620_IDEMPIERE-4006.sql') FROM dual
|
||||||
|
;
|
|
@ -286,6 +286,17 @@ public interface I_M_MatchInv
|
||||||
*/
|
*/
|
||||||
public BigDecimal getQty();
|
public BigDecimal getQty();
|
||||||
|
|
||||||
|
/** Column name Ref_MatchInv_ID */
|
||||||
|
public static final String COLUMNNAME_Ref_MatchInv_ID = "Ref_MatchInv_ID";
|
||||||
|
|
||||||
|
/** Set Referenced Match Invoice */
|
||||||
|
public void setRef_MatchInv_ID (int Ref_MatchInv_ID);
|
||||||
|
|
||||||
|
/** Get Referenced Match Invoice */
|
||||||
|
public int getRef_MatchInv_ID();
|
||||||
|
|
||||||
|
public org.compiere.model.I_M_MatchInv getRef_MatchInv() throws RuntimeException;
|
||||||
|
|
||||||
/** Column name Reversal_ID */
|
/** Column name Reversal_ID */
|
||||||
public static final String COLUMNNAME_Reversal_ID = "Reversal_ID";
|
public static final String COLUMNNAME_Reversal_ID = "Reversal_ID";
|
||||||
|
|
||||||
|
|
|
@ -1894,6 +1894,13 @@ public class MInvoice extends X_C_Invoice implements DocAction
|
||||||
{
|
{
|
||||||
addDocsPostProcess(matchInvoice);
|
addDocsPostProcess(matchInvoice);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (matchInvoice.getRef_MatchInv_ID() > 0)
|
||||||
|
{
|
||||||
|
MMatchInv refMatchInv = new MMatchInv(getCtx(), matchInvoice.getRef_MatchInv_ID(), get_TrxName());
|
||||||
|
if (!refMatchInv.isPosted())
|
||||||
|
addDocsPostProcess(refMatchInv);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2414,6 +2421,8 @@ public class MInvoice extends X_C_Invoice implements DocAction
|
||||||
// Reverse/Delete Matching
|
// Reverse/Delete Matching
|
||||||
if (!isSOTrx())
|
if (!isSOTrx())
|
||||||
{
|
{
|
||||||
|
MatchPOAutoMatch.unmatch(getCtx(), getC_Invoice_ID(), get_TrxName());
|
||||||
|
|
||||||
MMatchInv[] mInv = MMatchInv.getInvoice(getCtx(), getC_Invoice_ID(), get_TrxName());
|
MMatchInv[] mInv = MMatchInv.getInvoice(getCtx(), getC_Invoice_ID(), get_TrxName());
|
||||||
for (int i = 0; i < mInv.length; i++)
|
for (int i = 0; i < mInv.length; i++)
|
||||||
{
|
{
|
||||||
|
@ -2428,8 +2437,6 @@ public class MInvoice extends X_C_Invoice implements DocAction
|
||||||
addDocsPostProcess(new MMatchInv(Env.getCtx(), mInv[i].getReversal_ID(), get_TrxName()));
|
addDocsPostProcess(new MMatchInv(Env.getCtx(), mInv[i].getReversal_ID(), get_TrxName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
MatchPOAutoMatch.unmatch(getCtx(), getC_Invoice_ID(), get_TrxName());
|
|
||||||
|
|
||||||
MMatchPO[] mPO = MMatchPO.getInvoice(getCtx(), getC_Invoice_ID(), get_TrxName());
|
MMatchPO[] mPO = MMatchPO.getInvoice(getCtx(), getC_Invoice_ID(), get_TrxName());
|
||||||
for (int i = 0; i < mPO.length; i++)
|
for (int i = 0; i < mPO.length; i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -655,7 +655,7 @@ public class MMatchPO extends X_M_MatchPO
|
||||||
return retValue;
|
return retValue;
|
||||||
} // create
|
} // create
|
||||||
|
|
||||||
private static MMatchInv createMatchInv(MMatchPO mpo, int C_InvoiceLine_ID, int M_InOutLine_ID, BigDecimal qty, Timestamp dateTrx, String trxName)
|
protected static MMatchInv createMatchInv(MMatchPO mpo, int C_InvoiceLine_ID, int M_InOutLine_ID, BigDecimal qty, Timestamp dateTrx, String trxName)
|
||||||
{
|
{
|
||||||
Savepoint savepoint = null;
|
Savepoint savepoint = null;
|
||||||
Trx trx = null;
|
Trx trx = null;
|
||||||
|
|
|
@ -213,6 +213,19 @@ public class MatchPOAutoMatch {
|
||||||
matchPOCreditMemo.setPosted(true);
|
matchPOCreditMemo.setPosted(true);
|
||||||
matchPOCreditMemo.saveEx(trxName);
|
matchPOCreditMemo.saveEx(trxName);
|
||||||
|
|
||||||
|
MMatchInv matchInv1 = MMatchPO.createMatchInv(po, po.getC_InvoiceLine_ID(), po.getM_InOutLine_ID(), po.getQty(), po.getDateTrx(), trxName);
|
||||||
|
MMatchInv matchInv2 = MMatchPO.createMatchInv(matchPOCreditMemo, matchPOCreditMemo.getC_InvoiceLine_ID(), matchPOCreditMemo.getM_InOutLine_ID(), matchPOCreditMemo.getQty(), matchPOCreditMemo.getDateTrx(), trxName);
|
||||||
|
if (matchInv1 != null && matchInv2 != null)
|
||||||
|
{
|
||||||
|
matchInv1.setRef_MatchInv_ID(matchInv2.getM_MatchInv_ID());
|
||||||
|
matchInv1.saveEx(trxName);
|
||||||
|
|
||||||
|
matchInv2.setRef_MatchInv_ID(matchInv1.getM_MatchInv_ID());
|
||||||
|
matchInv2.saveEx(trxName);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
|
||||||
matchedMatchPOList.add(po);
|
matchedMatchPOList.add(po);
|
||||||
creditMemoQty = creditMemoQty.subtract(po.getQty());
|
creditMemoQty = creditMemoQty.subtract(po.getQty());
|
||||||
}
|
}
|
||||||
|
@ -226,6 +239,19 @@ public class MatchPOAutoMatch {
|
||||||
matchPOCreditMemo.setPosted(true);
|
matchPOCreditMemo.setPosted(true);
|
||||||
matchPOCreditMemo.saveEx(trxName);
|
matchPOCreditMemo.saveEx(trxName);
|
||||||
|
|
||||||
|
MMatchInv matchInv1 = MMatchPO.createMatchInv(matchPO, matchPO.getC_InvoiceLine_ID(), matchPO.getM_InOutLine_ID(), matchPO.getQty(), matchPO.getDateTrx(), trxName);
|
||||||
|
MMatchInv matchInv2 = MMatchPO.createMatchInv(matchPOCreditMemo, matchPOCreditMemo.getC_InvoiceLine_ID(), matchPOCreditMemo.getM_InOutLine_ID(), matchPOCreditMemo.getQty(), matchPOCreditMemo.getDateTrx(), trxName);
|
||||||
|
if (matchInv1 != null && matchInv2 != null)
|
||||||
|
{
|
||||||
|
matchInv1.setRef_MatchInv_ID(matchInv2.getM_MatchInv_ID());
|
||||||
|
matchInv1.saveEx(trxName);
|
||||||
|
|
||||||
|
matchInv2.setRef_MatchInv_ID(matchInv1.getM_MatchInv_ID());
|
||||||
|
matchInv2.saveEx(trxName);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
|
||||||
matchedMatchPOList.add(matchPO);
|
matchedMatchPOList.add(matchPO);
|
||||||
creditMemoQty = creditMemoQty.subtract(matchPO.getQty());
|
creditMemoQty = creditMemoQty.subtract(matchPO.getQty());
|
||||||
}
|
}
|
||||||
|
@ -245,6 +271,19 @@ public class MatchPOAutoMatch {
|
||||||
matchPO.setPosted(true);
|
matchPO.setPosted(true);
|
||||||
matchPO.saveEx(trxName);
|
matchPO.saveEx(trxName);
|
||||||
|
|
||||||
|
MMatchInv matchInv1 = MMatchPO.createMatchInv(po, po.getC_InvoiceLine_ID(), po.getM_InOutLine_ID(), po.getQty(), po.getDateTrx(), trxName);
|
||||||
|
MMatchInv matchInv2 = MMatchPO.createMatchInv(matchPO, matchPO.getC_InvoiceLine_ID(), matchPO.getM_InOutLine_ID(), matchPO.getQty(), matchPO.getDateTrx(), trxName);
|
||||||
|
if (matchInv1 != null && matchInv2 != null)
|
||||||
|
{
|
||||||
|
matchInv1.setRef_MatchInv_ID(matchInv2.getM_MatchInv_ID());
|
||||||
|
matchInv1.saveEx(trxName);
|
||||||
|
|
||||||
|
matchInv2.setRef_MatchInv_ID(matchInv1.getM_MatchInv_ID());
|
||||||
|
matchInv2.saveEx(trxName);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
|
||||||
matchedMatchPOList.add(matchPO);
|
matchedMatchPOList.add(matchPO);
|
||||||
creditMemoQty = creditMemoQty.subtract(matchPO.getQty());
|
creditMemoQty = creditMemoQty.subtract(matchPO.getQty());
|
||||||
}
|
}
|
||||||
|
@ -281,6 +320,19 @@ public class MatchPOAutoMatch {
|
||||||
matchPOCreditMemo.setPosted(true);
|
matchPOCreditMemo.setPosted(true);
|
||||||
matchPOCreditMemo.saveEx(trxName);
|
matchPOCreditMemo.saveEx(trxName);
|
||||||
|
|
||||||
|
MMatchInv matchInv1 = MMatchPO.createMatchInv(po, po.getC_InvoiceLine_ID(), po.getM_InOutLine_ID(), po.getQty(), po.getDateTrx(), trxName);
|
||||||
|
MMatchInv matchInv2 = MMatchPO.createMatchInv(matchPOCreditMemo, matchPOCreditMemo.getC_InvoiceLine_ID(), matchPOCreditMemo.getM_InOutLine_ID(), matchPOCreditMemo.getQty(), matchPOCreditMemo.getDateTrx(), trxName);
|
||||||
|
if (matchInv1 != null && matchInv2 != null)
|
||||||
|
{
|
||||||
|
matchInv1.setRef_MatchInv_ID(matchInv2.getM_MatchInv_ID());
|
||||||
|
matchInv1.saveEx(trxName);
|
||||||
|
|
||||||
|
matchInv2.setRef_MatchInv_ID(matchInv1.getM_MatchInv_ID());
|
||||||
|
matchInv2.saveEx(trxName);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
|
||||||
matchedMatchPOList.add(po);
|
matchedMatchPOList.add(po);
|
||||||
creditMemoQty = creditMemoQty.subtract(po.getQty());
|
creditMemoQty = creditMemoQty.subtract(po.getQty());
|
||||||
}
|
}
|
||||||
|
@ -294,6 +346,19 @@ public class MatchPOAutoMatch {
|
||||||
matchPOCreditMemo.setPosted(true);
|
matchPOCreditMemo.setPosted(true);
|
||||||
matchPOCreditMemo.saveEx(trxName);
|
matchPOCreditMemo.saveEx(trxName);
|
||||||
|
|
||||||
|
MMatchInv matchInv1 = MMatchPO.createMatchInv(matchPO, matchPO.getC_InvoiceLine_ID(), matchPO.getM_InOutLine_ID(), matchPO.getQty(), matchPO.getDateTrx(), trxName);
|
||||||
|
MMatchInv matchInv2 = MMatchPO.createMatchInv(matchPOCreditMemo, matchPOCreditMemo.getC_InvoiceLine_ID(), matchPOCreditMemo.getM_InOutLine_ID(), matchPOCreditMemo.getQty(), matchPOCreditMemo.getDateTrx(), trxName);
|
||||||
|
if (matchInv1 != null && matchInv2 != null)
|
||||||
|
{
|
||||||
|
matchInv1.setRef_MatchInv_ID(matchInv2.getM_MatchInv_ID());
|
||||||
|
matchInv1.saveEx(trxName);
|
||||||
|
|
||||||
|
matchInv2.setRef_MatchInv_ID(matchInv1.getM_MatchInv_ID());
|
||||||
|
matchInv2.saveEx(trxName);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
|
||||||
matchedMatchPOList.add(matchPO);
|
matchedMatchPOList.add(matchPO);
|
||||||
creditMemoQty = creditMemoQty.subtract(matchPO.getQty());
|
creditMemoQty = creditMemoQty.subtract(matchPO.getQty());
|
||||||
}
|
}
|
||||||
|
@ -313,6 +378,19 @@ public class MatchPOAutoMatch {
|
||||||
matchPO.setPosted(true);
|
matchPO.setPosted(true);
|
||||||
matchPO.saveEx(trxName);
|
matchPO.saveEx(trxName);
|
||||||
|
|
||||||
|
MMatchInv matchInv1 = MMatchPO.createMatchInv(po, po.getC_InvoiceLine_ID(), po.getM_InOutLine_ID(), po.getQty(), po.getDateTrx(), trxName);
|
||||||
|
MMatchInv matchInv2 = MMatchPO.createMatchInv(matchPO, matchPO.getC_InvoiceLine_ID(), matchPO.getM_InOutLine_ID(), matchPO.getQty(), matchPO.getDateTrx(), trxName);
|
||||||
|
if (matchInv1 != null && matchInv2 != null)
|
||||||
|
{
|
||||||
|
matchInv1.setRef_MatchInv_ID(matchInv2.getM_MatchInv_ID());
|
||||||
|
matchInv1.saveEx(trxName);
|
||||||
|
|
||||||
|
matchInv2.setRef_MatchInv_ID(matchInv1.getM_MatchInv_ID());
|
||||||
|
matchInv2.saveEx(trxName);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
|
||||||
matchedMatchPOList.add(matchPO);
|
matchedMatchPOList.add(matchPO);
|
||||||
creditMemoQty = creditMemoQty.subtract(matchPO.getQty());
|
creditMemoQty = creditMemoQty.subtract(matchPO.getQty());
|
||||||
}
|
}
|
||||||
|
@ -348,6 +426,18 @@ public class MatchPOAutoMatch {
|
||||||
*/
|
*/
|
||||||
public static void unmatch(Properties ctx, int C_Invoice_ID, String trxName)
|
public static void unmatch(Properties ctx, int C_Invoice_ID, String trxName)
|
||||||
{
|
{
|
||||||
|
MMatchInv[] minvs = MMatchInv.getInvoice(ctx, C_Invoice_ID, trxName);
|
||||||
|
for(MMatchInv minv : minvs)
|
||||||
|
{
|
||||||
|
if (minv.getReversal_ID() > 0 || minv.getRef_MatchInv_ID() == 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
MMatchInv refMatchInv = new MMatchInv(ctx, minv.getRef_MatchInv_ID(), trxName);
|
||||||
|
refMatchInv.deleteEx(true);
|
||||||
|
|
||||||
|
minv.deleteEx(true);
|
||||||
|
}
|
||||||
|
|
||||||
List<Integer> unmatchedOrderLineID = new ArrayList<Integer>();
|
List<Integer> unmatchedOrderLineID = new ArrayList<Integer>();
|
||||||
MMatchPO[] mpos = MMatchPO.getInvoice(ctx, C_Invoice_ID, trxName);
|
MMatchPO[] mpos = MMatchPO.getInvoice(ctx, C_Invoice_ID, trxName);
|
||||||
for (MMatchPO mpo : mpos)
|
for (MMatchPO mpo : mpos)
|
||||||
|
|
|
@ -33,7 +33,7 @@ public class X_M_MatchInv extends PO implements I_M_MatchInv, I_Persistent
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 20190106L;
|
private static final long serialVersionUID = 20190923L;
|
||||||
|
|
||||||
/** Standard Constructor */
|
/** Standard Constructor */
|
||||||
public X_M_MatchInv (Properties ctx, int M_MatchInv_ID, String trxName)
|
public X_M_MatchInv (Properties ctx, int M_MatchInv_ID, String trxName)
|
||||||
|
@ -44,7 +44,6 @@ public class X_M_MatchInv extends PO implements I_M_MatchInv, I_Persistent
|
||||||
setC_InvoiceLine_ID (0);
|
setC_InvoiceLine_ID (0);
|
||||||
setDateAcct (new Timestamp( System.currentTimeMillis() ));
|
setDateAcct (new Timestamp( System.currentTimeMillis() ));
|
||||||
setDateTrx (new Timestamp( System.currentTimeMillis() ));
|
setDateTrx (new Timestamp( System.currentTimeMillis() ));
|
||||||
setM_InOutLine_ID (0);
|
|
||||||
setM_MatchInv_ID (0);
|
setM_MatchInv_ID (0);
|
||||||
setM_Product_ID (0);
|
setM_Product_ID (0);
|
||||||
setPosted (false);
|
setPosted (false);
|
||||||
|
@ -416,6 +415,31 @@ public class X_M_MatchInv extends PO implements I_M_MatchInv, I_Persistent
|
||||||
return bd;
|
return bd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public org.compiere.model.I_M_MatchInv getRef_MatchInv() throws RuntimeException
|
||||||
|
{
|
||||||
|
return (org.compiere.model.I_M_MatchInv)MTable.get(getCtx(), org.compiere.model.I_M_MatchInv.Table_Name)
|
||||||
|
.getPO(getRef_MatchInv_ID(), get_TrxName()); }
|
||||||
|
|
||||||
|
/** Set Referenced Match Invoice.
|
||||||
|
@param Ref_MatchInv_ID Referenced Match Invoice */
|
||||||
|
public void setRef_MatchInv_ID (int Ref_MatchInv_ID)
|
||||||
|
{
|
||||||
|
if (Ref_MatchInv_ID < 1)
|
||||||
|
set_Value (COLUMNNAME_Ref_MatchInv_ID, null);
|
||||||
|
else
|
||||||
|
set_Value (COLUMNNAME_Ref_MatchInv_ID, Integer.valueOf(Ref_MatchInv_ID));
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Get Referenced Match Invoice.
|
||||||
|
@return Referenced Match Invoice */
|
||||||
|
public int getRef_MatchInv_ID ()
|
||||||
|
{
|
||||||
|
Integer ii = (Integer)get_Value(COLUMNNAME_Ref_MatchInv_ID);
|
||||||
|
if (ii == null)
|
||||||
|
return 0;
|
||||||
|
return ii.intValue();
|
||||||
|
}
|
||||||
|
|
||||||
public org.compiere.model.I_M_MatchInv getReversal() throws RuntimeException
|
public org.compiere.model.I_M_MatchInv getReversal() throws RuntimeException
|
||||||
{
|
{
|
||||||
return (org.compiere.model.I_M_MatchInv)MTable.get(getCtx(), org.compiere.model.I_M_MatchInv.Table_Name)
|
return (org.compiere.model.I_M_MatchInv)MTable.get(getCtx(), org.compiere.model.I_M_MatchInv.Table_Name)
|
||||||
|
|
|
@ -300,7 +300,7 @@ public class Match
|
||||||
m_qtyColumn = "lin.QtyInvoiced";
|
m_qtyColumn = "lin.QtyInvoiced";
|
||||||
m_sql.append("SELECT hdr.C_Invoice_ID,hdr.DocumentNo, hdr.DateInvoiced, bp.Name,hdr.C_BPartner_ID,"
|
m_sql.append("SELECT hdr.C_Invoice_ID,hdr.DocumentNo, hdr.DateInvoiced, bp.Name,hdr.C_BPartner_ID,"
|
||||||
+ " lin.Line,lin.C_InvoiceLine_ID, p.Name,lin.M_Product_ID,"
|
+ " lin.Line,lin.C_InvoiceLine_ID, p.Name,lin.M_Product_ID,"
|
||||||
+ " lin.QtyInvoiced,SUM(NVL(mi.Qty,0)), org.Name, hdr.AD_Org_ID " //JAVIER
|
+ " CASE WHEN dt.DocBaseType='APC' THEN lin.QtyInvoiced * -1 ELSE lin.QtyInvoiced END,SUM(NVL(mi.Qty,0)), org.Name, hdr.AD_Org_ID " //JAVIER
|
||||||
+ "FROM C_Invoice hdr"
|
+ "FROM C_Invoice hdr"
|
||||||
+ " INNER JOIN AD_Org org ON (hdr.AD_Org_ID=org.AD_Org_ID)" //JAVIER
|
+ " INNER JOIN AD_Org org ON (hdr.AD_Org_ID=org.AD_Org_ID)" //JAVIER
|
||||||
+ " INNER JOIN C_BPartner bp ON (hdr.C_BPartner_ID=bp.C_BPartner_ID)"
|
+ " INNER JOIN C_BPartner bp ON (hdr.C_BPartner_ID=bp.C_BPartner_ID)"
|
||||||
|
@ -313,9 +313,9 @@ public class Match
|
||||||
m_sql.append(" AND mi.M_InOutLine_ID = ").append(Line_ID);
|
m_sql.append(" AND mi.M_InOutLine_ID = ").append(Line_ID);
|
||||||
|
|
||||||
m_groupBy = " GROUP BY hdr.C_Invoice_ID,hdr.DocumentNo,hdr.DateInvoiced,bp.Name,hdr.C_BPartner_ID,"
|
m_groupBy = " GROUP BY hdr.C_Invoice_ID,hdr.DocumentNo,hdr.DateInvoiced,bp.Name,hdr.C_BPartner_ID,"
|
||||||
+ " lin.Line,lin.C_InvoiceLine_ID,p.Name,lin.M_Product_ID,lin.QtyInvoiced, org.Name, hdr.AD_Org_ID " //JAVIER
|
+ " lin.Line,lin.C_InvoiceLine_ID,p.Name,lin.M_Product_ID,dt.DocBaseType,lin.QtyInvoiced, org.Name, hdr.AD_Org_ID " //JAVIER
|
||||||
+ "HAVING "
|
+ "HAVING "
|
||||||
+ (matched ? "0" : "lin.QtyInvoiced")
|
+ (matched ? "0" : "CASE WHEN dt.DocBaseType='APC' THEN lin.QtyInvoiced * -1 ELSE lin.QtyInvoiced END")
|
||||||
+ "<>SUM(NVL(mi.Qty,0))";
|
+ "<>SUM(NVL(mi.Qty,0))";
|
||||||
}
|
}
|
||||||
else if (display == MATCH_ORDER)
|
else if (display == MATCH_ORDER)
|
||||||
|
|
Loading…
Reference in New Issue