You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.4 KiB
49 lines
1.4 KiB
odoo.define('advance_cash_flow_statements.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) {
|
|
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
|
|
*/
|
|
_handleAction: function (action, options) {
|
|
|
|
if (action.type === 'ir_actions_xlsx_download') {
|
|
return this._executexlsxReportDownloadAction(action, options);
|
|
}
|
|
return this._super.apply(this, arguments);
|
|
},
|
|
});
|
|
|
|
});
|
|
|