diff --git a/models/acc_operation.py b/models/acc_operation.py index 453724211c9e5aa82f69fc6e7d83c44382b8a3a3..e8ee8bf9f3c3353edac829ec7c2e627102b51e81 100644 --- a/models/acc_operation.py +++ b/models/acc_operation.py @@ -156,7 +156,11 @@ class AccOperation(models.Model): last_day_start = last_record.date_slot.replace(hour=0, minute=0, second=0) last_day_end = last_day_start + relativedelta(days=1) # Get end time slot for previous month with timezone - end_month = last_day_start.replace(day=1) + # Manage if date is the last day of the month + if fields.Date.to_date(last_day_start) == fields.Date.to_date(date_utils.end_of(last_record.date_slot, "month")): + end_month = last_day_end.replace(day=1) + else: + end_month = last_day_start.replace(day=1) if scale == "semestre": date_end = end_month