[IMP] gamification: use state instead of status

bzr revid: mat@openerp.com-20130215141651-5ktcyekk9subj6ji
This commit is contained in:
Martin Trigaux
2013-02-15 15:16:51 +01:00
parent 2004f2bcd7
commit 8768bd8150
3 changed files with 22 additions and 16 deletions
+10 -10
View File
@@ -23,19 +23,19 @@ from openerp.osv import fields, osv
from datetime import date
GAMIFICATION_GOAL_STATUS = [
GAMIFICATION_GOAL_STATE = [
('inprogress','In progress'),
('reached','Reached'),
('failed','Failed'),
]
GAMIFICATION_PLAN_STATUS = [
GAMIFICATION_PLAN_STATE = [
('draft','Draft'),
('inprogress','In progress'),
('done','Done'),
]
GAMIFICATION_PERIOD_STATUS = [
GAMIFICATION_PERIOD_STATE = [
('once','No automatic assigment'),
('daily','Daily'),
('weekly','Weekly'),
@@ -139,15 +139,15 @@ class gamification_goal(osv.Model):
'current' : fields.float('Current',
required=True,
track_visibility = 'always'),
'status': fields.selection(GAMIFICATION_GOAL_STATUS,
string='Status',
'state': fields.selection(GAMIFICATION_GOAL_STATE,
string='State',
required=True,
track_visibility = 'always'),
}
_defaults = {
'current': 0,
'status': 'inprogress',
'state': 'inprogress',
}
@@ -177,12 +177,12 @@ class gamification_goal_plan(osv.Model):
'autojoin_group_id' : fields.many2one('res.groups',
string='Group',
help='Group of users whose members will automatically be added to the users'),
'period' : fields.selection(GAMIFICATION_PERIOD_STATUS,
'period' : fields.selection(GAMIFICATION_PERIOD_STATE,
string='Period',
help='Period of automatic goal assigment, will be done manually if none is selected',
required=True),
'status': fields.selection(GAMIFICATION_PLAN_STATUS,
string='Status',
'state': fields.selection(GAMIFICATION_PLAN_STATE,
string='State',
required=True),
'report_mode':fields.selection(GAMIFICATION_REPORT_MODE,
string="Mode",
@@ -199,7 +199,7 @@ class gamification_goal_plan(osv.Model):
_defaults = {
'period': 'once',
'status': 'inprogress',
'state': 'inprogress',
'report_mode' : 'progressbar',
'report_message_frequency' : 'onchange',
}
+9 -3
View File
@@ -11,14 +11,14 @@
<field name="name">Goal list</field>
<field name="model">gamification.goal</field>
<field name="arch" type="xml">
<tree string="Goal list" colors="red:status == 'failed';green:status == 'reached'">
<tree string="Goal list" colors="red:state == 'failed';green:state == 'reached'">
<field name="type_id"/>
<field name="user_id"/>
<field name="current"/>
<field name="target_goal"/>
<field name="start_date"/>
<field name="end_date"/>
<field name="status" invisible="1"/>
<field name="state" invisible="1"/>
</tree>
</field>
</record>
@@ -28,6 +28,12 @@
<field name="model">gamification.goal</field>
<field name="arch" type="xml">
<form string="Goal" version="7.0">
<header>
<button string="Mark as reached" type="workflow" name="signal_reached" states="inprogress"/>
<button string="Mark as failed" type="workflow" name="signal_failed" states="inprogress"/>
<!-- <button string="Cancel completion" type="workflow" name="signal_cancel" states="failed,reached"/> -->
<field name="state" widget="statusbar"/>
</header>
<sheet>
<group>
<group string="Reference">
@@ -42,7 +48,7 @@
<group string="Data">
<field name="target_goal"/>
<field name="current"/>
<field name="status"/>
<field name="state"/>
</group>
</group>
</sheet>
+3 -3
View File
@@ -12,10 +12,10 @@
<field name="name">Goal plans list</field>
<field name="model">gamification.goal.plan</field>
<field name="arch" type="xml">
<tree string="Goal types" colors="blue:status == 'inprogress';grey:status == 'done'">
<tree string="Goal types" colors="blue:state == 'inprogress';grey:state == 'done'">
<field name="name"/>
<field name="period"/>
<field name="status" invisible="1"/>
<field name="state" invisible="1"/>
</tree>
</field>
</record>
@@ -32,7 +32,7 @@
<group>
<group colspan="4">
<field name="period"/>
<field name="status"/>
<field name="state"/>
</group>
<group string="Report">
<field name="report_mode"/>