Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0029539Openbravo ERP04. Warehouse managementpublic2015-04-09 09:372015-05-07 22:16
dmiguelez 
dmiguelez 
normalmajoralways
closedfixed 
20Community Appliance
 
3.0PR15Q3 
Sandrahuguet
Core
No
0029539: Issues in Reservations related to Reallocate Stock functionality
There is an issue in Reservations related to Reallocate Stock functionality.
In the Procedures M_RESERVATION_REALLOCATE and M_RESERVE_STOCK_AUTO there is a wrong call to the function M_GET_STOCK_PARAM.
There is a parameter that should send the Reservation_ID but it is sending a null value instead.

By fixing this issue, another one is raised.

Under some circumstances, it is possible to create a situation in which there is more reserved stock than available stock.

To reproduce this issue it is needed to create a situation like this:
Product ----- Lot ------ qtyonhand ----- reservedqty ----- allocatedqty
Test -------- 0001 ----- 10 ------------ 5 --------------- 0
Test -------- 0002 ----- 10 ------------ 10 -------------- 0

By generating a PickList for an Outbound Location, it will generate the issue:
Product ----- Lot ------ qtyonhand ----- reservedqty ----- allocatedqty
Test -------- 0001 ----- 10 ------------ 15 -------------- 10
Test -------- 0002 ----- 0 ------------- 0 --------------- 0
1. Create new Product

  Go to Product Window and create a new record
     Organization: F&B US
     SearchKey: Test Product
     Name: Test Product
     Tax Category: Exempt
     Sale: Checked
     Product Type: Item
     Stocked: Checked
     Attribute Set: Lot
  Go to Price Tab and create a new record
    Price List Version: General Sales
    Unit Price: 10
    List Price: 10


2. Add Stock

  Go to Physical Inventory Window and create a new record
    Organization: F&B US
    Warehouse: US East Coast
  Go to Lines Tab and create a new record
    Product. Click on the magnifing glass. Click on the funnel icon. Filter Search Key by Test Product. Pick the record that has no Attribute defined
    Attribute Set Value: Create new one. 0001
    Storage Bin: EC-0-0-0
    Quantity Count: 10
  Click on Process Inventory Count

  Create another record in Physical Inventory Window
    Organization: F&B US
    Warehouse: US East Coast
  Go to Lines Tab and create a new record
    Product. Click on the magnifing glass. Click on the funnel icon. Filter Search Key by Test Product. Pick the record that has no Attribute defined
    Attribute Set Value: Create new one. 0002
    Storage Bin: EC-0-0-0
    Quantity Count: 10
  Click on Process Inventory Count


3. Create Sales Orders with Reservations

  Go to Sales Order Window and create a new record
    Organization: F&B US
    Business Partner: Healthy Food SuperMarkets
    Warehouse: US East Coast
    Invoice Terms: Immediate
  Go to Lines Tab and create a new record
    Product: Test Product
    Ordered Quantity: 5
  Go to Basic Discounts Tab and delete the existing record
  Book the Order
  Select the Sales Order Line and click on Manage Reservations button
  Select the Line with Attribute Set Value L0001 and set Quantity to 5 and click on Done

  Create another record in Sales Order Window
    Organization: F&B US
    Business Partner: Healthy Food SuperMarkets
    Warehouse: US East Coast
    Invoice Terms: Immediate
  Go to Lines Tab and create a new record
    Product: Test Product
    Ordered Quantity: 10
  Go to Basic Discounts Tab and delete the existing record
  Book the Order
  Select the Line and click on Manage Reservations button
  Select the Line with Attribute Set Value L0002 and set Quantity to 10 and click on Done


4. Check the data before moving forward

  This query can help, just replace productid with the m_product_id desired

    select l.value, sd.m_storage_detail_id, a.lot, a.m_attributesetinstance_id, qtyonhand, reservedqty, allocatedqty
    from m_storage_detail sd
      join m_locator l using (m_locator_id)
      join m_attributesetinstance a using (m_attributesetinstance_id)
    where m_product_id = productid
      and l.em_obwhs_type IS NULL OR l.em_obwhs_type <> 'OUT';

  It should return something like this

    Lot ------ qtyonhand ----- reservedqty ----- allocatedqty
    0001 ----- 10 ------------ 5 --------------- 0
    0002 ----- 10 ----------- 10 -------------- 0


5. Generate PickList

  Back in Sales Order Window, select the Sales Order that has 10 as the Ordered Quantity
  Click on the Generate PickList button and generate a PickList using Outbound Locator
  
  By launching the previous query it will return something like
    Lot ------ qtyonhand ----- reservedqty ----- allocatedqty
    0001 ----- 10 ------------ 15 -------------- 10
    0002 ----- 10 ------------ 0 --------------- 0

  Where it should be something like
    Lot ------ qtyonhand ----- reservedqty ----- allocatedqty
    0001 ----- 10 ------------ 10 -------------- 5
    0002 ----- 10 ------------ 5 --------------- 5
No tags attached.
Issue History
2015-04-09 09:37dmiguelezNew Issue
2015-04-09 09:37dmiguelezAssigned To => dmiguelez
2015-04-09 09:37dmiguelezModules => Core
2015-04-09 09:37dmiguelezTriggers an Emergency Pack => No
2015-04-09 09:38dmiguelezSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=8198#r8198
2015-04-09 09:40dmiguelezSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=8199#r8199
2015-04-09 09:42dmiguelezDescription Updatedbug_revision_view_page.php?rev_id=8201#r8201
2015-04-09 09:46dmiguelezDescription Updatedbug_revision_view_page.php?rev_id=8202#r8202
2015-04-09 09:46dmiguelezDescription Updatedbug_revision_view_page.php?rev_id=8203#r8203
2015-04-09 09:49dmiguelezSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=8204#r8204
2015-04-10 11:35hgbotCheckin
2015-04-10 11:35hgbotNote Added: 0076441
2015-04-10 11:35hgbotStatusnew => resolved
2015-04-10 11:35hgbotResolutionopen => fixed
2015-04-10 11:35hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/75d5c06162cb62cec67041ee793db67f24060902 [^]
2015-04-22 09:22dmitry_mezentsevReview Assigned To => eduardo_Argal
2015-04-29 20:47dmitry_mezentsevNote Added: 0076902
2015-04-30 16:12SandrahuguetReview Assigned Toeduardo_Argal => Sandrahuguet
2015-04-30 18:07SandrahuguetNote Added: 0076920
2015-04-30 18:07SandrahuguetStatusresolved => closed
2015-04-30 18:07SandrahuguetFixed in Version => 3.0PR15Q3
2015-05-07 22:16hudsonbotCheckin
2015-05-07 22:16hudsonbotNote Added: 0077114

Notes
(0076441)
hgbot   
2015-04-10 11:35   
Repository: erp/devel/pi
Changeset: 75d5c06162cb62cec67041ee793db67f24060902
Author: David Miguelez <david.miguelez <at> openbravo.com>
Date: Fri Apr 10 15:04:11 2015 +0530
URL: http://code.openbravo.com/erp/devel/pi/rev/75d5c06162cb62cec67041ee793db67f24060902 [^]

Fixes Issue 29539.
* Fixes wrong call to M_GET_STOCK_PARAM in two procedures
* Fixes problem with Stock Reallocation funcionality raised
  by fixing the wrong calls

---
M src-db/database/model/functions/M_GET_STOCK_PARAM.xml
M src-db/database/model/functions/M_RESERVATION_REALLOCATE.xml
M src-db/database/model/functions/M_RESERVE_STOCK_AUTO.xml
---
(0076902)
dmitry_mezentsev   
2015-04-29 20:47   
Not closed for 19 days!!!
(0076920)
Sandrahuguet   
2015-04-30 18:07   
Code review + testing OK
(0077114)
hudsonbot   
2015-05-07 22:16   
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/a1817f84bd8b [^]
Maturity status: Test