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 13:56:00 UTC

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

     [ https://issues.apache.org/jira/browse/OFBIZ-13603?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mridul Pathak closed OFBIZ-13603.
---------------------------------
    Fix Version/s: Upcoming Branch
       Resolution: Fixed

> 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
>            Priority: Major
>             Fix For: Upcoming Branch
>
>
> 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. *Correction:* this does not throw an exception — Groovy's dispatch for methods declared at script top level silently pads the missing trailing argument with {{null}} rather than raising {{MissingMethodException}}. The real effect is a silent no-op: with {{productId}} always {{null}}, the {{Product}} lookup inside {{getProductRequirementMethod()}} always misses, so {{requirementMethodId}} is always empty and the {{PRODRQM_AUTO}} branch never fires — even for a product genuinely configured with {{PRODRQM_AUTO}} ("Automatic For Every Sales Order"). The service that's supposed to auto-create a {{Requirement}}/{{OrderRequirementCommitment}} for such products silently never does. 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 against a {{PRODRQM_AUTO}}-configured product (asserting a requirement/commitment is actually created) 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)