Fixed: Terms are not shown correctly on the Invoice overview (OFBIZ-12139)
When we have multiple Payment (Net Days) terms on the invoice say
20% in 15Days (FIN_PAY_NETDAYS_1)
80% in 30Days (FIN_PAY_NETDAYS_2)
The terms section shows incorrect term data as shown in the screenshot.
Thanks: Nameet Jain for report and fix, Jacopo for confirmation
diff --git a/applications/accounting/groovyScripts/payment/PaymentServices.groovy b/applications/accounting/groovyScripts/payment/PaymentServices.groovy
index 3918b99..3e23701 100644
--- a/applications/accounting/groovyScripts/payment/PaymentServices.groovy
+++ b/applications/accounting/groovyScripts/payment/PaymentServices.groovy
@@ -87,7 +87,7 @@
for (invoiceTerm in invoiceTerms) {
termType = from("TermType").where("termTypeId", invoiceTerm.termTypeId).cache(true).queryOne()
if ("FIN_PAYMENT_TERM" == termType.parentTypeId) {
- invoicePaymentInfo.clear()
+ invoicePaymentInfo = [:]
invoicePaymentInfo.invoiceId = invoice.invoiceId
invoicePaymentInfo.invoiceTermId = invoiceTerm.invoiceTermId
invoicePaymentInfo.termTypeId = invoiceTerm.termTypeId
@@ -110,7 +110,7 @@
}
if (remainingAppliedAmount > 0.0 || invoiceTotalAmount <= 0.0 || computedTotalAmount < invoiceTotalAmount) {
- invoicePaymentInfo.clear()
+ invoicePaymentInfo = [:]
invoiceTerm = from("InvoiceTerm").where("invoiceId", invoice.invoiceId, "termTypeId", "FIN_PAYMENT_TERM").queryFirst()
if (invoiceTerm) {
invoicePaymentInfo.termTypeId = invoiceTerm.termTypeId