Commit 5ba6d609 authored by Boxiang Sun's avatar Boxiang Sun Committed by Eteri

erp5_officejs_support_request_ui: Remove redundant query in these two python script.

parent b5e79630
portal = context.getPortalObject() portal = context.getPortalObject()
# get the related Support Request, this should not be None
support_request_list = portal.portal_catalog(portal_type="Support Request", id=context.getId()) # with id keyword, this function will return a sequence data type which contains one element.
support_request_object = support_request_list[0].getObject()
# get the all HTML Posts which related to this Support Request # get the all HTML Posts which related to this Support Request
post_list = portal.portal_catalog(portal_type="HTML Post", strict_follow_up_uid=context.getUid(), sort_on=(('modification_date', 'descending'),), limit=1, validation_state="published") # with id keyword, this function will return a sequence data type which contains one element.
post_list = portal.portal_catalog(portal_type="HTML Post", strict_follow_up_uid=support_request_object.getUid(), sort_on=(('modification_date', 'descending'),), limit=1, validation_state="published") # with id keyword, this function will return a sequence data type which contains one element.
if len(post_list): if len(post_list):
return post_list[0].getTextContent() return post_list[0].getTextContent()
......
portal = context.getPortalObject()
# get the related Support Request, this should not be None
support_request_list = portal.portal_catalog(portal_type="Support Request", id=context.getId()) # with id keyword, this function will return a sequence data type which contains one element.
support_request_object = support_request_list[0].getObject()
support_request_link = context.absolute_url() support_request_link = context.absolute_url()
hash_position = support_request_link.index('support_request_module') hash_position = support_request_link.index('support_request_module')
......
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