[IMP] better data

bzr revid: mat@openerp.com-20130415155014-y6bdafhnmb5g7kqj
This commit is contained in:
Martin Trigaux 2013-04-15 17:50:14 +02:00
parent d02eed5d36
commit 0222ae2a21
8 changed files with 59 additions and 58 deletions

View File

@ -145,9 +145,9 @@ class gamification_goal(osv.Model):
def on_change_type_id(self, cr, uid, ids, type_id=False, context=None):
goal_type = self.pool.get('gamification.goal.type')
if not type_id:
return {'value':{'type_id': False}}
return {'value': {'type_id': False}}
goal_type = goal_type.browse(cr, uid, type_id, context=context)
ret = {'value' : {'computation_mode' : goal_type.computation_mode}}
ret = {'value': {'computation_mode': goal_type.computation_mode}}
return ret
_columns = {
@ -188,7 +188,7 @@ class gamification_goal(osv.Model):
track_visibility='always'),
'computation_mode': fields.related('type_id', 'computation_mode',
type='char',
type='char',
string="Type computation mode"),
'remind_update_delay': fields.integer('Remind delay',
help="The number of days after which the user assigned to a manual goal will be reminded. Never reminded if no value is specified."),

View File

@ -4,7 +4,7 @@
<!-- goal types -->
<record model="gamification.goal.type" id="type_base_timezone">
<field name="name">Change Timezone</field>
<field name="name">Set your Timezone</field>
<field name="description">Configure your profile and specify your timezone</field>
<field name="computation_mode">count</field>
<field name="ponctual">True</field>
@ -15,7 +15,7 @@
</record>
<record model="gamification.goal.type" id="type_base_avatar">
<field name="name">Change of avatar</field>
<field name="name">Set your Avatar</field>
<field name="description">In your user perference</field>
<field name="computation_mode">manually</field>
<field name="ponctual">True</field>
@ -26,7 +26,7 @@
<record model="gamification.goal.type" id="type_base_company_data">
<field name="name">Set your company data</field>
<field name="name">Set your Company Data</field>
<field name="description">Specify at least a website</field>
<field name="computation_mode">count</field>
<field name="ponctual">True</field>
@ -37,7 +37,7 @@
</record>
<record model="gamification.goal.type" id="type_base_company_logo">
<field name="name">Change your company logo</field>
<field name="name">Set your Company Logo</field>
<field name="computation_mode">count</field>
<field name="ponctual">True</field>
<field name="model_id" eval="ref('base.model_res_company')" />
@ -47,7 +47,7 @@
</record>
<record model="gamification.goal.type" id="type_base_invite">
<field name="name">Invite new users</field>
<field name="name">Invite new Users</field>
<field name="description">Create at least another user</field>
<field name="ponctual">True</field>
<field name="computation_mode">count</field>

View File

@ -107,7 +107,7 @@ class gamification_goal_plan(osv.Model):
return res
_columns = {
'name': fields.char('Plan Name', required=True, translate=True),
'name': fields.char('Challenge Name', required=True, translate=True),
'description': fields.text('Description', translate=True),
'state': fields.selection([
('draft', 'Draft'),
@ -117,11 +117,11 @@ class gamification_goal_plan(osv.Model):
string='State',
required=True),
'manager_id': fields.many2one('res.users',
string='Responsible', help="The user responsible for the plan."),
string='Responsible', help="The user responsible for the challenge."),
'start_date': fields.date('Planned Start Date',
help="The day a new plan will be automatically started. If no periodicity is set, will use this date as the goal start date."),
help="The day a new challenge will be automatically started. If no periodicity is set, will use this date as the goal start date."),
'end_date': fields.date('Planned End Date',
help="The day a new plan will be automatically closed. If no periodicity is set, will use this date as the goal end date."),
help="The day a new challenge will be automatically closed. If no periodicity is set, will use this date as the goal end date."),
'user_ids': fields.many2many('res.users', 'user_ids',
string='Users',
@ -641,7 +641,7 @@ class gamification_goal_planline(osv.Model):
_name = 'gamification.goal.planline'
_description = 'Gamification generic goal for plan'
_order = "sequence_type, id"
_order = "sequence, sequence_type, id"
def _get_planline_types(self, cr, uid, ids, context=None):
"""Return the ids of planline items related to the gamification.goal.type
@ -667,6 +667,9 @@ class gamification_goal_planline(osv.Model):
ondelete="cascade"),
'target_goal': fields.float('Target Value to Reach',
required=True),
'sequence': fields.integer('Sequence',
help='Sequence number for ordering',
required=True),
'sequence_type': fields.related('type_id', 'sequence',
type='integer',
string='Sequence',
@ -680,3 +683,7 @@ class gamification_goal_planline(osv.Model):
'type_monetary': fields.related('type_id', 'monetary', type="boolean", readonly=True, string="Monetary"),
'type_full_suffix': fields.related('type_id', 'full_suffix', type="char", readonly=True, string="Suffix"),
}
_default = {
'sequence': 1,
}

View File

@ -52,8 +52,8 @@
<form string="Goal types" version="7.0">
<header>
<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="Check Challenge" type="object" name="action_check" states="inprogress"/>
<button string="Close Challenge" type="object" name="action_close" states="inprogress" class="oe_highlight"/>
<button string="Reset to Draft" type="object" name="action_cancel" states="inprogress"/>
<button string="Reset Completion" type="object" name="action_reset" states="done"/>
<button string="Report Progress" type="object" name="action_report_progress" states="inprogress,done" groups="base.group_no_one"/>
@ -66,7 +66,7 @@
<h1>
<field name="name" placeholder="e.g. Monthly Sales Objectives"/>
</h1>
<label for="user_ids" class="oe_edit_only" string="Apply Plan To"/>
<label for="user_ids" class="oe_edit_only" string="Assign Challenge To"/>
<div>
<field name="user_ids" widget="many2many_tags" />
</div>
@ -91,6 +91,7 @@
<page string="Goals">
<field name="planline_ids" nolabel="1" colspan="4">
<tree string="Planline List" version="7.0" editable="bottom" >
<field name="sequence" widget="handle"/>
<field name="type_id"/>
<field name="type_condition"/>
<field name="target_goal"/>

View File

@ -102,7 +102,7 @@
background-color: #fff;
}
.openerp .oe_mail_wall .oe_mail_wall_aside table td,th {
vertical-align: center;
vertical-align: middle;
border: none;
}
.openerp .oe_mail_wall .oe_mail_wall_aside table td.col1 { width: 40%; }
@ -120,10 +120,16 @@
.openerp .oe_mail_wall .oe_mail_wall_aside li p {
margin:5px 0;
}
.openerp .oe_mail_wall .oe_mail_wall_aside .oe_update_plan {
display: inline-block;
.openerp .oe_mail_wall .oe_mail_wall_aside .oe_goal .oe_update_plan,
.openerp .oe_mail_wall .oe_mail_wall_aside .oe_goal .oe_goal_action {
visibility: hidden;
display: block;
float: right;
}
.openerp .oe_mail_wall .oe_mail_wall_aside .oe_goal:hover > .oe_update_plan,
.openerp .oe_mail_wall .oe_mail_wall_aside .oe_goal:hover .oe_goal_action {
visibility: visible;
}
.openerp .oe_mail_wall .oe_mail {
display: inline-block;
}

View File

@ -3,8 +3,8 @@
<div class="oe_gamification_goal"><em>Your goal list is empty</em></div>
</t>
<t t-name="gamification.goal_list_to_do">
<div t-foreach="widget.goals_info.info" t-as="plan">
<em><a class="oe_update_plan" rol="button" t-attf-id="{plan.id}">refresh</a></em>
<div t-foreach="widget.goals_info.info" t-as="plan" class="oe_goal">
<a class="oe_update_plan oe_e" rol="button" t-attf-id="{plan.id}">e</a>
<h3><t t-esc="plan.name" /></h3>
<t t-if="plan.visibility_mode == 'progressbar'">
@ -13,7 +13,7 @@
<span class="oe_goal_sparkline_piechart" t-att-data-completeness="goal.completeness"></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>
<a class="oe_goal_action oe_e" t-att-id="goal.id">&amp;</a>
</t>
<t t-if="!goal.type_ponctual">
<t t-if="goal.type_condition == 'higher'">
@ -43,7 +43,7 @@
<t t-esc="planline.type_name"/>
(Goal: max <span t-attf-class="#{planline.type_monetary ? 'oe_goal_field_monetary' : ''}"><t t-esc="planline.target_goal" /></span><t t-if="planline.type_unit"> <t t-esc="planline.type_unit"/></t>)
<t t-if="planline.type_computation_mode == 'manually' or planline.type_action">
<a class="oe_goal_action" t-att-id="planline.own_goal_id">modify</a>
<a class="oe_goal_action oe_e" t-att-id="planline.own_goal_id">&amp;</a>
</t>
</th>
</tr>
@ -61,11 +61,6 @@
<span class="oe_goal_sparkline_piechart" t-att-data-completeness="goal.completeness"></span>
<span t-attf-class="#{planline.type_monetary ? 'oe_goal_field_monetary' : ''}"><t t-esc="goal.current" /></span><t t-if="planline.type_unit"> <t t-esc="planline.type_unit"/></t>
</td>
<!-- <progress class="oe_goal_progress" t-att-value="goal.completeness" max="100" /></td>
<td class="col3">
<t t-esc="goal.current" />/<span t-attf-class="#{planline.type_monetary ? 'oe_goal_field_monetary' : ''}"><t t-esc="goal.target_goal"/></span>
<t t-if="planline.type_unit"><t t-esc="planline.type_unit"/></t>
</td> -->
</tr>
</tbody>
</table>

View File

@ -14,6 +14,16 @@
<field name="domain">[('state','!=','cancel'),('user_id','=',user_id),('type','=','out_invoice')]</field>
</record>
<record model="gamification.goal.type" id="type_crm_nbr_new_leads">
<field name="name"># New Leads</field>
<field name="description">Based on the creation date</field>
<field name="computation_mode">count</field>
<field name="unit">leads</field>
<field name="model_id" eval="ref('crm.model_crm_lead')" />
<field name="field_date_id" eval="ref('crm.field_crm_lead_create_date')" />
<field name="domain">[('user_id','=',user_id)]</field>
</record>
<record model="gamification.goal.type" id="type_crm_lead_delay_open">
<field name="name">Time to Qualify a Lead</field>
<field name="description">The average number of days to open the case (lower than)</field>
@ -49,16 +59,6 @@
<field name="domain">[('user_id','=',user_id),('type','='),('state','=','done')]</field>
</record>
<record model="gamification.goal.type" id="type_crm_nbr_new_leads">
<field name="name"># New Leads</field>
<field name="description">Based on the creation date</field>
<field name="computation_mode">count</field>
<field name="unit">leads</field>
<field name="model_id" eval="ref('crm.model_crm_lead')" />
<field name="field_date_id" eval="ref('crm.field_crm_lead_create_date')" />
<field name="domain">[('user_id','=',user_id)]</field>
</record>
<record model="gamification.goal.type" id="type_crm_nbr_new_opportunities">
<field name="name"># New Opportunities</field>
<field name="description">Based on the opening date</field>
@ -127,7 +127,7 @@
<!-- plans -->
<record model="gamification.goal.plan" id="plan_crm_sale">
<field name="name">Salesperson</field>
<field name="name">Monthly Sales Targets</field>
<field name="period">monthly</field>
<field name="visibility_mode">board</field>
<field name="autojoin_group_id" eval="ref('base.group_sale_salesman')" />
@ -136,7 +136,7 @@
</record>
<record model="gamification.goal.plan" id="plan_crm_marketing">
<field name="name">Marketing team</field>
<field name="name">Lead Acquisition</field>
<field name="period">monthly</field>
<field name="visibility_mode">progressbar</field>
<field name="autojoin_group_id" eval="ref('base.group_sale_salesman')" />
@ -150,16 +150,6 @@
<field name="target_goal">20000</field>
<field name="plan_id" eval="ref('plan_crm_sale')" />
</record>
<record model="gamification.goal.planline" id="planline_crm_sale3">
<field name="type_id" eval="ref('type_crm_nbr_sale_order_created')" />
<field name="target_goal">5</field>
<field name="plan_id" eval="ref('plan_crm_sale')" />
</record>
<record model="gamification.goal.planline" id="planline_crm_sale4">
<field name="type_id" eval="ref('type_crm_nbr_paid_sale_order')" />
<field name="target_goal">5</field>
<field name="plan_id" eval="ref('plan_crm_sale')" />
</record>
<record model="gamification.goal.planline" id="planline_crm_sale5">
<field name="type_id" eval="ref('type_crm_nbr_customer_refunds')" />
<field name="target_goal">4</field>
@ -167,21 +157,23 @@
</record>
<record model="gamification.goal.planline" id="planline_crm_marketing1">
<field name="type_id" eval="ref('type_crm_lead_delay_open')" />
<field name="target_goal">15</field>
<field name="plan_id" eval="ref('plan_crm_marketing')" />
</record>
<record model="gamification.goal.planline" id="planline_crm_marketing2">
<field name="type_id" eval="ref('type_crm_nbr_new_leads')" />
<field name="target_goal">7</field>
<field name="plan_id" eval="ref('plan_crm_marketing')" />
<field name="sequence">1</field>
</record>
<record model="gamification.goal.planline" id="planline_crm_marketing2">
<field name="type_id" eval="ref('type_crm_lead_delay_open')" />
<field name="target_goal">15</field>
<field name="plan_id" eval="ref('plan_crm_marketing')" />
<field name="sequence">2</field>
</record>
<record model="gamification.goal.planline" id="planline_crm_marketing3">
<field name="type_id" eval="ref('type_crm_nbr_new_opportunities')" />
<field name="target_goal">5</field>
<field name="plan_id" eval="ref('plan_crm_marketing')" />
<field name="sequence">3</field>
</record>
</data>

View File

@ -413,7 +413,7 @@
<field name="act_window_id" ref="action_hr_evaluation_interview_tree"/>
</record>
<record id="goals_menu_groupby_action" model="ir.actions.act_window">
<record id="goals_menu_groupby_action2" model="ir.actions.act_window">
<field name="res_model">gamification.goal</field>
<field name="view_type">form</field>
<field name="name">Goals History</field>
@ -453,7 +453,7 @@
<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="goal_plan_list_action2" groups="base.group_hr_user"/>
<menuitem id="gamification_goal_menu_hr" parent="menu_eval_hr" action="goals_menu_groupby_action" groups="base.group_hr_user"/>
<menuitem id="gamification_goal_menu_hr" parent="menu_eval_hr" action="goals_menu_groupby_action2" groups="base.group_hr_user"/>
<!-- Email Compose message Action-->
<act_window