How to Detect a Broken Replenishment Chain (MO/PO Not Fully Linked)?
Has anyone found a reliable way in Odoo to create a failsafe for breaks in the replenishment chain?
What I’m trying to do is create an automated activity when an order is genuinely “not coming in”, meaning there is some break somewhere in the replenishment flow.
What I’ve tried so far:
- Automated action on Stock Move
- Trigger: On create and edit
- Checking things like
forecast_availability < product_uom_qty - Creating an activity on the related transfer if the move looks short
The problem is that this gives false positives.
Example:
- Sales Order creates a delivery
- Delivery triggers an MO
- MO is waiting on components
- Components have a PO linked to replenish them
In real life, the chain is there and everything is lined up correctly. But Odoo still sometimes shows the stock move / transfer as effectively “not available”, because it can’t always see far enough back through the full chain. So the automation creates an activity even though there isn’t actually a broken flow.
We also tried a few other ideas:
- checking
forecast_expected_date - checking upstream/downstream stock moves
- checking linked MO / PO via
origin/ source references - trying procurement-group style logic
But that got messy fast, and on this database some of the fields we expected to use were not even available on the models we were triggering from, so it started throwing server errors.
What I actually want is something more like:
>
So my question is:
How would you build a proper failsafe for this in Odoo?
Would you:
- check for missing upstream stock moves?
- walk the MO/PO/source chain recursively?
- use a scheduled action instead of an automated action?
- flag “no valid replenishment path exists” some other way?
Mainly interested in something practical and robust, because availability / forecast alone seems too shallow for multi-step manufacturing + purchasing flows.
Any ideas appreciated.