In a Product Category, you can configure a removal strategy.

They are discussed at https://www.odoo.com/documentation/master/applications/inventory_and_mrp/inventory/routes/strategies/removal.html
I don't understand how "Closest Location" works though.