Commit 772d8fed authored by Jérome Perrin's avatar Jérome Perrin

configurator_standard: use specific sale and purchase business processes

Using different business process is more flexible, it allows to configure
different to build at different time, to generate different accounting etc.

This introduce two different business processes and also modernize the configuration to:
 - generate accounting only for the supplier in sales
 - generate accounting only for the client in purchases
 - generate accounting using income/expense accounts defined on supplies
 - generate accounting without analytics (project, function) only for
   income/expense accounts

and to fix an "infinite loop" with tax business link, it had the same
predecessor and successor
parent a5581cd5
configuration_save = context.restrictedTraverse(configuration_save_url)
# business processes
configuration_save.addConfigurationItem("Business Process Configurator Item",
title="Default Trade Business Process" ,
configuration_spreadsheet_data = getattr(context, "standard_business_process.ods").data,
reference="default_erp5_business_process")
configuration_save.addConfigurationItem("Business Process Configurator Item",
title="Default Sales Business Process" ,
configuration_spreadsheet_data = getattr(context, "standard_sale_business_process.ods").data,
reference="default_erp5_sale_business_process")
configuration_save.addConfigurationItem("Business Process Configurator Item",
title="Default Purchase Business Process" ,
configuration_spreadsheet_data = getattr(context, "standard_purchase_business_process.ods").data,
reference="default_erp5_purchase_business_process")
# setup Sale Trade Condition
configuration_save.addConfigurationItem("Sale Trade Condition Configurator Item",
title="General Sale Trade Condition",
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string>standard_purchase_business_process.ods</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>application/vnd.oasis.opendocument.spreadsheet</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string>standard_sale_business_process.ods</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>application/vnd.oasis.opendocument.spreadsheet</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -618,11 +618,18 @@ class StandardConfigurationMixin(TestLiveConfiguratorWorkflowMixin):
business_process_list = \
self.getBusinessConfigurationObjectList(business_configuration,
'Business Process')
self.assertEqual(len(business_process_list), 1)
self.assertEqual(len(business_process_list), 3)
self.assertEqual(
["default_erp5_business_process",
"default_erp5_purchase_business_process",
"default_erp5_sale_business_process", ],
sorted([bp.getReference() for bp in business_process_list])
)
business_process = business_process_list[0]
self.assertEqual("default_erp5_business_process",
business_process.getReference())
# Check in detail default_erp5_business_process, other business processes we'll only
# test they work in high level simulation scenario tests.
business_process, = [bp for bp in business_process_list if bp.getReference() == 'default_erp5_business_process']
self.assertEqual("Default Trade Business Process",
business_process.getTitle())
......@@ -792,14 +799,12 @@ class StandardConfigurationMixin(TestLiveConfiguratorWorkflowMixin):
self.assertEqual(None, sale_trade_condition.getExpirationDate())
# Check relation with Business Process
business_process_list = \
self.getBusinessConfigurationObjectList(business_configuration,
'Business Process')
self.assertEqual(len(business_process_list), 1)
business_process = business_process_list[0]
self.assertEqual(business_process,
sale_trade_condition.getSpecialiseValue())
self.assertIn(
sale_trade_condition.getSpecialiseValue(),
self.getBusinessConfigurationObjectList(business_configuration, 'Business Process'))
self.assertEqual(
sale_trade_condition.getSpecialiseReference(),
'default_erp5_sale_business_process')
# Check relation with Organisation
organisation_list = \
......@@ -841,14 +846,12 @@ class StandardConfigurationMixin(TestLiveConfiguratorWorkflowMixin):
self.assertEqual(None, purchase_trade_condition.getExpirationDate())
# Check relation with Business Process
business_process_list = \
self.getBusinessConfigurationObjectList(business_configuration,
'Business Process')
self.assertEqual(len(business_process_list), 1)
business_process = business_process_list[0]
self.assertEqual(business_process,
purchase_trade_condition.getSpecialiseValue())
self.assertIn(
purchase_trade_condition.getSpecialiseValue(),
self.getBusinessConfigurationObjectList(business_configuration, 'Business Process'))
self.assertEqual(
purchase_trade_condition.getSpecialiseReference(),
'default_erp5_purchase_business_process')
# Check relation with Organisation
organisation_list = \
......
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