diff --git a/mail_message_auto_expand/__init__.py b/mail_message_auto_expand/__init__.py new file mode 100644 index 00000000..be592a82 --- /dev/null +++ b/mail_message_auto_expand/__init__.py @@ -0,0 +1,3 @@ +# -*- encoding: utf-8 -*- + +import mail \ No newline at end of file diff --git a/mail_message_auto_expand/__openerp__.py b/mail_message_auto_expand/__openerp__.py new file mode 100644 index 00000000..900410bb --- /dev/null +++ b/mail_message_auto_expand/__openerp__.py @@ -0,0 +1,13 @@ +{ + 'name': 'Mail Message Auto Expand', + 'version': '8.0', + 'summary': 'Expands the Read More Automatically', + 'description': '', + 'author': 'Sunflower IT', + 'website': 'http://www.sunflowerweb.nl', + 'category': 'Social Network', + 'images': [], + 'depends': ['mail'], + 'data': [], + 'installable': True, +} diff --git a/mail_message_auto_expand/mail.py b/mail_message_auto_expand/mail.py new file mode 100644 index 00000000..76237ef8 --- /dev/null +++ b/mail_message_auto_expand/mail.py @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- +# © 2017 Sunflower IT (http://sunflowerweb.nl) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +import logging +from openerp import _, api, models, tools +from openerp.tools import html_email_clean +from openerp.tools.translate import _ +from HTMLParser import HTMLParser +from openerp import SUPERUSER_ID, api +_logger = logging.getLogger(__name__) + + +class MailMessage(models.Model): + _inherit = 'mail.message' + + def _message_read_dict(self, cr, uid, message, parent_id=False, + context=None): + max_length = 10000 # Increase the max lenght + body_short = html_email_clean(message.body, remove=False, shorten=False, + max_length=max_length) # Disable shortening + ret = super(MailMessage, self)._message_read_dict(cr, uid, + message, + parent_id=parent_id, + context=context) + ret['body_short'] = body_short + return ret + + diff --git a/mail_message_auto_expand/static/description/icon.png b/mail_message_auto_expand/static/description/icon.png new file mode 100644 index 00000000..bc9b9414 Binary files /dev/null and b/mail_message_auto_expand/static/description/icon.png differ