跳至内容
菜单
此问题已终结

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.


形象
丢弃
相关帖文 回复 查看 活动
0
5月 17
5776
0
2月 25
1198
1
11月 24
2041
0
10月 23
40
3
1月 20
5513