[IMP] send image message as attachement

bzr revid: mat@openerp.com-20130313142344-00hhvdzcelgs4ptk
This commit is contained in:
Martin Trigaux
2013-03-13 15:23:44 +01:00
parent 45179641d6
commit 3ad3048ea9
3 changed files with 9 additions and 8 deletions
+3 -2
View File
@@ -25,6 +25,8 @@ from openerp import tools
from templates import TemplateHelper
from datetime import date
import base64
class gamification_badge_user(osv.Model):
"""User having received a badge"""
@@ -185,8 +187,6 @@ class gamification_badge(osv.Model):
res = None
for badge_user in self.pool.get('gamification.badge.user').browse(cr, uid, badge_user_ids, context=context):
values = {'badge': badge}
if badge.image:
values['badgeb64'] = badge.image.encode('base64'),
if user_from:
values['user_from'] = user_from
@@ -200,6 +200,7 @@ class gamification_badge(osv.Model):
partner_ids=[(4, badge_user.user_id.partner_id.id)],
type='comment',
subtype='mt_comment',
attachments=[('badge-img', base64.decodestring(badge.image))],
context=context)
return res
-2
View File
@@ -265,7 +265,6 @@ class gamification_goal_plan(osv.Model):
self.report_progress(cr, uid, plan, context=context)
self.write(cr, uid, plan.id, {'last_report_date': fields.date.today}, context=context)
def action_start(self, cr, uid, ids, context=None):
"""Start a draft goal plan
@@ -285,7 +284,6 @@ class gamification_goal_plan(osv.Model):
Recompute the current value for each goal related"""
return self._update_all(cr, uid, ids=ids, context=context)
def action_close(self, cr, uid, ids, context=None):
"""Close a plan in progress
@@ -10,9 +10,11 @@
% endif
</p>
<p><img src="data:image/png;base64,${badgeb64}" alt="badge ${badge.name}" /></p>
<p><em>${description}</em></p>
% if badge.image
<p><img src="cid:badge-img" alt="Badge ${badge.name}" /></p>
% endif
% if badge.description
<p><em>${badge.description}</em></p>
% endif
</body>
</html>