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

I have a custom module, and i want to modify a field just before it opens(basically update the model's field, from another model) and i need to use the fields_view_get function... but i don't know how to get the id o f the opened model...the context doesnt have it, and what the super() gives back (res) doesnt contains those data...

How can i get the current active model id?

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hi, what is the print result of this code in first part of method fields_view_get :

cr.execute("""SELECT id FROM ir_model 
                          WHERE model = %s""", (str(self._name),))            
info = cr.dictfetchall()  
if info:
    model_id = info[0]['id'] 
    print str(model_id)

Bye

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

You can't. I've the some problem and I searched a solution with a lot of ways but I think it's impossibile because when fields_view_get trigs you haven't reference to original record.

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
3
พ.ย. 24
30038
1
ธ.ค. 21
2765
0
ธ.ค. 21
2330
0
เม.ย. 15
4660
0
มี.ค. 15
3778