Browse Source

Merge pull request #79 from yelizariev/10.0-merge-e82da01

10.0 merge e82da01
pull/81/head
Ivan Yelizariev 8 years ago
committed by GitHub
parent
commit
6870ceb260
  1. 5
      mail_attachment_popup/doc/changelog.rst
  2. 23
      mail_base/README.rst
  3. 1
      mail_base/__init__.py
  4. 2
      mail_base/__openerp__.py
  5. 1
      mail_base/controllers/__init__.py
  6. 15
      mail_base/controllers/main.py
  7. 9
      mail_base/doc/changelog.rst
  8. 4
      mail_base/doc/index.rst
  9. 13
      mail_base/models.py
  10. 14
      mail_base/static/src/js/base.js
  11. 5
      mail_check_immediately/doc/changelog.rst
  12. 5
      mail_move_message/doc/changelog.rst
  13. 2
      mail_sent/__openerp__.py
  14. 7
      mail_sent/doc/changelog.rst
  15. 13
      mail_sent/models.py

5
mail_attachment_popup/doc/changelog.rst

@ -1,8 +1,3 @@
.. _changelog:
Updates
=======
`1.0.0`
-------

23
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 <https://github.com/odoo/odoo/blob/9.0/addons/mail/static/src/js/chat_manager.js#L57>`__
// 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 <https://github.com/odoo/odoo/blob/9.0/addons/mail/static/src/js/chat_manager.js#L57>`__
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: `<doc/index.rst>`_
Changelog: `<doc/changelog.rst>`_
Tested on Odoo 9.0 c8cd67c5d98b410cabe0a6efb3347a8a4de731d8

1
mail_base/__init__.py

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
from . import models
from . import controllers

2
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",

1
mail_base/controllers/__init__.py

@ -0,0 +1 @@
from . import main

15
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)

9
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

4
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.

13
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

14
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();
}
});
},

5
mail_check_immediately/doc/changelog.rst

@ -1,8 +1,3 @@
.. _changelog:
Updates
=======
`1.0.1`
-------

5
mail_move_message/doc/changelog.rst

@ -1,8 +1,3 @@
.. _changelog:
Updates
=======
`1.0.4`
-------

2
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",

7
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`
-------

13
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):

Loading…
Cancel
Save