Ir al contenido
Menú
Se marcó esta pregunta

I have an issue with an automated action where I am trying to set the value of Many2one field from a value stored in a record.  I does not work but if I set the value to a constant then it will work.  Here is an example.

new_order = env['sale.order'].create({'x_quote_id':record.my_id})

The field "my_id" contains an integer value.

If I try the following, it does work.

new_order = env['sale.order'].create({'x_quote_id':226})

I'm not sure why I am unable to reference an integer stored in the record field but can by directly entering the integer value.


Avatar
Descartar

if you have any error messages can you share it, also log the value of the record.my_id field and see its value. May be it brings a value in which there is no record existing ?

For logging the value from ui: https://www.youtube.com/watch?v=tFR_z4J7p28

Autor

Niyas, thanks for your response.
I wasn't aware of the logging capability, so thanks for that. It will prove useful.
So what is extremely strange is that I simply put the log instruction in my code without changing anything else and now it works.
I'm extremely confused as to why. I removed the log instruction and it is still working.
I have no idea why it is now working

Publicaciones relacionadas Respuestas Vistas Actividad
3
mar 22
26108
1
nov 23
1998
2
dic 23
5547
1
nov 22
2471
1
ago 22
2553