diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_convertDestinationPrice.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_convertDestinationPrice.xml index 618203989ec719e1b507fac23cbcd0213cf9276d..dae7fd2bc6e4d2036560754acba399aedd774e92 100644 --- a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_convertDestinationPrice.xml +++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_convertDestinationPrice.xml @@ -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 + 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_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 -#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> diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_convertSourcePrice.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_convertSourcePrice.xml index db4b85a32ed4c7013ce8f30c85f579e4d6a4b2ca..57ac88eac71f82c4824d9ff0504c75c6a48e3e65 100644 --- a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_convertSourcePrice.xml +++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_convertSourcePrice.xml @@ -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> diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_viewConvertDestinationPriceDialog.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_viewConvertDestinationPriceDialog.xml index 39b4b0968abb8c68cd4e6166a24324773f1e6e7c..ace31526a1b931e99ba96faf99e048160698a8c8 100644 --- a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_viewConvertDestinationPriceDialog.xml +++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_viewConvertDestinationPriceDialog.xml @@ -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> diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_viewConvertDestinationPriceDialog/your_exchange_rate.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_viewConvertDestinationPriceDialog/your_exchange_rate.xml index 5313a6d6c20db132c17ff7810dc76c31a97e1079..af4a4ad8a6f0bb85961ce35d718c0fa2a49e744c 100644 --- a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_viewConvertDestinationPriceDialog/your_exchange_rate.xml +++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_viewConvertDestinationPriceDialog/your_exchange_rate.xml @@ -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> @@ -84,10 +83,6 @@ <key> <string>default</string> </key> <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> diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_viewConvertSourcePriceDialog.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_viewConvertSourcePriceDialog.xml index 5f019d0ab671673ce33f2d70fa299a0a901fe928..1487b1d66133f19c6c89b1a5f9d3122140dbc092 100644 --- a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_viewConvertSourcePriceDialog.xml +++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_viewConvertSourcePriceDialog.xml @@ -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> diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_viewConvertSourcePriceDialog/your_exchange_rate.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_viewConvertSourcePriceDialog/your_exchange_rate.xml index b4ca7666d0495d98eb13adfa4e6112b77215c2c6..d3a096a33a4adae0a97f330911f6d47f8f01aee9 100644 --- a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_viewConvertSourcePriceDialog/your_exchange_rate.xml +++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_viewConvertSourcePriceDialog/your_exchange_rate.xml @@ -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> @@ -84,10 +83,6 @@ <key> <string>default</string> </key> <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> diff --git a/bt5/erp5_accounting/bt/revision b/bt5/erp5_accounting/bt/revision index abcbc6eeea8609bc6c82736e36a008c5cb607281..5f9cb42f7c5773a92fd9637fbb4dd0abaef22143 100644 --- a/bt5/erp5_accounting/bt/revision +++ b/bt5/erp5_accounting/bt/revision @@ -1 +1 @@ -1367 \ No newline at end of file +1368 \ No newline at end of file