Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
4 Răspunsuri
16863 Vizualizări

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.

Imagine profil
Abandonează
Cel mai bun răspuns

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..

Imagine profil
Abandonează

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.

Cel mai bun răspuns

print self.ids

or

print self._ids

Imagine profil
Abandonează
Cel mai bun răspuns

Hi Jainesh Shah,

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

Thank you.

Imagine profil
Abandonează
Cel mai bun răspuns

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

Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
0
sept. 23
41
2
iul. 22
3756
0
mai 22
2050
1
nov. 21
18449
2
oct. 21
7438