From fd6b4fde142ef971de1eb3daa72ef5a38e8a693c Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Tue, 6 Sep 2011 13:57:54 +0200 Subject: [PATCH] [FIX] reintroduce reports mistakenly removed at revision xmo@openerp.com-20110905142455-1nt310pqzyzk69cp they probably shouldn't have been called Export bzr revid: xmo@openerp.com-20110906115754-i19nn5oi9fhqpmbd --- addons/web/controllers/main.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index b7c6ac0cfc9..d9edee1cfca 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -1335,3 +1335,26 @@ class ExcelExport(Export): data = fp.read() fp.close() return data + + +class Reports(View): + _cp_path = "/web/report" + + @openerpweb.jsonrequest + def get_report(self, req, action): + report_srv = req.session.proxy("report") + context = req.session.eval_context(openerpweb.nonliterals.CompoundContext(req.context, \ + action["context"])) + + args = [req.session._db, req.session._uid, req.session._password, action["report_name"], context["active_ids"], {"id": context["active_id"], "model": context["active_model"], "report_type": action["report_type"]}, context] + report_id = report_srv.report(*args) + report = None + while True: + args2 = [req.session._db, req.session._uid, req.session._password, report_id] + report = report_srv.report_get(*args2) + if report["state"]: + break + time.sleep(_REPORT_POLLER_DELAY) + + #TODO: ok now we've got the report, and so what? + return False