Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0042040Openbravo ERP04. Warehouse managementpublic2019-10-16 13:442019-12-12 23:01
ngarcia 
markmm82 
urgentmajoralways
closedfixed 
5
 
3.0PR20Q1 
Sandrahuguet
Core
No
0042040: Cannot print to PDF the Valued Stock Report if there exists a transaction in which the cost is not calculated
Cannot print to PDF the Valued Stock Report if there exists a transaction in which cost is not calculated.

The problem is in the following line of ReportValuationStock class:

spc.addCost(new BigDecimal(row.totalCost));

As the select query in ReportValuationStock_data.xsql is returning a null value in the total_cost column
As group admin role:
   Go to Process Request window and unschedule the costing background process
   Create a goods receipt, add a product and complete it
   Go to Valued Stock Report and filter it by the goods receipt organization and warehouse
   Check the product included in the goods receipt is shown with the UNIT COST and VALUATION columns empty and the following warning is shown:

Transactions with no available cost found

   Try to export it to PDF (Print record toolbar button) and check the following error is shown:
      java.lang.NumberFormatException

The log shows:

ERROR org.openbravo.erpCommon.ad_reports.ReportValuationStock - Error captured:
java.lang.NumberFormatException: null
    at java.math.BigDecimal.<init>(BigDecimal.java:624) ~[?:?]
    at java.math.BigDecimal.<init>(BigDecimal.java:401) ~[?:?]
    at java.math.BigDecimal.<init>(BigDecimal.java:834) ~[?:?]
    at org.openbravo.erpCommon.ad_reports.ReportValuationStock.printPageDataPDF(ReportValuationStock.java:473) ~[classes/:?]
    at org.openbravo.erpCommon.ad_reports.ReportValuationStock.buildData(ReportValuationStock.java:243) ~[classes/:?]
    at org.openbravo.erpCommon.ad_reports.ReportValuationStock.doPost(ReportValuationStock.java:122) ~[classes/:?]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:661) ~[tomcat8-servlet-api-8.5.39.jar:?]
No tags attached.
Issue History
2019-10-16 13:44ngarciaNew Issue
2019-10-16 13:44ngarciaAssigned To => Triage Finance
2019-10-16 13:44ngarciaModules => Core
2019-10-16 13:44ngarciaResolution time => 1572994800
2019-10-16 13:44ngarciaTriggers an Emergency Pack => No
2019-10-16 15:08SandrahuguetAssigned ToTriage Finance => markmm82
2019-10-17 01:29markmm82Statusnew => scheduled
2019-10-17 02:11markmm82Note Added: 0115131
2019-10-18 08:39hgbotCheckin
2019-10-18 08:39hgbotNote Added: 0115156
2019-10-18 08:39hgbotStatusscheduled => resolved
2019-10-18 08:39hgbotResolutionopen => fixed
2019-10-18 08:39hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/52830302ff4b99b0ae2ba69dab6d1ae8bdaa5427 [^]
2019-10-18 08:45SandrahuguetReview Assigned To => Sandrahuguet
2019-10-18 08:45SandrahuguetNote Added: 0115157
2019-10-18 08:45SandrahuguetStatusresolved => closed
2019-10-18 08:45SandrahuguetFixed in Version => 3.0PR20Q1
2019-12-12 23:01hudsonbotCheckin
2019-12-12 23:01hudsonbotNote Added: 0116255

Notes
(0115131)
markmm82   
2019-10-17 02:11   
Test Plan:
As group admin role:
   Go to Process Request window and unschedule the costing background process.
   Create a goods receipt header:
     Organization = F&B España - Región Sur,
     Warehouse = España Región Sur
     Business Partner = Bebidas Alegres, S.L.
   Add a line to it:
     Product = Cola de Cereza 0,5L
     Qty = 100
   Complete it
   Go to Valued Stock Report and filter it by the goods receipt organization and warehouse:
     Organization = F&B España - Región Sur,
     Warehouse = España Región Sur
   Export as HTML Format.
     Notice there is an entry with the product included in the goods receipt (Cola de Cereza 0,5L). It is shown with the UNIT COST and VALUATION columns empty, and with quantity as 100.
     Notice a warning is shown:
      "Transactions with no available cost found"

   Try to export it to PDF (Print record toolbar button) and check the document is generated successfully.
   Open the exported PDF.
      Notice there is an entry with the product included in the goods receipt (Cola de Cereza 0,5L). It is shown with the UNIT COST and VALUATION columns empty, and with quantity as 100.


   Go to Process Request window and reschedule the costing background process to be run immediately.
   Go back to the report and execute it again with the same filters as HTML.
     Notice that the entry for the product was updated with the calculated cost.
   Execute it again as PDF and notice the generated PDF has the same values than the report exported as HTML.
(0115156)
hgbot   
2019-10-18 08:39   
Repository: erp/devel/pi
Changeset: 52830302ff4b99b0ae2ba69dab6d1ae8bdaa5427
Author: Mark Molina <mark.molina <at> doceleguas.com>
Date: Wed Oct 16 21:18:08 2019 -0300
URL: http://code.openbravo.com/erp/devel/pi/rev/52830302ff4b99b0ae2ba69dab6d1ae8bdaa5427 [^]

Fixes issue 42040: Avoid NumberFormatException exporting as PDF Valued Stock Rep
ort if there exists a transaction in which the cost is not calculated

When there is a transaction without calculated cost the Valued Stock Report was failling
trying to export as PDF because the totalCost is got as an empty string and a NumberFormatException]
is thrown converting as BigDecimal. Fixed adding the totalCost if it was calculated (it
is not an empty value retrieved by the sql query)

---
M src/org/openbravo/erpCommon/ad_reports/ReportValuationStock.java
---
(0115157)
Sandrahuguet   
2019-10-18 08:45   
code review + testing ok
(0116255)
hudsonbot   
2019-12-12 23:01   
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/954d2b7a66fb [^]
Maturity status: Test