From c1093235408d7e6fe4582d8076aa6a2e103f1959 Mon Sep 17 00:00:00 2001
From: Fabien Morin <fabien@nexedi.com>
Date: Wed, 3 Jun 2009 14:04:52 +0000
Subject: [PATCH] check if the line could be applied or not (using predicate)

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@27359 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/Document/TradeModelLine.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/product/ERP5/Document/TradeModelLine.py b/product/ERP5/Document/TradeModelLine.py
index 3c2f744445..4d8a02f573 100644
--- a/product/ERP5/Document/TradeModelLine.py
+++ b/product/ERP5/Document/TradeModelLine.py
@@ -74,6 +74,11 @@ class TradeModelLine(XMLMatrix, Amount, Variated):
         current_aggregated_amount_list = None, base_id='movement', **kw):
       from Products.ERP5Type.Document import newTempSimulationMovement
 
+      # test with predicate if this model line could be applied
+      if not self.test(context):
+        # This model_line should not be applied
+        return []
+
       normal_resource_use_category_list = self.\
           portal_preferences.getPreferredNormalResourceUseCategoryList()
       if normal_resource_use_category_list is None:
@@ -175,4 +180,3 @@ class TradeModelLine(XMLMatrix, Amount, Variated):
             aggregated_amount_list.append(tmp_movement)
 
       return aggregated_amount_list
-
-- 
2.30.9