Hi Tomek, Thank you for reporting this. I can confirm this is indeed a bug.
The availableToPromiseTotal field is defined as a fixed-point type in the entity model, which translates to a BigDecimal at runtime. Comparing it against the String "0" can lead to database parsing errors and type mismatch exceptions. Your proposed fix is correct, with a couple of minor adjustments for Java syntax and imports: - Use the capitalized constant BigDecimal.ZERO (instead of BigDecimal.Zero). - Add the import import java.math.BigDecimal; to the top of FixedAssetMaintServices.java Please create a ticket on Jira and attach the patch with your fix. Regards, Arun Patidar On Fri, Jun 26, 2026 at 4:29 PM Tomek <[email protected]> wrote: > I have found a bug in the assetmaint plugin, specifically in the > following file: > > > assetmaint/src/main/java/org/apache/ofbiz/assetmaint/FixedAssetMaintServices.java > > Problematic code fragment: > > EntityConditionList<EntityExpr> ecl = > EntityCondition.makeCondition(UtilMisc.toList( > EntityCondition.makeCondition("productId", > EntityOperator.EQUALS, productId), > EntityCondition.makeCondition("facilityId", > EntityOperator.EQUALS, facilityId), > EntityCondition.makeCondition("availableToPromiseTotal", > EntityOperator.GREATER_THAN, "0")), // Here is the bug > EntityOperator.AND); > > Proposed fix: > > EntityConditionList<EntityExpr> ecl = > EntityCondition.makeCondition(UtilMisc.toList( > EntityCondition.makeCondition("productId", > EntityOperator.EQUALS, productId), > EntityCondition.makeCondition("facilityId", > EntityOperator.EQUALS, facilityId), > EntityCondition.makeCondition("availableToPromiseTotal", > EntityOperator.GREATER_THAN, BigDecimal.Zero)), > EntityOperator.AND); > > Rationale: > > The availableToPromiseTotal field represents a numerical value (defined > as a fixed-point number in the entity model), not a String. Passing the > string "0" causes a type mismatch exception or a database parsing > failure at runtime. Replacing it with BigDecimal.ZERO resolves the issue. > > Best regards, > Tomek > >
