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:
Heng Sin Low 2012-11-20 00:21:35 +08:00
parent eed9d21277
commit 86eb3d32fa
2 changed files with 12 additions and 8 deletions

View File

@ -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,8 +439,10 @@ 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())
reversal.saveEx();
this.setDescription("(" + reversal.getDocumentNo() + "<-)");
this.setReversal_ID(reversal.getM_MatchInv_ID());
this.saveEx();
return true;
}
return false;

View File

@ -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,8 +1189,10 @@ 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())
reversal.saveEx();
this.setDescription("(" + reversal.getDocumentNo() + "<-)");
this.setReversal_ID(reversal.getM_MatchPO_ID());
this.saveEx();
return true;
}
return false;