Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
2 Răspunsuri
10378 Vizualizări

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?

Imagine profil
Abandonează
Cel mai bun răspuns

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

Imagine profil
Abandonează
Cel mai bun răspuns

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.

Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
3
nov. 24
29952
1
dec. 21
2720
0
dec. 21
2280
0
apr. 15
4580
0
mar. 15
3721