Browse Source

Merge branch '9.0' of /home/iii/addons-yelizariev/../mass_mailing_extra into 9.0

pull/2/head
Ildar Nasyrov 9 years ago
parent
commit
eccd80db74
  1. 1
      mass_mailing_extra/__init__.py
  2. 21
      mass_mailing_extra/__openerp__.py
  3. 28
      mass_mailing_extra/models.py
  4. BIN
      mass_mailing_extra/static/description/icon.png
  5. 38
      mass_mailing_extra/views.xml

1
mass_mailing_extra/__init__.py

@ -0,0 +1 @@
import models

21
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
}

28
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)

BIN
mass_mailing_extra/static/description/icon.png

After

Width: 100  |  Height: 100  |  Size: 2.1 KiB

38
mass_mailing_extra/views.xml

@ -0,0 +1,38 @@
<?xml version="1.0"?>
<openerp>
<data>
<record model="ir.ui.view" id="view_mail_mail_statistics_form">
<field name="name">mail.mail.statistics.form</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">
<xpath expr="//form" position="inside">
<notebook>
<page string="Partners">
<group>
<label for="partners" string="Partners (summary)"/>
<field name="partners" readonly="1" nolabel="1"/>
<field name="partner_id" readonly="1"/>
</group>
<label for="partner_ids"/>
<field name="partner_ids" readonly="1"/>
</page>
</notebook>
</xpath>
</field>
</record>
<record model="ir.ui.view" id="view_mail_mail_statistics_tree">
<field name="name">mail.mail.statistics.tree</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">
<xpath expr="//field[@name='mail_mail_id_int']" position="before">
<field name="partners"/>
</xpath>
</field>
</record>
</data>
</openerp>
Loading…
Cancel
Save