diff --git a/product/ERP5/Document/TradeModelLine.py b/product/ERP5/Document/TradeModelLine.py index ee3f303b3f3e966a9190c4bee9a569ae538b4922..4a40684748744a484f9b08d12e641d4b9ad8f0f7 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