diff --git a/bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_workflow/scripts/buildTradeModelLineList.xml b/bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_workflow/scripts/buildTradeModelLineList.xml new file mode 100644 index 0000000000000000000000000000000000000000..f36ac3e9559f8257cd45e105eaa2f0b4d6f7a11f --- /dev/null +++ b/bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_workflow/scripts/buildTradeModelLineList.xml @@ -0,0 +1,181 @@ +<?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> diff --git a/bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_workflow/transitions/confirm.xml b/bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_workflow/transitions/confirm.xml index 9f55d171ffc5b5722587365a87dec83deba082f2..8002071d57dc3c89682e0b596e9aa8365760be0e 100644 --- a/bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_workflow/transitions/confirm.xml +++ b/bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_workflow/transitions/confirm.xml @@ -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> diff --git a/bt5/erp5_accounting/bt/revision b/bt5/erp5_accounting/bt/revision index 13074505545fe9b17633f5e8530ef4054f1d4938..81574ddd4813d5ceb496601af3821dde4c334f42 100644 --- a/bt5/erp5_accounting/bt/revision +++ b/bt5/erp5_accounting/bt/revision @@ -1 +1 @@ -956 \ No newline at end of file +960 \ No newline at end of file