filter qualification reports by contact state
This commit is contained in:
parent
4a67756cf8
commit
74eb054bc9
5 changed files with 52 additions and 9 deletions
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# Copyright (c) 2014 Helmut Merz helmutm@cy55.de
|
||||
# Copyright (c) 2015 Helmut Merz helmutm@cy55.de
|
||||
#
|
||||
# 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
|
||||
|
@ -22,6 +22,7 @@ Qualification management report definitions.
|
|||
|
||||
from zope.cachedescriptors.property import Lazy
|
||||
|
||||
from cybertools.composer.report.base import LeafQueryCriteria, CompoundQueryCriteria
|
||||
from cybertools.util.jeep import Jeep
|
||||
from loops.expert.report import ReportInstance
|
||||
from loops.organize.work.report import WorkRow
|
||||
|
@ -39,13 +40,12 @@ class QualificationOverview(ReportInstance):
|
|||
|
||||
rowFactory = WorkRow
|
||||
|
||||
fields = Jeep((task, party, workTitle, dayStart, dayEnd, state,))
|
||||
#partyState,)) # +deadline?
|
||||
fields = Jeep((task, party, workTitle, dayStart, dayEnd, state,
|
||||
partyState,)) # +deadline?
|
||||
|
||||
defaultOutputFields = fields
|
||||
defaultOutputFields = Jeep(list(fields)[:-1])
|
||||
defaultSortCriteria = (party, task,)
|
||||
|
||||
|
||||
def getOptions(self, option):
|
||||
return self.view.options(option)
|
||||
|
||||
|
@ -53,6 +53,14 @@ class QualificationOverview(ReportInstance):
|
|||
def states(self):
|
||||
return self.getOptions('report_select_state' or ('planned',))
|
||||
|
||||
@property
|
||||
def queryCriteria(self):
|
||||
crit = self.context.queryCriteria or []
|
||||
f = self.fields.partyState
|
||||
crit.append(
|
||||
LeafQueryCriteria(f.name, f.operator, 'active', f))
|
||||
return CompoundQueryCriteria(crit)
|
||||
|
||||
def selectObjects(self, parts):
|
||||
result = []
|
||||
workItems = self.recordManager['work']
|
||||
|
@ -112,6 +120,11 @@ class PersonQualifications(QualificationOverview):
|
|||
def getOptions(self, option):
|
||||
return self.view.typeOptions(option)
|
||||
|
||||
@property
|
||||
def queryCriteria(self):
|
||||
crit = self.context.queryCriteria or []
|
||||
return CompoundQueryCriteria(crit)
|
||||
|
||||
def selectObjects(self, parts):
|
||||
workItems = self.recordManager['work']
|
||||
person = self.view.context
|
||||
|
|
Binary file not shown.
|
@ -3,7 +3,7 @@ msgstr ""
|
|||
|
||||
"Project-Id-Version: 0.13.1\n"
|
||||
"POT-Creation-Date: 2007-05-22 12:00 CET\n"
|
||||
"PO-Revision-Date: 2015-03-17 12:00 CET\n"
|
||||
"PO-Revision-Date: 2015-03-20 12:00 CET\n"
|
||||
"Last-Translator: Helmut Merz <helmutm@cy55.de>\n"
|
||||
"Language-Team: loops developers <helmutm@cy55.de>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
|
@ -1134,6 +1134,9 @@ msgstr "Bemerkung"
|
|||
msgid "desc_transition_comments"
|
||||
msgstr "Notizen zum Statusübergang."
|
||||
|
||||
msgid "contact_states"
|
||||
msgstr "Kontaktstatus"
|
||||
|
||||
# state names
|
||||
|
||||
msgid "accepted"
|
||||
|
@ -1202,6 +1205,12 @@ msgstr "unklassifiziert"
|
|||
msgid "verified"
|
||||
msgstr "verifiziert"
|
||||
|
||||
msgid "prospective"
|
||||
msgstr "künftig"
|
||||
|
||||
msgid "inactive"
|
||||
msgstr "inaktiv"
|
||||
|
||||
# transitions
|
||||
|
||||
msgid "accept"
|
||||
|
@ -1276,6 +1285,15 @@ msgstr "verifizieren"
|
|||
msgid "work"
|
||||
msgstr "bearbeiten"
|
||||
|
||||
msgid "activate"
|
||||
msgstr "aktivieren"
|
||||
|
||||
msgid "inactivate"
|
||||
msgstr "inaktiv setzen"
|
||||
|
||||
msgid "reset"
|
||||
msgstr "zurücksetzen"
|
||||
|
||||
# calendar
|
||||
|
||||
msgid "Monday"
|
||||
|
|
|
@ -40,12 +40,12 @@ def contactStates():
|
|||
return StatesDefinition('contact_states',
|
||||
State('prospective', 'prospective', ('activate', 'inactivate',),
|
||||
color='blue'),
|
||||
State('active', 'active', ('retract', 'inactivate',),
|
||||
State('active', 'active', ('reset', 'inactivate',),
|
||||
color='green'),
|
||||
State('inactive', 'inactive', ('activate',),
|
||||
State('inactive', 'inactive', ('activate', 'reset'),
|
||||
color='x'),
|
||||
Transition('activate', 'activate', 'active'),
|
||||
Transition('retract', 'retract', 'prospective'),
|
||||
Transition('reset', 'reset', 'prospective'),
|
||||
Transition('inactivate', 'inactivate', 'inactive'),
|
||||
initialState='active')
|
||||
|
||||
|
|
|
@ -81,6 +81,18 @@ class DurationField(Field):
|
|||
|
||||
class PartyStateField(StateField):
|
||||
|
||||
def getValue(self, row):
|
||||
context = row.context
|
||||
if context is None:
|
||||
return None
|
||||
party = util.getObjectForUid(context.party)
|
||||
ptype = adapted(party.conceptType)
|
||||
stdefs = IOptions(ptype)('organize.stateful') or []
|
||||
if self.statesDefinition in stdefs:
|
||||
stf = getAdapter(party, IStateful,
|
||||
name=self.statesDefinition)
|
||||
return stf.state
|
||||
|
||||
def getContext(self, row):
|
||||
if row.context is None:
|
||||
return None
|
||||
|
|
Loading…
Add table
Reference in a new issue