You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by Tomek <to...@wp.pl> on 2026/06/26 12:21:41 UTC
Bug report: Incorrect unit price calculation during PO receiving due to Locale issues (String to BigDecimal parsing bug in ShipmentReceiptServices.xml)
I have encountered a significant localization bug during the purchase
order receiving process in Apache OFBiz. When using non-US regional
settings (specifically Polish locale, where the decimal separator is a
comma `,` instead of a dot `.`), the unit price of an item gets
multiplied incorrectly (e.g., 7.410 becomes 741.00) after completing the
receipt.
Steps to reproduce:
1. Set the system/user profile locale to Polish (pl_PL).
2. Create a new Purchase Order: select an organization, vendor, currency
(PLN), and a product catalog.
3. Add a test product to the order with a quantity of 1 and a unit price
of 7.410.
4. Click "Finalize order" -> "Continue" -> select a warehouse location
-> click "Continue" and finalize with "Create Order".
5. Approve the order. The order details screen correctly shows the unit
price as 7,41 PLN and Total Due as 7,41 PLN.
6. Click "Quick Receive Purchase Order".
7. Choose the shipment to receive and click "Receive Selected Shipment".
8. On the receiving form, verify the fields: Qty Accepted: 1, Per Unit
Price: 7,41 PLN. Click "Receive Selected Product(s)".
9. In the "Receipt(s) For Purchase Order" screen, the "Per Unit Price"
is displayed as 7.410. Click the PO identifier link to return to the
order view.
10. Review the order items: the "Unit / List" column now incorrectly
displays 741.00 PLN (multiplied by 100). The Items SubTotal and Total
Due are also bloated to 741.00 PLN.
Root Cause:
In the `updateIssuanceShipmentAndPoOnReceiveInventory` service
definition, the attributes `unitCost` and `orderCurrencyUnitPrice` are
defined as `String`. When the Groovy service parses these string values
into numerical objects, it encounters a formatting mismatch due to the
active regional settings (Locale), shifting the decimal threshold and
corrupting the monetary values.
Proposed Solution:
Change the data type of `unitCost` and `orderCurrencyUnitPrice`
attributes from `String` to `BigDecimal` directly in the service
definition. This forces the OFBiz framework to handle the type
conversion natively and safely before passing it to the Groovy
implementation layer.
File: applications/product/servicedef/services_shipment.xml
Modified Fragment:
<service name="updateIssuanceShipmentAndPoOnReceiveInventory"
engine="groovy"
location="component://product/src/main/groovy/org/apache/ofbiz/product/shipment/ShipmentReceiptServices.groovy"
invoke="updateIssuanceShipmentAndPoOnReceiveInventory">
<description>Update issuance, shipment and order items if
quantity received is higher than quantity on purchase order</description>
...
<attribute name="unitCost" type="BigDecimal" mode="IN"
optional="true"/>
<attribute name="orderCurrencyUnitPrice" type="BigDecimal"
mode="IN" optional="true"/>
</service>
This modification resolves the issue completely and ensures robust
handling across different Locales.
Best regards,
Tomek
Re: Bug report: Incorrect unit price calculation during PO receiving due to Locale issues (String to BigDecimal parsing bug in ShipmentReceiptServices.xml)
Posted by Tomek <to...@wp.pl>.
Hi Nicolas,
Thank you for your response.
I wanted to let you know that I have just submitted a request for an ASF
Jira account using the self-serve portal. I couldn't open the issue
right away because public signup is disabled.
Now I need to wait for my account to be approved. As soon as it is
active, I will create the Jira ticket with my analysis and assign it to you.
Best regards,
Tomek
W dniu 26.06.2026 o 16:22, Nicolas Malin via user pisze:
> Hello Tomek,
>
> Thanks for your valuable return.
>
> Can you open jira issue for your both raise with your analyze and
> assign it to me? I'll try to fix it soon
>
> Nicolas
Re: Bug report: Incorrect unit price calculation during PO receiving due to Locale issues (String to BigDecimal parsing bug in ShipmentReceiptServices.xml)
Posted by Tomek <to...@wp.pl>.
Hi Nicolas,
I wanted to let you know that I have successfully created the Jira
tickets for both issues.
Here are the ticket numbers:
- OFBIZ-13448
- OFBIZ-13449
I don't see any option to assign them to you, most likely due to a lack
of permissions on my new account. Could you please assign them to yourself?
Best regards,
Tomek
W dniu 26.06.2026 o 16:22, Nicolas Malin via user pisze:
> Hello Tomek,
>
> Thanks for your valuable return.
>
> Can you open jira issue for your both raise with your analyze and
> assign it to me? I'll try to fix it soon
>
> Nicolas
>
> Le 26/06/2026 à 14:21, Tomek a écrit :
>> I have encountered a significant localization bug during the purchase
>> order receiving process in Apache OFBiz. When using non-US regional
>> settings (specifically Polish locale, where the decimal separator is
>> a comma `,` instead of a dot `.`), the unit price of an item gets
>> multiplied incorrectly (e.g., 7.410 becomes 741.00) after completing
>> the receipt.
>>
>> Steps to reproduce:
>> 1. Set the system/user profile locale to Polish (pl_PL).
>> 2. Create a new Purchase Order: select an organization, vendor,
>> currency (PLN), and a product catalog.
>> 3. Add a test product to the order with a quantity of 1 and a unit
>> price of 7.410.
>> 4. Click "Finalize order" -> "Continue" -> select a warehouse
>> location -> click "Continue" and finalize with "Create Order".
>> 5. Approve the order. The order details screen correctly shows the
>> unit price as 7,41 PLN and Total Due as 7,41 PLN.
>> 6. Click "Quick Receive Purchase Order".
>> 7. Choose the shipment to receive and click "Receive Selected Shipment".
>> 8. On the receiving form, verify the fields: Qty Accepted: 1, Per
>> Unit Price: 7,41 PLN. Click "Receive Selected Product(s)".
>> 9. In the "Receipt(s) For Purchase Order" screen, the "Per Unit
>> Price" is displayed as 7.410. Click the PO identifier link to return
>> to the order view.
>> 10. Review the order items: the "Unit / List" column now incorrectly
>> displays 741.00 PLN (multiplied by 100). The Items SubTotal and Total
>> Due are also bloated to 741.00 PLN.
>>
>> Root Cause:
>>
>> In the `updateIssuanceShipmentAndPoOnReceiveInventory` service
>> definition, the attributes `unitCost` and `orderCurrencyUnitPrice`
>> are defined as `String`. When the Groovy service parses these string
>> values into numerical objects, it encounters a formatting mismatch
>> due to the active regional settings (Locale), shifting the decimal
>> threshold and corrupting the monetary values.
>>
>> Proposed Solution:
>>
>> Change the data type of `unitCost` and `orderCurrencyUnitPrice`
>> attributes from `String` to `BigDecimal` directly in the service
>> definition. This forces the OFBiz framework to handle the type
>> conversion natively and safely before passing it to the Groovy
>> implementation layer.
>>
>> File: applications/product/servicedef/services_shipment.xml
>>
>> Modified Fragment:
>>
>> <service name="updateIssuanceShipmentAndPoOnReceiveInventory"
>> engine="groovy"
>> location="component://product/src/main/groovy/org/apache/ofbiz/product/shipment/ShipmentReceiptServices.groovy"
>> invoke="updateIssuanceShipmentAndPoOnReceiveInventory">
>> <description>Update issuance, shipment and order items if
>> quantity received is higher than quantity on purchase
>> order</description>
>> ...
>> <attribute name="unitCost" type="BigDecimal" mode="IN"
>> optional="true"/>
>> <attribute name="orderCurrencyUnitPrice" type="BigDecimal"
>> mode="IN" optional="true"/>
>> </service>
>>
>> This modification resolves the issue completely and ensures robust
>> handling across different Locales.
>>
>> Best regards,
>> Tomek
>>
>
Re: Bug report: Incorrect unit price calculation during PO receiving due to Locale issues (String to BigDecimal parsing bug in ShipmentReceiptServices.xml)
Posted by Nicolas Malin via user <us...@ofbiz.apache.org>.
Hello Tomek,
Thanks for your valuable return.
Can you open jira issue for your both raise with your analyze and assign
it to me? I'll try to fix it soon
Nicolas
Le 26/06/2026 à 14:21, Tomek a écrit :
> I have encountered a significant localization bug during the purchase
> order receiving process in Apache OFBiz. When using non-US regional
> settings (specifically Polish locale, where the decimal separator is a
> comma `,` instead of a dot `.`), the unit price of an item gets
> multiplied incorrectly (e.g., 7.410 becomes 741.00) after completing
> the receipt.
>
> Steps to reproduce:
> 1. Set the system/user profile locale to Polish (pl_PL).
> 2. Create a new Purchase Order: select an organization, vendor,
> currency (PLN), and a product catalog.
> 3. Add a test product to the order with a quantity of 1 and a unit
> price of 7.410.
> 4. Click "Finalize order" -> "Continue" -> select a warehouse location
> -> click "Continue" and finalize with "Create Order".
> 5. Approve the order. The order details screen correctly shows the
> unit price as 7,41 PLN and Total Due as 7,41 PLN.
> 6. Click "Quick Receive Purchase Order".
> 7. Choose the shipment to receive and click "Receive Selected Shipment".
> 8. On the receiving form, verify the fields: Qty Accepted: 1, Per Unit
> Price: 7,41 PLN. Click "Receive Selected Product(s)".
> 9. In the "Receipt(s) For Purchase Order" screen, the "Per Unit Price"
> is displayed as 7.410. Click the PO identifier link to return to the
> order view.
> 10. Review the order items: the "Unit / List" column now incorrectly
> displays 741.00 PLN (multiplied by 100). The Items SubTotal and Total
> Due are also bloated to 741.00 PLN.
>
> Root Cause:
>
> In the `updateIssuanceShipmentAndPoOnReceiveInventory` service
> definition, the attributes `unitCost` and `orderCurrencyUnitPrice` are
> defined as `String`. When the Groovy service parses these string
> values into numerical objects, it encounters a formatting mismatch due
> to the active regional settings (Locale), shifting the decimal
> threshold and corrupting the monetary values.
>
> Proposed Solution:
>
> Change the data type of `unitCost` and `orderCurrencyUnitPrice`
> attributes from `String` to `BigDecimal` directly in the service
> definition. This forces the OFBiz framework to handle the type
> conversion natively and safely before passing it to the Groovy
> implementation layer.
>
> File: applications/product/servicedef/services_shipment.xml
>
> Modified Fragment:
>
> <service name="updateIssuanceShipmentAndPoOnReceiveInventory"
> engine="groovy"
> location="component://product/src/main/groovy/org/apache/ofbiz/product/shipment/ShipmentReceiptServices.groovy"
> invoke="updateIssuanceShipmentAndPoOnReceiveInventory">
> <description>Update issuance, shipment and order items if
> quantity received is higher than quantity on purchase order</description>
> ...
> <attribute name="unitCost" type="BigDecimal" mode="IN"
> optional="true"/>
> <attribute name="orderCurrencyUnitPrice" type="BigDecimal"
> mode="IN" optional="true"/>
> </service>
>
> This modification resolves the issue completely and ensures robust
> handling across different Locales.
>
> Best regards,
> Tomek
>