workflows: allow computed expression as choice button label (#11158)

This commit is contained in:
Frédéric Péters 2016-06-01 09:28:11 +02:00
parent bff7c291e2
commit ced3927a7f
1 changed files with 3 additions and 2 deletions

View File

@ -1760,7 +1760,7 @@ class ChoiceWorkflowStatusItem(WorkflowStatusJumpItem):
return _('Change Status (not completed)')
def fill_form(self, form, formdata, user):
form.add_submit('button%s' % self.id, self.label)
form.add_submit('button%s' % self.id, self.compute(self.label))
if self.require_confirmation:
get_response().add_javascript(['jquery.js', '../../i18n.js', 'qommon.js'])
widget = form.get_widget('button%s' % self.id)
@ -1777,7 +1777,8 @@ class ChoiceWorkflowStatusItem(WorkflowStatusJumpItem):
def add_parameters_widgets(self, form, parameters, prefix='', formdef=None):
if 'label' in parameters:
form.add(StringWidget, '%slabel' % prefix, title = _('Label'), value = self.label)
form.add(ComputedExpressionWidget, '%slabel' % prefix,
title=_('Label'), value=self.label)
WorkflowStatusJumpItem.add_parameters_widgets(self, form, parameters, prefix, formdef)
if 'by' in parameters:
form.add(WidgetList, '%sby' % prefix, title = _('By'), element_type = SingleSelectWidget,