diff options
| author | Christophe Simonis <chs@odoo.com> | 2019-04-12 13:37:44 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2019-04-12 13:37:44 +0200 |
| commit | 0a09a4d8a819ef06db47e798f0465e500004e4c1 (patch) | |
| tree | b9d66d60a1e9b5ff6030be62fff89df410b744ee /odoo/tools/date_utils.py | |
| parent | db97bb7f1136dc3ebde9924b79364a698a63765d (diff) | |
| parent | 120359bf0c98191051ac19ae2e5fde53ca7d2ae5 (diff) | |
[MERGE] forward port branch saas-12.3 up to 120359bf0c9
Diffstat (limited to 'odoo/tools/date_utils.py')
| -rw-r--r-- | odoo/tools/date_utils.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/odoo/tools/date_utils.py b/odoo/tools/date_utils.py index 26bfdabd835..702913ff04e 100644 --- a/odoo/tools/date_utils.py +++ b/odoo/tools/date_utils.py @@ -73,6 +73,10 @@ def get_fiscal_year(date, day=31, month=12): date_from = date_to + relativedelta(days=1) max_day = calendar.monthrange(date_to.year + 1, date_to.month)[1] date_to = type(date)(date.year + 1, month, min(day, max_day)) + + # Force at 29 February instead of 28 in case of leap year. + if date_to.month == 2 and date_to.day == 28 and max_day == 29: + date_to += relativedelta(days=1) return date_from, date_to |
