Se rendre au contenu
Menu
Cette question a été signalée

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
Ignorer
Publications associées Réponses Vues Activité
0
déc. 22
777
0
avr. 23
3044
1
août 22
2669
1
juin 25
1577
3
juil. 25
3230