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

I have an @api.one method and need the id of the current record. Like the other magic field as create_date aso., I can get this fields into a view but I didn'd find a solution to get them into @api.one method. If I try "print  self.create_date"  the result is false.


Imagine profil
Abandonează

self.id didn't work?

Autor

No self.id gets the following result: "openerp.models.NewId object at 0x7f36a85bd250" But actually I don't work in new record.

Simply use the ids value defined in method defination def method_name(self, cr, uid, ids, ,context=None)

Autor

Sorry Shivam, I don't understand your comment. I'm not so used in the old API. Do I have to create a method to get the ID?

Cel mai bun răspuns

This question is pretty old but for anyone who wandered looking for an answer, 
Try:  "self._origin.id"

Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
1
iun. 19
5597
0
sept. 19
98
1
iul. 17
4399
4
aug. 16
8596
1
mai 16
5205