Commit 3ac558e0 authored by Gabriel Monnerat's avatar Gabriel Monnerat Committed by Jérome Perrin

CUSTOM erp5_officejs_support_request: Add visa_file_reference as parameter and...

CUSTOM erp5_officejs_support_request: Add visa_file_reference as parameter and redirect to the expected view

In support request, we need to receive visa_file_reference and store it as causality. With this, we have the relation between Support Request and Visa File

Also, we change the action reference because the previous is not available in our scenario(Default View Action reference).
parent 449bb91a
...@@ -6,7 +6,19 @@ logged_in_user_value = portal.portal_membership.getAuthenticatedMember().getUser ...@@ -6,7 +6,19 @@ logged_in_user_value = portal.portal_membership.getAuthenticatedMember().getUser
now = DateTime() now = DateTime()
project_object = portal.project_module[project] project_object = portal.portal_catalog.getResultValue(portal_type="Project", id=project)
default_causality_value = None
if visa_file_reference:
visa_file_list = portal.portal_catalog(
portal_type="Visa File",
reference={'query': visa_file_reference, 'key': 'ExactMatch'},
limit=1
)
if visa_file_list:
default_causality_value = visa_file_list[0].getObject()
support_request = portal.support_request_module.newContent( support_request = portal.support_request_module.newContent(
portal_type='Support Request', portal_type='Support Request',
...@@ -33,7 +45,7 @@ if description is not None or file is not None: ...@@ -33,7 +45,7 @@ if description is not None or file is not None:
source_reference=source_reference, source_reference=source_reference,
) )
return support_request.Base_redirect('officejs_support_request_view', return support_request.Base_redirect('view',
keep_items={ keep_items={
'portal_status_message': translateString( 'portal_status_message': translateString(
'New Support Request created.', 'New Support Request created.',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment