Hi,
I had created an email template for model hr.applicant
field name="model_id" ref="hr_recruitment.model_hr_applicant"/>
In view, I created a menu in kanban view to call sendmail function
field name="name">hr.recruitment.kanban.view.applicant.inherit
field name="model">hr.applicant
field name="inherit_id" ref="hr_recruitment.hr_kanban_view_applicant"/>
field name="arch" type="xml">
xpath expr="//a[@name='action_makeMeeting']" position="before">
a role="menuitem" name="action_sendMail" type="object" class="dropdown- item">Send Mail
xpath>
My python function action_sendmail:
def action_sendMail(self):
""" Send mail with wizard """
self.ensure_one()
ctx = {
'default_use_template': False,
'default_template_id': False,
'default_composition_mode': 'mass_mail',
}
return {
'name': _('Compose Email'),
'type': 'ir.actions.act_window',
'view_mode': 'form',
'res_model': 'mail.compose.message',
'views': [(False, 'form')],
'view_id': False,
'target': 'new',
'context': ctx,
}
In kanban view, email compose have my defined template but when I create sendmail dropdown action in hr.applicant form not get my template. Here is my action:
record id="send_mail_to_applicant" model="ir.actions.server">
field name="name">Send Mail
field name="type">ir.actions.server
field name="model_id" ref="model_hr_applicant"/>
field name="binding_model_id" ref="model_hr_applicant"/>
field name="state">code
field name="code"> action = records.action_sendMail()
record>
and it change template to model Message. How can I apply hr.applicant model to my action send mail using template.
Thank you!