[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
This commit is contained in:
Xavier Morel 2011-09-06 13:57:54 +02:00
parent 9b82be28f2
commit fd6b4fde14
1 changed files with 23 additions and 0 deletions

View File

@ -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