diff --git a/controllers/controllers.py b/controllers/controllers.py index c0d837e..673e0f6 100644 --- a/controllers/controllers.py +++ b/controllers/controllers.py @@ -108,6 +108,21 @@ def call_obj_function(self, model, rec_id, function, **post): result = getattr(obj, function)(*args, **kwargs) return result + @http.route( + '/object///', + type='json', auth='user', methods=["POST"], csrf=False) + def call_objs_function(self, model, rec_ids, function, **post): + args = [] + kwargs = {} + if "args" in post: + args = post["args"] + if "kwargs" in post: + kwargs = post["kwargs"] + rec_ids = map(int, rec_ids.split(",")) + objs = request.env[model].browse(rec_ids) + result = getattr(objs, function)(*args, **kwargs) + return result + @http.route( '/api/', type='http', auth='user', methods=['GET'], csrf=False)