[Erp5-report] r39417 yusei - in /erp5/trunk/bt5/erp5_trade: SkinTemplateItem/portal_skins/e...

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Oct 21 08:14:59 CEST 2010


Author: yusei
Date: Thu Oct 21 08:14:59 2010
New Revision: 39417

URL: http://svn.erp5.org?rev=39417&view=rev
Log:
2010-10-21 yusei
* Add reverse_arrow_category parameter to Order_applyTradeCondition. This option is useful when trade condition is applied to returned packing list.

Modified:
    erp5/trunk/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Order_applyTradeCondition.xml
    erp5/trunk/bt5/erp5_trade/bt/change_log
    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=39417&r1=39416&r2=39417&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Order_applyTradeCondition.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Order_applyTradeCondition.xml [utf8] Thu Oct 21 08:14:59 2010
@@ -2,10 +2,7 @@
 <ZopeData>
   <record id="1" aka="AAAAAAAAAAE=">
     <pickle>
-      <tuple>
-        <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
-        <tuple/>
-      </tuple>
+      <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
     </pickle>
     <pickle>
       <dictionary>
@@ -83,19 +80,56 @@ def getPropertyFromTradeCondition(trade_
     if v:\n
       return v\n
 \n
-\n
-for category in category_list:\n
-  if force or not order.getPropertyList(category):\n
-    v = getPropertyFromTradeCondition(trade_condition, category)\n
-    if v:\n
-      new_category_dict[category] = v\n
-      # for accounting transactions, we also initialize resource with the price\n
-      # currency\n
-      if category == \'price_currency\' and \\\n
-          context.getPortalType() in \\\n
-          context.getPortalAccountingTransactionTypeList():\n
-        new_category_dict[\'resource\'] = v\n
-\n
+if not reverse_arrow_category:\n
+  for category in category_list:\n
+    if force or not order.getPropertyList(category):\n
+      v = getPropertyFromTradeCondition(trade_condition, category)\n
+      if v:\n
+        new_category_dict[category] = v\n
+        # for accounting transactions, we also initialize resource with the price\n
+        # currency\n
+        if category == \'price_currency\' and \\\n
+            context.getPortalType() in \\\n
+            context.getPortalAccountingTransactionTypeList():\n
+          new_category_dict[\'resource\'] = v\n
+else:\n
+  # Reverse source and destination\n
+  # This is useful for Returned Sale/Purchase XXX types.\n
+  reverse_dict = {\n
+    \'source\':\'destination\',\n
+    \'source_section\':\'destination_section\',\n
+    \'source_decision\':\'destination_decision\',\n
+    \'source_administration\':\'destination_administration\',\n
+    \'source_payment\':\'destination_payment\',\n
+    \'source_project\':\'destination_project\',\n
+    \'source_carrier\':\'destination_carrier\',\n
+    \'source_referral\':\'destination_referral\',\n
+    \'source_function\':\'destination_function\',\n
+    \'destination\':\'source\',\n
+    \'destination_section\':\'source_section\',\n
+    \'destination_decision\':\'source_decision\',\n
+    \'destination_administration\':\'source_administration\',\n
+    \'destination_payment\':\'source_payment\',\n
+    \'destination_project\':\'source_project\',\n
+    \'destination_carrier\':\'source_carrier\',\n
+    \'destination_referral\':\'source_referral\',\n
+    \'destination_function\':\'source_function\',\n
+    }\n
+  for category in category_list:\n
+    if force or not order.getPropertyList(category):\n
+      if category in reverse_dict:\n
+        trade_condition_category = reverse_dict[category]\n
+      else:\n
+        trade_condition_category = category\n
+      v = getPropertyFromTradeCondition(trade_condition, trade_condition_category)\n
+      if v:\n
+        new_category_dict[category] = v\n
+        # for accounting transactions, we also initialize resource with the price\n
+        # currency\n
+        if category == \'price_currency\' and \\\n
+            context.getPortalType() in \\\n
+            context.getPortalAccountingTransactionTypeList():\n
+          new_category_dict[\'resource\'] = v\n
 \n
 def copyPaymentCondition(order, trade_condition):\n
   filter_dict = {\'portal_type\': \'Payment Condition\'}\n
@@ -128,7 +162,7 @@ order.edit(**new_category_dict)\n
         </item>
         <item>
             <key> <string>_params</string> </key>
-            <value> <string>trade_condition, force=0</string> </value>
+            <value> <string>trade_condition, force=0, reverse_arrow_category=0</string> </value>
         </item>
         <item>
             <key> <string>errors</string> </key>
@@ -148,7 +182,7 @@ order.edit(**new_category_dict)\n
                   <dictionary>
                     <item>
                         <key> <string>co_argcount</string> </key>
-                        <value> <int>2</int> </value>
+                        <value> <int>3</int> </value>
                     </item>
                     <item>
                         <key> <string>co_varnames</string> </key>
@@ -156,6 +190,7 @@ order.edit(**new_category_dict)\n
                           <tuple>
                             <string>trade_condition</string>
                             <string>force</string>
+                            <string>reverse_arrow_category</string>
                             <string>context</string>
                             <string>order</string>
                             <string>category_list</string>
@@ -166,6 +201,9 @@ order.edit(**new_category_dict)\n
                             <string>_getattr_</string>
                             <string>v</string>
                             <string>_write_</string>
+                            <string>reverse_dict</string>
+                            <string>_getitem_</string>
+                            <string>trade_condition_category</string>
                             <string>copyPaymentCondition</string>
                             <string>filter_dict</string>
                             <string>list</string>
@@ -184,6 +222,7 @@ order.edit(**new_category_dict)\n
             <value>
               <tuple>
                 <int>0</int>
+                <int>0</int>
               </tuple>
             </value>
         </item>

Modified: erp5/trunk/bt5/erp5_trade/bt/change_log
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_trade/bt/change_log?rev=39417&r1=39416&r2=39417&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_trade/bt/change_log [utf8] (original)
+++ erp5/trunk/bt5/erp5_trade/bt/change_log [utf8] Thu Oct 21 08:14:59 2010
@@ -1,3 +1,6 @@
+2010-10-21 yusei
+* Add reverse_arrow_category parameter to Order_applyTradeCondition. This option is useful when trade condition is applied to returned packing list.
+
 2010-10-15 nicolas.dumazet
 * No restrictions on subtypes of Order portal type
 

Modified: erp5/trunk/bt5/erp5_trade/bt/revision
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_trade/bt/revision?rev=39417&r1=39416&r2=39417&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_trade/bt/revision [utf8] (original)
+++ erp5/trunk/bt5/erp5_trade/bt/revision [utf8] Thu Oct 21 08:14:59 2010
@@ -1 +1 @@
-991
\ No newline at end of file
+992
\ No newline at end of file




More information about the Erp5-report mailing list