Commit b5906da1 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

trigger trade model builder by using BusinessProcess.build instead of hardcoded builder id.

parent 0b6e2876
<?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>delivery = sci[\'object\']\n
delivery_portal_type = delivery.getPortalType()\n
portal_deliveries = sci.getPortal().portal_deliveries\n
\n
builder_by_portal_type = {\n
\'Sale Invoice Transaction\':\n
\'sale_invoice_transaction_trade_model_builder\',\n
\'Purchase Invoice Transaction\':\n
\'purchase_invoice_transaction_trade_model_builder\',\n
}\n
\n
if delivery_portal_type not in builder_by_portal_type:\n
return \n
\n
builder = getattr(portal_deliveries,\n
builder_by_portal_type[delivery_portal_type],\n
None)\n
\n
path = delivery.getPath()\n
tag = \'%s_updateAppliedRule\' % path\n
expand_tag = \'%s_expand\' % path\n
build_tag = \'invoice_transaction_build_trade_model_%s\' % delivery.getRelativeUrl()\n
build_accounting_tag = \'invoice_transaction_build_accounting_%s\' % delivery.getRelativeUrl()\n
\n
delivery.activate(tag=tag, after_tag=expand_tag).Delivery_updateAppliedRule(activate_kw=dict(tag=expand_tag))\n
\n
if builder is not None:\n
explanation_uid_list = [delivery.getUid(), ]\n
packing_list = delivery.getCausalityValue(\n
portal_type=(\'Sale Packing List\',\n
\'Purchase Packing List\'))\n
if packing_list is not None:\n
explanation_uid_list.append(packing_list.getUid())\n
order = packing_list.getCausalityValue(\n
portal_type=(\'Sale Order\',\n
\'Purchase Order\'))\n
if order is not None:\n
explanation_uid_list.append(order.getUid())\n
\n
builder.activate(\n
activity=\'SQLQueue\',\n
after_tag=(tag, expand_tag),\n
tag=build_tag,\n
activate_kw=dict(tag=build_tag)).build(activate_kw=dict(tag=build_tag),\n
explanation_uid=explanation_uid_list)\n
\n
# set the object in building state.\n
delivery.startBuilding()\n
delivery.activate(after_tag=(build_tag, build_accounting_tag)).updateCausalityState()\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>sci</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>buildTradeModelLineList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -10,6 +10,10 @@ ...@@ -10,6 +10,10 @@
<key> <string>actbox_category</string> </key> <key> <string>actbox_category</string> </key>
<value> <string>workflow</string> </value> <value> <string>workflow</string> </value>
</item> </item>
<item>
<key> <string>actbox_icon</string> </key>
<value> <string></string> </value>
</item>
<item> <item>
<key> <string>actbox_name</string> </key> <key> <string>actbox_name</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
...@@ -20,7 +24,7 @@ ...@@ -20,7 +24,7 @@
</item> </item>
<item> <item>
<key> <string>after_script_name</string> </key> <key> <string>after_script_name</string> </key>
<value> <string>buildTradeModelLineList</string> </value> <value> <string>Delivery_Build</string> </value>
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
......
1464 1465
\ No newline at end of file \ 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