Commit 5e75ad79 authored by Fabien Morin's avatar Fabien Morin

- change calculation part to use in this priority order :

 * the model line script
 * the model default script
 * the bt default script
- change PaySheetTransaction_addEndLine script name in PaySheetTransaction_postCalculation


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@17740 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent cba992fc
...@@ -382,20 +382,23 @@ class PaySheetTransaction(Invoice): ...@@ -382,20 +382,23 @@ class PaySheetTransaction(Invoice):
###################### ######################
# calculation part : # # calculation part : #
###################### ######################
script_name = model.getLocalizedCalculationScriptId() # get the model line script
if script_name is None or \ script_name = model_line.getCalculationScriptId()
getattr(self, script_name, None) is None: if script_name is None:
# if no calculation script found, use a default method : # if model line script is None, get the default model script
if not quantity: script_name = model.getDefaultCalculationScriptId()
if base_application <= model_slice_max:
quantity = base_application-model_slice_min if script_name is None:
else: # if no calculation script found, use a default script :
quantity = model_slice_max-model_slice_min script_name = 'PaySheetTransaction_defaultCalculationScript'
else:
localized_calculation_script = getattr(self, script_name, if getattr(self, script_name, None) is None:
None) raise ValueError, "Unable to find `%s` calculation script" % \
quantity, price = localized_calculation_script(\ script_name
paysheet=self, LOG('script_name :',0,script_name)
calculation_script = getattr(self, script_name, None)
quantity, price = calculation_script(\
base_application=base_application,
model_slice_min = model_slice_min, model_slice_min = model_slice_min,
model_slice_max=model_slice_max, model_slice_max=model_slice_max,
quantity=quantity, quantity=quantity,
...@@ -453,8 +456,8 @@ class PaySheetTransaction(Invoice): ...@@ -453,8 +456,8 @@ class PaySheetTransaction(Invoice):
# this script is used to add a line that permit to have good accounting # this script is used to add a line that permit to have good accounting
# lines # lines
localized_add_end_line_script = getattr(self, localized_add_end_line_script = getattr(self,
'PaySheetTransaction_addEndLine', 'PaySheetTransaction_postCalculation', None)
None) LOG('localized_add_end_line_script :', 0, localized_add_end_line_script)
if localized_add_end_line_script: if localized_add_end_line_script:
localized_add_end_line_script(employee_tax_amount) localized_add_end_line_script(employee_tax_amount)
......
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