misc: allow edit action on disabled forms (#42454)
This commit is contained in:
parent
d66eab7cd9
commit
c357c2f5c9
|
@ -3315,6 +3315,45 @@ def test_backoffice_wfedit(pub):
|
|||
number31.store()
|
||||
|
||||
|
||||
def test_backoffice_wfedit_disabled(pub):
|
||||
user = create_user(pub)
|
||||
create_environment(pub)
|
||||
formdef = FormDef.get_by_urlname('form-title')
|
||||
form_class = formdef.data_class()
|
||||
|
||||
number31 = [x for x in form_class.select() if x.data['1'] == 'FOO BAR 30'][0]
|
||||
number31.submission_context = {
|
||||
'mail_url': 'http://www.example.com/test.pdf',
|
||||
}
|
||||
number31.store()
|
||||
|
||||
# attach a custom workflow
|
||||
workflow = Workflow(name='wfedit')
|
||||
st1 = workflow.add_status('Status1', number31.status.split('-')[1])
|
||||
|
||||
wfedit = EditableWorkflowStatusItem()
|
||||
wfedit.id = '_wfedit'
|
||||
wfedit.by = [user.roles[0]]
|
||||
st1.items.append(wfedit)
|
||||
wfedit.parent = st1
|
||||
workflow.store()
|
||||
|
||||
formdef.workflow_id = workflow.id
|
||||
formdef.store()
|
||||
|
||||
app = login(get_app(pub))
|
||||
|
||||
formdef.disabled = True
|
||||
formdef.store()
|
||||
resp = app.get('/backoffice/management/form-title/%s/' % number31.id)
|
||||
resp = resp.form.submit('button_wfedit')
|
||||
resp = resp.follow()
|
||||
resp.form['f2'].value = 'bar'
|
||||
resp = resp.form.submit('submit')
|
||||
resp = resp.follow()
|
||||
assert form_class().get(number31.id).data['2'] == 'bar'
|
||||
|
||||
|
||||
def test_backoffice_wfedit_submission(pub):
|
||||
user = create_user(pub)
|
||||
create_environment(pub)
|
||||
|
|
|
@ -629,7 +629,7 @@ class FormPage(Directory, FormTemplateMixin):
|
|||
if authentication_context_check_result:
|
||||
return authentication_context_check_result
|
||||
|
||||
if self.check_disabled():
|
||||
if not self.edit_mode and self.check_disabled():
|
||||
return redirect(self.check_disabled())
|
||||
|
||||
session = get_session()
|
||||
|
|
Loading…
Reference in New Issue