From 48674c6265659e56ca17c0c8c45bfa158b9cb3b5 Mon Sep 17 00:00:00 2001
From: Alexandre Boeglin <alex@nexedi.com>
Date: Mon, 11 Feb 2008 11:43:05 +0000
Subject: [PATCH] pass portal_type_list parameter to
 getPriceCalculationOperandDict based on context.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@19227 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 ...ovement_getPriceCalculationOperandDict.xml | 28 +++++++++++++------
 product/ERP5/bootstrap/erp5_core/bt/revision  |  2 +-
 2 files changed, 21 insertions(+), 9 deletions(-)

diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Movement_getPriceCalculationOperandDict.xml b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Movement_getPriceCalculationOperandDict.xml
index c1af5ffc5d..dc1d0f438a 100644
--- a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Movement_getPriceCalculationOperandDict.xml
+++ b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Movement_getPriceCalculationOperandDict.xml
@@ -3,11 +3,8 @@
   <record id="1" aka="AAAAAAAAAAE=">
     <pickle>
       <tuple>
-        <tuple>
-          <string>Products.PythonScripts.PythonScript</string>
-          <string>PythonScript</string>
-        </tuple>
-        <none/>
+        <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
+        <tuple/>
       </tuple>
     </pickle>
     <pickle>
@@ -68,9 +65,21 @@
         </item>
         <item>
             <key> <string>_body</string> </key>
-            <value> <string>resource = context.getResourceValue()\n
+            <value> <string>portal_type_list = None\n
+\n
+explanation = context.getExplanationValue()\n
+if explanation is not None:\n
+  explanation_type = explanation.getPortalType()\n
+# XXX FIXME: Hardcoded values\n
+  if "Purchase" in explanation_type:\n
+    portal_type_list = ("Purchase Supply Line", "Purchase Supply Cell", "Supply Line", "Supply Cell")\n
+  elif "Sale" in explanation_type:\n
+    portal_type_list = ("Sale Supply Line", "Sale Supply Cell", "Supply Line", "Supply Cell")\n
+\n
+resource = context.getResourceValue()\n
 if resource is not None:\n
-  return resource.getPriceCalculationOperandDict(default=default, context=context, **kw)\n
+  return resource.getPriceCalculationOperandDict(default=default, context=context,\n
+      portal_type_list=portal_type_list, **kw)\n
 else:\n
   return default\n
 </string> </value>
@@ -123,10 +132,13 @@ else:\n
                           <tuple>
                             <string>default</string>
                             <string>kw</string>
+                            <string>None</string>
+                            <string>portal_type_list</string>
                             <string>_getattr_</string>
                             <string>context</string>
+                            <string>explanation</string>
+                            <string>explanation_type</string>
                             <string>resource</string>
-                            <string>None</string>
                             <string>_apply_</string>
                           </tuple>
                         </value>
diff --git a/product/ERP5/bootstrap/erp5_core/bt/revision b/product/ERP5/bootstrap/erp5_core/bt/revision
index 0e46c90894..b775c5e152 100644
--- a/product/ERP5/bootstrap/erp5_core/bt/revision
+++ b/product/ERP5/bootstrap/erp5_core/bt/revision
@@ -1 +1 @@
-698
\ No newline at end of file
+699
\ No newline at end of file
-- 
2.30.9