diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2022-09-13 12:05:33 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2022-09-13 12:05:33 +0700 |
| commit | 8f3d096dbae18bacd95796d03b17d4d94a806c85 (patch) | |
| tree | ae90032724dabe417b907db43145639e6df9565f /jasper_reports/static | |
| parent | 0d87fec0c4c6fb573b1a09076f6d50844d8d0a80 (diff) | |
jasper report integration
Diffstat (limited to 'jasper_reports/static')
| -rwxr-xr-x | jasper_reports/static/description/apps.png | bin | 0 -> 28791 bytes | |||
| -rwxr-xr-x | jasper_reports/static/description/create_report.png | bin | 0 -> 23646 bytes | |||
| -rwxr-xr-x | jasper_reports/static/description/data_template.png | bin | 0 -> 9159 bytes | |||
| -rwxr-xr-x | jasper_reports/static/description/example.png | bin | 0 -> 205242 bytes | |||
| -rwxr-xr-x | jasper_reports/static/description/icon.png | bin | 0 -> 4110 bytes | |||
| -rwxr-xr-x | jasper_reports/static/description/index.html | 126 | ||||
| -rwxr-xr-x | jasper_reports/static/description/jasper_menu.png | bin | 0 -> 83310 bytes | |||
| -rwxr-xr-x | jasper_reports/static/description/jasper_studio.png | bin | 0 -> 187562 bytes | |||
| -rwxr-xr-x | jasper_reports/static/description/java_path.png | bin | 0 -> 28631 bytes | |||
| -rwxr-xr-x | jasper_reports/static/description/print_report.png | bin | 0 -> 53493 bytes | |||
| -rwxr-xr-x | jasper_reports/static/src/img/icon.png | bin | 0 -> 4110 bytes | |||
| -rwxr-xr-x | jasper_reports/static/src/js/report/jasperactionmanager.js | 100 |
12 files changed, 226 insertions, 0 deletions
diff --git a/jasper_reports/static/description/apps.png b/jasper_reports/static/description/apps.png Binary files differnew file mode 100755 index 0000000..39dec45 --- /dev/null +++ b/jasper_reports/static/description/apps.png diff --git a/jasper_reports/static/description/create_report.png b/jasper_reports/static/description/create_report.png Binary files differnew file mode 100755 index 0000000..42ac20d --- /dev/null +++ b/jasper_reports/static/description/create_report.png diff --git a/jasper_reports/static/description/data_template.png b/jasper_reports/static/description/data_template.png Binary files differnew file mode 100755 index 0000000..a72efba --- /dev/null +++ b/jasper_reports/static/description/data_template.png diff --git a/jasper_reports/static/description/example.png b/jasper_reports/static/description/example.png Binary files differnew file mode 100755 index 0000000..b9ec346 --- /dev/null +++ b/jasper_reports/static/description/example.png diff --git a/jasper_reports/static/description/icon.png b/jasper_reports/static/description/icon.png Binary files differnew file mode 100755 index 0000000..6c41ad6 --- /dev/null +++ b/jasper_reports/static/description/icon.png diff --git a/jasper_reports/static/description/index.html b/jasper_reports/static/description/index.html new file mode 100755 index 0000000..74cc7f3 --- /dev/null +++ b/jasper_reports/static/description/index.html @@ -0,0 +1,126 @@ +<html> + +<body> + <section class="oe_container oe_dark"> + <div class="oe_row"> + <h2 class="oe_slogan">Jasper Report</h2> + <h3 class="oe_slogan">This Module Gives The Features for creating Jasper Reports</h3> + <div class="oe_row_img oe_centered oe_mt32" align="center"> + <p class="oe_mt32"> + </p> + <img class="oe_picture oe_screenshot" src="apps.png"> + </div> + </div> + </section> + + <section class="oe_container oe_dark"> + <div class="oe_row"> + <h2 class="oe_slogan">Configure Java path</h2> + <h3 class="oe_slogan">In your Odoo web interface, under the Company Data -> Jasper Configuration, add java path.</h3> + <div class="oe_row_img oe_centered oe_mt32" align="center"> + <p class="oe_mt32"> + </p> + <img class="oe_picture oe_screenshot" src="java_path.png"> + </div> + </div> + </section> + + <section class="oe_container oe_dark"> + <div class="oe_row"> + <h2 class="oe_slogan">Jasper Report Menu</h2> + <h3 class="oe_slogan">In your Odoo web interface, under the Technical section, jasper reports menu is there.</h3> + <div class="oe_row_img oe_centered oe_mt32" align="center"> + <p class="oe_mt32"> + </p> + <img class="oe_picture oe_screenshot" src="jasper_menu.png"> + </div> + </div> + </section> + + <section class="oe_container oe_dark"> + <div class="oe_row"> + <h2 class="oe_slogan">Jasper Data Template</h2> + <h3 class="oe_slogan">From your Jasper Menu, Create a jasper reports data template file.</h3> + <div class="oe_row_img oe_centered oe_mt32" align="center"> + <p class="oe_mt32"> + </p> + <img class="oe_picture oe_screenshot" src="data_template.png"> + </div> + </div> + </section> + + <section class="oe_container oe_dark"> + <div class="oe_row"> + <h2 class="oe_slogan">Design Jasper Report</h2> + <h3 class="oe_slogan">In Jasper Studio, import the .xml file which was generated from Odoo and design your Jasper Report as .jrxml.</h3> + <div class="oe_row_img oe_centered oe_mt32" align="center"> + <p class="oe_mt32"> + </p> + <img class="oe_picture oe_screenshot" src="jasper_studio.png"> + </div> + </div> + </section> + + <section class="oe_container oe_dark"> + <div class="oe_row"> + <h2 class="oe_slogan">Create Jasper Report</h2> + <h3 class="oe_slogan">Create a jasper reports for your module with your .jrxml file.</h3> + <div class="oe_row_img oe_centered oe_mt32" align="center"> + <p class="oe_mt32"> + </p> + <img class="oe_picture oe_screenshot" src="create_report.png"> + </div> + <p class="oe_mt32">Demo reports can be founded in jasper_reports/demo folder.</p> + </div> + </section> + + <section class="oe_container oe_dark"> + <div class="oe_row"> + <h2 class="oe_slogan">Print Jasper Report</h2> + <div class="oe_row_img oe_centered oe_mt32" align="center"> + <p class="oe_mt32"> + </p> + <img class="oe_picture oe_screenshot" src="print_report.png"> + </div> + </div> + </section> + + <section class="oe_container oe_dark"> + <div class="oe_row"> + <h2 class="oe_slogan">Example Of Jasper Report</h2> + <div class="oe_row_img oe_centered oe_mt32" align="center"> + <p class="oe_mt32"> + </p> + <img class="oe_picture oe_screenshot" src="example.png"> + </div> + </div> + </section> + + <section class="oe_container oe_dark"> + <div class="oe_row"> + <h2 class="oe_slogan">Jasper Report 'uuid' error</h2> + <div> + <p class="oe_mt32"> + <h4> + <b> Error:<br/> + <br/> + "Attribute 'uuid' is not allowed to appear in element 'jasperReport'."</b><br/> + </h4> + <h4> + <b><br/> + Solution: <br/> + <br/><b> + Solution 1: Open the .jrxml file created and remove uuid attributes. <br/> + Solution 2: Go to the Jasper Studio --> 'Window' --> 'Preferences' <br/> + Jasper Studio --> Compatibility --> In the drop down select/apply 'JasperReports 3.5.1' + </b> + </h4> + </p> + </div> + </div> + </section> + + +</body> + +</html> diff --git a/jasper_reports/static/description/jasper_menu.png b/jasper_reports/static/description/jasper_menu.png Binary files differnew file mode 100755 index 0000000..573fe58 --- /dev/null +++ b/jasper_reports/static/description/jasper_menu.png diff --git a/jasper_reports/static/description/jasper_studio.png b/jasper_reports/static/description/jasper_studio.png Binary files differnew file mode 100755 index 0000000..16d82de --- /dev/null +++ b/jasper_reports/static/description/jasper_studio.png diff --git a/jasper_reports/static/description/java_path.png b/jasper_reports/static/description/java_path.png Binary files differnew file mode 100755 index 0000000..d3b72b1 --- /dev/null +++ b/jasper_reports/static/description/java_path.png diff --git a/jasper_reports/static/description/print_report.png b/jasper_reports/static/description/print_report.png Binary files differnew file mode 100755 index 0000000..77fd821 --- /dev/null +++ b/jasper_reports/static/description/print_report.png diff --git a/jasper_reports/static/src/img/icon.png b/jasper_reports/static/src/img/icon.png Binary files differnew file mode 100755 index 0000000..6c41ad6 --- /dev/null +++ b/jasper_reports/static/src/img/icon.png diff --git a/jasper_reports/static/src/js/report/jasperactionmanager.js b/jasper_reports/static/src/js/report/jasperactionmanager.js new file mode 100755 index 0000000..57616bf --- /dev/null +++ b/jasper_reports/static/src/js/report/jasperactionmanager.js @@ -0,0 +1,100 @@ +odoo.define('report_xml.report', function (require) { + 'use strict'; + + var ActionManager = require('web.ActionManager'); + var core = require('web.core'); + var framework = require('web.framework'); + var session = require('web.session'); + var _t = core._t; + + ActionManager.include({ + + _executeReportAction: function (action, options) { + var self = this; + if (action.report_type === 'jasper') { + return self._triggerDownload(action, options, 'jasper'); + } + return this._super.apply(this, arguments); + }, + + _downloadReportJasper: function (url) { + var self = this; + framework.blockUI(); + return new Promise(function (resolve, reject) { + var reporttype = url.split('/')[2]; + var type = 'jasper'; + var blocked = !session.get_file({ + url: '/report/download', + data: { + data: JSON.stringify([url, type]), + context: JSON.stringify(session.user_context), + }, + success: resolve, + error: (error) => { + self.call('crash_manager', 'rpc_error', error); + reject(); + }, + complete: framework.unblockUI, + }); + if (blocked) { + // AAB: this check should be done in get_file service directly, + // should not be the concern of the caller (and that way, get_file + // could return a promise) + var message = _t('A popup window with your report was blocked. You ' + + 'may need to change your browser settings to allow ' + + 'popup windows for this page.'); + self.do_warn(_t('Warning'), message, true); + } + }); + }, + + _makeReportUrlsJasper: function (action) { + var reportUrls = this._makeReportUrls(action); + reportUrls.jasper = '/report/jasper/' + action.report_name; + + // We may have to build a query string with `action.data`. It's the place + // were report's using a wizard to customize the output traditionally put + // their options. + if (_.isUndefined(action.data) || _.isNull(action.data) || + (_.isObject(action.data) && _.isEmpty(action.data))) { + if (action.context.active_ids) { + var activeIDsPath = '/' + action.context.active_ids.join(','); + reportUrls = _.mapObject(reportUrls, function (value) { + return value += activeIDsPath; + }); + } + reportUrls.html += '?context=' + encodeURIComponent(JSON.stringify(session.user_context)); + } else { + var serializedOptionsPath = '?options=' + encodeURIComponent(JSON.stringify(action.data)); + serializedOptionsPath += '&context=' + encodeURIComponent(JSON.stringify(action.context)); + reportUrls = _.mapObject(reportUrls, function (value) { + return value += serializedOptionsPath; + }); + } + return reportUrls; + }, + + _triggerDownload: function (action, options, type) { + if (type === "jasper") { + var self = this; + var reportUrls = this._makeReportUrlsJasper(action); + return this._downloadReportJasper( + reportUrls[type]).then(function () { + if (action.close_on_report_download) { + var closeAction = { + type: 'ir.actions.act_window_close' + }; + return self.doAction( + closeAction, _.pick(options, 'on_close')); + } else { + return options.on_close(); + } + } + ); + } + return this._super.apply(this, arguments); + + }, + + }); +}); |
