Openbravo Issue Tracking System - Openbravo ERP |
View Issue Details |
|
ID | Project | Category | View Status | Date Submitted | Last Update |
0032364 | Openbravo ERP | 09. Financial management | public | 2016-02-26 13:57 | 2016-03-17 10:56 |
|
Reporter | ngarcia | |
Assigned To | AtulOpenbravo | |
Priority | immediate | Severity | minor | Reproducibility | always |
Status | closed | Resolution | fixed | |
Platform | | OS | 5 | OS Version | |
Product Version | | |
Target Version | | Fixed in Version | 3.0PR16Q2 | |
Merge Request Status | |
Review Assigned To | aferraz |
OBNetwork customer | |
Web browser | |
Modules | Core |
Support ticket | |
Regression level | Production - Confirmed Stable |
Regression date | 2014-09-02 |
Regression introduced in release | 3.0PR14Q4 |
Regression introduced by commit | https://code.openbravo.com/erp/devel/pi/rev/69108bf7103b [^] |
Triggers an Emergency Pack | No |
|
Summary | 0032364: NullPointerException when posting a Physical Inventory with a line without an associated transaction (not stocked product) |
Description | NullPointerException when posting a Physical Inventory with a line without an associated transaction (not stocked product) |
Steps To Reproduce | In an instance without the following issue solved:
https://issues.openbravo.com/view.php?id=31835 [^]
As group admin role:
Create a new product and set is as Stocked = 'Y'
Create a goods receipt to increase its stock
Create a goods shipment to leave its stock to 0
Set it as Stocked = 'N' (it will not possible after the fix of 31835)
Create a Physical inventory for the same warehouse the stock was received in
Launch the Create Inventory Count with the option of Inventory Quantity empty
Check the product is not inserted
Launch the Create Inventory Count with the option of Inventory Quantity = 0
Check the product is inserted and it shouldn't
Process the inventory
Try to post it and check the following error message is shown:
Process failed during execution
The logs shows:
WARN org.openbravo.erpCommon.ad_forms.AcctServer - Accounting process failed. RecordID: 0E718DFD7B384111B2D2112722FCFF8B - TableId: 321
java.lang.NullPointerException
at org.openbravo.erpCommon.ad_forms.DocInventory.createFact(DocInventory.java:183)
at org.openbravo.erpCommon.ad_forms.AcctServer.postLogic(AcctServer.java:1111)
at org.openbravo.erpCommon.ad_forms.AcctServer.post(AcctServer.java:804)
at org.openbravo.erpCommon.ad_forms.AcctServer.post(AcctServer.java:719)
at org.openbravo.erpCommon.ad_actionButton.Posted.processButton(Posted.java:273)
at org.openbravo.erpCommon.ad_actionButton.Posted.doPost(Posted.java:104) |
Proposed Solution | The problem is in the following code:
if ("NC".equals(line.transaction.getCostingStatus())) {
setStatus(STATUS_NotCalculatedCost);
}
but it will also fail in the following:
if (line.transaction.getTransactionCost() != null
&& line.transaction.getTransactionCost().compareTo(ZERO) == 0) {
countInvLinesWithTrnCostZero++;
}
as line.transaction is null
Apart from that, the Create Inventory Count process should avoid inserting not stocked products (check the solution of the 30697 issue) |
Additional Information | |
Tags | No tags attached. |
Relationships | related to | defect | 0030697 | | closed | AtulOpenbravo | Create Inventory Count List inserts inactive products | related to | defect | 0031835 | 3.0PR16Q2 | closed | aferraz | Not possible to change the product definition to Stocked under some circumstancies | depends on | backport | 0032372 | 3.0PR16Q1 | closed | AtulOpenbravo | NullPointerException when posting a Physical Inventory with a line without an associated transaction (not stocked product) | depends on | backport | 0032373 | 3.0PR15Q4.5 | closed | AtulOpenbravo | NullPointerException when posting a Physical Inventory with a line without an associated transaction (not stocked product) |
|
Attached Files | |
|
Issue History |
Date Modified | Username | Field | Change |
2016-02-26 13:57 | ngarcia | New Issue | |
2016-02-26 13:57 | ngarcia | Assigned To | => Triage Finance |
2016-02-26 13:57 | ngarcia | Modules | => Core |
2016-02-26 13:57 | ngarcia | Resolution time | => 1459461600 |
2016-02-26 13:57 | ngarcia | Triggers an Emergency Pack | => No |
2016-02-26 13:57 | ngarcia | Issue Monitored: networkb | |
2016-02-26 13:57 | ngarcia | Relationship added | related to 0030697 |
2016-02-26 13:59 | ngarcia | Relationship added | related to 0031385 |
2016-02-26 14:00 | ngarcia | Proposed Solution updated | |
2016-02-26 14:00 | ngarcia | Relationship deleted | related to 0031385 |
2016-02-26 14:00 | ngarcia | Relationship added | related to 0031835 |
2016-02-26 14:15 | vmromanos | Note Added: 0084570 | |
2016-02-26 14:17 | vmromanos | Note Added: 0084572 | |
2016-02-26 14:17 | vmromanos | Severity | major => minor |
2016-02-29 08:58 | AtulOpenbravo | Assigned To | Triage Finance => AtulOpenbravo |
2016-02-29 13:18 | psanjuan | Steps to Reproduce Updated | bug_revision_view_page.php?rev_id=11271#r11271 |
2016-02-29 14:01 | AtulOpenbravo | Status | new => scheduled |
2016-02-29 14:22 | AtulOpenbravo | Note Added: 0084593 | |
2016-02-29 14:42 | AtulOpenbravo | Regression date | => 2014-09-02 |
2016-02-29 14:42 | AtulOpenbravo | Regression introduced in release | => 3.0PR14Q4 |
2016-02-29 14:42 | AtulOpenbravo | Regression introduced by commit | => https://code.openbravo.com/erp/devel/pi/rev/69108bf7103b [^] |
2016-02-29 15:43 | psanjuan | Note Added: 0084600 | |
2016-02-29 15:46 | psanjuan | Note Edited: 0084600 | bug_revision_view_page.php?bugnote_id=0084600#r11275 |
2016-02-29 15:46 | psanjuan | Note Edited: 0084600 | bug_revision_view_page.php?bugnote_id=0084600#r11276 |
2016-02-29 15:46 | psanjuan | Note Edited: 0084600 | bug_revision_view_page.php?bugnote_id=0084600#r11277 |
2016-03-01 12:16 | psanjuan | Note Edited: 0084593 | bug_revision_view_page.php?bugnote_id=0084593#r11285 |
2016-03-01 12:23 | psanjuan | Note Edited: 0084593 | bug_revision_view_page.php?bugnote_id=0084593#r11286 |
2016-03-01 12:29 | psanjuan | Note Edited: 0084593 | bug_revision_view_page.php?bugnote_id=0084593#r11287 |
2016-03-01 12:29 | psanjuan | Note Added: 0084616 | |
2016-03-01 12:34 | psanjuan | Note Edited: 0084593 | bug_revision_view_page.php?bugnote_id=0084593#r11288 |
2016-03-01 13:53 | aferraz | Regression level | => Production - Confirmed Stable |
2016-03-01 18:29 | hgbot | Checkin | |
2016-03-01 18:29 | hgbot | Note Added: 0084640 | |
2016-03-01 18:29 | hgbot | Status | scheduled => resolved |
2016-03-01 18:29 | hgbot | Resolution | open => fixed |
2016-03-01 18:29 | hgbot | Fixed in SCM revision | => http://code.openbravo.com/erp/devel/pi/rev/e86c0df009cf91238c0eec3f6d44c8a5c194629d [^] |
2016-03-01 18:29 | hgbot | Checkin | |
2016-03-01 18:29 | hgbot | Note Added: 0084641 | |
2016-03-01 18:30 | aferraz | Review Assigned To | => aferraz |
2016-03-01 18:30 | aferraz | Note Added: 0084642 | |
2016-03-01 18:30 | aferraz | Status | resolved => closed |
2016-03-01 18:30 | aferraz | Fixed in Version | => 3.0PR16Q2 |
2016-03-17 10:56 | hudsonbot | Checkin | |
2016-03-17 10:56 | hudsonbot | Note Added: 0085175 | |
2016-03-17 10:56 | hudsonbot | Checkin | |
2016-03-17 10:56 | hudsonbot | Note Added: 0085176 | |
Notes |
|
|
Proposed solution:
for (int i = 0; i < p_lines.length; i++) {
DocLine_Material line = (DocLine_Material) p_lines[i];
if (line.transaction != null && "NC".equals(line.transaction.getCostingStatus())) {
setStatus(STATUS_NotCalculatedCost);
}
if (line.transaction == null
|| (line.transaction != null && line.transaction.getTransactionCost() != null && line.transaction
.getTransactionCost().compareTo(ZERO) == 0)) {
countInvLinesWithTrnCostZero++;
}
}
M_INVENTORY_LISTCREATE -> Avoid to insert non-stocked products |
|
|
|
Decreased to minor as this is not a common scenario, but a consequence of another issue |
|
|
(0084593)
|
AtulOpenbravo
|
2016-02-29 14:22
(edited on: 2016-03-01 12:34) |
|
Test Plan I
- In an instance prior to fix for issue 31835.
- Login as Group Admin role:
- Create a new product and set is as Stocked = 'Y'
- Create a goods receipt to increase its stock
- Create a goods shipment to leave its stock to 0
- Set it as Stocked = 'N'.
- Create a Physical inventory for the same warehouse the stock was received in.
- Launch the Create Inventory Count with the option of Inventory Quantity empty.
- Check the product is NOT inserted.
- Remove all lines
- Launch the Create Inventory Count with the option of Inventory Quantity = 0.
- Check that product is NOT inserted.
- Remove all lines
- Launch the Create Inventory Count for rest of the options and check that the product is NOT inserted.
- Change the Quantity Count for any of the products included in any physical inventory. Process and Post it, once the cost of the product for which quantity count has changed has been calculated. Check that it is possible to process and post physical inventory without any problem.Book
Test Plan I
- In an instance prior to fix for issue 31835.
- Login as Group Admin role:
- Create a new product and set is as Stocked = 'Y'
- Create a goods receipt to increase its stock
- Create a goods shipment to leave its stock to 0
- Create a Physical inventory for the same warehouse the stock was received in.
- Launch the Create Inventory Count with the option of Inventory Quantity empty.
- Check the product is inserted.
- Remove all lines
- Launch the Create Inventory Count with the option of Inventory Quantity = 0.
- Check that product is inserted.
- Remove all lines
- Launch the Create Inventory Count with the option < 0, and check that the product is not inserted.
- Remove all lines
- Launch the Create Inventory Count with the option > 0, and check that the product is not inserted.
- Remove all lines
- Launch the Create Inventory Count with the option not 0, and check that the product is not inserted.
- Change the Quantity Count for any of the products included in any physical inventory. Process it and Post it, once the cost of the product for which quantity count has changed has been calculated. Check that it is possible to process and post physical inventory without any problem.
Verified also issue related 30697 for products set as "Inactive".
|
|
|
(0084600)
|
psanjuan
|
2016-02-29 15:43
(edited on: 2016-02-29 15:46) |
|
Issue verified if improving repro steps as described below:
As group admin role:
Create a new product and set is as Stocked = 'Y'.
Select a Purchase Price List.
Create a goods receipt to increase its stock
Create a goods shipment to leave its stock to 0
Set it as Stocked = 'N'
Create a Physical inventory for the same warehouse the stock was received in
Launch the Create Inventory Count with the option of Inventory Quantity empty
Check that the product is inserted, while it should not.
Launch the Create Inventory Count with the option of Inventory Quantity = 0
Check that the product is inserted and it shouldn't
Remove all lines but the one related to the product.
Change Quantity Count to 1, therefore physical inventory is suitable to be post to the ledger.
Process the inventory
Try to post it and check the following error message is shown:
Process failed during execution
The logs shows:
WARN org.openbravo.erpCommon.ad_forms.AcctServer - Accounting process failed. RecordID: 0E718DFD7B384111B2D2112722FCFF8B - TableId: 321
java.lang.NullPointerException
at org.openbravo.erpCommon.ad_forms.DocInventory.createFact(DocInventory.java:183)
at org.openbravo.erpCommon.ad_forms.AcctServer.postLogic(AcctServer.java:1111)
at org.openbravo.erpCommon.ad_forms.AcctServer.post(AcctServer.java:804)
at org.openbravo.erpCommon.ad_forms.AcctServer.post(AcctServer.java:720)
at org.openbravo.erpCommon.ad_actionButton.Posted.processButton(Posted.java:273)
at org.openbravo.erpCommon.ad_actionButton.Posted.doPost(Posted.java:104)
|
|
|
|
Test Plan above verified.
Issue can be code reviewed and closed. |
|
|
(0084640)
|
hgbot
|
2016-03-01 18:29
|
|
Repository: erp/devel/pi
Changeset: e86c0df009cf91238c0eec3f6d44c8a5c194629d
Author: Atul Gaware <atul.gaware <at> openbravo.com>
Date: Mon Feb 29 17:00:12 2016 +0530
URL: http://code.openbravo.com/erp/devel/pi/rev/e86c0df009cf91238c0eec3f6d44c8a5c194629d [^]
Fixes Issue 32364:NullPointerException when posting a Physical Inventory
with a line without an associated transaction (not stocked product)
- Avoid insertion of zero quantity products in inventory line having
stocked flag as No.
- Code improvement to handle line with null transaction.
---
M src-db/database/model/functions/M_INVENTORY_LISTCREATE.xml
M src/org/openbravo/erpCommon/ad_forms/DocInventory.java
---
|
|
|
(0084641)
|
hgbot
|
2016-03-01 18:29
|
|
Repository: erp/devel/pi
Changeset: 88faf8e87290b8b87f07cdb382e06930e30321fd
Author: Alvaro Ferraz <alvaro.ferraz <at> openbravo.com>
Date: Tue Mar 01 18:02:57 2016 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/88faf8e87290b8b87f07cdb382e06930e30321fd [^]
Related to issue 32364: Code review improvements
Call line.getProductCosts only when line.transaction != null in DocInventory.java.
---
M src/org/openbravo/erpCommon/ad_forms/DocInventory.java
---
|
|
|
|
|
|
|
|
|
|
|