You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ofbiz.apache.org by "Mridul Pathak (Jira)" <ji...@apache.org> on 2026/09/11 10:23:00 UTC

[jira] [Created] (OFBIZ-13569) Fix Mini-lang to Groovy regressions in InvoiceServicesScript.groovy

Mridul Pathak created OFBIZ-13569:
-------------------------------------

             Summary: Fix Mini-lang to Groovy regressions in InvoiceServicesScript.groovy
                 Key: OFBIZ-13569
                 URL: https://issues.apache.org/jira/browse/OFBIZ-13569
             Project: OFBiz
          Issue Type: Bug
          Components: accounting
    Affects Versions: 24.09.07, Upcoming Branch
            Reporter: Mridul Pathak
            Assignee: Mridul Pathak


During the conversion of InvoiceServices.xml from Mini-lang to Groovy (OFBIZ-13085), several logic regressions were introduced in InvoiceServicesScript.groovy:

1. isInvoiceInForeignCurrency:
   - Inverted boolean: returns true when currency equals base currency, and false when different.
   - Accesses serviceResult.baseCurrencyUomId directly instead of serviceResult.partyAccountingPreference?.baseCurrencyUomId, always resolving to null.

2. setInvoiceStatus:
   - invoice.paidDate is assigned unconditionally outside the INVOICE_PAID check, setting paidDate on any status transition (e.g. INVOICE_APPROVED, INVOICE_SENT).

3. updateInvoice:
   - Multiple typos using statustId instead of statusId, resulting in missing statusId in label parameters, failure to mask statusId during setNonPKFields, and passing null statusId to setInvoiceStatus.

4. createInvoiceItem & updateInvoiceItem:
   - Product lookup uses where(parameters) instead of where(productId: ...), attempting to match non-Product entity fields like invoiceId.
   - createInvoiceItem uses if (!invoiceItem.amount), which treats 0 as falsy and recalculates price when amount is 0.

5. cancelInvoice:
   - Assumes any non-receipt payment is a disbursement (setting PMNT_SENT) rather than checking isDisbursement, and lacks null-safety when querying related Payment.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)