Commit c534798a 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 0fa28958
......@@ -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>
......
# coding: utf-8
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 = [
(u'Accounting & Finance', None, 0),
(u'Accounting', None, 1),
(u'Accounting Agent', 'af/accounting/agent', 2),
(u'Accounting Manager', 'af/accounting/manager', 2),
(u'Accounting & Finance Manager', 'af/manager', 1),
(u'Company', None, 0),
(u'Company Agent', 'company/agent', 1),
(u'Company Executive', 'company/executive', 1),
(u'Company Manager', 'company/manager', 1),
(u'Headquarters', None, 0),
(u'Headquarters Agent', 'hq/agent', 1),
(u'Headquarters Executive', 'hq/executive', 1),
(u'Headquarters Manager', 'hq/manager', 1),
(u'Human Resources', None, 0),
(u'Human Resources Agent', 'hr/agent', 1),
(u'Human Resources Manager', 'hr/manager', 1),
(u'Information Systems', None, 0),
(u'Information Systems Manager', 'is/manager', 1),
(u'Software Developer', 'is/developer', 1),
(u'System Administrator', 'is/admin', 1),
(u'Marketing', None, 0),
(u'Marketing Agent', 'marketing/agent', 1),
(u'Marketing Manager', 'marketing/manager', 1),
(u'Production – Manufacturing', None, 0),
(u'Production Agent', 'production/agent', 1),
(u'Production Manager', 'production/manager', 1),
(u'Project Management & Implementation', None, 0),
(u'Developer for a Project', 'project/developer', 1),
(u'Project Manager', 'project/manager', 1),
(u'Purchase', None, 0),
(u'Purchase Agent', 'purchase/agent', 1),
(u'Purchase Manager', 'purchase/manager', 1),
(u'Research and Development', None, 0),
(u'Research and Development Agent', 'rd/agent', 1),
(u'Research and Development Manager', 'rd/manager', 1),
(u'Sales', None, 0),
(u'Sales Agent', 'sales/agent', 1),
(u'Sales Manager', 'sales/manager', 1),
(u'Subsidiary', None, 0),
(u'Subsidiary Agent', 'subsidiary/agent', 1),
(u'Subsidiary Manager', 'subsidiary/manager', 1),
(u'Warehouse', None, 0),
(u'Warehouse Agent', 'warehouse/agent', 1),
(u'Warehouse Manager', 'warehouse/manager', 1),
]
return [['', '']] + [[
(u"\N{NO-BREAK SPACE}" * 4 * depth ).encode('utf-8') + str(translateString(title)),
relative_url,
] for (title, relative_url, depth) 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