Commit 05f84873 authored by Tristan Cavelier's avatar Tristan Cavelier

erp5_officejs_support_request_ui: extend way to get support types

split SupportRequest_getSupportTypeList with another script called
SupportRequest_getSupportTypeListFromProjectValue
parent d2bc4764
...@@ -10,15 +10,7 @@ try: ...@@ -10,15 +10,7 @@ try:
except IndexError: except IndexError:
project = None project = None
result = [] result = context.SupportRequest_getSupportTypeListFromProjectValue(project)
if project is not None:
sale_supply_list = portal.portal_catalog(portal_type="Sale Supply", destination_project_uid=project.getUid())
for sale_supply in sale_supply_list:
sale_supply_line_list = sale_supply.contentValues(portal_type='Sale Supply Line')
for supply_line in sale_supply_line_list:
service = supply_line.getResourceValue()
if service is not None:
result.append((service.getTitle(), service.getId()))
if json_flag: if json_flag:
from json import dumps from json import dumps
......
# /!\ proxy role !
portal = context.getPortalObject()
result = []
if project_value is not None:
sale_supply_list = portal.portal_catalog(portal_type="Sale Supply", destination_project_uid=project_value.getUid())
for sale_supply in sale_supply_list:
sale_supply_line_list = sale_supply.contentValues(portal_type='Sale Supply Line')
for supply_line in sale_supply_line_list:
service = supply_line.getResourceValue()
if service is not None:
result.append((service.getTitle(), service.getId()))
return result
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>project_value</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Auditor</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SupportRequest_getSupportTypeListFromProjectValue</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
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