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/03 12:53:00 UTC
[jira] [Created] (OFBIZ-13521) addOrderShipmentToShipment / getQuantityForShipment broken since the minilang-to-Groovy conversion
Mridul Pathak created OFBIZ-13521:
-------------------------------------
Summary: addOrderShipmentToShipment / getQuantityForShipment broken since the minilang-to-Groovy conversion
Key: OFBIZ-13521
URL: https://issues.apache.org/jira/browse/OFBIZ-13521
Project: OFBiz
Issue Type: Bug
Components: product
Affects Versions: 24.09.07, Upcoming Branch
Reporter: Mridul Pathak
Assignee: Mridul Pathak
h3. Problem
Two defects in {{applications/product/src/main/groovy/org/apache/ofbiz/product/shipment/ShipmentServices.groovy}}, both introduced by the 2020 minilang-to-Groovy port (OFBIZ-11462), together leave {{addOrderShipmentToShipment}} -- and therefore {{createOrderShipmentPlan}}, which calls it -- unable to complete successfully.
h4. Defect 1: sign-inverted remaining-quantity calculation
In {{getQuantityForShipment}}:
{code:java}
result.remainingQuantity = orderCancelQuantity + totPlannedOrIssuedQuantity - orderItem.quantity
{code}
This computes the negative of the correct remaining quantity. The original minilang computed {{orderItem.quantity - orderItem.cancelQuantity - totPlannedOrIssuedQuantity}}. Because of the inversion, {{addOrderShipmentToShipment}}'s check ({{if (parameters.quantity > remainingQuantity)}}) rejects almost any real planning attempt as "quantity is greater than the remaining quantity," even on a fresh order item with nothing planned yet.
h4. Defect 2: typo drops the shipment item sequence ID
In {{addOrderShipmentToShipment}}:
{code:java}
Map serviceResultCSI = run service: 'createShipmentItem', with: [...]
parameters.shipmentItemSeqId = serviceResultCSI.shipemntItemSeqId
result.shipmentItemSeqId = serviceResultCSI.shipmentItemSeqId
run service: 'createOrderShipment', with: parameters
{code}
{{serviceResultCSI.shipemntItemSeqId}} is misspelled ("shipemnt"), so {{parameters.shipmentItemSeqId}} is always {{null}} and the following {{createOrderShipment}} call always fails with a missing required parameter.
h3. Fix
* Correct the {{getQuantityForShipment}} formula to {{orderItem.quantity - orderCancelQuantity - totPlannedOrIssuedQuantity}}.
* Fix the typo to {{serviceResultCSI.shipmentItemSeqId}}.
h3. Acceptance criteria
* {{createOrderShipmentPlan}} (and other callers of {{addOrderShipmentToShipment}}) can successfully plan a fresh, unshipped order item onto a shipment.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)