[FIX] grant badge button and action

bzr revid: mat@openerp.com-20130329130714-suw4c3y0856rfg1h
This commit is contained in:
Martin Trigaux 2013-03-29 14:07:14 +01:00
parent 59c61a7554
commit 6305bfeb3c
4 changed files with 8 additions and 8 deletions

View File

@ -368,7 +368,7 @@ class grant_badge_wizard(osv.TransientModel):
_name = 'gamification.badge.user.wizard'
_columns = {
'user_id': fields.many2one("res.users", string='User', required=True),
'badge_id': fields.many2one("gamification.badge", string='Badge'),
'badge_id': fields.many2one("gamification.badge", string='Badge', required=True),
'comment': fields.text('Comment'),
}

View File

@ -43,7 +43,8 @@
target="new"
res_model="gamification.badge.user.wizard"
context="{'default_badge_id': active_id, 'badge_id': active_id}"
view_type="form" view_mode="form"/>
view_type="form" view_mode="form"
view_id="gamification.view_badge_wizard_grant" />
<record id="badge_list_view" model="ir.ui.view">
<field name="name">Badge List</field>
@ -65,7 +66,7 @@
<field name="arch" type="xml">
<form string="Badge" version="7.0">
<header>
<button string="Send this Badge" type="action" name="%(action_grant_wizard)d" class="oe_highlight" attrs="{'invisible': [
<button string="Grant this Badge" type="action" name="%(action_grant_wizard)d" class="oe_highlight" attrs="{'invisible': [
'|',
('rule_auth', '=', 'nobody'),
'&amp;',

View File

@ -69,9 +69,7 @@ class hr_grant_badge_wizard(osv.TransientModel):
'employee_id': fields.many2one("hr.employee", string='Employee', required=True),
'user_id': fields.related("employee_id", "user_id",
type="many2one", relation="res.users",
store=True, string='User'),
'badge_id': fields.many2one("gamification.badge", string='Badge'),
'comment': fields.text('Comment'),
store=True, string='User')
}
def action_grant_badge(self, cr, uid, ids, context=None):

View File

@ -50,7 +50,8 @@
target="new"
res_model="gamification.badge.user.wizard"
context="{'default_employee_id': active_id, 'employee_id': active_id}"
view_type="form" view_mode="form"/>
view_type="form" view_mode="form"
view_id="gamification.view_badge_wizard_reward"/>
@ -62,7 +63,7 @@
<field name="inherit_id" ref="hr.view_employee_form"/>
<field name="arch" type="xml">
<xpath expr="//div[@name='button_box']" position="inside">
<button string="Send Reward" type="action" name="%(action_reward_wizard)d" />
<button string="Grant Badge" type="action" name="%(action_reward_wizard)d" />
</xpath>
<xpath expr="//page[@string='Public Information']" position="before">
<page string="Received Badges">