← Back to team overview

openerp-community-reviewer team mailing list archive

lp:~bcim/account-financial-report/fix-account_financial_report_webkit-force-mako into lp:account-financial-report

 

Jacques-Etienne Baudoux has proposed merging lp:~bcim/account-financial-report/fix-account_financial_report_webkit-force-mako into lp:account-financial-report.

Requested reviews:
  Account Report Core Editors (account-report-core-editor)

For more details, see:
https://code.launchpad.net/~bcim/account-financial-report/fix-account_financial_report_webkit-force-mako/+merge/200014

Since begin of 2013, OpenERP moved from mako to jinja for the reports. The reports are build in mako and webkit_parser_header_fix.py already redefined generate_pdf and create_single_pdf using mako but was still based on standard mako_template method which is now using jinja for OpenERP version >7.0.
I have redefined in this module "mako_template" using mako to allow those reports to work fine on OpenERP >7.0
-- 
https://code.launchpad.net/~bcim/account-financial-report/fix-account_financial_report_webkit-force-mako/+merge/200014
Your team Account Report Core Editors is requested to review the proposed merge of lp:~bcim/account-financial-report/fix-account_financial_report_webkit-force-mako into lp:account-financial-report.
=== modified file 'account_financial_report_webkit/report/webkit_parser_header_fix.py'
--- account_financial_report_webkit/report/webkit_parser_header_fix.py	2013-11-03 12:55:27 +0000
+++ account_financial_report_webkit/report/webkit_parser_header_fix.py	2013-12-24 13:21:07 +0000
@@ -41,7 +41,6 @@
 from openerp import pooler
 from openerp import tools
 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
 
 _logger = logging.getLogger('financial.reports.webkit')
@@ -71,6 +70,19 @@
 #        })
 
 
+# redefine mako_template as this is overriden by jinja since saas-1
+# from openerp.addons.report_webkit.webkit_report import mako_template
+def mako_template(text):
+    """Build a Mako template.
+
+    This template uses UTF-8 encoding
+    """
+    from mako.template import Template
+    from mako.lookup import TemplateLookup
+    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):
 
     def generate_pdf(self, comm_path, report_xml, header, footer, html_list, webkit_header=False):


Follow ups