Commit 78760336 authored by Vincent Pelletier's avatar Vincent Pelletier

Handle the case where from_currency and to_currency are the same.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@13962 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 62092d14
...@@ -74,6 +74,12 @@ ...@@ -74,6 +74,12 @@
# context. If to_currency is provided, then instead of using\n # context. If to_currency is provided, then instead of using\n
# the context, it will generate a temp object.\n # the context, it will generate a temp object.\n
\n \n
# Handle the case where from_currency is to_currency\n
# Assumes that 2 currencies with the same ID, they are the same currency\n
if from_currency is not None and to_currency is not None and \\\n
[x for x in from_currency.split(\'/\') if x.strip()][-1] == [x for x in to_currency.split(\'/\') if x.strip()][-1]:\n
return 1\n
\n
def sort_by_date(a, b):\n def sort_by_date(a, b):\n
if a.getStartDateRangeMin() > b.getStartDateRangeMin() :\n if a.getStartDateRangeMin() > b.getStartDateRangeMin() :\n
return -1\n return -1\n
...@@ -178,16 +184,21 @@ return result\n ...@@ -178,16 +184,21 @@ return result\n
<string>currency_exchange_type</string> <string>currency_exchange_type</string>
<string>start_date</string> <string>start_date</string>
<string>kw</string> <string>kw</string>
<string>None</string>
<string>_getitem_</string>
<string>append</string>
<string>$append0</string>
<string>_getiter_</string>
<string>_getattr_</string>
<string>x</string>
<string>sort_by_date</string> <string>sort_by_date</string>
<string>context</string> <string>context</string>
<string>object</string> <string>object</string>
<string>Products.ERP5Type.Cache</string> <string>Products.ERP5Type.Cache</string>
<string>CachingMethod</string> <string>CachingMethod</string>
<string>None</string>
<string>calculateExchangeFromParameters</string> <string>calculateExchangeFromParameters</string>
<string>result</string> <string>result</string>
<string>getattr</string> <string>getattr</string>
<string>_getattr_</string>
<string>mapped_value</string> <string>mapped_value</string>
</tuple> </tuple>
</value> </value>
......
47 48
\ 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