Fixes issue 33887: GLItem accounting dimensions maintained when posting Payment
authorMark <markmm82@gmail.com>
Wed, 14 Sep 2016 19:39:08 -0400
changeset 30553 fa17d173e3ce
parent 30552 018192ddfcb3
child 30554 7237a9b65b09
Fixes issue 33887: GLItem accounting dimensions maintained when posting Payment

In case Payment document has business partner set in payment's header and GL Item line is included setting different business partner, then accounting entry is generated for line's business partner instead of header's business partner.
src/org/openbravo/erpCommon/ad_forms/DocFINPayment.java
--- a/src/org/openbravo/erpCommon/ad_forms/DocFINPayment.java	Mon Sep 19 11:14:46 2016 +0200
+++ b/src/org/openbravo/erpCommon/ad_forms/DocFINPayment.java	Wed Sep 14 19:39:08 2016 -0400
@@ -146,17 +146,16 @@
         FieldProviderFactory
             .setField(data[i], "AD_Org_ID", paymentDetail.getOrganization().getId());
         FieldProviderFactory.setField(data[i], "FIN_Payment_Detail_ID", paymentDetail.getId());
-        // Calculate Business Partner from payment header or from details if header is null or from
-        // the PSD in case of GL Item
-        BusinessPartner bPartner = payment.getBusinessPartner() != null ? payment
-            .getBusinessPartner()
-            : (paymentDetail.getFINPaymentScheduleDetailList().get(0).getInvoicePaymentSchedule() != null ? paymentDetail
-                .getFINPaymentScheduleDetailList().get(0).getInvoicePaymentSchedule().getInvoice()
-                .getBusinessPartner()
-                : (paymentDetail.getFINPaymentScheduleDetailList().get(0).getOrderPaymentSchedule() != null ? paymentDetail
-                    .getFINPaymentScheduleDetailList().get(0).getOrderPaymentSchedule().getOrder()
-                    .getBusinessPartner()
-                    : (paymentDetail.getFINPaymentScheduleDetailList().get(0).getBusinessPartner())));
+        // Calculate Business Partner from the PSD in case of GL Item or from payment header or from
+        // details if header is null
+        BusinessPartner bPartner = paymentDetail.getFINPaymentScheduleDetailList().get(0)
+            .getBusinessPartner() != null ? paymentDetail.getFINPaymentScheduleDetailList().get(0)
+            .getBusinessPartner() : (payment.getBusinessPartner() != null ? payment
+            .getBusinessPartner() : (paymentDetail.getFINPaymentScheduleDetailList().get(0)
+            .getInvoicePaymentSchedule() != null ? paymentDetail.getFINPaymentScheduleDetailList()
+            .get(0).getInvoicePaymentSchedule().getInvoice().getBusinessPartner() : paymentDetail
+            .getFINPaymentScheduleDetailList().get(0).getOrderPaymentSchedule().getOrder()
+            .getBusinessPartner()));
         FieldProviderFactory.setField(data[i], "cBpartnerId", bPartner != null ? bPartner.getId()
             : "");
         FieldProviderFactory.setField(data[i], "DoubtFulDebtAmount", paymentDetail