GoodERP
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

72 lines
2.5KB

  1. /** @odoo-module **/
  2. import { _t } from "@web/core/l10n/translation";
  3. export const _getReportUrl = (action, type, env) => {
  4. const url = new URL(
  5. `/report/${type}/${action.report_name}`,
  6. window.location.origin
  7. );
  8. const actionContext = action.context || {};
  9. if (action.data && JSON.stringify(action.data) !== "{}") {
  10. // Build a query string with `action.data` (it's the place where reports
  11. // using a wizard to customize the output traditionally put their options)
  12. url.searchParams.set(
  13. "options",
  14. encodeURIComponent(JSON.stringify(action.data))
  15. );
  16. url.searchParams.set(
  17. "context",
  18. encodeURIComponent(JSON.stringify(actionContext))
  19. );
  20. } else {
  21. if (actionContext.active_ids) {
  22. url.pathname += `/${actionContext.active_ids.join(",")}/${action.name}.pdf`;
  23. }
  24. if (actionContext.allowed_company_ids) {
  25. const cid = actionContext.allowed_company_ids.join();
  26. url.searchParams.set("cid", cid);
  27. }
  28. if (type === "html") {
  29. /* eslint-disable no-undef */
  30. url.searchParams.set(
  31. "context",
  32. encodeURIComponent(JSON.stringify(env.services.user.context))
  33. );
  34. }
  35. }
  36. return url.toString();
  37. };
  38. const link =
  39. '<br><br><a href="http://wkhtmltopdf.org/" target="_blank">wkhtmltopdf.org</a>';
  40. export const WKHTMLTOPDF_MESSAGES = {
  41. broken:
  42. "Your installation of Wkhtmltopdf seems to be broken. The report will be shown " +
  43. "in html."
  44. + link,
  45. install:
  46. "Unable to find Wkhtmltopdf on this system. The report will be shown in " +
  47. "html."
  48. + link,
  49. upgrade:
  50. "You should upgrade your version of Wkhtmltopdf to at least 0.12.0 in order to " +
  51. "get a correct display of headers and footers as well as support for " +
  52. "table-breaking between pages."
  53. + link,
  54. workers:
  55. "You need to start Odoo with at least two workers to print a pdf version of " +
  56. "the reports."
  57. ,
  58. };
  59. export const WARNING_MESSAGE =
  60. "A popup window with your report was blocked. You " +
  61. "may need to change your browser settings to allow " +
  62. "popup windows for this page."
  63. ;
上海开阖软件有限公司 沪ICP备12045867号-1