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/27 06:51:00 UTC

[jira] [Created] (OFBIZ-13617) Three regressions in the minilang-to-Groovy conversion of CostServices.groovy

Mridul Pathak created OFBIZ-13617:
-------------------------------------

             Summary: Three regressions in the minilang-to-Groovy conversion of CostServices.groovy
                 Key: OFBIZ-13617
                 URL: https://issues.apache.org/jira/browse/OFBIZ-13617
             Project: OFBiz
          Issue Type: Bug
          Components: product/catalog
    Affects Versions: 24.09.07, Upcoming Branch
            Reporter: Mridul Pathak
            Assignee: Mridul Pathak


h3. 1. {{calculateProductCosts()}} throws on a common routing shape
{code:java}
totalCostsByType."${entry.key}" = entry.value + totalCostByType."${entry.key}"
{code}
Typo: {{totalCostByType}} (missing "s") is never declared — the real map is {{totalCostsByType}}. Throws {{MissingPropertyException}} whenever a product's routing has 2+ tasks contributing to the same cost-component type.

h3. 2. {{calculateProductAverageCost()}} lost mini-lang's per-iteration rounding
Mini-lang's {{<calculate>}} elements default to {{decimal-scale="2"}}/{{HALF_EVEN}} when omitted (confirmed in {{Calculate.java}}), so each loop iteration rounds the running total. The Groovy conversion accumulates unrounded and rounds only once at the end. Empirically confirmed with 3 items each contributing 0.125: mini-lang-style yields {{0.36}}, Groovy's single-round yields {{0.38}} — a materially different average cost whenever several inventory items have sub-cent-level contributions.

h3. 3. {{updateProductAverageCostOnReceiveInventory()}} ignores the configured rounding precision
{code:java}
int roundingDecimal = UtilProperties.getPropertyAsInteger('arithmetic', 'finaccout.decimals', 2)
{code}
Typo'd property key ({{finaccout.decimals}}, missing "n") never matches the real {{finaccount.decimals}} key in {{arithmetic.properties}}, so this always silently falls back to the hardcoded default of 2, regardless of what an admin configures.



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