Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0036099Openbravo ERP04. Warehouse managementpublic2017-05-25 12:052017-05-29 17:43
ngarcia 
markmm82 
urgentmajoralways
closedfixed 
5
 
3.0PR17Q3 
aferraz
OBPS
Core
46891
No
0036099: Price Correction Background finishes with error if a goods receipt is invoiced after the costing migration process was run
Price Correction Background finishes with error if a goods receipt is invoiced after the costing migration process was run
Install the 3.0MP12.2 version

As group admin role:
   Go to Open/Close Period Control and open the current period (create it in
   Fiscal Calendar window if needed)
   Create a product
   Add a purchase price to it
   Add a valid average cost to it
   Create a purchase order and a goods receipt to it

Upgrade the instance to the last version

As group admin role (for each client):
   Open the current period for all the calendars in all the entities

As System admin role:
   Launch the Costing Migration Process
   If it finishes with the Transactions without cost error, set as inactive the Products with transactions without available cost on date alert
   Launch the Costing Migration Process again and check it finishes successfully

As group admin role (for each client):
   Process all the 'Cost Rule Opening Inventory' inventories
   Create a Purchase Invoice for the previously created Goods Receipt
   Go to Process Request window and schedule the Price Correction Background process
   Check it finishes with error and the log shows:
      
ERROR org.openbravo.service.db.DalBaseProcess - The process org.openbravo.costing.PriceDifferenceBackground has thrown an exception.
java.lang.NullPointerException
    at org.openbravo.costing.PriceDifferenceProcess.calculateTransactionPriceDifferenceLogic(PriceDifferenceProcess.java:57)
    at org.openbravo.costing.PriceDifferenceProcess.calculateTransactionPriceDifference(PriceDifferenceProcess.java:165)
    at org.openbravo.costing.PriceDifferenceProcess.processPriceDifference(PriceDifferenceProcess.java:238)
    at org.openbravo.costing.PriceDifferenceBackground.doExecute(PriceDifferenceBackground.java:50)
Check if transactions previous to the migration should be adjusted or not. The problem is that the transactions previous to the migration are generated without m_costing_algorithm_id and the c_invoice_post function in this case, sets the transaction as checkpricedifference = Y
No tags attached.
Issue History
2017-05-25 12:05ngarciaNew Issue
2017-05-25 12:05ngarciaAssigned To => Triage Finance
2017-05-25 12:05ngarciaOBNetwork customer => Yes
2017-05-25 12:05ngarciaModules => Core
2017-05-25 12:05ngarciaSupport ticket => 46891
2017-05-25 12:05ngarciaResolution time => 1497477600
2017-05-25 12:05ngarciaTriggers an Emergency Pack => No
2017-05-25 12:06ngarciaIssue Monitored: networkb
2017-05-25 13:07heccamIssue Monitored: heccam
2017-05-25 18:14aferrazNote Added: 0096819
2017-05-25 18:15aferrazAssigned ToTriage Finance => markmm82
2017-05-25 18:46markmm82Statusnew => scheduled
2017-05-25 20:56markmm82Note Added: 0096822
2017-05-26 08:36hgbotCheckin
2017-05-26 08:36hgbotNote Added: 0096833
2017-05-26 08:36hgbotStatusscheduled => resolved
2017-05-26 08:36hgbotResolutionopen => fixed
2017-05-26 08:36hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/13966655c3a8c66f12d3e4aa74ece452756e2826 [^]
2017-05-26 08:38aferrazReview Assigned To => aferraz
2017-05-26 08:38aferrazNote Added: 0096834
2017-05-26 08:38aferrazStatusresolved => closed
2017-05-26 08:38aferrazFixed in Version => 3.0PR17Q3
2017-05-29 17:43hudsonbotCheckin
2017-05-29 17:43hudsonbotNote Added: 0096995

Notes
(0096819)
aferraz   
2017-05-25 18:14   
Transactions previous to the migration should not be adjusted.
Avoid NPE in PriceDifferenceProcess.calculateTransactionPriceDifferenceLogic:

// Without algorithm or with Standard Algorithm, no cost adjustment is needed
    if (materialTransaction.getCostingAlgorithm() == null
        || StringUtils.equals(materialTransaction.getCostingAlgorithm().getJavaClassName(),
            "org.openbravo.costing.StandardAlgorithm")) {
      return false;
    }
(0096822)
markmm82   
2017-05-25 20:56   
Test Plan:

Install the 3.0MP12.2 version

As group admin role:
   Go to Open/Close Period Control and open the current period (create it in
   Fiscal Calendar window if needed)
   Create a product
   Add a purchase price to it
   Add a valid average cost to it
   Create a purchase order and a goods receipt to it

Upgrade the instance to the last version

As group admin role (for each client):
   Open the current period for all the calendars in all the entities

As System admin role:
   Launch the Costing Migration Process
   If it finishes with the Transactions without cost error, set as inactive the Products with transactions without available cost on date alert
   Launch the Costing Migration Process again and check it finishes successfully

As group admin role (for each client):
   Process all the 'Cost Rule Opening Inventory' inventories
   Create a Purchase Invoice for the previously created Goods Receipt
   Go to Process Request window and schedule the Price Correction Background process
   Check it finishes with SUCCESS message.
(0096833)
hgbot   
2017-05-26 08:36   
Repository: erp/devel/pi
Changeset: 13966655c3a8c66f12d3e4aa74ece452756e2826
Author: Mark <markmm82 <at> gmail.com>
Date: Thu May 25 13:16:54 2017 -0400
URL: http://code.openbravo.com/erp/devel/pi/rev/13966655c3a8c66f12d3e4aa74ece452756e2826 [^]

Fixes issue 36099: Price Correction Background finishes with error
if a goods receipt is invoiced after the costing migration process was run

Price Correction Background finishes with error if a goods receipt is invoiced
after the costing migration process was run. The problem is that the transactions
previous to the migration are generated without m_costing_algorithm_id and the
c_invoice_post function in this case, sets the transaction as checkpricedifference = Y.

To fix that, transactions previous to the migration will not be adjusted.
To avoid NPE in PriceDifferenceProcess.calculateTransactionPriceDifferenceLogic
was included a validation taking into account all explained above.

---
M src/org/openbravo/costing/PriceDifferenceProcess.java
---
(0096834)
aferraz   
2017-05-26 08:38   
Code review OK
(0096995)
hudsonbot   
2017-05-29 17:43   
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/1ee70113bdc4 [^]
Maturity status: Test