跳至內容
選單
此問題已被標幟
5 回覆
12785 瀏覽次數

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
6月 19
5739
0
9月 19
98
1
7月 17
4615
4
8月 16
8849
1
5月 16
5412