Commit 36098e01 authored by Fabien Morin's avatar Fabien Morin

fix some mistakes :

- self is not the same than context, use context parameter instead
- get closest model from the paysheet
- condition for slice was wrong. if the slice is equal to the base_application, quantity is 0


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@28123 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent ddf893d1
......@@ -160,7 +160,7 @@ class TradeModelLine(Predicate, XMLMatrix, Amount):
# specialise_value
document = self.getParentValue().getSpecialiseValue()
business_process_list = document.findSpecialiseValueList(\
context=self, portal_type_list=['Business Process'])
context=context, portal_type_list=['Business Process'])
business_process = None
property_dict = {}
if len(business_process_list):
......@@ -289,7 +289,8 @@ class TradeModelLine(Predicate, XMLMatrix, Amount):
if salary_range is not None and calculation_script is None:
# slice are used only if there is no script found, in case where a
# script exist, slice should be handle in it
model = self.getParentValue()
model = context.getSpecialiseValue() # get the closest model from
# the paysheet
cell = model.getCell(salary_range)
if cell is None:
raise ValueError("Line '%s' (%s) can't find the cell corresponding"+\
......@@ -299,7 +300,7 @@ class TradeModelLine(Predicate, XMLMatrix, Amount):
model_slice_min = cell.getQuantityRangeMin()
model_slice_max = cell.getQuantityRangeMax()
base_application = tmp_movement.getQuantity(0.0)
if base_application < model_slice_min:
if base_application <= model_slice_min:
# if base_application is not in the slice range, quantity is 0
tmp_movement.setQuantity(0)
elif base_application-model_slice_min > 0:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment