Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0039073Openbravo ERP03. Procurement managementpublic2018-07-31 10:492018-08-20 14:42
ngarcia 
markmm82 
urgentmajoralways
closedfixed 
5
 
3.0PR18Q4 
Sandrahuguet
Core
No
0039073: NullPointerException in SL_RequisitionLine_Product callout if product is not selected in Requisition line
NullPointerException in SL_RequisitionLine_Product callout if product is not selected in Requisition line
As system admin role:
   Set 'Enable UOM Management' preference to 'Y

As group admin role:
   Create a Requisition
   Add a line to it
   Do not select a product
   Select a Price List

   Check the following error is shown in the log:
ERROR org.openbravo.client.application.window.FormInitializationComponent - TabId:800251 - Mode:CHANGE - rowId:null
org.openbravo.base.exception.OBException: Couldn't execute callout (class org.openbravo.erpCommon.ad_callouts.SL_RequisitionLine_Product)
...
Caused by: java.lang.NullPointerException
    at org.openbravo.materialmgmt.UOMUtil.getDefaultAUMForFlow(UOMUtil.java:126)
    at org.openbravo.materialmgmt.UOMUtil.getDefaultAUMForPurchase(UOMUtil.java:110)
    at org.openbravo.erpCommon.ad_callouts.SL_RequisitionLine_Product.execute(SL_RequisitionLine_Product.java:126)
No tags attached.
has duplicate defect 0039406pi closed AtulOpenbravo Product Callout in Requisition Line can throw a Null Pointer when "UomManagement" preference is enabled. 
Issue History
2018-07-31 10:49ngarciaNew Issue
2018-07-31 10:49ngarciaAssigned To => Triage Finance
2018-07-31 10:49ngarciaModules => Core
2018-07-31 10:49ngarciaTriggers an Emergency Pack => No
2018-07-31 10:53ngarciaIssue Monitored: networkb
2018-07-31 11:36ngarciaResolution time => 1534802400
2018-07-31 13:00SandrahuguetAssigned ToTriage Finance => markmm82
2018-07-31 15:15markmm82Statusnew => scheduled
2018-07-31 16:05markmm82Note Added: 0106059
2018-08-17 14:51hgbotCheckin
2018-08-17 14:51hgbotNote Added: 0106389
2018-08-17 14:51hgbotStatusscheduled => resolved
2018-08-17 14:51hgbotResolutionopen => fixed
2018-08-17 14:51hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/446b08330250484960ab9b786410e6cef630e3ae [^]
2018-08-17 14:56SandrahuguetReview Assigned To => Sandrahuguet
2018-08-17 14:56SandrahuguetNote Added: 0106390
2018-08-17 14:56SandrahuguetStatusresolved => closed
2018-08-17 14:56SandrahuguetFixed in Version => 3.0PR18Q4
2018-08-20 14:42hudsonbotCheckin
2018-08-20 14:42hudsonbotNote Added: 0106415
2018-11-15 07:54AtulOpenbravoRelationship addedhas duplicate 0039406

Notes
(0106059)
markmm82   
2018-07-31 16:05   
Test PLan:
As system admin role:
   Set 'Enable UOM Management' preference to 'Y

As group admin role:
   Create a Requisition
   Add a line to it
   Do not select a product
   Select a Price List.
     Notice in the Eclipse console there aren't any exception logged.
   Don't save the line

   Add a new line to it
   This time select Cerveza Ale product (be sure it hasn't any AUM defined first)
    Notice the Alternative UOM has been automatically populated with the default UOM,
    in this case the product UOM because (Unit) it hasn't any AUM defined.
   Clean the ALternative UOM field and don't select any UOM.
   Select a Price List.
     Notice in the Eclipse console there aren't any exception logged and the Alternative UOM has been changed again to use Unit as it AUM.

   Go to Cerveza Ale product and add a new Alternate UOM
     UOM = Liter
     Conversion Rate = 0.5
     Sales = Purchase = Logistics = Primary

  Go back to the Requisition previously created and create a new line.
  Select Cerveza Ale product
  Notice the Alternative UOM has been automatically populated with the default Liter UOM
  Set 10 as Operative Quantity, check it represents 5 Units (In Quantity field)
  Clean the ALternative UOM field and don't select any UOM.
  Select a Price List.
     Notice in the Eclipse console there aren't any exception logged and the Alternative UOM has been changed again to use Liter as it default AUM.
(0106389)
hgbot   
2018-08-17 14:51   
Repository: erp/devel/pi
Changeset: 446b08330250484960ab9b786410e6cef630e3ae
Author: Mark <markmm82 <at> gmail.com>
Date: Tue Jul 31 10:05:27 2018 -0500
URL: http://code.openbravo.com/erp/devel/pi/rev/446b08330250484960ab9b786410e6cef630e3ae [^]

Fixed issue 39073:Fix NullPointerException in SL_RequisitionLine_Product callout
if product is not selected in Requisition line.

If the product wasn't selected then a NPE was thrown because was trying to get the
default AUM for an empty Product ID.

It is included a new condition validating that a product is selected and it is
not empty to avoid try to get a default AUM for an empty product and throw a NPE.

---
M src/org/openbravo/erpCommon/ad_callouts/SL_RequisitionLine_Product.java
---
(0106390)
Sandrahuguet   
2018-08-17 14:56   
Code review + testing OK
(0106415)
hudsonbot   
2018-08-20 14:42   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/4f7d5fed140f [^]
Maturity status: Test