[FIX] lunch: access rights error on ir.cron for lunch manager
Small fixup of recent commit https://github.com/odoo/odoo/commit/5b8eff9d771a9071327473d2185624f69e1057c1. closes odoo/odoo#73587 X-original-commit: d98a005c88b932a459b634cf811fb320cbea1357 Signed-off-by: Julien Castiaux <Julien00859@users.noreply.github.com> Signed-off-by: Alex Tuyls <alt-odoo@users.noreply.github.com>
This commit is contained in:
@@ -101,7 +101,8 @@ class LunchAlert(models.Model):
|
||||
sendat_tz = pytz.timezone(alert.tz).localize(datetime.combine(
|
||||
fields.Date.context_today(alert, fields.Datetime.now()),
|
||||
float_to_time(alert.notification_time, alert.notification_moment)))
|
||||
lc = alert.cron_id.lastcall
|
||||
cron = alert.cron_id.sudo()
|
||||
lc = cron.lastcall
|
||||
if ((
|
||||
lc and sendat_tz.date() <= fields.Datetime.context_timestamp(alert, lc).date()
|
||||
) or (
|
||||
@@ -110,7 +111,6 @@ class LunchAlert(models.Model):
|
||||
sendat_tz += timedelta(days=1)
|
||||
sendat_utc = sendat_tz.astimezone(pytz.UTC).replace(tzinfo=None)
|
||||
|
||||
cron = alert.cron_id.sudo()
|
||||
cron.name = f"Lunch: alert chat notification ({alert.name})"
|
||||
cron.active = cron_required
|
||||
cron.nextcall = sendat_utc
|
||||
|
||||
@@ -112,7 +112,8 @@ class LunchSupplier(models.Model):
|
||||
sendat_tz = pytz.timezone(supplier.tz).localize(datetime.combine(
|
||||
fields.Date.context_today(supplier),
|
||||
float_to_time(supplier.automatic_email_time, supplier.moment)))
|
||||
lc = supplier.cron_id.lastcall
|
||||
cron = supplier.cron_id.sudo()
|
||||
lc = cron.lastcall
|
||||
if ((
|
||||
lc and sendat_tz.date() <= fields.Datetime.context_timestamp(supplier, lc).date()
|
||||
) or (
|
||||
@@ -121,7 +122,6 @@ class LunchSupplier(models.Model):
|
||||
sendat_tz += timedelta(days=1)
|
||||
sendat_utc = sendat_tz.astimezone(pytz.UTC).replace(tzinfo=None)
|
||||
|
||||
cron = supplier.cron_id.sudo()
|
||||
cron.active = supplier.active and supplier.send_by == 'mail'
|
||||
cron.name = f"Lunch: send automatic email to {supplier.name}"
|
||||
cron.nextcall = sendat_utc
|
||||
|
||||
Reference in New Issue
Block a user