From b0401f5a20ccbdc57b21be2141be0e9e0995bbe9 Mon Sep 17 00:00:00 2001
From: Fabien Morin <fabien@nexedi.com>
Date: Wed, 8 Jul 2009 14:35:32 +0000
Subject: [PATCH] the calculation script part was not at the good place, sorry

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

diff --git a/product/ERP5/Document/TradeModelLine.py b/product/ERP5/Document/TradeModelLine.py
index ee3f303b3f..4a40684748 100644
--- a/product/ERP5/Document/TradeModelLine.py
+++ b/product/ERP5/Document/TradeModelLine.py
@@ -266,13 +266,6 @@ class TradeModelLine(Predicate, XMLMatrix, Amount):
             modified = 1
             tmp_movement.setQuantity(quantity + movement.getTotalPrice())
 
-      # if a calculation script is defined, use it
-      calculation_script = self.getCalculationScript(context)
-      if calculation_script is not None:
-        tmp_movement = calculation_script(\
-            current_aggregated_amount_list=movement_list,
-            current_movement=tmp_movement)
-
       else:
         # if the quantity is defined, use it
         modified = 1
@@ -280,6 +273,13 @@ class TradeModelLine(Predicate, XMLMatrix, Amount):
           # if price is not defined, it the same as 100 %
           tmp_movement.setPrice(1)
 
+      # if a calculation script is defined, use it
+      calculation_script = self.getCalculationScript(context)
+      if calculation_script is not None:
+        tmp_movement = calculation_script(\
+            current_aggregated_amount_list=movement_list,
+            current_movement=tmp_movement)
+
       # check if slices are used
       salary_range_list = tmp_movement.getVariationCategoryList(\
           base_category_list='salary_range') #XXX hardcoded values
-- 
2.30.9