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/19 09:55:00 UTC

[jira] [Created] (OFBIZ-13603) Two regressions in OrderRequirementServicesScript.groovy break automatic-requirement generation

Mridul Pathak created OFBIZ-13603:
-------------------------------------

             Summary: Two regressions in OrderRequirementServicesScript.groovy break automatic-requirement generation
                 Key: OFBIZ-13603
                 URL: https://issues.apache.org/jira/browse/OFBIZ-13603
             Project: OFBiz
          Issue Type: Bug
          Components: order
    Affects Versions: Upcoming Branch
            Reporter: Mridul Pathak
            Assignee: Mridul Pathak


h3. Needs fixing

{{applications/order/src/main/groovy/org/apache/ofbiz/order/order/OrderRequirementServicesScript.groovy}} has two distinct regressions, both introduced within the same overall OFBIZ-9984 conversion effort:

* {{checkCreateOrderRequirement()}} calls {{getProductRequirementMethod()}} with no arguments. A later commit within the same OFBIZ-9984 conversion changed {{getProductRequirementMethod}}'s signature to {{getProductRequirementMethod(String productId)}} — needed for two new call sites it was adding ({{checkCreateProductRequirementForFacility}}, {{getStockRequirementMethod}}) — but never updated this original, pre-existing call site. Since there is no fallback dispatch for a missing argument, this throws {{groovy.lang.MissingMethodException}} every single time {{checkCreateOrderRequirement}} runs — the service that is supposed to auto-create a {{Requirement}}/{{OrderRequirementCommitment}} for order items with automatic requirement upon ordering (requirement method {{PRODRQM_AUTO}}). Needs fixing: change the call to {{getProductRequirementMethod(parameters.productId)}}.
* {{checkCreateProductRequirementForFacility()}} checks {{if (requirementMethodId)}} (a plain truthy check) where the pre-conversion minilang required an exact match against {{'PRODRQM_STOCK'}} or {{'PRODRQM_STOCK_ATP'}}. The {{PROD_REQ_METHOD}} enumeration has seven real values ({{PRODRQM_NONE}}, {{PRODRQM_AUTO}}, {{PRODRQM_STOCK}}, {{PRODRQM_STOCK_ATP}}, {{PRODRQM_ATP}}, {{PRODRQM_DS}}, {{PRODRQM_DSATP}}), so a product or store configured with any of the other five — including {{PRODRQM_NONE}}, which explicitly means "No Requirement Created" — is incorrectly processed by this facility-wide batch check, and can generate a spurious {{PRODUCT_REQUIREMENT}} record computed off the wrong quantity metric (the ternary treats anything that isn't literally {{'PRODRQM_STOCK'}} as an ATP case). Needs fixing: restore the exact-match condition, e.g. {{if (requirementMethodId in ['PRODRQM_STOCK', 'PRODRQM_STOCK_ATP'])}}.

Acceptance criteria: both fixed, with regression tests covering at least one successful {{checkCreateOrderRequirement}} call and one {{checkCreateProductRequirementForFacility}} call against a product configured with {{PRODRQM_NONE}} (asserting no requirement is created).



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