odoo icon indicating copy to clipboard operation
odoo copied to clipboard

[FIX] purchase_stock, *: include visibility_days in qty_forecast compute

Open Guillaume-gdi opened this issue 6 months ago • 1 comments

*: 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.

Guillaume-gdi avatar Jun 11 '25 21:06 Guillaume-gdi

Pull request status dashboard

robodoo avatar Jun 11 '25 21:06 robodoo

@Whenrow Can you review this PR please?

Guillaume-gdi avatar Jun 30 '25 15:06 Guillaume-gdi

@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.

Whenrow avatar Jul 01 '25 13:07 Whenrow

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 avatar Jul 08 '25 17:07 Guillaume-gdi

@Guillaume-gdi Since https://github.com/odoo/odoo/commit/b6de43e4645b69ce709bc5fc171daf24ed68a2f1, (v18) there is a new context value to do exactly that

Whenrow avatar Jul 29 '25 07:07 Whenrow