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

Use accounting_create_related_payment_selection, not accounting_selection which is often reseted.

Set a better status message when processing multiple documents.



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@10885 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent beb283e8
......@@ -81,25 +81,38 @@ selected_uids = stool.updateSelectionCheckedUidList(\n
\n
object_list = stool.callSelectionFor(selection_name)\n
\n
# update selection params, because it\'ll be used in the selection dialog.\n
stool.setSelectionParamsFor(\'accounting_create_related_payment_selection\',\n
params=dict(node_for_related_payment=node,\n
payment_mode_for_related_payment=payment_mode,\n
payment_for_related_payment=payment))\n
\n
# XXX prevent to call this on the whole module:\n
if len(object_list) > 100:\n
return context.REQUEST.RESPONSE.redirect(\n
"%s/view?portal_status_message=%s" % (\n
context.absolute_url(), N_(\n
\'Refusing to process more than 100 objects, check your selection\')))\n
\n
\n
activated = 0\n
for obj in object_list:\n
if obj.portal_type in invoice_type_list:\n
obj = obj.getObject()\n
if obj.getCausalityRelatedValue(portal_type=\'Payment Transaction\') is None:\n
obj.activate().Invoice_createRelatedPaymentTransaction(node=node,\n
obj.getObject().activate().Invoice_createRelatedPaymentTransaction(node=node,\n
payment_mode=payment_mode,\n
payment=payment,\n
batch_mode=1)\n
activated += 1\n
\n
if not activated:\n
return context.REQUEST.RESPONSE.redirect(\n
"%s/view?portal_status_message=%s" % (\n
context.absolute_url(), N_(\'No Invoice in your selection\')))\n
\n
return context.REQUEST.RESPONSE.redirect(\n
"%s/view?portal_status_message=%s" % (\n
context.absolute_url(), N_(\'Payments Creation in Progress\')))\n
context.absolute_url(), N_(\n
\'Payments Creation for ${activated_invoice_count} on ${total_selection_count} Invoices in Progress\',\n
mapping=dict(activated_invoice_count=activated, total_selection_count=len(object_list)))))\n
]]></string> </value>
......@@ -167,10 +180,11 @@ return context.REQUEST.RESPONSE.redirect(\n
<string>N_</string>
<string>selected_uids</string>
<string>object_list</string>
<string>dict</string>
<string>len</string>
<string>activated</string>
<string>_getiter_</string>
<string>obj</string>
<string>None</string>
</tuple>
</value>
</item>
......
......@@ -283,7 +283,7 @@
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python:here.portal_selections.getSelectionParamsFor(\'accounting_selection\').get(\'node_for_related_payment\')</string> </value>
<value> <string>python:here.portal_selections.getSelectionParamsFor(\'accounting_create_related_payment_selection\').get(\'node_for_related_payment\')</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -283,7 +283,7 @@
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python:here.portal_selections.getSelectionParamsFor(\'accounting_selection\').get(\'payment_for_related_payment\')</string> </value>
<value> <string>python:here.portal_selections.getSelectionParamsFor(\'accounting_create_related_payment_selection\').get(\'payment_for_related_payment\')</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -283,7 +283,7 @@
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python:here.portal_selections.getSelectionParamsFor(\'accounting_selection\').get(\'payment_mode_for_related_payment\')</string> </value>
<value> <string>python:here.portal_selections.getSelectionParamsFor(\'accounting_create_related_payment_selection\').get(\'payment_mode_for_related_payment\')</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -81,7 +81,8 @@ is_source = context.AccountingTransaction_isSourceView()\n
line_portal_type = \'Accounting Transaction Line\'\n
\n
# update selection params, because it\'ll be used in the selection dialog.\n
portal.portal_selections.setSelectionParamsFor(\'accounting_selection\',\n
portal.portal_selections.setSelectionParamsFor(\n
\'accounting_create_related_payment_selection\',\n
params=dict(node_for_related_payment=node,\n
payment_mode_for_related_payment=payment_mode,\n
payment_for_related_payment=payment))\n
......
......@@ -283,7 +283,7 @@
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python:here.portal_selections.getSelectionParamsFor(\'accounting_selection\').get(\'node_for_related_payment\')</string> </value>
<value> <string>python:here.portal_selections.getSelectionParamsFor(\'accounting_create_related_payment_selection\').get(\'node_for_related_payment\')</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -283,7 +283,7 @@
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python:here.portal_selections.getSelectionParamsFor(\'accounting_selection\').get(\'payment_for_related_payment\')</string> </value>
<value> <string>python:here.portal_selections.getSelectionParamsFor(\'accounting_create_related_payment_selection\').get(\'payment_for_related_payment\')</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -283,7 +283,7 @@
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python:here.portal_selections.getSelectionParamsFor(\'accounting_selection\').get(\'payment_mode_for_related_payment\')</string> </value>
<value> <string>python:here.portal_selections.getSelectionParamsFor(\'accounting_create_related_payment_selection\').get(\'payment_mode_for_related_payment\')</string> </value>
</item>
</dictionary>
</pickle>
......
95
\ No newline at end of file
96
\ 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