Commit 7c3d482f authored by Jérome Perrin's avatar Jérome Perrin

officejs_support_request_ui: simplify date arithmetics

parent 29795b08
from datetime import timedelta
from json import dumps from json import dumps
portal = context.getPortalObject() portal = context.getPortalObject()
# Get the split date # Get the split date
now_date = DateTime() now_date = DateTime().asdatetime()
date_2 = now_date - 2 date_2_midnight = DateTime(now_date - timedelta(days=2)).earliestTime()
date_7 = now_date - 7 date_7_midnight = DateTime(now_date - timedelta(days=7)).earliestTime()
date_30 = now_date - 30 date_30_midnight = DateTime(now_date - timedelta(days=30)).earliestTime()
# we can not use str.join...
date_2_midnight = DateTime(str(date_2.year()) + "-" + str(date_2.month()) + "-" + str(date_2.day()))
date_7_midnight = DateTime(str(date_7.year()) + "-" + str(date_7.month()) + "-" + str(date_7.day()))
date_30_midnight = DateTime(str(date_30.year()) + "-" + str(date_30.month()) + "-" + str(date_30.day()))
support_request_list = portal.portal_catalog( support_request_list = portal.portal_catalog(
portal_type="Support Request", portal_type="Support Request",
select_list=['simulation_state', 'start_date'], select_list=['simulation_state', 'start_date'],
**{"delivery.start_date": {"query": now_date, "range": "ngt"}} **{"delivery.start_date": {"query": DateTime(now_date), "range": "ngt"}}
) )
count_by_state = {} count_by_state = {}
......
  • @jerome I wonder if we should also some filtering of local_roles here? Current configuration would give everything that user has view permission in, but maybe only Assignors or Assignees should give things in the graphs?

  • Thanks @georgios.dagkakis . I'm not sure local roles filter is always good here, currently this dashboard can be used by some managers, CEOs etc who just have Auditor role.

    Thierry also suggested that we had a drop down menu to filter by project on this page, it's on my TODO list (but with low priority) if your concern is "this page show me tickets from all projects, even the ones I'm not working on", then this project filter could be the solution I guess ?

  • Yes indeed, a project filter would be better in this case. I may check also with Thierry on the plan for this

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