Browse Source

[FIX]replace body_short

pull/167/head
kiplangatdan 7 years ago
parent
commit
6c06b3a26e
  1. 55
      mail_message_auto_expand/README.rst
  2. 6
      mail_message_auto_expand/__init__.py
  3. 33
      mail_message_auto_expand/__openerp__.py
  4. 28
      mail_message_auto_expand/mail.py
  5. BIN
      mail_message_auto_expand/static/description/icon.png
  6. 9
      mail_message_auto_expand/static/src/xml/mail_autoexpand.xml

55
mail_message_auto_expand/README.rst

@ -0,0 +1,55 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
========================
Mail Message Auto Expand
========================
This module extends the functionality of mail. It automatically expands the
messages in the chatter. Instead of having to click *read more*
Usage
=====
Just install
Bug Tracker
===========
Bugs are tracked on `GitHub Issues <https://github.com/OCA/ social/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 a detailed and
welcomed feedback `here <https://github.com/OCA/
social/issues/new?body=module:%20 mail_message_auto_expand%0Aversion:%20
8.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Credits
=======
Images
------
* PICOL Icon Generator `here <http://picol.org/picol_icon_generator>`_.
Contributors
------------
* Dan Kiplangat <dan@sunflowerweb.nl>
* Tom Blauwendraat <tom@sunflowerweb.nl>
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 http://odoo-community.org.

6
mail_message_auto_expand/__init__.py

@ -1,3 +1,5 @@
# -*- encoding: utf-8 -*-
# -*- coding: utf-8 -*-
# © 2016 Sunflower IT (http://sunflowerweb.nl)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
import mail
from . import models

33
mail_message_auto_expand/__openerp__.py

@ -1,13 +1,22 @@
{
'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,
# -*- coding: utf-8 -*-
# © 2016 Sunflower IT (http://sunflowerweb.nl)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Mail Message Auto Expand",
"summary": "Expands the Read More Automatically",
"version": "8.0.1.0.0",
"category": "Social Network",
"website": "https://sunflowerweb.nl",
"author": "Sunflower IT, Odoo Community Association (OCA)",
"license": "AGPL-3",
"application": False,
"installable": True,
"depends": [
"mail",
],
"data": [],
"qweb": [
"static/src/xml/mail_autoexpand.xml",
],
}

28
mail_message_auto_expand/mail.py

@ -1,28 +0,0 @@
# -*- 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

BIN
mail_message_auto_expand/static/description/icon.png

Before

Width: 300  |  Height: 300  |  Size: 26 KiB

After

Width: 128  |  Height: 128  |  Size: 2.2 KiB

9
mail_message_auto_expand/static/src/xml/mail_autoexpand.xml

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<template>
<t t-extend="mail.thread.message">
<t t-jquery="div[class=oe_msg_center] div[class=oe_msg_body_short]" t-operation="replace">
<t t-raw="widget.body"/>
</t>
</t>
</template>
Loading…
Cancel
Save