diff --git a/mail_attachment_popup/doc/changelog.rst b/mail_attachment_popup/doc/changelog.rst index cc3dd23..9ee2b48 100644 --- a/mail_attachment_popup/doc/changelog.rst +++ b/mail_attachment_popup/doc/changelog.rst @@ -1,8 +1,3 @@ -.. _changelog: - -Updates -======= - `1.0.0` ------- diff --git a/mail_base/README.rst b/mail_base/README.rst index 0aa46ac..9e936a2 100644 --- a/mail_base/README.rst +++ b/mail_base/README.rst @@ -6,14 +6,23 @@ Mail Base * fixes toggling left bar * fixes Recipients field. Out-of-box this field could be empty. -Usage ------ -To use this module you need either install module that depends on it or create new module. +One can say, that the module do this todo from `addons/mail/static/src/js/chat_manager.js `__ + + // to do: move this to mail.utils + + + +Note. Due to odoo restrictions, module makes mail initialization again. That is browser loads emoji and other chat data twice. This is the only way to make Mail feature extendable. Further information -------------------- -Due to odoo restrictions, module makes mail initialization again. That is browser loads emoji and other chat data twice. This is the only way to make Mail feature extendable. +=================== -One can say, that the module do this todo from `addons/mail/static/src/js/chat_manager.js `__ +Demo: http://runbot.it-projects.info/demo/mail-addons/9.0 - // to do: move this to mail.utils +.. HTML Description: https://apps.odoo.com/apps/modules/9.0/mail_base/ + +Usage instructions: ``_ + +Changelog: ``_ + +Tested on Odoo 9.0 c8cd67c5d98b410cabe0a6efb3347a8a4de731d8 diff --git a/mail_base/__init__.py b/mail_base/__init__.py index cde864b..c3d410e 100644 --- a/mail_base/__init__.py +++ b/mail_base/__init__.py @@ -1,3 +1,4 @@ # -*- coding: utf-8 -*- from . import models +from . import controllers diff --git a/mail_base/__openerp__.py b/mail_base/__openerp__.py index 3b0ebcb..9cf607a 100644 --- a/mail_base/__openerp__.py +++ b/mail_base/__openerp__.py @@ -4,7 +4,7 @@ "summary": """Makes Mail extendable""", "category": "Discuss", "images": [], - "version": "1.0.0", + "version": "1.0.1", "author": "IT-Projects LLC, Pavel Romanchenko", "support": "apps@it-projects.info", diff --git a/mail_base/controllers/__init__.py b/mail_base/controllers/__init__.py new file mode 100644 index 0000000..12a7e52 --- /dev/null +++ b/mail_base/controllers/__init__.py @@ -0,0 +1 @@ +from . import main diff --git a/mail_base/controllers/main.py b/mail_base/controllers/main.py new file mode 100644 index 0000000..8812df9 --- /dev/null +++ b/mail_base/controllers/main.py @@ -0,0 +1,15 @@ +# -*- coding: utf-8 -*- +from openerp.http import request +import openerp + + +class MailChatController(openerp.addons.bus.controllers.main.BusController): + # ----------------------------- + # Extends BUS Controller Poll + # ----------------------------- + + def _poll(self, dbname, channels, last, options): + if request.session.uid: + channels.append((request.db, 'mail_base.mail_sent')) + + return super(MailChatController, self)._poll(dbname, channels, last, options) diff --git a/mail_base/doc/changelog.rst b/mail_base/doc/changelog.rst new file mode 100644 index 0000000..a42098f --- /dev/null +++ b/mail_base/doc/changelog.rst @@ -0,0 +1,9 @@ +`1.0.1` +------- + +- **FIX**: clear messages cache on sending message via Mail Composer. Otherwise Sent, Arhives menus will have new message until user refresh whole web page + +`1.0.0` +------- + +- Init version diff --git a/mail_base/doc/index.rst b/mail_base/doc/index.rst new file mode 100644 index 0000000..9f8b977 --- /dev/null +++ b/mail_base/doc/index.rst @@ -0,0 +1,4 @@ +Mail Base +========= + +To use this module you need either install module that depends on it or create new module. diff --git a/mail_base/models.py b/mail_base/models.py index ade9a35..953f49f 100644 --- a/mail_base/models.py +++ b/mail_base/models.py @@ -16,3 +16,16 @@ class MailMessage(models.Model): for id in triplet[2]: values['partner_ids'].append((4, id, False)) return super(MailMessage, self).write(values) + + +class MailComposer(models.TransientModel): + + _inherit = 'mail.compose.message' + + @api.multi + def send_mail(self, auto_commit=False): + res = super(MailComposer, self).send_mail(auto_commit=auto_commit) + notification = {} + self.env['bus.bus'].sendone((self._cr.dbname, 'mail_base.mail_sent'), notification) + + return res diff --git a/mail_base/static/src/js/base.js b/mail_base/static/src/js/base.js index 9a2bed8..19e1eb9 100644 --- a/mail_base/static/src/js/base.js +++ b/mail_base/static/src/js/base.js @@ -417,6 +417,12 @@ var MailTools = core.Class.extend({ }); }, + clear_cache_all_channels: function(){ + _.each(channels, function(channel){ + channel.cache = {}; + }); + }, + add_to_cache: function (message, domain) { _.each(message.channel_ids, function (channel_id) { var channel = chat_manager.get_channel(channel_id); @@ -551,6 +557,14 @@ var MailTools = core.Class.extend({ } else if (model === 'bus.presence') { // update presence of users chat_manager.mail_tools.on_presence_notification(notification[1]); + } else if (model === 'mail_base.mail_sent') { + // Delete cache in order to fetch new message + + // TODO find a solution without deleting cache. Currently + // problem is that on inheriting send_mail in + // mail.compose.message it's not possible to get id of new + // message + chat_manager.mail_tools.clear_cache_all_channels(); } }); }, diff --git a/mail_check_immediately/doc/changelog.rst b/mail_check_immediately/doc/changelog.rst index 4c43525..3dfce87 100644 --- a/mail_check_immediately/doc/changelog.rst +++ b/mail_check_immediately/doc/changelog.rst @@ -1,8 +1,3 @@ -.. _changelog: - -Updates -======= - `1.0.1` ------- diff --git a/mail_move_message/doc/changelog.rst b/mail_move_message/doc/changelog.rst index 2f27ae2..8ad2fe4 100644 --- a/mail_move_message/doc/changelog.rst +++ b/mail_move_message/doc/changelog.rst @@ -1,8 +1,3 @@ -.. _changelog: - -Updates -======= - `1.0.4` ------- diff --git a/mail_sent/__openerp__.py b/mail_sent/__openerp__.py index 29adbd0..1e9ffda 100644 --- a/mail_sent/__openerp__.py +++ b/mail_sent/__openerp__.py @@ -4,7 +4,7 @@ "summary": """Quick way to find sent messages""", "category": "Discuss", "images": ['images/menu.png'], - "version": "1.0.3", + "version": "1.0.4", "author": "IT-Projects LLC, Ivan Yelizariev, Pavel Romanchenko", "support": "apps@it-projects.info", diff --git a/mail_sent/doc/changelog.rst b/mail_sent/doc/changelog.rst index 2147d0e..142f071 100644 --- a/mail_sent/doc/changelog.rst +++ b/mail_sent/doc/changelog.rst @@ -1,7 +1,6 @@ -.. _changelog: - -Updates -======= +`1.0.4` +------- +- **FIX:** didn't work for non-admin users `1.0.2` ------- diff --git a/mail_sent/models.py b/mail_sent/models.py index 27bf2f0..6d1ef14 100644 --- a/mail_sent/models.py +++ b/mail_sent/models.py @@ -7,14 +7,15 @@ class MailMessage(models.Model): sent = fields.Boolean('Sent', compute="_compute_sent", help='Was message sent to someone', store=True) - @api.one @api.depends('author_id', 'partner_ids') def _compute_sent(self): - self_sudo = self.sudo() - self_sudo.sent = len(self_sudo.partner_ids) > 1 \ - or len(self_sudo.partner_ids) == 1 \ - and self_sudo.author_id \ - and self_sudo.partner_ids[0].id != self_sudo.author_id.id + for r in self: + r_sudo = r.sudo() + sent = len(r_sudo.partner_ids) > 1 \ + or len(r_sudo.partner_ids) == 1 \ + and r_sudo.author_id \ + and r_sudo.partner_ids[0].id != r_sudo.author_id.id + r.sent = sent @api.multi def message_format(self):