From 9cf666288076dc4e315e62e7ca0d6fc59995a498 Mon Sep 17 00:00:00 2001 From: Jorge Pinna Puissant Date: Fri, 4 Jan 2019 10:04:06 +0000 Subject: [PATCH] [FIX] account: compute_fiscalyear_dates non leap years Before this commit, when the fiscal year was setting to 29/02. The function that compute the fiscal year dates gives an error. This occurs when the date passed as parameter wasn't a leap year. Now, for the non leap years we use the 28/02. opw-1917035 closes odoo/odoo#29932 --- addons/account/models/company.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/addons/account/models/company.py b/addons/account/models/company.py index 72b2c1f0197..8d1a2174431 100644 --- a/addons/account/models/company.py +++ b/addons/account/models/company.py @@ -115,7 +115,11 @@ Best Regards,''') last_month = self.fiscalyear_last_month last_day = self.fiscalyear_last_day if (date.month < last_month or (date.month == last_month and date.day <= last_day)): - date = date.replace(month=last_month, day=last_day) + # FORWARD-PORT UP TO v11 + if last_month == 2 and last_day == 29 and date.year % 4 != 0: + date = date.replace(month=last_month, day=28) + else: + date = date.replace(month=last_month, day=last_day) else: if last_month == 2 and last_day == 29 and (date.year + 1) % 4 != 0: date = date.replace(month=last_month, day=28, year=date.year + 1)