From 621b995aa408377cd6bf610d6e55a532a41cb45c Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Thu, 5 Sep 2013 11:48:28 +0800 Subject: [PATCH] IDEMPIERE-1307 Voiding allocation header keeps payment allocated. Base on patch from Richard Morales Herrera. --- .../src/org/compiere/model/MAllocationLine.java | 2 +- .../src/org/compiere/model/MPayment.java | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MAllocationLine.java b/org.adempiere.base/src/org/compiere/model/MAllocationLine.java index f21bb52e72..bf60f9a66a 100644 --- a/org.adempiere.base/src/org/compiere/model/MAllocationLine.java +++ b/org.adempiere.base/src/org/compiere/model/MAllocationLine.java @@ -266,7 +266,7 @@ public class MAllocationLine extends X_C_AllocationLine log.warning("C_BPartner_ID different - Invoice=" + getC_BPartner_ID() + " - Payment=" + payment.getC_BPartner_ID()); if (reverse) { - if (!payment.isCashTrx()) + if (!payment.isCashbookTrx()) { payment.setIsAllocated(false); payment.saveEx(); diff --git a/org.adempiere.base/src/org/compiere/model/MPayment.java b/org.adempiere.base/src/org/compiere/model/MPayment.java index 9ddd4f33ba..ab63d1512e 100644 --- a/org.adempiere.base/src/org/compiere/model/MPayment.java +++ b/org.adempiere.base/src/org/compiere/model/MPayment.java @@ -200,7 +200,7 @@ public final class MPayment extends X_C_Payment } // resetNew /** - * Is Cashbook Transfer Trx + * Is Cash Trx * @return true if Cash Trx */ public boolean isCashTrx() @@ -208,6 +208,14 @@ public final class MPayment extends X_C_Payment return "X".equals(getTenderType()); } // isCashTrx + /** + * Is Cashbook Trx + * @return true if this is a cashbook trx + */ + public boolean isCashbookTrx() { + return isCashTrx() && !MSysConfig.getBooleanValue(MSysConfig.CASH_AS_PAYMENT, true , getAD_Client_ID()); + } + /************************************************************************** * Set Credit Card. * Need to set PatmentProcessor after Amount/Currency Set @@ -650,7 +658,7 @@ public final class MPayment extends X_C_Payment { // @Trifon - CashPayments //if ( getTenderType().equals("X") ) { - if ( isCashTrx() && !MSysConfig.getBooleanValue(MSysConfig.CASH_AS_PAYMENT, true , getAD_Client_ID())) { + if ( isCashbookTrx()) { // Cash Book Is mandatory if ( getC_CashBook_ID() <= 0 ) { log.saveError("Error", Msg.parseTranslation(getCtx(), "@Mandatory@: @C_CashBook_ID@")); @@ -1965,7 +1973,7 @@ public final class MPayment extends X_C_Payment // @Trifon - CashPayments //if ( getTenderType().equals("X") ) { - if ( isCashTrx() && !MSysConfig.getBooleanValue(MSysConfig.CASH_AS_PAYMENT, true , getAD_Client_ID())) { + if ( isCashbookTrx()) { // Create Cash Book entry if ( getC_CashBook_ID() <= 0 ) { log.saveError("Error", Msg.parseTranslation(getCtx(), "@Mandatory@: @C_CashBook_ID@")); @@ -2047,7 +2055,8 @@ public final class MPayment extends X_C_Payment setDocAction(DOCACTION_Close); return DocAction.STATUS_Completed; } // completeIt - + + /** * Set the definite document number after completed */