[FIX] stock: compute replenishment info

The history of the replenishment info may be empty while it should not

To reproduce the issue:
(Set your device on January)
1. Process a delivery for product P
2. (Inventory > Operations > Replenishment, create a new one for P)
3. Click on the information icon (I) of the P's line

Error: The sales history does contain anything

When calling `relativedelta`, `month` is considered as an absolute value
and will replace the corresponding value while `months` is a relative
value and will be added/subtracted to the corresponding value.

OPW-2740123

closes odoo/odoo#84881

X-original-commit: c87fea0916b61cb4b0c37f3fe2ddad8359e6aeb2
Signed-off-by: Arnold Moyaux <arm@odoo.com>
Signed-off-by: Adrien Widart <awt@odoo.com>
This commit is contained in:
Adrien Widart
2022-02-18 14:29:02 +00:00
parent 66179e552b
commit eb1ddbf115
@@ -49,7 +49,7 @@ class StockReplenishmentInfo(models.TransientModel):
for replenishment_report in self:
replenishment_history = []
today = fields.Datetime.now()
first_month = subtract(today, month=2)
first_month = subtract(today, months=2)
date_from, dummy = get_month(first_month)
dummy, date_to = get_month(today)
domain = [