跳至內容
選單
此問題已被標幟

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.


頭像
捨棄

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

作者

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

相關帖文 回覆 瀏覽次數 活動
3
3月 22
26286
1
11月 23
2164
2
12月 23
5790
1
11月 22
2621
1
8月 22
2663