Browse Source

[ADD] mass_mailing_keep_archives (#50)

* Bring modules from odoo-addons

* ADD README.rst

* FIX

* FIX init__-py

* ADD author
pull/67/head
Nicolas Mac Rouillon 9 years ago
committed by Holger Brunn
parent
commit
2ee5a68ee0
  1. 32
      mass_mailing_keep_archives/README.rst
  2. 6
      mass_mailing_keep_archives/__init__.py
  3. 24
      mass_mailing_keep_archives/__openerp__.py
  4. 15
      mass_mailing_keep_archives/mass_mailing_view.xml
  5. 6
      mass_mailing_keep_archives/models/__init__.py
  6. 32
      mass_mailing_keep_archives/models/mass_mailing.py

32
mass_mailing_keep_archives/README.rst

@ -0,0 +1,32 @@
+.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
+ :alt: License
+
+Mass Mailing Keep Archives
+==========================
+
+This module adds an option on mass mailing campaings to allow you set if you
+want to keep archives (mails sent) or not.
+
+Credits
+=======
+
+Contributors
+------------
+
+* Juan José Scarafía <jjs@adhoc.com.ar>
+* Nicolás Mac Rouillon <nmr@adhoc.com.ar>
+
+Maintainer
+----------
+
+.. image:: http://odoo-community.org/logo.png
+ :alt: Odoo Community Association
+ :target: http://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.

6
mass_mailing_keep_archives/__init__.py

@ -0,0 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
from . import models

24
mass_mailing_keep_archives/__openerp__.py

@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
##############################################################################
# © 2015 ADHOC SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
##############################################################################
{
'name': 'Mass Mailing Keep Archives',
'version': '8.0.0.0.0',
'author': 'ADHOC SA, Odoo Community Association (OCA)',
'website': 'www.adhoc.com.ar',
'license': 'AGPL-3',
'depends': [
'mass_mailing',
],
'data': [
'mass_mailing_view.xml',
],
'demo': [
],
'test': [],
'installable': True,
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

15
mass_mailing_keep_archives/mass_mailing_view.xml

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_mail_mass_mailing_form" model="ir.ui.view">
<field name="name">mail.mass_mailing.keep_archives.form</field>
<field name="model">mail.mass_mailing</field>
<field name="inherit_id" ref="mass_mailing.view_mail_mass_mailing_form"/>
<field name="arch" type="xml">
<label for="reply_to" position="before">
<field name="keep_archives"/>
</label>
</field>
</record>
</data>
</openerp>

6
mass_mailing_keep_archives/models/__init__.py

@ -0,0 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
from . import mass_mailing

32
mass_mailing_keep_archives/models/mass_mailing.py

@ -0,0 +1,32 @@
# -*- coding: utf-8 -*-
from openerp import models, api, fields
class MassMailing(models.Model):
_inherit = "mail.mass_mailing"
keep_archives = fields.Boolean()
class MailComposeMessage(models.Model):
_inherit = "mail.compose.message"
@api.model
def get_mail_values(self, wizard, res_ids):
""" Override method to add keep_archives functionalty """
res = super(MailComposeMessage, self).get_mail_values(
wizard, res_ids)
# use only for allowed models in mass mailing
if wizard.composition_mode == 'mass_mail' and \
(wizard.mass_mailing_name or wizard.mass_mailing_id) and \
wizard.model in [item[0] for item in self.env[
'mail.mass_mailing']._get_mailing_model()]:
mass_mailing = wizard.mass_mailing_id
# option only from mass mailing, not for compositions create
# mass mailings
if mass_mailing:
for res_id in res_ids:
res[res_id].update({
'auto_delete': not mass_mailing.keep_archives,
})
return res
Loading…
Cancel
Save