Commit fb95b945 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_crm: Remove unsupported sort, and make the script more reusable

parent fd0b8d89
...@@ -16,13 +16,11 @@ query = ComplexQuery( ...@@ -16,13 +16,11 @@ query = ComplexQuery(
logical_operator='and'), logical_operator='and'),
logical_operator='or') logical_operator='or')
# Use event modification date instead. kw['sort_on'] = (('modification_date', 'DESC'),)
kw['sort_on'] = (("catalog.simulation_state='suspended'", 'DESC'), if 'simulation_state' not in kw:
("catalog.simulation_state='validated'", 'DESC'), kw['simulation_state'] = "NOT cancelled"
("catalog.simulation_state='confirmed'", 'DESC'), if 'limit' not in kw:
('modification_date', 'DESC'),) kw['limit'] = 30
kw['simulation_state'] = "NOT cancelled"
kw['limit'] = 30
result_list = [] result_list = []
for document in portal.portal_catalog(query=query, **kw): for document in portal.portal_catalog(query=query, **kw):
if document.getPortalType() == "Upgrade Decision Line": if document.getPortalType() == "Upgrade Decision Line":
......
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