Fixes issue 33776: Business partner being null in Payment scheduledetails
authorSanjota <sanjota.nelagi@promantia.com>
Wed, 24 Aug 2016 12:58:54 +0200
changeset 30250 97dc0931fbfb
parent 30249 19d7f3e7efc1
child 30251 7a6f2a5786c1
child 30252 a8a02720da0e
Fixes issue 33776: Business partner being null in Payment scheduledetails

Set the Bpartner of payment scheduledetails to the bpartner of Invoice or order
Details: Set Bpartner for newly created merged Payment Scheduledetails when the fin_payment is made void.
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_PaymentProcess.java
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_PaymentProcess.java	Mon Sep 05 18:58:22 2016 +0000
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_PaymentProcess.java	Wed Aug 24 12:58:54 2016 +0200
@@ -1057,12 +1057,15 @@
                   // Create merged Payment Schedule Detail with the pending to be paid amount
                   if (outStandingAmt.compareTo(BigDecimal.ZERO) != 0) {
                     final FIN_PaymentScheduleDetail mergedScheduleDetail = dao
-                        .getNewPaymentScheduleDetail(paymentScheduleDetail.getInvoicePaymentSchedule()
-                           .getInvoice().getOrganization(), outStandingAmt);
+                        .getNewPaymentScheduleDetail(paymentScheduleDetail
+                            .getInvoicePaymentSchedule().getInvoice().getOrganization(),
+                            outStandingAmt);
                     mergedScheduleDetail.setInvoicePaymentSchedule(paymentScheduleDetail
                         .getInvoicePaymentSchedule());
                     mergedScheduleDetail.setOrderPaymentSchedule(paymentScheduleDetail
                         .getOrderPaymentSchedule());
+                    mergedScheduleDetail.setBusinessPartner(paymentScheduleDetail
+                        .getBusinessPartner());
                     OBDal.getInstance().save(mergedScheduleDetail);
                   }
                 } else if (paymentScheduleDetail.getOrderPaymentSchedule() != null) {
@@ -1086,10 +1089,12 @@
                   // Create merged Payment Schedule Detail with the pending to be paid amount
                   if (outStandingAmt.compareTo(BigDecimal.ZERO) != 0) {
                     final FIN_PaymentScheduleDetail mergedScheduleDetail = dao
-                        .getNewPaymentScheduleDetail(paymentScheduleDetail.getOrderPaymentSchedule()
-                        	.getOrder().getOrganization(), outStandingAmt);
+                        .getNewPaymentScheduleDetail(paymentScheduleDetail
+                            .getOrderPaymentSchedule().getOrder().getOrganization(), outStandingAmt);
                     mergedScheduleDetail.setOrderPaymentSchedule(paymentScheduleDetail
                         .getOrderPaymentSchedule());
+                    mergedScheduleDetail.setBusinessPartner(paymentScheduleDetail
+                        .getBusinessPartner());
                     OBDal.getInstance().save(mergedScheduleDetail);
                   }
                 } else if (paymentDetail.getGLItem() != null) {