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)
|
||||
{
|
||||
if (this.isPosted())
|
||||
if (this.isPosted() && this.getReversal_ID() == 0)
|
||||
{
|
||||
MMatchInv reversal = new MMatchInv (getCtx(), 0, get_TrxName());
|
||||
PO.copyValues(this, reversal);
|
||||
|
@ -439,9 +439,11 @@ public class MMatchInv extends X_M_MatchInv
|
|||
reversal.set_ValueNoCheck ("DocumentNo", null);
|
||||
reversal.setPosted (false);
|
||||
reversal.setReversal_ID(getM_MatchInv_ID());
|
||||
this.setDescription("(" + this.getDocumentNo() + "<-)");
|
||||
if (reversal.save() && this.save())
|
||||
return true;
|
||||
reversal.saveEx();
|
||||
this.setDescription("(" + reversal.getDocumentNo() + "<-)");
|
||||
this.setReversal_ID(reversal.getM_MatchInv_ID());
|
||||
this.saveEx();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1175,7 +1175,7 @@ public class MMatchPO extends X_M_MatchPO
|
|||
|
||||
public boolean reverse(Timestamp reversalDate)
|
||||
{
|
||||
if (this.isPosted())
|
||||
if (this.isPosted() && this.getReversal_ID() == 0)
|
||||
{
|
||||
MMatchPO reversal = new MMatchPO (getCtx(), 0, get_TrxName());
|
||||
reversal.setC_InvoiceLine_ID(getC_InvoiceLine_ID());
|
||||
|
@ -1189,9 +1189,11 @@ public class MMatchPO extends X_M_MatchPO
|
|||
reversal.set_ValueNoCheck ("DocumentNo", null);
|
||||
reversal.setPosted (false);
|
||||
reversal.setReversal_ID(getM_MatchPO_ID());
|
||||
this.setDescription("(" + this.getDocumentNo() + "<-)");
|
||||
if (reversal.save() && this.save())
|
||||
return true;
|
||||
reversal.saveEx();
|
||||
this.setDescription("(" + reversal.getDocumentNo() + "<-)");
|
||||
this.setReversal_ID(reversal.getM_MatchPO_ID());
|
||||
this.saveEx();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue