Commit 12b823b5 authored by Vincent Pelletier's avatar Vincent Pelletier

Explicitely convert currency, grabing "from" and "to" currencies from account incident document.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@13966 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 3265e5ed
...@@ -122,7 +122,13 @@ elif (in_price != 0 and in_price != price) or (out_price != 0 and out_price != p ...@@ -122,7 +122,13 @@ elif (in_price != 0 and in_price != price) or (out_price != 0 and out_price != p
# Now we will validate the accounting position\n # Now we will validate the accounting position\n
transaction = state_change[\'object\']\n transaction = state_change[\'object\']\n
bank_account = transaction.getDestinationPaymentValue()\n bank_account = transaction.getDestinationPaymentValue()\n
price = transaction.ERP5Banking_getExchangeValue()\n exchange_rate_list = transaction.CurrencyExchange_getExchangeRateList(from_currency=transaction.getResource(),\n
to_currency=\'currency_module/%s\' % (context.Baobab_getPortalReferenceCurrencyID(), ),\n
currency_exchange_type=\'transfer\',\n
start_date=transaction.getStartDate())\n
if len(exchange_rate_list) == 0:\n
raise ValidationError, \'Convertion between currencies %s and %s is unknown.\'\n
price = context.getSourceTotalAssetPrice() * exchange_rate_list[0]\n
line = transaction.get(\'movement\')\n line = transaction.get(\'movement\')\n
\n \n
in_list = transaction.objectValues(portal_type=\'Incoming Account Incident Line\')\n in_list = transaction.objectValues(portal_type=\'Incoming Account Incident Line\')\n
...@@ -232,6 +238,8 @@ if debit:\n ...@@ -232,6 +238,8 @@ if debit:\n
<string>len</string> <string>len</string>
<string>resource</string> <string>resource</string>
<string>bank_account</string> <string>bank_account</string>
<string>exchange_rate_list</string>
<string>ValidationError</string>
<string>line</string> <string>line</string>
<string>debit</string> <string>debit</string>
<string>error</string> <string>error</string>
......
262 263
\ 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