Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
1 Balas
3223 Tampilan

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
Buang
Penulis Jawaban Terbai

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
Buang
Post Terkait Replies Tampilan Aktivitas
3
Apr 24
2028
1
Sep 23
1925
5
Jul 20
5840
0
Mar 17
3034
1
Sep 24
1276