Commit 177f9f86 authored by Jérome Perrin's avatar Jérome Perrin

revert r20322, movement.getExplanationValue raises an AttributeError in too many cases.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@20476 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 7e4dcf6b
......@@ -99,15 +99,19 @@ def resourceSalePriceSortMethod(a, b):\n
else:\n
return sourceSortMethod(a, b)\n
\n
if hasattr(context, \'getExplanationValue\'):\n
try:\n
explanation = context.getExplanationValue()\n
if explanation is not None:\n
explanation_type = explanation.getPortalType()\n
# XXX FIXME: Hardcoded values\n
if "Purchase" in explanation_type:\n
kw[\'sort_method\'] = resourcePurchasePriceSortMethod\n
elif "Sale" in explanation_type:\n
kw[\'sort_method\'] = resourceSalePriceSortMethod\n
except AttributeError:\n
# Sometime, movements doesn\'t have an explanation.\n
explanation = None\n
\n
if explanation is not None:\n
explanation_type = explanation.getPortalType()\n
# XXX FIXME: Hardcoded values\n
if "Purchase" in explanation_type:\n
kw[\'sort_method\'] = resourcePurchasePriceSortMethod\n
elif "Sale" in explanation_type:\n
kw[\'sort_method\'] = resourceSalePriceSortMethod\n
\n
resource = context.getResourceValue()\n
if resource is not None:\n
......@@ -168,10 +172,10 @@ else:\n
<string>destinationSortMethod</string>
<string>resourcePurchasePriceSortMethod</string>
<string>resourceSalePriceSortMethod</string>
<string>hasattr</string>
<string>context</string>
<string>_getattr_</string>
<string>context</string>
<string>explanation</string>
<string>AttributeError</string>
<string>None</string>
<string>explanation_type</string>
<string>_write_</string>
......
787
\ No newline at end of file
788
\ 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