Merge branch 'master' into bbmaster
This commit is contained in:
commit
bd6c0167fd
1 changed files with 13 additions and 13 deletions
|
@ -1,5 +1,5 @@
|
||||||
#
|
#
|
||||||
# Copyright (c) 2011 Helmut Merz helmutm@cy55.de
|
# Copyright (c) 2012 Helmut Merz helmutm@cy55.de
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
@ -18,8 +18,6 @@
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Planning and recording activities (work items).
|
Planning and recording activities (work items).
|
||||||
|
|
||||||
$Id$
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from zope import component
|
from zope import component
|
||||||
|
@ -42,7 +40,8 @@ _not_found = object()
|
||||||
def workItemStates():
|
def workItemStates():
|
||||||
return StatesDefinition('workItemStates',
|
return StatesDefinition('workItemStates',
|
||||||
State('new', 'new',
|
State('new', 'new',
|
||||||
('plan', 'accept', 'start', 'work', 'finish', 'delegate', 'cancel'),
|
('plan', 'accept', 'start', 'work', 'finish', 'delegate',
|
||||||
|
'cancel'),
|
||||||
color='red'),
|
color='red'),
|
||||||
State('planned', 'planned',
|
State('planned', 'planned',
|
||||||
('plan', 'accept', 'start', 'work', 'finish', 'delegate',
|
('plan', 'accept', 'start', 'work', 'finish', 'delegate',
|
||||||
|
@ -67,13 +66,13 @@ def workItemStates():
|
||||||
State('closed', 'closed', (), color='lightblue'),
|
State('closed', 'closed', (), color='lightblue'),
|
||||||
# not directly reachable states:
|
# not directly reachable states:
|
||||||
State('delegated', 'delegated',
|
State('delegated', 'delegated',
|
||||||
('plan', 'accept', 'start', 'work', 'finish', 'close', 'delegate',
|
('plan', 'accept', 'start', 'work', 'finish', 'close',
|
||||||
'move', 'cancel', 'modify'),
|
'delegate', 'move', 'cancel', 'modify'),
|
||||||
color='purple'),
|
color='purple'),
|
||||||
State('delegated_x', 'delegated', (), color='purple'),
|
State('delegated_x', 'delegated', (), color='purple'),
|
||||||
State('moved', 'moved',
|
State('moved', 'moved',
|
||||||
('plan', 'accept', 'start', 'work', 'finish', 'close', 'delegate',
|
('plan', 'accept', 'start', 'work', 'finish', 'close',
|
||||||
'move', 'cancel', 'modify'),
|
'delegate', 'move', 'cancel', 'modify'),
|
||||||
color='grey'),
|
color='grey'),
|
||||||
State('moved_x', 'moved', (), color='grey'),
|
State('moved_x', 'moved', (), color='grey'),
|
||||||
State('replaced', 'replaced', (), color='grey'),
|
State('replaced', 'replaced', (), color='grey'),
|
||||||
|
@ -95,7 +94,7 @@ def workItemStates():
|
||||||
|
|
||||||
|
|
||||||
fieldNames = ['title', 'description', 'start', 'end', 'duration', 'effort',
|
fieldNames = ['title', 'description', 'start', 'end', 'duration', 'effort',
|
||||||
'comment', 'party']
|
'comment', 'party'] # for use in editingRules
|
||||||
|
|
||||||
# meaning: - not editable, value=default
|
# meaning: - not editable, value=default
|
||||||
# / not editable, value=None
|
# / not editable, value=None
|
||||||
|
@ -125,11 +124,11 @@ class WorkItem(Stateful, Track):
|
||||||
|
|
||||||
implements(IWorkItem)
|
implements(IWorkItem)
|
||||||
|
|
||||||
statesDefinition = 'organize.workItemStates'
|
|
||||||
|
|
||||||
metadata_attributes = Track.metadata_attributes + ('state',)
|
metadata_attributes = Track.metadata_attributes + ('state',)
|
||||||
index_attributes = metadata_attributes
|
index_attributes = metadata_attributes
|
||||||
typeName = 'WorkItem'
|
typeName = 'WorkItem'
|
||||||
|
typeInterface = IWorkItem
|
||||||
|
statesDefinition = 'organize.workItemStates'
|
||||||
|
|
||||||
initAttributes = set(['party', 'title', 'description', 'start', 'end',
|
initAttributes = set(['party', 'title', 'description', 'start', 'end',
|
||||||
'duration', 'effort'])
|
'duration', 'effort'])
|
||||||
|
@ -141,7 +140,8 @@ class WorkItem(Stateful, Track):
|
||||||
self.data['created'] = self.timeStamp
|
self.data['created'] = self.timeStamp
|
||||||
|
|
||||||
def getStatesDefinition(self):
|
def getStatesDefinition(self):
|
||||||
return component.getUtility(IStatesDefinition, name=self.statesDefinition)
|
return component.getUtility(IStatesDefinition,
|
||||||
|
name=self.statesDefinition)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def party(self):
|
def party(self):
|
||||||
|
@ -165,7 +165,7 @@ class WorkItem(Stateful, Track):
|
||||||
return self.data.get('effort') or self.duration
|
return self.data.get('effort') or self.duration
|
||||||
|
|
||||||
def __getattr__(self, attr):
|
def __getattr__(self, attr):
|
||||||
if attr not in IWorkItem:
|
if attr not in self.typeInterface:
|
||||||
raise AttributeError(attr)
|
raise AttributeError(attr)
|
||||||
return self.data.get(attr)
|
return self.data.get(attr)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue