[Erp5-report] r20184 - in /experimental/bt5/erp5_base_experimental: SkinTemplateItem/portal...
nobody at svn.erp5.org
nobody at svn.erp5.org
Thu Mar 27 22:04:51 CET 2008
Author: bartek
Date: Thu Mar 27 22:04:51 2008
New Revision: 20184
URL: http://svn.erp5.org?rev=20184&view=rev
Log:
A (proposed) implementation of API method Currency.convertCurrency, which at present is not implemented
Added:
experimental/bt5/erp5_base_experimental/SkinTemplateItem/portal_skins/erp5_base_experimental/
experimental/bt5/erp5_base_experimental/SkinTemplateItem/portal_skins/erp5_base_experimental/Currency_convertCurrency.xml
Modified:
experimental/bt5/erp5_base_experimental/SkinTemplateItem/portal_skins/erp5_base_experimental.xml
experimental/bt5/erp5_base_experimental/bt/revision
Modified: experimental/bt5/erp5_base_experimental/SkinTemplateItem/portal_skins/erp5_base_experimental.xml
URL: http://svn.erp5.org/experimental/bt5/erp5_base_experimental/SkinTemplateItem/portal_skins/erp5_base_experimental.xml?rev=20184&r1=20183&r2=20184&view=diff
==============================================================================
--- experimental/bt5/erp5_base_experimental/SkinTemplateItem/portal_skins/erp5_base_experimental.xml (original)
+++ experimental/bt5/erp5_base_experimental/SkinTemplateItem/portal_skins/erp5_base_experimental.xml Thu Mar 27 22:04:51 2008
@@ -16,6 +16,12 @@
</value>
</item>
<item>
+ <key> <string>_objects</string> </key>
+ <value>
+ <tuple/>
+ </value>
+ </item>
+ <item>
<key> <string>id</string> </key>
<value> <string>erp5_base_experimental</string> </value>
</item>
Added: experimental/bt5/erp5_base_experimental/SkinTemplateItem/portal_skins/erp5_base_experimental/Currency_convertCurrency.xml
URL: http://svn.erp5.org/experimental/bt5/erp5_base_experimental/SkinTemplateItem/portal_skins/erp5_base_experimental/Currency_convertCurrency.xml?rev=20184&view=auto
==============================================================================
--- experimental/bt5/erp5_base_experimental/SkinTemplateItem/portal_skins/erp5_base_experimental/Currency_convertCurrency.xml (added)
+++ experimental/bt5/erp5_base_experimental/SkinTemplateItem/portal_skins/erp5_base_experimental/Currency_convertCurrency.xml Thu Mar 27 22:04:51 2008
@@ -1,0 +1,204 @@
+<?xml version="1.0"?>
+<ZopeData>
+ <record id="1" aka="AAAAAAAAAAE=">
+ <pickle>
+ <tuple>
+ <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
+ <tuple/>
+ </tuple>
+ </pickle>
+ <pickle>
+ <dictionary>
+ <item>
+ <key> <string>Python_magic</string> </key>
+ <value>
+ <none/>
+ </value>
+ </item>
+ <item>
+ <key> <string>Script_magic</string> </key>
+ <value> <int>3</int> </value>
+ </item>
+ <item>
+ <key> <string>__ac_local_roles__</string> </key>
+ <value>
+ <none/>
+ </value>
+ </item>
+ <item>
+ <key> <string>_bind_names</string> </key>
+ <value>
+ <object>
+ <klass>
+ <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
+ </klass>
+ <tuple/>
+ <state>
+ <dictionary>
+ <item>
+ <key> <string>_asgns</string> </key>
+ <value>
+ <dictionary>
+ <item>
+ <key> <string>name_container</string> </key>
+ <value> <string>container</string> </value>
+ </item>
+ <item>
+ <key> <string>name_context</string> </key>
+ <value> <string>context</string> </value>
+ </item>
+ <item>
+ <key> <string>name_m_self</string> </key>
+ <value> <string>script</string> </value>
+ </item>
+ <item>
+ <key> <string>name_subpath</string> </key>
+ <value> <string>traverse_subpath</string> </value>
+ </item>
+ </dictionary>
+ </value>
+ </item>
+ </dictionary>
+ </state>
+ </object>
+ </value>
+ </item>
+ <item>
+ <key> <string>_body</string> </key>
+ <value> <string encoding="cdata"><![CDATA[
+
+"""\n
+ This is supposed to be an implementation of Currency.convertCurrency API method\n
+ which at present returns quantity and does nothing\n
+\n
+ to_currency - a Currency object\n
+"""\n
+\n
+# conversion to the same currency\n
+if to_currency == context: return quantity\n
+\n
+# find exchange line (TODO: rewrite to use Query)\n
+kw = dict()\n
+kw[\'where_expression\'] = "movement.start_date<\'%s\' and movement.stop_date>\'%s\'" % (date, date)\n
+kw[\'portal_type\'] = \'Currency Exchange Line\'\n
+kw[\'sort_on\'] = ((\'movement.stop_date\', \'descending\'),)\n
+kw[\'price_currency_uid\'] = to_currency.getUid()\n
+res = context.searchFolder(**kw)\n
+if len(res) != 1:\n
+ context.log(\'Bad news: there is %s exchange lines for %s/%s valid for date %s\' % (len(res), context.getReference(), to_currency.getReference(), date))\n
+ return 0\n
+line = res[0]\n
+\n
+# find exchange type cell (lame - should it be based on predicates? why would it be better?)\n
+for c in line.searchFolder():\n
+ if c.isMemberOf(\'currency_exchange_type/\' + currency_exchange_type):\n
+ return c.getBasePrice() * quantity\n
+\n
+# fallback\n
+context.log(\'Bad news: there is %s exchange lines for %s/%s valid for date %s, exchange type %s\' % (0, context.getReference(), to_currency.getReference(), date, currency_exchange_type))\n
+return 0\n
+
+
+]]></string> </value>
+ </item>
+ <item>
+ <key> <string>_code</string> </key>
+ <value>
+ <none/>
+ </value>
+ </item>
+ <item>
+ <key> <string>_filepath</string> </key>
+ <value>
+ <none/>
+ </value>
+ </item>
+ <item>
+ <key> <string>_params</string> </key>
+ <value> <string>to_currency, quantity=1, date=DateTime(), currency_exchange_type=\'sale\'</string> </value>
+ </item>
+ <item>
+ <key> <string>errors</string> </key>
+ <value>
+ <tuple/>
+ </value>
+ </item>
+ <item>
+ <key> <string>func_code</string> </key>
+ <value>
+ <object>
+ <klass>
+ <global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
+ </klass>
+ <tuple/>
+ <state>
+ <dictionary>
+ <item>
+ <key> <string>co_argcount</string> </key>
+ <value> <int>4</int> </value>
+ </item>
+ <item>
+ <key> <string>co_varnames</string> </key>
+ <value>
+ <tuple>
+ <string>to_currency</string>
+ <string>quantity</string>
+ <string>date</string>
+ <string>currency_exchange_type</string>
+<string>context</string>
+ <string>dict</string>
+ <string>kw</string>
+ <string>_write_</string>
+ <string>_getattr_</string>
+ <string>_apply_</string>
+ <string>res</string>
+ <string>len</string>
+ <string>_getitem_</string>
+ <string>line</string>
+ <string>_getiter_</string>
+ <string>c</string>
+ </tuple>
+ </value>
+ </item>
+ </dictionary>
+ </state>
+ </object>
+ </value>
+ </item>
+ <item>
+ <key> <string>func_defaults</string> </key>
+ <value>
+ <tuple>
+ <int>1</int>
+ <object>
+ <klass>
+ <global name="DateTime" module="DateTime.DateTime"/>
+ </klass>
+ <tuple>
+ <none/>
+ </tuple>
+ <state>
+ <tuple>
+ <float>1206651142.06</float>
+ <string>GMT+1</string>
+ </tuple>
+ </state>
+ </object>
+ <string>sale</string>
+ </tuple>
+ </value>
+ </item>
+ <item>
+ <key> <string>id</string> </key>
+ <value> <string>Currency_convertCurrency</string> </value>
+ </item>
+ <item>
+ <key> <string>warnings</string> </key>
+ <value>
+ <tuple/>
+ </value>
+ </item>
+ </dictionary>
+ </pickle>
+ </record>
+</ZopeData>
Modified: experimental/bt5/erp5_base_experimental/bt/revision
URL: http://svn.erp5.org/experimental/bt5/erp5_base_experimental/bt/revision?rev=20184&r1=20183&r2=20184&view=diff
==============================================================================
--- experimental/bt5/erp5_base_experimental/bt/revision (original)
+++ experimental/bt5/erp5_base_experimental/bt/revision Thu Mar 27 22:04:51 2008
@@ -1,1 +1,1 @@
-1
+4
More information about the Erp5-report
mailing list