تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
5 الردود
12779 أدوات العرض

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?

الكاتب

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)

الكاتب

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?

أفضل إجابة

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

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
1
يونيو 19
5732
0
سبتمبر 19
98
1
يوليو 17
4597
4
أغسطس 16
8836
1
مايو 16
5401