From fbba584c68db52fcc0d7b7fc0741b7fefe1e1be7 Mon Sep 17 00:00:00 2001 From: PNO Date: Thu, 7 Apr 2022 12:07:37 +0000 Subject: [PATCH] [FIX] stock: Wrong next_inventory_date Issue: Imagine today is the April 7th 2022 and we set the inventory frequency to 90 days. If our last inventory date was on January 12th 2022, the next inventory date should be set to April 12th 2022. However, it is being set to January 27th 2022 which is wrong. The next inventory date should be last inventory date + cyclic inventory frequency. OPW-2795459 closes odoo/odoo#88267 X-original-commit: 990758ebbed294c8f25d90a5e4f6a7455be97a31 Signed-off-by: Arnold Moyaux --- addons/stock/models/stock_location.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/stock/models/stock_location.py b/addons/stock/models/stock_location.py index bb8cf435d92..fcca84000b9 100644 --- a/addons/stock/models/stock_location.py +++ b/addons/stock/models/stock_location.py @@ -134,7 +134,7 @@ class Location(models.Model): if days_until_next_inventory <= 0: location.next_inventory_date = fields.Date.today() + timedelta(days=1) else: - location.next_inventory_date = location.last_inventory_date + timedelta(days=days_until_next_inventory) + location.next_inventory_date = location.last_inventory_date + timedelta(days=location.cyclic_inventory_frequency) else: location.next_inventory_date = fields.Date.today() + timedelta(days=location.cyclic_inventory_frequency) except OverflowError: