diff --git a/mail_archives/__openerp__.py b/mail_archives/__openerp__.py index 316de3e..6fb0495 100644 --- a/mail_archives/__openerp__.py +++ b/mail_archives/__openerp__.py @@ -12,7 +12,8 @@ "depends": [ "base", - "mail" + "mail", + "mail_base" ], "data": [ diff --git a/mail_archives/static/src/js/archives.js b/mail_archives/static/src/js/archives.js index 5a4cbdd..bca7205 100644 --- a/mail_archives/static/src/js/archives.js +++ b/mail_archives/static/src/js/archives.js @@ -56,13 +56,13 @@ base_obj.MailTools.include({ msg.body = msg.body.replace(regexp, ' '+emoji_substitutions[key]+' '); }); - // Add property to Object var properties = this.get_properties(msg); + // Add property to Object properties.is_archive = this.property_descr("channel_archive", msg, this); Object.defineProperties(msg, properties); - // Set archive flag msg = this.set_channel_flags(data, msg); + // Set archive flag msg.is_archive = true; if (msg.model === 'mail.channel') { // Add 'channel_archive' to channel_array @@ -76,7 +76,6 @@ base_obj.MailTools.include({ } } - // Compute displayed author name or email if ((!msg.author_id || !msg.author_id[0]) && msg.email_from) { msg.mailto = msg.email_from; } else { @@ -84,10 +83,8 @@ base_obj.MailTools.include({ msg.email_from || _t('Anonymous'); } - // Don't redirect on author clicked of self-posted messages msg.author_redirect = !msg.is_author; - // Compute the avatar_url if (msg.author_id && msg.author_id[0]) { msg.avatar_src = "/web/image/res.partner/" + msg.author_id[0] + "/image_small"; } else if (msg.message_type === 'email') { @@ -96,10 +93,8 @@ base_obj.MailTools.include({ msg.avatar_src = "/mail/static/src/img/smiley/avatar.jpg"; } - // add anchor tags to urls msg.body = this.parse_and_transform(msg.body, this.add_link); - // Compute url of attachments _.each(msg.attachment_ids, function(a) { a.url = '/web/content/' + a.id + '?download=true'; }); @@ -177,7 +172,6 @@ base_obj.MailTools.include({ // Change chat_manager with override methods var cls = new base_obj.MailTools(base_obj.chat_manager); base_obj.chat_manager.is_ready = cls.start(); -console.log('MailTools:', cls); return base_obj.chat_manager; diff --git a/mail_archives/views/templates.xml b/mail_archives/views/templates.xml index c6e872f..a99a03d 100644 --- a/mail_archives/views/templates.xml +++ b/mail_archives/views/templates.xml @@ -6,7 +6,6 @@ inherit_id="web.assets_backend"> - diff --git a/mail_base/__init__.py b/mail_base/__init__.py new file mode 100644 index 0000000..40a96af --- /dev/null +++ b/mail_base/__init__.py @@ -0,0 +1 @@ +# -*- coding: utf-8 -*- diff --git a/mail_base/__openerp__.py b/mail_base/__openerp__.py new file mode 100644 index 0000000..c16ca84 --- /dev/null +++ b/mail_base/__openerp__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +{ + "name": "mail_base", + "summary": """Contain common code for other mail modules""", + "category": "Uncategorized", + "images": [], + "version": "1.0.0", + + "author": "IT-Projects LLC, Pavel Romanchenko", + "website": "http://www.it-projects.info", + "license": "LGPL-3", + + "depends": [ + "base", + "mail" + ], + + "data": [ + "views/templates.xml", + ], + 'installable': True, +} diff --git a/mail_archives/static/src/js/base.js b/mail_base/static/src/js/base.js similarity index 100% rename from mail_archives/static/src/js/base.js rename to mail_base/static/src/js/base.js diff --git a/mail_base/views/templates.xml b/mail_base/views/templates.xml new file mode 100644 index 0000000..8846a55 --- /dev/null +++ b/mail_base/views/templates.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file