[IMP] display user's badges on employee

bzr revid: mat@openerp.com-20130419154817-rq09s1f5nl6ryhka
This commit is contained in:
Martin Trigaux 2013-04-19 17:48:17 +02:00
parent 263124a6f3
commit 4fb6e9b682
4 changed files with 10 additions and 7 deletions

View File

@ -764,7 +764,7 @@ class gamification_goal_plan(osv.Model):
def reward_user(self, cr, uid, user_id, badge_id, context=None):
"""Create a badge user and send the badge to him"""
user_badge_id = self.pool.get('gamification.badge.user').create(cr, uid, {'user_id': user_id, 'badge_id': badge_id}, context=context)
return self.pool.get('gamification.badge').send_badge(cr, uid, badge_id, [user_badge_id], context=context)
return self.pool.get('gamification.badge').send_badge(cr, uid, badge_id, [user_badge_id], user_from=None, context=context)
class gamification_goal_planline(osv.Model):

View File

@ -107,12 +107,9 @@
.openerp .oe_mail_wall .oe_mail_wall_aside .oe_user_avatar { width: 32px; }
/* background progress bar */
.openerp .oe_mail_wall .oe_mail_wall_aside .oe_goal_progress {
background: rgb(173, 219, 178);
/* background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3QQSDDgQbtbJfgAAABl0RVh0Q29tbWVudABDcmVhdGVkIHdpdGggR0lNUFeBDhcAAAAMSURBVAjXY2jY2AoAA2sBt0HZbqoAAAAASUVORK5CYII=);
background-image: url("http://lorempixel.com/20/10/");
background-repeat: repeat-y;
background-position: 0 50%;*/
}
.openerp .oe_mail_wall .oe_mail_wall_aside table progress,.oe_form_field_progressbar {
width: 100%;

View File

@ -51,7 +51,7 @@
</thead>
<tbody>
<tr t-foreach="planline.goals" t-as="goal" t-attf-class="#{goal.id == planline.own_goal_id ? 'oe_bold' : ''}">
<div style="background:#fff;">
<div style="background: #fff;">
<th class="col0"><t t-esc="goal.rank" /></th>
<td class="col1"><img class="oe_user_avatar" t-attf-alt="#{goal.user_name}" t-attf-data-id="#{goal.user_id}"/></td>
<td class="col2" style="width:150px;">

View File

@ -141,7 +141,13 @@ class hr_employee(osv.osv):
"""Return the list of badge_users assigned to the employee"""
res = {}
for employee in self.browse(cr, uid, ids, context=context):
res[employee.id] = self.pool.get('gamification.badge.user').search(cr, uid, [('employee_id', '=', employee.id)], context=context)
res[employee.id] = self.pool.get('gamification.badge.user').search(cr, uid, [
'|',
('employee_id', '=', employee.id),
'&',
('employee_id', '=', False),
('user_id', '=', employee.user_id.id)
], context=context)
return res
def _has_badges(self, cr, uid, ids, field_name, arg, context=None):