diff options
| author | Martin Trigaux <mat@odoo.com> | 2018-08-17 01:49:22 +0200 |
|---|---|---|
| committer | Martin Trigaux <mat@odoo.com> | 2018-08-17 13:46:39 +0200 |
| commit | d97e69ff0241af7403eef4a01f4dcf3f4e06963e (patch) | |
| tree | bfa1b88083f512a791674cd80295f7ecf45ebe22 /addons/mail/models/ir_actions.py | |
| parent | c51cfbc58b826fdaa9ccda17b4a0dc1759ed06f5 (diff) | |
[FIX] mail: schedule activity with user's today
The activity was incorrectly scheduled with a deadline as the now in UTC while
the state was computed using "today" in the user's timezone.
This made the nightly test fail (run at 23:30 UTC with the user in UTC+2).
Use context_today instead of today for all activity_schedule calls
To make it easier, use on the context_today default value instead of setting
context_today everywhere (which is more error prone in the future)
Never use datetime, only date objects
add a warning to detect potential errors when passing a datetime
Closes #26411
Diffstat (limited to 'addons/mail/models/ir_actions.py')
| -rw-r--r-- | addons/mail/models/ir_actions.py | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/addons/mail/models/ir_actions.py b/addons/mail/models/ir_actions.py index 16abdfeaf8e..8c84144a12a 100644 --- a/addons/mail/models/ir_actions.py +++ b/addons/mail/models/ir_actions.py @@ -1,7 +1,6 @@ # -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. -from datetime import date from dateutil.relativedelta import relativedelta from odoo import _, api, fields, models @@ -96,7 +95,7 @@ class ServerActions(models.Model): 'activity_type_id': action.activity_type_id.id, } if action.activity_date_deadline_range > 0: - vals['date_deadline'] = date.today() + relativedelta(**{action.activity_date_deadline_range_type: action.activity_date_deadline_range}) + vals['date_deadline'] = fields.Date.context_today(action) + relativedelta(**{action.activity_date_deadline_range_type: action.activity_date_deadline_range}) for record in records: if action.activity_user_type == 'specific': user = action.activity_user_id |
