[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
This commit is contained in:
committed by
Yannick Tivisse
parent
bea7b19862
commit
82e35bce6c
@@ -21,6 +21,9 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
.o_kanban_badge_description {
|
||||
padding-bottom: 15px;
|
||||
}
|
||||
.o_red {
|
||||
color: red;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
<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 attrs="{'invisible': [('remaining_sending','!=',-1)]}" class="oe_grey">
|
||||
No monthly sending limit
|
||||
</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>
|
||||
|
||||
@@ -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" />
|
||||
|
||||
@@ -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" />
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user