Commit 4b742773 authored by Fabien Morin's avatar Fabien Morin

typo, add comments


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@17812 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 2a11b7bd
...@@ -203,7 +203,7 @@ class PaySheetTransaction(Invoice): ...@@ -203,7 +203,7 @@ class PaySheetTransaction(Invoice):
'cell_list' : [] 'cell_list' : []
} }
# create cells if a value has been entered by accountable # create cells if a value has been entered
if quantity or price: if quantity or price:
for salary_range in salary_range_categories: for salary_range in salary_range_categories:
# Define an empty new cell # Define an empty new cell
...@@ -285,12 +285,13 @@ class PaySheetTransaction(Invoice): ...@@ -285,12 +285,13 @@ class PaySheetTransaction(Invoice):
else: else:
old_val = 0 old_val = 0
new_val = old_val + paysheetcell.getQuantity() new_val = old_val + paysheetcell.getQuantity()
# increment the corresponding amount
base_amount_current_value_dict[base_amount] = new_val base_amount_current_value_dict[base_amount] = new_val
# get not editables model lines # get not editables model lines
model = self.getSpecialiseValue() model = self.getSpecialiseValue()
model_line_list = model.contentValues(portal_type='Pay Sheet Model Line', model_line_list = model.contentValues(portal_type='Pay Sheet Model Line',
sort_on='int_index') sort_on='int_index')
model_line_list = [line for line in model_line_list if not line.getEditable()] model_line_list = [line for line in model_line_list if not line.getEditable()]
pay_sheet_line_list = [] pay_sheet_line_list = []
...@@ -304,18 +305,18 @@ class PaySheetTransaction(Invoice): ...@@ -304,18 +305,18 @@ class PaySheetTransaction(Invoice):
# This line should not be used # This line should not be used
continue continue
service = model_line.getResourceValue() service = model_line.getResourceValue()
title = model_line.getTitleOrId() title = model_line.getTitleOrId()
int_index = model_line.getFloatIndex() int_index = model_line.getFloatIndex()
id = model_line.getId() id = model_line.getId()
base_amount_list = model_line.getBaseAmountList() base_amount_list = model_line.getBaseAmountList()
res = service.getRelativeUrl() res = service.getRelativeUrl()
if model_line.getDescription(): if model_line.getDescription():
desc = ''.join(model_line.getDescription()) desc = ''.join(model_line.getDescription())
# if the model_line description is empty, the payroll service # if the model_line description is empty, the payroll service
# description is used # description is used
else: else:
desc = ''.join(service.getDescription()) desc = ''.join(service.getDescription())
variation_share_list = model_line.getVariationCategoryList(\ variation_share_list = model_line.getVariationCategoryList(\
base_category_list=['tax_category',]) base_category_list=['tax_category',])
...@@ -325,74 +326,86 @@ class PaySheetTransaction(Invoice): ...@@ -325,74 +326,86 @@ class PaySheetTransaction(Invoice):
for share in variation_share_list: for share in variation_share_list:
for slice in variation_slice_list: for slice in variation_slice_list:
cell = model_line.getCell(slice, share) cell = model_line.getCell(slice, share)
if cell is not None: if cell is None:
# get the slice : LOG('createNotEditablePaySheetLineList : cell is None')
model_slice = None continue
model_slice = model_line.getParentValue().getCell(slice) # get the slice :
quantity = 0.0 model_slice = None
price = 0.0 model_slice = model_line.getParentValue().getCell(slice)
if model_slice is not None: quantity = 0.0
model_slice_min = model_slice.getQuantityRangeMin() price = 0.0
model_slice_max = model_slice.getQuantityRangeMax() if model_slice is None:
LOG('createNotEditablePaySheetLineList : model_slice %s is None' %\
###################### slice)
# calculation part : # continue
###################### model_slice_min = model_slice.getQuantityRangeMin()
# get the model line script model_slice_max = model_slice.getQuantityRangeMax()
script_name = model_line.getCalculationScriptId()
if script_name is None: ######################
# if model line script is None, get the default model script # calculation part : #
script_name = model.getDefaultCalculationScriptId() ######################
if script_name is None: # get script in this order
# if no calculation script found, use a default script : # 1 - model_line script
script_name = 'PaySheetTransaction_defaultCalculationScript' # 2 - model script
# 3 - get the default calculation script
if getattr(self, script_name, None) is None:
raise ValueError, "Unable to find `%s` calculation script" % \ # get the model line script
script_name script_name = model_line.getCalculationScriptId()
calculation_script = getattr(self, script_name, None) if script_name is None:
quantity=0 # if model line script is None, get the default model script
price=0 script_name = model.getDefaultCalculationScriptId()
result = calculation_script(\
base_amount_current_value_dict=base_amount_current_value_dict, if script_name is None:
share=share, # if no calculation script found, use a default script :
model_slice_min=model_slice_min, script_name = 'PaySheetTransaction_defaultCalculationScript'
model_slice_max=model_slice_max,
cell=cell,) if getattr(self, script_name, None) is None:
quantity = result['quantity'] raise ValueError, "Unable to find `%s` calculation script" % \
price = result['price'] script_name
calculation_script = getattr(self, script_name, None)
# Cell creation : quantity=0
# Define an empty new cell price=0
new_cell = { 'axe_list' : [share, slice] LOG('script_name :', 0, script_name)
, 'quantity' : quantity result = calculation_script(\
, 'price' : price base_amount_current_value_dict=base_amount_current_value_dict,
} share=share,
cell_list.append(new_cell) model_slice_min=model_slice_min,
model_slice_max=model_slice_max,
#XXX this is a hack to have the net salary cell=cell,)
base_list = model_line.getResourceValue().getBaseAmountList()
if price is not None and 'employee_share' in share and\ quantity = result['quantity']
not ('base_salary' in base_list or\ price = result['price']
'bonus' in base_list or\
'gross_salary' in base_list): # Cell creation :
employee_tax_amount += round((price * quantity), precision) # Define an empty new cell
new_cell = { 'axe_list' : [share, slice],
# update base participation 'quantity' : quantity,
base_participation_list = service.getBaseAmountList(base=1) 'price' : price,
for base_participation in base_participation_list: }
if quantity: cell_list.append(new_cell)
if base_amount_current_value_dict.has_key(base_participation):
old_val = base_amount_current_value_dict[base_participation] #XXX this is a hack to have the net salary
else: base_list = model_line.getResourceValue().getBaseAmountList()
old_val = 0 if price is not None and 'employee_share' in share and\
new_val = old_val + quantity ('deductible_tax' in base_list or\
'non_deductible_tax' in base_list):
if price: employee_tax_amount += round((price * quantity), precision)
if old_val != 0:
new_val = round((old_val + quantity*price), precision) # update base participation
base_amount_current_value_dict[base_participation] = new_val base_participation_list = service.getBaseAmountList(base=1)
for base_participation in base_participation_list:
if quantity:
if base_amount_current_value_dict.has_key(base_participation):
old_val = base_amount_current_value_dict[base_participation]
else:
old_val = 0
new_val = old_val + quantity
if price:
if old_val != 0:
new_val = round((old_val + quantity*price), precision)
base_amount_current_value_dict[base_participation] = new_val
if cell_list: if cell_list:
# create the PaySheetLine # create the PaySheetLine
......
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