Commit 1f5a41af authored by Jérome Perrin's avatar Jérome Perrin

configurator: Introduce scripts to get region and function items

Some configurator profiles uses a spreadsheet to define categories
(consulting configurator), some use a business templates.

For the ones using business template, because the categories are not available
yet we have the values directly in the script.
parent aaa303b4
......@@ -151,7 +151,7 @@
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: context.BusinessConfiguration_getCategoriesSpreadsheetConfiguratorItem().getCategoryTitleItemList(\'region\')</string> </value>
<value> <string>context/BusinessConfiguration_getRegionTitleItemList</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -127,7 +127,7 @@
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: context.BusinessConfiguration_getCategoriesSpreadsheetConfiguratorItem().getCategoryTitleItemList(\'function\')</string> </value>
<value> <string>context/BusinessConfiguration_getFunctionTitleItemList</string> </value>
</item>
</dictionary>
</pickle>
......
from Products.ERP5Type.Message import translateString
if context.getGlobalConfigurationAttr('categories_spreadsheet_configuration_save_relative_url'):
item_list_from_spreadsheet = context.BusinessConfiguration_getCategoriesSpreadsheetConfiguratorItem().getCategoryTitleItemList('function')
if item_list_from_spreadsheet != [('', '')]:
return item_list_from_spreadsheet
function_item_list = [
('Accounting & Finance', None),
('Accounting', 'af/accounting'),
('Accounting Agent', 'af/accounting/agent'),
('Accounting Manager', 'af/accounting/manager'),
('Accounting & Finance Manager', 'af/manager'),
('Company', None),
('Company Agent', 'company/agent'),
('Company Executive', 'company/executive'),
('Company Manager', 'company/manager'),
('Headquarters', None),
('Headquarters Agent', 'hq/agent'),
('Headquarters Executive', 'hq/executive'),
('Headquarters Manager', 'hq/manager'),
('Human Resources', None),
('Human Resources Agent', 'hr/agent'),
('Human Resources Manager', 'hr/manager'),
('Information Systems', None),
('Information Systems Manager', 'is/manager'),
('Software Developer', 'is/developer'),
('System Administrator', 'is/admin'),
('Marketing', None),
('Marketing Agent', 'marketing/agent'),
('Marketing Manager', 'marketing/manager'),
('Production \xe2\x80\x93 Manufacturing', None),
('Production Agent', 'production/agent'),
('Production Manager', 'production/manager'),
('Project Management & Implementation', None),
('Developer for a Project', 'project/developer'),
('Project Manager', 'project/manager'),
('Purchase', None),
('Purchase Agent', 'purchase/agent'),
('Purchase Manager', 'purchase/manager'),
('Research and Development', None),
('Research and Development Agent', 'rd/agent'),
('Research and Development Manager', 'rd/manager'),
('Sales', None),
('Sales Agent', 'sales/agent'),
('Sales Manager', 'sales/manager'),
('Subsidiary', None),
('Subsidiary Agent', 'subsidiary/agent'),
('Subsidiary Manager', 'subsidiary/manager'),
('Warehouse', None),
('Warehouse Agent', 'warehouse/agent'),
('Warehouse Manager', 'warehouse/manager'),
]
return [('', '')] + [(translateString(title), relative_url) for (title, relative_url) in function_item_list]
<?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></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>BusinessConfiguration_getFunctionTitleItemList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>BusinessConfiguration_getRegionTitleItemList</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