indicator attribute depending on work item type; use deadline for timestamp if start is not set
This commit is contained in:
parent
fff00ef1a0
commit
b0b9868d1f
1 changed files with 13 additions and 6 deletions
|
@ -131,26 +131,26 @@ class WorkItemType(object):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, name, title, description=u'',
|
def __init__(self, name, title, description=u'',
|
||||||
actions=None, fields=None, color=None):
|
actions=None, fields=None, indicator=None):
|
||||||
self.name = name
|
self.name = name
|
||||||
self.title = title
|
self.title = title
|
||||||
self.description = description
|
self.description = description
|
||||||
self.actions = actions or list(editingRules)
|
self.actions = actions or list(editingRules)
|
||||||
self.fields = fields or ('deadline', 'start-end', 'duration-effort')
|
self.fields = fields or ('deadline', 'start-end', 'duration-effort')
|
||||||
self.color = color
|
self.indicator = indicator
|
||||||
|
|
||||||
workItemTypes = Jeep((
|
workItemTypes = Jeep((
|
||||||
WorkItemType('work', u'Unit of Work'),
|
WorkItemType('work', u'Unit of Work', indicator='work_work'),
|
||||||
WorkItemType('scheduled', u'Scheduled Event',
|
WorkItemType('scheduled', u'Scheduled Event',
|
||||||
actions=('plan', 'accept', 'finish', 'cancel',
|
actions=('plan', 'accept', 'finish', 'cancel',
|
||||||
'modify', 'delegate', 'move', 'close', 'reopen'),
|
'modify', 'delegate', 'move', 'close', 'reopen'),
|
||||||
fields =('start-end', 'duration-effort',),
|
fields =('start-end', 'duration-effort',),
|
||||||
color ='#aaaaff'),
|
indicator='work_event'),
|
||||||
WorkItemType('deadline', u'Deadline',
|
WorkItemType('deadline', u'Deadline',
|
||||||
actions=('plan', 'accept', 'finish', 'cancel',
|
actions=('plan', 'accept', 'finish', 'cancel',
|
||||||
'modify', 'delegate', 'move', 'close', 'reopen'),
|
'modify', 'delegate', 'move', 'close', 'reopen'),
|
||||||
fields =('deadline',),
|
fields =('deadline',),
|
||||||
color ='#ffffaa')
|
indicator='work_deadline')
|
||||||
))
|
))
|
||||||
|
|
||||||
|
|
||||||
|
@ -180,6 +180,10 @@ class WorkItem(Stateful, Track):
|
||||||
return component.getUtility(IStatesDefinition,
|
return component.getUtility(IStatesDefinition,
|
||||||
name=self.statesDefinition)
|
name=self.statesDefinition)
|
||||||
|
|
||||||
|
def getWorkItemType(self):
|
||||||
|
name = self.workItemType
|
||||||
|
return name and workItemTypes[name] or None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def party(self):
|
def party(self):
|
||||||
return self.userName
|
return self.userName
|
||||||
|
@ -231,7 +235,6 @@ class WorkItem(Stateful, Track):
|
||||||
self.state = self.state + '_x'
|
self.state = self.state + '_x'
|
||||||
self.reindex('state')
|
self.reindex('state')
|
||||||
new.doTransition(action)
|
new.doTransition(action)
|
||||||
#new.reindex('state')
|
|
||||||
new.reindex()
|
new.reindex()
|
||||||
return new
|
return new
|
||||||
|
|
||||||
|
@ -331,6 +334,10 @@ class WorkItem(Stateful, Track):
|
||||||
if copyData is None:
|
if copyData is None:
|
||||||
copyData = self.initAttributes
|
copyData = self.initAttributes
|
||||||
newData = {}
|
newData = {}
|
||||||
|
start = kw.get('start')
|
||||||
|
deadline = kw.get('deadline')
|
||||||
|
if not start and deadline:
|
||||||
|
kw['start'] = deadline
|
||||||
for k in self.initAttributes.union(set(['comment'])):
|
for k in self.initAttributes.union(set(['comment'])):
|
||||||
v = kw.get(k, _not_found)
|
v = kw.get(k, _not_found)
|
||||||
if v is _not_found and k in copyData:
|
if v is _not_found and k in copyData:
|
||||||
|
|
Loading…
Add table
Reference in a new issue