Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[13.0] mail_archives #348

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mail_archives/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
"depends": ["mail"],
"data": ["views/templates.xml"],
"qweb": ["static/src/xml/menu.xml"],
"installable": False,
"installable": True,
}
16 changes: 8 additions & 8 deletions mail_archives/static/src/js/archives.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
odoo.define("mail_archives.archives", function(require) {
odoo.define("mail_archives.archives", function (require) {
"use strict";

var core = require("web.core");
Expand All @@ -10,10 +10,10 @@ odoo.define("mail_archives.archives", function(require) {
var _t = core._t;

Manager.include({
_updateMailboxesFromServer: function(data) {
_updateMailboxesFromServer: function (data) {
this._super(data);
if (
!_.find(this.getThreads(), function(th) {
!_.find(this.getThreads(), function (th) {
return th.getID() === "mailbox_channel_archive";
})
) {
Expand All @@ -27,7 +27,7 @@ odoo.define("mail_archives.archives", function(require) {
});

SearchableThread.include({
_fetchMessages: function(pDomain, loadMore) {
_fetchMessages: function (pDomain, loadMore) {
var self = this;
if (this._id !== "mailbox_channel_archive") {
return this._super(pDomain, loadMore);
Expand All @@ -48,16 +48,16 @@ odoo.define("mail_archives.archives", function(require) {
method: "message_fetch",
args: [domain],
kwargs: this._getFetchMessagesKwargs(),
}).then(function(messages) {
}).then(function (messages) {
// Except this function. It adds the required thread to downloaded messages
_.each(messages, function(m) {
_.each(messages, function (m) {
m.channel_ids.push("mailbox_channel_archive");
});
if (!cache.allHistoryLoaded) {
cache.allHistoryLoaded = messages.length < self._FETCH_LIMIT;
}
cache.loaded = true;
_.each(messages, function(message) {
_.each(messages, function (message) {
self.call("mail_service", "addMessage", message, {
silent: true,
domain: pDomain,
Expand All @@ -70,7 +70,7 @@ odoo.define("mail_archives.archives", function(require) {
});

Mailbox.include({
_getThreadDomain: function() {
_getThreadDomain: function () {
if (this._id === "mailbox_channel_archive") {
return [
"|",
Expand Down
7 changes: 4 additions & 3 deletions mail_archives/static/src/xml/menu.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
t-attf-class="o_mail_discuss_title_main o_mail_discuss_item #{(activeThreadID == 'channel_archive') ? 'o_active': ''}"
data-thread-id="mailbox_channel_archive"
>
<span class="o_channel_name mail_archives"> <i
class="fa fa-archive"
/> Archive </span>
<span class="o_channel_name mail_archives">
<i class="fa fa-archive" />
Archive
</span>
</div>
</t>
</t>
Expand Down
35 changes: 15 additions & 20 deletions mail_archives/views/templates.xml
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
<?xml version="1.0" ?>
<openerp>
<data>
<template
id="res_partner_mails_count_assets_backend"
name="res_partner_mails_count_assets_backend"
inherit_id="web.assets_backend"
>
<xpath expr="." position="inside">
<link
rel="stylesheet"
href="/mail_archives/static/src/css/archives.css"
/>
<script
src="/mail_archives/static/src/js/archives.js"
type="text/javascript"
/>
</xpath>
</template>
</data>
</openerp>
<odoo>
<template
id="res_partner_mails_count_assets_backend"
name="res_partner_mails_count_assets_backend"
inherit_id="web.assets_backend"
>
<xpath expr="." position="inside">
<link rel="stylesheet" href="/mail_archives/static/src/css/archives.css" />
<script
src="/mail_archives/static/src/js/archives.js"
type="text/javascript"
/>
</xpath>
</template>
</odoo>