|
|
@ -48,11 +48,12 @@ _logger = logging.getLogger('financial.reports.webkit') |
|
|
|
# Class used only as a workaround to bug: |
|
|
|
# http://code.google.com/p/wkhtmltopdf/issues/detail?id=656 |
|
|
|
|
|
|
|
# html headers and footers do not work on big files (hundreds of pages) so we replace them by |
|
|
|
# text headers and footers passed as arguments to wkhtmltopdf |
|
|
|
# html headers and footers do not work on big files (hundreds of pages) so we |
|
|
|
# replace them by text headers and footers passed as arguments to wkhtmltopdf |
|
|
|
# this class has to be removed once the bug is fixed |
|
|
|
|
|
|
|
# in your report class, to print headers and footers as text, you have to add them in the localcontext with a key 'additional_args' |
|
|
|
# in your report class, to print headers and footers as text, you have to add |
|
|
|
# them in the localcontext with a key 'additional_args' |
|
|
|
# for instance: |
|
|
|
# header_report_name = _('PARTNER LEDGER') |
|
|
|
# footer_date_time = self.formatLang(str(datetime.today()), date_time=True) |
|
|
@ -75,6 +76,7 @@ _logger = logging.getLogger('financial.reports.webkit') |
|
|
|
from mako.template import Template |
|
|
|
from mako.lookup import TemplateLookup |
|
|
|
|
|
|
|
|
|
|
|
def mako_template(text): |
|
|
|
"""Build a Mako template. |
|
|
|
|
|
|
@ -165,7 +167,9 @@ class HeaderFooterTextWebKitParser(webkit_report.WebKitParser): |
|
|
|
context = {} |
|
|
|
htmls = [] |
|
|
|
if report_xml.report_type != 'webkit': |
|
|
|
return super(HeaderFooterTextWebKitParser,self).create_single_pdf(cursor, uid, ids, data, report_xml, context=context) |
|
|
|
return super(HeaderFooterTextWebKitParser, self |
|
|
|
).create_single_pdf(cursor, uid, ids, data, |
|
|
|
report_xml, context=context) |
|
|
|
|
|
|
|
parser_instance = self.parser(cursor, |
|
|
|
uid, |
|
|
@ -187,7 +191,7 @@ class HeaderFooterTextWebKitParser(webkit_report.WebKitParser): |
|
|
|
if not template: |
|
|
|
raise except_osv(_('Error!'), _('Webkit Report template not found !')) |
|
|
|
header = report_xml.webkit_header.html |
|
|
|
footer = report_xml.webkit_header.footer_html |
|
|
|
|
|
|
|
if not header and report_xml.header: |
|
|
|
raise except_osv( |
|
|
|
_('No header defined for this Webkit report!'), |
|
|
@ -227,7 +231,8 @@ class HeaderFooterTextWebKitParser(webkit_report.WebKitParser): |
|
|
|
_logger.error(msg) |
|
|
|
raise except_osv(_('Webkit render'), msg) |
|
|
|
|
|
|
|
# NO html footer and header because we write them as text with wkhtmltopdf |
|
|
|
# NO html footer and header because we write them as text with |
|
|
|
# wkhtmltopdf |
|
|
|
head = foot = False |
|
|
|
|
|
|
|
if report_xml.webkit_debug: |
|
|
|