コンテンツへスキップ
メニュー
この質問にフラグが付けられました
2 返信
10280 ビュー

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.

アバター
破棄
関連投稿 返信 ビュー 活動
3
11月 24
29677
1
12月 21
2617
0
12月 21
2173
0
4月 15
4446
0
3月 15
3594