[FIX] purchase_stock, *: include visibility_days in qty_forecast compute
*: stock
The visibility_days field defines how many days into the future the forecast should be considered for product replenishment:
Consider product forecast these many days in the future upon product
replenishment ...
However, the method computing qty_forecast did not depend on the visibility_days value, leading to incorrect replenishment behavior.
This commit fixes the issue by ensuring visibility_days is taken into account during forecast computation.
@Whenrow Can you review this PR please?
@Guillaume-gdi Hello. The visibility day alone should not trigger a replenishment, the goal is to adapt the quantity to replenish only if the forecast is already negative. The test you have updated check that.
I had a deeper look and I found this commit. I understand that is not stable compliant but we should at least fix the issue in the master version @Whenrow @amoyaux
@Guillaume-gdi Since https://github.com/odoo/odoo/commit/b6de43e4645b69ce709bc5fc171daf24ed68a2f1, (v18) there is a new context value to do exactly that
