Stephane Wirtel (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-wkhtmltopdf-stw into 
lp:openobject-addons.

Requested reviews:
  OpenERP Core Team (openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-wkhtmltopdf-stw/+merge/93161
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-wkhtmltopdf-stw/+merge/93161
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-wkhtmltopdf-stw.
=== modified file 'l10n_ch/report/report_webkit_html.py'
--- l10n_ch/report/report_webkit_html.py	2012-01-17 17:21:53 +0000
+++ l10n_ch/report/report_webkit_html.py	2012-02-15 09:16:48 +0000
@@ -309,7 +309,7 @@
             except Exception, e:
                raise Exception(exceptions.text_error_template().render())
             return (deb, 'html')
-        bin = self.get_lib(cursor, uid, company.id)
+        bin = self.get_lib(cursor, uid)
         pdf = self.generate_pdf(bin, report_xml, head, foot, htmls)
         return (pdf, 'pdf')
     

=== modified file 'report_webkit/webkit_report.py'
--- report_webkit/webkit_report.py	2012-02-13 08:42:42 +0000
+++ report_webkit/webkit_report.py	2012-02-15 09:16:48 +0000
@@ -73,6 +73,7 @@
 
     def get_lib(self, cursor, uid, company) :
         """Return the lib wkhtml path"""
+<<<<<<< TREE
         #TODO Detect lib in system first
         path = self.pool.get('res.company').read(cursor, uid, company, ['lib_path',])
         path = path['lib_path']
@@ -100,6 +101,35 @@
                             _('path to Wkhtmltopdf is not absolute'),
                             'for path %s'%(path)
                             )
+=======
+
+        proxy = self.pool.get('ir.config_parameter')
+        webkit_path = proxy.get_param(cursor, uid, 'webkit_path')
+
+        if not webkit_path:
+            try:
+                defpath = os.environ.get('PATH', os.defpath).split(os.pathsep)
+                if hasattr(sys, 'frozen'):
+                    defpath.append(os.getcwd())
+                    if tools.config['root_path']:
+                        defpath.append(os.path.dirname(tools.config['root_path']))
+                webkit_path = tools.which('wkhtmltopdf', path=os.pathsep.join(defpath))
+            except IOError:
+                webkit_path = None
+
+        if webkit_path:
+            return webkit_path
+
+        raise except_osv(
+                         _('Wkhtmltopdf library path is not set'),
+                         _('Please install executable on your system' \
+                         ' (sudo apt-get install wkhtmltopdf) or download it from here:' \
+                         ' http://code.google.com/p/wkhtmltopdf/downloads/list and set the' \
+                         ' path in the ir.config_parameter with the webkit_path key.' \
+                         'Minimal version is 0.9.9')
+                        )
+
+>>>>>>> MERGE-SOURCE
     def generate_pdf(self, comm_path, report_xml, header, footer, html_list, webkit_header=False):
         """Call webkit in order to generate pdf"""
         if not webkit_header:

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to