Commit 66750076 authored by Sebastien Robin's avatar Sebastien Robin

allow to specify a base price on the currency exchange line itself

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@14245 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent db559561
...@@ -101,21 +101,29 @@ if to_currency is not None:\n ...@@ -101,21 +101,29 @@ if to_currency is not None:\n
from Products.ERP5Type.Document import newTempBase\n from Products.ERP5Type.Document import newTempBase\n
temp_object = newTempBase(context.getPortalObject(),\'temp_object\')\n temp_object = newTempBase(context.getPortalObject(),\'temp_object\')\n
temp_kw = {\'category_list\':[\'resource/%s\' % from_currency,\n temp_kw = {\'category_list\':[\'resource/%s\' % from_currency,\n
\'currency_exchange_type/%s\' % currency_exchange_type,\n
\'price_currency/%s\' % to_currency],\n \'price_currency/%s\' % to_currency],\n
\'start_date\':start_date\n \'start_date\':start_date\n
}\n }\n
if currency_exchange_type is not None:\n
temp_kw[\'category_list\'].append(\'currency_exchange_type/%s\' % currency_exchange_type)\n
temp_object.edit(**temp_kw)\n temp_object.edit(**temp_kw)\n
object = temp_object\n object = temp_object\n
mapped_value = context.portal_domains.generateMappedValue(object, \n mapped_value = context.portal_domains.generateMappedValue(object, \n
has_cell_content=0, \n has_cell_content=0, \n
sort_method=sort_by_date)\n sort_method=sort_by_date)\n
result = [getattr(mapped_value, \'base_price\', None), \n base_price = getattr(mapped_value, \'base_price\', None)\n
getattr(mapped_value, \'discount\', None)]\n discount = getattr(mapped_value, \'discount\', None)\n
if base_price is None and discount is None:\n
mapped_value = context.portal_domains.generateMappedValue(object, \n
has_cell_content=1, \n
sort_method=sort_by_date)\n
base_price = getattr(mapped_value, \'base_price\', None)\n
discount = getattr(mapped_value, \'discount\', None)\n
result = [base_price, discount]\n
return result\n return result\n
# The cache duration must not be too long, 300 is the maximum\n # The cache duration must not be too long, 300 is the maximum\n
calculateExchangeFromParameters = CachingMethod(calculateExchangeFromParameters, \n calculateExchangeFromParameters = CachingMethod(calculateExchangeFromParameters, \n
id = \'calculateExchangeFromParameterss\', cache_factory = \'erp5_ui_short\')\n id = \'calculateExchangeFromParameters\', cache_factory = \'erp5_ui_short\')\n
result = calculateExchangeFromParameters(start_date=start_date,\n result = calculateExchangeFromParameters(start_date=start_date,\n
currency_exchange_type=currency_exchange_type,\n currency_exchange_type=currency_exchange_type,\n
from_currency=from_currency,to_currency=to_currency)\n from_currency=from_currency,to_currency=to_currency)\n
...@@ -153,7 +161,7 @@ return result\n ...@@ -153,7 +161,7 @@ return result\n
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>from_currency=None,to_currency=None,currency_exchange_type=\'sale\',start_date=None,**kw</string> </value> <value> <string>from_currency=None,to_currency=None,currency_exchange_type=None,start_date=None,**kw</string> </value>
</item> </item>
<item> <item>
<key> <string>errors</string> </key> <key> <string>errors</string> </key>
...@@ -214,7 +222,7 @@ return result\n ...@@ -214,7 +222,7 @@ return result\n
<tuple> <tuple>
<none/> <none/>
<none/> <none/>
<string>sale</string> <none/>
<none/> <none/>
</tuple> </tuple>
</value> </value>
......
106 107
\ 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