Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 97 additions & 0 deletions mass_mailing_unique/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
===============================
Unique records for mass mailing
===============================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:6c5fd9d116a02db48f1af0912637513299c74afcbb9f6d256a89330ba9f9cfbe
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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%2Fmass--mailing-lightgray.png?logo=github
:target: https://github.com/OCA/mass-mailing/tree/18.0/mass_mailing_unique
:alt: OCA/mass-mailing
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/mass-mailing-18-0/mass-mailing-18-0-mass_mailing_unique
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/mass-mailing&target_branch=18.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module extends the functionality of mass mailing lists to disable
duplicate entries in list names and contact emails.

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 mailing contacts.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/mass-mailing/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/mass-mailing/issues/new?body=module:%20mass_mailing_unique%0Aversion:%2018.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

- `Camptocamp <https://www.camptocamp.com>`__

- Iván Todorovich <ivan.todorovich@gmail.com>

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/mass-mailing <https://github.com/OCA/mass-mailing/tree/18.0/mass_mailing_unique>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
6 changes: 6 additions & 0 deletions mass_mailing_unique/__init__.py
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
16 changes: 16 additions & 0 deletions mass_mailing_unique/__manifest__.py
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": "18.0.1.0.0",
"category": "Marketing",
"website": "https://github.com/OCA/mass-mailing",
"author": "Tecnativa, Odoo Community Association (OCA)",
"license": "AGPL-3",
"depends": ["mass_mailing"],
"pre_init_hook": "pre_init_hook",
}
49 changes: 49 additions & 0 deletions mass_mailing_unique/hooks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# 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.exceptions import ValidationError


def pre_init_hook(env):
"""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
env.cr.execute(
"""
SELECT email_normalized, COUNT(id) as count
FROM mailing_contact
GROUP BY email_normalized
HAVING COUNT(id) > 1
"""
)
for result in env.cr.fetchall():
errors.append(
"There are {1} mailing contacts with the same email: {0}".format(*result)
)
# Search for duplicates in list's name
env.cr.execute(
"""
SELECT name, COUNT(id) as count
FROM mailing_list
GROUP BY name
HAVING COUNT(id) > 1
"""
)
for result in env.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(
env._(
"Unable to install module mass_mailing_unique:\n%s", "\n".join(errors)
)
)
68 changes: 68 additions & 0 deletions mass_mailing_unique/i18n/ca.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mass_mailing_unique
#
# Translators:
# Carles Antoli <carlesantoli@hotmail.com>, 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 <carlesantoli@hotmail.com>, 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
#: model:ir.model.constraint,message:mass_mailing_unique.constraint_mailing_list_unique_name
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
#: model:ir.model,name:mass_mailing_unique.model_mailing_contact
msgid "Mailing Contact"
msgstr ""

#. module: mass_mailing_unique
#: model:ir.model,name:mass_mailing_unique.model_mailing_list
msgid "Mailing List"
msgstr "Llista d'enviament"

#. module: mass_mailing_unique
#: model:ir.model.constraint,message:mass_mailing_unique.constraint_mailing_contact_unique_email
msgid ""
"There's already an existing mailing contact with this email address. \n"
"Delete that existing record or change its email field value."
msgstr ""

#. module: mass_mailing_unique
#. odoo-python
#: code:addons/mass_mailing_unique/hooks.py:0
#, python-format
msgid ""
"Unable to install module mass_mailing_unique:\n"
"%s"
msgstr ""

#~ msgid "Mass Mailing Contact"
#~ msgstr "Contactes del correu massiu"

#, 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}."
67 changes: 67 additions & 0 deletions mass_mailing_unique/i18n/de.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mass_mailing_unique
#
# Translators:
# Rudolf Schnapka <rs@techno-flex.de>, 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 <rs@techno-flex.de>, 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
#: model:ir.model.constraint,message:mass_mailing_unique.constraint_mailing_list_unique_name
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
#: model:ir.model,name:mass_mailing_unique.model_mailing_contact
msgid "Mailing Contact"
msgstr ""

#. module: mass_mailing_unique
#: model:ir.model,name:mass_mailing_unique.model_mailing_list
msgid "Mailing List"
msgstr "Mailingliste"

#. module: mass_mailing_unique
#: model:ir.model.constraint,message:mass_mailing_unique.constraint_mailing_contact_unique_email
msgid ""
"There's already an existing mailing contact with this email address. \n"
"Delete that existing record or change its email field value."
msgstr ""

#. module: mass_mailing_unique
#. odoo-python
#: code:addons/mass_mailing_unique/hooks.py:0
#, python-format
msgid ""
"Unable to install module mass_mailing_unique:\n"
"%s"
msgstr ""

#~ msgid "Mass Mailing Contact"
#~ msgstr "Massenmail-Kontakt"

#, 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}."
81 changes: 81 additions & 0 deletions mass_mailing_unique/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mass_mailing_unique
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 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: 2023-12-12 16:22+0000\n"
"Last-Translator: Ivorra78 <informatica@totmaterial.es>\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"
"X-Generator: Weblate 4.17\n"

#. module: mass_mailing_unique
#: model:ir.model.constraint,message:mass_mailing_unique.constraint_mailing_list_unique_name
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
#: model:ir.model,name:mass_mailing_unique.model_mailing_contact
msgid "Mailing Contact"
msgstr "Contacto por Correo"

#. module: mass_mailing_unique
#: model:ir.model,name:mass_mailing_unique.model_mailing_list
msgid "Mailing List"
msgstr "Lista de correo"

#. module: mass_mailing_unique
#: model:ir.model.constraint,message:mass_mailing_unique.constraint_mailing_contact_unique_email
msgid ""
"There's already an existing mailing contact with this email address. \n"
"Delete that existing record or change its email field value."
msgstr ""

#. module: mass_mailing_unique
#. odoo-python
#: code:addons/mass_mailing_unique/hooks.py:0
#, python-format
msgid ""
"Unable to install module mass_mailing_unique:\n"
"%s"
msgstr ""
"No se ha podido instalar el módulo mass_mailing_unique:\n"
"%s"

#~ msgid "Display Name"
#~ msgstr "Mostrar Nombre"

#~ msgid "ID"
#~ msgstr "ID"

#~ msgid "Last Modified on"
#~ msgstr "Última Modificación el"

#~ msgid "There's already a contact with this email address"
#~ msgstr "Ya hay un contacto con esta dirección de correo electrónico"

#~ msgid "Mass Mailing Contact"
#~ msgstr "Contacto de envío masivo"

#, 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}."
Loading