Browse Source
Merge pull request #12 from x620/9.0-res_partner_mails_count
Merge pull request #12 from x620/9.0-res_partner_mails_count
[ADD] add mail_to and fix mail_basepull/23/head
Ivan Yelizariev
9 years ago
16 changed files with 185 additions and 15 deletions
-
4mail_archives/static/src/js/archives.js
-
3mail_base/README.rst
-
2mail_base/__init__.py
-
18mail_base/models.py
-
15mail_base/static/src/js/base.js
-
8mail_sent/models.py
-
4mail_sent/static/src/js/sent.js
-
11mail_to/README.rst
-
1mail_to/__init__.py
-
28mail_to/__openerp__.py
-
7mail_to/doc/changelog.rst
-
12mail_to/doc/index.rst
-
23mail_to/static/src/css/mail_to.css
-
29mail_to/static/src/js/mail_to.js
-
22mail_to/static/src/xml/recipient.xml
-
13mail_to/templates.xml
@ -1 +1,3 @@ |
|||||
# -*- coding: utf-8 -*- |
# -*- coding: utf-8 -*- |
||||
|
|
||||
|
import models |
@ -0,0 +1,18 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
|
||||
|
from openerp import api, models |
||||
|
|
||||
|
|
||||
|
class MailMessage(models.Model): |
||||
|
_inherit = 'mail.message' |
||||
|
|
||||
|
@api.multi |
||||
|
def write(self, values): |
||||
|
if values.get('needaction_partner_ids'): |
||||
|
if not values.get('partner_ids'): |
||||
|
values['partner_ids'] = [] |
||||
|
for triplet in values.get('needaction_partner_ids'): |
||||
|
if triplet[0] == 6: |
||||
|
for id in triplet[2]: |
||||
|
values['partner_ids'].append((4, id, False)) |
||||
|
return super(MailMessage, self).write(values) |
@ -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 |
@ -0,0 +1 @@ |
|||||
|
# -*- coding: utf-8 -*- |
@ -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, |
||||
|
} |
@ -0,0 +1,7 @@ |
|||||
|
Changelog |
||||
|
========= |
||||
|
|
||||
|
`1.0.0` |
||||
|
------- |
||||
|
|
||||
|
- Init version |
@ -0,0 +1,12 @@ |
|||||
|
========================= |
||||
|
Show message recipients |
||||
|
========================= |
||||
|
|
||||
|
Usage |
||||
|
===== |
||||
|
|
||||
|
* Open Discuss menu. |
||||
|
* Many messages have Recipients info. |
||||
|
* Click Inbox left menu item, click Send mail button, set recipient and send message. This message will show recipient. |
||||
|
* To see the recipient's need hover the mouse over a message. |
||||
|
* For messages created before install module it will not work where the recipients are not set. There is no way to restore recipients value. |
@ -0,0 +1,23 @@ |
|||||
|
.recipient_link { |
||||
|
color: grey; |
||||
|
} |
||||
|
.recipient_link:hover { |
||||
|
color: #0d0d0d; |
||||
|
} |
||||
|
|
||||
|
.o_mail_thread .o_thread_message span.recipients_info, |
||||
|
.o_mail_thread .o_thread_message i.o_thread_message_star, |
||||
|
.o_mail_thread .o_thread_message i.o_thread_message_reply, |
||||
|
.o_mail_thread .o_thread_message i.o_thread_message_needaction { |
||||
|
opacity: 0.4; |
||||
|
} |
||||
|
|
||||
|
.o_mail_thread .o_thread_message:hover i.o_thread_message_star, |
||||
|
.o_mail_thread .o_thread_message:hover i.o_thread_message_reply, |
||||
|
.o_mail_thread .o_thread_message:hover i.o_thread_message_needaction { |
||||
|
opacity: 0.7; |
||||
|
} |
||||
|
|
||||
|
.o_mail_thread .o_thread_message:hover span.recipients_info { |
||||
|
opacity: 1; |
||||
|
} |
@ -0,0 +1,29 @@ |
|||||
|
odoo.define('mail_to.MailTo', function (require) { |
||||
|
"use strict"; |
||||
|
|
||||
|
var base_obj = require('mail_base.base'); |
||||
|
|
||||
|
base_obj.MailTools.include({ |
||||
|
make_message: function(data){ |
||||
|
var msg = this._super(data); |
||||
|
msg.partner_ids = data.partner_ids; |
||||
|
// msg.needaction_partner_ids = data.needaction_partner_ids;
|
||||
|
|
||||
|
var more_recipients = ''; |
||||
|
// value which define more recipients
|
||||
|
msg.more_recipients_value = 4; |
||||
|
for (var i = 0; i < msg.partner_ids.length; i++){ |
||||
|
if (i >= msg.more_recipients_value){ |
||||
|
// append names
|
||||
|
more_recipients += msg.partner_ids[i][1]; |
||||
|
// separate them with semicolon
|
||||
|
if (i < msg.partner_ids.length - 1){ |
||||
|
more_recipients += '; '; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
msg.more_recipients = more_recipients; |
||||
|
return msg; |
||||
|
} |
||||
|
}); |
||||
|
}); |
@ -0,0 +1,22 @@ |
|||||
|
<?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="after"> |
||||
|
<span class="recipients_info"> |
||||
|
<t t-if="message.partner_ids.length > 0">To: </t> |
||||
|
<t t-foreach="message.partner_ids.length" t-as="i"> |
||||
|
<t t-if="i < message.more_recipients_value"> |
||||
|
<a t-att-href="_.str.sprintf('/web?#id=%s&view_type=form&model=res.partner', message.partner_ids[i][0])" class="recipient_link"> |
||||
|
<i t-esc="message.partner_ids[i][1]"/><t t-if="i < message.partner_ids.length - 1">; </t> |
||||
|
</a> |
||||
|
</t> |
||||
|
</t> |
||||
|
<t t-if="message.partner_ids.length > message.more_recipients_value - 1"> |
||||
|
<span t-att-title="message.more_recipients"> |
||||
|
and <t t-esc="message.partner_ids.length - message.more_recipients_value"/> more |
||||
|
</span> |
||||
|
</t> |
||||
|
</span> |
||||
|
</t> |
||||
|
</t> |
||||
|
</template> |
@ -0,0 +1,13 @@ |
|||||
|
<?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"> |
||||
|
<link rel="stylesheet" href="/mail_to/static/src/css/mail_to.css"/> |
||||
|
<script src="/mail_to/static/src/js/mail_to.js" type="text/javascript"></script> |
||||
|
</xpath> |
||||
|
</template> |
||||
|
</data> |
||||
|
</openerp> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue