This is an automated email from the ASF dual-hosted git repository.
akashjain pushed a commit to branch trunk
in repository
https://gitbox.apache.org/repos/asf/ofbiz-framework.gitThe following commit(s) were added to refs/heads/trunk by this push:
new 163ff79 Improved: Get billing party by parent invoice type (OFBIZ-10878)
163ff79 is described below
commit 163ff79526e18f720d3cb89176e4899aa0b4c15f
Author: Akash Jain <
[hidden email]>
AuthorDate: Sun Aug 30 18:47:47 2020 +0530
Improved: Get billing party by parent invoice type (OFBIZ-10878)
Thanks, Ingo Wolfmayr.
---
.../org/apache/ofbiz/accounting/invoice/InvoiceWorker.java | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceWorker.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceWorker.java
index a102565..72d8ddb 100644
--- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceWorker.java
+++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceWorker.java
@@ -377,12 +377,18 @@ public final class InvoiceWorker {
// if no locations found get it from the PartyAndContactMech using the from and to party on the invoice
String destinationPartyId = null;
Timestamp now = UtilDateTime.nowTimestamp();
- if ("SALES_INVOICE".equals(invoice.getString("invoiceTypeId"))) {
- destinationPartyId = invoice.getString("partyId");
+ GenericValue invoiceType = null;
+ try {
+ EntityQuery.use(delegator).from("InvoiceType").where("invoiceTypeId", invoice.getString("invoiceTypeId")).queryFirst();
+ } catch (GenericEntityException e) {
+ Debug.logError("Trouble getting invoice type", MODULE);
}
- if ("PURCHASE_INVOICE".equals(invoice.getString("invoiceTypeId"))) {
+ if ("SALES_INVOICE".equals(invoice.getString("invoiceTypeId")) || "SALES_INVOICE".equals(invoiceType.getString("parentTypeId"))) {
destinationPartyId = invoice.getString("partyId");
}
+ if ("PURCHASE_INVOICE".equals(invoice.getString("invoiceTypeId")) || "PURCHASE_INVOICE".equals(invoiceType.getString("parentTypeId"))) {
+ destinationPartyId = invoice.getString("partyIdFrom");
+ }
try {
locations = EntityQuery.use(delegator).from("PartyContactWithPurpose")
.where("partyId", destinationPartyId, "contactMechPurposeTypeId", contactMechPurposeTypeId).queryList();