# Finding empty locations

**URL:** https://discuss.tryton.org/t/finding-empty-locations/5622
**Category:** Developer
**Tags:** stock, purchasing
**Created:** [October 19, 2022, 1:24pm UTC](https://discuss.tryton.org/t/finding-empty-locations/5622 "2022-10-19T13:24:01Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![maxx](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/maxx/32/2320_2.png) [@maxx](https://discuss.tryton.org/u/maxx)
#### Post date: [October 19, 2022, 1:24pm UTC](https://discuss.tryton.org/t/finding-empty-locations/5622/1 "2022-10-19T13:24:01Z")

</div>

Hi,

We have a big warehouse with a lot of locations to store a pallet at each location.  
When doing a supplier shipment, the user has to choose the location where he will store the products.  
Until now, he is searching (visually) in the warehouse for an empty location to put the pallet from the supplier shipment. Wondering in Tryton, how to get a list of empty locations for helping user?

---

<div class="post-metadata">

### Author: ![pokoli](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/pokoli/32/22_2.png) [@pokoli](https://discuss.tryton.org/u/pokoli)
#### Post date: [October 19, 2022, 1:54pm UTC](https://discuss.tryton.org/t/finding-empty-locations/5622/2 "2022-10-19T13:54:10Z")

</div>

There is a [get\_empty\_location](https://hg.tryton.org/modules/stock/file/58af7e68eec1/location.py#l281) function on the location but I guess you want to be able to filter out the ones that are not empty.

> [@maxx](#):
>
> Until now, he is searching (visually) in the warehouse for an empty location to put the pallet from the supplier shipment. Wondering in Tryton, how to get a list of empty locations for helping user?

In such case I’m wondering if it won’t be better that tryton picks the first location that is empty (you can define an order) and propose them to the user.

This will be similar to what [Stock product location module](https://docs.tryton.org/projects/modules-stock-product-location/en/latest/) does but just filtering empty locations.

---

<div class="post-metadata">

### Author: ![maxx](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/maxx/32/2320_2.png) [@maxx](https://discuss.tryton.org/u/maxx)
#### Post date: [October 20, 2022, 7:52am UTC](https://discuss.tryton.org/t/finding-empty-locations/5622/3 "2022-10-20T07:52:41Z")

</div>

> [@pokoli](#):
>
> There is a [get\_empty\_location](https://hg.tryton.org/modules/stock/file/58af7e68eec1/location.py#l281) function on the location but I guess you want to be able to filter out the ones that are not empty.

I need all empty storage locations from a warehouse

---

<div class="post-metadata">

### Author: ![pokoli](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/pokoli/32/22_2.png) [@pokoli](https://discuss.tryton.org/u/pokoli)
#### Post date: [October 24, 2022, 8:14am UTC](https://discuss.tryton.org/t/finding-empty-locations/5622/4 "2022-10-24T08:14:44Z")

</div>

> [@maxx](#):
>
> I need all empty storage locations from a warehouse

Indeed the warehouse domain is already applied by the shipment, so you just need to add a domain for the empty warehouse clause. But I’m not sure if that is easy to implement.

That’s why I sugested that the server sugests the location which will be probably easier to implement.

---

<div class="post-metadata">

### Author: ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)
#### Post date: [October 24, 2022, 2:55pm UTC](https://discuss.tryton.org/t/finding-empty-locations/5622/5 "2022-10-24T14:55:00Z")

</div>

I’m afraid that there will be not performent way to get this information. The `get_empty_location` may be slow when performed on a lot of locations. Also I guess in your use case it should not considered as empty a location with consumable.

At some point I think we will need a simpler sub-level than location to build a fast WMS on top of it.

---

<div class="post-metadata">

### Author: ![tbruyere](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/tbruyere/32/37_2.png) [@tbruyere](https://discuss.tryton.org/u/tbruyere)
#### Post date: [October 25, 2022, 1:51pm UTC](https://discuss.tryton.org/t/finding-empty-locations/5622/6 "2022-10-25T13:51:42Z")

</div>

If I’m not mistaken, currently the system is forced to look if a movement placed stock on the location to define if the location is empty. And so to check a lot of location, there is going to be a performance issue.

For the moment, I use the “Create Inventories” wizard to generate inventories of all locations. Duration +/- 30sec for 1000 locations.  
Then I create a CSV report with location,Product,Lot,Actual Quantity.  
I remove the lines with a product from the list → and I have the list of empty locations.  
And I delete the inventories I just created.
