[Erp5-report] r39046 jerome - in /erp5/trunk/bt5/erp5_accounting: SkinTemplateItem/portal_s...
nobody at svn.erp5.org
nobody at svn.erp5.org
Tue Oct 12 10:30:34 CEST 2010
Author: jerome
Date: Tue Oct 12 10:30:25 2010
New Revision: 39046
URL: http://svn.erp5.org?rev=39046&view=rev
Log:
make it possible to use another conversion rate that the one proposed by system. This also make possible to use this action when no conversion has been found.
Modified:
erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_convertDestinationPrice.xml
erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_convertSourcePrice.xml
erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_viewConvertDestinationPriceDialog.xml
erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_viewConvertDestinationPriceDialog/your_exchange_rate.xml
erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_viewConvertSourcePriceDialog.xml
erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_viewConvertSourcePriceDialog/your_exchange_rate.xml
erp5/trunk/bt5/erp5_accounting/bt/revision
Modified: erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_convertDestinationPrice.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_convertDestinationPrice.xml?rev=39046&r1=39045&r2=39046&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_convertDestinationPrice.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_convertDestinationPrice.xml [utf8] Tue Oct 12 10:30:25 2010
@@ -50,21 +50,18 @@
</item>
<item>
<key> <string>_body</string> </key>
- <value> <string>from Products.ERP5.Document.Document import ConversionError\n
-\n
-"""\n
+ <value> <string>"""\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
+precision = context.getDestinationSectionValue().getPriceCurrencyValue().getQuantityPrecision()\n
#Get all transaction lines of the transaction \n
-line_list= context.contentValues(\n
+line_list = context.contentValues(\n
portal_type=portal.getPortalAccountingMovementTypeList())\n
"""\n
For each transaction line, calculate the price of the resource\n
@@ -74,26 +71,24 @@ and start_date categories \n
"""\n
\n
for line in line_list:\n
- if line.getDestinationSectionValue() is None:\n
- raise AssertionError\n
- else:\n
- currency = line.getResourceValue()\n
- exchange_ratio = currency.getPrice(context=line.asContext(\n
- categories=[\'resource/%s\' % line.getResource(), \n
- \'price_currency/currency_module/%s\' %\n
- line.getDestinationSectionValue().getPriceCurrencyId()],\n
- start_date=line.getStopDate()))\n
-\n
-#redirect to previous page without doing the conversion\n
- if exchange_ratio is None:\n
- return context.Base_redirect(form_id,\n
+ section = line.getDestinationSectionValue()\n
+ currency = line.getResourceValue()\n
+ if not exchange_rate:\n
+ exchange_rate = currency.getPrice(context=line.asContext(\n
+ categories=[line.getResource(base=True),\n
+ section.getPriceCurrency(base=True)],\n
+ start_date=line.getStopDate()))\n
+\n
+ # redirect to previous page without doing the conversion\n
+ if exchange_rate is None:\n
+ return context.Base_redirect(form_id,\n
keep_items=dict(\n
- portal_status_message=context.Base_translateString(\'No exchange ratio found.\'))) \n
-#update the corresponding price and round it according to the precision of\n
-#the converted currency\n
- line.setDestinationTotalAssetPrice(\n
- round(exchange_ratio*(line.getQuantity()), precision))\n
+ portal_status_message=context.Base_translateString(\'No exchange ratio found.\')))\n
\n
+ # update the corresponding price and round it according to the precision of\n
+ # the converted currency\n
+ line.setDestinationTotalAssetPrice(\n
+ round(exchange_rate * (line.getQuantity()), precision))\n
\n
msg = context.Base_translateString(\'Price converted.\')\n
\n
@@ -109,7 +104,7 @@ return context.Base_redirect(form_id,\n
</item>
<item>
<key> <string>_params</string> </key>
- <value> <string>form_id=\'view\'</string> </value>
+ <value> <string>exchange_rate=None, form_id=\'view\'</string> </value>
</item>
<item>
<key> <string>errors</string> </key>
@@ -129,15 +124,14 @@ return context.Base_redirect(form_id,\n
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
- <value> <int>1</int> </value>
+ <value> <int>2</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
+ <string>exchange_rate</string>
<string>form_id</string>
- <string>Products.ERP5.Document.Document</string>
- <string>ConversionError</string>
<string>_getattr_</string>
<string>context</string>
<string>portal</string>
@@ -145,10 +139,10 @@ return context.Base_redirect(form_id,\n
<string>line_list</string>
<string>_getiter_</string>
<string>line</string>
- <string>None</string>
- <string>AssertionError</string>
+ <string>section</string>
<string>currency</string>
- <string>exchange_ratio</string>
+ <string>True</string>
+ <string>None</string>
<string>dict</string>
<string>round</string>
<string>msg</string>
@@ -164,6 +158,7 @@ return context.Base_redirect(form_id,\n
<key> <string>func_defaults</string> </key>
<value>
<tuple>
+ <none/>
<string>view</string>
</tuple>
</value>
Modified: erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_convertSourcePrice.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_convertSourcePrice.xml?rev=39046&r1=39045&r2=39046&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_convertSourcePrice.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_convertSourcePrice.xml [utf8] Tue Oct 12 10:30:25 2010
@@ -50,16 +50,15 @@
</item>
<item>
<key> <string>_body</string> </key>
- <value> <string>from Products.ERP5.Document.Document import ConversionError\n
-"""\n
+ <value> <string>"""\n
Script to convert the prices used in the transaction to the \n
currency of the destination section\n
"""\n
portal = context.getPortalObject()\n
#get the precision of the destination\n
-precision =context.getSourceSectionValue().getPriceCurrencyValue().getQuantityPrecision()\n
+precision = context.getSourceSectionValue().getPriceCurrencyValue().getQuantityPrecision()\n
#Get all transaction lines of the transaction \n
-line_list= context.contentValues(\n
+line_list = context.contentValues(\n
portal_type=portal.getPortalAccountingMovementTypeList())\n
"""\n
For each transaction line, calculate the price of the resource\n
@@ -69,27 +68,24 @@ and start_date categories \n
"""\n
\n
for line in line_list:\n
- if line.getSourceSectionValue() is None:\n
- raise AssertionError\n
- else:\n
- currency = line.getResourceValue()\n
- exchange_ratio = currency.getPrice(context=line.asContext(\n
- categories=[\'resource/%s\' % line.getResource(), \n
- \'price_currency/currency_module/%s\' %\n
- line.getSourceSectionValue().getPriceCurrencyId()],\n
+ section = line.getSourceSectionValue()\n
+ currency = line.getResourceValue()\n
+ if not exchange_rate:\n
+ exchange_rate = currency.getPrice(context=line.asContext(\n
+ categories=[line.getResource(base=True),\n
+ section.getPriceCurrency(base=True)],\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
+ # redirect to previous page without doing the conversion\n
+ if exchange_rate is None:\n
+ return context.Base_redirect(form_id,\n
keep_items=dict(\n
- portal_status_message=context.Base_translateString(\'No exchange ratio found.\'))) \n
-\n
+ portal_status_message=context.Base_translateString(\'No exchange ratio found.\')))\n
\n
-#update the corresponding price and round it according to the precision of\n
-#the converted currency\n
- line.setSourceTotalAssetPrice(\n
- round(exchange_ratio * (-line.getQuantity()), precision))\n
\n
+ # update the corresponding price and round it according to the precision of\n
+ # the converted currency\n
+ line.setSourceTotalAssetPrice(\n
+ round(exchange_rate * (-line.getQuantity()), precision))\n
\n
msg = context.Base_translateString(\'Price converted.\')\n
\n
@@ -105,7 +101,7 @@ return context.Base_redirect(form_id,\n
</item>
<item>
<key> <string>_params</string> </key>
- <value> <string>form_id=\'view\'</string> </value>
+ <value> <string>exchange_rate=None, form_id=\'view\'</string> </value>
</item>
<item>
<key> <string>errors</string> </key>
@@ -125,15 +121,14 @@ return context.Base_redirect(form_id,\n
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
- <value> <int>1</int> </value>
+ <value> <int>2</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
+ <string>exchange_rate</string>
<string>form_id</string>
- <string>Products.ERP5.Document.Document</string>
- <string>ConversionError</string>
<string>_getattr_</string>
<string>context</string>
<string>portal</string>
@@ -141,10 +136,10 @@ return context.Base_redirect(form_id,\n
<string>line_list</string>
<string>_getiter_</string>
<string>line</string>
- <string>None</string>
- <string>AssertionError</string>
+ <string>section</string>
<string>currency</string>
- <string>exchange_ratio</string>
+ <string>True</string>
+ <string>None</string>
<string>dict</string>
<string>round</string>
<string>msg</string>
@@ -160,6 +155,7 @@ return context.Base_redirect(form_id,\n
<key> <string>func_defaults</string> </key>
<value>
<tuple>
+ <none/>
<string>view</string>
</tuple>
</value>
Modified: erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_viewConvertDestinationPriceDialog.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_viewConvertDestinationPriceDialog.xml?rev=39046&r1=39045&r2=39046&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_viewConvertDestinationPriceDialog.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_viewConvertDestinationPriceDialog.xml [utf8] Tue Oct 12 10:30:25 2010
@@ -53,7 +53,7 @@
</item>
<item>
<key> <string>enctype</string> </key>
- <value> <string>application/x-www-form-urlencoded</string> </value>
+ <value> <string>multipart/form-data</string> </value>
</item>
<item>
<key> <string>group_list</string> </key>
@@ -143,6 +143,10 @@
<key> <string>update_action</string> </key>
<value> <string></string> </value>
</item>
+ <item>
+ <key> <string>update_action_title</string> </key>
+ <value> <string></string> </value>
+ </item>
</dictionary>
</pickle>
</record>
Modified: erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_viewConvertDestinationPriceDialog/your_exchange_rate.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_viewConvertDestinationPriceDialog/your_exchange_rate.xml?rev=39046&r1=39045&r2=39046&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_viewConvertDestinationPriceDialog/your_exchange_rate.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_viewConvertDestinationPriceDialog/your_exchange_rate.xml [utf8] Tue Oct 12 10:30:25 2010
@@ -10,10 +10,9 @@
<key> <string>delegated_list</string> </key>
<value>
<list>
- <string>title</string>
<string>default</string>
<string>precision</string>
- <string>editable</string>
+ <string>title</string>
</list>
</value>
</item>
@@ -85,10 +84,6 @@
<value> <string></string> </value>
</item>
<item>
- <key> <string>editable</string> </key>
- <value> <int>0</int> </value>
- </item>
- <item>
<key> <string>field_id</string> </key>
<value> <string>my_money_quantity</string> </value>
</item>
Modified: erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_viewConvertSourcePriceDialog.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_viewConvertSourcePriceDialog.xml?rev=39046&r1=39045&r2=39046&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_viewConvertSourcePriceDialog.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_viewConvertSourcePriceDialog.xml [utf8] Tue Oct 12 10:30:25 2010
@@ -53,7 +53,7 @@
</item>
<item>
<key> <string>enctype</string> </key>
- <value> <string>application/x-www-form-urlencoded</string> </value>
+ <value> <string>multipart/form-data</string> </value>
</item>
<item>
<key> <string>group_list</string> </key>
@@ -143,6 +143,10 @@
<key> <string>update_action</string> </key>
<value> <string></string> </value>
</item>
+ <item>
+ <key> <string>update_action_title</string> </key>
+ <value> <string></string> </value>
+ </item>
</dictionary>
</pickle>
</record>
Modified: erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_viewConvertSourcePriceDialog/your_exchange_rate.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_viewConvertSourcePriceDialog/your_exchange_rate.xml?rev=39046&r1=39045&r2=39046&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_viewConvertSourcePriceDialog/your_exchange_rate.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_viewConvertSourcePriceDialog/your_exchange_rate.xml [utf8] Tue Oct 12 10:30:25 2010
@@ -10,10 +10,9 @@
<key> <string>delegated_list</string> </key>
<value>
<list>
- <string>title</string>
<string>default</string>
<string>precision</string>
- <string>editable</string>
+ <string>title</string>
</list>
</value>
</item>
@@ -85,10 +84,6 @@
<value> <string></string> </value>
</item>
<item>
- <key> <string>editable</string> </key>
- <value> <int>0</int> </value>
- </item>
- <item>
<key> <string>field_id</string> </key>
<value> <string>my_money_quantity</string> </value>
</item>
Modified: erp5/trunk/bt5/erp5_accounting/bt/revision
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/bt/revision?rev=39046&r1=39045&r2=39046&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/bt/revision [utf8] (original)
+++ erp5/trunk/bt5/erp5_accounting/bt/revision [utf8] Tue Oct 12 10:30:25 2010
@@ -1 +1 @@
-1367
\ No newline at end of file
+1368
\ No newline at end of file
More information about the Erp5-report
mailing list