mirror of https://github.com/OCA/social.git
[MIG] mass_mailing_unique: Migration to 14.0.
parent
57478fa670
commit
8a5c52ee47
|
@ -2,10 +2,13 @@
|
|||
Unique records for mass mailing
|
||||
===============================
|
||||
|
||||
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
..
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! This file is generated by oca-gen-addon-readme !!
|
||||
!! changes will be overwritten. !!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! source digest: sha256:e10a616a0dd5c95c537e32644c23a440c452a691bc4268b3c2ea6d7d18b5f012
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
|
||||
:target: https://odoo-community.org/page/development-status
|
||||
|
@ -14,19 +17,19 @@ Unique records for mass mailing
|
|||
: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
|
||||
:target: https://github.com/OCA/social/tree/14.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
|
||||
:target: https://translation.odoo-community.org/projects/social-14-0/social-14-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
|
||||
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
|
||||
:target: https://runboat.odoo-community.org/builds?repo=OCA/social&target_branch=14.0
|
||||
:alt: Try me on Runboat
|
||||
|
||||
|badge1| |badge2| |badge3| |badge4| |badge5|
|
||||
|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.
|
||||
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.
|
||||
|
@ -42,21 +45,15 @@ 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.
|
||||
* 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 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**>`_.
|
||||
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:%2014.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.
|
||||
|
||||
|
@ -77,6 +74,9 @@ Contributors
|
|||
* Vicent Cubells
|
||||
* Pedro M. Baeza
|
||||
* Ernesto Tejeda
|
||||
* `Camptocamp <https://www.camptocamp.com>`_
|
||||
|
||||
* Iván Todorovich <ivan.todorovich@gmail.com>
|
||||
|
||||
Maintainers
|
||||
~~~~~~~~~~~
|
||||
|
@ -91,6 +91,6 @@ 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.
|
||||
This module is part of the `OCA/social <https://github.com/OCA/social/tree/14.0/mass_mailing_unique>`_ project on GitHub.
|
||||
|
||||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
||||
|
|
|
@ -6,20 +6,11 @@
|
|||
{
|
||||
"name": "Unique records for mass mailing",
|
||||
"summary": "Avoids duplicate mailing lists and contacts",
|
||||
"version": "12.0.1.0.2",
|
||||
"version": "14.0.1.0.0",
|
||||
"category": "Marketing",
|
||||
"website": "https://github.com/OCA/social",
|
||||
"author": "Tecnativa, "
|
||||
"Odoo Community Association (OCA)",
|
||||
"author": "Tecnativa, Odoo Community Association (OCA)",
|
||||
"license": "AGPL-3",
|
||||
"application": False,
|
||||
"installable": True,
|
||||
"depends": ["mass_mailing"],
|
||||
"pre_init_hook": "pre_init_hook",
|
||||
"images": [
|
||||
"images/error-duplicated-email.png",
|
||||
"images/error-duplicated-list.png",
|
||||
],
|
||||
"depends": [
|
||||
"mass_mailing",
|
||||
],
|
||||
}
|
||||
|
|
|
@ -2,41 +2,47 @@
|
|||
# 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 a unique key in Odoo that cannot be applied, Odoo will log a
|
||||
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 LOWER(c.email) AS e, l.name, COUNT(c.id)
|
||||
FROM
|
||||
mail_mass_mailing_contact AS c
|
||||
INNER JOIN mail_mass_mailing_contact_list_rel AS cl
|
||||
ON cl.contact_id = c.id
|
||||
INNER JOIN mail_mass_mailing_list AS l ON cl.list_id = l.id
|
||||
GROUP BY l.name, e
|
||||
HAVING COUNT(c.id) > 1""")
|
||||
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("{0} appears {2} times in list {1}.".format(*result))
|
||||
|
||||
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)
|
||||
FROM mail_mass_mailing_list
|
||||
GROUP BY name
|
||||
HAVING COUNT(id) > 1""")
|
||||
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} lists with name {0}.".format(*result))
|
||||
|
||||
errors.append(
|
||||
"There are {1} mailing lists with the same name: {0}.".format(*result)
|
||||
)
|
||||
# Abort if duplicates are found
|
||||
if errors:
|
||||
raise ValidationError(
|
||||
"Fix this before installing:" + "".join("\n" + e for e in errors))
|
||||
_("Unable to install module mass_mailing_unique:\n%s", "\n".join(errors))
|
||||
)
|
||||
|
|
|
@ -19,36 +19,54 @@ msgstr ""
|
|||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
#. module: mass_mailing_unique
|
||||
#: sql_constraint:mail.mass_mailing.list:0
|
||||
#: 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
|
||||
#: 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."
|
||||
#: 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,name:mass_mailing_unique.model_mail_mass_mailing_list
|
||||
#: 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,name:mass_mailing_unique.model_mail_mass_mailing_contact
|
||||
msgid "Mass Mailing Contact"
|
||||
msgstr "Contactes del correu massiu"
|
||||
#: 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
|
||||
#: model:ir.model,name:mass_mailing_unique.model_mail_mass_mailing_list_contact_rel
|
||||
msgid "Mass Mailing Subscription Information"
|
||||
#: 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 ""
|
||||
|
|
|
@ -19,36 +19,54 @@ msgstr ""
|
|||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
#. module: mass_mailing_unique
|
||||
#: sql_constraint:mail.mass_mailing.list:0
|
||||
#: 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
|
||||
#: 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."
|
||||
#: 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,name:mass_mailing_unique.model_mail_mass_mailing_list
|
||||
#: 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,name:mass_mailing_unique.model_mail_mass_mailing_contact
|
||||
msgid "Mass Mailing Contact"
|
||||
msgstr "Massenmail-Kontakt"
|
||||
#: 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
|
||||
#: model:ir.model,name:mass_mailing_unique.model_mail_mass_mailing_list_contact_rel
|
||||
msgid "Mass Mailing Subscription Information"
|
||||
#: 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 ""
|
||||
|
|
|
@ -19,36 +19,54 @@ msgstr ""
|
|||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
#. module: mass_mailing_unique
|
||||
#: sql_constraint:mail.mass_mailing.list:0
|
||||
#: 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
|
||||
#: 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."
|
||||
#: 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,name:mass_mailing_unique.model_mail_mass_mailing_list
|
||||
#: 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,name:mass_mailing_unique.model_mail_mass_mailing_contact
|
||||
msgid "Mass Mailing Contact"
|
||||
msgstr "Contacto de envío masivo"
|
||||
#: 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
|
||||
#: model:ir.model,name:mass_mailing_unique.model_mail_mass_mailing_list_contact_rel
|
||||
msgid "Mass Mailing Subscription Information"
|
||||
#: 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."
|
||||
|
|
|
@ -20,40 +20,70 @@ msgstr ""
|
|||
"X-Generator: Weblate 4.3.2\n"
|
||||
|
||||
#. module: mass_mailing_unique
|
||||
#: sql_constraint:mail.mass_mailing.list:0
|
||||
#: 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
|
||||
#: 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."
|
||||
#: 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 ""
|
||||
"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."
|
||||
|
||||
#. module: mass_mailing_unique
|
||||
#: model:ir.model,name:mass_mailing_unique.model_mail_mass_mailing_list
|
||||
#: 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,name:mass_mailing_unique.model_mail_mass_mailing_contact
|
||||
msgid "Mass Mailing Contact"
|
||||
msgstr "Contact de la liste de diffusion"
|
||||
#: 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
|
||||
#: model:ir.model,name:mass_mailing_unique.model_mail_mass_mailing_list_contact_rel
|
||||
msgid "Mass Mailing Subscription Information"
|
||||
msgstr "Information d'Abonnement au Publipostage"
|
||||
#: 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."
|
||||
|
|
|
@ -21,36 +21,54 @@ msgstr ""
|
|||
"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
|
||||
|
||||
#. module: mass_mailing_unique
|
||||
#: sql_constraint:mail.mass_mailing.list:0
|
||||
#: 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
|
||||
#: 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."
|
||||
#: 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,name:mass_mailing_unique.model_mail_mass_mailing_list
|
||||
#: 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,name:mass_mailing_unique.model_mail_mass_mailing_contact
|
||||
msgid "Mass Mailing Contact"
|
||||
msgstr "Kontakti za masovno slanje"
|
||||
#: 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
|
||||
#: model:ir.model,name:mass_mailing_unique.model_mail_mass_mailing_list_contact_rel
|
||||
msgid "Mass Mailing Subscription Information"
|
||||
#: 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."
|
||||
|
|
|
@ -9,45 +9,81 @@ 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"
|
||||
"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"
|
||||
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
||||
"X-Generator: Weblate 4.17\n"
|
||||
|
||||
#. module: mass_mailing_unique
|
||||
#: sql_constraint:mail.mass_mailing.list:0
|
||||
#: 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
|
||||
#: code:addons/mass_mailing_unique/models/mail_mass_mailing_contact.py:24
|
||||
#: 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 ""
|
||||
"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."
|
||||
"Unable to install module mass_mailing_unique:\n"
|
||||
"%s"
|
||||
msgstr ""
|
||||
|
||||
#. module: mass_mailing_unique
|
||||
#: model:ir.model,name:mass_mailing_unique.model_mail_mass_mailing_list
|
||||
msgid "Mailing List"
|
||||
msgstr "Mailing List"
|
||||
#, 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."
|
||||
|
||||
#. module: mass_mailing_unique
|
||||
#: model:ir.model,name:mass_mailing_unique.model_mail_mass_mailing_contact
|
||||
msgid "Mass Mailing Contact"
|
||||
msgstr "Contatto Mass Mailing"
|
||||
#~ msgid "Mass Mailing Contact"
|
||||
#~ msgstr "Contatto Mass Mailing"
|
||||
|
||||
#. module: mass_mailing_unique
|
||||
#: model:ir.model,name:mass_mailing_unique.model_mail_mass_mailing_list_contact_rel
|
||||
msgid "Mass Mailing Subscription Information"
|
||||
msgstr ""
|
||||
#~ 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."
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * mass_mailing_unique
|
||||
# * mass_mailing_unique
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 12.0\n"
|
||||
"Project-Id-Version: Odoo Server 14.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"Last-Translator: <>\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
|
@ -14,30 +14,47 @@ msgstr ""
|
|||
"Plural-Forms: \n"
|
||||
|
||||
#. module: mass_mailing_unique
|
||||
#: sql_constraint:mail.mass_mailing.list:0
|
||||
#: 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
|
||||
#: 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."
|
||||
#: 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,name:mass_mailing_unique.model_mail_mass_mailing_list
|
||||
#: 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,name:mass_mailing_unique.model_mail_mass_mailing_contact
|
||||
msgid "Mass Mailing Contact"
|
||||
#: 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
|
||||
#: model:ir.model,name:mass_mailing_unique.model_mail_mass_mailing_list_contact_rel
|
||||
msgid "Mass Mailing Subscription Information"
|
||||
#: code:addons/mass_mailing_unique/hooks.py:0
|
||||
#, python-format
|
||||
msgid ""
|
||||
"Unable to install module mass_mailing_unique:\n"
|
||||
"%s"
|
||||
msgstr ""
|
||||
|
||||
|
|
|
@ -19,32 +19,50 @@ msgstr ""
|
|||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
#. module: mass_mailing_unique
|
||||
#: sql_constraint:mail.mass_mailing.list:0
|
||||
#: 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
|
||||
#: 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."
|
||||
#: 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,name:mass_mailing_unique.model_mail_mass_mailing_list
|
||||
#: 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,name:mass_mailing_unique.model_mail_mass_mailing_contact
|
||||
msgid "Mass Mailing Contact"
|
||||
msgstr "Contacto do email em massa"
|
||||
#: 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
|
||||
#: model:ir.model,name:mass_mailing_unique.model_mail_mass_mailing_list_contact_rel
|
||||
msgid "Mass Mailing Subscription Information"
|
||||
#: 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"
|
||||
|
|
|
@ -20,36 +20,54 @@ msgstr ""
|
|||
"%100==4 ? 2 : 3);\n"
|
||||
|
||||
#. module: mass_mailing_unique
|
||||
#: sql_constraint:mail.mass_mailing.list:0
|
||||
#: 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
|
||||
#: 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."
|
||||
#: 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,name:mass_mailing_unique.model_mail_mass_mailing_list
|
||||
#: 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,name:mass_mailing_unique.model_mail_mass_mailing_contact
|
||||
msgid "Mass Mailing Contact"
|
||||
msgstr "Stik masovne pošte"
|
||||
#: 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
|
||||
#: model:ir.model,name:mass_mailing_unique.model_mail_mass_mailing_list_contact_rel
|
||||
msgid "Mass Mailing Subscription Information"
|
||||
#: 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."
|
||||
|
|
|
@ -1,8 +1,2 @@
|
|||
# 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 mail_mass_mailing_contact
|
||||
from . import mail_mass_mailing_list
|
||||
from . import mail_mass_mailing_list_contact_rel
|
||||
from . import mass_mailing
|
||||
from . import mailing_contact
|
||||
from . import mailing_list
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
# Copyright 2018 Tecnativa - Ernesto Tejeda
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from odoo import _, api, models
|
||||
from odoo.exceptions import ValidationError
|
||||
|
||||
|
||||
class MailMassMailingContact(models.Model):
|
||||
_inherit = 'mail.mass_mailing.contact'
|
||||
|
||||
@api.constrains('email', 'list_ids')
|
||||
def _check_email_list_ids(self):
|
||||
for contact in self:
|
||||
lists = contact.subscription_list_ids.mapped('list_id')
|
||||
lists |= contact.list_ids
|
||||
others = lists.mapped('contact_ids') - contact
|
||||
|
||||
contact_email = contact.email.strip().lower()
|
||||
other_emails = [e.strip().lower() for e in others.mapped('email')]
|
||||
if contact_email in other_emails:
|
||||
in_list = others.filtered(lambda o: o.email == contact_email) \
|
||||
.list_ids.mapped('name')
|
||||
lists = ''.join(map(lambda l: '- {}\n'.format(l), in_list))
|
||||
msg = _('''Email (%(contact_email)s) already in mailing list(s):
|
||||
%(lists)s
|
||||
Please use a different email address or remove \
|
||||
(%(contact_email)s) from the mailing list(s) above.''')
|
||||
raise ValidationError(msg % {
|
||||
'contact_email': contact_email,
|
||||
'lists': lists,
|
||||
})
|
|
@ -1,12 +0,0 @@
|
|||
# Copyright 2018 Tecnativa - Ernesto Tejeda
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from odoo import api, models
|
||||
|
||||
|
||||
class MailMassMailingList(models.Model):
|
||||
_inherit = 'mail.mass_mailing.list'
|
||||
|
||||
@api.constrains('contact_ids')
|
||||
def _check_contact_ids_email(self):
|
||||
self.mapped("contact_ids")._check_email_list_ids()
|
|
@ -1,12 +0,0 @@
|
|||
# Copyright 2018 Tecnativa - Ernesto Tejeda
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from odoo import api, models
|
||||
|
||||
|
||||
class MailMassMailingContactListRel(models.Model):
|
||||
_inherit = 'mail.mass_mailing.list_contact_rel'
|
||||
|
||||
@api.constrains('contact_id', 'list_id')
|
||||
def _check_contact_id_partner_id_list_id(self):
|
||||
self.mapped("contact_id")._check_email_list_ids()
|
|
@ -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",
|
||||
)
|
||||
]
|
|
@ -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.",
|
||||
)
|
||||
]
|
|
@ -1,14 +0,0 @@
|
|||
# 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 models
|
||||
|
||||
|
||||
class MailMassMailingList(models.Model):
|
||||
_inherit = "mail.mass_mailing.list"
|
||||
|
||||
_sql_constraints = [
|
||||
("unique_name", "UNIQUE(name)",
|
||||
"Cannot have more than one lists with the same name.")
|
||||
]
|
|
@ -4,3 +4,6 @@
|
|||
* Vicent Cubells
|
||||
* Pedro M. Baeza
|
||||
* Ernesto Tejeda
|
||||
* `Camptocamp <https://www.camptocamp.com>`_
|
||||
|
||||
* Iván Todorovich <ivan.todorovich@gmail.com>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
This module extends the functionality of mass mailing lists to disable
|
||||
duplicate entries in list names and contact emails per list.
|
||||
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.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Before installing this module, you need to:
|
||||
|
||||
* Remove all duplicated list names.
|
||||
* Remove all duplicated emails in each list.
|
||||
* Remove all duplicated emails in mailing contacts.
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
To use this module, you need to try to create a duplicated mailing list, or a
|
||||
duplicated email inside one. You will not can.
|
|
@ -1,20 +1,20 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<?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 0.15.1: http://docutils.sourceforge.net/" />
|
||||
<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 7952 2016-07-26 18:15:59Z milde $
|
||||
: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 http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
|
||||
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
|
||||
customize this style sheet.
|
||||
*/
|
||||
|
||||
|
@ -366,75 +366,79 @@ ul.auto-toc {
|
|||
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! This file is generated by oca-gen-addon-readme !!
|
||||
!! changes will be overwritten. !!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! source digest: sha256:e10a616a0dd5c95c537e32644c23a440c452a691bc4268b3c2ea6d7d18b5f012
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||||
<p><a class="reference external" 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" 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" href="https://github.com/OCA/social/tree/12.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" href="https://translation.odoo-community.org/projects/social-12-0/social-12-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" href="https://runbot.odoo-community.org/runbot/205/12.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
|
||||
<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/14.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-14-0/social-14-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&target_branch=14.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 per list.</p>
|
||||
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="id1">Installation</a></li>
|
||||
<li><a class="reference internal" href="#usage" id="id2">Usage</a></li>
|
||||
<li><a class="reference internal" href="#bug-tracker" id="id3">Bug Tracker</a></li>
|
||||
<li><a class="reference internal" href="#credits" id="id4">Credits</a><ul>
|
||||
<li><a class="reference internal" href="#authors" id="id5">Authors</a></li>
|
||||
<li><a class="reference internal" href="#contributors" id="id6">Contributors</a></li>
|
||||
<li><a class="reference internal" href="#maintainers" id="id7">Maintainers</a></li>
|
||||
<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="#id1">Installation</a></h1>
|
||||
<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 each list.</li>
|
||||
<li>Remove all duplicated emails in mailing contacts.</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="usage">
|
||||
<h1><a class="toc-backref" href="#id2">Usage</a></h1>
|
||||
<p>To use this module, you need to try to create a duplicated mailing list, or a
|
||||
duplicated email inside one. You will not can.</p>
|
||||
</div>
|
||||
<div class="section" id="bug-tracker">
|
||||
<h1><a class="toc-backref" href="#id3">Bug Tracker</a></h1>
|
||||
<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 smashing 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:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
|
||||
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:%2014.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="#id4">Credits</a></h1>
|
||||
<h1><a class="toc-backref" href="#toc-entry-3">Credits</a></h1>
|
||||
<div class="section" id="authors">
|
||||
<h2><a class="toc-backref" href="#id5">Authors</a></h2>
|
||||
<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="#id6">Contributors</a></h2>
|
||||
<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><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:<ul>
|
||||
<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 <<a class="reference external" href="mailto:ivan.todorovich@gmail.com">ivan.todorovich@gmail.com</a>></li>
|
||||
</ul>
|
||||
</blockquote>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="maintainers">
|
||||
<h2><a class="toc-backref" href="#id7">Maintainers</a></h2>
|
||||
<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/12.0/mass_mailing_unique">OCA/social</a> project on GitHub.</p>
|
||||
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/social/tree/14.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>
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 41 KiB |
Binary file not shown.
Before Width: | Height: | Size: 36 KiB |
|
@ -1,8 +1,12 @@
|
|||
# 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 import exceptions
|
||||
from odoo.tools import mute_logger
|
||||
|
||||
from ..hooks import pre_init_hook
|
||||
|
||||
|
@ -10,78 +14,97 @@ from ..hooks import pre_init_hook
|
|||
class TestMassMailingUnique(common.SavepointCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super(TestMassMailingUnique, cls).setUpClass()
|
||||
cls.list = cls.env['mail.mass_mailing.list'].create({
|
||||
'name': 'Test list',
|
||||
})
|
||||
cls.contact1 = cls.env['mail.mass_mailing.contact'].create({
|
||||
'name': 'Contact 1',
|
||||
'email': 'email1@test.com',
|
||||
'list_ids': [(6, 0, [cls.list.id])]
|
||||
})
|
||||
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(self):
|
||||
def test_init_hook_list_mailing_list(self):
|
||||
# Disable temporarily the constraint
|
||||
self.env.cr.execute("""
|
||||
ALTER TABLE mail_mass_mailing_list
|
||||
DROP CONSTRAINT mail_mass_mailing_list_unique_name
|
||||
""")
|
||||
self.env['mail.mass_mailing.list'].create({
|
||||
'name': 'Test list',
|
||||
})
|
||||
with self.assertRaises(exceptions.ValidationError):
|
||||
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_add_contact_with_list(self):
|
||||
with self.assertRaises(exceptions.ValidationError):
|
||||
self.env['mail.mass_mailing.contact'].create({
|
||||
'name': 'Contact 2',
|
||||
'email': 'email1@test.com',
|
||||
'list_ids': [(6, 0, [self.list.id])]
|
||||
})
|
||||
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()
|
||||
with self.assertRaises(ValidationError):
|
||||
pre_init_hook(self.env.cr)
|
||||
|
||||
def test_add_contact_with_subscription(self):
|
||||
with self.assertRaises(exceptions.ValidationError):
|
||||
self.env['mail.mass_mailing.contact'].create({
|
||||
'name': 'Contact 2',
|
||||
'email': 'email1@test.com',
|
||||
'subscription_list_ids': [
|
||||
(0, 0, {'list_id': self.list.id})
|
||||
]
|
||||
})
|
||||
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()
|
||||
|
||||
def test_add_list_with_contacts(self):
|
||||
contact2 = self.env['mail.mass_mailing.contact'].create({
|
||||
'name': 'Contact 2',
|
||||
'email': 'email1@test.com',
|
||||
})
|
||||
with self.assertRaises(exceptions.ValidationError):
|
||||
self.env['mail.mass_mailing.list'].create({
|
||||
'name': 'Test list 2',
|
||||
'contact_ids': [(6, 0, (self.contact1 | contact2).ids)]
|
||||
})
|
||||
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()
|
||||
|
||||
def test_add_list_with_subscriptions(self):
|
||||
contact2 = self.env['mail.mass_mailing.contact'].create({
|
||||
'name': 'Contact 2',
|
||||
'email': 'email1@test.com',
|
||||
})
|
||||
with self.assertRaises(exceptions.ValidationError):
|
||||
self.env['mail.mass_mailing.list'].create({
|
||||
'name': 'Test list 2',
|
||||
'subscription_contact_ids': [
|
||||
(0, 0, {'contact_id': self.contact1.id}),
|
||||
(0, 0, {'contact_id': contact2.id})
|
||||
]
|
||||
})
|
||||
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_add_list_contact_rel(self):
|
||||
contact2 = self.env['mail.mass_mailing.contact'].create({
|
||||
'name': 'Contact 2',
|
||||
'email': 'email1@test.com',
|
||||
})
|
||||
with self.assertRaises(exceptions.ValidationError):
|
||||
self.env['mail.mass_mailing.list_contact_rel'].create({
|
||||
'list_id': self.list.id,
|
||||
'contact_id': contact2.id
|
||||
})
|
||||
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()
|
||||
|
||||
def test_mailing_list_unique_name_ok(self):
|
||||
"""Create a mailing list with another name"""
|
||||
self.env["mailing.list"].create(
|
||||
{
|
||||
"name": "Another mailing list",
|
||||
}
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue