Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
4 Odpovědi
16831 Zobrazení

Hi Community,

 I use self.id inside of onchange that is returning me " <openerp.models.Newid object at 0xb0efbc4c>".

- I want to get record's id.

Any idea?

Thanks in advance.

Avatar
Zrušit
Nejlepší odpověď

If your record is already created in Odoo, 

Then on onchange method you can access it using self._origin.

If record is not created, then there is no way to access it uptil record is not saved.


hope this helps..

Avatar
Zrušit

Just what I was looking for, thanks Asmita!

Is this work in compute function

I am not sure about this, but it won't work on compute field function, as in compute field function we can directly access record's id, once it is saved.

Nejlepší odpověď

print self.ids

or

print self._ids

Avatar
Zrušit
Nejlepší odpověď

Hi Jainesh Shah,

You can only get the record's id after saving your details.

Thank you.

Avatar
Zrušit
Nejlepší odpověď

Hi Jainesh,

yes it's possible,

example =

self.browse (cr, uid, ids [0])


https://www.odoo.com/fr_FR/forum/aide-1/question/is-it-possible-to-capture-both-original-and-new-values-in-an-on-change-method-44119

Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
0
zář 23
41
2
čvc 22
3702
0
kvě 22
2014
1
lis 21
18410
2
říj 21
7387