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.

50 lines
1.5 KiB

  1. /* # Copyright 2016-2018 Ivan Yelizariev <https://it-projects.info/team/yelizariev>
  2. # Copyright 2017-2018 Artyom Losev <https://it-projects.info/team/ArtyomLosev>
  3. # Copyright 2018 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
  4. # License MIT (https://opensource.org/licenses/MIT). */
  5. odoo.define("mail_all.all", function(require) {
  6. "use strict";
  7. var core = require("web.core");
  8. var Manager = require("mail.Manager");
  9. var Mailbox = require("mail.model.Mailbox");
  10. var _t = core._t;
  11. Manager.include({
  12. _updateMailboxesFromServer: function(data) {
  13. this._super(data);
  14. if (
  15. !_.find(this.getThreads(), function(th) {
  16. return th.getID() === "mailbox_channel_all";
  17. })
  18. ) {
  19. this._addMailbox({
  20. id: "channel_all",
  21. name: _t("All Messages"),
  22. mailboxCounter: 0,
  23. });
  24. }
  25. },
  26. _makeMessage: function(data) {
  27. var message = this._super(data);
  28. message._addThread("mailbox_channel_all");
  29. return message;
  30. },
  31. });
  32. Mailbox.include({
  33. _getThreadDomain: function() {
  34. if (this._id === "mailbox_channel_all") {
  35. return [];
  36. }
  37. return this._super();
  38. },
  39. });
  40. return {
  41. Manager: Manager,
  42. Mailbox: Mailbox,
  43. };
  44. });