Commit b00e5742 by François C.

Do not send shift mail reminder for committee members

parent 88c283ad
...@@ -2,6 +2,9 @@ ...@@ -2,6 +2,9 @@
from openerp import _, api, models, fields from openerp import _, api, models, fields
import datetime import datetime
import logging
_logger = logging.getLogger(__name__)
class ShiftRegistration(models.Model): class ShiftRegistration(models.Model):
_inherit = 'shift.registration' _inherit = 'shift.registration'
...@@ -21,12 +24,19 @@ class ShiftRegistration(models.Model): ...@@ -21,12 +24,19 @@ class ShiftRegistration(models.Model):
@api.multi @api.multi
def send_shift_reminder_email(self): def send_shift_reminder_email(self):
conf = self.env['ir.config_parameter']
committees_shift_template_id = 0
try:
committees_shift_template_id = int(conf.get_param("lacagette_membership.committees_shift_id"))
except:
pass
mail_template = self.env.ref('lacagette_shifts.custom_shift_email_reminder') mail_template = self.env.ref('lacagette_shifts.custom_shift_email_reminder')
if not mail_template: if not mail_template:
return False return False
for reg_target in self: for reg_target in self:
if reg_target.shift_id.shift_template_id.id != committees_shift_template_id:
mail_template.send_mail(reg_target.id) mail_template.send_mail(reg_target.id)
self.write({'reminder_mail_sent': True}) reg_target.write({'reminder_mail_sent': True})
return True return True
@api.model @api.model
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment