Create a board decision from a note for board #22013
This commit is contained in:
parent
9be18c4b00
commit
4213ecfd77
|
@ -0,0 +1,44 @@
|
|||
from five import grok
|
||||
from plone import api
|
||||
from pfwbged.basecontent.types import INoteForBoard
|
||||
|
||||
|
||||
class CreateBoardDecision(grok.View):
|
||||
"""Create a board decision from a note for board"""
|
||||
|
||||
grok.name('create_board_decision')
|
||||
grok.context(INoteForBoard)
|
||||
grok.require("zope2.View")
|
||||
|
||||
def render(self):
|
||||
note = self.context
|
||||
|
||||
values_params = [
|
||||
u'form.widgets.IBasic.title={}'.format(
|
||||
note.title,
|
||||
),
|
||||
u'form.widgets.related_docs:list={}'.format(
|
||||
u'/'.join(note.getPhysicalPath()),
|
||||
),
|
||||
]
|
||||
|
||||
list_fields = {
|
||||
'treated_by': 'IPfwbDocument.treated_by',
|
||||
'treating_groups': 'treating_groups',
|
||||
'recipient_groups': 'recipient_groups',
|
||||
'keywords': 'IPfwbDocument.keywords',
|
||||
}
|
||||
for field_id, field_param_id in list_fields.items():
|
||||
field = getattr(note, field_id, []) or []
|
||||
for item in field:
|
||||
values_params.append(
|
||||
u'form.widgets.{}:list={}'.format(field_param_id, item)
|
||||
)
|
||||
|
||||
documents_folder_url = api.portal.get()['documents'].absolute_url()
|
||||
encoded_params = "&".join(values_params).encode('utf-8')
|
||||
url = '{0}/++add++pfwb.boarddecision?{1}'.format(
|
||||
documents_folder_url,
|
||||
encoded_params,
|
||||
)
|
||||
self.request.response.redirect(url)
|
|
@ -446,11 +446,13 @@ class CustomMenu(menu.WorkflowMenu):
|
|||
action['title'] = _(u"Create signed version for version ${version}",
|
||||
mapping={'version': context.Title()})
|
||||
cssClass += " overlay-form-reload"
|
||||
elif action['id'] == 'create_outgoing_mail':
|
||||
elif action['id'] in (
|
||||
'create_outgoing_mail',
|
||||
'create_board_decision',
|
||||
'delete',
|
||||
):
|
||||
# make it overlay !
|
||||
cssClass += ' overlay-form-redirect'
|
||||
elif action['id'] == 'delete':
|
||||
cssClass += " overlay-form-redirect"
|
||||
|
||||
if action['allowed']:
|
||||
aid = action['id']
|
||||
|
@ -563,14 +565,6 @@ class CustomMenu(menu.WorkflowMenu):
|
|||
# wf actions on informations
|
||||
actions.extend(self.getWorkflowActionsForType(context, request, 'information'))
|
||||
|
||||
if context.portal_type in ('pfwb.boarddecision',):
|
||||
# ideally this condition would be part of the task action
|
||||
# condition_expr, but that would require to get down from there
|
||||
# back to the document; it's much easier to just hide it from
|
||||
# here.
|
||||
actions = [x for x in actions if \
|
||||
x.get('extra').get('id') != 'plone-contentmenu-actions-create_outgoing_mail']
|
||||
|
||||
if ICollection.providedBy(context):
|
||||
# edition of collections is done inline, remove edit action but add
|
||||
# save and save as
|
||||
|
|
Reference in New Issue