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 ...@@ -81,25 +81,38 @@ selected_uids = stool.updateSelectionCheckedUidList(\n
\n \n
object_list = stool.callSelectionFor(selection_name)\n object_list = stool.callSelectionFor(selection_name)\n
\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 # XXX prevent to call this on the whole module:\n
if len(object_list) > 100:\n if len(object_list) > 100:\n
return context.REQUEST.RESPONSE.redirect(\n return context.REQUEST.RESPONSE.redirect(\n
"%s/view?portal_status_message=%s" % (\n "%s/view?portal_status_message=%s" % (\n
context.absolute_url(), N_(\n context.absolute_url(), N_(\n
\'Refusing to process more than 100 objects, check your selection\')))\n \'Refusing to process more than 100 objects, check your selection\')))\n
\n \n
activated = 0\n
for obj in object_list:\n for obj in object_list:\n
if obj.portal_type in invoice_type_list:\n if obj.portal_type in invoice_type_list:\n
obj = obj.getObject()\n obj.getObject().activate().Invoice_createRelatedPaymentTransaction(node=node,\n
if obj.getCausalityRelatedValue(portal_type=\'Payment Transaction\') is None:\n
obj.activate().Invoice_createRelatedPaymentTransaction(node=node,\n
payment_mode=payment_mode,\n payment_mode=payment_mode,\n
payment=payment,\n payment=payment,\n
batch_mode=1)\n batch_mode=1)\n
activated += 1\n
\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 return context.REQUEST.RESPONSE.redirect(\n
"%s/view?portal_status_message=%s" % (\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> ]]></string> </value>
...@@ -167,10 +180,11 @@ return context.REQUEST.RESPONSE.redirect(\n ...@@ -167,10 +180,11 @@ return context.REQUEST.RESPONSE.redirect(\n
<string>N_</string> <string>N_</string>
<string>selected_uids</string> <string>selected_uids</string>
<string>object_list</string> <string>object_list</string>
<string>dict</string>
<string>len</string> <string>len</string>
<string>activated</string>
<string>_getiter_</string> <string>_getiter_</string>
<string>obj</string> <string>obj</string>
<string>None</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
...@@ -283,7 +283,7 @@ ...@@ -283,7 +283,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <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> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -283,7 +283,7 @@ ...@@ -283,7 +283,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <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> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -283,7 +283,7 @@ ...@@ -283,7 +283,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <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> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -81,7 +81,8 @@ is_source = context.AccountingTransaction_isSourceView()\n ...@@ -81,7 +81,8 @@ is_source = context.AccountingTransaction_isSourceView()\n
line_portal_type = \'Accounting Transaction Line\'\n line_portal_type = \'Accounting Transaction Line\'\n
\n \n
# update selection params, because it\'ll be used in the selection dialog.\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 params=dict(node_for_related_payment=node,\n
payment_mode_for_related_payment=payment_mode,\n payment_mode_for_related_payment=payment_mode,\n
payment_for_related_payment=payment))\n payment_for_related_payment=payment))\n
......
...@@ -283,7 +283,7 @@ ...@@ -283,7 +283,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <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> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -283,7 +283,7 @@ ...@@ -283,7 +283,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <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> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -283,7 +283,7 @@ ...@@ -283,7 +283,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <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> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
95 96
\ 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