[FIX] event: fix done field definition

Add missing trigger for done

Do not copy done field on event.mail model.

Task ID-2414658
COM PR odoo/odoo#63093
This commit is contained in:
Stéphane Debauche
2021-03-24 11:18:11 +00:00
committed by Thibault Delavallée
parent db8f68f683
commit 214d8fe589
2 changed files with 3 additions and 4 deletions
+2 -2
View File
@@ -85,9 +85,9 @@ class EventMailScheduler(models.Model):
scheduled_date = fields.Datetime('Scheduled Sent Mail', compute='_compute_scheduled_date', store=True)
mail_registration_ids = fields.One2many('event.mail.registration', 'scheduler_id')
mail_sent = fields.Boolean('Mail Sent on Event', copy=False)
done = fields.Boolean('Sent', compute='_compute_done', store=True)
done = fields.Boolean('Sent', compute='_compute_done', store=True, copy=False)
@api.depends('mail_sent', 'interval_type', 'event_id.registration_ids', 'mail_registration_ids')
@api.depends('mail_sent', 'interval_type', 'event_id.registration_ids', 'mail_registration_ids.mail_sent')
def _compute_done(self):
for mail in self:
if mail.interval_type in ['before_event', 'after_event']:
@@ -133,8 +133,7 @@ class TestMailSchedule(TestEventCommon, MockEmail):
# verify that subscription scheduler was auto-executed after each registration
self.assertEqual(len(after_sub_scheduler_2.mail_registration_ids), 2, 'event: should have 2 scheduled communication (1 / registration)')
self.assertTrue(all(mail_reg.mail_sent for mail_reg in after_sub_scheduler_2.mail_registration_ids))
# FIXME: field not updated
# self.assertTrue(after_sub_scheduler_2.done, 'event: all subscription mails should have been sent')
self.assertTrue(after_sub_scheduler_2.done, 'event: all subscription mails should have been sent')
# check emails effectively sent
self.assertEqual(len(self._new_mails), 2, 'event: should have 2 scheduled emails (1 / registration)')