OCA reporting engine fork for dev and update.
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.

55 lines
1.8 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. /* Copyright 2015-2019 Onestein (<https://www.onestein.eu>)
  2. * License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). */
  3. odoo.define("bi_view_editor.JoinNodeDialog", function (require) {
  4. "use strict";
  5. var Dialog = require("web.Dialog");
  6. var core = require("web.core");
  7. var qweb = core.qweb;
  8. var _t = core._t;
  9. var JoinNodeDialog = Dialog.extend({
  10. xmlDependencies: Dialog.prototype.xmlDependencies.concat([
  11. "/bi_view_editor/static/src/xml/bi_view_editor.xml",
  12. ]),
  13. events: {
  14. "click li": "choiceClicked",
  15. },
  16. init: function (parent, options, choices, model_data) {
  17. this.choices = choices;
  18. // Prepare data for view
  19. for (var i = 0; i < choices.length; i++) {
  20. if (choices[i].join_node !== -1 && choices[i].table_alias !== -1) {
  21. choices[i].model_name =
  22. model_data[choices[i].table_alias].model_name;
  23. }
  24. choices[i].index = i;
  25. }
  26. var defaults = _.defaults(options || {}, {
  27. title: _t("Join..."),
  28. dialogClass: "oe_act_window",
  29. $content: qweb.render("bi_view_editor.JoinNodeDialog", {
  30. choices: choices,
  31. }),
  32. buttons: [
  33. {
  34. text: _t("Cancel"),
  35. classes: "btn-default o_form_button_cancel",
  36. close: true,
  37. },
  38. ],
  39. });
  40. this._super(parent, defaults);
  41. },
  42. choiceClicked: function (e) {
  43. this.trigger("chosen", {
  44. choice: this.choices[$(e.currentTarget).attr("data-index")],
  45. });
  46. this.close();
  47. },
  48. });
  49. return JoinNodeDialog;
  50. });