Hi everyone,
I'm currently trying to implement a client-side variable on Odoo 10 (if that makes any sense).
What I mean by that would be a variable usable globally in Odoo, easily readable/editable, and bound to only one computer.
I tried several methods:
In my ignorance, I tried to use a python file globalv.py inside which I put the line "variable=0". Then I imported it anytime I needed the variable in my code. This way I had almost everything I needed, except that the variable was shared by every computer of the network. It made me understand that the python methods were only used server side (at least to my knowledge).
I then tried to use Javascript which is said to be client-side. As a complete beginner, I defined a variable in an odoo function but couldn't export it in order to use it or manipulate it like something passed by reference in C++ (I think I can't use pointers here). Therefore, I gave up on Javascript as well.
Then I tried to use the context, because I believe it to be client-side (not sure tho?). The problem is, it seems the context is in fact bound to a recordset, and it looks complicated to pass my variable everytime and everywhere since I in fact need it everytime and everywhere.
Finally I imagined that the user accessible with self.env.user, is client-side as two computers can connect to two different users even though they're connected to the same server. I tried to modify the api completely to include a variable inside the environment class and a custom sudo that would edit this variable but I gave up since little by little, I was modifying every method and class.
I hope you can tell me if I'm being logical here or if it's completely impossible to implement such a thing. (And if someone can explicit what is the context or see some inaccurate detail here, please feel free to share your knowledge too)
I really appreciate for your efforts to add all the possible details in the question. Such details really help people to give answer. +1 for good question and enough details.