From a6abeda787e130a34bf544542fbbce3ada864a1b Mon Sep 17 00:00:00 2001
From: Alexandre Boeglin <alex@nexedi.com>
Date: Tue, 12 Feb 2008 16:12:21 +0000
Subject: [PATCH] * _pricingSortMethod: Destination is acquired from parent on
 supplies, no need   to do it manually. * getPriceParameterDict: filtering on
 portal type is not the correct way,   revert previous change.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@19277 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/Document/Resource.py | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/product/ERP5/Document/Resource.py b/product/ERP5/Document/Resource.py
index 4ffe63c073..b9722b7755 100644
--- a/product/ERP5/Document/Resource.py
+++ b/product/ERP5/Document/Resource.py
@@ -546,17 +546,13 @@ class Resource(XMLMatrix, Variated):
 
     def _pricingSortMethod(self, a, b):
       # Simple method : the one that defines a destination wins
-      parent = a.getParentValue()
-      if parent.getPortalType().endswith(' Line'):
-        parent = parent.getParentValue()
-      if parent.getDestination():
-        return -1 # a has a destination and wins
-      return 1 # a has no destination ans loses
+      if a.getDestination():
+        return -1 # a defines a destination and wins
+      return 1 # a defines no destination ans loses
 
     security.declareProtected(Permissions.AccessContentsInformation, 
                               'getPriceParameterDict')
-    def getPriceParameterDict(self, context=None, REQUEST=None,
-        portal_type_list=None, **kw):
+    def getPriceParameterDict(self, context=None, REQUEST=None, **kw):
       """
       Get all pricing parameters from Predicate.
       """
@@ -575,8 +571,7 @@ class Resource(XMLMatrix, Variated):
       # Generate the predicate mapped value
       # to get some price values.
       domain_tool = getToolByName(self,'portal_domains')
-      if portal_type_list is None:
-        portal_type_list = self.getPortalSupplyPathTypeList()
+      portal_type_list = self.getPortalSupplyPathTypeList()
 
       # Generate the fake context
       tmp_context = self.asContext(context=context, 
-- 
2.30.9