Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
3233 Lượt xem

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?

Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
3
thg 4 24
2029
1
thg 9 23
1926
5
thg 7 20
5843
0
thg 3 17
3036
1
thg 9 24
1276