Commit 3078ef7a authored by Gabriel Monnerat's avatar Gabriel Monnerat

erp5_document_scanner: Response body may contain a local reference of the uploaded image

The http response should return a 200 response in case of success. The response body may contain a local reference of the uploaded image
parent cca2acc0
...@@ -2,6 +2,17 @@ ...@@ -2,6 +2,17 @@
We need proy role as manager to create a new active process We need proy role as manager to create a new active process
and post active result and post active result
""" """
import string
import random
reference = str(
DateTime().millis()) + '-' + ''.join(
random.sample(
string.letters+string.digits, random.randint(
6, 10)
)
)
portal = context.getPortalObject() portal = context.getPortalObject()
if REQUEST: if REQUEST:
...@@ -12,6 +23,5 @@ if active_process_url: ...@@ -12,6 +23,5 @@ if active_process_url:
else: else:
active_process = portal.portal_activities.newActiveProcess() active_process = portal.portal_activities.newActiveProcess()
active_process.postActiveResult(detail=detail) active_process.postActiveResult(detail=detail, reference=reference)
return active_process, reference
return active_process
...@@ -30,7 +30,7 @@ if not image_str: ...@@ -30,7 +30,7 @@ if not image_str:
return context.Base_renderForm('Base_viewUploadDocumentFromCameraDialog', return context.Base_renderForm('Base_viewUploadDocumentFromCameraDialog',
message=translateString('Nothing to capture')) message=translateString('Nothing to capture'))
active_process = context.Base_postDataToActiveResult( active_process, _ = context.Base_postDataToActiveResult(
active_process_url, active_process_url,
image_str) image_str)
......
return context.REQUEST import json
_, reference = context.Base_postDataToActiveResult(
active_process_url, input_value)
return json.dumps({"reference": reference})
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>**kw</string> </value> <value> <string>input_value, active_process_url, **kw</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
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