Commit 560ccc5d authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

erp5_base: create an Active Process for successful case as well if the last result is bad.

parent 20c95080
from Products.CMFActivity.ActiveResult import ActiveResult
from Products.ZSQLCatalog.SQLCatalog import SimpleQuery, ComplexQuery
portal = context.getPortalObject() portal = context.getPortalObject()
result = [] result = []
sql_result = portal.ERP5Site_zGetDuplicateLoginReferenceList() sql_result = portal.ERP5Site_zGetDuplicateLoginReferenceList()
if len(sql_result): if len(sql_result):
from Products.CMFActivity.ActiveResult import ActiveResult
from Products.ZSQLCatalog.SQLCatalog import SimpleQuery, ComplexQuery
query = ComplexQuery( query = ComplexQuery(
*[ComplexQuery(SimpleQuery(portal_type=i['portal_type']), *[ComplexQuery(SimpleQuery(portal_type=i['portal_type']),
SimpleQuery(reference=i['reference'])) for i in sql_result], SimpleQuery(reference=i['reference'])) for i in sql_result],
...@@ -16,6 +16,13 @@ if len(sql_result): ...@@ -16,6 +16,13 @@ if len(sql_result):
active_result.edit(summary='Logins having the same reference exist', active_result.edit(summary='Logins having the same reference exist',
severity=len(sql_result), severity=len(sql_result),
detail='\n'.join(result)) detail='\n'.join(result))
active_process = context.newActiveProcess() elif context.sense():
active_process.postResult(active_result) active_result = ActiveResult()
return active_process active_result.edit(summary='Logins having the same reference does not exist',
severity=0)
else:
return
active_process = context.newActiveProcess()
active_process.postResult(active_result)
return active_process
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