Browse Source
[MIG] mail_debrand
[MIG] mail_debrand
There's no commits preservation, as the module doesn't serve as is on v9.pull/321/head
Pedro M. Baeza
8 years ago
committed by
Graeme Gellatly
10 changed files with 457 additions and 0 deletions
-
73mail_debrand/README.rst
-
4mail_debrand/__init__.py
-
21mail_debrand/__openerp__.py
-
34mail_debrand/i18n/es.po
-
4mail_debrand/models/__init__.py
-
43mail_debrand/models/mail_template.py
-
BINmail_debrand/static/description/icon.png
-
248mail_debrand/static/description/icon.svg
-
4mail_debrand/tests/__init__.py
-
26mail_debrand/tests/test_mail_debrand.py
@ -0,0 +1,73 @@ |
|||||
|
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg |
||||
|
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html |
||||
|
:alt: License: AGPL-3 |
||||
|
|
||||
|
============ |
||||
|
Mail Debrand |
||||
|
============ |
||||
|
|
||||
|
This module modifies the functionality of emails to remove the Odoo branding. |
||||
|
|
||||
|
It also allows some context options to remove user and company signatures too. |
||||
|
|
||||
|
Usage |
||||
|
===== |
||||
|
|
||||
|
To use this module, you need to: |
||||
|
|
||||
|
* Install it. |
||||
|
* Send an email. |
||||
|
* Nobody will know it comes from Odoo. |
||||
|
|
||||
|
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas |
||||
|
:alt: Try me on Runbot |
||||
|
:target: https://runbot.odoo-community.org/runbot/205/10.0 |
||||
|
|
||||
|
|
||||
|
Known issues / Roadmap |
||||
|
====================== |
||||
|
|
||||
|
* This module relies on the translation of the strings here in this module that |
||||
|
must match the mail notification template translation on Odoo core, |
||||
|
specifically the words "using" and "Odoo". |
||||
|
|
||||
|
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. |
||||
|
|
||||
|
Credits |
||||
|
======= |
||||
|
|
||||
|
Contributors |
||||
|
------------ |
||||
|
|
||||
|
* Rafael Blasco <rafabn@tecnativa.com> |
||||
|
* Jairo Llopis <jairo.llopis@tecnativa.com> |
||||
|
* Jordi Ballester Alomar <jordi.ballester@eficent.com> |
||||
|
* Darshan Patel <darshan.patel.serpentcs@gmail.com> |
||||
|
* Pedro M. Baeza <pedro.baeza@tecnativa.com> |
||||
|
|
||||
|
Images |
||||
|
------ |
||||
|
|
||||
|
* https://openclipart.org/detail/29117/unread-mail-icon |
||||
|
* https://openclipart.org/detail/147961/panneau-interdit-forbidden-road-sign-basic |
||||
|
|
||||
|
Maintainer |
||||
|
---------- |
||||
|
|
||||
|
.. image:: https://odoo-community.org/logo.png |
||||
|
:alt: Odoo Community Association |
||||
|
:target: https://odoo-community.org |
||||
|
|
||||
|
This module is maintained by the OCA. |
||||
|
|
||||
|
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. |
||||
|
|
||||
|
To contribute to this module, please visit https://odoo-community.org. |
@ -0,0 +1,4 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
||||
|
|
||||
|
from . import models |
@ -0,0 +1,21 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
# Copyright 2016 Tecnativa - Jairo Llopis |
||||
|
# Copyright 2017 SerpentCS - Darshan Patel |
||||
|
# Copyright 2017 Tecnativa - Pedro M. Baeza |
||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
||||
|
|
||||
|
{ |
||||
|
"name": "Mail Debrand", |
||||
|
"summary": "Remove Odoo branding in sent emails", |
||||
|
"version": "10.0.1.0.0", |
||||
|
"category": "Social Network", |
||||
|
"website": "https://www.tecnativa.com", |
||||
|
"author": "Tecnativa, " |
||||
|
"Eficent, " |
||||
|
"Odoo Community Association (OCA)", |
||||
|
"license": "AGPL-3", |
||||
|
"installable": True, |
||||
|
"depends": [ |
||||
|
"mail", |
||||
|
], |
||||
|
} |
@ -0,0 +1,34 @@ |
|||||
|
# Translation of Odoo Server. |
||||
|
# This file contains the translation of the following modules: |
||||
|
# * mail_debrand |
||||
|
# |
||||
|
msgid "" |
||||
|
msgstr "" |
||||
|
"Project-Id-Version: Odoo Server 10.0\n" |
||||
|
"Report-Msgid-Bugs-To: \n" |
||||
|
"POT-Creation-Date: 2017-05-15 14:50+0000\n" |
||||
|
"PO-Revision-Date: 2017-05-15 14:50+0000\n" |
||||
|
"Last-Translator: <>\n" |
||||
|
"Language-Team: \n" |
||||
|
"MIME-Version: 1.0\n" |
||||
|
"Content-Type: text/plain; charset=UTF-8\n" |
||||
|
"Content-Transfer-Encoding: \n" |
||||
|
"Plural-Forms: \n" |
||||
|
|
||||
|
#. module: mail_debrand |
||||
|
#: model:ir.model,name:mail_debrand.model_mail_template |
||||
|
msgid "Email Templates" |
||||
|
msgstr "Plantillas de correo electrónico" |
||||
|
|
||||
|
#. module: mail_debrand |
||||
|
#: code:addons/mail_debrand/models/mail_template.py:26 |
||||
|
#, python-format |
||||
|
msgid "Odoo" |
||||
|
msgstr "Odoo" |
||||
|
|
||||
|
#. module: mail_debrand |
||||
|
#: code:addons/mail_debrand/models/mail_template.py:25 |
||||
|
#, python-format |
||||
|
msgid "using" |
||||
|
msgstr "usando" |
||||
|
|
@ -0,0 +1,4 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
||||
|
|
||||
|
from . import mail_template |
@ -0,0 +1,43 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
# Copyright 2017 Tecnativa - Pedro M. Baeza |
||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
||||
|
|
||||
|
import re |
||||
|
from odoo import _, api, models |
||||
|
|
||||
|
|
||||
|
class MailTemplate(models.Model): |
||||
|
_inherit = 'mail.template' |
||||
|
|
||||
|
@api.multi |
||||
|
def generate_email(self, res_ids, fields=None): |
||||
|
mail_template = self.env.ref( |
||||
|
'mail.mail_template_data_notification_email_default' |
||||
|
) |
||||
|
if self == mail_template: |
||||
|
obj = self.with_context(mail_debrand=True) |
||||
|
else: |
||||
|
obj = self |
||||
|
return super(MailTemplate, obj).generate_email(res_ids, fields=fields) |
||||
|
|
||||
|
@api.model |
||||
|
def _debrand_body(self, body): |
||||
|
using_word = _('using') |
||||
|
odoo_word = _('Odoo') |
||||
|
return re.sub( |
||||
|
using_word + "(.*)[\r\n]*(.*)>" + odoo_word + r"</a>", "", body, |
||||
|
) |
||||
|
|
||||
|
@api.model |
||||
|
def render_template(self, template_txt, model, res_ids, |
||||
|
post_process=False): |
||||
|
res = super(MailTemplate, self).render_template( |
||||
|
template_txt, model, res_ids, post_process=post_process, |
||||
|
) |
||||
|
if post_process and self.env.context.get('mail_debrand'): |
||||
|
if isinstance(res, basestring): |
||||
|
res = self._debrand_body(res) |
||||
|
else: |
||||
|
for res_id, body in res.iteritems(): |
||||
|
res[res_id] = self._debrand_body(body) |
||||
|
return res |
After Width: 128 | Height: 128 | Size: 5.2 KiB |
@ -0,0 +1,248 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?> |
||||
|
<svg |
||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/" |
||||
|
xmlns:cc="http://creativecommons.org/ns#" |
||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" |
||||
|
xmlns:svg="http://www.w3.org/2000/svg" |
||||
|
xmlns="http://www.w3.org/2000/svg" |
||||
|
xmlns:xlink="http://www.w3.org/1999/xlink" |
||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" |
||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" |
||||
|
viewBox="0 0 128 128" |
||||
|
id="svg2" |
||||
|
version="1.1" |
||||
|
inkscape:version="0.91 r13725" |
||||
|
sodipodi:docname="icon.svg" |
||||
|
width="128" |
||||
|
height="128" |
||||
|
inkscape:export-filename="icon.png" |
||||
|
inkscape:export-xdpi="90" |
||||
|
inkscape:export-ydpi="90"> |
||||
|
<metadata |
||||
|
id="metadata128"> |
||||
|
<rdf:RDF> |
||||
|
<cc:Work |
||||
|
rdf:about=""> |
||||
|
<dc:format>image/svg+xml</dc:format> |
||||
|
<dc:type |
||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> |
||||
|
<dc:title /> |
||||
|
</cc:Work> |
||||
|
</rdf:RDF> |
||||
|
</metadata> |
||||
|
<sodipodi:namedview |
||||
|
pagecolor="#ffffff" |
||||
|
bordercolor="#666666" |
||||
|
borderopacity="1" |
||||
|
objecttolerance="10" |
||||
|
gridtolerance="10" |
||||
|
guidetolerance="10" |
||||
|
inkscape:pageopacity="0" |
||||
|
inkscape:pageshadow="2" |
||||
|
inkscape:window-width="1855" |
||||
|
inkscape:window-height="1176" |
||||
|
id="namedview126" |
||||
|
showgrid="false" |
||||
|
inkscape:zoom="1.4583592" |
||||
|
inkscape:cx="-40.114514" |
||||
|
inkscape:cy="5.0469316" |
||||
|
inkscape:window-x="65" |
||||
|
inkscape:window-y="24" |
||||
|
inkscape:window-maximized="1" |
||||
|
inkscape:current-layer="svg2" /> |
||||
|
<defs |
||||
|
id="defs4"> |
||||
|
<linearGradient |
||||
|
id="linearGradient5060"> |
||||
|
<stop |
||||
|
offset="0" |
||||
|
id="stop7" /> |
||||
|
<stop |
||||
|
offset="1" |
||||
|
stop-opacity="0" |
||||
|
id="stop9" /> |
||||
|
</linearGradient> |
||||
|
<linearGradient |
||||
|
gradientUnits="userSpaceOnUse" |
||||
|
id="linearGradient5027" |
||||
|
x2="0" |
||||
|
y1="-150.69685" |
||||
|
y2="327.6604"> |
||||
|
<stop |
||||
|
offset="0" |
||||
|
stop-opacity="0" |
||||
|
id="stop12" /> |
||||
|
<stop |
||||
|
offset=".5" |
||||
|
id="stop14" /> |
||||
|
<stop |
||||
|
offset="1" |
||||
|
stop-opacity="0" |
||||
|
id="stop16" /> |
||||
|
</linearGradient> |
||||
|
<linearGradient |
||||
|
gradientTransform="matrix(2.9186598,0,0,2.6345737,-4.8428991,-17.303404)" |
||||
|
gradientUnits="userSpaceOnUse" |
||||
|
id="linearGradient6738" |
||||
|
x1="16.25" |
||||
|
x2="31.5" |
||||
|
y1="12.25" |
||||
|
y2="36.625"> |
||||
|
<stop |
||||
|
offset="0" |
||||
|
stop-color="#fff" |
||||
|
id="stop19" /> |
||||
|
<stop |
||||
|
offset="1" |
||||
|
stop-color="#ddd" |
||||
|
id="stop21" /> |
||||
|
</linearGradient> |
||||
|
<linearGradient |
||||
|
gradientUnits="userSpaceOnUse" |
||||
|
id="linearGradient6954" |
||||
|
x2="0" |
||||
|
y1="29.22382" |
||||
|
y2="35.47382"> |
||||
|
<stop |
||||
|
offset="0" |
||||
|
stop-color="#fff" |
||||
|
id="stop24" /> |
||||
|
<stop |
||||
|
offset="1" |
||||
|
stop-color="#c9c9c9" |
||||
|
id="stop26" /> |
||||
|
</linearGradient> |
||||
|
<linearGradient |
||||
|
gradientUnits="userSpaceOnUse" |
||||
|
id="linearGradient6956" |
||||
|
x1="26.504271" |
||||
|
x2="28.364229" |
||||
|
xlink:href="#linearGradient5060" |
||||
|
y1="35.819832" |
||||
|
y2="36.569832" |
||||
|
gradientTransform="translate(5.9124945,0.99230678)" /> |
||||
|
<linearGradient |
||||
|
gradientTransform="matrix(-0.97769,0.21008,0.21008,0.97769,61.56807,-4.44833)" |
||||
|
gradientUnits="userSpaceOnUse" |
||||
|
id="linearGradient6958" |
||||
|
x1="22.686769" |
||||
|
x2="21.408461" |
||||
|
xlink:href="#linearGradient5060" |
||||
|
y1="36.3904" |
||||
|
y2="35.739632" /> |
||||
|
<radialGradient |
||||
|
cx="55" |
||||
|
cy="125" |
||||
|
gradientUnits="userSpaceOnUse" |
||||
|
id="radialGradient278" |
||||
|
r="14.375"> |
||||
|
<stop |
||||
|
offset="0" |
||||
|
stop-color="#fff" |
||||
|
id="stop31" /> |
||||
|
<stop |
||||
|
offset=".5" |
||||
|
stop-color="#fff520" |
||||
|
stop-opacity=".89109" |
||||
|
id="stop33" /> |
||||
|
<stop |
||||
|
offset="1" |
||||
|
stop-color="#fff300" |
||||
|
stop-opacity="0" |
||||
|
id="stop35" /> |
||||
|
</radialGradient> |
||||
|
<radialGradient |
||||
|
cx="16.214741" |
||||
|
cy="19.83647" |
||||
|
gradientTransform="matrix(1,0,0,0.68192,19.76231,14.9041)" |
||||
|
gradientUnits="userSpaceOnUse" |
||||
|
id="radialGradient6948" |
||||
|
r="13.56536"> |
||||
|
<stop |
||||
|
offset="0" |
||||
|
stop-color="#727e0a" |
||||
|
id="stop38" /> |
||||
|
<stop |
||||
|
offset="1" |
||||
|
stop-color="#5b6508" |
||||
|
id="stop40" /> |
||||
|
</radialGradient> |
||||
|
<radialGradient |
||||
|
cx="29.344931" |
||||
|
cy="17.064079" |
||||
|
gradientTransform="matrix(0.788,0,0,0.788,6.2212,3.61763)" |
||||
|
gradientUnits="userSpaceOnUse" |
||||
|
id="radialGradient6952" |
||||
|
r="9.1620598"> |
||||
|
<stop |
||||
|
offset="0" |
||||
|
stop-color="#e9b15e" |
||||
|
id="stop43" /> |
||||
|
<stop |
||||
|
offset="1" |
||||
|
stop-color="#966416" |
||||
|
id="stop45" /> |
||||
|
</radialGradient> |
||||
|
<radialGradient |
||||
|
cx="605.71429" |
||||
|
cy="486.64789" |
||||
|
gradientTransform="matrix(-2.77439,0,0,1.96971,112.7623,-872.8854)" |
||||
|
gradientUnits="userSpaceOnUse" |
||||
|
id="radialGradient5031" |
||||
|
r="117.14286" |
||||
|
xlink:href="#linearGradient5060" /> |
||||
|
<radialGradient |
||||
|
cx="605.71429" |
||||
|
cy="486.64789" |
||||
|
gradientTransform="matrix(2.77439,0,0,1.96971,-1891.633,-872.8854)" |
||||
|
gradientUnits="userSpaceOnUse" |
||||
|
id="radialGradient5029" |
||||
|
r="117.14286" |
||||
|
xlink:href="#linearGradient5060" /> |
||||
|
<radialGradient |
||||
|
cx="31.1127" |
||||
|
cy="19.008619" |
||||
|
gradientUnits="userSpaceOnUse" |
||||
|
id="radialGradient6950" |
||||
|
r="8.6620598" |
||||
|
xlink:href="#linearGradient5060" /> |
||||
|
</defs> |
||||
|
<g |
||||
|
transform="matrix(2.1385661,0,0,2.1385661,-36.355623,89.820203)" |
||||
|
inkscape:label="Calque 1" |
||||
|
id="layer1"> |
||||
|
<path |
||||
|
transform="translate(13,-50)" |
||||
|
d="m 10,8 c -3.3137,0 -6,2.6822 -6,6 0.074392,9.0983 1.952e-4,18.727 0,28 0,3.1932 2.4839,5.7776 5.625,5.9688 l 44.625,0.031 c 3.199,-0.129 5.75,-2.765 5.75,-6 l 0,-29.031 c -0.485,-2.829 -2.941,-4.969 -5.906,-4.969 -14.69,0.0067 -29.398,1e-4 -44.094,0 z m -0.09375,3.1562 44.375,0 -21.469,21.469 c -0.39174,0.39174 -1.0145,0.39174 -1.4062,0 l -21.5,-21.469 z m 47.094,1.532 0,29.093 c 0,1.7334 -0.6245,2.7125 -1.875,3.0625 l -15.125,-15.156 17,-17 z m -49.656,0.124 16.718,16.719 -15.281,15.281 c -1.046,-0.353 -1.4101,-1.195 -1.4372,-2.343 l 0,-29.656 z m 18.844,18.812 5.2188,5.25 c 0.39174,0.39174 1.0145,0.39174 1.4062,0 l 5.062,-5.062 13.187,13.188 -38.25,0 13.375,-13.375 z" |
||||
|
sodipodi:nodetypes="ccscccccccccccccccccccccccccccc" |
||||
|
style="fill:#000000" |
||||
|
id="rect3174" |
||||
|
inkscape:connector-curvature="0" /> |
||||
|
</g> |
||||
|
<g |
||||
|
transform="matrix(0.26759984,0,0,-0.26759984,62.366861,118.02764)" |
||||
|
inkscape:label="ink_ext_XXXXXX" |
||||
|
id="g10"> |
||||
|
<path |
||||
|
d="m 104.00014,165.45424 c -8.313043,0 -16.263246,-1.57861 -23.850744,-4.72609 -7.594015,-3.15718 -14.181554,-7.52151 -19.768717,-13.10966 -5.587026,-5.58537 -10.031894,-12.10596 -13.321854,-19.55278 -3.297028,-7.45376 -4.942836,-15.61837 -4.942836,-24.4966 0,-8.312905 1.645808,-16.26269 4.942836,-23.850746 3.28996,-7.594012 7.734828,-14.256255 13.321854,-19.984093 5.587163,-5.733797 12.174702,-10.246299 19.768717,-13.536809 7.587498,-3.297027 15.537701,-4.941729 23.850744,-4.941729 8.30583,0 16.2577,1.644702 23.85171,4.941729 7.5875,3.29051 14.18128,7.803012 19.76942,13.536809 5.58675,5.727838 10.02454,12.390081 13.32171,19.984093 3.29023,7.588056 4.94089,15.537841 4.94089,23.850746 -0.85928,16.90258 -6.87567,31.15898 -18.04779,42.76184 -11.17419,11.60314 -25.6454,17.97571 -43.40561,19.12329 l -0.43033,0 z M 104.43047,208 c 14.03437,0 27.28859,-2.79405 39.75226,-8.38083 12.46244,-5.58534 23.4211,-13.10687 32.87602,-22.5618 9.45355,-9.45492 16.97508,-20.48705 22.56183,-33.09085 C 205.20733,131.3558 208,117.89258 208,103.56911 208,89.239815 205.27385,75.85019 199.83679,63.387487 194.39,50.925336 187.01124,39.966662 177.70323,30.511325 168.38966,21.056678 157.431,13.602838 144.82719,8.1646355 132.21703,2.726419 118.61203,0 104.00014,0 89.671258,0 76.208041,2.5780813 63.603558,7.7347705 50.993109,12.892 39.96777,20.123798 30.512431,29.437215 21.058202,38.744259 13.605015,49.702934 8.1651761,62.313379 2.7204595,74.917448 0,88.668665 0,103.56911 c 0,14.32347 2.6462976,27.71892 7.9502436,40.1826 5.2990814,12.46381 12.6781754,23.34765 22.1335154,32.66119 9.453538,9.30801 20.553026,16.76025 33.305391,22.347 12.744188,5.58675 26.429298,8.66218 41.04132,9.2401" |
||||
|
style="fill:#a2478a;fill-opacity:1;fill-rule:nonzero;stroke:none" |
||||
|
id="path14" |
||||
|
inkscape:connector-curvature="0" /> |
||||
|
</g> |
||||
|
<g |
||||
|
id="g4250" |
||||
|
transform="matrix(0.16801262,0,0,0.16801262,85.012954,66.157096)"> |
||||
|
<ellipse |
||||
|
style="fill:none;stroke:#ff0000;stroke-width:50.00000381" |
||||
|
id="path3315" |
||||
|
cx="30.856556" |
||||
|
cy="143.08545" |
||||
|
rx="199.9995" |
||||
|
ry="199.99942" /> |
||||
|
<path |
||||
|
d="m -114.84995,20.228255 297.14,260.000005" |
||||
|
inkscape:connector-curvature="0" |
||||
|
style="fill:#ff0000;stroke:#ff0000;stroke-width:50" |
||||
|
id="path4089" /> |
||||
|
</g> |
||||
|
</svg> |
@ -0,0 +1,4 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
||||
|
|
||||
|
from . import test_mail_debrand |
@ -0,0 +1,26 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
# Copyright 2017 Tecnativa - Pedro M. Baeza |
||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
||||
|
|
||||
|
from odoo.tests import common |
||||
|
|
||||
|
|
||||
|
class TestMailDebrand(common.SavepointCase): |
||||
|
@classmethod |
||||
|
def setUpClass(cls): |
||||
|
super(TestMailDebrand, cls).setUpClass() |
||||
|
cls.template = cls.env.ref( |
||||
|
'mail.mail_template_data_notification_email_default' |
||||
|
) |
||||
|
|
||||
|
def test_generate_email_simple(self): |
||||
|
res = self.template.generate_email( |
||||
|
self.env.user.id, fields=['body_html'], |
||||
|
) |
||||
|
self.assertNotIn('using', res) |
||||
|
|
||||
|
def test_generate_email_multi(self): |
||||
|
res = self.template.generate_email( |
||||
|
self.env.user.ids, fields=['body_html'], |
||||
|
) |
||||
|
self.assertNotIn('using', res[res.keys()[0]]) |
Write
Preview
Loading…
Cancel
Save
Reference in new issue