Skip to Content
Menu
This question has been flagged

I'm using "email_compose_message_wizard_form" to send a mail from custom module. It works if I chose partner for recipient but I want to be able to send it to custom email without having to choose partner.

I tried this:

class Message(models.Model):
    _inherit = 'mail.message'
    email_to = fields.Char('To:')
class MailComposer(models.TransientModel):
_inherit = 'mail.compose.message'

    email_to = fields.Char('To:')

    @api.multi
def get_mail_values(self, res_ids):
res = super(MailComposer, self).get_mail_values(res_ids)
if self.model and len(res_ids) == 1:
res[res_ids[0]]['email_to'] = self.email_to
return res

and then adding

<field name="email_to"  placeholder="Mail to..."/>

to mail_compose_message_view and mail_message_view

So I can see the field on the compose message wizard form but it doesn't send it. It behaves as I've left it empty.


Avatar
Discard
Related Posts Replies Views Activity
0
May 17
5163
1
Nov 24
105
0
Oct 23
40
3
Jan 20
4417
0
Mar 15
2609