diff --git a/bt5/erp5_banking_core/PropertySheetTemplateItem/CurrencyExchangeRate.py b/bt5/erp5_banking_core/PropertySheetTemplateItem/CurrencyExchangeRate.py new file mode 100644 index 0000000000000000000000000000000000000000..d8b36ba5315c492b7c75cdf8c3f53c4727dcd175 --- /dev/null +++ b/bt5/erp5_banking_core/PropertySheetTemplateItem/CurrencyExchangeRate.py @@ -0,0 +1,40 @@ +############################################################################## +# +# Copyright (c) 2002-2007 Nexedi SARL and Contributors. All Rights Reserved. +# +# WARNING: This program as such is intended to be used by professional +# programmers who take the whole responsability of assessing all potential +# consequences resulting from its eventual inadequacies and bugs +# End users who are looking for a ready-to-use solution with commercial +# garantees and support are strongly adviced to contract a Free Software +# Service Company +# +# This program is Free Software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +############################################################################## + +class CurrencyExchangeRate: + """ + PropertySheetTemplate properties for all ERP5 objects + """ + + _properties = ( + { 'id' : 'currency_exchange_rate', + 'description' : 'A particular currency exchange rate used', + 'type' : 'float', + 'mode' : 'w' }, + ) + + diff --git a/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/ERP5Banking_getExchangeValue.xml b/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/ERP5Banking_getExchangeValue.xml index 40005fc836dd708e389977d6f06de0e762e4d0ab..845e42d8c7d4e768eb3525be5eb3b02367202d33 100644 --- a/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/ERP5Banking_getExchangeValue.xml +++ b/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/ERP5Banking_getExchangeValue.xml @@ -67,13 +67,17 @@ <key> <string>_body</string> </key> <value> <string encoding="cdata"><![CDATA[ -rate_list = context.CurrencyExchange_getExchangeRateList(from_currency=from_currency,\n +rate = None\n +method = getattr(context, \'getCurrencyExchangeRate\', None)\n +if method is not None:\n + rate = method()\n +if rate is None:\n + rate_list = context.CurrencyExchange_getExchangeRateList(from_currency=from_currency,\n to_currency=to_currency, \n currency_exchange_type=currency_exchange_type,\n start_date=start_date)\n -rate = None\n -if len(rate_list) > 0:\n - rate = rate_list[0]\n + if len(rate_list) > 0:\n + rate = rate_list[0]\n \n price = context.getSourceTotalAssetPrice()\n \n @@ -145,11 +149,13 @@ return round(rate * price)\n <string>to_currency</string> <string>currency_exchange_type</string> <string>start_date</string> - <string>_getattr_</string> - <string>context</string> - <string>rate_list</string> <string>None</string> <string>rate</string> + <string>getattr</string> + <string>context</string> + <string>method</string> + <string>_getattr_</string> + <string>rate_list</string> <string>len</string> <string>_getitem_</string> <string>price</string> diff --git a/bt5/erp5_banking_core/bt/revision b/bt5/erp5_banking_core/bt/revision index 194ba8cc7594b96181da7c25c73002be08d56ff5..871cae9aa662ba186a3a1da42301a2cfbbaea7e0 100644 --- a/bt5/erp5_banking_core/bt/revision +++ b/bt5/erp5_banking_core/bt/revision @@ -1 +1 @@ -320 \ No newline at end of file +323 \ No newline at end of file diff --git a/bt5/erp5_banking_core/bt/template_property_sheet_id_list b/bt5/erp5_banking_core/bt/template_property_sheet_id_list index 706558704b42f0c1648c0db233267158ea747412..bd398466aee2a2a5a25772ea7763cb20d08d9e57 100644 --- a/bt5/erp5_banking_core/bt/template_property_sheet_id_list +++ b/bt5/erp5_banking_core/bt/template_property_sheet_id_list @@ -1,3 +1,4 @@ CheckModel RenderingPreference -BaobabStopDate \ No newline at end of file +BaobabStopDate +CurrencyExchangeRate \ No newline at end of file