def getAttachments(self, reqId, expId, expIdObj, report_name): for attach in expIdObj.get('attachments',[]): attachFileName = attach.get("fileName") content = self.jps.getAttachment(reqId, expId, attachFileName) from jasper_erpnext_report.utils.file import get_html_reports_images_path, get_html_reports_path report_path = get_html_reports_path(report_name, hash=self.html_hash) image_path = get_html_reports_images_path(report_path) write_file(content.content, os.path.join(image_path, attachFileName), "wb")
def _get_report(data): jasper_run_method("jasper_before_get_report", data) jsr = jasper_session_obj or Jr.JasperRoot() fileName, content, report_name = jsr.get_report_server(data) pformat = data.get("pformat") if pformat == "html": html_reports_path = get_html_reports_path(report_name, hash=jsr.html_hash) write_file(content[0], os.path.join(html_reports_path, fileName)) return fileName, content, report_name
def save(self): self.save_path = write_file(self.content, self.file_path)
def jasper_save_email(file_path, output): write_file(output, file_path, modes="wb") return file_path