[IMP] better UI

bzr revid: mat@openerp.com-20130411151132-vsk2cnff5uhqmzas
This commit is contained in:
Martin Trigaux 2013-04-11 17:11:32 +02:00
parent d4ccdb46de
commit 28761467fc
7 changed files with 43 additions and 26 deletions

View File

@ -140,7 +140,7 @@ class gamification_badge(osv.Model):
('everyone', 'Everyone'), ('everyone', 'Everyone'),
('users', 'A selected list of users'), ('users', 'A selected list of users'),
('having', 'People having some badges'), ('having', 'People having some badges'),
('nobody', 'Nobody'), ('nobody', 'No one'),
], ],
string="User Authorization Rule", string="User Authorization Rule",
help="Who can grant this badge", help="Who can grant this badge",
@ -153,18 +153,19 @@ class gamification_badge(osv.Model):
string='Required Badges', string='Required Badges',
help="Only the people having these badges can give this badge"), help="Only the people having these badges can give this badge"),
'rule_max': fields.boolean('Limited Sending', 'rule_max': fields.boolean('Monthly Limited Sending',
help="Check to set a monthly limit per person of sending this badge"), help="Check to set a monthly limit per person of sending this badge"),
'rule_max_number': fields.integer('Limitation Number', 'rule_max_number': fields.integer('Limitation Number',
help="The maximum number of time this badge can be sent per month per person."), help="The maximum number of time this badge can be sent per month per person."),
'stat_my_monthly_sending': fields.function(_get_month_my_sent, 'stat_my_monthly_sending': fields.function(_get_month_my_sent,
type="integer",
string='My Monthly Sending Total', string='My Monthly Sending Total',
help="The number of time the current user has sent this badge this month."), help="The number of time the current user has sent this badge this month."),
'rule_automatic': fields.selection([ 'rule_automatic': fields.selection([
('manual', 'Given by Users Only'), ('goals', 'List of goals to reach'),
('goals', 'List of Goals'), ('python', 'Custom python code executed'),
('python', 'Python Code'), ('manual', 'Not automatic'),
], ],
string="Automatic Rule", string="Automatic Rule",
help="Can this badge be automatically rewarded", help="Can this badge be automatically rewarded",
@ -184,16 +185,21 @@ class gamification_badge(osv.Model):
type="many2many", relation="res.users"), type="many2many", relation="res.users"),
'stat_count': fields.function(_get_global_count, string='Total', 'stat_count': fields.function(_get_global_count, string='Total',
type="integer",
help="The number of time this badge has been received."), help="The number of time this badge has been received."),
'stat_count_distinct': fields.function(_get_unique_global_count, 'stat_count_distinct': fields.function(_get_unique_global_count,
string='Unique Count', type="integer",
string='Number of users',
help="The number of time this badge has been received by individual users."), help="The number of time this badge has been received by individual users."),
'stat_this_month': fields.function(_get_month_count, 'stat_this_month': fields.function(_get_month_count,
string='Monthly Count', type="integer",
string='Monthly total',
help="The number of time this badge has been received this month."), help="The number of time this badge has been received this month."),
'stat_my': fields.function(_get_global_my_count, string='My Total', 'stat_my': fields.function(_get_global_my_count, string='My Total',
type="integer",
help="The number of time the current user has received this badge."), help="The number of time the current user has received this badge."),
'stat_my_this_month': fields.function(_get_month_my_count, 'stat_my_this_month': fields.function(_get_month_my_count,
type="integer",
string='My Monthly Total', string='My Monthly Total',
help="The number of time the current user has received this badge this month."), help="The number of time the current user has received this badge this month."),
} }

View File

@ -85,27 +85,33 @@
</h1> </h1>
</div> </div>
<group> <group>
<field name="description" /> <field name="description" nolabel="1" placeholder="Badge Description" />
</group> </group>
<group string="User Rules"> <group string="User Rules">
<field name="rule_auth" string="Allowed to Grant" /> <field name="rule_auth" string="Allowed to Grant" widget="radio" />
<field name="rule_auth_user_ids" attrs="{'invisible': [('rule_auth','!=','users')]}" widget="many2many_tags" /> <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_auth_badge_ids" attrs="{'invisible': [('rule_auth','!=','having')]}" widget="many2many_tags" />
<field name="rule_max" attrs="{'invisible': [('rule_auth','=','nobody')]}" /> <field name="rule_max" attrs="{'invisible': [('rule_auth','=','nobody')]}" />
<field name="rule_max_number" attrs="{'invisible': ['|',('rule_max','=',False),('rule_auth','=','nobody')]}"/> <field name="rule_max_number" attrs="{'invisible': ['|',('rule_max','=',False),('rule_auth','=','nobody')]}"/>
<field name="stat_my_monthly_sending" attrs="{'invisible': [('rule_auth','=','nobody')]}"/>
</group> </group>
<group string="Automatic Rules"> <group string="Automatic Rules">
<field name="rule_automatic"/> <field name="rule_automatic" widget="radio"/>
<field name="compute_code" attrs="{'invisible': [('rule_automatic','!=','python')]}"/> <field name="compute_code" attrs="{'invisible': [('rule_automatic','!=','python')]}"/>
<field name="goal_type_ids" attrs="{'invisible': [('rule_automatic','!=','goals')]}" widget="many2many_tags"/> <field name="goal_type_ids" attrs="{'invisible': [('rule_automatic','!=','goals')]}" widget="many2many_tags"/>
</group> </group>
<group string="Stats"> <group string="Statistics">
<field name="stat_count"/> <group>
<field name="stat_count_distinct"/> <field name="stat_count"/>
<field name="stat_this_month"/> <field name="stat_this_month"/>
<field name="stat_my"/> <field name="stat_count_distinct"/>
<field name="stat_my_this_month"/> </group>
<field name="stat_my_monthly_sending"/> <group>
<field name="stat_my"/>
<field name="stat_my_this_month"/>
</group>
</group> </group>
</sheet> </sheet>
</form> </form>

View File

@ -54,7 +54,7 @@
<group string="Reference"> <group string="Reference">
<field name="type_id" on_change="on_change_type_id(type_id)" attrs="{'readonly':[('state','!=','draft')]}"/> <field name="type_id" on_change="on_change_type_id(type_id)" attrs="{'readonly':[('state','!=','draft')]}"/>
<field name="user_id" attrs="{'readonly':[('state','!=','draft')]}"/> <field name="user_id" attrs="{'readonly':[('state','!=','draft')]}"/>
<field name="planline_id" groups="base.group_no_one" attrs="{'readonly':[('state','!=','draft')]}"/> <field name="plan_id" attrs="{'readonly':[('state','!=','draft')]}"/>
</group> </group>
<group string="Schedule"> <group string="Schedule">
<field name="start_date" attrs="{'readonly':[('state','!=','draft')]}"/> <field name="start_date" attrs="{'readonly':[('state','!=','draft')]}"/>
@ -69,13 +69,16 @@
<field name="last_update" groups="base.group_no_one"/> <field name="last_update" groups="base.group_no_one"/>
</group> </group>
<group string="Data" colspan="4"> <group string="Data" colspan="4">
<field name="target_goal" attrs="{'readonly':[('state','!=','draft')]}"/> <field name="target_goal" attrs="{'readonly':[('state','!=','draft')]}" class="oe_inline"/>
<label for="current" /> <label for="current" />
<div> <div>
<field name="current" attrs="{'readonly':[('computation_mode','!=','manually')]}" class="oe_inline"/> <field name="current" attrs="{'readonly':[('computation_mode','!=','manually')]}" class="oe_inline"/>
<button string="Refresh state" type="object" name="update" class="oe_highlight oe_inline" attrs="{'invisible':['|',('computation_mode', '=', 'manually'),('state', '=', 'draft')]}"/> <button string="Refresh state" type="object" name="update" class="oe_highlight oe_inline" attrs="{'invisible':['|',('computation_mode', '=', 'manually'),('state', '=', 'draft')]}"/>
<button name="write" type="object" string="The current value is up to date" help="Indicate that the current value of the manual goal is still correct and avoid reminders" attrs="{'invisible':['|',('computation_mode','!=', 'manually'),('state','=','draft')]}"/> <button name="write" type="object" string="The current value is up to date" help="Indicate that the current value of the manual goal is still correct and avoid reminders" attrs="{'invisible':['|',('computation_mode','!=', 'manually'),('state','=','draft')]}"/>
</div> </div>
<field name="type_condition"/>
<field name="type_suffix"/>
<field name="type_ponctual"/>
</group> </group>
</group> </group>
</sheet> </sheet>
@ -166,9 +169,9 @@
</t> </t>
<t t-if="record.type_condition.raw_value != 'higher'"> <t t-if="record.type_condition.raw_value != 'higher'">
<div class="oe_goal_state"> <div class="oe_goal_state">
<t t-esc="record.current.raw_value" /><t t-esc="record.target_goal.raw_value" /> <t t-esc="record.current.raw_value" />
</div> </div>
<em>reached when lower than</em> <em>reached when lower than <t t-esc="record.target_goal.raw_value" /></em>
</t> </t>
</t> </t>

View File

@ -1,7 +1,7 @@
/* Kanban views */ /* Kanban views */
.openerp .oe_kanban_view .oe_kanban_card.oe_kanban_goal, .openerp .oe_kanban_view .oe_kanban_card.oe_kanban_goal,
.openerp .oe_kanban_view .oe_kanban_card.oe_kanban_badge { .openerp .oe_kanban_view .oe_kanban_card.oe_kanban_badge {
width: 200px; width: 220px;
min-height: 200px; min-height: 200px;
} }
.oe_kanban_badge_avatars { .oe_kanban_badge_avatars {

View File

@ -123,7 +123,6 @@ openerp.gamification = function(instance) {
if (self.view.dataset.model === 'gamification.goal' && self.$el.find('.oe_goal_gauge').length == 1) { if (self.view.dataset.model === 'gamification.goal' && self.$el.find('.oe_goal_gauge').length == 1) {
var unique_id = _.uniqueId("goal_gauge_"); var unique_id = _.uniqueId("goal_gauge_");
self.$el.find('.oe_goal_gauge').attr('id', unique_id); self.$el.find('.oe_goal_gauge').attr('id', unique_id);
console.log(self.record);
var g = new JustGage({ var g = new JustGage({
id: unique_id, id: unique_id,
node: self.$el.find('.oe_goal_gauge').empty().get(0), node: self.$el.find('.oe_goal_gauge').empty().get(0),

View File

@ -423,13 +423,16 @@
</record> </record>
<record model="ir.actions.act_window" id="gamification.goal_plan_list_action"> <record id="goal_plan_list_action2" model="ir.actions.act_window">
<field name="name">Goal Plans</field>
<field name="domain">[('category', '=', 'hr')]</field> <field name="domain">[('category', '=', 'hr')]</field>
<field name="res_model">gamification.goal.plan</field>
<field name="view_mode">kanban,form</field>
</record> </record>
<menuitem name="Interview Requests" parent="menu_eval_hr" id="menu_open_hr_evaluation_interview_requests" <menuitem name="Interview Requests" parent="menu_eval_hr" id="menu_open_hr_evaluation_interview_requests"
action="action_hr_evaluation_interview_tree"/> action="action_hr_evaluation_interview_tree"/>
<menuitem id="gamification_plan_menu_hr" parent="menu_eval_hr" action="gamification.goal_plan_list_action" groups="gamification.group_goal_manager"/> <menuitem id="gamification_plan_menu_hr" parent="menu_eval_hr" action="goal_plan_list_action2" groups="gamification.group_goal_manager"/>
<menuitem id="gamification_goal_menu_hr" parent="menu_eval_hr" action="goals_menu_groupby_act" groups="gamification.group_goal_manager"/> <menuitem id="gamification_goal_menu_hr" parent="menu_eval_hr" action="goals_menu_groupby_act" groups="gamification.group_goal_manager"/>
<!-- Email Compose message Action--> <!-- Email Compose message Action-->

View File

@ -34,7 +34,7 @@
What are you thank for? What are you thank for?
<group> <group>
<field name="employee_id" invisible="1" /> <field name="employee_id" invisible="1" />
<field name="badge_id" nolabel="1" /> <field name="badge_id" nolabel="1" colspan="4" />
<field name="comment" nolabel="1" placeholder="Describe what they did and why it matters" /> <field name="comment" nolabel="1" placeholder="Describe what they did and why it matters" />
</group> </group>
<footer> <footer>