Browse Source
Merge pull request #19 from Antiun/pr-mail_statistics_extras
Merge pull request #19 from Antiun/pr-mail_statistics_extras
[ADD] mass_mailing_statistic_extra addonpull/31/head
Pedro M. Baeza
9 years ago
11 changed files with 297 additions and 0 deletions
-
71mass_mailing_statistic_extra/README.rst
-
5mass_mailing_statistic_extra/__init__.py
-
23mass_mailing_statistic_extra/__openerp__.py
-
42mass_mailing_statistic_extra/i18n/es.po
-
6mass_mailing_statistic_extra/models/__init__.py
-
33mass_mailing_statistic_extra/models/mail_mail.py
-
13mass_mailing_statistic_extra/models/mail_mail_statistics.py
-
BINmass_mailing_statistic_extra/static/description/icon.png
-
5mass_mailing_statistic_extra/tests/__init__.py
-
60mass_mailing_statistic_extra/tests/test_mail_mail.py
-
39mass_mailing_statistic_extra/views/mass_mailing.xml
@ -0,0 +1,71 @@ |
|||
.. 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 |
|||
|
|||
================================== |
|||
Mass mailing statistics extra info |
|||
================================== |
|||
|
|||
This module add extra info to mail statictics records: |
|||
|
|||
* email_from |
|||
* email_to |
|||
* subject |
|||
|
|||
In order to give a more useful information to final user when listing email |
|||
statistics related with a mass mailing message |
|||
|
|||
|
|||
Usage |
|||
===== |
|||
|
|||
- Go to Marketing/ Mass Mailing |
|||
- Create |
|||
- Set a Subject |
|||
- Send the email |
|||
- Check the sent email and open it |
|||
- Go to Smart Buttons (number of sent emails, Received, opened, replied) |
|||
- check now you can see subject; email_from; email_to; sent date, opened date |
|||
|
|||
|
|||
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas |
|||
:alt: Try me on Runbot |
|||
:target: https://runbot.odoo-community.org/runbot/205/8.0 |
|||
|
|||
For further information, please visit: |
|||
|
|||
* https://www.odoo.com/forum/help-1 |
|||
|
|||
|
|||
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 smashing it by providing a detailed and welcomed feedback |
|||
`here <https://github.com/OCA/social/issues/new?body=module:%20mass_mailing_statistic_extra%0Aversion:%208.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. |
|||
|
|||
|
|||
Credits |
|||
======= |
|||
|
|||
Contributors |
|||
------------ |
|||
|
|||
* Rafael Blasco <rafabn@antiun.com> |
|||
* Antonio Espinosa <antonioea@antiun.com> |
|||
|
|||
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. |
@ -0,0 +1,5 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# License AGPL-3: Antiun Ingenieria S.L. - Antonio Espinosa |
|||
# See README.rst file on addon root folder for more details |
|||
|
|||
from . import models |
@ -0,0 +1,23 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# License AGPL-3: Antiun Ingenieria S.L. - Antonio Espinosa |
|||
# See README.rst file on addon root folder for more details |
|||
|
|||
{ |
|||
'name': "Mail statistics extra info", |
|||
'category': 'Marketing', |
|||
'version': '8.0.1.0.0', |
|||
'depends': [ |
|||
'mass_mailing', |
|||
], |
|||
'external_dependencies': {}, |
|||
'data': [ |
|||
'views/mass_mailing.xml', |
|||
], |
|||
'author': 'Antiun Ingeniería, ' |
|||
'Odoo Community Association (OCA)', |
|||
'website': 'http://www.antiun.com', |
|||
'license': 'AGPL-3', |
|||
'demo': [], |
|||
'test': [], |
|||
'installable': True, |
|||
} |
@ -0,0 +1,42 @@ |
|||
# Translation of Odoo Server. |
|||
# This file contains the translation of the following modules: |
|||
# * mass_mailing_statistic_extra |
|||
# |
|||
msgid "" |
|||
msgstr "" |
|||
"Project-Id-Version: Odoo Server 8.0\n" |
|||
"Report-Msgid-Bugs-To: \n" |
|||
"POT-Creation-Date: 2015-10-08 22:33+0000\n" |
|||
"PO-Revision-Date: 2015-10-08 22:33+0000\n" |
|||
"Last-Translator: <>\n" |
|||
"Language-Team: \n" |
|||
"MIME-Version: 1.0\n" |
|||
"Content-Type: text/plain; charset=UTF-8\n" |
|||
"Content-Transfer-Encoding: \n" |
|||
"Plural-Forms: \n" |
|||
|
|||
#. module: mass_mailing_statistic_extra |
|||
#: model:ir.model,name:mass_mailing_statistic_extra.model_mail_mail_statistics |
|||
msgid "Email Statistics" |
|||
msgstr "Estadísticas de correo electrónico" |
|||
|
|||
#. module: mass_mailing_statistic_extra |
|||
#: field:mail.mail.statistics,email_from:0 |
|||
msgid "From" |
|||
msgstr "De" |
|||
|
|||
#. module: mass_mailing_statistic_extra |
|||
#: model:ir.model,name:mass_mailing_statistic_extra.model_mail_mail |
|||
msgid "Outgoing Mails" |
|||
msgstr "Correos salientes" |
|||
|
|||
#. module: mass_mailing_statistic_extra |
|||
#: field:mail.mail.statistics,subject:0 |
|||
msgid "Subject" |
|||
msgstr "Asunto" |
|||
|
|||
#. module: mass_mailing_statistic_extra |
|||
#: field:mail.mail.statistics,email_to:0 |
|||
msgid "To" |
|||
msgstr "Para" |
|||
|
@ -0,0 +1,6 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# License AGPL-3: Antiun Ingenieria S.L. - Antonio Espinosa |
|||
# See README.rst file on addon root folder for more details |
|||
|
|||
from . import mail_mail |
|||
from . import mail_mail_statistics |
@ -0,0 +1,33 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# License AGPL-3: Antiun Ingenieria S.L. - Antonio Espinosa |
|||
# See README.rst file on addon root folder for more details |
|||
|
|||
from openerp import models, api |
|||
|
|||
|
|||
class MailMail(models.Model): |
|||
_inherit = 'mail.mail' |
|||
|
|||
@api.model |
|||
def email_to_list_get(self, mail): |
|||
email_list = [] |
|||
if mail.email_to: |
|||
email_to = self.send_get_mail_to(mail) |
|||
email_list += email_to |
|||
for partner in mail.recipient_ids: |
|||
email_to = self.send_get_mail_to(mail, partner=partner) |
|||
email_list += email_to |
|||
return email_list |
|||
|
|||
@api.multi |
|||
def create(self, vals): |
|||
mail = super(MailMail, self).create(vals) |
|||
if vals.get('statistics_ids'): |
|||
email_list = self.email_to_list_get(mail) |
|||
for stat in mail.statistics_ids: |
|||
stat.write({ |
|||
'email_from': mail.email_from, |
|||
'email_to': ';'.join(email_list), |
|||
'subject': mail.subject, |
|||
}) |
|||
return mail |
@ -0,0 +1,13 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# License AGPL-3: Antiun Ingenieria S.L. - Antonio Espinosa |
|||
# See README.rst file on addon root folder for more details |
|||
|
|||
from openerp import models, fields |
|||
|
|||
|
|||
class MailMailStatistics(models.Model): |
|||
_inherit = 'mail.mail.statistics' |
|||
|
|||
email_from = fields.Char(string='From', readonly=True) |
|||
email_to = fields.Char(string='To', readonly=True) |
|||
subject = fields.Char(string='Subject', readonly=True) |
After Width: 128 | Height: 128 | Size: 9.2 KiB |
@ -0,0 +1,5 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# © 2015 Antiun Ingenieria S.L. - Antonio Espinosa |
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
|||
|
|||
from . import test_mail_mail |
@ -0,0 +1,60 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# © 2015 Antiun Ingenieria S.L. - Antonio Espinosa |
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
|||
|
|||
from openerp.tests.common import TransactionCase |
|||
from openerp import fields |
|||
from email.utils import formataddr |
|||
|
|||
|
|||
# One test case per method |
|||
class TestResPartner(TransactionCase): |
|||
|
|||
def test_mail_mail_create(self): |
|||
partner_a = self.env.ref('base.res_partner_address_16') |
|||
partner_b = self.env.ref('base.res_partner_3') |
|||
partner_c = self.env.ref('base.res_partner_2') |
|||
mass_mailing = self.env['mail.mass_mailing'].create({ |
|||
'email_from': 'email_from@example.com', |
|||
'name': 'Subject test', |
|||
'mailing_domain': "[['id', 'in', [%d, %d, %d]]]" % ( |
|||
partner_a.id, |
|||
partner_b.id, |
|||
partner_c.id |
|||
), |
|||
'mailing_model': 'res.partner', |
|||
'body_html': '<p>Hello world!</p>', |
|||
'reply_to_mode': 'email', |
|||
}) |
|||
mail = self.env['mail.mail'].create({ |
|||
'author_id': self.env.ref('base.res_partner_4').id, |
|||
'notification': False, |
|||
'mailing_id': mass_mailing.id, |
|||
'date': fields.Datetime.now(), |
|||
'subject': 'Subject test', |
|||
'email_from': 'email_from@example.com', |
|||
'email_to': partner_a.email, |
|||
'recipient_ids': [ |
|||
(4, partner_b.id), |
|||
(4, partner_c.id), |
|||
], |
|||
'statistics_ids': [(0, 0, { |
|||
'mass_mailing_id': mass_mailing.id, |
|||
'model': 'res.partner', |
|||
'res_id': partner_a.id, |
|||
})], |
|||
'model': 'res.partner', |
|||
'res_id': partner_a.id, |
|||
}) |
|||
|
|||
orig_list = [ |
|||
partner_a.email, |
|||
formataddr((partner_b.name, partner_b.email)), |
|||
formataddr((partner_c.name, partner_c.email)), |
|||
] |
|||
self.assertEqual(len(mail.statistics_ids), 1) |
|||
self.assertEqual(mail.statistics_ids[0].subject, 'Subject test') |
|||
self.assertEqual(mail.statistics_ids[0].email_from, |
|||
'email_from@example.com') |
|||
for address in mail.statistics_ids[0].email_to.split(';'): |
|||
self.assertIn(address, orig_list) |
@ -0,0 +1,39 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<openerp> |
|||
<data> |
|||
|
|||
<record model="ir.ui.view" id="view_mail_mail_statistics_tree"> |
|||
<field name="name">Mail statistics extra columns</field> |
|||
<field name="model">mail.mail.statistics</field> |
|||
<field name="inherit_id" ref="mass_mailing.view_mail_mail_statistics_tree"/> |
|||
<field name="arch" type="xml"> |
|||
<field name="mail_mail_id_int" position="attributes"> |
|||
<attribute name="invisible">1</attribute> |
|||
</field> |
|||
<field name="message_id" position="attributes"> |
|||
<attribute name="invisible">1</attribute> |
|||
</field> |
|||
<field name="message_id" position="after"> |
|||
<field name="subject"/> |
|||
<field name="email_from"/> |
|||
<field name="email_to"/> |
|||
</field> |
|||
</field> |
|||
</record> |
|||
|
|||
<record model="ir.ui.view" id="view_mail_mail_statistics_form"> |
|||
<field name="name">Mail statistics extra info</field> |
|||
<field name="model">mail.mail.statistics</field> |
|||
<field name="inherit_id" ref="mass_mailing.view_mail_mail_statistics_form"/> |
|||
<field name="arch" type="xml"> |
|||
<field name="message_id" position="after"> |
|||
<field name="subject"/> |
|||
<field name="email_from"/> |
|||
<field name="email_to"/> |
|||
</field> |
|||
</field> |
|||
</record> |
|||
|
|||
|
|||
</data> |
|||
</openerp> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue