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

- confirm invoice "unconditionally"

Post building script shall work in all possible cases.

Catching only WorkflowException was in consistent:

 * user without privileges in accounting was able to build invoice coming from
   packing list without price currency (script worked well)
 * user with privileges in accounting, which delivered packing list, was not
   able to confirm this invoice, as ValidationFailed was raised


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@31889 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 9d1d8086
...@@ -105,20 +105,8 @@ if not invoice.hasTitle() and related_packing_list.hasTitle():\n ...@@ -105,20 +105,8 @@ if not invoice.hasTitle() and related_packing_list.hasTitle():\n
\n \n
# initialize accounting_workflow to confirmed state\n # initialize accounting_workflow to confirmed state\n
if invoice.getSimulationState() == \'draft\':\n if invoice.getSimulationState() == \'draft\':\n
try :\n
context.getPortalObject().portal_workflow.doActionFor(\n
invoice, \'confirm_action\',\n
comment=translateString(\'Initialised by Delivery Builder.\'),\n
skip_period_validation=1)\n
except WorkflowException, e:\n
# The user cannot pass the transition, it\'s OK\n
pass\n
\n
if invoice.getSimulationState() == \'draft\':\n
# call the workflow method, if the user cannot perform this operation.\n
invoice.confirm(comment=translateString(\'Initialised by Delivery Builder.\'),)\n invoice.confirm(comment=translateString(\'Initialised by Delivery Builder.\'),)\n
\n \n
\n
# First set the invoice in the building state on the causality workflow\n # First set the invoice in the building state on the causality workflow\n
invoice.startBuilding()\n invoice.startBuilding()\n
\n \n
...@@ -184,7 +172,6 @@ invoice.activate(after_path_and_method_id=(related_simulation_movement_path_list ...@@ -184,7 +172,6 @@ invoice.activate(after_path_and_method_id=(related_simulation_movement_path_list
<string>order_trade_model_line_copy_id_list</string> <string>order_trade_model_line_copy_id_list</string>
<string>order_trade_model_line</string> <string>order_trade_model_line</string>
<string>clipboard</string> <string>clipboard</string>
<string>e</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
324 325
\ 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