Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
3230 Zobrazení

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?

Avatar
Zrušit
Autor Nejlepší odpověď

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

Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
3
dub 24
2028
1
zář 23
1926
5
čvc 20
5843
0
bře 17
3036
1
zář 24
1276