[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 <arm@odoo.com>
This commit is contained in:
PNO
2022-04-08 11:39:52 +02:00
parent bde1fe704a
commit fbba584c68
+1 -1
View File
@@ -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: