Commit 9e8c9ffe authored by Mame Coumba Sall's avatar Mame Coumba Sall

2008-09-10 mame

* Took care of case where there is no currency exchange line defined for a transaction

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@23546 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent f12027b4
......@@ -66,10 +66,15 @@
<item>
<key> <string>_body</string> </key>
<value> <string>from Products.ERP5.Document.Document import ConversionError\n
\n
"""\n
Script to convert the prices used in the transaction to the \n
currency of the destination section\n
form_id : Page that action is called from\n
\n
\n
"""\n
\n
portal = context.getPortalObject()\n
#get the precision of the destination\n
precision =context.getDestinationSectionValue().getPriceCurrencyValue().getQuantityPrecision()\n
......@@ -94,7 +99,11 @@ for line in line_list:\n
line.getDestinationSectionValue().getPriceCurrencyId()],\n
start_date=line.getStopDate()))\n
\n
\n
#redirect to previous page without doing the conversion\n
if exchange_ratio is None:\n
return context.Base_redirect(form_id,\n
keep_items=dict(\n
portal_status_message=context.Base_translateString(\'No exchange ratio was found.\'))) \n
#update the corresponding price and round it according to the precision of\n
#the converted currency\n
line.setDestinationTotalAssetPrice(\n
......@@ -162,9 +171,9 @@ return context.Base_redirect(form_id,\n
<string>AssertionError</string>
<string>currency</string>
<string>exchange_ratio</string>
<string>dict</string>
<string>round</string>
<string>msg</string>
<string>dict</string>
</tuple>
</value>
</item>
......
......@@ -92,7 +92,12 @@ for line in line_list:\n
categories=[\'resource/%s\' % line.getResourceRelativeUrl(), \n
\'price_currency/currency_module/%s\' %\n
line.getSourceSectionValue().getPriceCurrencyId()],\n
start_date=line.getStopDate()))\n
start_date=line.getStartDate()))\n
#redirect to previous page without doing the conversion\n
if exchange_ratio is None:\n
return context.Base_redirect(form_id,\n
keep_items=dict(\n
portal_status_message=context.Base_translateString(\'No exchange ratio was found.\'))) \n
\n
\n
#update the corresponding price and round it according to the precision of\n
......@@ -162,9 +167,9 @@ return context.Base_redirect(form_id,\n
<string>AssertionError</string>
<string>currency</string>
<string>exchange_ratio</string>
<string>dict</string>
<string>round</string>
<string>msg</string>
<string>dict</string>
</tuple>
</value>
</item>
......
......@@ -65,7 +65,12 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>currency = context.getResourceValue()\n
<value> <string>"""\n
Script used to get the exchange ratio used \n
in the conversion of the destination price\n
"""\n
\n
currency = context.getResourceValue()\n
exchange_ratio = currency.getPrice(context=context.asContext(categories=[\'resource/%s\' % context.getResourceRelativeUrl(), \n
\'price_currency/currency_module/%s\' % context.getDestinationSectionValue().getPriceCurrencyId()],\n
start_date=context.getStopDate()))\n
......
......@@ -77,6 +77,7 @@ if section is not None:\n
if section_value is not None:\n
result = section_value.getGroupRelatedValueList(portal_type=\'Organisation\',\n
checked_permission=\'View\')\n
\n
result = [r for r in result\n
if r.getProperty(\'validation_state\') not in (\'invalidated\', \'deleted\')]\n
\n
......
......@@ -81,25 +81,25 @@
<value>
<dictionary>
<item>
<key> <string>bottom</string> </key>
<key> <string>bottom</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>center</string> </key>
<key> <string>center</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>hidden</string> </key>
<key> <string>hidden</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>left</string> </key>
<key> <string>left</string> </key>
<value>
<list>
<string>my_destination_currency</string>
......@@ -108,7 +108,7 @@
</value>
</item>
<item>
<key> <string>right</string> </key>
<key> <string>right</string> </key>
<value>
<list/>
</value>
......
......@@ -81,25 +81,25 @@
<value>
<dictionary>
<item>
<key> <string>bottom</string> </key>
<key> <string>bottom</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>center</string> </key>
<key> <string>center</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>hidden</string> </key>
<key> <string>hidden</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>left</string> </key>
<key> <string>left</string> </key>
<value>
<list>
<string>your_exchange_rate</string>
......@@ -108,7 +108,7 @@
</value>
</item>
<item>
<key> <string>right</string> </key>
<key> <string>right</string> </key>
<value>
<list/>
</value>
......
769
\ No newline at end of file
768
\ 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