[MIG] mass_mailing_custom_unsubscribe: Migration to v13.0
This commit is contained in:
parent
844c382fe7
commit
fc38567fb2
@ -14,13 +14,13 @@ Customizable unsubscription process on mass mailing emails
|
||||
: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_custom_unsubscribe
|
||||
:target: https://github.com/OCA/social/tree/13.0/mass_mailing_custom_unsubscribe
|
||||
: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_custom_unsubscribe
|
||||
:target: https://translation.odoo-community.org/projects/social-13-0/social-13-0-mass_mailing_custom_unsubscribe
|
||||
: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
|
||||
:target: https://runbot.odoo-community.org/runbot/205/13.0
|
||||
:alt: Try me on Runbot
|
||||
|
||||
|badge1| |badge2| |badge3| |badge4| |badge5|
|
||||
@ -88,7 +88,7 @@ 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_custom_unsubscribe%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
||||
`feedback <https://github.com/OCA/social/issues/new?body=module:%20mass_mailing_custom_unsubscribe%0Aversion:%2013.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.
|
||||
|
||||
@ -111,6 +111,7 @@ Contributors
|
||||
* David Vidal
|
||||
* Ernesto Tejeda
|
||||
* Pedro M. Baeza
|
||||
* Carlos Roca
|
||||
|
||||
Maintainers
|
||||
~~~~~~~~~~~
|
||||
@ -125,6 +126,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_custom_unsubscribe>`_ project on GitHub.
|
||||
This module is part of the `OCA/social <https://github.com/OCA/social/tree/13.0/mass_mailing_custom_unsubscribe>`_ project on GitHub.
|
||||
|
||||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
||||
|
@ -6,7 +6,7 @@
|
||||
"name": "Customizable unsubscription process on mass mailing emails",
|
||||
"summary": "Know and track (un)subscription reasons, GDPR compliant",
|
||||
"category": "Marketing",
|
||||
"version": "12.0.1.0.2",
|
||||
"version": "13.0.1.0.0",
|
||||
"depends": ["mass_mailing"],
|
||||
"data": [
|
||||
"security/ir.model.access.csv",
|
||||
|
@ -16,7 +16,7 @@ class CustomUnsubscribe(MassMailController):
|
||||
def reason_form(self, mailing_id, email, res_id, reasons, token):
|
||||
"""Get the unsubscription reason form.
|
||||
|
||||
:param mail.mass_mailing mailing:
|
||||
:param mailing.mailing mailing:
|
||||
Mailing where the unsubscription is being processed.
|
||||
|
||||
:param str email:
|
||||
@ -46,6 +46,8 @@ class CustomUnsubscribe(MassMailController):
|
||||
"Called `mailing()` with: %r", (mailing_id, email, res_id, token, post)
|
||||
)
|
||||
reasons = request.env["mail.unsubscription.reason"].search([])
|
||||
if not res_id:
|
||||
res_id = "0"
|
||||
res_id = res_id and int(res_id)
|
||||
try:
|
||||
# Check if we already have a reason for unsubscription
|
||||
@ -57,13 +59,10 @@ class CustomUnsubscribe(MassMailController):
|
||||
# Unsubscribe, saving reason and details by context
|
||||
details = post.get("details", False)
|
||||
self._add_extra_context(mailing_id, res_id, reason_id, details)
|
||||
mailing_obj = request.env["mail.mass_mailing"]
|
||||
mailing_obj = request.env["mailing.mailing"]
|
||||
mass_mailing = mailing_obj.sudo().browse(mailing_id)
|
||||
model = mass_mailing.mailing_model_real
|
||||
if (
|
||||
"opt_out" in request.env[model]._fields
|
||||
and model != "mail.mass_mailing.contact"
|
||||
):
|
||||
if "opt_out" in request.env[model]._fields and model != "mailing.contact":
|
||||
mass_mailing.update_opt_out_other(email, [res_id], True)
|
||||
result = request.render(
|
||||
"mass_mailing.page_unsubscribed",
|
||||
@ -81,7 +80,7 @@ class CustomUnsubscribe(MassMailController):
|
||||
# You could get a DetailsRequiredError here, but only if HTML5
|
||||
# validation fails, which should not happen in modern browsers
|
||||
result = super().mailing(mailing_id, email, res_id, token=token, **post)
|
||||
if model == "mail.mass_mailing.contact":
|
||||
if model == "mailing.contact":
|
||||
# update list_ids taking into account
|
||||
# not_cross_unsubscriptable field
|
||||
result.qcontext.update(
|
||||
|
@ -18,7 +18,8 @@
|
||||
<template id="mass_mailing_custom_unsubscribe.layout"
|
||||
inherit_id="mass_mailing.layout">
|
||||
<xpath expr="//t[@t-set='head']" position="inside">
|
||||
<t t-call="web.assets_frontend"/>
|
||||
<t t-call-assets="web_editor.assets_wysiwyg"/>
|
||||
<t t-call-assets="web.assets_frontend"/>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
|
@ -4,9 +4,9 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 12.0\n"
|
||||
"Project-Id-Version: Odoo Server 13.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"
|
||||
@ -42,27 +42,22 @@ msgstr ""
|
||||
msgid "Action Needed"
|
||||
msgstr ""
|
||||
|
||||
#. module: mass_mailing_custom_unsubscribe
|
||||
#: model:ir.model.fields,field_description:mass_mailing_custom_unsubscribe.field_mail_unsubscription__allow_private
|
||||
msgid "Allow Private"
|
||||
msgstr ""
|
||||
|
||||
#. module: mass_mailing_custom_unsubscribe
|
||||
#. openerp-web
|
||||
#: code:addons/mass_mailing_custom_unsubscribe/static/src/js/unsubscribe.js:89
|
||||
#: code:addons/mass_mailing_custom_unsubscribe/static/src/js/unsubscribe.js:94
|
||||
#: code:addons/mass_mailing_custom_unsubscribe/static/src/js/unsubscribe.js:221
|
||||
#: code:addons/mass_mailing_custom_unsubscribe/static/src/js/unsubscribe.js:230
|
||||
#: code:addons/mass_mailing_custom_unsubscribe/static/src/js/unsubscribe.js:260
|
||||
#: code:addons/mass_mailing_custom_unsubscribe/static/src/js/unsubscribe.js:270
|
||||
#: code:addons/mass_mailing_custom_unsubscribe/static/src/js/unsubscribe.js:0
|
||||
#: code:addons/mass_mailing_custom_unsubscribe/static/src/js/unsubscribe.js:0
|
||||
#: code:addons/mass_mailing_custom_unsubscribe/static/src/js/unsubscribe.js:0
|
||||
#: code:addons/mass_mailing_custom_unsubscribe/static/src/js/unsubscribe.js:0
|
||||
#: code:addons/mass_mailing_custom_unsubscribe/static/src/js/unsubscribe.js:0
|
||||
#: code:addons/mass_mailing_custom_unsubscribe/static/src/js/unsubscribe.js:0
|
||||
#, python-format
|
||||
msgid "An error occured. Please try again later or contact us."
|
||||
msgstr ""
|
||||
|
||||
#. module: mass_mailing_custom_unsubscribe
|
||||
#. openerp-web
|
||||
#: code:addons/mass_mailing_custom_unsubscribe/static/src/js/unsubscribe.js:163
|
||||
#: code:addons/mass_mailing_custom_unsubscribe/static/src/js/unsubscribe.js:169
|
||||
#: code:addons/mass_mailing_custom_unsubscribe/static/src/js/unsubscribe.js:0
|
||||
#: code:addons/mass_mailing_custom_unsubscribe/static/src/js/unsubscribe.js:0
|
||||
#, python-format
|
||||
msgid "An error occurred. Your changes have not been saved, try again later."
|
||||
msgstr ""
|
||||
@ -73,7 +68,7 @@ msgid "Attachment Count"
|
||||
msgstr ""
|
||||
|
||||
#. module: mass_mailing_custom_unsubscribe
|
||||
#: selection:mail.unsubscription,action:0
|
||||
#: model:ir.model.fields.selection,name:mass_mailing_custom_unsubscribe.selection__mail_unsubscription__action__blacklist_add
|
||||
msgid "Blacklisting"
|
||||
msgstr ""
|
||||
|
||||
@ -101,7 +96,7 @@ msgid "Date"
|
||||
msgstr ""
|
||||
|
||||
#. module: mass_mailing_custom_unsubscribe
|
||||
#: selection:mail.unsubscription,action:0
|
||||
#: model:ir.model.fields.selection,name:mass_mailing_custom_unsubscribe.selection__mail_unsubscription__action__blacklist_rm
|
||||
msgid "De-blacklisting"
|
||||
msgstr ""
|
||||
|
||||
@ -179,24 +174,24 @@ msgstr ""
|
||||
msgid "ID"
|
||||
msgstr ""
|
||||
|
||||
#. module: mass_mailing_custom_unsubscribe
|
||||
#: model:ir.model.fields,help:mass_mailing_custom_unsubscribe.field_mail_unsubscription__message_unread
|
||||
msgid "If checked new messages require your attention."
|
||||
msgstr ""
|
||||
|
||||
#. module: mass_mailing_custom_unsubscribe
|
||||
#: model:ir.model.fields,help:mass_mailing_custom_unsubscribe.field_mail_unsubscription__message_needaction
|
||||
#: model:ir.model.fields,help:mass_mailing_custom_unsubscribe.field_mail_unsubscription__message_unread
|
||||
msgid "If checked, new messages require your attention."
|
||||
msgstr ""
|
||||
|
||||
#. module: mass_mailing_custom_unsubscribe
|
||||
#: model:ir.model.fields,help:mass_mailing_custom_unsubscribe.field_mail_unsubscription__message_has_error
|
||||
#: model:ir.model.fields,help:mass_mailing_custom_unsubscribe.field_mail_unsubscription__message_has_sms_error
|
||||
msgid "If checked, some messages have a delivery error."
|
||||
msgstr ""
|
||||
|
||||
#. module: mass_mailing_custom_unsubscribe
|
||||
#: model:ir.model.fields,help:mass_mailing_custom_unsubscribe.field_mail_mass_mailing_list__not_cross_unsubscriptable
|
||||
msgid "If you mark this field, this list won't be shown when unsubscribing from other mailing list, in the section: 'Is there any other mailing list you want to leave?'"
|
||||
#: model:ir.model.fields,help:mass_mailing_custom_unsubscribe.field_mailing_list__not_cross_unsubscriptable
|
||||
msgid ""
|
||||
"If you mark this field, this list won't be shown when unsubscribing from "
|
||||
"other mailing list, in the section: 'Is there any other mailing list you "
|
||||
"want to leave?'"
|
||||
msgstr ""
|
||||
|
||||
#. module: mass_mailing_custom_unsubscribe
|
||||
@ -238,7 +233,7 @@ msgid "Mail unsubscription reason"
|
||||
msgstr ""
|
||||
|
||||
#. module: mass_mailing_custom_unsubscribe
|
||||
#: model:ir.model,name:mass_mailing_custom_unsubscribe.model_mail_mass_mailing_list
|
||||
#: model:ir.model,name:mass_mailing_custom_unsubscribe.model_mailing_list
|
||||
msgid "Mailing List"
|
||||
msgstr ""
|
||||
|
||||
@ -253,7 +248,7 @@ msgid "Main Attachment"
|
||||
msgstr ""
|
||||
|
||||
#. module: mass_mailing_custom_unsubscribe
|
||||
#: model:ir.model,name:mass_mailing_custom_unsubscribe.model_mail_mass_mailing
|
||||
#: model:ir.model,name:mass_mailing_custom_unsubscribe.model_mailing_mailing
|
||||
msgid "Mass Mailing"
|
||||
msgstr ""
|
||||
|
||||
@ -309,7 +304,7 @@ msgid "Name"
|
||||
msgstr ""
|
||||
|
||||
#. module: mass_mailing_custom_unsubscribe
|
||||
#: model:ir.model.fields,field_description:mass_mailing_custom_unsubscribe.field_mail_mass_mailing_list__not_cross_unsubscriptable
|
||||
#: model:ir.model.fields,field_description:mass_mailing_custom_unsubscribe.field_mailing_list__not_cross_unsubscriptable
|
||||
msgid "Not cross unsubscriptable"
|
||||
msgstr ""
|
||||
|
||||
@ -320,7 +315,7 @@ msgstr ""
|
||||
|
||||
#. module: mass_mailing_custom_unsubscribe
|
||||
#: model:ir.model.fields,field_description:mass_mailing_custom_unsubscribe.field_mail_unsubscription__message_has_error_counter
|
||||
msgid "Number of error"
|
||||
msgid "Number of errors"
|
||||
msgstr ""
|
||||
|
||||
#. module: mass_mailing_custom_unsubscribe
|
||||
@ -344,13 +339,13 @@ msgid "Other reason"
|
||||
msgstr ""
|
||||
|
||||
#. module: mass_mailing_custom_unsubscribe
|
||||
#: code:addons/mass_mailing_custom_unsubscribe/models/mail_unsubscription.py:89
|
||||
#: code:addons/mass_mailing_custom_unsubscribe/models/mail_unsubscription.py:0
|
||||
#, python-format
|
||||
msgid "Please indicate why are you unsubscribing."
|
||||
msgstr ""
|
||||
|
||||
#. module: mass_mailing_custom_unsubscribe
|
||||
#: code:addons/mass_mailing_custom_unsubscribe/models/mail_unsubscription.py:98
|
||||
#: code:addons/mass_mailing_custom_unsubscribe/models/mail_unsubscription.py:0
|
||||
#, python-format
|
||||
msgid "Please provide details on why you are unsubscribing."
|
||||
msgstr ""
|
||||
@ -366,13 +361,18 @@ msgstr ""
|
||||
msgid "Reason"
|
||||
msgstr ""
|
||||
|
||||
#. module: mass_mailing_custom_unsubscribe
|
||||
#: model:ir.model.fields,field_description:mass_mailing_custom_unsubscribe.field_mail_unsubscription__message_has_sms_error
|
||||
msgid "SMS Delivery error"
|
||||
msgstr ""
|
||||
|
||||
#. module: mass_mailing_custom_unsubscribe
|
||||
#: model:ir.model.fields,field_description:mass_mailing_custom_unsubscribe.field_mail_unsubscription_reason__sequence
|
||||
msgid "Sequence"
|
||||
msgstr ""
|
||||
|
||||
#. module: mass_mailing_custom_unsubscribe
|
||||
#: selection:mail.unsubscription,action:0
|
||||
#: model:ir.model.fields.selection,name:mass_mailing_custom_unsubscribe.selection__mail_unsubscription__action__subscription
|
||||
msgid "Subscription"
|
||||
msgstr ""
|
||||
|
||||
@ -397,7 +397,7 @@ msgid "Unsubscribe now"
|
||||
msgstr ""
|
||||
|
||||
#. module: mass_mailing_custom_unsubscribe
|
||||
#: selection:mail.unsubscription,action:0
|
||||
#: model:ir.model.fields.selection,name:mass_mailing_custom_unsubscribe.selection__mail_unsubscription__action__unsubscription
|
||||
msgid "Unsubscription"
|
||||
msgstr ""
|
||||
|
||||
@ -409,17 +409,9 @@ msgstr ""
|
||||
|
||||
#. module: mass_mailing_custom_unsubscribe
|
||||
#: model_terms:ir.ui.view,arch_db:mass_mailing_custom_unsubscribe.reason
|
||||
msgid "We would appreciate if you provide feedback about why you updated<br/>your subscriptions"
|
||||
msgstr ""
|
||||
|
||||
#. module: mass_mailing_custom_unsubscribe
|
||||
#: model:ir.model.fields,field_description:mass_mailing_custom_unsubscribe.field_mail_unsubscription__website_message_ids
|
||||
msgid "Website Messages"
|
||||
msgstr ""
|
||||
|
||||
#. module: mass_mailing_custom_unsubscribe
|
||||
#: model:ir.model.fields,help:mass_mailing_custom_unsubscribe.field_mail_unsubscription__website_message_ids
|
||||
msgid "Website communication history"
|
||||
msgid ""
|
||||
"We would appreciate if you provide feedback about why you updated<br/>your "
|
||||
"subscriptions"
|
||||
msgstr ""
|
||||
|
||||
#. module: mass_mailing_custom_unsubscribe
|
||||
@ -444,45 +436,48 @@ msgstr ""
|
||||
|
||||
#. module: mass_mailing_custom_unsubscribe
|
||||
#. openerp-web
|
||||
#: code:addons/mass_mailing_custom_unsubscribe/static/src/js/unsubscribe.js:147
|
||||
#: code:addons/mass_mailing_custom_unsubscribe/static/src/js/unsubscribe.js:199
|
||||
#: code:addons/mass_mailing_custom_unsubscribe/static/src/js/unsubscribe.js:247
|
||||
#: code:addons/mass_mailing_custom_unsubscribe/static/src/js/unsubscribe.js:0
|
||||
#: code:addons/mass_mailing_custom_unsubscribe/static/src/js/unsubscribe.js:0
|
||||
#: code:addons/mass_mailing_custom_unsubscribe/static/src/js/unsubscribe.js:0
|
||||
#, python-format
|
||||
msgid "You are not authorized to do this!"
|
||||
msgstr ""
|
||||
|
||||
#. module: mass_mailing_custom_unsubscribe
|
||||
#. openerp-web
|
||||
#: code:addons/mass_mailing_custom_unsubscribe/static/src/js/unsubscribe.js:105
|
||||
#: code:addons/mass_mailing_custom_unsubscribe/static/src/js/unsubscribe.js:0
|
||||
#, python-format
|
||||
msgid "You have been <strong>successfully unsubscribed from %s</strong>."
|
||||
msgstr ""
|
||||
|
||||
#. module: mass_mailing_custom_unsubscribe
|
||||
#. openerp-web
|
||||
#: code:addons/mass_mailing_custom_unsubscribe/static/src/js/unsubscribe.js:110
|
||||
#: code:addons/mass_mailing_custom_unsubscribe/static/src/js/unsubscribe.js:0
|
||||
#, python-format
|
||||
msgid "You have been <strong>successfully unsubscribed</strong>."
|
||||
msgstr ""
|
||||
|
||||
#. module: mass_mailing_custom_unsubscribe
|
||||
#. openerp-web
|
||||
#: code:addons/mass_mailing_custom_unsubscribe/static/src/js/unsubscribe.js:205
|
||||
#: code:addons/mass_mailing_custom_unsubscribe/static/src/js/unsubscribe.js:0
|
||||
#, python-format
|
||||
msgid "You have been successfully <strong>added to our blacklist</strong>. You will not be contacted anymore by our services."
|
||||
msgid ""
|
||||
"You have been successfully <strong>added to our blacklist</strong>. You will"
|
||||
" not be contacted anymore by our services."
|
||||
msgstr ""
|
||||
|
||||
#. module: mass_mailing_custom_unsubscribe
|
||||
#. openerp-web
|
||||
#: code:addons/mass_mailing_custom_unsubscribe/static/src/js/unsubscribe.js:253
|
||||
#: code:addons/mass_mailing_custom_unsubscribe/static/src/js/unsubscribe.js:0
|
||||
#, python-format
|
||||
msgid "You have been successfully <strong>removed from our blacklist</strong>. You are now able to be contacted by our services."
|
||||
msgid ""
|
||||
"You have been successfully <strong>removed from our blacklist</strong>. You "
|
||||
"are now able to be contacted by our services."
|
||||
msgstr ""
|
||||
|
||||
#. module: mass_mailing_custom_unsubscribe
|
||||
#. openerp-web
|
||||
#: code:addons/mass_mailing_custom_unsubscribe/static/src/js/unsubscribe.js:152
|
||||
#: code:addons/mass_mailing_custom_unsubscribe/static/src/js/unsubscribe.js:0
|
||||
#, python-format
|
||||
msgid "Your changes have been saved."
|
||||
msgstr ""
|
||||
|
||||
|
@ -11,7 +11,7 @@ class MailBlackList(models.Model):
|
||||
mailing_id = self.env.context.get("mailing_id")
|
||||
res_id = self.env.context.get("unsubscription_res_id")
|
||||
if mailing_id and res_id:
|
||||
mailing = self.env["mail.mass_mailing"].browse(mailing_id, self._prefetch)
|
||||
mailing = self.env["mailing.mailing"].browse(mailing_id)
|
||||
model_name = mailing.mailing_model_real
|
||||
self.env["mail.unsubscription"].create(
|
||||
{
|
||||
@ -27,7 +27,7 @@ class MailBlackList(models.Model):
|
||||
mailing_id = self.env.context.get("mailing_id")
|
||||
res_id = self.env.context.get("unsubscription_res_id")
|
||||
if mailing_id and res_id:
|
||||
mailing = self.env["mail.mass_mailing"].browse(mailing_id, self._prefetch)
|
||||
mailing = self.env["mailing.mailing"].browse(mailing_id)
|
||||
model_name = mailing.mailing_model_real
|
||||
self.env["mail.unsubscription"].create(
|
||||
{
|
||||
|
@ -9,13 +9,13 @@ from odoo.tools.safe_eval import safe_eval
|
||||
|
||||
|
||||
class MailMassMailing(models.Model):
|
||||
_inherit = "mail.mass_mailing"
|
||||
_inherit = "mailing.mailing"
|
||||
|
||||
def update_opt_out(self, email, list_ids, value):
|
||||
"""Save unsubscription reason when opting out from mailing."""
|
||||
self.ensure_one()
|
||||
action = "unsubscription" if value else "subscription"
|
||||
subscription_model = self.env["mail.mass_mailing.list_contact_rel"]
|
||||
subscription_model = self.env["mailing.contact.subscription"]
|
||||
opt_out_records = subscription_model.search(
|
||||
[
|
||||
("contact_id.email", "=ilike", email),
|
||||
@ -23,7 +23,7 @@ class MailMassMailing(models.Model):
|
||||
("opt_out", "!=", value),
|
||||
]
|
||||
)
|
||||
model_name = "mail.mass_mailing.contact"
|
||||
model_name = "mailing.contact"
|
||||
for contact, subscriptions in groupby(opt_out_records, lambda r: r.contact_id):
|
||||
mailing_list_ids = [r.list_id.id for r in subscriptions]
|
||||
# reason_id and details are expected from the context
|
||||
@ -64,10 +64,7 @@ class MailMassMailing(models.Model):
|
||||
"""Handle models with opt_out field for excluding them."""
|
||||
self.ensure_one()
|
||||
model = self.env[self.mailing_model_real].with_context(active_test=False)
|
||||
if (
|
||||
self.mailing_model_real != "mail.mass_mailing.contact"
|
||||
and "opt_out" in model._fields
|
||||
):
|
||||
if self.mailing_model_real != "mailing.contact" and "opt_out" in model._fields:
|
||||
email_fname = "email_from"
|
||||
if "email" in model._fields:
|
||||
email_fname = "email"
|
||||
|
@ -5,7 +5,7 @@ from odoo import fields, models
|
||||
|
||||
|
||||
class MailMassMailing(models.Model):
|
||||
_inherit = "mail.mass_mailing.list"
|
||||
_inherit = "mailing.list"
|
||||
|
||||
not_cross_unsubscriptable = fields.Boolean(
|
||||
string="Not cross unsubscriptable",
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
from odoo import _, api, fields, models
|
||||
|
||||
from odoo.addons.mass_mailing.models.mass_mailing import MASS_MAILING_BUSINESS_MODELS
|
||||
from odoo.addons.mass_mailing.models.mailing import MASS_MAILING_BUSINESS_MODELS
|
||||
|
||||
from .. import exceptions
|
||||
|
||||
@ -29,7 +29,7 @@ class MailUnsubscription(models.Model):
|
||||
help="What did the (un)subscriber choose to do.",
|
||||
)
|
||||
mass_mailing_id = fields.Many2one(
|
||||
"mail.mass_mailing",
|
||||
"mailing.mailing",
|
||||
"Mass mailing",
|
||||
required=True,
|
||||
help="Mass mailing from which he was unsubscribed.",
|
||||
@ -40,7 +40,7 @@ class MailUnsubscription(models.Model):
|
||||
help="Who was subscribed or unsubscribed.",
|
||||
)
|
||||
mailing_list_ids = fields.Many2many(
|
||||
comodel_name="mail.mass_mailing.list",
|
||||
comodel_name="mailing.list",
|
||||
string="Mailing lists",
|
||||
help="(Un)subscribed mass mailing lists, if any.",
|
||||
)
|
||||
@ -59,8 +59,8 @@ class MailUnsubscription(models.Model):
|
||||
def map_mailing_list_models(self, models):
|
||||
model_mapped = []
|
||||
for model in models:
|
||||
if model == "mail.mass_mailing.list":
|
||||
model_mapped.append(("mail.mass_mailing.contact", model))
|
||||
if model == "mailing.list":
|
||||
model_mapped.append(("mailing.contact", model))
|
||||
else:
|
||||
model_mapped.append((model, model))
|
||||
return model_mapped
|
||||
@ -71,7 +71,7 @@ class MailUnsubscription(models.Model):
|
||||
|
||||
@api.model
|
||||
def _selection_unsubscriber_id(self):
|
||||
"""Models that can be linked to a ``mail.mass_mailing``."""
|
||||
"""Models that can be linked to a ``mailing.mailing``."""
|
||||
model = (
|
||||
self.env["ir.model"]
|
||||
.search([("model", "in", MASS_MAILING_BUSINESS_MODELS)])
|
||||
@ -79,7 +79,6 @@ class MailUnsubscription(models.Model):
|
||||
)
|
||||
return self.map_mailing_list_models(model)
|
||||
|
||||
@api.multi
|
||||
@api.constrains("action", "reason_id")
|
||||
def _check_reason_needed(self):
|
||||
"""Ensure reason is given for unsubscriptions."""
|
||||
@ -90,7 +89,6 @@ class MailUnsubscription(models.Model):
|
||||
_("Please indicate why are you unsubscribing.")
|
||||
)
|
||||
|
||||
@api.multi
|
||||
@api.constrains("details", "reason_id")
|
||||
def _check_details_needed(self):
|
||||
"""Ensure details are given if required."""
|
||||
|
@ -6,3 +6,4 @@
|
||||
* David Vidal
|
||||
* Ernesto Tejeda
|
||||
* Pedro M. Baeza
|
||||
* Carlos Roca
|
||||
|
@ -367,7 +367,7 @@ ul.auto-toc {
|
||||
!! This file is generated by oca-gen-addon-readme !!
|
||||
!! changes will be overwritten. !!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||||
<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_custom_unsubscribe"><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_custom_unsubscribe"><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" 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/13.0/mass_mailing_custom_unsubscribe"><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-13-0/social-13-0-mass_mailing_custom_unsubscribe"><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/13.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
|
||||
<p>This addon extends the unsubscription form to let you:</p>
|
||||
<ul class="simple">
|
||||
<li>Choose which mailing lists are not cross-unsubscriptable when unsubscribing
|
||||
@ -440,7 +440,7 @@ duplicated functionality and depending on it instead of replacing it).</li>
|
||||
<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_custom_unsubscribe%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
|
||||
<a class="reference external" href="https://github.com/OCA/social/issues/new?body=module:%20mass_mailing_custom_unsubscribe%0Aversion:%2013.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">
|
||||
@ -461,6 +461,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
|
||||
<li>David Vidal</li>
|
||||
<li>Ernesto Tejeda</li>
|
||||
<li>Pedro M. Baeza</li>
|
||||
<li>Carlos Roca</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
@ -472,7 +473,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
|
||||
<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_custom_unsubscribe">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/13.0/mass_mailing_custom_unsubscribe">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>
|
||||
|
@ -31,7 +31,7 @@ odoo.define('mass_mailing_custom_unsubscribe.unsubscribe', function (require) {
|
||||
$radio.on('change click', function (e) {
|
||||
$details.prop(
|
||||
"required",
|
||||
$(event.target).is("[data-details-required]") && $(event.target).is(":visible")
|
||||
$(e.target).is("[data-details-required]") && $(e.target).is(":visible")
|
||||
);
|
||||
});
|
||||
|
||||
@ -90,7 +90,7 @@ odoo.define('mass_mailing_custom_unsubscribe.unsubscribe', function (require) {
|
||||
$info_state.removeClass('alert-success').removeClass('alert-info').removeClass('alert-warning').addClass('alert-error');
|
||||
}
|
||||
})
|
||||
.fail(function () {
|
||||
.guardedCatch(function () {
|
||||
$('#subscription_info').html(_t('An error occured. Please try again later or contact us.'));
|
||||
$info_state.removeClass('alert-success').removeClass('alert-info').removeClass('alert-warning').addClass('alert-error');
|
||||
});
|
||||
@ -164,7 +164,7 @@ odoo.define('mass_mailing_custom_unsubscribe.unsubscribe', function (require) {
|
||||
$info_state.removeClass('alert-info').addClass('alert-warning');
|
||||
}
|
||||
})
|
||||
.fail(function () {
|
||||
.guardedCatch(function () {
|
||||
$('#info_state').removeClass('invisible');
|
||||
$('#subscription_info').html(_t('An error occurred. Your changes have not been saved, try again later.'));
|
||||
$info_state.removeClass('alert-info').addClass('alert-warning');
|
||||
@ -226,7 +226,7 @@ odoo.define('mass_mailing_custom_unsubscribe.unsubscribe', function (require) {
|
||||
$('#unsubscribed_info').hide();
|
||||
}
|
||||
})
|
||||
.fail(function () {
|
||||
.guardedCatch(function () {
|
||||
$('#subscription_info').html(_t('An error occured. Please try again later or contact us.'));
|
||||
$info_state.removeClass('alert-success').removeClass('alert-info').removeClass('alert-warning').addClass('alert-error');
|
||||
});
|
||||
@ -265,7 +265,7 @@ odoo.define('mass_mailing_custom_unsubscribe.unsubscribe', function (require) {
|
||||
$('#unsubscribed_info').hide();
|
||||
}
|
||||
})
|
||||
.fail(function () {
|
||||
.guardedCatch(function () {
|
||||
$('#info_state').removeClass('invisible');
|
||||
$('#subscription_info').html(_t('An error occured. Please try again later or contact us.'));
|
||||
$info_state.removeClass('alert-success').removeClass('alert-info').removeClass('alert-warning').addClass('alert-error');
|
||||
|
@ -28,24 +28,23 @@ class UICase(HttpCase):
|
||||
)
|
||||
|
||||
self.domain = self.env["ir.config_parameter"].get_param("web.base.url")
|
||||
List = self.lists = self.env["mail.mass_mailing.list"]
|
||||
List = self.lists = self.env["mailing.list"]
|
||||
for n in range(4):
|
||||
self.lists += List.create({"name": "test list %d" % n})
|
||||
self.contact = self.env["mail.mass_mailing.contact"].create(
|
||||
self.contact = self.env["mailing.contact"].create(
|
||||
{
|
||||
"name": "test contact",
|
||||
"email": self.email,
|
||||
"list_ids": [(6, False, self.lists.ids)],
|
||||
}
|
||||
)
|
||||
self.mailing = self.env["mail.mass_mailing"].create(
|
||||
self.mailing = self.env["mailing.mailing"].create(
|
||||
{
|
||||
"name": "test mailing %d" % n,
|
||||
"mailing_model_id": self.env.ref(
|
||||
"mass_mailing.model_mail_mass_mailing_list"
|
||||
).id,
|
||||
"mailing_model_id": self.env.ref("mass_mailing.model_mailing_list").id,
|
||||
"contact_list_ids": [(6, 0, [self.lists[0].id, self.lists[3].id])],
|
||||
"reply_to_mode": "thread",
|
||||
"subject": "Test",
|
||||
}
|
||||
)
|
||||
self.mailing._onchange_model_and_list()
|
||||
@ -73,7 +72,7 @@ class UICase(HttpCase):
|
||||
self.lists[3].is_public = False
|
||||
# Extract the unsubscription link from the message body
|
||||
with self.mail_postprocess_patch:
|
||||
self.mailing.send_mail()
|
||||
self.mailing.action_send_mail()
|
||||
|
||||
tour = "mass_mailing_custom_unsubscribe_tour_contact"
|
||||
self.browser_js(
|
||||
@ -84,9 +83,9 @@ class UICase(HttpCase):
|
||||
)
|
||||
|
||||
# Check results from running tour
|
||||
self.assertFalse(self.lists[0].subscription_contact_ids.opt_out)
|
||||
self.assertTrue(self.lists[1].subscription_contact_ids.opt_out)
|
||||
self.assertFalse(self.lists[2].subscription_contact_ids.opt_out)
|
||||
self.assertFalse(self.lists[0].subscription_ids.opt_out)
|
||||
self.assertTrue(self.lists[1].subscription_ids.opt_out)
|
||||
self.assertFalse(self.lists[2].subscription_ids.opt_out)
|
||||
|
||||
cnt = self.contact
|
||||
common_domain = [
|
||||
@ -137,10 +136,10 @@ class UICase(HttpCase):
|
||||
)
|
||||
# Extract the unsubscription link from the message body
|
||||
with self.mail_postprocess_patch:
|
||||
self.mailing.send_mail()
|
||||
self.mailing.action_send_mail()
|
||||
|
||||
tour = "mass_mailing_custom_unsubscribe_tour_partner"
|
||||
self.phantom_js(
|
||||
self.browser_js(
|
||||
url_path=self.url,
|
||||
code=self._tour_run % tour,
|
||||
ready=self._tour_ready % tour,
|
||||
|
@ -5,8 +5,8 @@
|
||||
<odoo>
|
||||
|
||||
<record id="view_mail_mass_mailing_list_form" model="ir.ui.view">
|
||||
<field name="model">mail.mass_mailing.list</field>
|
||||
<field name="inherit_id" ref="mass_mailing.view_mail_mass_mailing_list_form"/>
|
||||
<field name="model">mailing.list</field>
|
||||
<field name="inherit_id" ref="mass_mailing.mailing_list_view_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="is_public" position="after">
|
||||
<field name="not_cross_unsubscriptable"
|
||||
|
@ -51,7 +51,7 @@
|
||||
|
||||
<menuitem
|
||||
id="mail_unsubscription_reason_menu"
|
||||
parent="mass_mailing.menu_mass_mailing_configuration"
|
||||
parent="mass_mailing.mass_mailing_configuration"
|
||||
action="mail_unsubscription_reason_action"/>
|
||||
|
||||
</odoo>
|
||||
|
Loading…
Reference in New Issue
Block a user