[Erp5-report] r20474 - in /erp5/trunk/bt5/erp5_trade: SkinTemplateItem/portal_skins/erp5_tr...
nobody at svn.erp5.org
nobody at svn.erp5.org
Mon Apr 14 11:28:10 CEST 2008
Author: jerome
Date: Mon Apr 14 11:28:09 2008
New Revision: 20474
URL: http://svn.erp5.org?rev=20474&view=rev
Log:
new tax system (missing in previous commit)
Added:
erp5/trunk/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/TradeCondition_viewTax/
erp5/trunk/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/TradeCondition_viewTax/listbox.xml
erp5/trunk/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/TradeCondition_viewTax/my_title.xml
Modified:
erp5/trunk/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Order_applyTradeCondition.xml
erp5/trunk/bt5/erp5_trade/bt/revision
Modified: erp5/trunk/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Order_applyTradeCondition.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Order_applyTradeCondition.xml?rev=20474&r1=20473&r2=20474&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Order_applyTradeCondition.xml (original)
+++ erp5/trunk/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Order_applyTradeCondition.xml Mon Apr 14 11:28:09 2008
@@ -79,16 +79,29 @@
]\n
new_category_dict = {}\n
\n
+\n
+def getPropertyFromTradeCondition(trade_condition, property_name):\n
+ """Get a property from the trade condition, or from a specialised trade\n
+ condition\n
+ """\n
+ v = trade_condition.getProperty(property_name)\n
+ if v:\n
+ return v\n
+ for specialised_trade_condition in trade_condition.getSpecialiseValueList():\n
+ v = getPropertyFromTradeCondition(\n
+ specialised_trade_condition, property_name)\n
+ if v:\n
+ return v\n
+\n
+\n
for category in category_list:\n
if force or not order.getPropertyList(category):\n
- value_list = trade_condition.getPropertyList(category)\n
- if value_list:\n
- if len(value_list) == 1:\n
- new_category_dict[category] = value_list[0]\n
- else:\n
- new_category_dict[\'%s_list\' % category] = value_list\n
+ v = getPropertyFromTradeCondition(trade_condition, category)\n
+ if v:\n
+ new_category_dict[category] = v\n
\n
def copyObjects(portal_type):\n
+ # TODO: iterate on specialise tree\n
filter_dict = {\'portal_type\': portal_type}\n
if len(order.contentIds(filter=filter_dict)) == 0:\n
to_copy = trade_condition.contentIds(filter=filter_dict)\n
@@ -101,6 +114,38 @@
\n
# copy discounts if none exist\n
copyObjects(\'Discount\')\n
+\n
+# initialise tax lines\n
+def initialiseTaxLineList(order, trade_condition):\n
+ for tax_model_line in trade_condition.contentValues(portal_type=\'Tax Model Line\'):\n
+ tax_model_line_reference = tax_model_line.getReference()\n
+ if not tax_model_line_reference or tax_model_line_reference not in [\n
+ x.getProperty(\'reference\') for x in\n
+ order.contentValues(portal_type=\'Tax Line\')]:\n
+ tax_line = order.newContent(\n
+ portal_type=\'Tax Line\',\n
+ resource=tax_model_line.getResource(),\n
+ reference=tax_model_line_reference,\n
+ float_index=tax_model_line.getFloatIndex(),\n
+ base_application_list=tax_model_line.getBaseApplicationList(),\n
+ # XXX tax model line or tax model line resource ?\n
+ base_contribution_list=tax_model_line.getBaseContributionList(),\n
+ quantity=0,\n
+ price=0,)\n
+ # calculation_script\n
+ if tax_model_line.getProperty(\'calculation_script_id\'):\n
+ raise NotImplementedError\n
+ # fixed_amount\n
+ if tax_model_line.getQuantity():\n
+ raise NotImplementedError\n
+ # ratio\n
+ tax_line.setPrice(tax_model_line.getEfficiency())\n
+ \n
+ # recurse on other trade conditions\n
+ for specialised_trade_condition in trade_condition.getSpecialiseValueList():\n
+ initialiseTaxLineList(order, specialised_trade_condition)\n
+\n
+initialiseTaxLineList(context, trade_condition)\n
\n
# set specialise\n
new_category_dict[\'specialise\'] = trade_condition.getRelativeUrl()\n
@@ -156,14 +201,14 @@
<string>order</string>
<string>category_list</string>
<string>new_category_dict</string>
+ <string>getPropertyFromTradeCondition</string>
<string>_getiter_</string>
<string>category</string>
<string>_getattr_</string>
- <string>value_list</string>
- <string>len</string>
- <string>_getitem_</string>
+ <string>v</string>
<string>_write_</string>
<string>copyObjects</string>
+ <string>initialiseTaxLineList</string>
<string>_apply_</string>
</tuple>
</value>
Added: erp5/trunk/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/TradeCondition_viewTax/listbox.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/TradeCondition_viewTax/listbox.xml?rev=20474&view=auto
==============================================================================
--- erp5/trunk/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/TradeCondition_viewTax/listbox.xml (added)
+++ erp5/trunk/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/TradeCondition_viewTax/listbox.xml Mon Apr 14 11:28:09 2008
@@ -1,0 +1,136 @@
+<?xml version="1.0"?>
+<ZopeData>
+ <record id="1" aka="AAAAAAAAAAE=">
+ <pickle>
+ <tuple>
+ <global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
+ <tuple/>
+ </tuple>
+ </pickle>
+ <pickle>
+ <dictionary>
+ <item>
+ <key> <string>delegated_list</string> </key>
+ <value>
+ <list>
+ <string>title</string>
+ <string>columns</string>
+ <string>selection_name</string>
+ <string>portal_types</string>
+ </list>
+ </value>
+ </item>
+ <item>
+ <key> <string>id</string> </key>
+ <value> <string>listbox</string> </value>
+ </item>
+ <item>
+ <key> <string>message_values</string> </key>
+ <value>
+ <dictionary>
+ <item>
+ <key> <string>external_validator_failed</string> </key>
+ <value> <string>The input failed the external validator.</string> </value>
+ </item>
+ </dictionary>
+ </value>
+ </item>
+ <item>
+ <key> <string>overrides</string> </key>
+ <value>
+ <dictionary>
+ <item>
+ <key> <string>field_id</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>form_id</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>target</string> </key>
+ <value> <string></string> </value>
+ </item>
+ </dictionary>
+ </value>
+ </item>
+ <item>
+ <key> <string>tales</string> </key>
+ <value>
+ <dictionary>
+ <item>
+ <key> <string>field_id</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>form_id</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>target</string> </key>
+ <value> <string></string> </value>
+ </item>
+ </dictionary>
+ </value>
+ </item>
+ <item>
+ <key> <string>values</string> </key>
+ <value>
+ <dictionary>
+ <item>
+ <key> <string>columns</string> </key>
+ <value>
+ <list>
+ <tuple>
+ <string>title</string>
+ <string>Title</string>
+ </tuple>
+ <tuple>
+ <string>float_index</string>
+ <string>Calculation Order</string>
+ </tuple>
+ <tuple>
+ <string>base_application_title</string>
+ <string>Base Application</string>
+ </tuple>
+ </list>
+ </value>
+ </item>
+ <item>
+ <key> <string>field_id</string> </key>
+ <value> <string>my_view_mode_listbox</string> </value>
+ </item>
+ <item>
+ <key> <string>form_id</string> </key>
+ <value> <string>Base_viewFieldLibrary</string> </value>
+ </item>
+ <item>
+ <key> <string>portal_types</string> </key>
+ <value>
+ <list>
+ <tuple>
+ <string>Tax Model Line</string>
+ <string>Tax Model Line</string>
+ </tuple>
+ </list>
+ </value>
+ </item>
+ <item>
+ <key> <string>selection_name</string> </key>
+ <value> <string>tax_model_selection</string> </value>
+ </item>
+ <item>
+ <key> <string>target</string> </key>
+ <value> <string>Click to edit the target</string> </value>
+ </item>
+ <item>
+ <key> <string>title</string> </key>
+ <value> <string>Tax Model Lines</string> </value>
+ </item>
+ </dictionary>
+ </value>
+ </item>
+ </dictionary>
+ </pickle>
+ </record>
+</ZopeData>
Added: erp5/trunk/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/TradeCondition_viewTax/my_title.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/TradeCondition_viewTax/my_title.xml?rev=20474&view=auto
==============================================================================
--- erp5/trunk/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/TradeCondition_viewTax/my_title.xml (added)
+++ erp5/trunk/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/TradeCondition_viewTax/my_title.xml Mon Apr 14 11:28:09 2008
@@ -1,0 +1,99 @@
+<?xml version="1.0"?>
+<ZopeData>
+ <record id="1" aka="AAAAAAAAAAE=">
+ <pickle>
+ <tuple>
+ <global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
+ <tuple/>
+ </tuple>
+ </pickle>
+ <pickle>
+ <dictionary>
+ <item>
+ <key> <string>delegated_list</string> </key>
+ <value>
+ <list>
+ <string>editable</string>
+ </list>
+ </value>
+ </item>
+ <item>
+ <key> <string>id</string> </key>
+ <value> <string>my_title</string> </value>
+ </item>
+ <item>
+ <key> <string>message_values</string> </key>
+ <value>
+ <dictionary>
+ <item>
+ <key> <string>external_validator_failed</string> </key>
+ <value> <string>The input failed the external validator.</string> </value>
+ </item>
+ </dictionary>
+ </value>
+ </item>
+ <item>
+ <key> <string>overrides</string> </key>
+ <value>
+ <dictionary>
+ <item>
+ <key> <string>field_id</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>form_id</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>target</string> </key>
+ <value> <string></string> </value>
+ </item>
+ </dictionary>
+ </value>
+ </item>
+ <item>
+ <key> <string>tales</string> </key>
+ <value>
+ <dictionary>
+ <item>
+ <key> <string>field_id</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>form_id</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>target</string> </key>
+ <value> <string></string> </value>
+ </item>
+ </dictionary>
+ </value>
+ </item>
+ <item>
+ <key> <string>values</string> </key>
+ <value>
+ <dictionary>
+ <item>
+ <key> <string>editable</string> </key>
+ <value> <int>0</int> </value>
+ </item>
+ <item>
+ <key> <string>field_id</string> </key>
+ <value> <string>my_title</string> </value>
+ </item>
+ <item>
+ <key> <string>form_id</string> </key>
+ <value> <string>Base_viewFieldLibrary</string> </value>
+ </item>
+ <item>
+ <key> <string>target</string> </key>
+ <value> <string>Click to edit the target</string> </value>
+ </item>
+ </dictionary>
+ </value>
+ </item>
+ </dictionary>
+ </pickle>
+ </record>
+</ZopeData>
Modified: erp5/trunk/bt5/erp5_trade/bt/revision
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_trade/bt/revision?rev=20474&r1=20473&r2=20474&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_trade/bt/revision (original)
+++ erp5/trunk/bt5/erp5_trade/bt/revision Mon Apr 14 11:28:09 2008
@@ -1,1 +1,1 @@
-256
+257
More information about the Erp5-report
mailing list