Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie

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

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
0
gru 22
777
0
kwi 23
3042
1
sie 22
2667
1
cze 25
1564
3
lip 25
3227