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

pass wf transition with workflow method if the user cannot pass with his rights


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@4738 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent a9e5d5ac
......@@ -71,6 +71,7 @@
# after the sale_invoice_builder delivery builder has created\n
# the new Sale Invoice Transaction\n
#\n
from ZODB.POSException import ConflictError \n
\n
sale_invoice = context\n
\n
......@@ -92,17 +93,23 @@ sale_invoice.edit(\n
title = related_packing_list.getTitle(),\n
resource = price_currency,\n
price_currency = price_currency,\n
reference = related_packing_list.getReference(),\n
)\n
\n
# initialize accounting_workflow to planned state\n
if sale_invoice.getSimulationState() == \'draft\' : \n
context.getPortalObject().portal_workflow.doActionFor(\n
sale_invoice, \'plan_action\', wf_id=\'accounting_workflow\',\n
comment = \'Initialized by Delivery Builder\'\n
)\n
try :\n
context.getPortalObject().portal_workflow.doActionFor(\n
sale_invoice, \'plan_action\', wf_id=\'accounting_workflow\',\n
comment = \'Initialized by Delivery Builder\',\n
skip_period_validation = 1 )\n
except (ConflictError, RuntimeError), e : raise\n
except Exception, e :\n
LOG(\'Exception in plan_action\', e)\n
# call the workflow method, if the user cannot perform this operation.\n
sale_invoice.plan()\n
\n
# First set the invoice in the building state on the causality workflow\n
#context.getPortalObject().portal_workflow.doActionFor(sale_invoice, \'start_building\', wf_id=\'invoice_causality_workflow\')\n
sale_invoice.startBuilding()\n
\n
# Then an activity should put the causality state in diverged or solved\n
......@@ -110,44 +117,50 @@ sale_invoice.startBuilding()\n
sale_invoice.activate(\n
after_method_id = ( \'immediateReindexObject\',\n
\'recursiveImmediateReindexObject\',\n
\'Delivery_confirm\'\n
)).updateCausalityState()\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value> <string encoding="base64">YwAAAAAAAAAAAQAAAEAAAABzDQAAAGQBAIQAAFoAAGQAAFMoAgAAAE5jAAAAAAgAAAAQAAAACwAA
AHMzAQAAdAAAiQAAhwAAZAEAhgAA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AHMAAAAA</string> </value>
</item>
<item>
<key> <string>_filepath</string> </key>
......@@ -182,6 +195,8 @@ aG9uKXMIAAAAPG1vZHVsZT4BAAAAcwAAAAA=</string> </value>
<value>
<tuple>
<string>kw</string>
<string>ZODB.POSException</string>
<string>ConflictError</string>
<string>context</string>
<string>sale_invoice</string>
<string>LOG</string>
......@@ -189,6 +204,9 @@ aG9uKXMIAAAAPG1vZHVsZT4BAAAAcwAAAAA=</string> </value>
<string>related_packing_list</string>
<string>related_order</string>
<string>price_currency</string>
<string>RuntimeError</string>
<string>e</string>
<string>Exception</string>
</tuple>
</value>
</item>
......
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