4 changed files with 55 additions and 13 deletions
@ -1,20 +1,27 @@ |
|||||
/** @odoo-module **/ |
/** @event_management/static/src/js/action_manager.js **/ |
||||
/** Xlsx report action manager */ |
import { registry } from "@web/core/registry"; |
||||
import {registry} from "@web/core/registry"; |
import { BlockUI, unblockUI } from "@web/core/ui/block_ui"; |
||||
import { BlockUI } from "@web/core/ui/block_ui"; |
|
||||
import { download } from "@web/core/network/download"; |
import { download } from "@web/core/network/download"; |
||||
/**XLSX HandlerThis handler is responsible for generating XLSX reports. |
|
||||
It sends a request to the server to generate the report in XLSX format and |
const reportHandlers = registry.category("ir.actions.report handlers"); |
||||
downloads the generated file.@param {Object} action - The action object |
|
||||
containing the report details.@returns {Promise} - A promise that resolves |
if (reportHandlers.contains("xlsx")) { |
||||
when the report generation is complete.*/ |
reportHandlers.remove("xlsx"); |
||||
registry.category("ir.actions.report handlers").add("xlsx", async (action) => { |
} |
||||
|
reportHandlers.add("xlsx", async (action) => { |
||||
if (action.report_type === 'xlsx') { |
if (action.report_type === 'xlsx') { |
||||
BlockUI; |
BlockUI; |
||||
await download({ |
await download({ |
||||
url: '/event_xlsx_reports', |
url: '/event_xlsx_reports', |
||||
data: action.data, |
data: action.data, |
||||
complete: () => unblockUI, |
complete: () => unblockUI, |
||||
error: (error) => self.call('crash_manager', 'rpc_error', error), |
error: (error) => { |
||||
|
// Use Odoo's crash manager properly if in OWL context
|
||||
|
const env = owl.Component.env; |
||||
|
if (env && env.services && env.services.crash_manager) { |
||||
|
env.services.crash_manager.rpc_error(error); |
||||
|
} |
||||
|
}, |
||||
}); |
}); |
||||
}}); |
} |
||||
|
}); |
||||
Loading…
Reference in new issue