Attached Files | FixesIssue_29389_1.diff [^] (6,029 bytes) 2015-03-26 12:54 [Show Content] [Hide Content]# HG changeset patch
# User Atul Gaware <atul.gaware@openbravo.com>
# Date 1427314696 -19800
# Node ID 242adff1fd17f5541bbe53363cddd148c130cf47
# Parent 949be1b4825e10f4ba7a50216afa19e63d82abcf
Fixes Issue 29389: Invoice's Payment Plan and Order's Payment Plan are not
updated when reactivating partial payment
Part of fix from the regression commit is reversed and fixed in the FIN_Utility
update amount method. If there is need to update amount then only amounts are
updated through FIN_Utility in PaidStatusEventHandler else care was already taken
by FIN_AddPayment
diff -r 949be1b4825e -r 242adff1fd17 modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_AddPayment.java
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_AddPayment.java Mon Feb 23 05:31:08 2015 +0000
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_AddPayment.java Thu Mar 26 01:48:16 2015 +0530
@@ -11,7 +11,7 @@
* under the License.
* The Original Code is Openbravo ERP.
* The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2010-2014 Openbravo SLU
+ * All portions are Copyright (C) 2010-2015 Openbravo SLU
* All Rights Reserved.
* Contributor(s): ______________________________________.
*************************************************************************
@@ -1160,18 +1160,15 @@
*/
public static void updatePaymentScheduleAmounts(FIN_PaymentDetail paymentDetail,
FIN_PaymentSchedule paymentSchedule, BigDecimal amount, BigDecimal writeOffAmount) {
- if (paymentSchedule.getOutstandingAmount().compareTo(BigDecimal.ZERO) != 0) {
- paymentSchedule.setPaidAmount(paymentSchedule.getPaidAmount().add(amount));
- paymentSchedule.setOutstandingAmount(paymentSchedule.getOutstandingAmount().subtract(amount));
- if (writeOffAmount != null && writeOffAmount.compareTo(BigDecimal.ZERO) != 0) {
- paymentSchedule.setPaidAmount(paymentSchedule.getPaidAmount().add(writeOffAmount));
- paymentSchedule.setOutstandingAmount(paymentSchedule.getOutstandingAmount().subtract(
- writeOffAmount));
- }
- OBDal.getInstance().save(paymentSchedule);
- CashVATUtil.createInvoiceTaxCashVAT(paymentDetail, paymentSchedule,
- amount.add(writeOffAmount));
+ paymentSchedule.setPaidAmount(paymentSchedule.getPaidAmount().add(amount));
+ paymentSchedule.setOutstandingAmount(paymentSchedule.getOutstandingAmount().subtract(amount));
+ if (writeOffAmount != null && writeOffAmount.compareTo(BigDecimal.ZERO) != 0) {
+ paymentSchedule.setPaidAmount(paymentSchedule.getPaidAmount().add(writeOffAmount));
+ paymentSchedule.setOutstandingAmount(paymentSchedule.getOutstandingAmount().subtract(
+ writeOffAmount));
}
+ OBDal.getInstance().save(paymentSchedule);
+ CashVATUtil.createInvoiceTaxCashVAT(paymentDetail, paymentSchedule, amount.add(writeOffAmount));
if (paymentSchedule.getInvoice() != null) {
updateInvoicePaymentMonitor(paymentSchedule, amount, writeOffAmount);
}
diff -r 949be1b4825e -r 242adff1fd17 modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/FIN_Utility.java
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/FIN_Utility.java Mon Feb 23 05:31:08 2015 +0000
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/FIN_Utility.java Thu Mar 26 01:48:16 2015 +0530
@@ -11,7 +11,7 @@
* under the License.
* The Original Code is Openbravo ERP.
* The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2010-2014 Openbravo SLU
+ * All portions are Copyright (C) 2010-2015 Openbravo SLU
* All Rights Reserved.
* Contributor(s): ______________________________________.
*************************************************************************
@@ -1406,12 +1406,30 @@
creditUsed = creditUsed.subtract(amountWithSign);
bPartner.setCreditUsed(creditUsed);
OBDal.getInstance().save(bPartner);
- FIN_AddPayment.updatePaymentScheduleAmounts(psd.getPaymentDetails(),
- psd.getInvoicePaymentSchedule(), psd.getAmount(), psd.getWriteoffAmount());
+ // Check whether there is need to update the amounts
+ BigDecimal paymentScheduleDetailInvAmt = BigDecimal.ZERO;
+ for (FIN_PaymentScheduleDetail paymentScheduleDetail : psd.getInvoicePaymentSchedule()
+ .getFINPaymentScheduleDetailInvoicePaymentScheduleList()) {
+ paymentScheduleDetailInvAmt = paymentScheduleDetailInvAmt.add(paymentScheduleDetail
+ .getAmount());
+ }
+ if (paymentScheduleDetailInvAmt.compareTo(psd.getInvoicePaymentSchedule().getAmount()) != 0) {
+ FIN_AddPayment.updatePaymentScheduleAmounts(psd.getPaymentDetails(),
+ psd.getInvoicePaymentSchedule(), psd.getAmount(), psd.getWriteoffAmount());
+ }
}
if (psd.getOrderPaymentSchedule() != null) {
- FIN_AddPayment.updatePaymentScheduleAmounts(psd.getPaymentDetails(),
- psd.getOrderPaymentSchedule(), psd.getAmount(), psd.getWriteoffAmount());
+ // Check whether there is need to update amount
+ BigDecimal paymentScheduleDetailOrdAmt = BigDecimal.ZERO;
+ for (FIN_PaymentScheduleDetail paymentScheduleDetail : psd.getOrderPaymentSchedule()
+ .getFINPaymentScheduleDetailOrderPaymentScheduleList()) {
+ paymentScheduleDetailOrdAmt = paymentScheduleDetailOrdAmt.add(paymentScheduleDetail
+ .getAmount());
+ }
+ if (paymentScheduleDetailOrdAmt.compareTo(psd.getOrderPaymentSchedule().getAmount()) != 0) {
+ FIN_AddPayment.updatePaymentScheduleAmounts(psd.getPaymentDetails(),
+ psd.getOrderPaymentSchedule(), psd.getAmount(), psd.getWriteoffAmount());
+ }
}
if (psd.getPaymentDetails().isPrepayment() && psd.getOrderPaymentSchedule() == null
&& psd.getInvoicePaymentSchedule() == null) {
FixesIssue_29389_2.diff [^] (3,038 bytes) 2015-03-26 12:54 [Show Content] [Hide Content]# HG changeset patch
# User Víctor Martínez Romanos <victor.martinez@openbravo.com>
# Date 1427369973 -3600
# Node ID 1dbdd6cd22884a721a9005d78586aeb97d00fa05
# Parent df6eaf978ff87c00925ca8d83bf98575d5171628
Related to issue 29389: removed useless stuff found in code review,
the updatePaymentAmounts() method contained useless code to check whether it's necessary to update the PS amounts or not. This code is not available in PI, and I have verified that after removing it the bug is still fixed.
Removed and synchronized this method with PI
diff --git a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/FIN_Utility.java b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/FIN_Utility.java
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/FIN_Utility.java
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/FIN_Utility.java
@@ -1406,30 +1406,12 @@
creditUsed = creditUsed.subtract(amountWithSign);
bPartner.setCreditUsed(creditUsed);
OBDal.getInstance().save(bPartner);
- // Check whether there is need to update the amounts
- BigDecimal paymentScheduleDetailInvAmt = BigDecimal.ZERO;
- for (FIN_PaymentScheduleDetail paymentScheduleDetail : psd.getInvoicePaymentSchedule()
- .getFINPaymentScheduleDetailInvoicePaymentScheduleList()) {
- paymentScheduleDetailInvAmt = paymentScheduleDetailInvAmt.add(paymentScheduleDetail
- .getAmount());
- }
- if (paymentScheduleDetailInvAmt.compareTo(psd.getInvoicePaymentSchedule().getAmount()) != 0) {
- FIN_AddPayment.updatePaymentScheduleAmounts(psd.getPaymentDetails(),
- psd.getInvoicePaymentSchedule(), psd.getAmount(), psd.getWriteoffAmount());
- }
+ FIN_AddPayment.updatePaymentScheduleAmounts(psd.getPaymentDetails(),
+ psd.getInvoicePaymentSchedule(), psd.getAmount(), psd.getWriteoffAmount());
}
if (psd.getOrderPaymentSchedule() != null) {
- // Check whether there is need to update amount
- BigDecimal paymentScheduleDetailOrdAmt = BigDecimal.ZERO;
- for (FIN_PaymentScheduleDetail paymentScheduleDetail : psd.getOrderPaymentSchedule()
- .getFINPaymentScheduleDetailOrderPaymentScheduleList()) {
- paymentScheduleDetailOrdAmt = paymentScheduleDetailOrdAmt.add(paymentScheduleDetail
- .getAmount());
- }
- if (paymentScheduleDetailOrdAmt.compareTo(psd.getOrderPaymentSchedule().getAmount()) != 0) {
- FIN_AddPayment.updatePaymentScheduleAmounts(psd.getPaymentDetails(),
- psd.getOrderPaymentSchedule(), psd.getAmount(), psd.getWriteoffAmount());
- }
+ FIN_AddPayment.updatePaymentScheduleAmounts(psd.getPaymentDetails(),
+ psd.getOrderPaymentSchedule(), psd.getAmount(), psd.getWriteoffAmount());
}
if (psd.getPaymentDetails().isPrepayment() && psd.getOrderPaymentSchedule() == null
&& psd.getInvoicePaymentSchedule() == null) {
29389.sql [^] (2,596 bytes) 2015-04-21 11:12 |