From: <vp...@us...> - 2007-04-18 22:35:00
|
Revision: 2156 http://svn.sourceforge.net/adempiere/?rev=2156&view=rev Author: vpj-cd Date: 2007-04-18 15:35:01 -0700 (Wed, 18 Apr 2007) Log Message: ----------- Fixed: [ 1691676 ] Duplicate Allocation when you reverse invoice with PR cash https://sourceforge.net/tracker/index.php?func=detail&aid=1691676&group_id=176962&atid=879332 Modified Paths: -------------- trunk/base/src/org/compiere/model/MInvoice.java Modified: trunk/base/src/org/compiere/model/MInvoice.java =================================================================== --- trunk/base/src/org/compiere/model/MInvoice.java 2007-04-18 22:15:08 UTC (rev 2155) +++ trunk/base/src/org/compiere/model/MInvoice.java 2007-04-18 22:35:01 UTC (rev 2156) @@ -2011,14 +2011,18 @@ m_processMsg = "@PeriodClosed@"; return false; } - // - MAllocationHdr[] allocations = MAllocationHdr.getOfInvoice(getCtx(), - getC_Invoice_ID(), get_TrxName()); - for (int i = 0; i < allocations.length; i++) - { - allocations[i].setDocAction(DocAction.ACTION_Reverse_Correct); - allocations[i].reverseCorrectIt(); - allocations[i].save(get_TrxName()); + + if(!getPaymentRule().equals(MInvoice.PAYMENTRULE_Cash)) + { + // + MAllocationHdr[] allocations = MAllocationHdr.getOfInvoice(getCtx(), + getC_Invoice_ID(), get_TrxName()); + for (int i = 0; i < allocations.length; i++) + { + allocations[i].setDocAction(DocAction.ACTION_Reverse_Correct); + allocations[i].reverseCorrectIt(); + allocations[i].save(get_TrxName()); + } } // Reverse/Delete Matching if (!isSOTrx()) @@ -2050,6 +2054,7 @@ return false; } reversal.setReversal(true); + // Reverse Line Qty MInvoiceLine[] rLines = reversal.getLines(false); @@ -2109,6 +2114,8 @@ setC_Payment_ID(0); setIsPaid(true); + if(!getPaymentRule().equals(MInvoice.PAYMENTRULE_Cash)) + { // Create Allocation MAllocationHdr alloc = new MAllocationHdr(getCtx(), false, getDateAcct(), getC_Currency_ID(), @@ -2135,6 +2142,7 @@ if (alloc.processIt(DocAction.ACTION_Complete)) alloc.save(); } + } // After reverseCorrect m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REVERSECORRECT); if (m_processMsg != null) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |