[IMP] badge to employee actions
bzr revid: mat@openerp.com-20130412133606-60kb4s026vfsrija
This commit is contained in:
@@ -67,10 +67,12 @@
|
||||
<field name="arch" type="xml">
|
||||
<form string="Badge" version="7.0">
|
||||
<header>
|
||||
<button string="Grant this Badge" type="action" name="%(action_grant_wizard)d" class="oe_highlight" attrs="{'invisible': [('remaining_sending','!=',0)]}" />
|
||||
<button string="Grant this Badge" type="action" name="%(action_grant_wizard)d" class="oe_highlight" attrs="{'invisible': [('remaining_sending','=',0)]}" />
|
||||
<button string="Check Badge" type="object" name="check_automatic" groups="base.group_no_one" />
|
||||
</header>
|
||||
<sheet>
|
||||
<div class="oe_right oe_button_box">
|
||||
</div>
|
||||
<field name="image" widget='image' class="oe_left oe_avatar"/>
|
||||
<div class="oe_title">
|
||||
<label for="name" class="oe_edit_only"/>
|
||||
@@ -148,7 +150,7 @@
|
||||
<a type="open"><img t-att-src="kanban_image('gamification.badge', 'image', record.image.raw_value)" t-att-title="record.name.value" width="110" height="110" /></a>
|
||||
</div>
|
||||
<div>
|
||||
<h4><a type="open"><field name="name"/></a></h4>
|
||||
<h4><field name="name"/></h4>
|
||||
<t t-if="record.description.value">
|
||||
<em><field name="description"/></em>
|
||||
</t>
|
||||
@@ -171,9 +173,11 @@
|
||||
</t>
|
||||
</div>
|
||||
<div class="oe_kanban_badge_avatars">
|
||||
<t t-foreach="record.unique_owner_ids.raw_value.slice(0,11)" t-as="owner">
|
||||
<img t-att-src="kanban_image('res.users', 'image_small', owner)" t-att-data-member_id="owner"/>
|
||||
</t>
|
||||
<a type="object" name="get_granted_employees">
|
||||
<t t-foreach="record.unique_owner_ids.raw_value.slice(0,11)" t-as="owner">
|
||||
<img t-att-src="kanban_image('res.users', 'image_small', owner)" t-att-data-member_id="owner"/>
|
||||
</t>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -30,4 +30,5 @@ This allow the user to send badges to employees instead of simple users.
|
||||
Badge received are displayed on the user profile.""",
|
||||
'data': ['badge_view.xml'],
|
||||
'auto_install': True,
|
||||
'js': ['static/src/js/badges.js'],
|
||||
}
|
||||
|
||||
@@ -61,6 +61,24 @@ class gamification_badge(osv.Model):
|
||||
badge_user.employee_id.id, context=context, **kwargs)
|
||||
return super(gamification_badge, self).message_post(cr, uid, thread_id, context=context, **kwargs)
|
||||
|
||||
def get_granted_employees(self, cr, uid, badge_ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
|
||||
employee_ids = []
|
||||
badge_user_ids = self.pool.get('gamification.badge.user').search(cr, uid, [('badge_id', 'in', badge_ids), ('employee_id', '!=', False)], context=context)
|
||||
for badge_user in self.pool.get('gamification.badge.user').browse(cr, uid, badge_user_ids, context):
|
||||
employee_ids.append(badge_user.employee_id.id)
|
||||
# remove duplicates
|
||||
employee_ids = list(set(employee_ids))
|
||||
return {
|
||||
'type': 'ir.actions.act_window',
|
||||
'name': 'Granted Employees',
|
||||
'view_mode': 'kanban,tree,form',
|
||||
'view_type': 'form',
|
||||
'res_model': 'hr.employee',
|
||||
'domain': [('id', 'in', employee_ids)]
|
||||
}
|
||||
|
||||
class hr_grant_badge_wizard(osv.TransientModel):
|
||||
_name = 'gamification.badge.user.wizard'
|
||||
|
||||
@@ -53,7 +53,16 @@
|
||||
view_type="form" view_mode="form"
|
||||
view_id="gamification.view_badge_wizard_reward"/>
|
||||
|
||||
|
||||
<record id="hr_badge_form_view" model="ir.ui.view">
|
||||
<field name="name">Badge Form</field>
|
||||
<field name="model">gamification.badge</field>
|
||||
<field name="inherit_id" ref="gamification.badge_form_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//div[@class='oe_right oe_button_box']" position="inside">
|
||||
<button string="Granted Employees" type="object" name="get_granted_employees" attrs="{'invisible': [('stat_count','=',0)]}" />
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- HR Employee -->
|
||||
|
||||
|
||||
Reference in New Issue
Block a user