Commit fa290d32 authored by Łukasz Nowak's avatar Łukasz Nowak

Merge remote-tracking branch 'origin/master' into performance-hack

Conflicts:
	master/bt5/vifib_erp5/bt/revision
	master/bt5/vifib_slap/bt/revision
parents a351d16c 2432350b
<property_sheet_list>
<portal_type id="Item">
<item>VariationRange</item>
</portal_type>
<portal_type id="Slave Instance">
<item>Reference</item>
<item>SlaveInstanceConstraint</item>
......
399
\ No newline at end of file
400
\ No newline at end of file
Item | VariationRange
Slave Instance | Reference
Slave Instance | SlaveInstanceConstraint
Slave Instance | SoftwareInstance
......
......@@ -66,14 +66,19 @@ if obj is None:\n
return []\n
\n
item_portal_type = "Hosting Subscription"\n
movement_portal_type = "Sale Order Line"\n
movement_portal_type = ["Sale Order Line"]\n
\n
# BBB: Supports for Software Instances without Sale Order Line\n
movement_portal_type.append("Sale Packing List Line")\n
\n
portal = obj.getPortalObject()\n
\n
movement = portal.portal_catalog.getResultValue(\n
portal_type=movement_portal_type,\n
strict_aggregate_uid=obj.getUid(),\n
simulation_state=(\'confirmed\', \'ordered\'),\n
# simulation_state=(\'confirmed\', \'ordered\'), # BBB: State has no meaning\n
default_resource_uid=portal.restrictedTraverse(portal.portal_preferences.getPreferredInstanceSetupResource()).getUid(), # BBB: Resource is important\n
limit=1, # BBB: There shall be one and only one delivery line with setup resource\n
)\n
\n
if movement is not None:\n
......
......@@ -67,7 +67,7 @@ category_list = []\n
if obj is None:\n
return []\n
\n
movement_portal_type = "Sale Order Line"\n
movement_portal_type = ["Sale Packing List Line", "Sale Order Line"]\n
\n
portal = obj.getPortalObject()\n
\n
......@@ -77,7 +77,9 @@ parent_url_list = []\n
for movement in portal.portal_catalog(\n
portal_type=movement_portal_type,\n
strict_aggregate_uid=obj.getUid(),\n
simulation_state=(\'ordered\', \'confirmed\'),\n
default_resource_uid=portal.restrictedTraverse(portal.portal_preferences.getPreferredInstanceSetupResource()).getUid(),\n
# simulation_state=(\'ordered\', \'confirmed\', \'started\', \'stopped\'),\n
limit=1,\n
):\n
item = movement.getDestinationSectionValue(portal_type="Person")\n
if item is not None:\n
......
392
\ No newline at end of file
394
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Alarm" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>active_sense_method_id</string> </key>
<value> <string>Alarm_cloneCleanupPartition</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>vifib_clone_destroy_partition</string> </value>
</item>
<item>
<key> <string>periodicity_day_frequency</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>periodicity_hour</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>periodicity_minute</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>periodicity_minute_frequency</string> </key>
<value> <int>5</int> </value>
</item>
<item>
<key> <string>periodicity_month</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>periodicity_month_day</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>periodicity_start_date</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>3660.0</float>
<string>GMT</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key> <string>periodicity_week</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Alarm</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Clone destroy partition</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -61,9 +61,14 @@ kw.update(\n
\n
context.getPortalObject().portal_catalog.searchAndActivate(\n
method_id=\'SimulationMovement_buildVifib\',\n
method_kw={\'tag\': tag},\n
activate_kw={\'tag\': tag, \'priority\': 4},\n
**kw\n
)\n
\n
# register activity on alarm object waiting for own tag in order to have only one alarm\n
# running in same time\n
context.activate(after_tag=tag).getId()\n
</string> </value>
</item>
<item>
......
<?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>portal = context.getPortalObject()\n
cleanup_service = portal.portal_preferences.getPreferredInstanceCleanupResource()\n
\n
portal.portal_catalog.searchAndActivate(\n
portal_type=\'Sale Packing List Line\',\n
default_resource_uid=portal.restrictedTraverse(cleanup_service).getUid(),\n
aggregate_portal_type="Software Instance",\n
simulation_state="confirmed",\n
method_id=\'SalePackingListLine_checkAndCloneCleanupPartition\',\n
activate_kw={\'tag\': tag}\n
)\n
\n
# Register activity in order to have only one alarm running in the same time\n
context.activate(after_tag=tag).getId()\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>tag, fixit, params</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Alarm_cloneCleanupPartition</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>_body</string> </key>
<value> <string encoding="cdata"><![CDATA[
from Products.ZSQLCatalog.SQLCatalog import Query, NegatedQuery\n
from DateTime import DateTime\n
movement = context\n
portal = movement.getPortalObject()\n
cleanup_service = portal.portal_preferences.getPreferredInstanceCleanupResource()\n
\n
instance = movement.getAggregateValue(portal_type="Software Instance")\n
# Search for other cleanup packing list (generated by UI double click for\n
# example)\n
newer_movement = portal.portal_catalog.getResultValue(\n
portal_type="Sale Packing List Line",\n
default_resource_uid=portal.restrictedTraverse(cleanup_service).getUid(),\n
default_aggregate_uid=instance.getUid(),\n
uid=NegatedQuery(Query(uid=movement.getUid())),\n
simulation_state="confirmed",\n
**{\'movement.start_date\': Query(**{\'movement.start_date\': movement.getStartDate(), \'range\': \'min\'})}\n
)\n
\n
if (newer_movement is not None) and (newer_movement.getSimulationState() == \'confirmed\'):\n
# another cleanup packing list was found, cannot clone\n
return\n
\n
# Search for the non cleanup newest packing list which is newer then current cleanup\n
# resource is ignored, as cleanups deliveries are already analysed before\n
newer_newest_movement = portal.portal_catalog.getResultValue(\n
portal_type="Sale Packing List Line",\n
default_aggregate_uid=instance.getUid(),\n
**{\'movement.start_date\': Query(**{\'movement.start_date\': movement.getStartDate(), \'range\': \'max\'})}\n
)\n
\n
if newer_newest_movement is not None:\n
cleanup_delivery = movement.getParentValue()\n
# setup new cleanup date to now, as it will be newer then any existing document\n
now = DateTime()\n
if now < newer_newest_movement:\n
raise ValueError(\'The movement %s is newer then current time %s so it is impossible to move delivery %s as newer\' % (newer_newest_movement.getRelativeUrl(), now, cleanup_delivery.getRelativeUrl()))\n
new_cleanup_delivery = cleanup_delivery.Base_createCloneDocument(batch_mode=1)\n
new_cleanup_delivery.setStartDate(DateTime())\n
cleanup_delivery.cancel(comment=\'Cancelled as newer clone is created: %s\' % new_cleanup_delivery.getPath())\n
new_cleanup_delivery.confirm(comment=\'Replaced too old cleanup delivery: %s\' % cleanup_delivery.getPath())\n
]]></string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SalePackingListLine_checkAndCloneCleanupPartition</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -54,19 +54,18 @@
# movement build but not indexed, so do nothing\n
return\n
\n
if context.getResource() == \'service_module/vifib_instance_subscription\':\n
# XXX-Luke: Avoid building until Open Order logic is fixed\n
return\n
\n
root_applied_rule = context.getRootAppliedRule()\n
portal = context.getPortalObject()\n
portal.portal_catalog.searchAndActivate(\n
portal_type=\'Business Link\',\n
parent_uid=[portal.business_process_module.vifib_sale_business_process.getUid(), portal.business_process_module.vifib_purchase_business_process.getUid()],\n
method_id=\'build\',\n
method_kw={\'path\': \'%s/%%\' % root_applied_rule.getPath()}\n
)\n
\n
context.getCausalityValue(portal_type=\'Business Link\').build(path=\'%s/%%\' % root_applied_rule.getPath(), activate_kw={\'tag\': tag})\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
<value> <string>tag</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
583
\ No newline at end of file
589
\ No newline at end of file
......@@ -5,6 +5,7 @@ portal_alarms/stop_confirmed_sale_invoice_transaction
portal_alarms/vifib_cancel_destroy_partition
portal_alarms/vifib_cancel_update_partition
portal_alarms/vifib_check_consistency
portal_alarms/vifib_clone_destroy_partition
portal_alarms/vifib_desactivate_dead_computer
portal_alarms/vifib_destroy_non_instanciated_partition
portal_alarms/vifib_lock_person
......
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