Siirry sisältöön
Menu
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Tämä kysymys on merkitty
1552 Näkymät

Im trying to open up the email composer with my custom template to be able to send the open event.booth as an email.
However the composer that opens up is somehow empty (meaning there is no email text in it and the subject is default and the recipient is empty)
This is what it looks like (image)

Now, the template on the bottom right is correct. But the text is missing.
When I respect the template at the bottom right, it looks like this:

This is what I want it to look like. As you can see here the template including subject and recipient is correct. It should open up like that!


This is the code how I open the composer

    def action_send_booth_confirmation_mail(self):
confirmation_template = self\.env\.ref\('rectanglemaps\.event_booth_confirmation_mail_template'\)
\ \ \ \ \ \ \ \ for\ rec\ in\ self:
\ \ \ \ \ \ \ \ \ \ \ \ composer\ =\ self\.env\['mail\.compose\.message'\]\.with_context\(\{
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 'default_template_id':\ confirmation_template\.id,
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 'default_composition_mode':\ 'comment',
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 'default_res_id':\ rec\.id,
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 'default_model':\ 'event\.booth',
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 'default_use_template':\ True,
\ \ \ \ \ \ \ \ \ \ \ \ \}\)\.create\(\{\}\)
\ \ \ \ \ \ \ \ \ \ \ \ return\ \{
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 'name':\ 'Send\ Email',
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 'type':\ 'ir\.actions\.act_window',
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 'view_mode':\ 'form',
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 'res_model':\ 'mail\.compose\.message',
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 'view_id':\ self\.env\.ref\('mail\.email_compose_message_wizard_form'\)\.id,
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 'target':\ 'new',
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 'res_id':\ composer\.id,
\ \ \ \ \ \ \ \ \ \ \ \ \}

https://pastebin\.com/JtKA0sGS

And\ this\ is\ the\ template\ \(but\ it\ works\ fine\ if\ I\ preview\ in\ Technical\ >\ Mail\ Templates\ and\ on\ the\ second\ try\ so\ I\ dont\ think\ the\ problem\ is\ here\?\)
https://pastebin.com/M7bMdsmm


I added pastebin to both because odoo code inline is not working properly

Avatar
Hylkää
Aiheeseen liittyviä artikkeleita Vastaukset Näkymät Toimenpide
0
jouluk. 22
777
0
huhtik. 23
3040
1
elok. 22
2666
1
kesäk. 25
1556
3
heinäk. 25
3225