From 3ad3048ea9c325aa53b428c4ec93dd7f1d0f9ffc Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Wed, 13 Mar 2013 15:23:44 +0100 Subject: [PATCH] [IMP] send image message as attachement bzr revid: mat@openerp.com-20130313142344-00hhvdzcelgs4ptk --- addons/gamification/badge.py | 5 +++-- addons/gamification/plan.py | 2 -- addons/gamification/templates/badge_received.mako | 10 ++++++---- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/addons/gamification/badge.py b/addons/gamification/badge.py index 9ea8a0b572a..de51b7dc019 100644 --- a/addons/gamification/badge.py +++ b/addons/gamification/badge.py @@ -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 diff --git a/addons/gamification/plan.py b/addons/gamification/plan.py index 856c19598ad..367250f1cd9 100644 --- a/addons/gamification/plan.py +++ b/addons/gamification/plan.py @@ -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 diff --git a/addons/gamification/templates/badge_received.mako b/addons/gamification/templates/badge_received.mako index b745a33a9ca..77c110c3ef9 100644 --- a/addons/gamification/templates/badge_received.mako +++ b/addons/gamification/templates/badge_received.mako @@ -10,9 +10,11 @@ % endif

-

badge ${badge.name}

- -

${description}

- + % if badge.image +

Badge ${badge.name}

+ % endif + % if badge.description +

${badge.description}

+ % endif \ No newline at end of file