Odoo Help


This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Hot to get the current id into a method

Lucas Huber
on 3/2/16, 9:14 AM 975 views

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.

self.id didn't work?

Axel Mendoza
on 3/2/16, 12:17 PM

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

Lucas Huber
on 3/5/16, 9:07 AM

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

Shivam Mahajan
on 3/15/16, 7:04 AM

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?

Lucas Huber
on 3/15/16, 8:36 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)


Asked: 3/2/16, 9:14 AM
Seen: 975 times
Last updated: 3/2/16, 9:14 AM