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

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.

頭像
捨棄
最佳答案

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

頭像
捨棄

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.

最佳答案

print self.ids

or

print self._ids

頭像
捨棄
最佳答案

Hi Jainesh Shah,

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

Thank you.

頭像
捨棄
最佳答案

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

頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
0
9月 23
41
2
7月 22
3856
0
5月 22
2139
1
11月 21
18527
2
10月 21
7607