Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0037201Openbravo ERP04. Warehouse managementpublic2017-10-31 16:012017-11-02 18:22
ngarcia 
dmiguelez 
urgentmajoralways
closedfixed 
5
 
3.0PR18Q1 
dmiguelez
Core
No
0037201: It is not possible to remove negative stock if it exists in more than one warehouse of the same organization
It is not possible to remove negative stock if it exists in more than one warehouse of the same organization

You need for instance Openbravo For Retail to obtain negative stock without allowing it

M_CHECK_STOCK database function is checking if the product has negative stock in the m_storage_detail table filtering by organization. Analyze which filter should be used for checking it: storage bin, warehouse...
In an environment with Openbravo For Retail installed:

In the backend:
   Create a new warehouse for Vall Blanca Store
   Add a locator to it
   Set it's status to OverIssue = 'N' (not allowing negative stock)
   Change the status of all the storage bins of Vall Blanca Store Warehouse warehouse to OverIssue = 'N'. If you get an error that negative stock already exists, leave it as 0 with a physical inventory.
   Set both warehouses as on hand warehouses for Vall Blanca Store and set different priority to them. Remove others.
   Create a new product and add it to 'The White Valley Group Sale Price List' and 'White Valley Group Product List' assortment

In the POS:
   Create a new receipt, add the previously created product and complete it

In the backend:
   Check the goods shipment has been done for the warehouse with highest priority (lowest value in priority field)
   Change the priority of the warehouses in order to modify the order

In the POS:
   Log out and log in again
   Create a new receipt, add the previously created product and complete it

In the backend:
   Check the goods shipment has been done for the warehouse with highest priority (different than the previous one)

At this moment we have negative stock of the same product in two different warehouses of the same organization

Try to increase the stock of one of the warehouses by different documents such as physical inventory, goods movement or goods receipt
Check the following error message is shown:

Insufficient stock for Product <> with UOM <> and Storage Bin <>

You should increase the stock on all the warehouses at once. In documents with warehouse at header level it could cause inconsistent data
No tags attached.
related to defect 0035009 closed collazoandy4 in m_storage_detail, the organization should not be updated 
related to defect 0037168 closed dmiguelez Negative Stock can be obtained although the storage bin is defined as OverIssue = N (not allowing negative stock) 
Issue History
2017-10-31 16:01ngarciaNew Issue
2017-10-31 16:01ngarciaAssigned To => Triage Finance
2017-10-31 16:01ngarciaModules => Core
2017-10-31 16:01ngarciaResolution time => 1511132400
2017-10-31 16:01ngarciaTriggers an Emergency Pack => No
2017-10-31 17:25ngarciaDescription Updatedbug_revision_view_page.php?rev_id=16215#r16215
2017-10-31 17:25ngarciaIssue Monitored: networkb
2017-10-31 17:26ngarciaRelationship addedrelated to 0035009
2017-11-02 13:08dmiguelezRelationship addedrelated to 0037168
2017-11-02 13:25dmiguelezAssigned ToTriage Finance => dmiguelez
2017-11-02 16:40dmiguelezNote Added: 0100221
2017-11-02 17:03dmiguelezStatusnew => scheduled
2017-11-02 18:21dmiguelezNote Added: 0100230
2017-11-02 18:21dmiguelezStatusscheduled => resolved
2017-11-02 18:21dmiguelezFixed in SCM revision => https://code.openbravo.com/erp/devel/pi/rev/a3731e13318b [^]
2017-11-02 18:21dmiguelezResolutionopen => fixed
2017-11-02 18:21dmiguelezNote Added: 0100231
2017-11-02 18:21dmiguelezFixed in Version => 3.0PR18Q1
2017-11-02 18:22dmiguelezReview Assigned To => dmiguelez
2017-11-02 18:22dmiguelezNote Added: 0100234
2017-11-02 18:22dmiguelezStatusresolved => closed

Notes
(0100221)
dmiguelez   
2017-11-02 16:40   
Test Plan:

1. Prepare scenario:

In an environment with Openbravo For Retail installed:

In the backend:
   Create a new warehouse for Vall Blanca Store
   Add a locator to it
   Set it's status to OverIssue = 'N' (not allowing negative stock)
   Change the status of all the storage bins of Vall Blanca Store Warehouse warehouse to OverIssue = 'N'. If you get an error that negative stock already exists, leave it as 0 with a physical inventory.
   Set both warehouses as on hand warehouses for Vall Blanca Store and set different priority to them. Remove others.
   Create a new product and add it to 'The White Valley Group Sale Price List' and 'White Valley Group Product List' assortment

In the POS:
   Create a new receipt, add the previously created product and complete it

In the backend:
   Check the goods shipment has been done for the warehouse with highest priority (lowest value in priority field)
   Change the priority of the warehouses in order to modify the order

In the POS:
   Log out and log in again
   Create a new receipt, add the previously created product and complete it

In the backend:
   Check the goods shipment has been done for the warehouse with highest priority (different than the previous one)

At this moment we have negative stock of the same product in two different warehouses of the same organization

2. Physical Inventory (first follow Prepare Scenario steps):

Create a new Physical Inventory for any of the Warehouses with negative Stock of the Product
Create a new Line and set booked quantity = 0
Process the Physical Inventory.
Process completed successfully.

3. Goods Receipt (first follow Prepare Scenario steps):

Create a new Goods Receipt for any of the Warehouses with negative Stock of the Product
Create a new Line with quantity = 1
Process the Goods Receipt
Process completed successfully

4. Goods Movement (first follow Prepare Scenario steps):

First, create a new Physical Inventory to create positive Stock for the Product for any of the two Warehouses
Now, there is positive Stock in one Warehouse and negative stock in the other.

Create a new Goods Movement.
Create a line in which Stock is moved from the Warehouse with positive Stock to the Warehouse with negative Stock.

Try to move more quantity than available Stock.
When completing the Goods Movement it fails.

Try to move the same quantity as the available Stock.
The Goods Movement can be completed successfully.
(0100230)
dmiguelez   
2017-11-02 18:21   
https://code.openbravo.com/erp/devel/pi/rev/a3731e13318b [^]
(0100231)
dmiguelez   
2017-11-02 18:21   
Related to Issue:

https://code.openbravo.com/erp/devel/pi/rev/e0ae38b3f82b [^]
(0100234)
dmiguelez   
2017-11-02 18:22   
Code Review + Testing Ok