Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0036398Openbravo ERP09. Financial managementpublic2017-07-04 08:332017-07-11 10:14
0036398: Avoid casting to Object when adding numeric results from a SimpleCallout
Avoid casting to Object when adding numeric values from a SimpleCallout. Before the callout refactor project (see 0032366), to set the value of a quantity it was possible to do the following:

String strHasSecondaryUOM = SLOrderProductData.hasSecondaryUOM(this, strMProductID);
info.addResult("inphasseconduom", (Object) strHasSecondaryUOM);

With the previous API, this avoided to send the value of a String surrounded by quotes. Thus, the value was finally being interpreted as a numeric value.

With the changes introduced in the mentioned project the API is more compact and it is not necessary to surround the strings between quotes to specify a string value. Therefore such castings should not be done as the type of the values is managed internally with a JSONObject.

The callouts affected by this internal change are:

- src/org/openbravo/erpCommon/ad_callouts/
- src/org/openbravo/erpCommon/ad_callouts/
- src/org/openbravo/erpCommon/ad_callouts/
- Login as System Admin Role
- Mark as displayed = Yes fields
  - Window: Goods Receipt/ Shipment, Tab: Lines, Fields: Order Quantity, Order Uom
  - Window: Goods Movement, Tab: Lines, Fields: Order Quantity, Order Uom
- Window: Physical Inventory, Tab: Lines, Fields: Order Quantity, Order Uom
- Logout
- Login as QA Testing Admin.
- Create a new Product "Test Product".
- Assign second UOM as Kilogram to "Test Product" in the UOM Tab
- Create a Goods Receipt
- Add a line and select the Test Product, enter Movement Quantity 1
- Realize that Order Uom and Order Quantity fields are not displayed.
- Save Record and Refresh (as Display Logic does not work)
- Realize that Order Uom and Order Quantity fields are displayed.

Note that the display logic is not working because of the fact that the display logic condition is expecting a numeric value. But a string is being sent:

info.addResult("inphasseconduom", (Object) strHasSecondaryUOM);
Replace the castings to Object in the mentioned callouts by sending the corresponding numeric value when it applies. For example

Instead of:

info.addResult("inphasseconduom", (Object) strHasSecondaryUOM);


info.addResult("inphasseconduom", Integer.parseInt(strHasSecondaryUOM));
No tags attached.
blocks defect 0036392 closed collazoandy4 Avoid casting to Object when adding numeric results from a SimpleCallout 
Issue History
2017-07-04 12:15aferrazTypedefect => backport
2017-07-04 12:15aferrazTarget Version => 3.0PR17Q2.2
2017-07-10 13:33hgbotCheckin
2017-07-10 13:33hgbotNote Added: 0097977
2017-07-10 13:33hgbotStatusscheduled => resolved
2017-07-10 13:33hgbotResolutionopen => fixed
2017-07-10 13:33hgbotFixed in SCM revision => [^]
2017-07-11 10:14hgbotCheckin
2017-07-11 10:14hgbotNote Added: 0098007
2017-07-11 10:14aferrazReview Assigned To => aferraz
2017-07-11 10:14aferrazNote Added: 0098009
2017-07-11 10:14aferrazStatusresolved => closed
2017-07-11 10:14aferrazFixed in Version => 3.0PR17Q2.2

2017-07-10 13:33   
Repository: erp/backports/3.0PR17Q2.2
Changeset: c16287afa86302c7afec2c12f5ff25687ea161a6
Author: Armaignac <collazoandy4 <at>>
Date: Mon Jul 10 12:49:45 2017 +0200
URL: [^]

Fixes issue 36398: Avoid casting when adding numeric results in SimpleCallout

The casting to Object was replace by a integer conversion, sending the
corresponding numeric value when it applies.

M src/org/openbravo/erpCommon/ad_callouts/
M src/org/openbravo/erpCommon/ad_callouts/
M src/org/openbravo/erpCommon/ad_callouts/
2017-07-11 10:14   
Repository: erp/backports/3.0PR17Q2.2
Changeset: a34de04047ed76d88313e744bc729d5d433848bd
Author: Armaignac <collazoandy4 <at>>
Date: Mon Jul 10 15:08:05 2017 -0400
URL: [^]

Related to issue 36398: Hide secondUOM fields if product doesn't have secondUOM

When a product with a second UOM was selected the associated fields are shown,
but not hidden when the product is change and doesn't have a second UOM because
the has_second_uom var is not updated with the corresponding value according
to the product selection.

The value of has_second_uom var is updated according to the product selection
in the result for a correct use in display logic function.

M src/org/openbravo/erpCommon/ad_callouts/
2017-07-11 10:14   
Code review + Testing OK