Commit 19446356 authored by Kevin Deldycke's avatar Kevin Deldycke

Add direct link to the wrong transaction object when closing the accounting period.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@7654 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 6d7719e1
...@@ -14,7 +14,9 @@ ...@@ -14,7 +14,9 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>Python_magic</string> </key> <key> <string>Python_magic</string> </key>
<value> <string encoding="base64">O/INCg==</string> </value> <value>
<none/>
</value>
</item> </item>
<item> <item>
<key> <string>Script_magic</string> </key> <key> <string>Script_magic</string> </key>
...@@ -79,28 +81,30 @@ valid_states = [\'cancelled\', \'stopped\', \'delivered\']\n ...@@ -79,28 +81,30 @@ valid_states = [\'cancelled\', \'stopped\', \'delivered\']\n
start_date = closing_period.getStartDate()\n start_date = closing_period.getStartDate()\n
stop_date = closing_period.getStopDate()\n stop_date = closing_period.getStopDate()\n
\n \n
search_params = { \'delivery.start_date\' : \'>= %s\' % start_date,\n search_params = { \'delivery.start_date\': \'>= %s\' % start_date\n
\'delivery.stop_date\' : \'<= %s\' % stop_date, \n , \'delivery.stop_date\' : \'<= %s\' % stop_date\n
\'simulation_state\' : [\'draft\', \'planned\', \'confirmed\', ] }\n , \'simulation_state\' : [\'draft\', \'planned\', \'confirmed\'] \n
}\n
transaction_list = accounting_module.searchFolder( **search_params )\n transaction_list = accounting_module.searchFolder( **search_params )\n
\n \n
organisation_section = closing_period.getParentValue()\n organisation_section = closing_period.getParentValue()\n
for transaction in transaction_list :\n for transaction in transaction_list:\n
transaction = transaction.getObject()\n transaction = transaction.getObject()\n
# we only take into account transaction that are related to this\n # we only take into account transaction that are related to this\n
# organisation. \n # organisation. \n
# FIXME: this approach is not compatible with categories as section.\n # FIXME: this approach is not compatible with categories as section.\n
# FIXME: and not compatible with 100 000 transactions, but as we only search\n # FIXME: and not compatible with 100 000 transactions, but as we only search\n
# for draft, planned or confirmed transactions, it should be ok.\n # for draft, planned or confirmed transactions, it should be ok.\n
if transaction.getSourceSectionUid() == organisation_section.getUid() or \\\n if organisation_section.getUid() in [ transaction.getSourceSectionUid()\n
transaction.getDestinationSectionUid() == organisation_section.getUid() :\n , transaction.getDestinationSectionUid()]:\n
if transaction.getSimulationState() not in valid_states :\n if transaction.getSimulationState() not in valid_states:\n
raise ValidationFailed, N_(\n raise ValidationFailed, N_(\n
"Transaction ${transaction_path} is in invalid "+\n "Transaction <a href=\'${url}\'>${path}</a> is in invalid state (${state})",\n
"state (${transaction_translated_state})",\n mapping = { \'url\' : transaction.absolute_url()\n
mapping = { \'transaction_path\' : transaction.getPath(),\n , \'path\' : transaction.getPath()\n
\'transaction_translated_state\' :\n , \'state\': unicode(transaction.getTranslatedSimulationStateTitle(), \'utf8\')\n
unicode(transaction.getTranslatedSimulationStateTitle(), \'utf8\')})\n }\n
)\n
]]></string> </value> ]]></string> </value>
......
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