IDEMPIERE-378 Implement Reverse Accrual. Fixed reverse matching doesn't update current document's description correctly. Added validation to prevent repeated execution of reversal process.
This commit is contained in:
parent
eed9d21277
commit
86eb3d32fa
|
@ -427,7 +427,7 @@ public class MMatchInv extends X_M_MatchInv
|
||||||
*/
|
*/
|
||||||
public boolean reverse(Timestamp reversalDate)
|
public boolean reverse(Timestamp reversalDate)
|
||||||
{
|
{
|
||||||
if (this.isPosted())
|
if (this.isPosted() && this.getReversal_ID() == 0)
|
||||||
{
|
{
|
||||||
MMatchInv reversal = new MMatchInv (getCtx(), 0, get_TrxName());
|
MMatchInv reversal = new MMatchInv (getCtx(), 0, get_TrxName());
|
||||||
PO.copyValues(this, reversal);
|
PO.copyValues(this, reversal);
|
||||||
|
@ -439,8 +439,10 @@ public class MMatchInv extends X_M_MatchInv
|
||||||
reversal.set_ValueNoCheck ("DocumentNo", null);
|
reversal.set_ValueNoCheck ("DocumentNo", null);
|
||||||
reversal.setPosted (false);
|
reversal.setPosted (false);
|
||||||
reversal.setReversal_ID(getM_MatchInv_ID());
|
reversal.setReversal_ID(getM_MatchInv_ID());
|
||||||
this.setDescription("(" + this.getDocumentNo() + "<-)");
|
reversal.saveEx();
|
||||||
if (reversal.save() && this.save())
|
this.setDescription("(" + reversal.getDocumentNo() + "<-)");
|
||||||
|
this.setReversal_ID(reversal.getM_MatchInv_ID());
|
||||||
|
this.saveEx();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -1175,7 +1175,7 @@ public class MMatchPO extends X_M_MatchPO
|
||||||
|
|
||||||
public boolean reverse(Timestamp reversalDate)
|
public boolean reverse(Timestamp reversalDate)
|
||||||
{
|
{
|
||||||
if (this.isPosted())
|
if (this.isPosted() && this.getReversal_ID() == 0)
|
||||||
{
|
{
|
||||||
MMatchPO reversal = new MMatchPO (getCtx(), 0, get_TrxName());
|
MMatchPO reversal = new MMatchPO (getCtx(), 0, get_TrxName());
|
||||||
reversal.setC_InvoiceLine_ID(getC_InvoiceLine_ID());
|
reversal.setC_InvoiceLine_ID(getC_InvoiceLine_ID());
|
||||||
|
@ -1189,8 +1189,10 @@ public class MMatchPO extends X_M_MatchPO
|
||||||
reversal.set_ValueNoCheck ("DocumentNo", null);
|
reversal.set_ValueNoCheck ("DocumentNo", null);
|
||||||
reversal.setPosted (false);
|
reversal.setPosted (false);
|
||||||
reversal.setReversal_ID(getM_MatchPO_ID());
|
reversal.setReversal_ID(getM_MatchPO_ID());
|
||||||
this.setDescription("(" + this.getDocumentNo() + "<-)");
|
reversal.saveEx();
|
||||||
if (reversal.save() && this.save())
|
this.setDescription("(" + reversal.getDocumentNo() + "<-)");
|
||||||
|
this.setReversal_ID(reversal.getM_MatchPO_ID());
|
||||||
|
this.saveEx();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue