From d90dee942f97d94ce14b6e00415e3d1346415804 Mon Sep 17 00:00:00 2001 From: x620 Date: Tue, 26 Apr 2016 18:14:33 +0500 Subject: [PATCH] [ADD] mail_to module: display recipients the right of the messages --- mail_to/README.rst | 11 +++++++++++ mail_to/__init__.py | 1 + mail_to/__openerp__.py | 28 ++++++++++++++++++++++++++++ mail_to/doc/changelog.rst | 7 +++++++ mail_to/doc/index.rst | 9 +++++++++ mail_to/models.py | 17 +++++++++++++++++ mail_to/static/src/js/mail_to.js | 17 +++++++++++++++++ mail_to/static/src/xml/recipient.xml | 12 ++++++++++++ mail_to/templates.xml | 12 ++++++++++++ 9 files changed, 114 insertions(+) create mode 100644 mail_to/README.rst create mode 100644 mail_to/__init__.py create mode 100644 mail_to/__openerp__.py create mode 100644 mail_to/doc/changelog.rst create mode 100644 mail_to/doc/index.rst create mode 100644 mail_to/models.py create mode 100644 mail_to/static/src/js/mail_to.js create mode 100644 mail_to/static/src/xml/recipient.xml create mode 100644 mail_to/templates.xml diff --git a/mail_to/README.rst b/mail_to/README.rst new file mode 100644 index 0000000..1220cdb --- /dev/null +++ b/mail_to/README.rst @@ -0,0 +1,11 @@ +========================= + Show message recipients +========================= + +Allows you be sure, that all discussion participants were notified. Adds recipients label the right of message. + +Further information +------------------- +HTML Description: https://apps.odoo.com/apps/modules/9.0/mail_to/ + +Tested on Odoo 9.0 d3dd4161ad0598ebaa659fbd083457c77aa9448d \ No newline at end of file diff --git a/mail_to/__init__.py b/mail_to/__init__.py new file mode 100644 index 0000000..40a96af --- /dev/null +++ b/mail_to/__init__.py @@ -0,0 +1 @@ +# -*- coding: utf-8 -*- diff --git a/mail_to/__openerp__.py b/mail_to/__openerp__.py new file mode 100644 index 0000000..664adc5 --- /dev/null +++ b/mail_to/__openerp__.py @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- +{ + "name": """Show message recipients""", + "summary": """Allows you be sure, that all discussion participants were notified""", + "category": "Discuss", + "images": [], + "version": "1.0.0", + + "author": "IT-Projects LLC, Pavel Romanchenko", + "website": "https://it-projects.info", + "license": "LGPL-3", + #"price": 9.00, + #"currency": "EUR", + + "depends": [ + 'mail_base', + ], + "external_dependencies": {"python": [], "bin": []}, + "data": [ + 'templates.xml', + ], + "qweb": [ + 'static/src/xml/recipient.xml', + ], + "demo": [], + "installable": True, + "auto_install": False, +} diff --git a/mail_to/doc/changelog.rst b/mail_to/doc/changelog.rst new file mode 100644 index 0000000..61af251 --- /dev/null +++ b/mail_to/doc/changelog.rst @@ -0,0 +1,7 @@ +Changelog +========= + +`1.0.0` +------- + +- Init version \ No newline at end of file diff --git a/mail_to/doc/index.rst b/mail_to/doc/index.rst new file mode 100644 index 0000000..870e115 --- /dev/null +++ b/mail_to/doc/index.rst @@ -0,0 +1,9 @@ +========================= + Show message recipients +========================= + +Usage +===== + +* Open Discuss menu +* All messages have Recipients info \ No newline at end of file diff --git a/mail_to/models.py b/mail_to/models.py new file mode 100644 index 0000000..b53fc12 --- /dev/null +++ b/mail_to/models.py @@ -0,0 +1,17 @@ +# -*- coding: utf-8 -*- +from openerp import api, models, fields + + +class MailMessage(models.Model): + _inherit = 'mail.message' + + @api.multi + def message_format(self): + message_values = super(MailMessage, self).message_format() + message_index = {message['id']: message for message in message_values} + for item in self: + msg = message_index.get(item.id) + if msg: + # TODO: найти получателей + msg['recipient'] = 'Recipient' + return message_values diff --git a/mail_to/static/src/js/mail_to.js b/mail_to/static/src/js/mail_to.js new file mode 100644 index 0000000..63b9219 --- /dev/null +++ b/mail_to/static/src/js/mail_to.js @@ -0,0 +1,17 @@ +odoo.define('mail_to.MailTo', function (require) { + "use strict"; + + var Thread = require('mail.ChatThread'); + var Model = require('web.Model'); + + Thread.include({ + render: function (messages, options) { + // for(var i = 0; i < messages.length; i++){ + // var msg = messages[i]; + // msg.needaction_partner_ids = [3]; + // } + // console.log('messages:', messages); + this._super(messages, options); + } + }); +}); diff --git a/mail_to/static/src/xml/recipient.xml b/mail_to/static/src/xml/recipient.xml new file mode 100644 index 0000000..dddae1d --- /dev/null +++ b/mail_to/static/src/xml/recipient.xml @@ -0,0 +1,12 @@ + + \ No newline at end of file diff --git a/mail_to/templates.xml b/mail_to/templates.xml new file mode 100644 index 0000000..0d763ec --- /dev/null +++ b/mail_to/templates.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file