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

I've created an automated action that I'd like to send an email from.  I am using the SaaS version and I'm a bit confused on how to get it set up correctly.  Many of the examples in the forums are for the open source version and the SaaS version seems to be set up a bit different and I can't find much documentation on it.

Here is what I have so far.

-----

domain=[('name','ilike','Proj.Quote_Review')]

template = env['mail.template'].search(domain, limit = 1)

my_id = record.id

template.send_mail(my_id)

----

In some of the examples the last line would be

template.send_mail(self.id)

In the Saas version you can't use self (perhaps someone could explain how it differs and why that is).

With what I have written above, I get the following error.

ValueError: <class 'TypeError'>: "'NewId' object is not iterable" while evaluating

Now if I just replace record.id with a constant like 4 for example, the email will send with the template selected and the data from the record in my model with an id of 4.  I know I'm not understanding something obvious here but can't quite get it.  Wouldn't record.id return an integer much like me just entering a constant of 4?

Awatar
Odrzuć
Autor Najlepsza odpowiedź

I managed to solve this problem by finding the answer in another forum.  I don't really understand why it works so perhaps someone could explain.

I changed my_id = record.id 

to

my_id = record._origin.id

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
3
kwi 24
2028
1
wrz 23
1925
5
lip 20
5840
0
mar 17
3034
1
wrz 24
1276