Skip to Content
Menu
This question has been flagged

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
Discard

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

Author

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

Related Posts Replies Views Activity
3
Mar 22
24845
1
Nov 23
870
2
Dec 23
4064
1
Nov 22
1439
1
Aug 22
1495