Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
4 ตอบกลับ
17016 มุมมอง

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

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
0
ก.ย. 23
41
2
ก.ค. 22
3850
0
พ.ค. 22
2134
1
พ.ย. 21
18520
2
ต.ค. 21
7596