work in progress: task management: creation of work items OK
git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@3096 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
		
							parent
							
								
									9e242aa0e5
								
							
						
					
					
						commit
						42f9529086
					
				
					 3 changed files with 10 additions and 7 deletions
				
			
		| 
						 | 
				
			
			@ -11,7 +11,7 @@
 | 
			
		|||
 | 
			
		||||
  <adapter factory="cybertools.organize.work.WorkItems" />
 | 
			
		||||
 | 
			
		||||
  <utility component="cybertools.organize.work.workItemStates"
 | 
			
		||||
  <utility factory="cybertools.organize.work.workItemStates"
 | 
			
		||||
           provides="cybertools.stateful.interfaces.IStatesDefinition"
 | 
			
		||||
           name="organize.workItemStates" />
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -28,6 +28,7 @@ from zope.interface import Interface, Attribute
 | 
			
		|||
from zope.i18nmessageid import MessageFactory
 | 
			
		||||
 | 
			
		||||
from cybertools.composer.schema.factory import Email
 | 
			
		||||
from cybertools.tracking.interfaces import ITrack
 | 
			
		||||
from cybertools.util.jeep import Jeep, Term
 | 
			
		||||
 | 
			
		||||
_ = MessageFactory('cybertools.organize')
 | 
			
		||||
| 
						 | 
				
			
			@ -420,7 +421,7 @@ class IJobManager(Interface):
 | 
			
		|||
 | 
			
		||||
# work
 | 
			
		||||
 | 
			
		||||
class IWorkItem(Interface):
 | 
			
		||||
class IWorkItem(ITrack):
 | 
			
		||||
    """ A single piece of work, started and finished at a certain time,
 | 
			
		||||
        done by exactly one party (usually a person).
 | 
			
		||||
    """
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -180,14 +180,13 @@ class WorkItem(Stateful, Track):
 | 
			
		|||
        self.startWork(**kw)
 | 
			
		||||
 | 
			
		||||
    def action_finish(self, **kw):
 | 
			
		||||
        if 'description' in kw:
 | 
			
		||||
            self.data['description'] = kw.pop('description')
 | 
			
		||||
        if self.state == 'new':
 | 
			
		||||
            self.assign(kw.pop('party', None))
 | 
			
		||||
        if self.state == 'assigned':
 | 
			
		||||
            self.startWork(start=kw.pop('start', None))
 | 
			
		||||
        self.stopWork(**kw)
 | 
			
		||||
        #pred = self.predecessor    # better to finish predecessors manually?
 | 
			
		||||
        #while pred is not None:
 | 
			
		||||
        #    wi = getParent(self)[pred]
 | 
			
		||||
        #    wi.doTransition('finish')
 | 
			
		||||
        #    pred = wi.pred
 | 
			
		||||
 | 
			
		||||
    # auxiliary methods
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -226,6 +225,9 @@ class WorkItems(object):
 | 
			
		|||
    def __getitem__(self, key):
 | 
			
		||||
        return self.context[key]
 | 
			
		||||
 | 
			
		||||
    def __iter__(self):
 | 
			
		||||
        return iter(self.context.values())
 | 
			
		||||
 | 
			
		||||
    def add(self, task, party, run=0, **kw):
 | 
			
		||||
        trackId = self.context.saveUserTrack(task, run, party, {})
 | 
			
		||||
        track = self[trackId]
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue