We have the sale_stock_quantity module to check if the sold products are/will be available in stock. And we have the stock_supply modules to automatically supply the stock when needed. This works well until there is a delay somewhere in the supply chain (a supplier that does not deliver on time, the production that is blocked etc.).
The only tools we provide for now are:
“Products by Warehouse”: provides an overview of where there could be problem but user need to change the date to see each forecast.
“Product Quantities by Warehouse”: provides a fast way to detect stock level issue for the selected product.
“Stock Moves by Warehouse”: helps to choose which moves of a product to reschedule.
As we can see, we do not help the user finding where are the problems. We provide only tools to analyze the problem.
So we need a tool to spot for the user which shipments or productions have issues with the stock level of the warehouse for their planned date.
Proposal
We create a new module named stock_quantity_issue.
Checking if a shipment or production have enough stock level is an expensive operation and it will be very complex to make a searcher so we propose to have a scheduled task that will loop over each goods. For each good it will search for negative quantity on the warehouse up to the next supply date. For each move in the dates found, it creates an issue grouped per origin and include the move.
On each run the task will mark as solved all the previous non-solved records if possible otherwise it will use the issue to complete with possible new moves.
The user may mark a record as solved to clear it from the list if all the moves linked have a positive quantity.
The model stock.quantity.issue:
origin: Reference of stock.shipment.out, stock.shipment.in.return, stock.shipment.internal, production
planned_date: Computed from the shipment or production
moves: Many2Many to stock.product_quantities_warehouse.move
state: open, processing, solved
processing_by: the employee who is trying to solve the issue
solved_by: the employee who marked the issue as solved
I’m wondering if it won’t be better to just delete the open moves when recomputing the issues like we do por purchase and production requests. This will easy the regrouping but will also delete the issue if it has been fixed (for example by rescheduling the shipment to a date in the future) wihtout marking the issue as solved.
Solving the issue will perform any changes to the origin, or it will just mark the issue as solved?
I’m wondering if we just need the date of the issue: As the planned date may be modified we may be interesting on knowing when the issue has raised (and probably also when and who has solved it).
Is this module intended to just handle issues relating to supply and stock levels? If so I think it might be better if it was called stock_supply_issue or stock_quantity_issue.
Having stock that is falling apart is an issue with the stock, but I don’t think it is what this module is about?
indeed, it is necessary to be able to indicate to the user where the problems are. I think we should also tell him if he can deliver faster. These are the two sides of the same question: on what real date will I be able to deliver?
Doing what is necessary to have the material on the scheduled date is essential, and being able to indicate whether it will be possible to deliver earlier is more than few software offers.
So for me the nub of the matter is the delivery date, knowing the most probable / possible delivery date (whether late or early) is an essential indication for the life of the company.
Indeed we could imagine having a similar module but for optimization. It would loop on waiting shipments and try to find an possible earlier planned date that works for all moves. And then it creates a record to propose the optimization. Of course there should be a check that the optimization is still valid before being applied.
But this is for another topic.