From cb459faa3bef1f343b5a4e2e57b078855cbdafda Mon Sep 17 00:00:00 2001 From: "Audric Onockx (auon)" Date: Mon, 13 Feb 2023 07:01:54 +0000 Subject: [PATCH] [FIX] project: allow computation of recurrence message when yearly Steps: Enable recurrence feature. Go to Project > Office Design > Customer Review. Enable recurrence on this task > Change month to year. Issue: Crash. Cause: `_get_next_recurring_dates` is called without a `repeat_month` arg. Is is supposed to be a string which is going to be found in MONTHS keys. Except it is False and so it is not in the list. Fix: If we don't receive it, deduce it from `date_start` arg. closes odoo/odoo#112506 X-original-commit: 566c4904129dc7e81458871656d9b20b19b36246 Signed-off-by: Xavier Bol (xbo) Signed-off-by: Audric Onockx (auon) --- addons/project/models/project_task_recurrence.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/project/models/project_task_recurrence.py b/addons/project/models/project_task_recurrence.py index 55ce3b571ff..5e1fd93552b 100644 --- a/addons/project/models/project_task_recurrence.py +++ b/addons/project/models/project_task_recurrence.py @@ -191,7 +191,8 @@ class ProjectTaskRecurrence(models.Model): return dates elif repeat_unit == 'year': rrule_kwargs['freq'] = YEARLY - month = list(MONTHS.keys()).index(repeat_month) + 1 + month = list(MONTHS.keys()).index(repeat_month) + 1 if repeat_month else date_start.month + repeat_month = repeat_month or list(MONTHS.keys())[month - 1] rrule_kwargs['bymonth'] = month if repeat_on_year == 'date': rrule_kwargs['bymonthday'] = min(repeat_day, MONTHS.get(repeat_month))