19.0 vanilla

This commit is contained in:
Ernad Husremovic 2026-03-09 09:31:00 +01:00
parent a1137a1456
commit e1d89e11e3
2789 changed files with 1093187 additions and 605897 deletions

View file

@ -5,11 +5,12 @@ from odoo import api, fields, models, _
class ApplicantSendMail(models.TransientModel):
_name = 'applicant.send.mail'
_inherit = 'mail.composer.mixin'
_inherit = ['mail.composer.mixin']
_description = 'Send mails to applicants'
applicant_ids = fields.Many2many('hr.applicant', string='Applications', required=True)
applicant_ids = fields.Many2many('hr.applicant', string='Applications', required=True, context={'active_test': False})
author_id = fields.Many2one('res.partner', 'Author', required=True, default=lambda self: self.env.user.partner_id.id)
attachment_ids = fields.Many2many('ir.attachment', string='Attachments', readonly=False, store=True, bypass_search_access=True)
@api.depends('subject')
def _compute_render_model(self):
@ -25,7 +26,7 @@ class ApplicantSendMail(models.TransientModel):
'tag': 'display_notification',
'params': {
'type': 'danger',
'message': _("The following applicants are missing an email address: %s.", ', '.join(without_emails.mapped(lambda a: a.partner_name or a.name))),
'message': _("The following applicants are missing an email address: %s.", ', '.join(without_emails.mapped(lambda a: a.partner_name or a.display_name))),
}
}
@ -40,18 +41,22 @@ class ApplicantSendMail(models.TransientModel):
if not applicant.partner_id:
applicant.partner_id = self.env['res.partner'].create({
'is_company': False,
'type': 'private',
'name': applicant.partner_name,
'email': applicant.email_from,
'phone': applicant.partner_phone,
'mobile': applicant.partner_mobile,
})
attachment_ids = []
for attachment_id in self.attachment_ids:
new_attachment = attachment_id.copy({'res_model': 'hr.applicant', 'res_id': applicant.id})
attachment_ids.append(new_attachment.id)
applicant.message_post(
subject=subjects[applicant.id],
author_id=self.author_id.id,
body=bodies[applicant.id],
message_type='comment',
email_from=self.author_id.email,
email_layout_xmlid='mail.mail_notification_light',
message_type='comment',
partner_ids=applicant.partner_id.ids,
subject=subjects[applicant.id],
attachment_ids=attachment_ids
)