groupeurd_newsletter v0.5
Ajout de la réponse aux besoins suivants: - Ajout section "Dernières publications" aux modèles Newsletter URD - Empêcher pour un publipostage de faire un second clic "Envoyer à tous" si l'envoi de mails est déjà planifié - Ajouter automatiquement un lien de désinscription s'il n'est pas ajouté manuellement
This commit is contained in:
parent
9f584879a4
commit
de1487730d
|
@ -11,13 +11,16 @@
|
||||||
- Unicité de l'abonné dans chaque liste
|
- Unicité de l'abonné dans chaque liste
|
||||||
- Droits d'utilisateur pour limiter accès à uniquement publipostages et listes de diffusion
|
- Droits d'utilisateur pour limiter accès à uniquement publipostages et listes de diffusion
|
||||||
- Retirer droit de suppression d'abonné au profil Responsable Marketing
|
- Retirer droit de suppression d'abonné au profil Responsable Marketing
|
||||||
- Retirer la gestion des nom des abonnés (dans la liste ou dans le formulaire)
|
- Retirer la gestion des noms des abonnés (dans la liste ou dans le formulaire)
|
||||||
- Ajouter un champ "unsubscribed_by_odoo_user" qui sera manipulé pour les désincriptions par interface
|
- Ajouter un champ "unsubscribed_by_odoo_user" qui sera manipulé pour les désincriptions par interface
|
||||||
- Afficher champ create_uid pour savoir provenance des contacts
|
- Afficher champ create_uid pour savoir provenance des contacts
|
||||||
- Ne garder que les modèles de courriel de newsletter dans Publipostages/Modèles de courriel
|
- Ne garder que les modèles de courriel de newsletter dans Publipostages/Modèles de courriel
|
||||||
- Modèles de newsletter spécifiques
|
- Modèles de newsletter spécifiques
|
||||||
- Lien vers version HTML (format proposé: __HTML_VERSION_URL__)
|
- Lien vers version HTML (format proposé: __HTML_VERSION_URL__)
|
||||||
- Placement libre du lien de désinscription (format proposé: __UNSUBSCRIBE_URL__)
|
- Placement libre du lien de désinscription (format proposé: __UNSUBSCRIBE_URL__)
|
||||||
|
- Ajout section "Dernières publications" aux modèles Newsletter URD
|
||||||
|
- Empêcher pour un publipostage de faire un second clic "Envoyer à tous" si l'envoi de mails est déjà planifié
|
||||||
|
- Ajouter automatiquement un lien de désinscription s'il n'est pas ajouté manuellement
|
||||||
|
|
||||||
En projet:
|
En projet:
|
||||||
- Ecraser les propriétés d'un publipostage par les propriétés standard d'un modèle de courriel au moment de la sélection de ce dernier.
|
- Ecraser les propriétés d'un publipostage par les propriétés standard d'un modèle de courriel au moment de la sélection de ce dernier.
|
||||||
|
@ -31,7 +34,7 @@
|
||||||
# Check https://github.com/odoo/odoo/blob/master/openerp/addons/base/module/module_data.xml
|
# Check https://github.com/odoo/odoo/blob/master/openerp/addons/base/module/module_data.xml
|
||||||
# for the full list
|
# for the full list
|
||||||
'category': 'Marketing',
|
'category': 'Marketing',
|
||||||
'version': '0.4',
|
'version': '0.5',
|
||||||
|
|
||||||
# any module necessary for this one to work correctly
|
# any module necessary for this one to work correctly
|
||||||
'depends': ['base','mass_mailing','marketing','website_mail'],
|
'depends': ['base','mass_mailing','marketing','website_mail'],
|
||||||
|
|
|
@ -9,6 +9,9 @@ from openerp.osv import osv
|
||||||
from openerp import tools
|
from openerp import tools
|
||||||
from openerp.tools.translate import _
|
from openerp.tools.translate import _
|
||||||
|
|
||||||
|
import logging
|
||||||
|
_logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
# Overrides mass mailing Contact for this module purpose
|
# Overrides mass mailing Contact for this module purpose
|
||||||
class contact(models.Model):
|
class contact(models.Model):
|
||||||
_name = "mail.mass_mailing.contact"
|
_name = "mail.mass_mailing.contact"
|
||||||
|
@ -70,7 +73,11 @@ class MailMail(osv.Model):
|
||||||
has_email_to = emails and emails[0] or False
|
has_email_to = emails and emails[0] or False
|
||||||
unsubscribe_url = self._get_unsubscribe_url(cr, uid, mail, has_email_to, context=context)
|
unsubscribe_url = self._get_unsubscribe_url(cr, uid, mail, has_email_to, context=context)
|
||||||
if unsubscribe_url:
|
if unsubscribe_url:
|
||||||
body = body.replace('__UNSUBSCRIBE_URL__', unsubscribe_url)
|
if body.count('__UNSUBSCRIBE_URL__') > 0:
|
||||||
|
body = body.replace('__UNSUBSCRIBE_URL__', unsubscribe_url)
|
||||||
|
else:
|
||||||
|
unsubscribe_link = '<small><a href="%s">%s</a></small>' % (unsubscribe_url, _('Click to unsubscribe'))
|
||||||
|
body = tools.append_content_to_html(body,unsubscribe_link, plaintext=False, container_tag='p')
|
||||||
html_version_url = self._get_html_version_url(cr, uid, mail, has_email_to, context=context)
|
html_version_url = self._get_html_version_url(cr, uid, mail, has_email_to, context=context)
|
||||||
body = body.replace('__HTML_VERSION_URL__', html_version_url)
|
body = body.replace('__HTML_VERSION_URL__', html_version_url)
|
||||||
|
|
||||||
|
@ -95,10 +102,13 @@ class TestMassMailing(osv.TransientModel):
|
||||||
mass_mailing_id = fields.Many2one('mail.mass_mailing', 'Mailing', required=True, ondelete='cascade')
|
mass_mailing_id = fields.Many2one('mail.mass_mailing', 'Mailing', required=True, ondelete='cascade')
|
||||||
|
|
||||||
def send_mail_test(self, cr, uid, ids, context=None):
|
def send_mail_test(self, cr, uid, ids, context=None):
|
||||||
|
_logger.info('entering new send_mail_test')
|
||||||
#Add a 'mass_mailing_test' flag in the context to be able to build correct HTML_VERSION/UNSUBSCRIBE URLs in test mode
|
#Add a 'mass_mailing_test' flag in the context to be able to build correct HTML_VERSION/UNSUBSCRIBE URLs in test mode
|
||||||
context['mass_mailing_test'] = True
|
context['mass_mailing_test'] = True
|
||||||
|
|
||||||
Mail = self.pool['mail.mail']
|
Mail = self.pool['mail.mail']
|
||||||
|
|
||||||
|
_logger.info('before send_mail_test for loop')
|
||||||
for wizard in self.browse(cr, uid, ids, context=context):
|
for wizard in self.browse(cr, uid, ids, context=context):
|
||||||
mailing = wizard.mass_mailing_id
|
mailing = wizard.mass_mailing_id
|
||||||
test_emails = tools.email_split(wizard.email_to)
|
test_emails = tools.email_split(wizard.email_to)
|
||||||
|
@ -117,11 +127,18 @@ class TestMassMailing(osv.TransientModel):
|
||||||
mail_mail_obj = Mail.browse(cr, uid, Mail.create(cr, uid, mail_values, context=context), context=context)
|
mail_mail_obj = Mail.browse(cr, uid, Mail.create(cr, uid, mail_values, context=context), context=context)
|
||||||
unsubscribe_url = Mail._get_unsubscribe_url(cr, uid, mail_mail_obj, test_mail, context=context)
|
unsubscribe_url = Mail._get_unsubscribe_url(cr, uid, mail_mail_obj, test_mail, context=context)
|
||||||
html_version_url = Mail._get_html_version_url(cr, uid, mail_mail_obj, test_mail, context=context)
|
html_version_url = Mail._get_html_version_url(cr, uid, mail_mail_obj, test_mail, context=context)
|
||||||
body = mailing.body_html.replace('__UNSUBSCRIBE_URL__', unsubscribe_url)
|
if unsubscribe_url:
|
||||||
|
if mailing.body_html.count('__UNSUBSCRIBE_URL__') > 0:
|
||||||
|
body = mailing.body_html.replace('__UNSUBSCRIBE_URL__', unsubscribe_url)
|
||||||
|
else:
|
||||||
|
unsubscribe_link = '<small><a href="%s">%s</a></small>' % (unsubscribe_url, _('Click to unsubscribe'))
|
||||||
|
body = tools.append_content_to_html(mailing.body_html,unsubscribe_link, plaintext=False, container_tag='p')
|
||||||
body = mailing.body_html.replace('__HTML_VERSION_URL__', html_version_url)
|
body = mailing.body_html.replace('__HTML_VERSION_URL__', html_version_url)
|
||||||
Mail.write(cr, uid, mail_mail_obj.id, {'body_html': mailing.body_html}, context=context)
|
Mail.write(cr, uid, mail_mail_obj.id, {'body_html': mailing.body_html}, context=context)
|
||||||
mail_ids.append(mail_mail_obj.id)
|
mail_ids.append(mail_mail_obj.id)
|
||||||
|
_logger.info('just before new send_mail_test Mail.send')
|
||||||
Mail.send(cr, uid, mail_ids, context=context)
|
Mail.send(cr, uid, mail_ids, context=context)
|
||||||
|
_logger.info('just after new send_mail_test Mail.send')
|
||||||
self.pool['mail.mass_mailing'].write(cr, uid, [mailing.id], {'state': 'test'}, context=context)
|
self.pool['mail.mass_mailing'].write(cr, uid, [mailing.id], {'state': 'test'}, context=context)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
|
@ -207,6 +207,91 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div id="publication-header">
|
||||||
|
<table style="background-color: rgb(244, 244, 244);" align="center" border="0" cellpadding="0" cellspacing="0" width="640">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<table align="center" border="0" cellpadding="0" cellspacing="0" width="600">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td> </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td style="font-size: 0pt;" height="1"><img src="http://www.urd.org/newsletter/urd-img/separateur.png" alt="separateur.png" height="1" width="600"></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td style="font-size: 0pt;" height="13"><br>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td style="font-family: Georgia,Times,serif; font-variant: small-caps; font-size: 14px; text-align: left; color: rgb(0, 0, 0);" height="14">DERNIÈRES PUBLICATIONS DU GROUPE URD</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td style="font-size: 0pt;" height="18"><br>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<table style="background-color: rgb(244, 244, 244);" align="center" border="0" cellpadding="0" cellspacing="0" width="640">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<table align="center" border="0" cellpadding="0" cellspacing="0" width="600">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td style="font-size: 0pt; text-align: center;" width="130">
|
||||||
|
<div style="text-align: center;"> </div>
|
||||||
|
<div style="text-align: center;"><a href="http://www.fmreview.org/sites/fmr/files/FMRdownloads/en/resettlement.pdf"><img style="border: 0px solid ; float: left;" src="http://www.urd.org/newsletter/urd-img/2017-58/Veille1.PNG" ></a></div>
|
||||||
|
</td>
|
||||||
|
<td style="font-size: 0pt;" width="30"><br>
|
||||||
|
</td>
|
||||||
|
<td style="font-size: 0pt;" valign="top" width="440">
|
||||||
|
<table align="center" border="0" cellpadding="0" cellspacing="0" width="440">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td style="font-family: Georgia,Times,serif; font-size: 18px; font-weight: bold; color: rgb(241, 157, 43); text-align: justify;" height="18">Forced Migration Review, « Resettlement » </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td style="font-size: 0pt;" height="14"><br>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td style="font-family: Arial,Helvetica,sans-serif; font-size: 14px; color: rgb(144, 144, 144); line-height: 18px; text-align: justify;" valign="top">Ce
|
||||||
|
numéro de la revue des migrations forcées s’intéresse aux modalités et
|
||||||
|
aux enjeux de la réinstallation, à la façon dont celle-ci est gérée,
|
||||||
|
aussi bien financièrement qu’humainement. Les articles présentent
|
||||||
|
différentes études de cas, des exemples de réinstallation positifs et
|
||||||
|
d’autres plus négatifs. Des retours en arrière historiques montrent par
|
||||||
|
exemple la réinstallation des réfugiés hongrois en 1956. Des articles
|
||||||
|
généraux clôturent la revue. <a style="color: rgb(241, 157, 43); font-size: 12px; text-decoration: none;" href="http://www.urd.org/Veille-bibliographique-mars-2017?artpage=3-11#outil_sommaire_2">En
|
||||||
|
savoir plus</a></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td style="font-size: 0pt; vertical-align: top;" height="14">o<br />
|
||||||
|
</td>
|
||||||
|
<td style="vertical-align: top;"><br>
|
||||||
|
</td>
|
||||||
|
<td style="vertical-align: top;"><br>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div id="veille-header">
|
<div id="veille-header">
|
||||||
<table style="background-color: rgb(244, 244, 244);" align="center" border="0" cellpadding="0" cellspacing="0" width="640">
|
<table style="background-color: rgb(244, 244, 244);" align="center" border="0" cellpadding="0" cellspacing="0" width="640">
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -342,6 +427,8 @@
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div id="footer">
|
<div id="footer">
|
||||||
<p style="font-family: Arial,Helvetica,sans-serif; font-size: 11px; color: rgb(145, 145, 145); text-align: center; line-height: 18px;">
|
<p style="font-family: Arial,Helvetica,sans-serif; font-size: 11px; color: rgb(145, 145, 145); text-align: center; line-height: 18px;">
|
||||||
© Groupe URD - La Fontaine des Marins - 26170 PLAISIANS - Tel :+33 (0)4
|
© Groupe URD - La Fontaine des Marins - 26170 PLAISIANS - Tel :+33 (0)4
|
||||||
|
|
|
@ -143,6 +143,69 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Dernière publication Newsletter Groupe URD - FR -->
|
||||||
|
<div>
|
||||||
|
<div class="oe_snippet_thumbnail">
|
||||||
|
<img class="oe_snippet_thumbnail_img" src="/website/static/src/img/blocks/block_text_image.png"/>
|
||||||
|
<span class="oe_snippet_thumbnail_title">Publi FR</span>
|
||||||
|
</div>
|
||||||
|
<div class="oe_snippet_body" style="padding:0px; margin:0px">
|
||||||
|
|
||||||
|
<table style="background-color: rgb(244, 244, 244);" align="center" border="0" cellpadding="0" cellspacing="0" width="640">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<table align="center" border="0" cellpadding="0" cellspacing="0" width="600">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td style="font-size: 0pt; text-align: center;" width="130">
|
||||||
|
<div style="text-align: center;"> </div>
|
||||||
|
<div style="text-align: center;"><a href="http://www.fmreview.org/sites/fmr/files/FMRdownloads/en/resettlement.pdf"><img style="border: 0px solid ; float: left;" src="http://www.urd.org/newsletter/urd-img/2017-58/Veille1.PNG" /></a></div>
|
||||||
|
</td>
|
||||||
|
<td style="font-size: 0pt;" width="30"><br />
|
||||||
|
</td>
|
||||||
|
<td style="font-size: 0pt;" valign="top" width="440">
|
||||||
|
<table align="center" border="0" cellpadding="0" cellspacing="0" width="440">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td style="font-family: Georgia,Times,serif; font-size: 18px; font-weight: bold; color: rgb(241, 157, 43); text-align: justify;" height="18">Forced Migration Review, « Resettlement » </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td style="font-size: 0pt;" height="14"><br />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td style="font-family: Arial,Helvetica,sans-serif; font-size: 14px; color: rgb(144, 144, 144); line-height: 18px; text-align: justify;" valign="top">Ce
|
||||||
|
numéro de la revue des migrations forcées s’intéresse aux modalités et
|
||||||
|
aux enjeux de la réinstallation, à la façon dont celle-ci est gérée,
|
||||||
|
aussi bien financièrement qu’humainement. Les articles présentent
|
||||||
|
différentes études de cas, des exemples de réinstallation positifs et
|
||||||
|
d’autres plus négatifs. Des retours en arrière historiques montrent par
|
||||||
|
exemple la réinstallation des réfugiés hongrois en 1956. Des articles
|
||||||
|
généraux clôturent la revue. <a style="color: rgb(241, 157, 43); font-size: 12px; text-decoration: none;" href="http://www.urd.org/Veille-bibliographique-mars-2017?artpage=3-11#outil_sommaire_2">En
|
||||||
|
savoir plus</a></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td style="font-size: 0pt; vertical-align: top;" height="14">o<br />
|
||||||
|
</td>
|
||||||
|
<td style="vertical-align: top;"><br />
|
||||||
|
</td>
|
||||||
|
<td style="vertical-align: top;"><br />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- Actualité Newsletter Groupe URD - EN -->
|
<!-- Actualité Newsletter Groupe URD - EN -->
|
||||||
<div>
|
<div>
|
||||||
<div class="oe_snippet_thumbnail">
|
<div class="oe_snippet_thumbnail">
|
||||||
|
|
|
@ -23,6 +23,23 @@
|
||||||
</field>
|
</field>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
<record model="ir.ui.view" id="groupeurd_view_mail_mass_mailing_form">
|
||||||
|
<field name="name">mail.mass_mailing.form</field>
|
||||||
|
<field name="model">mail.mass_mailing</field>
|
||||||
|
<field name="inherit_id" ref="mass_mailing.view_mail_mass_mailing_form" />
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<button name="send_mail" position="replace"></button> <!-- Empty replace to remove the first original "send_mail" button. -->
|
||||||
|
<button name="send_mail" position="replace"> <!-- This second "send_mail" replace will replace the second original "send_mail" with two new buttons. -->
|
||||||
|
<button name="send_mail" type="object"
|
||||||
|
attrs="{'invisible': ['|', ('scheduled', '>', 0), '|', ('state', '=', 'done'), ('body_html', '=', False)]}"
|
||||||
|
class="oe_highlight" string="Send to All" confirm="This will send the email to all recipients. Do you still want to proceed ?"/>
|
||||||
|
<button name="send_mail" type="object"
|
||||||
|
attrs="{'invisible': ['|', ('scheduled', '>', 0), '&', ('state', '!=', 'done'), ('body_html', '!=', False)]}"
|
||||||
|
string="Send to All" confirm="This will send the email to all recipients. Do you still want to proceed ?"/>
|
||||||
|
</button>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
</data>
|
</data>
|
||||||
</openerp>
|
</openerp>
|
Loading…
Reference in New Issue