Browse Source

[ADD] mail_to module: display recipients the right of the messages

pull/12/head
x620 9 years ago
parent
commit
d90dee942f
  1. 11
      mail_to/README.rst
  2. 1
      mail_to/__init__.py
  3. 28
      mail_to/__openerp__.py
  4. 7
      mail_to/doc/changelog.rst
  5. 9
      mail_to/doc/index.rst
  6. 17
      mail_to/models.py
  7. 17
      mail_to/static/src/js/mail_to.js
  8. 12
      mail_to/static/src/xml/recipient.xml
  9. 12
      mail_to/templates.xml

11
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

1
mail_to/__init__.py

@ -0,0 +1 @@
# -*- coding: utf-8 -*-

28
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,
}

7
mail_to/doc/changelog.rst

@ -0,0 +1,7 @@
Changelog
=========
`1.0.0`
-------
- Init version

9
mail_to/doc/index.rst

@ -0,0 +1,9 @@
=========================
Show message recipients
=========================
Usage
=====
* Open Discuss menu
* All messages have Recipients info

17
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

17
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);
}
});
});

12
mail_to/static/src/xml/recipient.xml

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<template>
<t t-extend="mail.ChatThread.Message">
<t t-jquery="p[class=o_mail_info]>span" t-operation="before">
<span class="recipients_info">
<t t-foreach="message.partner_ids" t-as="p">
<i t-att-data-message-id="message.id" title="Recipients Info" t-esc="p[1]"/>
</t>
</span>
</t>
</t>
</template>

12
mail_to/templates.xml

@ -0,0 +1,12 @@
<?xml version="1.0"?>
<openerp>
<data>
<template id="mail_to_assets_backend"
name="mail_to_assets_backend"
inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<script src="/mail_to/static/src/js/mail_to.js" type="text/javascript"></script>
</xpath>
</template>
</data>
</openerp>
Loading…
Cancel
Save