From a87f080884bad0426c8057b92fbc16611b868064 Mon Sep 17 00:00:00 2001
From: Fabien Morin <fabien@nexedi.com>
Date: Tue, 27 Nov 2007 13:37:40 +0000
Subject: [PATCH] remove a hack and put it in the localized script
 PaySheetTransaction_postCalculation

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@17821 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/Document/PaySheetTransaction.py | 17 ++++-------------
 1 file changed, 4 insertions(+), 13 deletions(-)

diff --git a/product/ERP5/Document/PaySheetTransaction.py b/product/ERP5/Document/PaySheetTransaction.py
index 7e991da671..c7647af49e 100644
--- a/product/ERP5/Document/PaySheetTransaction.py
+++ b/product/ERP5/Document/PaySheetTransaction.py
@@ -295,7 +295,6 @@ class PaySheetTransaction(Invoice):
     model_line_list = [line for line in model_line_list if not line.getEditable()]
 
     pay_sheet_line_list = []
-    employee_tax_amount = 0
 
     # main loop : find all informations and create cell and PaySheetLines
     for model_line in model_line_list:
@@ -330,7 +329,6 @@ class PaySheetTransaction(Invoice):
             LOG('createNotEditablePaySheetLineList : cell is None')
             continue
           # get the slice :
-          model_slice = None
           model_slice = model_line.getParentValue().getCell(slice)
           quantity = 0.0
           price = 0.0
@@ -369,7 +367,7 @@ class PaySheetTransaction(Invoice):
           LOG('script_name :', 0, script_name)
           result = calculation_script(\
             base_amount_current_value_dict=base_amount_current_value_dict,
-            share=share,
+            share=share, #XXX
             model_slice_min=model_slice_min, 
             model_slice_max=model_slice_max, 
             cell=cell,)
@@ -385,13 +383,6 @@ class PaySheetTransaction(Invoice):
                      }
           cell_list.append(new_cell)
 
-          #XXX this is a hack to have the net salary
-          base_list = model_line.getResourceValue().getBaseAmountList()
-          if price is not None and 'employee_share' in share and\
-              ('deductible_tax' in base_list or\
-               'non_deductible_tax' in base_list):
-            employee_tax_amount += round((price * quantity), precision)
-
           # update base participation
           base_participation_list = service.getBaseAmountList(base=1)
           for base_participation in base_participation_list:
@@ -422,9 +413,9 @@ class PaySheetTransaction(Invoice):
 
     # this script is used to add a line that permit to have good accounting 
     # lines
-    localized_add_end_line_script = getattr(self,
+    post_calculation_script = getattr(self,
                                 'PaySheetTransaction_postCalculation', None)
-    if localized_add_end_line_script:
-      localized_add_end_line_script(employee_tax_amount)
+    if post_calculation_script:
+      post_calculation_script()
 
     return pay_sheet_line_list
-- 
2.30.9