Atlassian uses cookies to improve your browsing experience, perform analytics and research, and conduct advertising. Accept all cookies to indicate that you agree to our use of cookies on your device. Atlassian cookies and tracking notice, (opens new window)
logic to check negative on-hand for warehouse don't work 100% if IsDisallowNegativeInv change sometime
Description
1. when we change "Disallow Negative Inventory" of warehouse from false to true idempiere check quality per warehouse logic at MWarehouse.beforeSave
SELECT M_Product_ID FROM M_StorageOnHand s
WHERE s.M_Locator_ID IN(SELECT M_Locator_ID FROM M_Locator l WHERE M_Warehouse_ID=? )GROUPBY M_Product_ID, M_Locator_ID, M_AttributeSetInstance_ID, C_OrderLine_ID HAVINGSUM(s.QtyOnHand)<0
2. when do a movement, idempiere check "Disallow Negative Inventory" per locator logic at MStorageOnHand.addQtyOnHand
if(getQtyOnHand().signum()==-1){
=======
suppose we have two StorageOnHand record and warehouse is allow negative onhand_1 record quality = -100 onhand_2 record quality = 200 now we change warehouse to disallow negative. it's ok because total on warehouse > 0
:yellow_star: issue 1: do a warehouse movement in quality = 50, by logic it choose record onhand_1 to auto balancing logic on MStorageOnHand.addQtyOnHand will raise NegativeInventoryDisallowed exception
:yellow_star: issue 2: do a warehouse movement out quality = 150, by logic it choose record onhand_2 to process, so after that we have onhand_1 record quality = -100 onhand_2 record quality = 50 so now total quality on warehouse is negative, conflict with properties "Disallow Negative Inventory"
@Deepak Pansheriya, @Carlos Ruiz [Administrator], @Heng Sin Low wdyt?
i description it base on status of my data. but it can be get test case to redo. i will provide test case late.
@Hiep Lq, I think your test case is not reproducible - if there is a reproducible test case where disallow negative inventory is set and a storage is saved negative then is a bug (we recently fixed one in production doc).
About the sync between the logic in validation and the logic in storage - if the data can be fixed after set (maybe with a Storage Cleanup, or a movement, or a physical inventory) that would be OK, if the data cannot be fixed then we have a problem.
Hiep Lq June 30, 2017 at 1:05 PM
issue 1: for me it's ok to by pass check Negative Inventory in case move on warehouse
i can confirm time-to-time system hit negative levels when disallow quantity is 0. Mainly when inventory moves created on warehouse locators across organisations.
1. when we change "Disallow Negative Inventory" of warehouse from false to true idempiere check quality per warehouse
logic at MWarehouse.beforeSave
SELECT M_Product_ID FROM M_StorageOnHand s WHERE s.M_Locator_ID IN (SELECT M_Locator_ID FROM M_Locator l WHERE M_Warehouse_ID=? ) GROUP BY M_Product_ID, M_Locator_ID, M_AttributeSetInstance_ID, C_OrderLine_ID HAVING SUM(s.QtyOnHand) < 0
2. when do a movement, idempiere check "Disallow Negative Inventory" per locator
logic at MStorageOnHand.addQtyOnHand
if (getQtyOnHand().signum() == -1) {
=======
suppose we have two StorageOnHand record and warehouse is allow negative
onhand_1 record quality = -100
onhand_2 record quality = 200
now we change warehouse to disallow negative. it's ok because total on warehouse > 0
:yellow_star: issue 1:
do a warehouse movement in quality = 50, by logic it choose record onhand_1 to auto balancing
logic on MStorageOnHand.addQtyOnHand will raise NegativeInventoryDisallowed exception
:yellow_star: issue 2:
do a warehouse movement out quality = 150, by logic it choose record onhand_2 to process, so after that we have
onhand_1 record quality = -100
onhand_2 record quality = 50
so now total quality on warehouse is negative, conflict with properties "Disallow Negative Inventory"
@Deepak Pansheriya, @Carlos Ruiz [Administrator], @Heng Sin Low wdyt?
i description it base on status of my data. but it can be get test case to redo. i will provide test case late.