Commit 25e74888 authored by Gabriel Monnerat's avatar Gabriel Monnerat

erp5_document_scanner: Use portal_ids to generate ids in order

parent 3ba804f5
......@@ -5,14 +5,6 @@
import string
import random
reference = str(
DateTime().millis()) + '-' + ''.join(
random.sample(
string.letters+string.digits, random.randint(
6, 10)
)
)
portal = context.getPortalObject()
if REQUEST:
......@@ -23,5 +15,11 @@ if active_process_url:
else:
active_process = portal.portal_activities.newActiveProcess()
active_process.postActiveResult(detail=detail, reference=reference)
return active_process, reference
if generate_new_uid:
id_group = ('document_scanner_js', active_process.getUid())
new_uid = portal.portal_ids.generateNewId(id_group=id_group, default=0)
else:
new_uid = None
active_process.postActiveResult(detail=detail, reference=new_uid)
return active_process, new_uid
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>active_process_url, detail, REQUEST=None, **kw</string> </value>
<value> <string>active_process_url, detail, generate_new_uid=False, REQUEST=None, **kw</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
......
import json
_, uuid = context.Base_postDataToActiveResult(
active_process_url, input_value)
active_process_url, input_value,
generate_new_uid=True)
return json.dumps({"uuid": uuid})
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