greffier can now add a note
This commit is contained in:
parent
2ca6e38836
commit
5cb7973153
|
@ -79,4 +79,11 @@
|
|||
permission="zope2.View"
|
||||
/>
|
||||
|
||||
<browser:page
|
||||
name="to_process"
|
||||
for="pfwbged.basecontent.behaviors.IPfwbIncomingMail"
|
||||
class=".to_process.WfCommentView"
|
||||
permission="zope2.View"
|
||||
/>
|
||||
|
||||
</configure>
|
||||
|
|
|
@ -0,0 +1,77 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
|
||||
from zope.interface import Interface
|
||||
from zope import schema
|
||||
from z3c.form import form, button
|
||||
from z3c.form.field import Fields
|
||||
from z3c.form.interfaces import HIDDEN_MODE
|
||||
|
||||
from plone.z3cform.layout import FormWrapper
|
||||
from Products.Five.browser import BrowserView
|
||||
from plone import api
|
||||
|
||||
|
||||
from ..subscribers.mail import incoming_mail_attributed
|
||||
from .. import _
|
||||
|
||||
|
||||
class IComment(Interface):
|
||||
|
||||
workflow_action = schema.Text(
|
||||
title=_(u"Workflow action"),
|
||||
required=True)
|
||||
|
||||
comment = schema.Text(
|
||||
title=_(u"Comment"),
|
||||
description=_(u"You can enter a note."),
|
||||
required=False)
|
||||
|
||||
|
||||
class WfCommentForm(form.AddForm):
|
||||
fields = Fields(IComment)
|
||||
fields['workflow_action'].mode = HIDDEN_MODE
|
||||
next_url = None
|
||||
|
||||
def updateActions(self):
|
||||
super(WfCommentForm, self).updateActions()
|
||||
self.actions["save"].addClass("context")
|
||||
self.actions["cancel"].addClass("standalone")
|
||||
|
||||
def updateWidgets(self):
|
||||
super(WfCommentForm, self).updateWidgets()
|
||||
if 'workflow_action' in self.request:
|
||||
self.widgets['workflow_action'].value = (
|
||||
self.request['workflow_action'])
|
||||
|
||||
@button.buttonAndHandler(_(u'Save'), name='save')
|
||||
def handleAdd(self, action):
|
||||
data, errors = self.extractData()
|
||||
if errors:
|
||||
self.status = self.formErrorsMessage
|
||||
return
|
||||
self._finishedAdd = True
|
||||
|
||||
comment = data['comment'] or u""
|
||||
comment = comment.strip()
|
||||
|
||||
incomingmail = self.context
|
||||
api.content.transition(obj=incomingmail, transition=data['workflow_action'])
|
||||
incomingmail.reindexObject(idxs=['review_state'])
|
||||
incoming_mail_attributed(incomingmail, comment)
|
||||
self.next_url = self.context.absolute_url()
|
||||
|
||||
@button.buttonAndHandler(_(u'Cancel'), name='cancel')
|
||||
def handleCancel(self, action):
|
||||
self._finishedAdd = True
|
||||
self.next_url = self.context.absolute_url()
|
||||
|
||||
def nextURL(self):
|
||||
return self.next_url
|
||||
|
||||
|
||||
class WfCommentView(FormWrapper, BrowserView):
|
||||
form = WfCommentForm
|
||||
|
||||
def __init__(self, context, request):
|
||||
BrowserView.__init__(self, context, request)
|
||||
FormWrapper.__init__(self, context, request)
|
|
@ -1,9 +1,9 @@
|
|||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: pfwbged.policy\n"
|
||||
"POT-Creation-Date: 2013-08-30 17:32+0000\n"
|
||||
"PO-Revision-Date: 2013-08-30 19:32+0100\n"
|
||||
"Last-Translator: Cédric Messiant <cedric.messiant@gmail.com>\n"
|
||||
"POT-Creation-Date: 2013-09-04 09:37+0000\n"
|
||||
"PO-Revision-Date: 2013-09-04 11:37+0100\n"
|
||||
"Last-Translator: Vincent Fretin <vincent.fretin@gmail.com>\n"
|
||||
"Language-Team: Ecréall\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=utf-8\n"
|
||||
|
@ -15,39 +15,39 @@ msgstr ""
|
|||
"Domain: DOMAIN\n"
|
||||
"X-Generator: Poedit 1.5.4\n"
|
||||
|
||||
#: ../menu.py:157
|
||||
#: ../menu.py:164
|
||||
msgid "${action} the version ${version}"
|
||||
msgstr "${action} la version ${version}"
|
||||
|
||||
#: ../browser/comments.py:100
|
||||
#: ../browser/comments.py:98
|
||||
msgid "Accept refusal"
|
||||
msgstr "Accepter le refus"
|
||||
|
||||
#: ../menu.py:86
|
||||
#: ../menu.py:93
|
||||
msgid "Actions"
|
||||
msgstr "Actions"
|
||||
|
||||
#: ../menu.py:224
|
||||
#: ../menu.py:231
|
||||
msgid "Add ${title}"
|
||||
msgstr "Ajouter ${title}"
|
||||
|
||||
#: ../browser/comments.py:101
|
||||
#: ../browser/comments.py:99
|
||||
msgid "Ask for refusal"
|
||||
msgstr "Demander le refus"
|
||||
|
||||
#: ../browser/ask_opinion.py:57
|
||||
#: ../browser/ask_opinion.py:55
|
||||
msgid "Ask opinion"
|
||||
msgstr "Demander un avis"
|
||||
|
||||
#: ../menu.py:38
|
||||
#: ../menu.py:40
|
||||
msgid "Ask opinion about version ${version}"
|
||||
msgstr "Demander un avis sur la version ${version}"
|
||||
|
||||
#: ../browser/ask_validation.py:59
|
||||
#: ../browser/ask_validation.py:58
|
||||
msgid "Ask validation"
|
||||
msgstr "Demander une validation"
|
||||
|
||||
#: ../menu.py:39
|
||||
#: ../menu.py:41
|
||||
msgid "Ask validation about version ${version}"
|
||||
msgstr "Demander une validation sur la version ${version}"
|
||||
|
||||
|
@ -59,11 +59,19 @@ msgstr "Modifiable par"
|
|||
msgid "Can view"
|
||||
msgstr "Visible par"
|
||||
|
||||
#: ../menu.py:33
|
||||
#: ../browser/to_process.py:63
|
||||
msgid "Cancel"
|
||||
msgstr "Annuler"
|
||||
|
||||
#: ../browser/to_process.py:25
|
||||
msgid "Comment"
|
||||
msgstr "Note"
|
||||
|
||||
#: ../menu.py:35
|
||||
msgid "Create a new version"
|
||||
msgstr "Créer une nouvelle version"
|
||||
|
||||
#: ../menu.py:323
|
||||
#: ../menu.py:330
|
||||
msgid "Create signed version for version ${version}"
|
||||
msgstr "Créer la version signée pour la version ${version}"
|
||||
|
||||
|
@ -71,23 +79,23 @@ msgstr "Créer la version signée pour la version ${version}"
|
|||
msgid "Create version ${version}"
|
||||
msgstr "Création de la version ${version}"
|
||||
|
||||
#: ../menu.py:35
|
||||
#: ../menu.py:37
|
||||
msgid "File in a folder"
|
||||
msgstr "Ranger dans un dossier"
|
||||
|
||||
#: ../menu.py:42
|
||||
#: ../menu.py:44
|
||||
msgid "Finish version ${version}"
|
||||
msgstr "Finaliser la version ${version}"
|
||||
|
||||
#: ../menu.py:142
|
||||
#: ../menu.py:149
|
||||
msgid "Mark document as read"
|
||||
msgstr "Marquer le document comme lu"
|
||||
|
||||
#: ../browser/ask_opinion.py:27
|
||||
#: ../browser/ask_opinion.py:25
|
||||
msgid "Opinion application for version ${version}"
|
||||
msgstr "Demande d'avis pour la version ${version}"
|
||||
|
||||
#: ../subscribers/document.py:109
|
||||
#: ../subscribers/document.py:111
|
||||
msgid "Process document"
|
||||
msgstr "Traiter le document"
|
||||
|
||||
|
@ -95,23 +103,27 @@ msgstr "Traiter le document"
|
|||
msgid "Process mail"
|
||||
msgstr "Traiter ce courrier"
|
||||
|
||||
#: ../browser/comments.py:102
|
||||
#: ../browser/comments.py:100
|
||||
msgid "Refuse refusal"
|
||||
msgstr "Refuser le refus"
|
||||
|
||||
#: ../menu.py:41
|
||||
#: ../menu.py:43
|
||||
msgid "Refuse version ${version}"
|
||||
msgstr "Refuser la version ${version}"
|
||||
|
||||
#: ../browser/comments.py:52
|
||||
#: ../browser/comments.py:50
|
||||
msgid "Render opinion"
|
||||
msgstr "Rendre un avis"
|
||||
|
||||
#: ../menu.py:147
|
||||
#: ../menu.py:154
|
||||
msgid "Return opinion about ${version}"
|
||||
msgstr "Rendre un avis sur la version ${version}"
|
||||
|
||||
#: ../menu.py:34
|
||||
#: ../browser/to_process.py:46
|
||||
msgid "Save"
|
||||
msgstr "OK"
|
||||
|
||||
#: ../menu.py:36
|
||||
msgid "Send for information"
|
||||
msgstr "Transmettre pour information"
|
||||
|
||||
|
@ -119,14 +131,23 @@ msgstr "Transmettre pour information"
|
|||
msgid "Tasks view"
|
||||
msgstr "Vue tâches"
|
||||
|
||||
#: ../menu.py:43
|
||||
#: ../menu.py:45
|
||||
msgid "Validate and finish version ${version}"
|
||||
msgstr "Valider et finaliser la version ${version}"
|
||||
|
||||
#: ../menu.py:40
|
||||
#: ../menu.py:42
|
||||
msgid "Validate version ${version}"
|
||||
msgstr "Valider la version ${version}"
|
||||
|
||||
#: ../browser/ask_validation.py:27
|
||||
#: ../browser/ask_validation.py:26
|
||||
msgid "Validation application for version ${version}"
|
||||
msgstr "Demande de validation pour la version ${version}"
|
||||
|
||||
#: ../browser/to_process.py:21
|
||||
msgid "Workflow action"
|
||||
msgstr "Transition du workflow"
|
||||
|
||||
#: ../browser/to_process.py:26
|
||||
msgid "You can enter a note."
|
||||
msgstr "Vous pouvez entrer une note."
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: pfwbged.policy\n"
|
||||
"POT-Creation-Date: 2013-08-30 17:32+0000\n"
|
||||
"POT-Creation-Date: 2013-09-04 09:37+0000\n"
|
||||
"PO-Revision-Date: 2013-08-30 19:33+0100\n"
|
||||
"Last-Translator: Cédric Messiant <cedric.messiant@gmail.com>\n"
|
||||
"Language-Team: French\n"
|
||||
|
@ -168,3 +168,4 @@ msgstr "En cours de validation"
|
|||
#: ../profiles/default/workflows/outgoingmail_workflow/definition.xml
|
||||
msgid "Writing"
|
||||
msgstr "En rédaction"
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"POT-Creation-Date: 2013-08-30 17:32+0000\n"
|
||||
"POT-Creation-Date: 2013-09-04 09:37+0000\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI +ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
@ -17,39 +17,39 @@ msgstr ""
|
|||
"Preferred-Encodings: utf-8 latin1\n"
|
||||
"Domain: pfwbged.policy\n"
|
||||
|
||||
#: ../menu.py:157
|
||||
#: ../menu.py:164
|
||||
msgid "${action} the version ${version}"
|
||||
msgstr ""
|
||||
|
||||
#: ../browser/comments.py:100
|
||||
#: ../browser/comments.py:98
|
||||
msgid "Accept refusal"
|
||||
msgstr ""
|
||||
|
||||
#: ../menu.py:86
|
||||
#: ../menu.py:93
|
||||
msgid "Actions"
|
||||
msgstr ""
|
||||
|
||||
#: ../menu.py:224
|
||||
#: ../menu.py:231
|
||||
msgid "Add ${title}"
|
||||
msgstr ""
|
||||
|
||||
#: ../browser/comments.py:101
|
||||
#: ../browser/comments.py:99
|
||||
msgid "Ask for refusal"
|
||||
msgstr ""
|
||||
|
||||
#: ../browser/ask_opinion.py:57
|
||||
#: ../browser/ask_opinion.py:55
|
||||
msgid "Ask opinion"
|
||||
msgstr ""
|
||||
|
||||
#: ../menu.py:38
|
||||
#: ../menu.py:40
|
||||
msgid "Ask opinion about version ${version}"
|
||||
msgstr ""
|
||||
|
||||
#: ../browser/ask_validation.py:59
|
||||
#: ../browser/ask_validation.py:58
|
||||
msgid "Ask validation"
|
||||
msgstr ""
|
||||
|
||||
#: ../menu.py:39
|
||||
#: ../menu.py:41
|
||||
msgid "Ask validation about version ${version}"
|
||||
msgstr ""
|
||||
|
||||
|
@ -61,11 +61,19 @@ msgstr ""
|
|||
msgid "Can view"
|
||||
msgstr ""
|
||||
|
||||
#: ../menu.py:33
|
||||
#: ../browser/to_process.py:63
|
||||
msgid "Cancel"
|
||||
msgstr ""
|
||||
|
||||
#: ../browser/to_process.py:25
|
||||
msgid "Comment"
|
||||
msgstr ""
|
||||
|
||||
#: ../menu.py:35
|
||||
msgid "Create a new version"
|
||||
msgstr ""
|
||||
|
||||
#: ../menu.py:323
|
||||
#: ../menu.py:330
|
||||
msgid "Create signed version for version ${version}"
|
||||
msgstr ""
|
||||
|
||||
|
@ -73,23 +81,23 @@ msgstr ""
|
|||
msgid "Create version ${version}"
|
||||
msgstr ""
|
||||
|
||||
#: ../menu.py:35
|
||||
#: ../menu.py:37
|
||||
msgid "File in a folder"
|
||||
msgstr ""
|
||||
|
||||
#: ../menu.py:42
|
||||
#: ../menu.py:44
|
||||
msgid "Finish version ${version}"
|
||||
msgstr ""
|
||||
|
||||
#: ../menu.py:142
|
||||
#: ../menu.py:149
|
||||
msgid "Mark document as read"
|
||||
msgstr ""
|
||||
|
||||
#: ../browser/ask_opinion.py:27
|
||||
#: ../browser/ask_opinion.py:25
|
||||
msgid "Opinion application for version ${version}"
|
||||
msgstr ""
|
||||
|
||||
#: ../subscribers/document.py:109
|
||||
#: ../subscribers/document.py:111
|
||||
msgid "Process document"
|
||||
msgstr ""
|
||||
|
||||
|
@ -97,23 +105,27 @@ msgstr ""
|
|||
msgid "Process mail"
|
||||
msgstr ""
|
||||
|
||||
#: ../browser/comments.py:102
|
||||
#: ../browser/comments.py:100
|
||||
msgid "Refuse refusal"
|
||||
msgstr ""
|
||||
|
||||
#: ../menu.py:41
|
||||
#: ../menu.py:43
|
||||
msgid "Refuse version ${version}"
|
||||
msgstr ""
|
||||
|
||||
#: ../browser/comments.py:52
|
||||
#: ../browser/comments.py:50
|
||||
msgid "Render opinion"
|
||||
msgstr ""
|
||||
|
||||
#: ../menu.py:147
|
||||
#: ../menu.py:154
|
||||
msgid "Return opinion about ${version}"
|
||||
msgstr ""
|
||||
|
||||
#: ../menu.py:34
|
||||
#: ../browser/to_process.py:46
|
||||
msgid "Save"
|
||||
msgstr ""
|
||||
|
||||
#: ../menu.py:36
|
||||
msgid "Send for information"
|
||||
msgstr ""
|
||||
|
||||
|
@ -121,15 +133,23 @@ msgstr ""
|
|||
msgid "Tasks view"
|
||||
msgstr ""
|
||||
|
||||
#: ../menu.py:43
|
||||
#: ../menu.py:45
|
||||
msgid "Validate and finish version ${version}"
|
||||
msgstr ""
|
||||
|
||||
#: ../menu.py:40
|
||||
#: ../menu.py:42
|
||||
msgid "Validate version ${version}"
|
||||
msgstr ""
|
||||
|
||||
#: ../browser/ask_validation.py:27
|
||||
#: ../browser/ask_validation.py:26
|
||||
msgid "Validation application for version ${version}"
|
||||
msgstr ""
|
||||
|
||||
#: ../browser/to_process.py:21
|
||||
msgid "Workflow action"
|
||||
msgstr ""
|
||||
|
||||
#: ../browser/to_process.py:26
|
||||
msgid "You can enter a note."
|
||||
msgstr ""
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"POT-Creation-Date: 2013-08-30 17:32+0000\n"
|
||||
"POT-Creation-Date: 2013-09-04 09:37+0000\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI +ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
|
|
@ -134,7 +134,7 @@ class CustomMenu(menu.WorkflowMenu):
|
|||
|
||||
description = ''
|
||||
|
||||
if action['id'] in ('submit', 'ask_opinion', 'attribute'):
|
||||
if action['id'] in ('submit', 'ask_opinion', 'attribute', 'to_process'):
|
||||
cssClass += " overlay-form-reload"
|
||||
|
||||
transition = action.get('transition', None)
|
||||
|
|
|
@ -228,7 +228,7 @@
|
|||
</guard>
|
||||
</transition>
|
||||
<transition transition_id="to_process" title="" new_state="processing" trigger="USER" before_script="" after_script="">
|
||||
<action url="%(content_url)s/content_status_modify?workflow_action=to_process" category="workflow" icon="" i18n:translate="">To process</action>
|
||||
<action url="%(content_url)s/@@to_process?workflow_action=to_process" category="workflow" icon="" i18n:translate="">To process</action>
|
||||
<guard>
|
||||
<guard-role>Greffier</guard-role>
|
||||
<guard-role>Manager</guard-role>
|
||||
|
|
|
@ -22,7 +22,7 @@ from pfwbged.policy.interfaces import IIncomingMailAttributed
|
|||
from pfwbged.basecontent.behaviors import IPfwbIncomingMail
|
||||
|
||||
|
||||
def create_tasks(container, groups, deadline):
|
||||
def create_tasks(container, groups, deadline, note=""):
|
||||
"""Create 'process mail' tasks for a list of groups or users.
|
||||
"""
|
||||
chooser = INameChooser(container)
|
||||
|
@ -31,6 +31,7 @@ def create_tasks(container, groups, deadline):
|
|||
'title': translate(_(u'Process mail'),
|
||||
context=container.REQUEST),
|
||||
'deadline': deadline,
|
||||
'note': note,
|
||||
}
|
||||
newid = chooser.chooseName('process-mail', container)
|
||||
container.invokeFactory('task', newid, **params)
|
||||
|
@ -51,26 +52,24 @@ def get_tasks(obj):
|
|||
return tasks
|
||||
|
||||
|
||||
@grok.subscribe(IPfwbIncomingMail, IAfterTransitionEvent)
|
||||
def incoming_mail_attributed(context, event):
|
||||
def incoming_mail_attributed(context, comment):
|
||||
"""Launched when a mail is attributed to some groups or users.
|
||||
"""
|
||||
if event.transition is not None and event.transition.id == 'to_process':
|
||||
# first, copy treated_by and in_copy into treating_groups and recipient_groups
|
||||
treating_groups = list(frozenset((context.treating_groups or []) + (context.treated_by or [])))
|
||||
treating_dm = LocalRolesToPrincipalsDataManager(context, IDmsIncomingMail['treating_groups'])
|
||||
treating_dm.set(treating_groups)
|
||||
recipient_groups = list(frozenset((context.recipient_groups or []) + (context.in_copy or [])))
|
||||
recipient_dm = LocalRolesToPrincipalsDataManager(context, IDmsIncomingMail['recipient_groups'])
|
||||
recipient_dm.set(recipient_groups)
|
||||
context.reindexObjectSecurity()
|
||||
# first, copy treated_by and in_copy into treating_groups and recipient_groups
|
||||
treating_groups = list(frozenset((context.treating_groups or []) + (context.treated_by or [])))
|
||||
treating_dm = LocalRolesToPrincipalsDataManager(context, IDmsIncomingMail['treating_groups'])
|
||||
treating_dm.set(treating_groups)
|
||||
recipient_groups = list(frozenset((context.recipient_groups or []) + (context.in_copy or [])))
|
||||
recipient_dm = LocalRolesToPrincipalsDataManager(context, IDmsIncomingMail['recipient_groups'])
|
||||
recipient_dm.set(recipient_groups)
|
||||
context.reindexObjectSecurity()
|
||||
|
||||
already_in_charge = []
|
||||
for task in context.objectValues('task'):
|
||||
already_in_charge.extend(task.responsible)
|
||||
new_treating_groups = frozenset(context.treating_groups or []) - frozenset(already_in_charge)
|
||||
# create a task for each group which has not already a task for this mail
|
||||
create_tasks(context, new_treating_groups, context.deadline)
|
||||
already_in_charge = []
|
||||
for task in context.objectValues('task'):
|
||||
already_in_charge.extend(task.responsible)
|
||||
new_treating_groups = frozenset(context.treating_groups or []) - frozenset(already_in_charge)
|
||||
# create a task for each group which has not already a task for this mail
|
||||
create_tasks(context, new_treating_groups, context.deadline, comment)
|
||||
|
||||
#
|
||||
#@grok.subscribe(IPfwbIncomingMail, IObjectModifiedEvent)
|
||||
|
|
|
@ -125,6 +125,9 @@ Open favorite
|
|||
Click element css=#favorites a[href$='${name}']
|
||||
Wait Until Page Contains Element id=searchresults
|
||||
|
||||
Close Overlay
|
||||
Click Element css=div.overlay div.close
|
||||
|
||||
Overlay should close
|
||||
Element should not remain visible id=exposeMask
|
||||
Wait until keyword succeeds 60 1 Page should not contain element css=div.overlay
|
||||
|
@ -229,7 +232,21 @@ Scenario
|
|||
Log in as greffier
|
||||
Go to ${PLONE_URL}/documents/new-mail
|
||||
Execute transition to_process
|
||||
Overlay is opened
|
||||
Input Text form.widgets.comment merci de traiter
|
||||
Save form
|
||||
Wait Until Page Contains En cours de traitement
|
||||
State should be En cours de traitement
|
||||
# the task has been created
|
||||
Page Should Contain Traiter ce courrier
|
||||
# verify the comment has been added to the created task
|
||||
# by opening the overlay and close it
|
||||
Page Should Not Contain Traiter le document
|
||||
Click Link Traiter ce courrier
|
||||
Overlay is opened
|
||||
Page Should Contain merci de traiter
|
||||
Close Overlay
|
||||
Overlay should close
|
||||
|
||||
[Documentation] Finances group member sees document
|
||||
Log in as finances
|
||||
|
|
Reference in New Issue