Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Calling server method asynchronously

By
Mayte
on 1/5/16, 1:25 PM 247 views

Hello:


I have a time consuming server method that needs to be run asynchronously so user can keep working on something else while method is running on the backend.

Currently I am doing it thru a cron job, but now I need to call the method per user request thru a form button.


I tried JS RPC high-level API thru XML button; py method is run but still UI gets held upon method completion.

This is the JS I am running.


Thanks!


Mayte

openerp.my_addon = function (instance,action) {

instance.web.client_actions.add('my.addon.validate.action', 'instance.my_addon.validate_action');

instance.my_addon.validate_action = function (parent, action) {

var active_id = action.context.active_id;


   var MyModel = new instance.web.Model('my.model');
MyModel.call("call_model_method", [[active_id]]);
return;
};
};

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 1/5/16, 1:25 PM
Seen: 247 times
Last updated: 1/5/16, 1:31 PM