[IMP] gamification: better buttons for change of states

bzr revid: mat@openerp.com-20130219103351-m9ni2hntv6miz4nu
This commit is contained in:
Martin Trigaux 2013-02-19 11:33:51 +01:00
parent 0f042d442e
commit f6ddf40705
3 changed files with 8 additions and 5 deletions

View File

@ -262,6 +262,8 @@ class gamification_goal_plan(osv.Model):
def action_cancel(self, cr, uid, ids, context=None):
return self.write(cr, uid, ids, {'state': 'draft'}, context=context)
def action_reset(self, cr, uid, ids, context=None):
return self.write(cr, uid, ids, {'state': 'inprogress'}, context=context)
class gamification_goal_planline(osv.Model):

View File

@ -31,9 +31,9 @@
<field name="arch" type="xml">
<form string="Goal" version="7.0">
<header>
<button string="Mark as Reached" type="object" name="action_reach" states="inprogress"/>
<button string="Mark as Failed" type="object" name="action_fail" states="inprogress"/>
<button string="Cancel Completion" type="object" name="action_cancel" states="failed,reached"/>
<button string="Goal Reached" type="object" name="action_reach" states="inprogress" class="oe_highlight"/>
<button string="Goal Failed" type="object" name="action_fail" states="inprogress"/>
<button string="Reset Completion" type="object" name="action_cancel" states="failed,reached"/>
<field name="state" widget="statusbar" statusbar_visible="inprogress" />
</header>
<sheet>

View File

@ -27,9 +27,10 @@
<field name="arch" type="xml">
<form string="Goal types" version="7.0">
<header>
<button string="Start Plan" type="object" name="action_start" states="draft"/>
<button string="Close Plan" type="object" name="action_close" states="inprogress"/>
<button string="Start Plan" type="object" name="action_start" states="draft" class="oe_highlight"/>
<button string="Close Plan" type="object" name="action_close" states="inprogress" class="oe_highlight"/>
<button string="Cancel Plan" type="object" name="action_cancel" states="inprogress"/>
<button string="Reset Plan" type="object" name="action_reset" states="done"/>
<field name="state" widget="statusbar"/>
</header>
<sheet>