Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
5057 Lượt xem

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.


Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 5 17
5870
0
thg 2 25
1379
1
thg 11 24
2225
0
thg 10 23
40
3
thg 1 20
5638