Zum Inhalt springen
Menü
Sie müssen registriert sein, um mit der Community zu interagieren.
Diese Frage wurde gekennzeichnet
2 Antworten
10436 Ansichten

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?

Avatar
Verwerfen
Beste Antwort

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

Avatar
Verwerfen
Beste Antwort

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.

Avatar
Verwerfen
Verknüpfte Beiträge Antworten Ansichten Aktivität
3
Nov. 24
30046
1
Dez. 21
2769
0
Dez. 21
2332
0
Apr. 15
4661
0
März 15
3781