summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeyur Gajjar <kga@odoo.com>2015-12-14 19:02:31 +0530
committerYannick Tivisse <yti@odoo.com>2016-03-21 14:02:10 +0100
commit82e35bce6c4fa2e6dca98309f7a9483a9a719eb9 (patch)
treebb5773e41a238f252b5a0321a6e9b509350a3805
parentbea7b198621a76f3f29853fc8725e9821ff375cc (diff)
[FIX] gamification: several layout issues
1/ ISSUES WITH BADGES: Go to menu Employees > Badges > Select any Badge from kanban View. Click on "GRANT THIS BADGE" button. - When you grant a badge, the description field is not at the right place. It should be below the employee field - Badges Form View: "Granted Employees" should be a stat button with a counter - Badges form view is broken, field label/values are not at right place 2/ ISSUES WITH CHALLENGES: Go to menu Employees > Challenges Challenges Kanban View - Image Avatars are too big, make it smaller. - Challenges Form View > Advanced Options : fields Report frequency, Report Template and Send a Copy to are ugly
-rw-r--r--addons/gamification/static/src/less/gamification.less3
-rw-r--r--addons/gamification/views/badge.xml44
-rw-r--r--addons/gamification/views/challenge.xml8
-rw-r--r--addons/gamification/wizard/grant_badge.xml6
-rw-r--r--addons/hr_gamification/models/gamification.py10
-rw-r--r--addons/hr_gamification/views/gamification.xml4
6 files changed, 48 insertions, 27 deletions
diff --git a/addons/gamification/static/src/less/gamification.less b/addons/gamification/static/src/less/gamification.less
index a9440f5fd4f..f047f263764 100644
--- a/addons/gamification/static/src/less/gamification.less
+++ b/addons/gamification/static/src/less/gamification.less
@@ -21,6 +21,9 @@
}
}
}
+ .o_kanban_badge_description {
+ padding-bottom: 15px;
+ }
.o_red {
color: red;
}
diff --git a/addons/gamification/views/badge.xml b/addons/gamification/views/badge.xml
index 1ef04703968..a2618ecfa29 100644
--- a/addons/gamification/views/badge.xml
+++ b/addons/gamification/views/badge.xml
@@ -51,27 +51,29 @@
</h1>
</div>
<group>
- <field name="description" nolabel="1" placeholder="Badge Description" />
+ <field name="description" nolabel="1" placeholder="Badge Description"/>
</group>
<group string="Granting">
<div class="oe_grey" colspan="2">
Security rules to define who is allowed to manually grant badges. Not enforced for administrator.
</div>
- <field name="rule_auth" widget="radio" />
- <field name="rule_auth_user_ids" attrs="{'invisible': [('rule_auth','!=','users')]}" widget="many2many_tags" />
- <field name="rule_auth_badge_ids" attrs="{'invisible': [('rule_auth','!=','having')]}" widget="many2many_tags" />
- <field name="rule_max" attrs="{'invisible': [('rule_auth','=','nobody')]}" />
- <field name="rule_max_number" attrs="{'invisible': ['|',('rule_max','=',False),('rule_auth','=','nobody')]}"/>
- <label for="stat_my_monthly_sending"/>
- <div>
- <field name="stat_my_monthly_sending" attrs="{'invisible': [('rule_auth','=','nobody')]}" />
- <div attrs="{'invisible': [('remaining_sending','=',-1)]}" class="oe_grey">
- You can still grant <field name="remaining_sending" class="oe_inline"/> badges this month
- </div>
- <div attrs="{'invisible': [('remaining_sending','!=',-1)]}" class="oe_grey">
- No monthly sending limit
+ <group>
+ <field name="rule_auth" widget="radio"/>
+ <field name="rule_auth_user_ids" attrs="{'invisible': [('rule_auth','!=','users')]}" widget="many2many_tags" />
+ <field name="rule_auth_badge_ids" attrs="{'invisible': [('rule_auth','!=','having')]}" widget="many2many_tags" />
+ <field name="rule_max" attrs="{'invisible': [('rule_auth','=','nobody')]}" />
+ <field name="rule_max_number" attrs="{'invisible': ['|',('rule_max','=',False),('rule_auth','=','nobody')]}"/>
+ <label for="stat_my_monthly_sending"/>
+ <div>
+ <field name="stat_my_monthly_sending" attrs="{'invisible': [('rule_auth','=','nobody')]}" />
+ <div attrs="{'invisible': [('remaining_sending','=',-1)]}" class="oe_grey">
+ You can still grant <field name="remaining_sending" class="oe_inline"/> badges this month
+ </div>
+ <div attrs="{'invisible': [('remaining_sending','!=',-1)]}" class="oe_grey">
+ No monthly sending limit
+ </div>
</div>
- </div>
+ </group>
</group>
<group string="Rewards for challenges">
<field name="challenge_ids" widget="many2many_kanban" nolabel="1" context="{'default_reward_id': active_id}" />
@@ -110,7 +112,7 @@
<field name="rule_max_number" />
<templates>
<t t-name="kanban-box">
- <div t-attf-class="oe_kanban_global_click #{record.stat_my.raw_value ? 'oe_kanban_color_5' : 'oe_kanban_color_white'}">
+ <div t-attf-class="o_kanban_gamification oe_kanban_global_click #{record.stat_my.raw_value ? 'oe_kanban_color_5' : 'oe_kanban_color_white'}">
<div class="o_kanban_image">
<img t-att-src="kanban_image('gamification.badge', 'image', record.image.raw_value)" t-att-title="record.name.value"/>
</div>
@@ -129,12 +131,14 @@
<strong><t t-esc="record.stat_count.raw_value"/></strong> granted,
<strong><t t-esc="record.stat_this_month.raw_value"/></strong> this month
</div>
- <div t-if="record.description.value">
+ <div t-if="record.description.value" class="o_kanban_badge_description">
<em><field name="description"/></em>
+ <div>
+ <t t-foreach="record.unique_owner_ids.raw_value.slice(0,11)" t-as="owner">
+ <img width="24" height="24" class="oe_kanban_avatar" t-att-src="kanban_image('res.users', 'image_small', owner)" t-att-data-member_id="owner"/>
+ </t>
+ </div>
</div>
- <t t-foreach="record.unique_owner_ids.raw_value.slice(0,11)" t-as="owner">
- <img width="24" height="24" class="oe_kanban_avatar" t-att-src="kanban_image('res.users', 'image_small', owner)" t-att-data-member_id="owner"/>
- </t>
<div t-if="record.remaining_sending.value != 0" class="o_kanban_button">
<button type="action" name="%(action_grant_wizard)d" class="oe_highlight btn btn-sm btn-primary">Grant</button>
</div>
diff --git a/addons/gamification/views/challenge.xml b/addons/gamification/views/challenge.xml
index d8ba6619794..c38eb427997 100644
--- a/addons/gamification/views/challenge.xml
+++ b/addons/gamification/views/challenge.xml
@@ -111,9 +111,11 @@
<div class="oe_grey" colspan="4">
<p>Depending on the Display mode, reports will be individual or shared.</p>
</div>
- <field name="report_message_frequency" />
- <field name="report_template_id" attrs="{'invisible': [('report_message_frequency','=','never')]}" />
- <field name="report_message_group_id" attrs="{'invisible': [('report_message_frequency','=','never')]}" />
+ <group colspan="4">
+ <field name="report_message_frequency"/>
+ <field name="report_template_id" attrs="{'invisible': [('report_message_frequency','=','never')]}" />
+ <field name="report_message_group_id" attrs="{'invisible': [('report_message_frequency','=','never')]}" />
+ </group>
</group>
<group string="Reminders for Manual Goals">
<label for="remind_update_delay" />
diff --git a/addons/gamification/wizard/grant_badge.xml b/addons/gamification/wizard/grant_badge.xml
index 58628e26d25..27ea32677c8 100644
--- a/addons/gamification/wizard/grant_badge.xml
+++ b/addons/gamification/wizard/grant_badge.xml
@@ -8,10 +8,10 @@
<field name="arch" type="xml">
<form string="Grant Badge To">
Who would you like to reward?
+ <field name="badge_id" invisible="1"/>
<group>
- <field name="user_id" nolabel="1" />
- <field name="badge_id" invisible="1"/>
- <field name="comment" nolabel="1" placeholder="Describe what they did and why it matters (will be public)" class="oe_no_padding" />
+ <field name="user_id" nolabel="1" colspan="4"/>
+ <field name="comment" nolabel="1" placeholder="Describe what they did and why it matters (will be public)" colspan="4"/>
</group>
<footer>
<button string="Grant Badge" type="object" name="action_grant_badge" class="btn-primary" />
diff --git a/addons/hr_gamification/models/gamification.py b/addons/hr_gamification/models/gamification.py
index 6a483837dfa..034f4e44d85 100644
--- a/addons/hr_gamification/models/gamification.py
+++ b/addons/hr_gamification/models/gamification.py
@@ -49,6 +49,16 @@ class gamification_badge(osv.Model):
'domain': [('id', 'in', employee_ids)]
}
+ def _get_granted_employees_count(self, cr, uid, ids, field_name, arg, context=None):
+ res = {}
+ for badge in self.browse(cr, uid, ids, context=context):
+ res[badge.id] = self.pool.get('gamification.badge.user').search_count(cr, uid, [('badge_id', '=', badge.id), ('employee_id', '!=', False)], context=context)
+ return res
+
+ _columns = {
+ 'granted_employees_count': fields.function(_get_granted_employees_count, type="integer")
+ }
+
class hr_employee(osv.osv):
_name = "hr.employee"
diff --git a/addons/hr_gamification/views/gamification.xml b/addons/hr_gamification/views/gamification.xml
index ed4eb263e1e..7bdfd2134bf 100644
--- a/addons/hr_gamification/views/gamification.xml
+++ b/addons/hr_gamification/views/gamification.xml
@@ -8,7 +8,9 @@
<field name="inherit_id" ref="gamification.badge_form_view"/>
<field name="arch" type="xml">
<div name="button_box" position="inside">
- <button string="Granted Employees" type="object" name="get_granted_employees" attrs="{'invisible': [('stat_count','=',0)]}" />
+ <button class="oe_stat_button" type="object" name="get_granted_employees" attrs="{'invisible': [('stat_count','=',0)]}" icon="fa-user">
+ <field name="granted_employees_count" string="Granted" widget="statinfo"/>
+ </button>
</div>
</field>
</record>