Commit 30eb9be0 authored by Jérome Perrin's avatar Jérome Perrin

Merge remote-tracking branch 'master_test/master' into zope4py2

parents adcce185 ba333b30
...@@ -110,6 +110,10 @@ class BuilderMixin(XMLObject, Amount, Predicate): ...@@ -110,6 +110,10 @@ class BuilderMixin(XMLObject, Amount, Predicate):
restrict selection to a given root Applied Rule caused by a single Order restrict selection to a given root Applied Rule caused by a single Order
or to Simulation Movements related to a limited set of existing or to Simulation Movements related to a limited set of existing
""" """
import datetime
import logging
logger = logging.getLogger("%s(%s)" % (__name__, self.getRelativeUrl()))
total_start = datetime.datetime.now()
# Parameter initialization # Parameter initialization
if delivery_relative_url_list is None: if delivery_relative_url_list is None:
delivery_relative_url_list = [] delivery_relative_url_list = []
...@@ -133,21 +137,42 @@ class BuilderMixin(XMLObject, Amount, Predicate): ...@@ -133,21 +137,42 @@ class BuilderMixin(XMLObject, Amount, Predicate):
kw['causality_uid'] = [link_value.getUid() for link_value in business_link_value_list] kw['causality_uid'] = [link_value.getUid() for link_value in business_link_value_list]
if applied_rule_uid is not None: if applied_rule_uid is not None:
kw['applied_rule_uid'] = applied_rule_uid kw['applied_rule_uid'] = applied_rule_uid
start = datetime.datetime.now()
movement_list = self.searchMovementList(**kw) movement_list = self.searchMovementList(**kw)
logger.info(
'Found %s movements in %s', len(movement_list), datetime.datetime.now() - start )
if not movement_list: if not movement_list:
logger.info('No movement found')
return [] return []
# Collect # Collect
start = datetime.datetime.now()
root_group_node = self.collectMovement(movement_list, merge_delivery=merge_delivery) root_group_node = self.collectMovement(movement_list, merge_delivery=merge_delivery)
logger.info('Collected in %s', datetime.datetime.now() - start )
# Build # Build
start = datetime.datetime.now()
delivery_list = self.buildDeliveryList( delivery_list = self.buildDeliveryList(
root_group_node, root_group_node,
delivery_relative_url_list=delivery_relative_url_list, delivery_relative_url_list=delivery_relative_url_list,
movement_list=movement_list, activate_kw=activate_kw, movement_list=movement_list, activate_kw=activate_kw,
merge_delivery=merge_delivery, **kw) merge_delivery=merge_delivery, **kw)
logger.info('Built %s deliveries in %s', len(delivery_list), datetime.datetime.now() - start )
# Call a script after building # Call a script after building
start = datetime.datetime.now()
self.callAfterBuildingScript(delivery_list, movement_list, **kw) self.callAfterBuildingScript(delivery_list, movement_list, **kw)
logger.info('callAfterBuildingScript in %s', datetime.datetime.now() - start )
logger.info('Total build() time for %s deliveries in %s', len(delivery_list), datetime.datetime.now() - total_start )
return delivery_list return delivery_list
def pdb_backdoor(self):
"""to debug start_date ..
"""
import pdb;pdb.set_trace()
def getRelatedBusinessLinkValueList(self): def getRelatedBusinessLinkValueList(self):
return self.getDeliveryBuilderRelatedValueList(portal_type='Business Link') return self.getDeliveryBuilderRelatedValueList(portal_type='Business Link')
......
return 'disabled for benchmark' # causing too many conflicts
if context.getReference(): if context.getReference():
return return
......
...@@ -32,14 +32,13 @@ from Products.ERP5Type import Permissions, PropertySheet ...@@ -32,14 +32,13 @@ from Products.ERP5Type import Permissions, PropertySheet
from Products.ERP5Type.XMLObject import XMLObject from Products.ERP5Type.XMLObject import XMLObject
from erp5.component.mixin.ConfiguratorItemMixin import ConfiguratorItemMixin from erp5.component.mixin.ConfiguratorItemMixin import ConfiguratorItemMixin
from erp5.component.interface.IConfiguratorItem import IConfiguratorItem from erp5.component.interface.IConfiguratorItem import IConfiguratorItem
from Products.ERP5Type.Cache import CachingMethod
from zLOG import LOG, INFO from zLOG import LOG, INFO
@zope.interface.implementer(IConfiguratorItem) @zope.interface.implementer(IConfiguratorItem)
class StandardBT5ConfiguratorItem(ConfiguratorItemMixin, XMLObject): class StandardBT5ConfiguratorItem(ConfiguratorItemMixin, XMLObject):
""" This class will install standard ERP5 template from a repository to """Install standard ERP5 business template from a repository
fake site. """ """
meta_type = 'ERP5 Standard BT5 Configurator Item' meta_type = 'ERP5 Standard BT5 Configurator Item'
portal_type = 'Standard BT5 Configurator Item' portal_type = 'Standard BT5 Configurator Item'
...@@ -61,29 +60,32 @@ class StandardBT5ConfiguratorItem(ConfiguratorItemMixin, XMLObject): ...@@ -61,29 +60,32 @@ class StandardBT5ConfiguratorItem(ConfiguratorItemMixin, XMLObject):
def _checkConsistency(self, fixit=False, **kw): def _checkConsistency(self, fixit=False, **kw):
template_tool = self.getPortalObject().portal_templates template_tool = self.getPortalObject().portal_templates
bt5_id = self.getBt5Id().split('.')[0]
bt5_id_list = self.getBt5IdList()
# BBB this used to be a string property
if isinstance(bt5_id_list, str):
bt5_id_list = [bt5_id_list]
bt5_id_set = {bt.split('.')[0] for bt in bt5_id_list}
if bt5_id in template_tool.getInstalledBusinessTemplateTitleList(): if not bt5_id_set.difference(template_tool.getInstalledBusinessTemplateTitleList()):
LOG("StandardBT5ConfiguratorItem", INFO, LOG("StandardBT5ConfiguratorItem", INFO,
"Business Template already Installed: %s for %s" % (bt5_id, self.getRelativeUrl())) "Business Templates already Installed: %s for %s" % (bt5_id_set, self.getRelativeUrl()))
return [] return []
def _getRepositoryBusinessTemplateTitleList(): repository_bt_title_set = {bt.getTitle() for bt in \
return [bt.getTitle() for bt in \ template_tool.getRepositoryBusinessTemplateList()}
template_tool.getRepositoryBusinessTemplateList()]
repository_bt_title_list = CachingMethod(
_getRepositoryBusinessTemplateTitleList,
id='StandardBT5_getRepositoryBusinessTemplateTitleList',
cache_factory='erp5_content_long')()
if bt5_id in repository_bt_title_list: not_found_bt_set = bt5_id_set.difference(repository_bt_title_set)
if fixit: if not_found_bt_set:
template_tool.installBusinessTemplateListFromRepository([bt5_id], raise ValueError("Business template %s not found on available \
update_catalog=self.getUpdateCatalog(0), sources." % not_found_bt_set)
install_dependency=self.getInstallDependency(1), if fixit:
activate=True) template_tool.installBusinessTemplateListFromRepository(
list(bt5_id_set),
update_catalog=self.getUpdateCatalog(0),
install_dependency=self.getInstallDependency(1),
activate=True)
return [self._createConstraintMessage('%s should be installed' % bt5_id_list),]
return [self._createConstraintMessage('%s should be installed' % bt5_id),]
raise ValueError("The business template %s was not found on available \
sources." % bt5_id)
...@@ -19,11 +19,10 @@ bt5_installation_list = ('erp5_dhtml_style', ...@@ -19,11 +19,10 @@ bt5_installation_list = ('erp5_dhtml_style',
'erp5_osoe_web_renderjs_ui', 'erp5_osoe_web_renderjs_ui',
) )
bt5_update_catalog = ('erp5_ingestion_mysql_innodb_catalog', 'erp5_accounting', ) configuration_save.addConfigurationItem(
"Standard BT5 Configurator Item",
for name in bt5_installation_list: title="Standard business templates",
configuration_save.addConfigurationItem("Standard BT5 Configurator Item", bt5_id_list=bt5_installation_list,
title=name, bt5_id=name, update_catalog=True,
update_catalog=(name in bt5_update_catalog), install_dependency=True,
install_dependency=True, )
)
...@@ -8,7 +8,27 @@ ...@@ -8,7 +8,27 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>bt5_id</string> </key> <key> <string>bt5_id</string> </key>
<value> <string>erp5_dhtml_style</string> </value> <value>
<tuple>
<string>erp5_dhtml_style</string>
<string>erp5_jquery_ui</string>
<string>erp5_ingestion_mysql_innodb_catalog</string>
<string>erp5_dms</string>
<string>erp5_accounting</string>
<string>erp5_crm</string>
<string>erp5_simplified_invoicing</string>
<string>erp5_trade_knowledge_pad</string>
<string>erp5_crm_knowledge_pad</string>
<string>erp5_configurator_standard_solver</string>
<string>erp5_configurator_standard_trade_template</string>
<string>erp5_configurator_standard_accounting_template</string>
<string>erp5_configurator_standard_invoicing_template</string>
<string>erp5_ods_style</string>
<string>erp5_odt_style</string>
<string>erp5_ooo_import</string>
<string>erp5_jquery_ui</string>
</tuple>
</value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
...@@ -18,23 +38,13 @@ ...@@ -18,23 +38,13 @@
<key> <string>install_dependency</string> </key> <key> <string>install_dependency</string> </key>
<value> <int>1</int> </value> <value> <int>1</int> </value>
</item> </item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Standard BT5 Configurator Item</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>erp5_dhtml_style</string> </value> <value> <string>Standard business templates</string> </value>
</item> </item>
<item> <item>
<key> <string>update_catalog</string> </key> <key> <string>update_catalog</string> </key>
<value> <int>0</int> </value> <value> <int>1</int> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Standard BT5 Configurator Item" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>bt5_id</string> </key>
<value> <string>erp5_configurator_standard_solver</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>10</string> </value>
</item>
<item>
<key> <string>install_dependency</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Standard BT5 Configurator Item</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>erp5_configurator_standard_solver</string> </value>
</item>
<item>
<key> <string>update_catalog</string> </key>
<value> <int>0</int> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Standard BT5 Configurator Item" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>bt5_id</string> </key>
<value> <string>erp5_configurator_standard_trade_template</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>11</string> </value>
</item>
<item>
<key> <string>install_dependency</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Standard BT5 Configurator Item</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>erp5_configurator_standard_trade_template</string> </value>
</item>
<item>
<key> <string>update_catalog</string> </key>
<value> <int>0</int> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Standard BT5 Configurator Item" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>bt5_id</string> </key>
<value> <string>erp5_configurator_standard_accounting_template</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>12</string> </value>
</item>
<item>
<key> <string>install_dependency</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Standard BT5 Configurator Item</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>erp5_configurator_standard_accounting_template</string> </value>
</item>
<item>
<key> <string>update_catalog</string> </key>
<value> <int>0</int> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Standard BT5 Configurator Item" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>bt5_id</string> </key>
<value> <string>erp5_configurator_standard_invoicing_template</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>13</string> </value>
</item>
<item>
<key> <string>install_dependency</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Standard BT5 Configurator Item</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>erp5_configurator_standard_invoicing_template</string> </value>
</item>
<item>
<key> <string>update_catalog</string> </key>
<value> <int>0</int> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Standard BT5 Configurator Item" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>bt5_id</string> </key>
<value> <string>erp5_ods_style</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>14</string> </value>
</item>
<item>
<key> <string>install_dependency</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Standard BT5 Configurator Item</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>erp5_ods_style</string> </value>
</item>
<item>
<key> <string>update_catalog</string> </key>
<value> <int>0</int> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Standard BT5 Configurator Item" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>bt5_id</string> </key>
<value> <string>erp5_odt_style</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>15</string> </value>
</item>
<item>
<key> <string>install_dependency</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Standard BT5 Configurator Item</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>erp5_odt_style</string> </value>
</item>
<item>
<key> <string>update_catalog</string> </key>
<value> <int>0</int> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Standard BT5 Configurator Item" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>bt5_id</string> </key>
<value> <string>erp5_ooo_import</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>16</string> </value>
</item>
<item>
<key> <string>install_dependency</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Standard BT5 Configurator Item</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>erp5_ooo_import</string> </value>
</item>
<item>
<key> <string>update_catalog</string> </key>
<value> <int>0</int> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Standard BT5 Configurator Item" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>bt5_id</string> </key>
<value> <string>erp5_jquery_ui</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>2</string> </value>
</item>
<item>
<key> <string>install_dependency</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Standard BT5 Configurator Item</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>erp5_jquery_ui</string> </value>
</item>
<item>
<key> <string>update_catalog</string> </key>
<value> <int>0</int> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Standard BT5 Configurator Item" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>bt5_id</string> </key>
<value> <string>erp5_ingestion_mysql_innodb_catalog</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>3</string> </value>
</item>
<item>
<key> <string>install_dependency</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Standard BT5 Configurator Item</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>erp5_ingestion_mysql_innodb_catalog</string> </value>
</item>
<item>
<key> <string>update_catalog</string> </key>
<value> <int>1</int> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Standard BT5 Configurator Item" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>bt5_id</string> </key>
<value> <string>erp5_dms</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>4</string> </value>
</item>
<item>
<key> <string>install_dependency</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Standard BT5 Configurator Item</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>erp5_dms</string> </value>
</item>
<item>
<key> <string>update_catalog</string> </key>
<value> <int>0</int> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Standard BT5 Configurator Item" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>bt5_id</string> </key>
<value> <string>erp5_accounting</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>5</string> </value>
</item>
<item>
<key> <string>install_dependency</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Standard BT5 Configurator Item</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>erp5_accounting</string> </value>
</item>
<item>
<key> <string>update_catalog</string> </key>
<value> <int>1</int> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Standard BT5 Configurator Item" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>bt5_id</string> </key>
<value> <string>erp5_crm</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>6</string> </value>
</item>
<item>
<key> <string>install_dependency</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Standard BT5 Configurator Item</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>erp5_crm</string> </value>
</item>
<item>
<key> <string>update_catalog</string> </key>
<value> <int>0</int> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Standard BT5 Configurator Item" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>bt5_id</string> </key>
<value> <string>erp5_simplified_invoicing</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>7</string> </value>
</item>
<item>
<key> <string>install_dependency</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Standard BT5 Configurator Item</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>erp5_simplified_invoicing</string> </value>
</item>
<item>
<key> <string>update_catalog</string> </key>
<value> <int>0</int> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Standard BT5 Configurator Item" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>bt5_id</string> </key>
<value> <string>erp5_trade_knowledge_pad</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>8</string> </value>
</item>
<item>
<key> <string>install_dependency</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Standard BT5 Configurator Item</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>erp5_trade_knowledge_pad</string> </value>
</item>
<item>
<key> <string>update_catalog</string> </key>
<value> <int>0</int> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Standard BT5 Configurator Item" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>bt5_id</string> </key>
<value> <string>erp5_crm_knowledge_pad</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>9</string> </value>
</item>
<item>
<key> <string>install_dependency</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Standard BT5 Configurator Item</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>erp5_crm_knowledge_pad</string> </value>
</item>
<item>
<key> <string>update_catalog</string> </key>
<value> <int>0</int> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
"""Create test data for updateSimulation scalability test.
"""
import random
rng = random.Random(random_seed)
portal = context.getPortalObject()
sale_trade_condition, = portal.portal_catalog(
portal_type="Sale Trade Condition",
reference='STC-General',
)
sale_trade_condition = sale_trade_condition.getObject()
resources = []
for _ in range(10):
resource = portal.product_module.newContent(
title='Scalability Test Resource %s %s' % (random_seed, rng.randint(0, 10000)),
)
resource.validate()
resources.append(resource)
customers = []
for _ in range(10):
customer = portal.organisation_module.newContent(
title='Scalability Test Organisation %s %s' % (random_seed, rng.randint(0, 10000)),
)
customer.validate()
customers.append(customer)
def makeSaleOrder():
sale_order = portal.sale_order_module.newContent(
portal_type='Sale Order',
title='Scalability Test Sale Order %s %s' % (random_seed, rng.randrange(10000)),
start_date=DateTime() + (rng.random() * 100.),
specialise_value=sale_trade_condition,
)
sale_order.setStopDate(sale_order.getStopDate() + (rng.random() * 100.))
sale_order.setDestinationSectionValue(rng.choice(customers))
sale_order.setDestinationValue(rng.choice(customers))
sale_order.SaleOrder_applySaleTradeCondition()
for i in range(rng.randint(1, 10)):
sale_order.newContent(
portal_type='Sale Order Line',
int_index=i,
resource_value=rng.choice(resources),
quantity=1 + rng.random() * 20,
price=rng.random() * 100,
)
sale_order.Base_checkConsistency()
sale_order.confirm()
return sale_order
for _ in range(order_count):
order = makeSaleOrder()
# build packing lists one by one, because we create a lot and don't want the
# global builder to try to build them all in one big transaction
expand_tag = 'build:%s' % order.getPath()
order.reindexObject(activate_kw={'tag': expand_tag})
portal.portal_deliveries.sale_packing_list_builder.activate(
activity='SQLQueue',
after_tag=expand_tag,
).build(explanation_uid=order.getUid())
# cancel packing lists, so that they are not selected by
# DeliveryBuilder_selectConfirmedDeliveryList
for brain in portal.portal_catalog(
portal_type='Sale Packing List',
simulation_state='confirmed',):
spl = brain.getObject()
if spl.getSimulationState() == 'confirmed' and not spl.hasActivity():
spl.cancel()
# undo redirect from SaleOrder_applySaleTradeCondition
container.REQUEST.RESPONSE.setStatus(200)
return "Done"
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="_reconstructor" module="copy_reg"/>
</klass>
<tuple>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
<global name="object" module="__builtin__"/>
<none/>
</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>random_seed, order_count=50</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_createScalabilityTestSaleOrderBatch</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
portal = context.getPortalObject() portal = context.getPortalObject()
portal.sale_order_module.migrateToHBTree()
portal.sale_order_module.setIdGenerator('_generatePerNodeId') portal.sale_order_module.setIdGenerator('_generatePerNodeId')
portal.sale_packing_list_module.migrateToHBTree()
portal.sale_packing_list_module.setIdGenerator('_generatePerNodeId')
portal.portal_simulation.migrateToHBTree()
portal.portal_simulation.setIdGenerator('_generatePerNodeId')
portal.person_module.migrateToHBTree()
portal.person_module.setIdGenerator('_generatePerNodeId') portal.person_module.setIdGenerator('_generatePerNodeId')
...@@ -20,6 +20,7 @@ if distribution_node_list: ...@@ -20,6 +20,7 @@ if distribution_node_list:
if distribution_node is None: if distribution_node is None:
distribution_node = activity_node_list[0] distribution_node = activity_node_list[0]
activity_node_list = activity_node_list[1:]
# default ERP5 instanciation uses following schema for naming all zope nodes # default ERP5 instanciation uses following schema for naming all zope nodes
# activities-0..9 when number of nodes <= 10 # activities-0..9 when number of nodes <= 10
# activites-01..09 (or n) when number of nodes > 10 # activites-01..09 (or n) when number of nodes > 10
......
erp5_configurator_standard erp5_configurator_standard
erp5_full_text_myisam_catalog erp5_full_text_mroonga_catalog
\ No newline at end of file \ No newline at end of file
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
<key> <string>categories</string> </key> <key> <string>categories</string> </key>
<value> <value>
<tuple> <tuple>
<string>elementary_type/string</string> <string>elementary_type/lines</string>
</tuple> </tuple>
</value> </value>
</item> </item>
...@@ -43,13 +43,17 @@ ...@@ -43,13 +43,17 @@
<key> <string>mode</string> </key> <key> <string>mode</string> </key>
<value> <string>w</string> </value> <value> <string>w</string> </value>
</item> </item>
<item>
<key> <string>multivalued</string> </key>
<value> <int>0</int> </value>
</item>
<item> <item>
<key> <string>portal_type</string> </key> <key> <string>portal_type</string> </key>
<value> <string>Standard Property</string> </value> <value> <string>Standard Property</string> </value>
</item> </item>
<item> <item>
<key> <string>property_default</string> </key> <key> <string>property_default</string> </key>
<value> <string>python: \'erp5_base\'</string> </value> <value> <string>python: (\'erp5_base\', )</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
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