Commit 475b5c6f authored by Gabriel Monnerat's avatar Gabriel Monnerat

erp5_document_scanner: Use portal_ids to generate ids in order

parent 0a0fe70a
...@@ -5,14 +5,6 @@ ...@@ -5,14 +5,6 @@
import string import string
import random 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:
...@@ -23,5 +15,11 @@ if active_process_url: ...@@ -23,5 +15,11 @@ if active_process_url:
else: else:
active_process = portal.portal_activities.newActiveProcess() active_process = portal.portal_activities.newActiveProcess()
active_process.postActiveResult(detail=detail, reference=reference) if generate_new_uid:
return active_process, reference 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 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <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>
<item> <item>
<key> <string>_proxy_roles</string> </key> <key> <string>_proxy_roles</string> </key>
......
import json import json
_, uuid = context.Base_postDataToActiveResult( _, uuid = context.Base_postDataToActiveResult(
active_process_url, input_value) active_process_url, input_value,
generate_new_uid=True)
return json.dumps({"uuid": uuid}) 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