Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
vauxoo-dev
addons-vauxoo
Commits
e7f4fef0
Commit
e7f4fef0
authored
Jun 01, 2016
by
Moisés López - https://www.vauxoo.com/
🖥
Browse files
[REF] attach_image_email: Using external files for template and logo
parent
dd55c2ba
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
attach_image_email/__openerp__.py
View file @
e7f4fef0
...
...
@@ -8,7 +8,7 @@
{
'name'
:
'Attach image in email'
,
'version'
:
'8.0.
0.1
.0'
,
'version'
:
'8.0.
1.0
.0'
,
'author'
:
'Vauxoo'
,
'category'
:
'Addons Vauxoo'
,
'website'
:
'https://www.vauxoo.com'
,
...
...
@@ -16,10 +16,6 @@
'depends'
:
[
'base'
,
],
'data'
:
[],
'qweb'
:
[],
'demo'
:
[],
'test'
:
[],
'installable'
:
True
,
'auto_install'
:
False
,
}
attach_image_email/models/ir_mail_server.py
View file @
e7f4fef0
...
...
@@ -35,17 +35,17 @@ class IrMailServer(models.Model):
match
=
pattern
.
search
(
body
,
pos
)
if
not
match
:
break
s
=
match
.
start
()
e
=
match
.
end
()
data
=
body
[
s
+
len
(
'"data:image/png;base64,'
):
e
-
1
]
new_body
+=
body
[
pos
:
s
]
s
tart
=
match
.
start
()
e
nd
=
match
.
end
()
data
=
body
[
s
tart
+
len
(
'"data:image/png;base64,'
):
e
nd
-
1
]
new_body
+=
body
[
pos
:
s
tart
]
fname
=
ftemplate
%
fcounter
fcounter
+=
1
custom_attachments
.
append
((
fname
,
base64
.
b64decode
(
data
)))
new_body
+=
'"cid:%s"'
%
fname
pos
=
e
pos
=
e
nd
new_body
+=
body
[
pos
:]
return
new_body
,
custom_attachments
...
...
attach_image_email/tests/template.html
0 → 100644
View file @
e7f4fef0
<table
border=
"0"
cellpadding=
"2"
cellspacing=
"2"
align=
"center"
width=
"400"
>
<tbody>
<tr>
<td
valign=
"top"
>
<div
style=
"font-family: 'Lucida Grande', Ubuntu, Arial,
Verdana, sans-serif; font-size: 12px; color: rgb(34, 34,
34); background-color: rgb(255, 255, 255); "
>
<div
class=
"moz-text-html"
lang=
"x-unicode"
>
<table
border=
"0"
cellpadding=
"2"
cellspacing=
"2"
width=
"100%"
>
<tbody>
<tr>
<td
valign=
"top"
>
<img
src=
"data:image/png;base64,{image_base64}"
height=
"100"
width=
"250"
>
</td>
</tr>
</tbody>
</table>
<div
style=
"font-family: "Lucida
Grande",Ubuntu,Arial,Verdana,sans-serif;
font-size: 15px; color: #8F41A2;
background-color: rgb(255, 255, 255);"
align=
"left"
><strong
style=
"color: #8F41A2; font-size: 16px"
>
<big><b>
Hello, this is a test template
</b></big></strong><br>
</div>
</div>
</div>
</td>
<td
valign=
"top"
><br>
</td>
</tr>
</tbody>
</table>
attach_image_email/tests/test_attach_image.py
View file @
e7f4fef0
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment