Store supplier available quantity

Rational

When using the sale_supply (and specially sale_supply_drop_shipment) it’s important to know which quantity of products is available on the supplier side as this is information is usefull to decide if the customer order can be satified before confirming it.

Normally the unique way to know if the information is available is asking the supplier but nowadays is more common that suppliers expose this information to their customers (via webservice or a file updated periodically, etc.).

Proposal

On the product supplier table add the following fields:

  • Available Quantity: Float to represent the quantity that the supplier is ready to sell.
  • Quantity Unit: The unit of measure to represent this quantity availble.

The requested quantity should be available on the find_best_supplier pattern, so if the supplier does not have enought available quantity to fill the request it should be skipped.

Implementation

As this depends on sale_supply (and probably sale_stock_quantity) I think this should be implemented in a third module.

I do not like to add operational fields on a referential model.
Also it will make no sense to have this field for a product supplier related to a template.
I think this should be stored on a different table. We should probably allow to add extra criteria like tha country, the company etc.

I’m not sure it is a good way because if any supplier has enough quantity we need any way to get one any way. So for me, it is more about extending sale_stock_quantity to warn about shortage with the selected supplier.
But we could have two pass on calling find_best_supplier one which exclude the supplier without enough and an second if none is found without caring about shortage.

Then I will name it purchase_supplier_stock but add the dependency on sale_supply and sale_stock_supply optional as there should be some users that whant to know the supplier quantity without purchasing on sale.

Makes sense to use a seaprate model. Then we can add a Functional field on product to compute the supplier availble quantity for product to sum the quantities of avialable criterias and use this check for sale_stock_quantity.

There is no selected supplier on purchase so we must sum all the avaialble ones.

Makes sense.

There should be one when supplied on sale.

Yes but this is after the sale is confired and the warning of sale_stock_quantity is raised after.

So I think we should include a field to show the supplier quantity per product and show it on the product list view so the user entering the sale order has this information available. And use this field to raise the warning.

I wonder if it would make sense to use stock.move and use a different location for each supplier warehouse.

For me stock move is usefull for having all the history of moves of the companies, which is not the current case as we may be only interested on the last quantity of the supplier for each of it’s countries/warehouses, etc.

Also I do not think it’s a good idea to have on the same table the supplier stock our own stock history.

Which is the benefit of reusing the stock.move table?

I agree, that’s why we’ve also used a different table to handle this in other projects.

It could handle lots out of the box. It would also show the supplier stock in the same screen that shows the stock of the product by location. Which could be useful.

Why you need to know lots?

You will never know which lot is delivered until the goods leave the supplier warehouse so for me tracking the available lots is useless.

For me we should avoid mixxin supplier quantities with own company quantities: Company products can be used inmediatly but in order to receive there may be some delivery time.

I do not see how you would do that as a product may have multiple suppliers with each one a quantity.
But this could be displayed on the product supplier list but I’m not sure it will be useful as the supplier is not chosen at that time.

Some businesses do work handling supplier lots in advance and purchase specific supplier lots.

If the company owns several warehouses products may not be available immediately either, depending on where you need the goods. Tryton even allows you to configure the delay of moving goods from one location to the other.

For me, it makes no sense to manage supplier location like a warehouse. It is too much work and I doubt companies will have such detailed information about the supplier warehouse (like when stock decrease or increase etc.).

As tryton will create a single purchase for a single product I think it makes sense to pick the supplier with max quantity available. Companies should be allowed to customize the value of the field if they have a diferent behaviour.

The product supplier is not avaiable no sale (where you want to knwo the available quantity) so for me it does not make sense to include it as part of the view but the field can be used to raise the sale_stock_quantity warning

I do not agree because the process may choose another supplier and then raise a warning.
Also it may make believe that it is the maximum quantity allowed to be purchased when the purchase process could be split through multiple suppliers.

Then it makes sense to sum the quantities of all the suppliers and let the user create all the required purhase request for them.

We do not support such workflow for now. As long as it is not supported, we should not display such sum to avoid leading users to wrong belief.