Commit e01a4b39 authored by Rafael Monnerat's avatar Rafael Monnerat

Install categories via Spreadsheet instead use business templates

parent c37602ac
......@@ -45,7 +45,7 @@
<key> <string>categories</string> </key>
<value>
<tuple>
<string>destination/workflow_module/erp5_standard_workflow/3</string>
<string>destination/workflow_module/erp5_standard_workflow/6</string>
</tuple>
</value>
</item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="State" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_count</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>_local_properties</string> </key>
<value>
<tuple>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>comment</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>string</string> </value>
</item>
</dictionary>
</tuple>
</value>
</item>
<item>
<key> <string>_mt_index</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>_tree</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>destination/workflow_module/erp5_standard_workflow/3</string>
</tuple>
</value>
</item>
<item>
<key> <string>comment</string> </key>
<value> <string>Configure Preference</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>5</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>State</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Category</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Length" module="BTrees.Length"/>
</pickle>
<pickle> <int>0</int> </pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Transition" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_count</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>_mt_index</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>_tree</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>after_script_id</string> </key>
<value> <string>BusinessConfiguration_setupStandardCategory</string> </value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>destination/workflow_module/erp5_standard_workflow/5</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>guard_expression</string> </key>
<value> <string>python: True</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>6</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Transition</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Setup Category</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Length" module="BTrees.Length"/>
</pickle>
<pickle> <int>0</int> </pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
</ZopeData>
......@@ -63,7 +63,6 @@ bt5_installation_list = (\'erp5_dhtml_style\',\n
\'erp5_crm_knowledge_pad\',\n
\'erp5_tax_resource\',\n
\'erp5_discount_resource\',\n
\'erp5_configurator_standard_categories\',\n
\'erp5_ods_style\',\n
\'erp5_odt_style\',\n
\'erp5_ooo_import\',\n
......
<?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>_body</string> </key>
<value> <string>configuration_save = context.restrictedTraverse(configuration_save_url)\n
\n
context.setGlobalConfigurationAttr(\n
categories_spreadsheet_configuration_save_relative_url=configuration_save.getRelativeUrl())\n
\n
configuration_save.addConfigurationItem("Categories Spreadsheet Configurator Item",\n
configuration_spreadsheet_data = getattr(context, "standard_category.ods").data)\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>configuration_save_url=None, **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>BusinessConfiguration_setupStandardCategory</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -108,11 +108,11 @@ class TestConsultingConfiguratorWorkflow(TestLiveConfiguratorWorkflowMixin):
def afterSetUp(self):
TestLiveConfiguratorWorkflowMixin.afterSetUp(self)
categories_file_id = 'consulting_configurator_sample_categories.ods'
categories_file_id = 'standard_category.ods'
self.categories_file_path, self.categories_file_upload = \
self.uploadFile(categories_file_id)
roles_file_id = 'consulting_configurator_sample_roles_configuration_sheet.ods'
roles_file_id = 'standard_portal_type_roles.ods'
self.roles_file_path, self.roles_file_upload = \
self.uploadFile(roles_file_id)
# set the company employees number
......@@ -245,7 +245,7 @@ class TestConsultingConfiguratorWorkflow(TestLiveConfiguratorWorkflowMixin):
""" Check if organisation was created fine """
business_configuration = sequence.get("business_configuration")
# last one: a step for what the client selected
organisation_config_save = business_configuration['5']
organisation_config_save = business_configuration['6']
self.assertEquals(1, len(organisation_config_save.contentValues()))
# first item: configuration of our organisation
organisation_config_item = organisation_config_save['1']
......@@ -524,7 +524,7 @@ class TestStandardConfiguratorWorkflow(TestLiveConfiguratorWorkflowMixin):
default_address_region):
""" Check if configuration key was created fine """
# last one: a step for what the client selected
organisation_config_save = business_configuration['4']
organisation_config_save = business_configuration['5']
self.assertEquals(2, len(organisation_config_save.contentValues()))
# first item: configuration of our organisation
organisation_config_item = organisation_config_save['1']
......@@ -548,7 +548,7 @@ class TestStandardConfiguratorWorkflow(TestLiveConfiguratorWorkflowMixin):
self.assertEquals(category_config_item.getTitle(),
'My Organisation')
self.assertEquals(4, len(business_configuration.contentValues(portal_type="Configuration Save")))
self.assertEquals(5, len(business_configuration.contentValues(portal_type="Configuration Save")))
self.assertEquals(0, len(business_configuration.contentValues(portal_type="Link")))
def stepCheckOrganisationConfiguratorItemFrance(self, sequence=None, sequence_list=None, **kw):
......
......@@ -58,7 +58,6 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
'erp5_tax_resource',
'erp5_discount_resource',
'erp5_invoicing',
'erp5_configurator_standard_categories',
'erp5_trade_knowledge_pad',
'erp5_crm_knowledge_pad',
'erp5_simplified_invoicing',
......
  • @rafael do you remember the reason for this ?

    I feel it can be for unification of the code with consulting configurator (with consulting we upload a spreadsheet and categories come from the spreadsheet). There was also this idea that spreadsheet is the source of trust (we create business template by importing spreadsheet).

    I was working on configurator to make erp5_configurator_standard install erp5_configurator_standard_categories, because erp5_configurator_standard_categories has quantity unit definitions using the "new way" ( the module and not local properties on quantity unit categories).

    Do you think it's better to keep using a spreadsheet for categories ? I don't really know which way is better. I was thinking that it's strange that there's a business template named erp5_configurator_standard_categories and we don't install it with erp5_configurator_standard.

  • mentioned in merge request !1172 (merged)

    Toggle commit list
  • This is quite old, looking at the changes:

    https://lab.nexedi.com/nexedi/erp5/commits/e01a4b39ce2ef780a234574a6b077d44e5bbfbff/bt5/erp5_configurator_standard

    I assume that I did it to unify like you said to avoid duplications (when change a category, it would be required to change on 2 locations, bt5 + spreadsheet).

    Maybe it was motivated or part of this change:

    c61ccc13

    This is the best I can remember.

  • Thanks for feedback.

    Also one reason why using spreadsheet was easy is that during configuration we ask questions like "What's the region of your organisation ?" and this needs to have region category available somehow. This was implemented by reading the spreadsheet on the fly.

    I could find another way in !1172 (merged) ( hardcode the region categoy in a script which yes looks bad but in reality regions don't change so often and the spreadsheet was never updated )

    I'm not sure what's best. It seems wrong that there's a category business template but we don't use it. If you think the new approach from !1172 (merged) is not good please tell me. Maybe I can extract the unit conversion paths in another business template, but there will still be the concern that erp5_configurator_standard_categories exists but is not used.

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