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 ...@@ -99,15 +99,19 @@ def resourceSalePriceSortMethod(a, b):\n
else:\n else:\n
return sourceSortMethod(a, b)\n return sourceSortMethod(a, b)\n
\n \n
if hasattr(context, \'getExplanationValue\'):\n try:\n
explanation = context.getExplanationValue()\n explanation = context.getExplanationValue()\n
if explanation is not None:\n except AttributeError:\n
explanation_type = explanation.getPortalType()\n # Sometime, movements doesn\'t have an explanation.\n
# XXX FIXME: Hardcoded values\n explanation = None\n
if "Purchase" in explanation_type:\n \n
kw[\'sort_method\'] = resourcePurchasePriceSortMethod\n if explanation is not None:\n
elif "Sale" in explanation_type:\n explanation_type = explanation.getPortalType()\n
kw[\'sort_method\'] = resourceSalePriceSortMethod\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 \n
resource = context.getResourceValue()\n resource = context.getResourceValue()\n
if resource is not None:\n if resource is not None:\n
...@@ -168,10 +172,10 @@ else:\n ...@@ -168,10 +172,10 @@ else:\n
<string>destinationSortMethod</string> <string>destinationSortMethod</string>
<string>resourcePurchasePriceSortMethod</string> <string>resourcePurchasePriceSortMethod</string>
<string>resourceSalePriceSortMethod</string> <string>resourceSalePriceSortMethod</string>
<string>hasattr</string>
<string>context</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string>
<string>explanation</string> <string>explanation</string>
<string>AttributeError</string>
<string>None</string> <string>None</string>
<string>explanation_type</string> <string>explanation_type</string>
<string>_write_</string> <string>_write_</string>
......
787 788
\ 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