Skip to content

Instantly share code, notes, and snippets.

@bbn-bernard
Created October 6, 2014 09:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bbn-bernard/b87b24d23006c29978f5 to your computer and use it in GitHub Desktop.
Save bbn-bernard/b87b24d23006c29978f5 to your computer and use it in GitHub Desktop.
diff --git a/addons/report/models/report.py b/addons/report/models/report.py
index c2e1cd2..e37a721 100644
--- a/addons/report/models/report.py
+++ b/addons/report/models/report.py
@@ -46,8 +46,12 @@ from pyPdf import PdfFileWriter, PdfFileReader
_logger = logging.getLogger(__name__)
def _get_wkhtmltopdf_bin():
- defpath = os.environ.get('PATH', os.defpath).split(os.pathsep)
- return which('wkhtmltopdf', path=os.pathsep.join(defpath))
+ webkit_path = config['webkit_path']
+ if not webkit_path:
+ defpath = os.environ.get('PATH', os.defpath).split(os.pathsep)
+ webkit_path = which('wkhtmltopdf', path=os.pathsep.join(defpath))
+
+ return webkit_path
#--------------------------------------------------------------------------
diff --git a/openerp/tools/config.py b/openerp/tools/config.py
index 3fb940e..2edc248 100644
--- a/openerp/tools/config.py
+++ b/openerp/tools/config.py
@@ -283,6 +283,12 @@ class configmanager(object):
group.add_option("--unaccent", dest="unaccent", my_default=False, action="store_true",
help="Use the unaccent function provided by the database when available.")
parser.add_option_group(group)
+
+ # report options
+ group = optparse.OptionGroup(parser, "Reporting Engine")
+ group.add_option("--webkit-path", dest="webkit_path", my_default=False, action="store_true",
+ help="Set wkhtmltopdf executable path")
+ parser.add_option_group(group)
if os.name == 'posix':
group = optparse.OptionGroup(parser, "Multiprocessing options")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment