My task: a dynamic progress bar in odoo.
I'm using the Odoo widget: 'progressbar'. I want to update the view every time the value is updated - hence I want to trigger the on_change_input
javascript function inside my python write method to render the view.
@api.one
def updatevalue(self, val):
self.value = val
# TODO call javascript function on_change_input()
The purpose is, that the progressbar should be updated while a process is running and the user should see the progress without updating the site.
Is my task possible with the progressbar widget? Or is there another possibility to show dynamic content in Odoo?
If I use my updatevalue
method as button, the progressbar is updated after clicking the button without calling the javascript function & without refreshing the page... but I do want to call the method in my code (and probably over rpc) therefore this does not help -.-
Thank you for your time!
Here is the workflow I have so far:
The user clicks on the button do_time_consuming_task
and the following function is called:
def do_timeconsuming_task(self):
ws = websocket.WebSocket()
ws.connect('ws:/129.0.0.1:1234/')
data = { 'topic' : 'server_command', 'id' : self.id, 'commandName' : 'do_sth',}
payload = ujson.dumps(data)
ws.send(payload)
ws.close()
On the server, the command is received and processed. There is an open rpc connection:
odoo = odoorpc.ODOO("129.0.0.1", port=8069)
odoo.login("database", "user", "password")
my_module = odoo.env['my_module.progress_widget_test']
progress_instance = my_module.browse(id)
Every time the progress value changes I call the following method of my module:
progress_instance.updatevalue(new_value)
when the value equals 100 % I close the connection
odoo.logout()
updatevalue
method. Which of the CybroOdoo Addons are you referring to? – IstaLibera