From e57a761dc7ca0463b8dffac7d8423ec362745513 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Wed, 27 Feb 2013 12:12:20 +0100 Subject: [PATCH] [IMP] gamification: add start goal button for draft goals bzr revid: mat@openerp.com-20130227111220-ipgvl5djlndcnxpw --- addons/gamification/goal.py | 5 ++++- addons/gamification/view/goal.xml | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/addons/gamification/goal.py b/addons/gamification/goal.py index 704ba2bad11..2b120eeaedf 100644 --- a/addons/gamification/goal.py +++ b/addons/gamification/goal.py @@ -208,7 +208,7 @@ class gamification_goal(osv.Model): for goal in self.browse(cr, uid, ids, context=context or {}): if goal.state not in ('inprogress','inprogress_update','reached'): - # skip if goal failed or canceled + # skip if goal draft, failed or canceled continue if goal.state == 'reached' and goal.end_date and fields.date.today() > goal.end_date: # only a goal reached but not passed the end date will still be @@ -263,6 +263,9 @@ class gamification_goal(osv.Model): self.write(cr, uid, [goal.id], towrite, context=context) return True + def action_start(self, cr, uid, ids, context=None): + self.write(cr, uid, ids, {'state': 'inprogress'}, context=context) + return self.update(cr, uid, ids, context=context) def action_reach(self, cr, uid, ids, context=None): return self.write(cr, uid, ids, {'state': 'reached'}, context=context) diff --git a/addons/gamification/view/goal.xml b/addons/gamification/view/goal.xml index c983076c9ad..a15e53a074e 100644 --- a/addons/gamification/view/goal.xml +++ b/addons/gamification/view/goal.xml @@ -40,7 +40,8 @@
-