forked from OCA/social
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by pedrobaeza
- Loading branch information
Showing
25 changed files
with
1,327 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
=============================== | ||
Unique records for mass mailing | ||
=============================== | ||
|
||
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png | ||
:target: https://odoo-community.org/page/development-status | ||
:alt: Beta | ||
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png | ||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html | ||
:alt: License: AGPL-3 | ||
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github | ||
:target: https://github.com/OCA/social/tree/12.0/mass_mailing_unique | ||
:alt: OCA/social | ||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png | ||
:target: https://translation.odoo-community.org/projects/social-12-0/social-12-0-mass_mailing_unique | ||
:alt: Translate me on Weblate | ||
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png | ||
:target: https://runbot.odoo-community.org/runbot/205/12.0 | ||
:alt: Try me on Runbot | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
This module extends the functionality of mass mailing lists to disable | ||
duplicate entries in list names and contact emails per list. | ||
|
||
This way you will avoid conflicts when importing contacts to a list that has a | ||
duplicated name. | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Installation | ||
============ | ||
|
||
Before installing this module, you need to: | ||
|
||
* Remove all duplicated list names. | ||
* Remove all duplicated emails in each list. | ||
|
||
Usage | ||
===== | ||
|
||
To use this module, you need to try to create a duplicated mailing list, or a | ||
duplicated email inside one. You will not can. | ||
|
||
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 <https://github.com/OCA/social/issues/new?body=module:%20mass_mailing_unique%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. | ||
|
||
Do not contact contributors directly about support or help with technical issues. | ||
|
||
Credits | ||
======= | ||
|
||
Authors | ||
~~~~~~~ | ||
|
||
* Tecnativa | ||
|
||
Contributors | ||
~~~~~~~~~~~~ | ||
|
||
* `Tecnativa <https://www.tecnativa.com>`_: | ||
|
||
* Jairo Llopis | ||
* Vicent Cubells | ||
* Pedro M. Baeza | ||
* Ernesto Tejeda | ||
|
||
Maintainers | ||
~~~~~~~~~~~ | ||
|
||
This module is maintained by the OCA. | ||
|
||
.. image:: https://odoo-community.org/logo.png | ||
:alt: Odoo Community Association | ||
:target: https://odoo-community.org | ||
|
||
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. | ||
|
||
This module is part of the `OCA/social <https://github.com/OCA/social/tree/12.0/mass_mailing_unique>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Copyright 2015 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis | ||
# Copyright 2016 Tecnativa - Vicent Cubells | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
from . import models | ||
from .hooks import pre_init_hook |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Copyright 2015 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis | ||
# Copyright 2016 Tecnativa - Vicent Cubells | ||
# Copyright 2018 Tecnativa - Ernesto Tejeda | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
{ | ||
"name": "Unique records for mass mailing", | ||
"summary": "Avoids duplicate mailing lists and contacts", | ||
"version": "14.0.1.0.0", | ||
"category": "Marketing", | ||
"website": "https://github.com/OCA/social", | ||
"author": "Tecnativa, Odoo Community Association (OCA)", | ||
"license": "AGPL-3", | ||
"depends": ["mass_mailing"], | ||
"pre_init_hook": "pre_init_hook", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Copyright 2015 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis | ||
# Copyright 2016 Tecnativa - Vicent Cubells | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
from odoo import _ | ||
from odoo.exceptions import ValidationError | ||
|
||
|
||
def pre_init_hook(cr): | ||
"""Make sure there are no duplicates before installing the module. | ||
If you define an unique key in Odoo that cannot be applied, Odoo will log a | ||
warning and install the module without that constraint. Since this module | ||
is useless without those constraints, we check here if all will work before | ||
installing, and provide a user-friendly message in case of failure. | ||
""" | ||
errors = list() | ||
# Search for duplicates in emails | ||
cr.execute( | ||
""" | ||
SELECT email_normalized, COUNT(id) as count | ||
FROM mailing_contact | ||
GROUP BY email_normalized | ||
HAVING COUNT(id) > 1 | ||
""" | ||
) | ||
for result in cr.fetchall(): | ||
errors.append( | ||
"There are {1} mailing contacts with the same email: {0}".format(*result) | ||
) | ||
# Search for duplicates in list's name | ||
cr.execute( | ||
""" | ||
SELECT name, COUNT(id) as count | ||
FROM mailing_list | ||
GROUP BY name | ||
HAVING COUNT(id) > 1 | ||
""" | ||
) | ||
for result in cr.fetchall(): | ||
errors.append( | ||
"There are {1} mailing lists with the same name: {0}.".format(*result) | ||
) | ||
# Abort if duplicates are found | ||
if errors: | ||
raise ValidationError( | ||
_("Unable to install module mass_mailing_unique:\n%s", "\n".join(errors)) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * mass_mailing_unique | ||
# | ||
# Translators: | ||
# Carles Antoli <[email protected]>, 2017 | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 9.0c\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2017-01-07 07:32+0000\n" | ||
"PO-Revision-Date: 2017-01-07 07:32+0000\n" | ||
"Last-Translator: Carles Antoli <[email protected]>, 2017\n" | ||
"Language-Team: Catalan (https://www.transifex.com/oca/teams/23907/ca/)\n" | ||
"Language: ca\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: \n" | ||
"Plural-Forms: nplurals=2; plural=(n != 1);\n" | ||
|
||
#. module: mass_mailing_unique | ||
#: sql_constraint:mail.mass_mailing.list:0 | ||
msgid "Cannot have more than one lists with the same name." | ||
msgstr "No es pot tenir més d'una llista amb el mateix nom." | ||
|
||
#. module: mass_mailing_unique | ||
#: code:addons/mass_mailing_unique/models/mail_mass_mailing_contact.py:24 | ||
#, python-format | ||
msgid "" | ||
"Email (%(contact_email)s) already in mailing list(s):\n" | ||
" %(lists)s\n" | ||
" Please use a different email address or " | ||
"remove (%(contact_email)s) from the mailing list(s) " | ||
"above." | ||
msgstr "" | ||
|
||
#. module: mass_mailing_unique | ||
#: model:ir.model,name:mass_mailing_unique.model_mail_mass_mailing_list | ||
msgid "Mailing List" | ||
msgstr "Llista d'enviament" | ||
|
||
#. module: mass_mailing_unique | ||
#: model:ir.model,name:mass_mailing_unique.model_mail_mass_mailing_contact | ||
msgid "Mass Mailing Contact" | ||
msgstr "Contactes del correu massiu" | ||
|
||
#. module: mass_mailing_unique | ||
#: model:ir.model,name:mass_mailing_unique.model_mail_mass_mailing_list_contact_rel | ||
msgid "Mass Mailing Subscription Information" | ||
msgstr "" | ||
|
||
#, fuzzy | ||
#~ msgid "Cannot have the same email (%s) morethan once in the same list." | ||
#~ msgstr "" | ||
#~ "No es pot tenir el mateix correu electrònic més d'una vegada en la " | ||
#~ "mateixa llista." | ||
|
||
#~ msgid "Fix this before installing:" | ||
#~ msgstr "Solucionar això abans d'instal·lar:" | ||
|
||
#~ msgid "There are {1} lists with name {0}." | ||
#~ msgstr "Hi ha {1} llistes amb el nom {0}." | ||
|
||
#~ msgid "{0} appears {2} times in list {1}." | ||
#~ msgstr "{0} apareix {2} vegades en la llista {1}." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * mass_mailing_unique | ||
# | ||
# Translators: | ||
# Rudolf Schnapka <[email protected]>, 2017 | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 9.0c\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2017-03-28 08:19+0000\n" | ||
"PO-Revision-Date: 2017-03-28 08:19+0000\n" | ||
"Last-Translator: Rudolf Schnapka <[email protected]>, 2017\n" | ||
"Language-Team: German (https://www.transifex.com/oca/teams/23907/de/)\n" | ||
"Language: de\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: \n" | ||
"Plural-Forms: nplurals=2; plural=(n != 1);\n" | ||
|
||
#. module: mass_mailing_unique | ||
#: sql_constraint:mail.mass_mailing.list:0 | ||
msgid "Cannot have more than one lists with the same name." | ||
msgstr "Sie dürfen nicht mehrere Listen gleich Namens führen." | ||
|
||
#. module: mass_mailing_unique | ||
#: code:addons/mass_mailing_unique/models/mail_mass_mailing_contact.py:24 | ||
#, python-format | ||
msgid "" | ||
"Email (%(contact_email)s) already in mailing list(s):\n" | ||
" %(lists)s\n" | ||
" Please use a different email address or " | ||
"remove (%(contact_email)s) from the mailing list(s) " | ||
"above." | ||
msgstr "" | ||
|
||
#. module: mass_mailing_unique | ||
#: model:ir.model,name:mass_mailing_unique.model_mail_mass_mailing_list | ||
msgid "Mailing List" | ||
msgstr "Mailingliste" | ||
|
||
#. module: mass_mailing_unique | ||
#: model:ir.model,name:mass_mailing_unique.model_mail_mass_mailing_contact | ||
msgid "Mass Mailing Contact" | ||
msgstr "Massenmail-Kontakt" | ||
|
||
#. module: mass_mailing_unique | ||
#: model:ir.model,name:mass_mailing_unique.model_mail_mass_mailing_list_contact_rel | ||
msgid "Mass Mailing Subscription Information" | ||
msgstr "" | ||
|
||
#, fuzzy | ||
#~ msgid "Cannot have the same email (%s) morethan once in the same list." | ||
#~ msgstr "" | ||
#~ "Die gleiche Email-Anschrift darf nicht mehrmals in einer Liste vorkommen." | ||
|
||
#~ msgid "Fix this before installing:" | ||
#~ msgstr "Beheben Sie dies vor der Installation:" | ||
|
||
#~ msgid "There are {1} lists with name {0}." | ||
#~ msgstr "Es gibt {1} Liste mit Name {0}." | ||
|
||
#~ msgid "{0} appears {2} times in list {1}." | ||
#~ msgstr "{0} erscheint {2} mal in der Liste {1}." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * mass_mailing_unique | ||
# | ||
# Translators: | ||
# OCA Transbot <[email protected]>, 2017 | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 9.0c\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2017-01-04 03:40+0000\n" | ||
"PO-Revision-Date: 2017-01-04 03:40+0000\n" | ||
"Last-Translator: OCA Transbot <[email protected]>, 2017\n" | ||
"Language-Team: Spanish (https://www.transifex.com/oca/teams/23907/es/)\n" | ||
"Language: es\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: \n" | ||
"Plural-Forms: nplurals=2; plural=(n != 1);\n" | ||
|
||
#. module: mass_mailing_unique | ||
#: sql_constraint:mail.mass_mailing.list:0 | ||
msgid "Cannot have more than one lists with the same name." | ||
msgstr "No se puede tener más de una lista con el mismo nombre." | ||
|
||
#. module: mass_mailing_unique | ||
#: code:addons/mass_mailing_unique/models/mail_mass_mailing_contact.py:24 | ||
#, python-format | ||
msgid "" | ||
"Email (%(contact_email)s) already in mailing list(s):\n" | ||
" %(lists)s\n" | ||
" Please use a different email address or " | ||
"remove (%(contact_email)s) from the mailing list(s) " | ||
"above." | ||
msgstr "" | ||
|
||
#. module: mass_mailing_unique | ||
#: model:ir.model,name:mass_mailing_unique.model_mail_mass_mailing_list | ||
msgid "Mailing List" | ||
msgstr "Lista de correo" | ||
|
||
#. module: mass_mailing_unique | ||
#: model:ir.model,name:mass_mailing_unique.model_mail_mass_mailing_contact | ||
msgid "Mass Mailing Contact" | ||
msgstr "Contacto de envío masivo" | ||
|
||
#. module: mass_mailing_unique | ||
#: model:ir.model,name:mass_mailing_unique.model_mail_mass_mailing_list_contact_rel | ||
msgid "Mass Mailing Subscription Information" | ||
msgstr "" | ||
|
||
#, fuzzy | ||
#~ msgid "Cannot have the same email (%s) morethan once in the same list." | ||
#~ msgstr "No se puede tener el mismo email varias veces en la misma lista." | ||
|
||
#~ msgid "Fix this before installing:" | ||
#~ msgstr "Arregle esto antes de instalar:" | ||
|
||
#~ msgid "There are {1} lists with name {0}." | ||
#~ msgstr "Hay {1} listas con el nombre {0}." | ||
|
||
#~ msgid "{0} appears {2} times in list {1}." | ||
#~ msgstr "{0} aparece {2} veces en la lista {1}." |
Oops, something went wrong.