[IMP] better UI

bzr revid: mat@openerp.com-20130408131729-lhlv0mhss502j9m1
This commit is contained in:
Martin Trigaux 2013-04-08 15:17:29 +02:00
parent 8c07975c91
commit 32b523c1d6
10 changed files with 217 additions and 207 deletions

View File

@ -41,49 +41,46 @@ class gamification_goal_type(osv.Model):
_description = 'Gamification goal type'
_columns = {
'name': fields.char('Type Name', required=True, translate=True),
'description': fields.text('Description'),
'monetary': fields.boolean('Use Currency', help="The target and current value used is monetary"),
'unit': fields.char('Unit',
'name': fields.char('Goal Type Name', required=True, translate=True),
'description': fields.text('Goal Description'),
'monetary': fields.boolean('Monetary Value', help="The target and current value are defined in the company currency."),
'unit': fields.char('Suffix',
help="The unit of the target and current values", translate=True),
'computation_mode': fields.selection([
('sum', 'Sum'),
('count', 'Count'),
('manually', 'Manually')
('manually', 'Recorded manually'),
('count', 'Automatic: number of records'),
('sum', 'Automatic: sum on a field'),
],
string="Mode of Computation",
help="""How is computed the goal value :\n
- 'Sum' for the total of the values if the 'Evaluated field'\n
- 'Count' for the number of entries\n
- 'Manually' for user defined values""",
string="Computation Mode",
required=True),
'model_id': fields.many2one('ir.model',
string='Model',
help='The model object for the field to evaluate'),
'field_id': fields.many2one('ir.model.fields',
string='Evaluated Field',
string='Field to Sum',
help='The field containing the value to evaluate'),
'field_date_id': fields.many2one('ir.model.fields',
string='Evaluated Date Field',
string='Date Field',
help='The date to use for the time period evaluated'),
'domain': fields.char("Domain",
'domain': fields.char("Filter Domain",
help="Technical filters rules to apply",
required=True), # how to apply it ?
'condition': fields.selection([
('lower', '<='),
('higher', '>=')
('higher', 'The higher the better'),
('lower', 'The lower the better')
],
string='Validation Condition',
string='Goal Performance',
help='A goal is considered as completed when the current value is compared to the value to reach',
required=True),
'sequence': fields.integer('Sequence',
help='Sequence number for ordering',
required=True),
'action_id': fields.char("Action",
help="The action xml id that will be called to update the goal value."),
'res_id_field': fields.char("id field",
help="The field name on the user profile containing the value for res_id for action")
'action_id': fields.many2one('ir.actions.act_window',
string="Action",
help="The action that will be called to update the goal value."),
'res_id_field': fields.char("ID Field of user",
help="The field name on the user profile (res.users) containing the value for res_id for action.")
}
_order = 'sequence'
@ -321,26 +318,34 @@ class gamification_goal(osv.Model):
In case of a manual goal, should return a wizard to update the value
:return: action description in a dictionnary
"""
print("get_action")
goal = self.browse(cr, uid, goal_id, context=context)
if goal.type_id.action_id:
try:
model, xml_id = goal.type_id.action_id.split('.', 1)
action = self.pool.get('ir.actions.act_window').for_xml_id(cr, uid, model, xml_id, context=context)
action_obj = goal.type_id.action_id
action = {
'name': action_obj.name,
'view_type': action_obj.view_type,
'view_mode': action_obj.view_mode,
'res_model': action_obj.res_model,
'domain': action_obj.domain,
'context': action_obj.context,
'type': 'ir.actions.act_window',
'search_view_id': action_obj.search_view_id.id,
'views': [(v.view_id.id, v.view_mode) for v in action_obj.view_ids]
}
if goal.type_id.res_id_field:
current_user = self.pool.get('res.users').browse(cr, uid, uid, context)
# eg : company_id.id
field_names = goal.type_id.res_id_field.split('.')
res = current_user.__getitem__(field_names[0])
for field_name in field_names[1:]:
res = res.__getitem__(field_name)
action['res_id'] = res
action['view_mode'] = 'form' # if one element to display, should see it in form mode
action['target'] = 'new'
print(action)
return action
except ValueError:
_logger.warning("Invalid XML ID '%s' for goal action.", goal.type_id.action_id)
if goal.type_id.res_id_field:
current_user = self.pool.get('res.users').browse(cr, uid, uid, context)
# eg : company_id.id
field_names = goal.type_id.res_id_field.split('.')
res = current_user.__getitem__(field_names[0])
for field_name in field_names[1:]:
res = res.__getitem__(field_name)
action['res_id'] = res
action['view_mode'] = 'form' # if one element to display, should see it in form mode
action['target'] = 'new'
print(action)
return action
if goal.computation_mode == 'manually':
action = {
@ -352,9 +357,7 @@ class gamification_goal(osv.Model):
}
action['context'] = {'default_goal_id': goal_id, 'default_current': goal.current}
action['res_model'] = 'gamification.goal.wizard'
print(action)
return action
print(False)
return False
def changed_users_avatar(self, cr, uid, ids, context):

View File

@ -9,7 +9,7 @@
<field name="computation_mode">count</field>
<field name="model_id" eval="ref('base.model_res_users')" />
<field name="domain">[('id','=',user_id),('partner_id.tz', '!=', False)]</field>
<field name="action_id">base.action_res_users_my</field>
<field name="action_id" eval="ref('base.action_res_users_my')" />
<field name="res_id_field">id</field>
</record>
@ -18,7 +18,7 @@
<field name="description">In your user perference</field>
<field name="computation_mode">manually</field>
<!-- problem : default avatar != False -> manually + check in write function -->
<field name="action_id">base.action_res_users_my</field>
<field name="action_id" eval="ref('base.action_res_users_my')" />
<field name="res_id_field">id</field>
</record>
@ -29,7 +29,7 @@
<field name="computation_mode">count</field>
<field name="model_id" eval="ref('base.model_res_company')" />
<field name="domain">[('user_ids', 'in', user_id), ('name', '!=', 'Your Company')]</field>
<field name="action_id">base.action_res_company_form_my</field>
<field name="action_id" eval="ref('base.action_res_company_form_my')" />
<field name="res_id_field">company_id.id</field>
</record>
@ -38,7 +38,7 @@
<field name="computation_mode">count</field>
<field name="model_id" eval="ref('base.model_res_company')" />
<field name="domain">[('user_ids', 'in', user_id),('logo', '!=', False)]</field>
<field name="action_id">base.action_res_company_form</field>
<field name="action_id" eval="ref('base.action_res_company_form')" />
<field name="res_id_field">company_id.id</field>
</record>

View File

@ -114,6 +114,7 @@
<field name="user_id"/>
<field name="type_id"/>
<field name="plan_id"/>
<group expand="0" string="Group By...">
<filter name="group_by_user" string="User" domain="[]" context="{'group_by':'user_id'}"/>
<filter name="group_by_type" string="Goal Type" domain="[]" context="{'group_by':'type_id'}"/>
@ -203,31 +204,36 @@
<field name="arch" type="xml">
<form string="Goal types" version="7.0">
<sheet>
<label for="name" class="oe_edit_only"/>
<h1>
<field name="name"/>
</h1>
<group>
<group string="General">
<field name="description" string="Tooltip"/>
<field name="condition"/>
<field name="monetary" />
<field name="unit" attrs="{'invisible': [('monetary', '=', True)]}"/>
</group>
<group string="Computation">
<label for="name" class="oe_edit_only"/>
<h1>
<field name="name" class="oe_inline"/>
</h1>
<label for="description" class="oe_edit_only"/>
<div>
<field name="description" class="oe_inline"/>
</div>
<group string="How to compute the goal?">
<field widget="radio" name="computation_mode"/>
<!-- Hide the fields below if manually -->
<field name="model_id" attrs="{'invisible':[('computation_mode','=','manually')], 'required':[('computation_mode','!=','manually')]}"/>
<field name="field_id" attrs="{'invisible':[('computation_mode','!=','sum')], 'required':[('computation_mode','=','sum')]}" domain="[('model_id','=',model_id)]" />
<field name="field_date_id" attrs="{'invisible':[('computation_mode','=','manually')]}" domain="[('ttype', 'in', ('date', 'datetime')), ('model_id','=',model_id)]"/>
<field name="domain" attrs="{'invisible':[('computation_mode','=','manually')], 'required':[('computation_mode','!=','manually')]}"/>
<field name="model_id" attrs="{'invisible':[('computation_mode','=','manually')], 'required':[('computation_mode','!=','manually')]}" class="oe_inline"/>
<field name="field_id" attrs="{'invisible':[('computation_mode','!=','sum')], 'required':[('computation_mode','=','sum')]}" domain="[('model_id','=',model_id)]" class="oe_inline"/>
<field name="field_date_id" attrs="{'invisible':[('computation_mode','=','manually')]}" domain="[('ttype', 'in', ('date', 'datetime')), ('model_id','=',model_id)]" class="oe_inline"/>
<field name="domain" attrs="{'invisible':[('computation_mode','=','manually')], 'required':[('computation_mode','!=','manually')]}" class="oe_inline"/>
<field name="condition" widget="radio"/>
</group>
<group string="User Action">
<field name="action_id" />
<field name="res_id_field" />
<group string="Formating Options">
<field name="unit" class="oe_inline"/>
<field name="monetary" class="oe_inline"/>
</group>
</group>
<group string="Clickable Goals">
<field name="action_id" class="oe_inline"/>
<field name="res_id_field" attrs="{'invisible': [('action_id', '=', False)]}" class="oe_inline"/>
</group>
</sheet>
</form>
</field>

View File

@ -96,23 +96,41 @@ class gamification_goal_plan(osv.Model):
return res
def _planline_count(self, cr, uid, ids, field_name, arg, context=None):
res = dict.fromkeys(ids, 0)
for plan in self.browse(cr, uid, ids, context):
res[plan.id] = len(plan.planline_ids)
return res
_columns = {
'name': fields.char('Plan Name', required=True, translate=True),
'state': fields.selection([
('draft', 'Draft'),
('inprogress', 'In Progress'),
('done', 'Done'),
],
string='State',
required=True),
'manager_id': fields.many2one('res.users',
string='Responsible', help="The user responsible for the plan."),
'start_date': fields.date('Planned Start Date', help="The day a new plan will be automatically started. The start and end dates for goals are still defined by the periodicity (eg: weekly goals run from Monday to Sunday)."),
'user_ids': fields.many2many('res.users',
string='Users',
help="List of users to which the goal will be set"),
'manager_id': fields.many2one('res.users', required=True,
string='Responsible', help="The user responsible for the plan."),
'autojoin_group_id': fields.many2one('res.groups',
string='Auto-subscription Group',
help='Group of users whose members will automatically be added to the users'),
'planline_ids': fields.one2many('gamification.goal.planline',
'plan_id',
string='Planline',
help="list of goals that will be set",
required=True),
'autojoin_group_id': fields.many2one('res.groups',
string='Auto-subscription Group',
help='Group of users whose members will automatically be added to the users'),
'planline_count': fields.function(_planline_count, type='integer', string="Planlines"),
'period': fields.selection([
('once', 'No Periodicity'),
('once', 'Non recurring'),
('daily', 'Daily'),
('weekly', 'Weekly'),
('monthly', 'Monthly'),
@ -121,20 +139,11 @@ class gamification_goal_plan(osv.Model):
string='Periodicity',
help='Period of automatic goal assigment. If none is selected, should be launched manually.',
required=True),
'start_date': fields.date('Starting Date', help="The day a new plan will be automatically started. The start and end dates for goals are still defined by the periodicity (eg: weekly goals run from Monday to Sunday)."),
'state': fields.selection([
('draft', 'Draft'),
('inprogress', 'In Progress'),
('done', 'Done'),
],
string='State',
required=True),
'visibility_mode': fields.selection([
('board', 'Leader Board'),
('progressbar', 'Personal Progressbar')
('progressbar', 'Individual Goals'),
('board', 'Leader Board (Group Ranking)'),
],
string="Visibility",
help='How are displayed the results, shared or in a single progressbar',
string="Display Mode",
required=True),
'report_message_frequency': fields.selection([
('never','Never'),
@ -150,8 +159,8 @@ class gamification_goal_plan(osv.Model):
string='Send a copy to',
help='Group that will receive a copy of the report in addition to the user'),
'report_header': fields.text('Report Header'),
'remind_update_delay': fields.integer('Remind delay for Manual Goals',
help="The number of days after which the user assigned to a manual goal will be reminded. Never reminded if no value or zero is specified."),
'remind_update_delay': fields.integer('Non-updated manual goals will be reminded after',
help="Never reminded if no value or zero is specified."),
'last_report_date': fields.date('Last Report Date'),
'next_report_date': fields.function(_get_next_report_date,
type='date',
@ -163,9 +172,9 @@ class gamification_goal_plan(osv.Model):
'state': 'draft',
'visibility_mode' : 'progressbar',
'report_message_frequency' : 'onchange',
'last_report_date' : fields.date.today,
'start_date' : fields.date.today,
'manager_id' : lambda s, cr, uid, c: uid,
'last_report_date': fields.date.today,
'start_date': fields.date.today,
'manager_id': lambda s, cr, uid, c: uid,
}
def write(self, cr, uid, ids, vals, context=None):
@ -228,7 +237,6 @@ class gamification_goal_plan(osv.Model):
for plan in self.browse(cr, uid, ids, context=context):
if plan.autojoin_group_id:
print("subscribe from group", plan.autojoin_group_id, [user.id for user in plan.autojoin_group_id.users])
self.plan_subscribe_users(cr, uid, ids, [user.id for user in plan.autojoin_group_id.users], context=context)
self.generate_goals_from_plan(cr, uid, [plan.id], context=context)
@ -305,30 +313,6 @@ class gamification_goal_plan(osv.Model):
return True
def action_show_related_goals(self, cr, uid, ids, context=None):
""" This opens goal view with a restriction to the list of goals from this plan only
@return: the goal view
"""
# get ids of related goals
goal_obj = self.pool.get('gamification.goal')
related_goal_ids = []
goal_ids = goal_obj.search(cr, uid, [('plan_id', 'in', ids)], context=context)
for plan in self.browse(cr, uid, ids, context=context):
for planline in plan.planline_ids:
goal_ids = goal_obj.search(cr, uid, [('planline_id', '=', planline.id)], context=context)
related_goal_ids.extend(goal_ids)
# process the new view
if context is None:
context = {}
res = self.pool.get('ir.actions.act_window').for_xml_id(cr, uid ,'gamification','goals_from_plan_act', context=context)
res['context'] = context
res['context'].update({
'default_id': related_goal_ids,
})
res['domain'] = [('id','in', related_goal_ids)]
return res
def action_report_progress(self, cr, uid, ids, context=None):
"""Manual report of a goal, does not influence automatic report frequency"""
for plan in self.browse(cr, uid, ids, context):
@ -588,4 +572,5 @@ class gamification_goal_planline(osv.Model):
'type_condition': fields.related('type_id', 'condition', type="selection",
readonly=True, string="Condition", selection=[('lower', '<='), ('higher', '>=')]),
'type_unit': fields.related('type_id', 'unit', type="char", readonly=True, string="Unit"),
'type_monetary': fields.related('type_id', 'monetary', type="boolean", readonly=True, string="Monetary"),
}

View File

@ -5,7 +5,7 @@
<record id="goal_plan_list_action" model="ir.actions.act_window">
<field name="name">Goal Plans</field>
<field name="res_model">gamification.goal.plan</field>
<field name="view_mode">tree,form</field>
<field name="view_mode">kanban,tree,form</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to create a goal plan.
@ -34,9 +34,15 @@
<record id="goals_from_plan_act" model="ir.actions.act_window">
<field name="res_model">gamification.goal</field>
<field name="view_type">form</field>
<field name="name">Related Goals</field>
<field name="view_mode">kanban,tree,form</field>
<field name="view_mode">kanban,tree</field>
<field name="context">{'search_default_group_by_type': True, 'search_default_inprogress': True, 'default_plan_id': active_id}</field>
<field name="help" type="html">
<p>
There is no goals associated to this plan matching your search.
Make sure that your plan is active and associated to at least one user.
</p>
</field>
</record>
<record id="goal_plan_form_view" model="ir.ui.view">
@ -45,7 +51,7 @@
<field name="arch" type="xml">
<form string="Goal types" version="7.0">
<header>
<button string="Manual Start" type="object" name="action_start" states="draft" class="oe_highlight"/>
<button string="Start Now" type="object" name="action_start" states="draft" class="oe_highlight"/>
<button string="Check Plan" type="object" name="action_check" states="inprogress"/>
<button string="Close Plan" type="object" name="action_close" states="inprogress" class="oe_highlight"/>
<button string="Reset to Draft" type="object" name="action_cancel" states="inprogress"/>
@ -54,88 +60,62 @@
<field name="state" widget="statusbar"/>
</header>
<sheet>
<div class="oe_title">
<label for="name" class="oe_edit_only"/>
<h1>
<field name="name" attrs="{'readonly':[('state','!=','draft')]}"/>
<field name="name" placeholder="e.g. Monthly Sales Objectives"/>
</h1>
<label for="user_ids" class="oe_edit_only" string="Apply Plan To"/>
<div>
<field name="user_ids" widget="many2many_tags" />
</div>
</div>
<!-- action buttons -->
<div class="oe_right oe_button_box">
<button name="action_show_related_goals" type="object" string="Related Goals" help="show all the generated goals for this plan" context="{'search_default_group_by_user': True}" />
<button type="action" name="%(goals_from_plan_act)d" string="Related Goals" attrs="{'invisible': [('state','=','draft')]}" />
</div>
<group colspan="2">
<field name="manager_id" />
<group>
<group>
<field name="period" attrs="{'readonly':[('state','!=','draft')]}"/>
<field name="visibility_mode" widget="radio" colspan="1" />
</group>
<group>
<field name="manager_id"/>
<field name="start_date" attrs="{'readonly':[('state','!=','draft')]}"/>
</group>
</group>
<group colspan="2">
<field name="start_date" attrs="{'readonly':[('state','!=','draft')]}"/>
<field name="period" attrs="{'readonly':[('state','!=','draft')]}"/>
</group>
<group string="Evaluated Users">
<group colspan="4">
<notebook>
<page string="Goals">
<field name="planline_ids" nolabel="1" colspan="4">
<tree string="Planline List" version="7.0" editable="bottom" >
<field name="type_id"/>
<field name="type_condition"/>
<field name="target_goal"/>
<field name="type_unit"/>
</tree>
</field>
</page>
<page string="Advanced Options">
<group string="Subscribe Users Automatically">
<field name="autojoin_group_id" />
</group>
<group colspan="4">
<field name="user_ids" widget="many2many_kanban">
<kanban quick_create="false" create="true">
<field name="name"/>
<templates>
<t t-name="kanban-box">
<div style="position: relative">
<a t-if="! read_only_mode" type="delete" style="position: absolute; right: 0; padding: 4px; diplay: inline-block">X</a>
<div class="oe_module_vignette">
<div class="oe_module_desc">
<field name="name"/>
</div>
</div>
</div>
</t>
</templates>
</kanban>
</field>
<group string="Notification Messages">
<field name="report_message_frequency" />
<field name="report_header" placeholder="e.g. The following message contains the current progress of the sale team..." 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" />
<div>
<field name="remind_update_delay" class="oe_inline"/> days
</div>
</group>
</page>
</notebook>
<group string="Goals">
<field name="planline_ids" nolabel="1" colspan="4" />
<label for="visibility_mode" colspan="1"/>
<div>
<field name="visibility_mode" widget="radio" colspan="1" />
<group name="visibility_mode_help" class="oe_grey oe_edit_only" colspan="2">
<p attrs="{'invisible': [('visibility_mode','!=','board')]}">
In Leaderboard mode, the reports will contain the progress of users of this plan.
</p>
<p attrs="{'invisible': [('visibility_mode','!=','progressbar')]}">
In Personal Progressbar mode, the progress of each user can only be seen by himself and the followers of this plan.
</p>
</group>
</div>
<label for="remind_update_delay"/>
<div>
<field name="remind_update_delay" class="oe_inline"/> days
</div>
</group>
<group string="Notification Message" colspan="4">
<field name="report_message_frequency" />
<field name="report_header" attrs="{'invisible': [('report_message_frequency','=','never')]}" />
<label for="report_message_group_id" attrs="{'invisible': [('report_message_frequency','=','never')]}" />
<div attrs="{'invisible': [('report_message_frequency','=','never')]}" >
<field name="report_message_group_id" />
<group name="report_help" class="oe_grey oe_edit_only" col="2" colspan="2">
<p attrs="{'invisible': [('report_message_group_id','!=',False)]}">
Select a group that will receive a copy of the reports.
</p>
<p attrs="{'invisible': [('report_message_group_id','=',False)]}">
A copy of the report will be sent to this group.
</p>
</group>
</div>
</group>
</sheet>
<div class="oe_chatter">
<field name="message_follower_ids" widget="mail_followers"/>
@ -145,6 +125,44 @@
</field>
</record>
<record model="ir.ui.view" id="view_goal_plan_kanban">
<field name="name">Goal Plan Kanban</field>
<field name="model">gamification.goal.plan</field>
<field name="arch" type="xml">
<kanban version="7.0" class="oe_background_grey">
<field name="planline_ids"/>
<field name="planline_count"/>
<field name="user_ids"/>
<templates>
<t t-name="kanban-box">
<div t-attf-class="oe_kanban_card oe_kanban_goal oe_kanban_global_click">
<div class="oe_dropdown_toggle oe_dropdown_kanban">
<span class="oe_e">í</span>
<ul class="oe_dropdown_menu">
<li><a type="edit">Configure Goal Plan</a></li>
</ul>
</div>
<div class="oe_kanban_content">
<h4><field name="name"/></h4>
<div class="oe_kanban_project_list">
<a type="action" name="%(goals_from_plan_act)d" style="margin-right: 10px">
<span t-if="record.planline_count.raw_value gt 1"><field name="planline_count"/> Goals</span>
<span t-if="record.planline_count.raw_value lt 2"><field name="planline_count"/> Goal</span>
</a>
</div>
<div class="oe_kanban_badge_avatars">
<t t-foreach="record.user_ids.raw_value.slice(0,11)" t-as="member">
<img t-att-src="kanban_image('res.users', 'image_small', member)" t-att-data-member_id="member"/>
</t>
</div>
</div>
</div>
</t>
</templates>
</kanban>
</field>
</record>
<!-- Planline -->
<record id="goal_planline_list_view" model="ir.ui.view">
@ -153,9 +171,7 @@
<field name="arch" type="xml">
<tree string="planline list" >
<field name="type_id"/>
<field name="type_condition"/>
<field name="target_goal"/>
<field name="type_unit"/>
</tree>
</field>
</record>

View File

@ -50,13 +50,14 @@ class res_users_gamification_group(osv.Model):
serialized_goals_info['planlines'] = []
for planline_board in goals_info:
print("planline_board", planline_board.name)
vals = {'type_name': planline_board['goal_type'].name,
'type_description': planline_board['goal_type'].description,
'type_condition': planline_board['goal_type'].condition,
'type_computation_mode': planline_board['goal_type'].computation_mode,
'type_monetary': planline_board['goal_type'].monetary,
'type_unit': planline_board['goal_type'].unit,
'type_action': planline_board['goal_type'].action_id,
'type_action': True if planline_board['goal_type'].action_id else False,
'goals': []}
for goal in planline_board['board_goals']:
vals['goals'].append({
@ -84,6 +85,7 @@ class res_users_gamification_group(osv.Model):
serialized_goals_info['goals'] = []
for goal in goals_info['goals']:
print("goal", goal.type_id.name)
serialized_goals_info['goals'].append({
'id': goal.id,
'type_name': goal.type_id.name,
@ -91,13 +93,14 @@ class res_users_gamification_group(osv.Model):
'type_condition': goal.type_id.condition,
'type_monetary': goal.type_id.monetary,
'type_unit': goal.type_id.unit,
'type_action': goal.type_id.action_id,
'type_action': True if goal.type_id.action_id else False,
'state': goal.state,
'completeness': goal.completeness,
'computation_mode': goal.computation_mode,
'current': goal.current,
'target_goal': goal.target_goal,
})
print("goal", True if goal.type_id.action_id else False)
all_goals_info.append(serialized_goals_info)
return all_goals_info

View File

@ -1,7 +1,8 @@
/* Kanban views */
.openerp .oe_notebook_page .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 {
width: 220px;
min-height: 160px;
}
.openerp .oe_kanban_view .oe_kanban_card.oe_kanban_color_reached {
background-color: #A1FF81;
@ -18,7 +19,9 @@
font-size: 0.9em;
}
.oe_kanban_badge_avatars {
margin-top: 8px;
}
.oe_kanban_badge_avatars img {
width: 30px;
height: 30px;
@ -29,6 +32,7 @@
}
/* Mail Sidebar */
.openerp .oe_mail_wall .oe_mail_wall_aside {

View File

@ -27,13 +27,10 @@ openerp.gamification = function(instance) {
self.get_goal_todo_info();
});
},
// 'click a.oe_show_description': function(event) {
// var goal_id = parseInt(event.currentTarget.id);
// this.$el.find('.oe_type_description_'+goal_id).toggle(10);
// },
'click a.oe_goal_action': function(event) {
var self = this;
var goal_id = parseInt(event.currentTarget.id, 10);
console.log("oe_goal_action");
var goal_action = new instance.web.Model('gamification.goal').call('get_action', [goal_id]).then(function(res) {
goal_action['action'] = res;
});
@ -62,13 +59,13 @@ openerp.gamification = function(instance) {
},
get_goal_todo_info: function() {
var self = this;
console.log("get_goal_todo_info");
var goals_info = this.res_user.call('get_goals_todo_info', {}).then(function(res) {
self.goals_info['info'] = res;
});
$.when(goals_info).done(function() {
if(self.goals_info.info.length > 0){
self.render_template_replace(self.$el.filter(".oe_gamification_goal"),'gamification.goal_list_to_do');
self.$el.find('.oe_type_description').hide();
self.render_money_fields(self.goals_info.info[0].currency);
self.render_progress_bars();
}
@ -116,6 +113,7 @@ openerp.gamification = function(instance) {
start: function() {
this._super();
var self = this;
console.log("start");
var sidebar = new instance.gamification.Sidebar(self);
sidebar.appendTo($('.oe_mail_wall_aside'));
}

View File

@ -416,15 +416,15 @@
<record id="goals_menu_groupby_act" model="ir.actions.act_window">
<field name="res_model">gamification.goal</field>
<field name="view_type">form</field>
<field name="name">Related Goals</field>
<field name="view_mode">kanban,tree,form</field>
<field name="context">{'search_default_group_by_type': True}</field>
<field name="name">Goals</field>
<field name="view_mode">tree,kanban,form</field>
<field name="context">{'search_default_group_by_user': True, 'search_default_group_by_type': True}</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_goal_menu_hr" parent="menu_eval_hr" action="goals_menu_groupby_act" groups="base.group_hr_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-->
<act_window

View File

@ -2,9 +2,9 @@
<openerp>
<data noupdate="0">
<!-- make Employee users Survey users -->
<!-- make Employee users Survey users and Gamification manager -->
<record id="base.group_user" model="res.groups">
<field name="implied_ids" eval="[(4, ref('base.group_survey_user'))]"/>
<field name="implied_ids" eval="[(4, ref('base.group_survey_user')), (4, ref('gamification.group_goal_manager'))]"/>
</record>
<record id="survey.menu_surveys" model="ir.ui.menu">
@ -26,11 +26,6 @@
<field eval="[(4,ref('base.group_hr_manager'))]" name="groups_id"/>
</record>
<!-- makes HR managers Gamification managers -->
<record id="base.group_hr_manager" model="res.groups">
<field name="implied_ids" eval="[(4, ref('gamification.group_goal_manager'))]"/>
</record>
</data>
<data noupdate="1">