Browse Source

[FIX] account_financial_report_webkit: force mako as jinja is new standard since saas-1

pull/7/merge
unknown 11 years ago
committed by Yannick Vaucher
parent
commit
802635b85f
  1. 2
      account_financial_report_webkit/__openerp__.py
  2. 15
      account_financial_report_webkit/report/webkit_parser_header_fix.py

2
account_financial_report_webkit/__openerp__.py

@ -126,7 +126,7 @@ an issue in wkhtmltopdf
the header and footer are created as text with arguments passed to the header and footer are created as text with arguments passed to
wkhtmltopdf. The texts are defined inside the report classes. wkhtmltopdf. The texts are defined inside the report classes.
""", """,
'version': '1.0',
'version': '1.0.1',
'author': 'Camptocamp', 'author': 'Camptocamp',
'license': 'AGPL-3', 'license': 'AGPL-3',
'category': 'Finance', 'category': 'Finance',

15
account_financial_report_webkit/report/webkit_parser_header_fix.py

@ -41,7 +41,6 @@ from openerp import addons
from openerp import pooler from openerp import pooler
from openerp import tools from openerp import tools
from openerp.addons.report_webkit import webkit_report from openerp.addons.report_webkit import webkit_report
from openerp.addons.report_webkit.webkit_report import mako_template
from openerp.addons.report_webkit.report_helper import WebKitHelper from openerp.addons.report_webkit.report_helper import WebKitHelper
_logger = logging.getLogger('financial.reports.webkit') _logger = logging.getLogger('financial.reports.webkit')
@ -71,6 +70,20 @@ _logger = logging.getLogger('financial.reports.webkit')
# }) # })
# redefine mako_template as this is overriden by jinja since saas-1
# from openerp.addons.report_webkit.webkit_report import mako_template
from mako.template import Template
from mako.lookup import TemplateLookup
def mako_template(text):
"""Build a Mako template.
This template uses UTF-8 encoding
"""
tmp_lookup = TemplateLookup() #we need it in order to allow inclusion and inheritance
return Template(text, input_encoding='utf-8', output_encoding='utf-8', lookup=tmp_lookup)
class HeaderFooterTextWebKitParser(webkit_report.WebKitParser): class HeaderFooterTextWebKitParser(webkit_report.WebKitParser):
def generate_pdf(self, comm_path, report_xml, header, footer, html_list, webkit_header=False): def generate_pdf(self, comm_path, report_xml, header, footer, html_list, webkit_header=False):

Loading…
Cancel
Save