diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2022-05-10 17:14:58 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2022-05-10 17:14:58 +0700 |
| commit | 1ca3b3df3421961caec3b747a364071c80f5c7da (patch) | |
| tree | 6778a1f0f3f9b4c6e26d6d87ccde16e24da6c9d6 /account_reports_xlsx/static/src | |
| parent | b57188be371d36d96caac4b8d65a40745c0e972c (diff) | |
initial commit
Diffstat (limited to 'account_reports_xlsx/static/src')
| -rw-r--r-- | account_reports_xlsx/static/src/js/action_manager.js | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/account_reports_xlsx/static/src/js/action_manager.js b/account_reports_xlsx/static/src/js/action_manager.js new file mode 100644 index 0000000..15ef8d3 --- /dev/null +++ b/account_reports_xlsx/static/src/js/action_manager.js @@ -0,0 +1,52 @@ +odoo.define('account_reports_xlsx.ActionManager', function (require) { +"use strict"; + +/** + * The purpose of this file is to add the actions of type + * 'ir_actions_xlsx_download' to the ActionManager. + */ + +var ActionManager = require('web.ActionManager'); +var framework = require('web.framework'); +var session = require('web.session'); + +ActionManager.include({ + + /** + * Executes actions of type 'ir_actions_xlsx_download'. + * + * @private + * @param {Object} action the description of the action to execute + * @returns {Deferred} resolved when the report has been downloaded ; + * rejected if an error occurred during the report generation + */ + _executexlsxReportDownloadAction: function (action) { + console.log("ExecutexlsxReportDownloadAction") + console.log(action) + framework.blockUI(); + var def = $.Deferred(); + session.get_file({ + url: '/xlsx_reports', + data: action.data, + success: def.resolve.bind(def), + error: (error) => this.call('crash_manager', 'rpc_error', error), + complete: framework.unblockUI, + }); + return def; + }, + /** + * Overrides to handle the 'ir_actions_xlsx_download' actions. + * + * @override + * @private + */ + _executeReportAction: function (action, options) { + console.log("inside Execute report action") + if (action.report_type === 'xlsx') { + return this._executexlsxReportDownloadAction(action, options); + } + return this._super.apply(this, arguments); + }, +}); + +}); |
