Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

210
Views
Función de anulación en ODOO15

Con los nuevos cambios en odoo15. No puedo anular una función en Javascript. Creé un módulo personalizado e importé el requerido.

Quiero anular la función _executeReportAction

 import {download} from "@web/core/network/download"; import {registry} from "@web/core/registry"; import { useService } from "@web/core/utils/hooks"; import {actionService} from "@web/webclient/actions/action_service"; async function _executeReportAction(action, options) { }

Así que cómo se hace

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

La función _executeReportAction primero intentará ejecutar controladores ir.actions.report , por lo que en lugar de parchear la función, agregue un controlador de informes zpl .

Puede consultar el módulo OCA report_xlsx que define un controlador de informes para informes xlsx

Código original:

 /** @odoo-module **/ import {download} from "@web/core/network/download"; import {registry} from "@web/core/registry"; registry .category("ir.actions.report handlers") .add("xlsx_handler", async function (action, options, env) { if (action.report_type === "xlsx") { const type = action.report_type; let url = `/report/${type}/${action.report_name}`; const actionContext = action.context || {}; if (action.data && JSON.stringify(action.data) !== "{}") { // Build a query string with `action.data` (it's the place where reports // using a wizard to customize the output traditionally put their options) const action_options = encodeURIComponent(JSON.stringify(action.data)); const context = encodeURIComponent(JSON.stringify(actionContext)); url += `?options=${action_options}&context=${context}`; } else { if (actionContext.active_ids) { url += `/${actionContext.active_ids.join(",")}`; } if (type === "xlsx") { const context = encodeURIComponent( JSON.stringify(env.services.user.context) ); url += `?context=${context}`; } } env.services.ui.block(); try { await download({ url: "/report/download", data: { data: JSON.stringify([url, action.report_type]), context: JSON.stringify(env.services.user.context), }, }); } finally { env.services.ui.unblock(); } const onClose = options.onClose; if (action.close_on_report_download) { return env.services.action.doAction( {type: "ir.actions.act_window_close"}, {onClose} ); } else if (onClose) { onClose(); } return Promise.resolve(true); } return Promise.resolve(false); });

En el código anterior fusionaron las funciones _triggerDownload y _getReportUrl en una sola función.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!