From c7db24edd7684927d744a0a1109654331abf630a Mon Sep 17 00:00:00 2001
From: Kazuhiko Shiozaki <kazuhiko@nexedi.com>
Date: Tue, 13 Apr 2010 19:36:07 +0000
Subject: [PATCH] path rule document to _getPropertyAndCategoryList() to avoid
 needless calculations.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@34530 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../DocumentTemplateItem/DeliverySimulationRule.py            | 4 +++-
 .../DocumentTemplateItem/InvoiceSimulationRule.py             | 4 +++-
 .../DocumentTemplateItem/TradeModelSimulationRule.py          | 4 +++-
 bt5/erp5_simulation/bt/revision                               | 2 +-
 4 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/bt5/erp5_simulation/DocumentTemplateItem/DeliverySimulationRule.py b/bt5/erp5_simulation/DocumentTemplateItem/DeliverySimulationRule.py
index e30dffa99a..2546723203 100644
--- a/bt5/erp5_simulation/DocumentTemplateItem/DeliverySimulationRule.py
+++ b/bt5/erp5_simulation/DocumentTemplateItem/DeliverySimulationRule.py
@@ -101,9 +101,11 @@ class DeliveryRuleMovementGenerator(MovementGeneratorMixin):
     Input movement list comes from the parent
     """
     ret = []
+    rule = context.getSpecialiseValue()
     for input_movement, business_path in self \
             ._getInputMovementAndPathTupleList(context):
-      kw = self._getPropertyAndCategoryList(input_movement, business_path)
+      kw = self._getPropertyAndCategoryList(input_movement, business_path,
+                                            rule)
       kw.update({'order':None,'delivery':None})
       simulation_movement = context.newContent(
         portal_type=RuleMixin.movement_type,
diff --git a/bt5/erp5_simulation/DocumentTemplateItem/InvoiceSimulationRule.py b/bt5/erp5_simulation/DocumentTemplateItem/InvoiceSimulationRule.py
index 78f5b55a4d..39d1af42b0 100644
--- a/bt5/erp5_simulation/DocumentTemplateItem/InvoiceSimulationRule.py
+++ b/bt5/erp5_simulation/DocumentTemplateItem/InvoiceSimulationRule.py
@@ -101,9 +101,11 @@ class InvoicingRuleMovementGenerator(MovementGeneratorMixin):
     i.e. business paths are not taken into account.
     """
     ret = []
+    rule = context.getSpecialiseValue()
     for input_movement, business_path in self \
             ._getInputMovementAndPathTupleList(context):
-      kw = self._getPropertyAndCategoryList(input_movement, business_path)
+      kw = self._getPropertyAndCategoryList(input_movement, business_path,
+                                            rule)
       kw.update({'order':None,'delivery':None})
       simulation_movement = context.newContent(
         portal_type=RuleMixin.movement_type,
diff --git a/bt5/erp5_simulation/DocumentTemplateItem/TradeModelSimulationRule.py b/bt5/erp5_simulation/DocumentTemplateItem/TradeModelSimulationRule.py
index 785140ef4e..5032972ab4 100644
--- a/bt5/erp5_simulation/DocumentTemplateItem/TradeModelSimulationRule.py
+++ b/bt5/erp5_simulation/DocumentTemplateItem/TradeModelSimulationRule.py
@@ -105,6 +105,7 @@ class TradeModelRuleMovementGenerator(MovementGeneratorMixin):
       return movement_list
 
     context_movement = context.getParentValue()
+    rule = context.getSpecialiseValue()
     for amount in trade_condition.getAggregatedAmountList(context_movement):
       # business path specific
       business_path_list = business_process.getPathValueList(
@@ -117,7 +118,8 @@ class TradeModelRuleMovementGenerator(MovementGeneratorMixin):
 
       business_path = business_path_list[0]
 
-      kw = self._getPropertyAndCategoryList(context_movement, business_path)
+      kw = self._getPropertyAndCategoryList(context_movement, business_path,
+                                            rule)
 
       # rule specific
       kw['price'] = amount.getPrice() or amount.getEfficiency()
diff --git a/bt5/erp5_simulation/bt/revision b/bt5/erp5_simulation/bt/revision
index e3f1e9b791..c147342cbe 100644
--- a/bt5/erp5_simulation/bt/revision
+++ b/bt5/erp5_simulation/bt/revision
@@ -1 +1 @@
-80
\ No newline at end of file
+81
\ No newline at end of file
-- 
2.30.9