Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
3215 Vistas

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
Descartar
Autor Mejor respuesta

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
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
3
abr 24
2027
1
sept 23
1925
5
jul 20
5836
0
mar 17
3029
1
sept 24
1270