Is it possible to get default recipients when sending mail (Actually , only Administrator is shown) ?
def action_send(self):
mail_template = self.env.ref('hr_test.my_email_template')
mail_template.send_mail(self.id, force_send=True)
partners = []
if self.applicant_id and self.applicant_id.user_id:
partners.append(self.applicant_id.user_id.partner_id.id)
partners = partners + [user.partner_id.id for user in
self.env.ref('hr_training.training_officer').users if
user.partner_id.id not in partners]
for rec in self:
if rec.applicant_id and rec.applicant_id.parent_id:
parent = rec.applicant_id.parent_id
if parent.user_id and parent.user_id.partner_id.id not in partners:
partners.append(parent.user_id.partner_id.id)
for partner in partners:
mail_template.send_mail(self.id, force_send=True,
raise_exception=True,
email_values={'email_to': partner})