Skip to Content
Menu
This question has been flagged

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
Discard
Author Best Answer

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
Discard
Best Answer

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
Discard
Best Answer

Hello @Christoph

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

Avatar
Discard
Related Posts Replies Views Activity
2
Jun 23
6653
1
Sep 23
1686
3
Dec 24
6115
1
Apr 24
3048
1
Jan 24
1668