Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
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).
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)
Why don't you use Odoo HTTP session? This will be saved at client-side for temporary time period.
from odoo.http import request
# Save value in session by using current logged user ID as key
request.session[request.env.uid] = 'Your Value'
#Get session value
I hope this will help you at some level to move further.
Sudhir Arya ERP Harbor Consulting Services Skype: firstname.lastname@example.org Website: http://www.erpharbor.com