IDEMPIERE-1088 Problem with Reverse-Accrual with payment allocation

This commit is contained in:
Carlos Ruiz 2013-06-21 19:26:14 -05:00
parent ac1a8e486c
commit 0e80967351
2 changed files with 20 additions and 15 deletions

View File

@ -21,6 +21,7 @@ import java.sql.ResultSet;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.logging.Level; import java.util.logging.Level;
import org.adempiere.exceptions.AdempiereException;
import org.compiere.model.MAllocationHdr; import org.compiere.model.MAllocationHdr;
import org.compiere.util.AdempiereUserError; import org.compiere.util.AdempiereUserError;
import org.compiere.util.DB; import org.compiere.util.DB;
@ -110,6 +111,8 @@ public class AllocationReset extends SvrProcess
MAllocationHdr hdr = new MAllocationHdr(getCtx(), p_C_AllocationHdr_ID, m_trx.getTrxName()); MAllocationHdr hdr = new MAllocationHdr(getCtx(), p_C_AllocationHdr_ID, m_trx.getTrxName());
if (delete(hdr)) if (delete(hdr))
count++; count++;
else
throw new AdempiereException("Cannot delete");
m_trx.close(); m_trx.close();
StringBuilder msgreturn = new StringBuilder("@Deleted@ #").append(count); StringBuilder msgreturn = new StringBuilder("@Deleted@ #").append(count);
return msgreturn.toString(); return msgreturn.toString();

View File

@ -407,6 +407,7 @@ public final class MAllocationHdr extends X_C_AllocationHdr implements DocAction
} }
// Stop the Document Workflow if invoice to allocate is as paid // Stop the Document Workflow if invoice to allocate is as paid
if (!isReversal()) {
for (MAllocationLine line :m_lines) for (MAllocationLine line :m_lines)
{ {
if (line.getC_Invoice_ID() != 0) if (line.getC_Invoice_ID() != 0)
@ -422,6 +423,7 @@ public final class MAllocationHdr extends X_C_AllocationHdr implements DocAction
throw new AdempiereException("@ValidationError@ @C_Invoice_ID@ @IsPaid@"); throw new AdempiereException("@ValidationError@ @C_Invoice_ID@ @IsPaid@");
} }
} }
}
// Add up Amounts & validate // Add up Amounts & validate
BigDecimal approval = Env.ZERO; BigDecimal approval = Env.ZERO;