Browse Source

[ADD] mail_message_thread: Threaded messages

pull/190/head
Dave Lasley 7 years ago
parent
commit
4f48b21538
No known key found for this signature in database GPG Key ID: 7DDBA4BA81B934CF
  1. 64
      mail_message_thread/README.rst
  2. 5
      mail_message_thread/__init__.py
  3. 18
      mail_message_thread/__manifest__.py
  4. 5
      mail_message_thread/models/__init__.py
  5. 21
      mail_message_thread/models/mail_message.py
  6. BIN
      mail_message_thread/static/description/icon.png
  7. 5
      mail_message_thread/tests/__init__.py
  8. 19
      mail_message_thread/tests/test_mail_message.py

64
mail_message_thread/README.rst

@ -0,0 +1,64 @@
.. image:: https://img.shields.io/badge/license-LGPL--3-blue.svg
:target: http://www.gnu.org/licenses/lgpl.html
:alt: License: LGPL-3
===================
Mail Message Thread
===================
This module adds threads to messages, allowing for direct replies.
Configuration
=============
Usage
=====
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/149/10.0
Known Issues / Roadmap
======================
Known Issues
------------
Roadmap
-------
Bug Tracker
===========
Bugs are tracked on `GitHub Issues
<https://github.com/OCA/server-tools/issues>`_. In case of trouble, please
check there if your issue has already been reported. If you spotted it first,
help us smash it by providing detailed and welcomed feedback.
Credits
=======
Images
------
* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.
Contributors
------------
* Dave Lasley <dave@laslabs.com>
Maintainer
----------
.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org
This module is maintained by the OCA.
OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
To contribute to this module, please visit https://odoo-community.org.

5
mail_message_thread/__init__.py

@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright 2017 LasLabs Inc.
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
from . import models

18
mail_message_thread/__manifest__.py

@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
# Copyright 2017 LasLabs Inc.
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
{
'name': 'Mail Message Thread',
'summary': 'Adds threading to messages, allowing for direct replies.',
'version': '10.0.1.0.0',
'category': 'Messaging',
'website': 'https://laslabs.com/',
'author': 'LasLabs, Odoo Community Association (OCA)',
'license': 'LGPL-3',
'application': False,
'installable': True,
'depends': [
'mail',
],
}

5
mail_message_thread/models/__init__.py

@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright 2017 LasLabs Inc.
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
from . import mail_message

21
mail_message_thread/models/mail_message.py

@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
# Copyright 2017 LasLabs Inc.
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
from odoo import api, models
class MailMessage(models.Model):
_name = 'mail.message'
_inherit = ['mail.message',
'mail.thread',
]
_description = 'Mail Message (Threaded)'
@api.multi
def message_post(self, *args, **kwargs):
return super(
MailMessage,
self.with_context(mail_create_nolog=True),
).message_post(*args, **kwargs)

BIN
mail_message_thread/static/description/icon.png

After

Width: 128  |  Height: 128  |  Size: 9.2 KiB

5
mail_message_thread/tests/__init__.py

@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright 2017 LasLabs Inc.
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
from . import test_mail_message

19
mail_message_thread/tests/test_mail_message.py

@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
# Copyright 2017 LasLabs Inc.
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
from odoo.tests.common import TransactionCase
class TestMailMessage(TransactionCase):
def setUp(self):
super(TestMailMessage, self).setUp()
partner = self.env.user.partner_id
partner.message_post('Test Message')
self.message = partner.message_ids[-1]
def test_message_reply(self):
self.assertEqual(len(self.message.message_ids), 1)
self.message.message_post('Test Reply')
self.assertEqual(len(self.message.message_ids), 2)
Loading…
Cancel
Save