Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata

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
Abbandona

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

Autore

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

Post correlati Risposte Visualizzazioni Attività
3
mar 22
26287
1
nov 23
2164
2
dic 23
5790
1
nov 22
2623
1
ago 22
2664