Ir al contenido
Menú
Se marcó esta pregunta

Hi there, 


How can I run a function always after opening a form view from a One2Many treeview. 


I have in my model a treeview that opens the rows in form, but how can I run a function after the form is opened. 


Does anyone have a solution for ODOO 16?

Avatar
Descartar
Autor Mejor respuesta

Hi, 


I have tried this but it is not working. 

The problem I think is that I have an opened record in form view and inside this form view I have a one2many treeview that I open as form popup. 

With the compute methot the first time i open the record and that i click on the rows the function is called but when i open the same row a secound time the function is not called again. 


The problem for me is that I want to do a few things that need to run on every open of the form popup. 

I want to run a availability check function witch will give me all the availability values from the products. 

Closing the main record every time is not the solution I want to have there.

I also tried get_view, same problem, it only works the first time I open the line, after that it doesn't work anymore.

Avatar
Descartar
Mejor respuesta

Hi,

If the field exists in view, you can use the compute method. Compute method works whenever the field is opened in the view.You can read about it more from the article below:https://www.odoo.com/documentation/16.0/es/developer/tutorials/getting_started/09_compute_onchange.html

Another way you could do this is use the get_view function.This function is triggered every time a model is rendered in Odoo.


Hope it helps

Avatar
Descartar
Mejor respuesta

Hello @Christoph

You can add the one field with compute method. Compute method will call always.

Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
2
jun 23
7113
1
sept 23
1863
3
dic 24
6417
1
abr 24
3311
1
ene 24
1864