[IMP] Add notification on the web client when wkhtmltopdf is not present or too old
bzr revid: sle@openerp.com-20140227154046-hxnhyho6v096hjx8
This commit is contained in:
parent
4f979046ed
commit
27a232596c
|
@ -529,6 +529,7 @@ class Report(http.Controller):
|
|||
|
||||
if LooseVersion(version) < LooseVersion('0.12.0'):
|
||||
_logger.warning('Upgrade WKHTMLTOPDF to (at least) 0.12.0')
|
||||
return 'upgrade'
|
||||
|
||||
return True
|
||||
except:
|
||||
|
|
|
@ -7,6 +7,7 @@ openerp.report = function(instance) {
|
|||
action = _.clone(action);
|
||||
var eval_contexts = ([instance.session.user_context] || []).concat([action.context]);
|
||||
action.context = instance.web.pyeval.eval('contexts',eval_contexts);
|
||||
_t = instance.web._t;
|
||||
|
||||
// QWeb reports
|
||||
if ('report_type' in action && (action.report_type == 'qweb-html' || action.report_type == 'qweb-pdf' || action.report_type == 'controller')) {
|
||||
|
@ -48,7 +49,7 @@ openerp.report = function(instance) {
|
|||
}
|
||||
if (action.report_type == 'qweb-html') {
|
||||
// Open the html report in a popup
|
||||
window.open(report_url);
|
||||
window.open(report_url, '_blank', 'height=768,width=1024');
|
||||
instance.web.unblockUI();
|
||||
return;
|
||||
} else {
|
||||
|
@ -61,10 +62,14 @@ openerp.report = function(instance) {
|
|||
openerp.session.rpc('/report/check_wkhtmltopdf').then(function (presence) {
|
||||
// Fallback of qweb-pdf if wkhtmltopdf is not installed
|
||||
if (!presence && action.report_type == 'qweb-pdf') {
|
||||
self.do_notify(_t('Report'), _t('Unable to find Wkhtmltopdf on this system. The report will be shown in html.'), true);
|
||||
window.open(report_url.substring(12), '_blank', 'height=768,width=1024');
|
||||
instance.web.unblockUI();
|
||||
}
|
||||
else {
|
||||
if (presence == 'upgrade') {
|
||||
self.do_notify(_t('Report'), _t('You should upgrade your version of Wkhtmltopdf to at least 0.12.0 in order to get a correct display of headers and footers as well as support for table-breaking between pages.'), true);
|
||||
}
|
||||
self.session.get_file({
|
||||
url: '/report/download',
|
||||
data: {data: JSON.stringify(response)},
|
||||
|
|
Loading…
Reference in New Issue