Commit c78c4e7d authored by Jérome Perrin's avatar Jérome Perrin

build trade model lines if builder is found

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@28394 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 70fc882e
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
<tuple/>
</tuple>
</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
update_applied_rule_tag = \'invoice_update_applied_rule_%s\' % delivery.getRelativeUrl()\n
build_tag = \'invoice_transaction_build_trade_model_%s\' % delivery.getRelativeUrl()\n
\n
delivery.Delivery_updateAppliedRule(activate_kw=dict(tag=update_applied_rule_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=update_applied_rule_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).updateCausalityState()\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>sci</string> </value>
</item>
<item>
<key> <string>errors</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>func_code</string> </key>
<value>
<object>
<klass>
<global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>sci</string>
<string>_getitem_</string>
<string>delivery</string>
<string>_getattr_</string>
<string>delivery_portal_type</string>
<string>portal_deliveries</string>
<string>builder_by_portal_type</string>
<string>getattr</string>
<string>None</string>
<string>builder</string>
<string>update_applied_rule_tag</string>
<string>build_tag</string>
<string>dict</string>
<string>explanation_uid_list</string>
<string>packing_list</string>
<string>order</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>buildTradeModelLineList</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -23,11 +23,11 @@
</item>
<item>
<key> <string>after_script_name</string> </key>
<value> <string></string> </value>
<value> <string>buildTradeModelLineList</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>validate a plannified transaction that will be turned into real accounting transactions</string> </value>
<value> <string>validate a planned transaction that will be turned into real accounting transactions</string> </value>
</item>
<item>
<key> <string>guard</string> </key>
......
956
\ No newline at end of file
960
\ 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