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

Building accounting history.

parent e3b21466
...@@ -2,6 +2,9 @@ ...@@ -2,6 +2,9 @@
<portal_type id="Slave Instance"> <portal_type id="Slave Instance">
<item>causality</item> <item>causality</item>
</portal_type> </portal_type>
<portal_type id="Software Installation">
<item>causality</item>
</portal_type>
<portal_type id="Software Instance"> <portal_type id="Software Instance">
<item>causality</item> <item>causality</item>
</portal_type> </portal_type>
......
...@@ -3,6 +3,10 @@ ...@@ -3,6 +3,10 @@
<type>Slave Instance</type> <type>Slave Instance</type>
<workflow>instance_accounting_slap_interaction_workflow</workflow> <workflow>instance_accounting_slap_interaction_workflow</workflow>
</chain> </chain>
<chain>
<type>Software Installation</type>
<workflow>installation_accounting_slap_interaction_workflow</workflow>
</chain>
<chain> <chain>
<type>Software Instance</type> <type>Software Instance</type>
<workflow>instance_accounting_slap_interaction_workflow</workflow> <workflow>instance_accounting_slap_interaction_workflow</workflow>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="InteractionWorkflowDefinition" module="Products.ERP5.InteractionWorkflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>creation_guard</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>groups</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>installation_accounting_slap_interaction_workflow</string> </value>
</item>
<item>
<key> <string>manager_bypass</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Accounting workflow for interaction with Software Installation changes</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Interaction" module="Products.ERP5.Interaction"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_mapping</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>interactions</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="InteractionDefinition" module="Products.ERP5.Interaction"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>actbox_category</string> </key>
<value> <string>workflow</string> </value>
</item>
<item>
<key> <string>actbox_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>actbox_url</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>activate_script_name</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>after_script_name</string> </key>
<value>
<list>
<string>Installation_changePromiseState</string>
</list>
</value>
</item>
<item>
<key> <string>before_commit_script_name</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>guard</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>change_installation_promise_state</string> </value>
</item>
<item>
<key> <string>method_id</string> </key>
<value>
<list>
<string>requestStart</string>
<string>requestDestroy</string>
</list>
</value>
</item>
<item>
<key> <string>once_per_transaction</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>portal_type_filter</string> </key>
<value>
<list>
<string>Software Installation</string>
</list>
</value>
</item>
<item>
<key> <string>script_name</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>temporary_document_disallowed</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>trigger_type</string> </key>
<value> <int>2</int> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Scripts" module="Products.DCWorkflow.Scripts"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_mapping</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>scripts</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>installation = state_change[\'object\']\n
portal = installation.getPortalObject()\n
isTransitionPossible = portal.portal_workflow.isTransitionPossible\n
\n
# Get latest workflow transition\n
state = installation.getSlapState()\n
started = "start_requested"\n
destroyed = "destroy_requested"\n
assert state in [started, destroyed]\n
script.log(state)\n
# Get all needed services\n
setup_service_relative_url = portal.portal_preferences.getPreferredSoftwareSetupResource()\n
setup_service = portal.restrictedTraverse(setup_service_relative_url)\n
cleanup_service_relative_url = portal.portal_preferences.getPreferredSoftwareCleanupResource()\n
cleanup_service = portal.restrictedTraverse(cleanup_service_relative_url)\n
\n
# Get current delivery\n
delivery = installation.getCausalityValue(portal_type=["Purchase Packing List"])\n
if delivery is None:\n
delivery = context.Installation_createPurchasePackingList(state_change, setup_service_relative_url)\n
\n
delivery_line = delivery.contentValues(portal_type=["Purchase Packing List Line"])[0]\n
resource = delivery_line.getResource()\n
\n
if state == destroyed:\n
comment = \'Software Release request destruction.\'\n
if resource == setup_service_relative_url:\n
if isTransitionPossible(delivery, \'confirm\'):\n
delivery.confirm(comment=comment)\n
if isTransitionPossible(delivery, \'start\'):\n
delivery.start(comment=comment)\n
if isTransitionPossible(delivery, \'stop\'):\n
delivery.stop(comment=comment)\n
if isTransitionPossible(delivery, \'deliver\'):\n
delivery.deliver(comment=comment)\n
delivery = context.Installation_createPurchasePackingList(state_change, cleanup_service_relative_url)\n
if isTransitionPossible(delivery, \'confirm\'):\n
delivery.confirm(comment=comment)\n
elif state == started:\n
if resource == setup_service_relative_url:\n
if isTransitionPossible(delivery, \'confirm\'):\n
delivery.confirm(comment=comment)\n
else:\n
# nothing to do in case if cleanup was\n
pass\n
\n
if installation.getCausality(portal_type=\'Purchase Packing List\') != delivery.getRelativeUrl():\n
installation.setCausality(delivery.getRelativeUrl())\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>state_change</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Installation_changePromiseState</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, ComplexQuery\n
installation = state_change[\'object\']\n
# Get required arguments\n
\n
software_release_document = installation.Base_getSoftwareReleaseDocument(installation.getUrlString())\n
if software_release_document is None:\n
raise NotImplemnetedError(\'Software Release %r not ready yet\' % instance.getUrlString())\n
\n
\n
portal = installation.getPortalObject()\n
computer = installation.getAggregateValue(portal_type=\'Computer\')\n
\n
\n
tag = \'SoftwareInstallation_%s_software_release_%s_change\' % (installation.getUid(), software_release_document.getUid())\n
if portal.portal_activities.countMessageWithTag(tag) > 0:\n
raise NotImplementedError(\'In progress\')\n
activate_kw = {\'tag\': tag}\n
\n
# XXX Hardcoded values\n
person = portal.ERP5Site_getAuthenticatedMemberPersonValue()\n
\n
packing_list_portal_type = "Purchase Packing List"\n
module = portal.getDefaultModule(portal_type=packing_list_portal_type)\n
packing_list = module.newContent(\n
portal_type=packing_list_portal_type,\n
start_date=DateTime(),\n
destination_value=person,\n
destination_section_value=person,\n
destination_decision_value=person,\n
source_administration_value=person,\n
# XXX Hardcoded values\n
source="organisation_module/vifib_internet",\n
source_section="organisation_module/vifib_internet",\n
price_currency="currency_module/EUR",\n
activate_kw=activate_kw\n
)\n
packing_list.newContent(\n
portal_type="Purchase Packing List Line",\n
resource=service,\n
aggregate_value_list=[software_release_document, computer, installation],\n
quantity=1,\n
activate_kw=activate_kw\n
)\n
\n
packing_list.confirm(activate_kw=activate_kw)\n
packing_list.startBuilding()\n
\n
return packing_list\n
]]></string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>state_change, service</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Installation_createPurchasePackingList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Variables" module="Products.DCWorkflow.Variables"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_mapping</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>variables</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Worklists" module="Products.DCWorkflow.Worklists"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_mapping</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>worklists</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
29 30
\ No newline at end of file \ No newline at end of file
Slave Instance | causality Slave Instance | causality
Software Installation | causality
Software Instance | causality Software Instance | causality
\ No newline at end of file
Slave Instance | instance_accounting_slap_interaction_workflow Slave Instance | instance_accounting_slap_interaction_workflow
Software Installation | installation_accounting_slap_interaction_workflow
Software Instance | instance_accounting_slap_interaction_workflow Software Instance | instance_accounting_slap_interaction_workflow
\ No newline at end of file
installation_accounting_slap_interaction_workflow
instance_accounting_slap_interaction_workflow instance_accounting_slap_interaction_workflow
\ No newline at end of file
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