[IMP] fixing and UI

bzr revid: mat@openerp.com-20130410101454-nkt8mbt8qb13zrge
This commit is contained in:
Martin Trigaux 2013-04-10 12:14:54 +02:00
parent 4baed41a12
commit f70b0017f6
11 changed files with 33 additions and 22 deletions

View File

@ -60,6 +60,7 @@
<field name="report_message_frequency">never</field>
<field name="autojoin_group_id" eval="ref('base.group_user')" />
<field name="state">inprogress</field>
<field name="category">other</field>
</record>
<record model="gamification.goal.plan" id="plan_base_configure">
@ -67,8 +68,9 @@
<field name="period">once</field>
<field name="visibility_mode">progressbar</field>
<field name="report_message_frequency">never</field>
<field name="autojoin_group_id" eval="ref('base.group_erp_manager')" />
<field name="user_ids" eval="[(4, ref('base.user_root'))]" />
<field name="state">inprogress</field>
<field name="category">other</field>
</record>
<!-- planlines -->

View File

@ -143,8 +143,7 @@ class gamification_goal_plan(osv.Model):
('progressbar', 'Individual Goals'),
('board', 'Leader Board (Group Ranking)'),
],
string="Display Mode",
required=True),
string="Display Mode", required=True),
'report_message_frequency': fields.selection([
('never','Never'),
('onchange','On change'),
@ -153,8 +152,7 @@ class gamification_goal_plan(osv.Model):
('monthly','Monthly'),
('yearly', 'Yearly')
],
string="Report Frequency",
required=True),
string="Report Frequency", required=True),
'report_message_group_id': fields.many2one('mail.group',
string='Send a copy to',
help='Group that will receive a copy of the report in addition to the user'),
@ -165,6 +163,12 @@ class gamification_goal_plan(osv.Model):
'next_report_date': fields.function(_get_next_report_date,
type='date',
string='Next Report Date'),
'category': fields.selection([
('hr', 'Human Ressources'),
('other', 'Other'),
],
string="Category", help="Only HR plans can be accessed by managers", required=True)
}
_defaults = {
@ -175,6 +179,7 @@ class gamification_goal_plan(osv.Model):
'last_report_date': fields.date.today,
'start_date': fields.date.today,
'manager_id': lambda s, cr, uid, c: uid,
'category': 'hr',
}
def write(self, cr, uid, ids, vals, context=None):

View File

@ -93,7 +93,7 @@
<field name="type_id"/>
<field name="type_condition"/>
<field name="target_goal"/>
<field name="type_unit"/>
<field name="type_full_suffix"/>
</tree>
</field>
</page>
@ -112,6 +112,9 @@
<field name="remind_update_delay" class="oe_inline"/> days
</div>
</group>
<group string="Category" groups="base.group_no_one">
<field name="category" />
</group>
</page>
</notebook>
@ -184,6 +187,8 @@
<search string="Search Goal Plans">
<filter name="draft_inprogress" string="Non-closed Plans"
domain="[('state', 'in', ('inprogress', 'draft'))]"/>
<filter name="hr_plans" string="HR Plans"
domain="[('category', '=', 'hr')]"/>
<field name="name"/>
<group expand="0" string="Group By...">
<filter string="State" domain="[]" context="{'group_by':'state'}"/>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" ?>
<openerp>
<data>
<data noupdate="1">
<record model="ir.module.category" id="module_goal_category">
<field name="name">Gamification</field>
<field name="description"></field>
@ -11,9 +11,7 @@
<field name="category_id" ref="module_goal_category"/>
<field name="users" eval="[(4, ref('base.user_root'))]"/>
</record>
</data>
<data noupdate="0">
<record id="goal_user_visibility" model="ir.rule">
<!-- TODO fix private for board -->
<field name="name">User can only see his/her goals or goal from the same plan in board visibility</field>

View File

@ -2,7 +2,7 @@
.openerp .oe_kanban_view .oe_kanban_card.oe_kanban_goal,
.openerp .oe_kanban_view .oe_kanban_card.oe_kanban_badge {
width: 220px;
min-height: 160px;
min-height: 150px;
}
.oe_kanban_badge_avatars {

View File

@ -125,14 +125,14 @@ openerp.gamification = function(instance) {
if (self.view.dataset.model === 'gamification.goal' && self.$el.find('.oe_goal_gauge').length == 1) {
var unique_id = _.uniqueId("goal_gauge_");
self.$el.find('.oe_goal_gauge').attr('id', unique_id);
console.log(self.record);
var g = new JustGage({
id: unique_id,
node: self.$el.find('.oe_goal_gauge').empty().get(0),
value: self.record.current.raw_value,
min: 0,
max: self.record.target_goal.raw_value,
title: self.record.type_id.value,
// title: self.record.type_id.value,
relativeGaugeSize: true,
levelColors: [
"#f9c802",

View File

@ -10,14 +10,11 @@
<t t-if="plan.visibility_mode == 'progressbar'">
<ul class="oe_goals_list">
<li t-foreach="plan.goals" t-as="goal">
<span class="oe_goal_sparkline_piechart"></span>
<strong t-attf-class="#{goal.state == 'reached' ? 'oe_goal_reached' : goal.state == 'failed' ? 'oe_goal_failed' : ''}" t-att-title="goal.type_description"><t t-esc="goal.type_name" /></strong>
<t t-if="goal.computation_mode == 'manually' or goal.type_action">
<a class="oe_goal_action" t-att-id="goal.id">modify</a>
</t>
<!-- <t t-if="goal.type_description">
<a class="oe_show_description" t-att-id="goal.id">?</a>
<p t-att-class="'oe_type_description oe_type_description_' + goal.id"><t t-esc="goal.type_description" /></p>
</t> -->
<t t-if="goal.type_condition == 'higher'">
<p>
<t t-esc="goal.current" />/<span t-attf-class="#{goal.type_monetary ? 'oe_goal_field_monetary' : ''}"><t t-esc="goal.target_goal"/></span>

View File

@ -109,13 +109,13 @@ class hr_employee(osv.osv):
"""Return the list of goals assigned to the employee"""
res = {}
for employee in self.browse(cr, uid, ids, context=context):
res[employee.id] = self.pool.get('gamification.goal').search(cr,uid,[('user_id','=',employee.user_id.id)], context=context)
res[employee.id] = self.pool.get('gamification.goal').search(cr,uid,[('user_id', '=', employee.user_id.id), ('plan_id.category', '=', 'hr')], context=context)
return res
_columns = {
'evaluation_plan_id': fields.many2one('hr_evaluation.plan', 'Appraisal Plan'),
'evaluation_date': fields.date('Next Appraisal Date', help="The date of the next appraisal is computed by the appraisal plan's dates (first appraisal + periodicity)."),
'goal_ids': fields.function(_get_employee_goals, type="one2many", obj='gamification.goal', string="Employee Goals")
'goal_ids': fields.function(_get_employee_goals, type="one2many", obj='gamification.goal', string="Employee HR Goals")
}
def run_employee_evaluation(self, cr, uid, automatic=False, use_new_cursor=False, context=None):
now = parser.parse(datetime.now().strftime('%Y-%m-%d'))

View File

@ -419,11 +419,17 @@
<field name="name">Goals History</field>
<field name="view_mode">tree,kanban</field>
<field name="context">{'search_default_group_by_user': True, 'search_default_group_by_type': True}</field>
<field name="domain">[('plan_id.category', '=', 'hr')]</field>
</record>
<record model="ir.actions.act_window" id="gamification.goal_plan_list_action">
<field name="domain">[('category', '=', 'hr')]</field>
</record>
<menuitem name="Interview Requests" parent="menu_eval_hr" id="menu_open_hr_evaluation_interview_requests"
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="gamification.goal_plan_list_action" 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-->

View File

@ -105,7 +105,6 @@ class hr_grant_badge_wizard(osv.TransientModel):
badge_obj.send_badge(cr, uid, wiz.badge_id.id, [badge_user], user_from=user_from, context=context)
return {}
hr_grant_badge_wizard()
class hr_employee(osv.osv):

View File

@ -67,14 +67,13 @@
<page string="Received Badges">
<button string="Grant a Badge" type="action" name="%(action_reward_wizard)d"/> to reward this employee for a good action
<div class="oe_view_nocontent" attrs="{'invisible': [('badge_ids', '!=', False)]}">
<div class="oe_view_nocontent" attrs="{'invisible': [('badge_ids','!=',[])]}">
<p class="oe_view_nocontent_create">
Click to grant this employee his first badge
</p><p class="oe_grey">
Badges are rewards of good work. Give them to people you believe deserve it.
</p>
</div>
<field name="badge_ids" widget="many2many_kanban" />
</page>
</xpath>