[IMP] refresh button for plan
bzr revid: mat@openerp.com-20130325161527-qes3lqpzevdmdsx6
This commit is contained in:
parent
364612d0be
commit
0aa973b9f0
|
@ -262,6 +262,14 @@ class gamification_goal_plan(osv.Model):
|
|||
self.report_progress(cr, uid, plan, context=context)
|
||||
self.write(cr, uid, plan.id, {'last_report_date': fields.date.today}, context=context)
|
||||
|
||||
def quick_update(self, cr, uid, plan_id, context=None):
|
||||
"""Update all the goals of a plan, no generation of new goals"""
|
||||
if not context: context = {}
|
||||
plan = self.browse(cr, uid, plan_id, context=context)
|
||||
goal_ids = self.pool.get('gamification.goal').search(cr, uid, [('plan_id', '=', plan_id)], context=context)
|
||||
self.pool.get('gamification.goal').update(cr, uid, goal_ids, context=context)
|
||||
return True
|
||||
|
||||
def action_start(self, cr, uid, ids, context=None):
|
||||
"""Start a draft goal plan
|
||||
|
||||
|
|
|
@ -72,6 +72,10 @@
|
|||
.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;
|
||||
float: right;
|
||||
}
|
||||
.openerp .oe_mail_wall .oe_mail {
|
||||
display: inline-block;
|
||||
}
|
|
@ -19,6 +19,14 @@ openerp.gamification = function(instance) {
|
|||
self.get_goal_todo_info();
|
||||
});
|
||||
},
|
||||
'click a.oe_update_plan': function(event) {
|
||||
var self = this;
|
||||
var plan_id = parseInt(event.currentTarget.id);
|
||||
var goals_updated = new instance.web.Model('gamification.goal.plan').call('quick_update', [plan_id]);
|
||||
$.when(goals_updated).done(function() {
|
||||
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);
|
||||
|
@ -35,8 +43,7 @@ openerp.gamification = function(instance) {
|
|||
|
||||
//var form = action_manager.dialog_widget.views.form.controller;
|
||||
});
|
||||
|
||||
}
|
||||
},
|
||||
},
|
||||
renderElement: function() {
|
||||
var self = this;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
</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>
|
||||
<h3><t t-esc="plan.name"/></h3>
|
||||
<t t-if="plan.visibility_mode == 'progressbar'">
|
||||
<ul class="oe_goals_list">
|
||||
|
@ -22,9 +23,9 @@
|
|||
<t t-if="goal.type_condition == 'lower'">
|
||||
<t t-esc="goal.current" /> (less than <t t-esc="goal.target_goal"/>)
|
||||
</t>
|
||||
<a class="oe_update_goal" rol="button" t-attf-id="{goal.id}">
|
||||
<!-- <a class="oe_update_goal" rol="button" t-attf-id="{goal.id}">
|
||||
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3QMWCRMG1/sI6gAAAR1JREFUKM910T9L1nEUBfCPP39S4pAuba0FDoEhbc6CLkEUvQMb7hKFDU29gCYPNFUoiH9WRwedhBB8CS1Bg7WEKKH12PJ94GnoTJfDOece7h3TkGQCk+hxVVVnjZ/Gz6q6TqJLMvTcxRG+4l0T38MXPE0yVlW6qhoa5jCLG/jQuEXM4BOWk+hb0n2sYQVdVX1uhvc4xRbe4rBPMo4n+I7NqroYqXmFXTzEC9zpcbOt3m8CIzVhkGSvGR50GMdtDPwfZzjHoGvCUyygH9YZqQW3MIXjHr9wgFU8axdRVZJMocNjHONbV1W/sYMf+Ig3SSZb8kts4xFeV9VF19JO8GpEdNnmFSxhv6oO8M+n1zGP51X1J8lsS1/FRpIe/gIpymSOkJCtuQAAAABJRU5ErkJggg==" alt="update" />
|
||||
</a>
|
||||
</a> -->
|
||||
</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
Loading…
Reference in New Issue