Odoo中文网|Odoo实施培训

 找回密码
 立即注册
搜索
热搜: Odoo OpenERP 实施
查看: 3569|回复: 1
打印 上一主题 下一主题

Odoo9中,怎样去掉QWeb HTML Report中的Save or Discard?

[复制链接]

14

主题

35

帖子

122

积分

注册会员

Rank: 2

积分
122
跳转到指定楼层
楼主
发表于 2015-11-1 15:54:29 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
如题,QWeb HTML Report中的Save or Discard怎么去掉?
回复

使用道具 举报

6

主题

20

帖子

62

积分

版主

Rank: 7Rank: 7Rank: 7

积分
62
沙发
发表于 2015-11-1 16:15:25 | 只看该作者
修改/openerp/addons/report/static/src/js/qwebactionmanager.js,如下所示:
odoo.define('module.report', function (require) {

var ActionManager = require('web.ActionManager');
var core = require('web.core');
var crash_manager = require('web.crash_manager');
var framework = require('web.framework');
var session = require('web.session');

var _t = core._t;
var wkhtmltopdf_state;

var trigger_download = function(session, response, c, action, options) {
session.get_file({
url: '/report/download',
data: {data: JSON.stringify(response)},
complete: framework.unblockUI,
error: c.rpc_error.bind(c),
success: function(){
if (action && options && !action.dialog) {
options.on_close();
}
},
});
};

ActionManager.include({
ir_actions_report_xml: function(action, options) {
var self = this;
framework.blockUI();
action = _.clone(action);
_t = core._t;

// QWeb reports
if ('report_type' in action && (action.report_type == 'qweb-html' || action.report_type == 'qweb-pdf' || action.report_type == 'controller')) {
var report_url = '';
switch (action.report_type) {
case 'qweb-html':
report_url = '/report/html/' + action.report_name;
break;
case 'qweb-pdf':
report_url = '/report/pdf/' + action.report_name;
break;
case 'controller':
report_url = action.report_file;
break;
default:
report_url = '/report/html/' + action.report_name;
break;
}

// generic report: no query string
// particular: query string of action.data.form and context
if (!('data' in action) || !(action.data)) {
if ('active_ids' in action.context) {
report_url += "/" + action.context.active_ids.join(',');
}
} else {
report_url += "?options=" + encodeURIComponent(JSON.stringify(action.data));
report_url += "&context=" + encodeURIComponent(JSON.stringify(action.context));
}

var response = new Array();
response[0] = report_url;
response[1] = action.report_type;
var c = crash_manager;

if (action.report_type == 'qweb-html') {
window.open(report_url, '_blank', 'scrollbars=1,height=900,width=1280');
framework.unblockUI();
} else if (action.report_type === 'qweb-pdf') {
// Trigger the download of the pdf/controller report
(wkhtmltopdf_state = wkhtmltopdf_state || session.rpc('/report/check_wkhtmltopdf')).then(function (presence) {
// Fallback on html if wkhtmltopdf is not installed or if OpenERP is started with one worker
if (presence === 'install') {
self.do_notify(_t('Report'), _t('Unable to find Wkhtmltopdf on this \
system. The report will be shown in html.<br><br><a href="http://wkhtmltopdf.org/" target="_blank">\
wkhtmltopdf.org</a>'), true);
report_url = report_url.substring(12);
window.open('/report/html/' + report_url, '_blank', 'height=768,width=1024');
framework.unblockUI();
return;
} else if (presence === 'workers') {
self.do_notify(_t('Report'), _t('You need to start OpenERP with at least two \
workers to print a pdf version of the reports.'), true);
report_url = report_url.substring(12);
window.open('/report/html/' + report_url, '_blank', 'height=768,width=1024');
framework.unblockUI();
return;
} 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.<br><br><a href="http://wkhtmltopdf.org/" \
target="_blank">wkhtmltopdf.org</a>'), true);
}
return trigger_download(self.session, response, c, action, options);
});
} else if (action.report_type === 'controller') {
return trigger_download(self.session, response, c, action, options);
}
} else {
return self._super(action, options);
}
}
});

});
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|小黑屋|技术支持|开发手册|Odoo中文网-远鼎旗下odoo培训网站 ( 苏ICP备15039516号 )

GMT+8, 2024-4-26 07:36 , Processed in 0.009991 second(s), 8 queries , Xcache On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表