# Fix Replenish Calculation Bug + Auto Filter
## Environment
* Version: 13
* URL(s): product/stock/replenish.php
## Configuration
MultiCompany needed with Stock Sharing ON, 2 entities and 1 warehouse per entity
**Entity A**
* Options: don't share stocks with other entities
* Warehouse : only 1 (WAR_A)
* Stock : 1 product (PROD) Qty : 4
**Entity B :**
* Options: don't share stocks with other entities
* Warehouse : only 1 (WAR_B)
* Stock : 1 product --the same-- (PROD) Qty : 17
**Product :**
* Desired Stock : 20
* Alert : 10
**WAR_A :**
* For the product
* Desired Stock : 16
* Alert : 6
## Fixed behavior :
* Entity A -> Replenish
* If WAR_A selected should show the product and fill with 12 the qty to order. Physical Stock (All) and Physical Stock (this
warehouse) should be 4.
* If no Warehouse selected show the product and fill with 12 (because only one warehouse seen by this entity) the qty to order. Physical Stock (All) should be 4.
## Actual behavior :
* Entity A -> Replenish
* The product isn't showed.
* If I intentionally incrementes the Desired Stock value. The product will be shown with the good filter (Warehouse if desired stock has been incremented on the combination ProductDesired <-> Warehouse). The qty for the order are correct and the physical stock shown is correct.
## Conclusion :
* 1 bug and 1 improvment
**BUG** : The value of the stock taken to whether or not show the product line is wrong. It is considering the stock in warehouses not shared with the entity.
**IMPROVMENT** : If only one Warehouse, take automatically the desired and alert values for this warehouse and not the general ones.