This is an automated email from the ASF dual-hosted git repository.

mridulpathak pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/trunk by this push:
     new a976a49235 Fixed: getFXConversion fails instead of defaulting to 1 
when no rate configured (OFBIZ-13531)
a976a49235 is described below

commit a976a49235b2edb91785d8d0a681f8ec548f0064
Author: Mridul Pathak <[email protected]>
AuthorDate: Wed Sep 9 20:08:28 2026 +0530

    Fixed: getFXConversion fails instead of defaulting to 1 when no rate 
configured (OFBIZ-13531)
    
    Restore the original minilang behavior in getFXConversion where an 
unconfigured currency pair gracefully defaults conversionRate to 1 and returns 
success, replacing the Groovy conversion's hard error return with a warning log.
---
 .../org/apache/ofbiz/accounting/admin/AcctgAdminServices.groovy     | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git 
a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/admin/AcctgAdminServices.groovy
 
b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/admin/AcctgAdminServices.groovy
index 7c56689def..30eccf1842 100644
--- 
a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/admin/AcctgAdminServices.groovy
+++ 
b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/admin/AcctgAdminServices.groovy
@@ -158,16 +158,14 @@ Map getFXConversion() {
     }
     List<GenericValue> rates = 
select().from('UomConversionDated').where(condition).orderBy('-fromDate').filterByDate().queryList()
 
-    BigDecimal conversionRate
+    BigDecimal conversionRate = BigDecimal.ONE
     int decimalScale = 2
     if (rates) {
         conversionFactor = 
EntityUtil.getFirst(rates).getBigDecimal('conversionFactor')
         BigDecimal originalValue = BigDecimal.ONE
         conversionRate = originalValue.divide(conversionFactor, decimalScale, 
RoundingMode.HALF_UP)
     } else {
-        String errorMessage = 'Could not find conversion rate'
-        logError(errorMessage)
-        return error(errorMessage)
+        logWarning('Could not find conversion rate')
     }
     result.put('conversionRate', conversionRate)
     return result

Reply via email to