diff --git a/mail_message_thread/README.rst b/mail_message_thread/README.rst new file mode 100644 index 00000000..01060f56 --- /dev/null +++ b/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 +`_. 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 `_. + +Contributors +------------ + +* Dave Lasley + +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. diff --git a/mail_message_thread/__init__.py b/mail_message_thread/__init__.py new file mode 100644 index 00000000..fd02263c --- /dev/null +++ b/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 diff --git a/mail_message_thread/__manifest__.py b/mail_message_thread/__manifest__.py new file mode 100644 index 00000000..f1aab362 --- /dev/null +++ b/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', + ], +} diff --git a/mail_message_thread/models/__init__.py b/mail_message_thread/models/__init__.py new file mode 100644 index 00000000..e7adc377 --- /dev/null +++ b/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 diff --git a/mail_message_thread/models/mail_message.py b/mail_message_thread/models/mail_message.py new file mode 100644 index 00000000..1ff5509c --- /dev/null +++ b/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) diff --git a/mail_message_thread/static/description/icon.png b/mail_message_thread/static/description/icon.png new file mode 100644 index 00000000..3a0328b5 Binary files /dev/null and b/mail_message_thread/static/description/icon.png differ diff --git a/mail_message_thread/tests/__init__.py b/mail_message_thread/tests/__init__.py new file mode 100644 index 00000000..05f8dc11 --- /dev/null +++ b/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 diff --git a/mail_message_thread/tests/test_mail_message.py b/mail_message_thread/tests/test_mail_message.py new file mode 100644 index 00000000..acf3004b --- /dev/null +++ b/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)