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 67a4f8315f737511c0b46eb4526160884bb1c96d..50205b81b350ac40e65ea6cf64c40b9075da335d 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 @@ -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> 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 6587111ffb728b13a9c7917c521568008964e431..6c8ec2e3d8335f87f3cbb4a93dd588e9d29e865a 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 @@ -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> diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_getDestinationExchangeRate.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_getDestinationExchangeRate.xml index 66aec3597b634b0447c056486a1e6e8c17be3e69..3babdad752bde03b8f77b98eb526841d739e60d2 100644 --- a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_getDestinationExchangeRate.xml +++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_getDestinationExchangeRate.xml @@ -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 diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_getDestinationSectionItemList.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_getDestinationSectionItemList.xml index 5654841b7a17311efa2c03b6db0e6c00724b64c6..d6b6fab7594c53534504108cdeced2a491eeaec6 100644 --- a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_getDestinationSectionItemList.xml +++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_getDestinationSectionItemList.xml @@ -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 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 81acb94342be946c201df81629275bc2653226f4..08780a7d0d04a9517a9ceca861d6fb91a2ab5def 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 @@ -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> 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 5c10011b2d3ab154a23da87d5ec8d6db19be3947..0c3e96b245cde582043dc5792bb16ba86bd77ee1 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 @@ -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> diff --git a/bt5/erp5_accounting/bt/revision b/bt5/erp5_accounting/bt/revision index c1891366fdb411c94d98138ed52fef2e57a2676c..988e00fe6b2996b85c3c171cf2b3bed3e896795a 100644 --- a/bt5/erp5_accounting/bt/revision +++ b/bt5/erp5_accounting/bt/revision @@ -1 +1 @@ -769 \ No newline at end of file +768 \ No newline at end of file