Merge PR #1265 into 16.0

Signed-off-by pedrobaeza
pull/1268/head
OCA-git-bot 2023-12-12 09:55:26 +00:00
commit 444ad4af40
25 changed files with 1522 additions and 0 deletions

View File

@ -0,0 +1,96 @@
===============================
Unique records for mass mailing
===============================
..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:f5940baf01ac9e97a9657f3d32ee223ed89599e4ddb03a316dc72aa39b7d3d91
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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/16.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-16-0/social-16-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/social&target_branch=16.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/social/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/social/issues/new?body=module:%20mass_mailing_unique%0Aversion:%2016.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/social <https://github.com/OCA/social/tree/16.0/mass_mailing_unique>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@ -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

View File

@ -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": "16.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",
}

View File

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

View File

@ -0,0 +1,83 @@
# 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.fields,field_description:mass_mailing_unique.field_mailing_contact__display_name
#: model:ir.model.fields,field_description:mass_mailing_unique.field_mailing_list__display_name
msgid "Display Name"
msgstr ""
#. module: mass_mailing_unique
#: model:ir.model.fields,field_description:mass_mailing_unique.field_mailing_contact__id
#: model:ir.model.fields,field_description:mass_mailing_unique.field_mailing_list__id
msgid "ID"
msgstr ""
#. module: mass_mailing_unique
#: model:ir.model.fields,field_description:mass_mailing_unique.field_mailing_contact____last_update
#: model:ir.model.fields,field_description:mass_mailing_unique.field_mailing_list____last_update
msgid "Last Modified on"
msgstr ""
#. 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 a contact with this email address"
msgstr ""
#. module: mass_mailing_unique
#: 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}."

View File

@ -0,0 +1,82 @@
# 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.fields,field_description:mass_mailing_unique.field_mailing_contact__display_name
#: model:ir.model.fields,field_description:mass_mailing_unique.field_mailing_list__display_name
msgid "Display Name"
msgstr ""
#. module: mass_mailing_unique
#: model:ir.model.fields,field_description:mass_mailing_unique.field_mailing_contact__id
#: model:ir.model.fields,field_description:mass_mailing_unique.field_mailing_list__id
msgid "ID"
msgstr ""
#. module: mass_mailing_unique
#: model:ir.model.fields,field_description:mass_mailing_unique.field_mailing_contact____last_update
#: model:ir.model.fields,field_description:mass_mailing_unique.field_mailing_list____last_update
msgid "Last Modified on"
msgstr ""
#. 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 a contact with this email address"
msgstr ""
#. module: mass_mailing_unique
#: 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}."

View File

@ -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: 2017-01-04 03:40+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 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
#: 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.fields,field_description:mass_mailing_unique.field_mailing_contact__display_name
#: model:ir.model.fields,field_description:mass_mailing_unique.field_mailing_list__display_name
msgid "Display Name"
msgstr ""
#. module: mass_mailing_unique
#: model:ir.model.fields,field_description:mass_mailing_unique.field_mailing_contact__id
#: model:ir.model.fields,field_description:mass_mailing_unique.field_mailing_list__id
msgid "ID"
msgstr ""
#. module: mass_mailing_unique
#: model:ir.model.fields,field_description:mass_mailing_unique.field_mailing_contact____last_update
#: model:ir.model.fields,field_description:mass_mailing_unique.field_mailing_list____last_update
msgid "Last Modified on"
msgstr ""
#. 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 "Lista de correo"
#. module: mass_mailing_unique
#: model:ir.model.constraint,message:mass_mailing_unique.constraint_mailing_contact_unique_email
msgid "There's already a contact with this email address"
msgstr ""
#. module: mass_mailing_unique
#: 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 "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}."

View File

@ -0,0 +1,100 @@
# 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: 2021-03-04 13:45+0000\n"
"Last-Translator: Rémi <remi@le-filament.com>\n"
"Language-Team: French (https://www.transifex.com/oca/teams/23907/fr/)\n"
"Language: fr\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.3.2\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 "Impossible d'avoir plus d'une liste avec le même nom."
#. module: mass_mailing_unique
#: model:ir.model.fields,field_description:mass_mailing_unique.field_mailing_contact__display_name
#: model:ir.model.fields,field_description:mass_mailing_unique.field_mailing_list__display_name
msgid "Display Name"
msgstr ""
#. module: mass_mailing_unique
#: model:ir.model.fields,field_description:mass_mailing_unique.field_mailing_contact__id
#: model:ir.model.fields,field_description:mass_mailing_unique.field_mailing_list__id
msgid "ID"
msgstr ""
#. module: mass_mailing_unique
#: model:ir.model.fields,field_description:mass_mailing_unique.field_mailing_contact____last_update
#: model:ir.model.fields,field_description:mass_mailing_unique.field_mailing_list____last_update
msgid "Last Modified on"
msgstr ""
#. 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 "Liste de diffusion"
#. module: mass_mailing_unique
#: model:ir.model.constraint,message:mass_mailing_unique.constraint_mailing_contact_unique_email
msgid "There's already a contact with this email address"
msgstr ""
#. module: mass_mailing_unique
#: code:addons/mass_mailing_unique/hooks.py:0
#, python-format
msgid ""
"Unable to install module mass_mailing_unique:\n"
"%s"
msgstr ""
#, 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 ""
#~ "Courriel (%(contact_email)s) déjà dans la(les) liste(s) de diffusion :\n"
#~ " %(lists)s\n"
#~ " Merci d'utiliser une adresse courriel différente ou "
#~ "supprimer (%(contact_email)s) de la (des) liste(s) de "
#~ "diffusion ci-dessus."
#~ msgid "Mass Mailing Contact"
#~ msgstr "Contact de la liste de diffusion"
#~ msgid "Mass Mailing Subscription Information"
#~ msgstr "Information d'Abonnement au Publipostage"
#, fuzzy
#~ msgid "Cannot have the same email (%s) morethan once in the same list."
#~ msgstr ""
#~ "Impossible d'avoir le même courriel plus d'une fois dans la même liste"
#~ msgid "Fix this before installing:"
#~ msgstr "Fixer avant l'installation:"
#~ msgid "There are {1} lists with name {0}."
#~ msgstr "Il y'a {1} listes avec le nom {0}."
#~ msgid "{0} appears {2} times in list {1}."
#~ msgstr "{0} Apparaît {2} fois dans la liste {1}."

View File

@ -0,0 +1,77 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mass_mailing_unique
#
# Translators:
# Bole <bole@dajmi5.com>, 2017
# OCA Transbot <transbot@odoo-community.org>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-12-01 02:19+0000\n"
"PO-Revision-Date: 2017-12-01 02:19+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2017\n"
"Language-Team: Croatian (https://www.transifex.com/oca/teams/23907/hr/)\n"
"Language: hr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\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 "Nije moguće imati više od jedne liste sa istim nazivom."
#. module: mass_mailing_unique
#: model:ir.model.fields,field_description:mass_mailing_unique.field_mailing_contact__display_name
#: model:ir.model.fields,field_description:mass_mailing_unique.field_mailing_list__display_name
msgid "Display Name"
msgstr ""
#. module: mass_mailing_unique
#: model:ir.model.fields,field_description:mass_mailing_unique.field_mailing_contact__id
#: model:ir.model.fields,field_description:mass_mailing_unique.field_mailing_list__id
msgid "ID"
msgstr ""
#. module: mass_mailing_unique
#: model:ir.model.fields,field_description:mass_mailing_unique.field_mailing_contact____last_update
#: model:ir.model.fields,field_description:mass_mailing_unique.field_mailing_list____last_update
msgid "Last Modified on"
msgstr ""
#. 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 "Mailing lista"
#. module: mass_mailing_unique
#: model:ir.model.constraint,message:mass_mailing_unique.constraint_mailing_contact_unique_email
msgid "There's already a contact with this email address"
msgstr ""
#. module: mass_mailing_unique
#: 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 "Kontakti za masovno slanje"
#, fuzzy
#~ msgid "Cannot have the same email (%s) morethan once in the same list."
#~ msgstr "Email mora biti jedinstven u listi."
#~ msgid "Fix this before installing:"
#~ msgstr "Ispravite sljedeće prije instalacije:"

View File

@ -0,0 +1,101 @@
# 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-10-09 07:54+0000\n"
"Last-Translator: mymage <stefano.consolaro@mymage.it>\n"
"Language-Team: Italian (https://www.transifex.com/oca/teams/23907/it/)\n"
"Language: it\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 "Non è possibile avere più di una lista con lo stesso nome."
#. module: mass_mailing_unique
#: model:ir.model.fields,field_description:mass_mailing_unique.field_mailing_contact__display_name
#: model:ir.model.fields,field_description:mass_mailing_unique.field_mailing_list__display_name
msgid "Display Name"
msgstr ""
#. module: mass_mailing_unique
#: model:ir.model.fields,field_description:mass_mailing_unique.field_mailing_contact__id
#: model:ir.model.fields,field_description:mass_mailing_unique.field_mailing_list__id
msgid "ID"
msgstr ""
#. module: mass_mailing_unique
#: model:ir.model.fields,field_description:mass_mailing_unique.field_mailing_contact____last_update
#: model:ir.model.fields,field_description:mass_mailing_unique.field_mailing_list____last_update
msgid "Last Modified on"
msgstr ""
#. 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 "Mailing list"
#. module: mass_mailing_unique
#: model:ir.model.constraint,message:mass_mailing_unique.constraint_mailing_contact_unique_email
msgid "There's already a contact with this email address"
msgstr ""
#. module: mass_mailing_unique
#: code:addons/mass_mailing_unique/hooks.py:0
#, python-format
msgid ""
"Unable to install module mass_mailing_unique:\n"
"%s"
msgstr ""
#, 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 ""
#~ "L'indirizzo (%(contact_email)s) è già nella mailing list:\n"
#~ " %(lists)s\n"
#~ " Utilizzare un indirizzo e-mail diverso o "
#~ "rimuovere (%(contact_email)s) dalle liste "
#~ "sopraelencate."
#~ msgid "Mass Mailing Contact"
#~ msgstr "Contatto Mass Mailing"
#~ msgid "Mass Mailing Subscription Information"
#~ msgstr "Informazione iscrizione mailing di massa"
#, fuzzy
#~ msgid "Cannot have the same email (%s) morethan once in the same list."
#~ msgstr ""
#~ "Non è possibile inserire la stessa email più di una volta nella stessa "
#~ "lista."
#~ msgid "Fix this before installing:"
#~ msgstr "Da risolvere prima dell'installazione:"
#~ msgid "There are {1} lists with name {0}."
#~ msgstr "Ci sono {1} liste con il nome {0}."
#~ msgid "{0} appears {2} times in list {1}."
#~ msgstr "{0} appare {2} volte nella lista {1}."

View File

@ -0,0 +1,60 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mass_mailing_unique
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \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 ""
#. module: mass_mailing_unique
#: model:ir.model.fields,field_description:mass_mailing_unique.field_mailing_contact__display_name
#: model:ir.model.fields,field_description:mass_mailing_unique.field_mailing_list__display_name
msgid "Display Name"
msgstr ""
#. module: mass_mailing_unique
#: model:ir.model.fields,field_description:mass_mailing_unique.field_mailing_contact__id
#: model:ir.model.fields,field_description:mass_mailing_unique.field_mailing_list__id
msgid "ID"
msgstr ""
#. module: mass_mailing_unique
#: model:ir.model.fields,field_description:mass_mailing_unique.field_mailing_contact____last_update
#: model:ir.model.fields,field_description:mass_mailing_unique.field_mailing_list____last_update
msgid "Last Modified on"
msgstr ""
#. 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 ""
#. module: mass_mailing_unique
#: model:ir.model.constraint,message:mass_mailing_unique.constraint_mailing_contact_unique_email
msgid "There's already a contact with this email address"
msgstr ""
#. module: mass_mailing_unique
#: code:addons/mass_mailing_unique/hooks.py:0
#, python-format
msgid ""
"Unable to install module mass_mailing_unique:\n"
"%s"
msgstr ""

View File

@ -0,0 +1,68 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mass_mailing_unique
#
# Translators:
# Pedro Castro Silva <pedrocs@exo.pt>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-12-02 13:18+0000\n"
"PO-Revision-Date: 2017-12-02 13:18+0000\n"
"Last-Translator: Pedro Castro Silva <pedrocs@exo.pt>, 2017\n"
"Language-Team: Portuguese (https://www.transifex.com/oca/teams/23907/pt/)\n"
"Language: pt\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 ""
#. module: mass_mailing_unique
#: model:ir.model.fields,field_description:mass_mailing_unique.field_mailing_contact__display_name
#: model:ir.model.fields,field_description:mass_mailing_unique.field_mailing_list__display_name
msgid "Display Name"
msgstr ""
#. module: mass_mailing_unique
#: model:ir.model.fields,field_description:mass_mailing_unique.field_mailing_contact__id
#: model:ir.model.fields,field_description:mass_mailing_unique.field_mailing_list__id
msgid "ID"
msgstr ""
#. module: mass_mailing_unique
#: model:ir.model.fields,field_description:mass_mailing_unique.field_mailing_contact____last_update
#: model:ir.model.fields,field_description:mass_mailing_unique.field_mailing_list____last_update
msgid "Last Modified on"
msgstr ""
#. 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 ""
#. module: mass_mailing_unique
#: model:ir.model.constraint,message:mass_mailing_unique.constraint_mailing_contact_unique_email
msgid "There's already a contact with this email address"
msgstr ""
#. module: mass_mailing_unique
#: 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 "Contacto do email em massa"

View File

@ -0,0 +1,82 @@
# 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: 2017-01-04 03:40+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2017\n"
"Language-Team: Slovenian (https://www.transifex.com/oca/teams/23907/sl/)\n"
"Language: sl\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n"
"%100==4 ? 2 : 3);\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 "Imate lahko le en seznam z istim imenom."
#. module: mass_mailing_unique
#: model:ir.model.fields,field_description:mass_mailing_unique.field_mailing_contact__display_name
#: model:ir.model.fields,field_description:mass_mailing_unique.field_mailing_list__display_name
msgid "Display Name"
msgstr ""
#. module: mass_mailing_unique
#: model:ir.model.fields,field_description:mass_mailing_unique.field_mailing_contact__id
#: model:ir.model.fields,field_description:mass_mailing_unique.field_mailing_list__id
msgid "ID"
msgstr ""
#. module: mass_mailing_unique
#: model:ir.model.fields,field_description:mass_mailing_unique.field_mailing_contact____last_update
#: model:ir.model.fields,field_description:mass_mailing_unique.field_mailing_list____last_update
msgid "Last Modified on"
msgstr ""
#. 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 "Poštni seznam"
#. module: mass_mailing_unique
#: model:ir.model.constraint,message:mass_mailing_unique.constraint_mailing_contact_unique_email
msgid "There's already a contact with this email address"
msgstr ""
#. module: mass_mailing_unique
#: 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 "Stik masovne pošte"
#, fuzzy
#~ msgid "Cannot have the same email (%s) morethan once in the same list."
#~ msgstr "Isti e-poštni naslov imate lahko le enkrat v istem seznamu."
#~ msgid "Fix this before installing:"
#~ msgstr "Popravite pred namestitvijo:"
#~ msgid "There are {1} lists with name {0}."
#~ msgstr "{1} seznamov z imenom {0}."
#~ msgid "{0} appears {2} times in list {1}."
#~ msgstr "{0} se pojavi {2} krat v seznamu {1}."

View File

@ -0,0 +1,2 @@
from . import mailing_contact
from . import mailing_list

View File

@ -0,0 +1,17 @@
# Copyright 2018 Tecnativa - Ernesto Tejeda
# Copyright 2021 Camptocamp - Iván Todorovich
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import models
class MailingContact(models.Model):
_inherit = "mailing.contact"
_sql_constraints = [
(
"unique_email",
"UNIQUE(email_normalized)",
"There's already a contact with this email address",
)
]

View File

@ -0,0 +1,18 @@
# Copyright 2015 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis
# Copyright 2016 Tecnativa - Vicent Cubells
# Copyright 2021 Camptocamp - Iván Todorovich
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import models
class MailingList(models.Model):
_inherit = "mailing.list"
_sql_constraints = [
(
"unique_name",
"UNIQUE(name)",
"Cannot have more than one lists with the same name.",
)
]

View File

@ -0,0 +1,9 @@
* `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>

View File

@ -0,0 +1,5 @@
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.

View File

@ -0,0 +1,4 @@
Before installing this module, you need to:
* Remove all duplicated list names.
* Remove all duplicated emails in mailing contacts.

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

View File

@ -0,0 +1,447 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
<title>Unique records for mass mailing</title>
<style type="text/css">
/*
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/
/* used to remove borders from tables and images */
.borderless, table.borderless td, table.borderless th {
border: 0 }
table.borderless td, table.borderless th {
/* Override padding for "table.docutils td" with "! important".
The right padding separates the table cells. */
padding: 0 0.5em 0 0 ! important }
.first {
/* Override more specific margin styles with "! important". */
margin-top: 0 ! important }
.last, .with-subtitle {
margin-bottom: 0 ! important }
.hidden {
display: none }
.subscript {
vertical-align: sub;
font-size: smaller }
.superscript {
vertical-align: super;
font-size: smaller }
a.toc-backref {
text-decoration: none ;
color: black }
blockquote.epigraph {
margin: 2em 5em ; }
dl.docutils dd {
margin-bottom: 0.5em }
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
overflow: hidden;
}
/* Uncomment (and remove this text!) to get bold-faced definition list terms
dl.docutils dt {
font-weight: bold }
*/
div.abstract {
margin: 2em 5em }
div.abstract p.topic-title {
font-weight: bold ;
text-align: center }
div.admonition, div.attention, div.caution, div.danger, div.error,
div.hint, div.important, div.note, div.tip, div.warning {
margin: 2em ;
border: medium outset ;
padding: 1em }
div.admonition p.admonition-title, div.hint p.admonition-title,
div.important p.admonition-title, div.note p.admonition-title,
div.tip p.admonition-title {
font-weight: bold ;
font-family: sans-serif }
div.attention p.admonition-title, div.caution p.admonition-title,
div.danger p.admonition-title, div.error p.admonition-title,
div.warning p.admonition-title, .code .error {
color: red ;
font-weight: bold ;
font-family: sans-serif }
/* Uncomment (and remove this text!) to get reduced vertical space in
compound paragraphs.
div.compound .compound-first, div.compound .compound-middle {
margin-bottom: 0.5em }
div.compound .compound-last, div.compound .compound-middle {
margin-top: 0.5em }
*/
div.dedication {
margin: 2em 5em ;
text-align: center ;
font-style: italic }
div.dedication p.topic-title {
font-weight: bold ;
font-style: normal }
div.figure {
margin-left: 2em ;
margin-right: 2em }
div.footer, div.header {
clear: both;
font-size: smaller }
div.line-block {
display: block ;
margin-top: 1em ;
margin-bottom: 1em }
div.line-block div.line-block {
margin-top: 0 ;
margin-bottom: 0 ;
margin-left: 1.5em }
div.sidebar {
margin: 0 0 0.5em 1em ;
border: medium outset ;
padding: 1em ;
background-color: #ffffee ;
width: 40% ;
float: right ;
clear: right }
div.sidebar p.rubric {
font-family: sans-serif ;
font-size: medium }
div.system-messages {
margin: 5em }
div.system-messages h1 {
color: red }
div.system-message {
border: medium outset ;
padding: 1em }
div.system-message p.system-message-title {
color: red ;
font-weight: bold }
div.topic {
margin: 2em }
h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
margin-top: 0.4em }
h1.title {
text-align: center }
h2.subtitle {
text-align: center }
hr.docutils {
width: 75% }
img.align-left, .figure.align-left, object.align-left, table.align-left {
clear: left ;
float: left ;
margin-right: 1em }
img.align-right, .figure.align-right, object.align-right, table.align-right {
clear: right ;
float: right ;
margin-left: 1em }
img.align-center, .figure.align-center, object.align-center {
display: block;
margin-left: auto;
margin-right: auto;
}
table.align-center {
margin-left: auto;
margin-right: auto;
}
.align-left {
text-align: left }
.align-center {
clear: both ;
text-align: center }
.align-right {
text-align: right }
/* reset inner alignment in figures */
div.align-right {
text-align: inherit }
/* div.align-center * { */
/* text-align: left } */
.align-top {
vertical-align: top }
.align-middle {
vertical-align: middle }
.align-bottom {
vertical-align: bottom }
ol.simple, ul.simple {
margin-bottom: 1em }
ol.arabic {
list-style: decimal }
ol.loweralpha {
list-style: lower-alpha }
ol.upperalpha {
list-style: upper-alpha }
ol.lowerroman {
list-style: lower-roman }
ol.upperroman {
list-style: upper-roman }
p.attribution {
text-align: right ;
margin-left: 50% }
p.caption {
font-style: italic }
p.credits {
font-style: italic ;
font-size: smaller }
p.label {
white-space: nowrap }
p.rubric {
font-weight: bold ;
font-size: larger ;
color: maroon ;
text-align: center }
p.sidebar-title {
font-family: sans-serif ;
font-weight: bold ;
font-size: larger }
p.sidebar-subtitle {
font-family: sans-serif ;
font-weight: bold }
p.topic-title {
font-weight: bold }
pre.address {
margin-bottom: 0 ;
margin-top: 0 ;
font: inherit }
pre.literal-block, pre.doctest-block, pre.math, pre.code {
margin-left: 2em ;
margin-right: 2em }
pre.code .ln { color: grey; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
pre.code .literal.string, code .literal.string { color: #0C5404 }
pre.code .name.builtin, code .name.builtin { color: #352B84 }
pre.code .deleted, code .deleted { background-color: #DEB0A1}
pre.code .inserted, code .inserted { background-color: #A3D289}
span.classifier {
font-family: sans-serif ;
font-style: oblique }
span.classifier-delimiter {
font-family: sans-serif ;
font-weight: bold }
span.interpreted {
font-family: sans-serif }
span.option {
white-space: nowrap }
span.pre {
white-space: pre }
span.problematic {
color: red }
span.section-subtitle {
/* font-size relative to parent (h1..h6 element) */
font-size: 80% }
table.citation {
border-left: solid 1px gray;
margin-left: 1px }
table.docinfo {
margin: 2em 4em }
table.docutils {
margin-top: 0.5em ;
margin-bottom: 0.5em }
table.footnote {
border-left: solid 1px black;
margin-left: 1px }
table.docutils td, table.docutils th,
table.docinfo td, table.docinfo th {
padding-left: 0.5em ;
padding-right: 0.5em ;
vertical-align: top }
table.docutils th.field-name, table.docinfo th.docinfo-name {
font-weight: bold ;
text-align: left ;
white-space: nowrap ;
padding-left: 0 }
/* "booktabs" style (no vertical lines) */
table.docutils.booktabs {
border: 0px;
border-top: 2px solid;
border-bottom: 2px solid;
border-collapse: collapse;
}
table.docutils.booktabs * {
border: 0px;
}
table.docutils.booktabs th {
border-bottom: thin solid;
text-align: left;
}
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
font-size: 100% }
ul.auto-toc {
list-style-type: none }
</style>
</head>
<body>
<div class="document" id="unique-records-for-mass-mailing">
<h1 class="title">Unique records for mass mailing</h1>
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:f5940baf01ac9e97a9657f3d32ee223ed89599e4ddb03a316dc72aa39b7d3d91
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/social/tree/16.0/mass_mailing_unique"><img alt="OCA/social" src="https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/social-16-0/social-16-0-mass_mailing_unique"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/social&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module extends the functionality of mass mailing lists to disable
duplicate entries in list names and contact emails.</p>
<p>This way you will avoid conflicts when importing contacts to a list that has a
duplicated name.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#installation" id="toc-entry-1">Installation</a></li>
<li><a class="reference internal" href="#bug-tracker" id="toc-entry-2">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="toc-entry-3">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="toc-entry-4">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="toc-entry-5">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="toc-entry-6">Maintainers</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="installation">
<h1><a class="toc-backref" href="#toc-entry-1">Installation</a></h1>
<p>Before installing this module, you need to:</p>
<ul class="simple">
<li>Remove all duplicated list names.</li>
<li>Remove all duplicated emails in mailing contacts.</li>
</ul>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#toc-entry-2">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/social/issues">GitHub Issues</a>.
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
<a class="reference external" href="https://github.com/OCA/social/issues/new?body=module:%20mass_mailing_unique%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
<h1><a class="toc-backref" href="#toc-entry-3">Credits</a></h1>
<div class="section" id="authors">
<h2><a class="toc-backref" href="#toc-entry-4">Authors</a></h2>
<ul class="simple">
<li>Tecnativa</li>
</ul>
</div>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#toc-entry-5">Contributors</a></h2>
<ul>
<li><p class="first"><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:</p>
<ul class="simple">
<li>Jairo Llopis</li>
<li>Vicent Cubells</li>
<li>Pedro M. Baeza</li>
<li>Ernesto Tejeda</li>
</ul>
</li>
<li><p class="first"><a class="reference external" href="https://www.camptocamp.com">Camptocamp</a></p>
<blockquote>
<ul class="simple">
<li>Iván Todorovich &lt;<a class="reference external" href="mailto:ivan.todorovich&#64;gmail.com">ivan.todorovich&#64;gmail.com</a>&gt;</li>
</ul>
</blockquote>
</li>
</ul>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<p>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.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/social/tree/16.0/mass_mailing_unique">OCA/social</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,3 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import test_mass_mailing_unique

View File

@ -0,0 +1,110 @@
# Copyright 2016 Tecnativa - Pedro M. Baeza
# Copyright 2021 Camptocamp - Iván Todorovich
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from psycopg2 import IntegrityError
from odoo.exceptions import ValidationError
from odoo.tests import common
from odoo.tools import mute_logger
from ..hooks import pre_init_hook
class TestMassMailingUnique(common.SavepointCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.mailing_list = cls.env.ref("mass_mailing.mailing_list_data")
cls.mailing_contact = cls.env["mailing.contact"].create(
{
"name": "John Doe",
"email": "john.doe@example.com",
"list_ids": [(6, 0, cls.mailing_list.ids)],
}
)
def test_init_hook_list_mailing_list(self):
# Disable temporarily the constraint
self.env.cr.execute(
"""
ALTER TABLE mailing_list
DROP CONSTRAINT mailing_list_unique_name
"""
)
# Create another list with the same exact name
self.env["mailing.list"].create({"name": self.mailing_list.name})
self.env["mailing.list"].flush()
with self.assertRaises(ValidationError):
pre_init_hook(self.env.cr)
def test_init_hook_list_mailing_contact(self):
# Disable temporarily the constraint
self.env.cr.execute(
"""
ALTER TABLE mailing_contact
DROP CONSTRAINT mailing_contact_unique_email
"""
)
# Create another list with the same exact name
self.env["mailing.contact"].create(
{
"name": f"{self.mailing_contact.name} (2)",
"email": self.mailing_contact.email,
}
)
self.env["mailing.contact"].flush_model()
with self.assertRaises(ValidationError):
pre_init_hook(self.env.cr)
def test_mailing_contact_unique_email_exact(self):
"""Create a contact with the same exact email"""
with mute_logger("odoo.sql_db"):
with self.assertRaisesRegex(IntegrityError, "mailing_contact_unique_email"):
self.env["mailing.contact"].create(
{
"name": "John Doe (2)",
"email": "john.doe@example.com",
}
)
self.env["mailing.contact"].flush_model()
def test_mailing_contact_unique_email_same(self):
"""Create a contact with the same email (not exact though)"""
with mute_logger("odoo.sql_db"):
with self.assertRaisesRegex(IntegrityError, "mailing_contact_unique_email"):
self.env["mailing.contact"].create(
{
"name": "John Doe (2)",
"email": "<John Doe> John.DOE@example.com",
}
)
self.env["mailing.contact"].flush_model()
def test_mailing_contact_unique_email_ok(self):
"""Create a contact with another email"""
self.env["mailing.contact"].create(
{
"name": "Jane Doe",
"email": "jane.doe@example.com",
}
)
def test_mailing_list_unique_name_duplicated(self):
"""Create a mailing list with the same name"""
with mute_logger("odoo.sql_db"):
with self.assertRaisesRegex(IntegrityError, "mailing_list_unique_name"):
self.env["mailing.list"].create(
{
"name": self.mailing_list.name,
}
)
self.env["mailing.list"].flush_model()
def test_mailing_list_unique_name_ok(self):
"""Create a mailing list with another name"""
self.env["mailing.list"].create(
{
"name": "Another mailing list",
}
)

View File

@ -0,0 +1 @@
../../../../mass_mailing_unique

View File

@ -0,0 +1,6 @@
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)