Instead of taking a sum (of quantities of warehouses), you must be able to choose from the sum of several (that is, to be able to choose between 1 and the N warehouses you have), to define the stock.