diff --git a/mass_mailing_extra/__init__.py b/mass_mailing_extra/__init__.py new file mode 100644 index 0000000..bff786c --- /dev/null +++ b/mass_mailing_extra/__init__.py @@ -0,0 +1 @@ +import models diff --git a/mass_mailing_extra/__openerp__.py b/mass_mailing_extra/__openerp__.py new file mode 100644 index 0000000..cc2207f --- /dev/null +++ b/mass_mailing_extra/__openerp__.py @@ -0,0 +1,21 @@ +{ + 'name' : 'Improvements for mass mailing', + 'version' : '1.0.0', + 'author' : 'IT-Projects LLC, Ivan Yelizariev', + 'license': 'LGPL-3', + 'category' : 'Mail', + 'website' : 'https://yelizariev.github.io', + 'description': """ +Modules adds: + +* partners info in mail.mail.statistics tree +* partners info in mail.mail.statistics form + +Tested on 8.0 f8d5a6727d3e8d428d9bef93da7ba6b11f344284 + """, + 'depends' : ['mass_mailing'], + 'data':[ + 'views.xml', + ], + 'installable': False +} diff --git a/mass_mailing_extra/models.py b/mass_mailing_extra/models.py new file mode 100644 index 0000000..1fc804f --- /dev/null +++ b/mass_mailing_extra/models.py @@ -0,0 +1,28 @@ +from openerp import api,models,fields + +class MailMailStats(models.Model): + + _inherit = 'mail.mail.statistics' + + partner_ids = fields.Many2many('res.partner', related='mail_mail_id.recipient_ids', string='Partners (Mail)') + + @api.one + def _get_partner_id(self): + if self.model=='res.partner': + self.partner_id = self.res_id + else: + self.partner_id = None + + partner_id = fields.Many2one('res.partner', compute=_get_partner_id, string='Partner (Document ID)') + + @api.one + def _get_partners(self): + res = {} + for p in self.partner_ids: + res[p.id] = p + if self.partner_id and self.partner_id.id not in res: + res[self.partner_id.id] = self.partner_id + self.partners = ', '.join([('%s <%s>' % (p.name, p.email)) for id,p in res.items()]) + + + partners = fields.Char('Partners', compute=_get_partners) diff --git a/mass_mailing_extra/static/description/icon.png b/mass_mailing_extra/static/description/icon.png new file mode 100644 index 0000000..79f7d8f Binary files /dev/null and b/mass_mailing_extra/static/description/icon.png differ diff --git a/mass_mailing_extra/views.xml b/mass_mailing_extra/views.xml new file mode 100644 index 0000000..19362b4 --- /dev/null +++ b/mass_mailing_extra/views.xml @@ -0,0 +1,38 @@ + + + + + + mail.mail.statistics.form + mail.mail.statistics + + + + + + + + + + + + + + + mail.mail.statistics.tree + mail.mail.statistics + + + + + + + + + +