[FIX] digest: check field existance
This commit fixes the following bug: * On a new DB, install account * Settings > Technical > Email > Digest emails * Open Weekly Digest, set Next Send Date to current day * Settings > Technical > Scheduled Actions > Digest Emails * Run manually AttributeError: 'res.company' object has no attribute 'resource_calendar_id' The field resource_calendar_id is added in the module resource. The module digest does not have resource in its dependency. In stable version, have a silent fallback on UTC if the field is not present. The right dependency should be added in master. closes odoo/odoo#28244
This commit is contained in:
committed by
Martin Trigaux
parent
9ee9546d59
commit
8cecb88c27
@@ -158,7 +158,8 @@ class Digest(models.Model):
|
||||
|
||||
def _compute_timeframes(self, company):
|
||||
now = datetime.utcnow()
|
||||
tz_name = company.resource_calendar_id.tz
|
||||
# TODO remove hasattr in >=saas-12.1
|
||||
tz_name = hasattr(company, "resource_calendar_id") and company.resource_calendar_id.tz
|
||||
if tz_name:
|
||||
now = pytz.timezone(tz_name).localize(now)
|
||||
start_date = now.date()
|
||||
|
||||
Reference in New Issue
Block a user