From 1eb5fb2c460f2bba0ccf34ded0d11fa005d2a310 Mon Sep 17 00:00:00 2001
From: Fabien Morin <fabien@nexedi.com>
Date: Wed, 28 Jan 2009 11:07:56 +0000
Subject: [PATCH] 2009-01-28 fabien * remove some unused script and refeactor
 some very similar scripts in a generic one

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@25326 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 ...ion_getAmountFromBaseParticipationList.xml | 191 ------------------
 ...ion_getMovementTotalPriceFromCategory.xml} |  58 +++---
 ...tYearToDateBaseContributionTotalPrice.xml} |  37 +++-
 ...etTransaction_getYearToDateGrossSalary.xml | 151 --------------
 ...aySheetTransaction_getYearToDateNetPay.xml | 159 ---------------
 ...Transaction_getYearToDateTaxableNetPay.xml | 161 ---------------
 bt5/erp5_payroll/bt/change_log                |   3 +
 bt5/erp5_payroll/bt/revision                  |   2 +-
 8 files changed, 65 insertions(+), 697 deletions(-)
 delete mode 100644 bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_getAmountFromBaseParticipationList.xml
 rename bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/{PaySheetTransaction_getYearToDateOvertimeAmount.xml => PaySheetTransaction_getMovementTotalPriceFromCategory.xml} (71%)
 rename bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/{PaySheetTransaction_getYearToDateBaseSalary.xml => PaySheetTransaction_getYearToDateBaseContributionTotalPrice.xml} (76%)
 delete mode 100644 bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_getYearToDateGrossSalary.xml
 delete mode 100644 bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_getYearToDateNetPay.xml
 delete mode 100644 bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_getYearToDateTaxableNetPay.xml

diff --git a/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_getAmountFromBaseParticipationList.xml b/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_getAmountFromBaseParticipationList.xml
deleted file mode 100644
index 734777892f..0000000000
--- a/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_getAmountFromBaseParticipationList.xml
+++ /dev/null
@@ -1,191 +0,0 @@
-<?xml version="1.0"?>
-<ZopeData>
-  <record id="1" aka="AAAAAAAAAAE=">
-    <pickle>
-      <tuple>
-        <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
-        <tuple/>
-      </tuple>
-    </pickle>
-    <pickle>
-      <dictionary>
-        <item>
-            <key> <string>Script_magic</string> </key>
-            <value> <int>3</int> </value>
-        </item>
-        <item>
-            <key> <string>_bind_names</string> </key>
-            <value>
-              <object>
-                <klass>
-                  <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
-                </klass>
-                <tuple/>
-                <state>
-                  <dictionary>
-                    <item>
-                        <key> <string>_asgns</string> </key>
-                        <value>
-                          <dictionary>
-                            <item>
-                                <key> <string>name_container</string> </key>
-                                <value> <string>container</string> </value>
-                            </item>
-                            <item>
-                                <key> <string>name_context</string> </key>
-                                <value> <string>context</string> </value>
-                            </item>
-                            <item>
-                                <key> <string>name_m_self</string> </key>
-                                <value> <string>script</string> </value>
-                            </item>
-                            <item>
-                                <key> <string>name_subpath</string> </key>
-                                <value> <string>traverse_subpath</string> </value>
-                            </item>
-                          </dictionary>
-                        </value>
-                    </item>
-                  </dictionary>
-                </state>
-              </object>
-            </value>
-        </item>
-        <item>
-            <key> <string>_body</string> </key>
-            <value> <string>\'\'\'\n
-  return the amount composed by all amount of paysheet line wich category of\n
-  category_list parameter is in variation_category_list of the PaySheet line \n
-  and wich has a base_contribution in the base_contribution_list\n
-\'\'\'\n
-\n
-# test the list parameters\n
-if base_contribution_list is None:\n
-  base_contribution_list = []\n
-elif not (same_type(base_contribution_list, []) or\n
-          same_type(base_contribution_list, ())):\n
-  base_contribution_list = [base_contribution_list]\n
-\n
-if category_list is None:\n
-  category_list = []\n
-elif not (same_type(category_list, []) or same_type(category_list, ())):\n
-  category_list = [category_list]\n
-\n
-\n
-# Get Precision\n
-precision = context.getPriceCurrencyValue().getQuantityPrecision()\n
-\n
-paysheet = context\n
-amount = 0\n
-\n
-for pay_sheet_line in paysheet.contentValues(portal_type=\'Pay Sheet Line\'):\n
-  for base_contribution in base_contribution_list:\n
-    if base_contribution in pay_sheet_line.getBaseContributionList():\n
-      if pay_sheet_line.getSalaryRangeList(base=1) != []:\n
-        for slice in pay_sheet_line.getSalaryRangeList(base=1):\n
-          for category in category_list:\n
-            if category in pay_sheet_line.getVariationCategoryList():\n
-              cell = pay_sheet_line.getCell(slice, category)\n
-              if cell is None:\n
-                continue\n
-              total_price = cell.getQuantity() * cell.getPrice()\n
-              amount += total_price\n
-      else:\n
-        for category in category_list:\n
-          if category in pay_sheet_line.getVariationCategoryList():\n
-            cell = pay_sheet_line.getCell(category)\n
-            if cell is None:\n
-              continue\n
-            total_price = cell.getQuantity() * cell.getPrice()\n
-            amount += total_price\n
-        \n
-      break # this permit to add only one time the amount even \n
-            # if many base_amount are in base_contribution_list\n
-\n
-amount = round(amount, precision)\n
-return amount\n
-</string> </value>
-        </item>
-        <item>
-            <key> <string>_code</string> </key>
-            <value>
-              <none/>
-            </value>
-        </item>
-        <item>
-            <key> <string>_params</string> </key>
-            <value> <string>base_contribution_list=None, category_list=None</string> </value>
-        </item>
-        <item>
-            <key> <string>errors</string> </key>
-            <value>
-              <tuple/>
-            </value>
-        </item>
-        <item>
-            <key> <string>func_code</string> </key>
-            <value>
-              <object>
-                <klass>
-                  <global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
-                </klass>
-                <tuple/>
-                <state>
-                  <dictionary>
-                    <item>
-                        <key> <string>co_argcount</string> </key>
-                        <value> <int>2</int> </value>
-                    </item>
-                    <item>
-                        <key> <string>co_varnames</string> </key>
-                        <value>
-                          <tuple>
-                            <string>base_contribution_list</string>
-                            <string>category_list</string>
-                            <string>None</string>
-                            <string>same_type</string>
-                            <string>_getattr_</string>
-                            <string>context</string>
-                            <string>precision</string>
-                            <string>paysheet</string>
-                            <string>amount</string>
-                            <string>_getiter_</string>
-                            <string>pay_sheet_line</string>
-                            <string>base_contribution</string>
-                            <string>slice</string>
-                            <string>category</string>
-                            <string>cell</string>
-                            <string>total_price</string>
-                            <string>_inplacevar_</string>
-                            <string>round</string>
-                          </tuple>
-                        </value>
-                    </item>
-                  </dictionary>
-                </state>
-              </object>
-            </value>
-        </item>
-        <item>
-            <key> <string>func_defaults</string> </key>
-            <value>
-              <tuple>
-                <none/>
-                <none/>
-              </tuple>
-            </value>
-        </item>
-        <item>
-            <key> <string>id</string> </key>
-            <value> <string>PaySheetTransaction_getAmountFromBaseParticipationList</string> </value>
-        </item>
-        <item>
-            <key> <string>warnings</string> </key>
-            <value>
-              <tuple/>
-            </value>
-        </item>
-      </dictionary>
-    </pickle>
-  </record>
-</ZopeData>
diff --git a/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_getYearToDateOvertimeAmount.xml b/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_getMovementTotalPriceFromCategory.xml
similarity index 71%
rename from bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_getYearToDateOvertimeAmount.xml
rename to bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_getMovementTotalPriceFromCategory.xml
index f14209cba3..a51045163a 100644
--- a/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_getYearToDateOvertimeAmount.xml
+++ b/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_getMovementTotalPriceFromCategory.xml
@@ -53,27 +53,23 @@
         </item>
         <item>
             <key> <string>_body</string> </key>
-            <value> <string>if paysheet is None:\n
-    paysheet = context\n
+            <value> <string>\'\'\'\n
+  return the amount composed by all amount of paysheet line wich category of\n
+  category_list parameter is in variation_category_list of the PaySheet line \n
+  and wich has a base_contribution in the base_contribution_list\n
+\'\'\'\n
 \n
-portal = context.getPortalObject();\n
-portal_simulation = portal.portal_simulation\n
+total_price = 0\n
+movement_list = context.getMovementList(portal_type=(\'Pay Sheet Line\', \'Pay Sheet Cell\'))\n
+for movement in movement_list:\n
+  if movement.isMemberOf(tax_category) and movement.isMemberOf(base_contribution):\n
+    total_price += movement.getTotalPrice()\n
 \n
-params = {\n
-    \'node_uid\' : paysheet.getSourceSectionUid(),\n
-    \'mirror_section_uid\' : paysheet.getSourceSectionUid(),\n
-    \'section_uid\' : paysheet.getDestinationSectionUid(),\n
-    \'tax_category_uid\' :\\\n
-        portal.portal_categories.tax_category.employee_share.getUid(),\n
-    \'to_date\' : paysheet.getStartDate(),\n
-    \'from_date\' : DateTime(paysheet.getStartDate().year(), 1, 1),\n
-    \'simulation_state\'    : [\'confirmed\', \'stopped\', \'delivered\'],\n
-    \'precision\' : paysheet.getPriceCurrencyValue().getQuantityPrecision(),\n
-    \'resource_category\' : [\'base_amount/overtime\',]\n
-    #\'src__\' : 1\n
-  }\n
+# Get Precision\n
+precision = context.getPriceCurrencyValue().getQuantityPrecision()\n
 \n
-return portal_simulation.getInventoryAssetPrice(**params)\n
+amount = round(total_price, precision)\n
+return amount\n
 </string> </value>
         </item>
         <item>
@@ -84,7 +80,7 @@ return portal_simulation.getInventoryAssetPrice(**params)\n
         </item>
         <item>
             <key> <string>_params</string> </key>
-            <value> <string>paysheet=None</string> </value>
+            <value> <string>base_contribution=None, tax_category=None</string> </value>
         </item>
         <item>
             <key> <string>errors</string> </key>
@@ -104,21 +100,24 @@ return portal_simulation.getInventoryAssetPrice(**params)\n
                   <dictionary>
                     <item>
                         <key> <string>co_argcount</string> </key>
-                        <value> <int>1</int> </value>
+                        <value> <int>2</int> </value>
                     </item>
                     <item>
                         <key> <string>co_varnames</string> </key>
                         <value>
                           <tuple>
-                            <string>paysheet</string>
-                            <string>None</string>
-                            <string>context</string>
+                            <string>base_contribution</string>
+                            <string>tax_category</string>
+                            <string>total_price</string>
                             <string>_getattr_</string>
-                            <string>portal</string>
-                            <string>portal_simulation</string>
-                            <string>DateTime</string>
-                            <string>params</string>
-                            <string>_apply_</string>
+                            <string>context</string>
+                            <string>movement_list</string>
+                            <string>_getiter_</string>
+                            <string>movement</string>
+                            <string>_inplacevar_</string>
+                            <string>precision</string>
+                            <string>round</string>
+                            <string>amount</string>
                           </tuple>
                         </value>
                     </item>
@@ -132,12 +131,13 @@ return portal_simulation.getInventoryAssetPrice(**params)\n
             <value>
               <tuple>
                 <none/>
+                <none/>
               </tuple>
             </value>
         </item>
         <item>
             <key> <string>id</string> </key>
-            <value> <string>PaySheetTransaction_getYearToDateOvertimeAmount</string> </value>
+            <value> <string>PaySheetTransaction_getMovementTotalPriceFromCategory</string> </value>
         </item>
         <item>
             <key> <string>warnings</string> </key>
diff --git a/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_getYearToDateBaseSalary.xml b/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_getYearToDateBaseContributionTotalPrice.xml
similarity index 76%
rename from bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_getYearToDateBaseSalary.xml
rename to bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_getYearToDateBaseContributionTotalPrice.xml
index 66ce9bed14..3e834cac1a 100644
--- a/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_getYearToDateBaseSalary.xml
+++ b/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_getYearToDateBaseContributionTotalPrice.xml
@@ -53,12 +53,29 @@
         </item>
         <item>
             <key> <string>_body</string> </key>
-            <value> <string>if paysheet is None:\n
+            <value> <string>\'\'\'\n
+  this script return the total price of the base contribution list\n
+  from the first of january of the year of the paysheet and until\n
+  the start_date of this current paysheet.\n
+\'\'\'\n
+\n
+if paysheet is None:\n
     paysheet = context\n
 \n
+# test the list parameters\n
+if base_contribution_list is None:\n
+  base_contribution_list = []\n
+elif not (same_type(base_contribution_list, []) or\n
+          same_type(base_contribution_list, ())):\n
+  base_contribution_list = [base_contribution_list]\n
+\n
 portal = context.getPortalObject();\n
 portal_simulation = portal.portal_simulation\n
 \n
+base_amount = portal.portal_categories.base_amount\n
+context.log(base_contribution_list)\n
+base_contribution_uid_list = [getattr(base_amount, category, None).getUid() for category in base_contribution_list]\n
+\n
 params = {\n
     \'node_uid\' : paysheet.getSourceSectionUid(),\n
     \'mirror_section_uid\' : paysheet.getSourceSectionUid(),\n
@@ -69,7 +86,7 @@ params = {\n
     \'from_date\' : DateTime(paysheet.getStartDate().year(), 1, 1),\n
     \'simulation_state\'    : [\'confirmed\', \'stopped\', \'delivered\'],\n
     \'precision\' : paysheet.getPriceCurrencyValue().getQuantityPrecision(),\n
-    \'resource_category\' : [\'base_amount/base_salary\',]\n
+    \'base_contribution_uid\' : base_contribution_uid_list,\n
     #\'src__\' : 1\n
   }\n
 \n
@@ -84,7 +101,7 @@ return portal_simulation.getInventoryAssetPrice(**params)\n
         </item>
         <item>
             <key> <string>_params</string> </key>
-            <value> <string>paysheet=None</string> </value>
+            <value> <string>paysheet=None, base_contribution_list=None</string> </value>
         </item>
         <item>
             <key> <string>errors</string> </key>
@@ -104,18 +121,27 @@ return portal_simulation.getInventoryAssetPrice(**params)\n
                   <dictionary>
                     <item>
                         <key> <string>co_argcount</string> </key>
-                        <value> <int>1</int> </value>
+                        <value> <int>2</int> </value>
                     </item>
                     <item>
                         <key> <string>co_varnames</string> </key>
                         <value>
                           <tuple>
                             <string>paysheet</string>
+                            <string>base_contribution_list</string>
                             <string>None</string>
                             <string>context</string>
+                            <string>same_type</string>
                             <string>_getattr_</string>
                             <string>portal</string>
                             <string>portal_simulation</string>
+                            <string>base_amount</string>
+                            <string>append</string>
+                            <string>$append0</string>
+                            <string>_getiter_</string>
+                            <string>category</string>
+                            <string>getattr</string>
+                            <string>base_contribution_uid_list</string>
                             <string>DateTime</string>
                             <string>params</string>
                             <string>_apply_</string>
@@ -132,12 +158,13 @@ return portal_simulation.getInventoryAssetPrice(**params)\n
             <value>
               <tuple>
                 <none/>
+                <none/>
               </tuple>
             </value>
         </item>
         <item>
             <key> <string>id</string> </key>
-            <value> <string>PaySheetTransaction_getYearToDateBaseSalary</string> </value>
+            <value> <string>PaySheetTransaction_getYearToDateBaseContributionTotalPrice</string> </value>
         </item>
         <item>
             <key> <string>warnings</string> </key>
diff --git a/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_getYearToDateGrossSalary.xml b/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_getYearToDateGrossSalary.xml
deleted file mode 100644
index f169d30b47..0000000000
--- a/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_getYearToDateGrossSalary.xml
+++ /dev/null
@@ -1,151 +0,0 @@
-<?xml version="1.0"?>
-<ZopeData>
-  <record id="1" aka="AAAAAAAAAAE=">
-    <pickle>
-      <tuple>
-        <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
-        <tuple/>
-      </tuple>
-    </pickle>
-    <pickle>
-      <dictionary>
-        <item>
-            <key> <string>Script_magic</string> </key>
-            <value> <int>3</int> </value>
-        </item>
-        <item>
-            <key> <string>_bind_names</string> </key>
-            <value>
-              <object>
-                <klass>
-                  <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
-                </klass>
-                <tuple/>
-                <state>
-                  <dictionary>
-                    <item>
-                        <key> <string>_asgns</string> </key>
-                        <value>
-                          <dictionary>
-                            <item>
-                                <key> <string>name_container</string> </key>
-                                <value> <string>container</string> </value>
-                            </item>
-                            <item>
-                                <key> <string>name_context</string> </key>
-                                <value> <string>context</string> </value>
-                            </item>
-                            <item>
-                                <key> <string>name_m_self</string> </key>
-                                <value> <string>script</string> </value>
-                            </item>
-                            <item>
-                                <key> <string>name_subpath</string> </key>
-                                <value> <string>traverse_subpath</string> </value>
-                            </item>
-                          </dictionary>
-                        </value>
-                    </item>
-                  </dictionary>
-                </state>
-              </object>
-            </value>
-        </item>
-        <item>
-            <key> <string>_body</string> </key>
-            <value> <string>if paysheet is None:\n
-    paysheet = context\n
-\n
-portal = context.getPortalObject();\n
-portal_simulation = portal.portal_simulation\n
-\n
-params = {\n
-    \'node_uid\' : paysheet.getSourceSectionUid(),\n
-    \'mirror_section_uid\' : paysheet.getSourceSectionUid(),\n
-    \'section_uid\' : paysheet.getDestinationSectionUid(),\n
-    \'tax_category_uid\' :\\\n
-        portal.portal_categories.tax_category.employee_share.getUid(),\n
-    \'to_date\' : paysheet.getStartDate(),\n
-    \'from_date\' : DateTime(paysheet.getStartDate().year(), 1, 1),\n
-    \'simulation_state\'    : [\'confirmed\', \'stopped\', \'delivered\'],\n
-    \'precision\' : paysheet.getPriceCurrencyValue().getQuantityPrecision(),\n
-    \'resource_category\' : [\'base_amount/gross_salary\',]\n
-    #\'src__\' : 1\n
-  }\n
-\n
-return portal_simulation.getInventoryAssetPrice(**params)\n
-</string> </value>
-        </item>
-        <item>
-            <key> <string>_code</string> </key>
-            <value>
-              <none/>
-            </value>
-        </item>
-        <item>
-            <key> <string>_params</string> </key>
-            <value> <string>paysheet=None</string> </value>
-        </item>
-        <item>
-            <key> <string>errors</string> </key>
-            <value>
-              <tuple/>
-            </value>
-        </item>
-        <item>
-            <key> <string>func_code</string> </key>
-            <value>
-              <object>
-                <klass>
-                  <global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
-                </klass>
-                <tuple/>
-                <state>
-                  <dictionary>
-                    <item>
-                        <key> <string>co_argcount</string> </key>
-                        <value> <int>1</int> </value>
-                    </item>
-                    <item>
-                        <key> <string>co_varnames</string> </key>
-                        <value>
-                          <tuple>
-                            <string>paysheet</string>
-                            <string>None</string>
-                            <string>context</string>
-                            <string>_getattr_</string>
-                            <string>portal</string>
-                            <string>portal_simulation</string>
-                            <string>DateTime</string>
-                            <string>params</string>
-                            <string>_apply_</string>
-                          </tuple>
-                        </value>
-                    </item>
-                  </dictionary>
-                </state>
-              </object>
-            </value>
-        </item>
-        <item>
-            <key> <string>func_defaults</string> </key>
-            <value>
-              <tuple>
-                <none/>
-              </tuple>
-            </value>
-        </item>
-        <item>
-            <key> <string>id</string> </key>
-            <value> <string>PaySheetTransaction_getYearToDateGrossSalary</string> </value>
-        </item>
-        <item>
-            <key> <string>warnings</string> </key>
-            <value>
-              <tuple/>
-            </value>
-        </item>
-      </dictionary>
-    </pickle>
-  </record>
-</ZopeData>
diff --git a/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_getYearToDateNetPay.xml b/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_getYearToDateNetPay.xml
deleted file mode 100644
index 8719d3eafd..0000000000
--- a/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_getYearToDateNetPay.xml
+++ /dev/null
@@ -1,159 +0,0 @@
-<?xml version="1.0"?>
-<ZopeData>
-  <record id="1" aka="AAAAAAAAAAE=">
-    <pickle>
-      <tuple>
-        <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
-        <tuple/>
-      </tuple>
-    </pickle>
-    <pickle>
-      <dictionary>
-        <item>
-            <key> <string>Script_magic</string> </key>
-            <value> <int>3</int> </value>
-        </item>
-        <item>
-            <key> <string>_bind_names</string> </key>
-            <value>
-              <object>
-                <klass>
-                  <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
-                </klass>
-                <tuple/>
-                <state>
-                  <dictionary>
-                    <item>
-                        <key> <string>_asgns</string> </key>
-                        <value>
-                          <dictionary>
-                            <item>
-                                <key> <string>name_container</string> </key>
-                                <value> <string>container</string> </value>
-                            </item>
-                            <item>
-                                <key> <string>name_context</string> </key>
-                                <value> <string>context</string> </value>
-                            </item>
-                            <item>
-                                <key> <string>name_m_self</string> </key>
-                                <value> <string>script</string> </value>
-                            </item>
-                            <item>
-                                <key> <string>name_subpath</string> </key>
-                                <value> <string>traverse_subpath</string> </value>
-                            </item>
-                          </dictionary>
-                        </value>
-                    </item>
-                  </dictionary>
-                </state>
-              </object>
-            </value>
-        </item>
-        <item>
-            <key> <string>_body</string> </key>
-            <value> <string>if paysheet is None:\n
-  paysheet = context\n
-\n
-portal = context.getPortalObject();\n
-portal_simulation = portal.portal_simulation\n
-\n
-params = {\n
-    \'section_uid\' : paysheet.getDestinationSectionUid(),\n
-    \'node_uid\' : paysheet.getSourceSectionUid(),\n
-    \'tax_category_uid\' :\\\n
-        portal.portal_categories.tax_category.employee_share.getUid(),\n
-    \'to_date\' : paysheet.getStartDate(),\n
-    \'from_date\' : DateTime(paysheet.getStartDate().year(), 1, 1),\n
-    \'simulation_state\'    : [\'confirmed\', \'stopped\', \'delivered\'],\n
-    \'precision\' : paysheet.getPriceCurrencyValue().getQuantityPrecision(),\n
-    \'resource_category\' : [\'base_amount/deductible_tax\', \n
-    \'base_amount/non_deductible_tax\'],\n
-  }\n
-\n
-deductible_tax = portal_simulation.getInventoryAssetPrice(**params)\n
-over_time = paysheet.PaySheetTransaction_getYearToDateOvertimeAmount()\n
-gross_salary = paysheet.PaySheetTransaction_getYearToDateGrossSalary() \n
-net_pay = gross_salary - over_time - deductible_tax\n
-\n
-return net_pay\n
-</string> </value>
-        </item>
-        <item>
-            <key> <string>_code</string> </key>
-            <value>
-              <none/>
-            </value>
-        </item>
-        <item>
-            <key> <string>_params</string> </key>
-            <value> <string>paysheet=None</string> </value>
-        </item>
-        <item>
-            <key> <string>errors</string> </key>
-            <value>
-              <tuple/>
-            </value>
-        </item>
-        <item>
-            <key> <string>func_code</string> </key>
-            <value>
-              <object>
-                <klass>
-                  <global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
-                </klass>
-                <tuple/>
-                <state>
-                  <dictionary>
-                    <item>
-                        <key> <string>co_argcount</string> </key>
-                        <value> <int>1</int> </value>
-                    </item>
-                    <item>
-                        <key> <string>co_varnames</string> </key>
-                        <value>
-                          <tuple>
-                            <string>paysheet</string>
-                            <string>None</string>
-                            <string>context</string>
-                            <string>_getattr_</string>
-                            <string>portal</string>
-                            <string>portal_simulation</string>
-                            <string>DateTime</string>
-                            <string>params</string>
-                            <string>_apply_</string>
-                            <string>deductible_tax</string>
-                            <string>over_time</string>
-                            <string>gross_salary</string>
-                            <string>net_pay</string>
-                          </tuple>
-                        </value>
-                    </item>
-                  </dictionary>
-                </state>
-              </object>
-            </value>
-        </item>
-        <item>
-            <key> <string>func_defaults</string> </key>
-            <value>
-              <tuple>
-                <none/>
-              </tuple>
-            </value>
-        </item>
-        <item>
-            <key> <string>id</string> </key>
-            <value> <string>PaySheetTransaction_getYearToDateNetPay</string> </value>
-        </item>
-        <item>
-            <key> <string>warnings</string> </key>
-            <value>
-              <tuple/>
-            </value>
-        </item>
-      </dictionary>
-    </pickle>
-  </record>
-</ZopeData>
diff --git a/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_getYearToDateTaxableNetPay.xml b/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_getYearToDateTaxableNetPay.xml
deleted file mode 100644
index 6c82707ca0..0000000000
--- a/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_getYearToDateTaxableNetPay.xml
+++ /dev/null
@@ -1,161 +0,0 @@
-<?xml version="1.0"?>
-<ZopeData>
-  <record id="1" aka="AAAAAAAAAAE=">
-    <pickle>
-      <tuple>
-        <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
-        <tuple/>
-      </tuple>
-    </pickle>
-    <pickle>
-      <dictionary>
-        <item>
-            <key> <string>Script_magic</string> </key>
-            <value> <int>3</int> </value>
-        </item>
-        <item>
-            <key> <string>_bind_names</string> </key>
-            <value>
-              <object>
-                <klass>
-                  <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
-                </klass>
-                <tuple/>
-                <state>
-                  <dictionary>
-                    <item>
-                        <key> <string>_asgns</string> </key>
-                        <value>
-                          <dictionary>
-                            <item>
-                                <key> <string>name_container</string> </key>
-                                <value> <string>container</string> </value>
-                            </item>
-                            <item>
-                                <key> <string>name_context</string> </key>
-                                <value> <string>context</string> </value>
-                            </item>
-                            <item>
-                                <key> <string>name_m_self</string> </key>
-                                <value> <string>script</string> </value>
-                            </item>
-                            <item>
-                                <key> <string>name_subpath</string> </key>
-                                <value> <string>traverse_subpath</string> </value>
-                            </item>
-                          </dictionary>
-                        </value>
-                    </item>
-                  </dictionary>
-                </state>
-              </object>
-            </value>
-        </item>
-        <item>
-            <key> <string>_body</string> </key>
-            <value> <string>if paysheet is None:\n
-  paysheet = context\n
-\n
-portal = context.getPortalObject();\n
-portal_simulation = portal.portal_simulation\n
-\n
-params = {\n
-    \'section_uid\' : paysheet.getDestinationSectionUid(),\n
-    \'node_uid\' : paysheet.getSourceSectionUid(),\n
-    \'tax_category_uid\' :\\\n
-        portal.portal_categories.tax_category.employee_share.getUid(),\n
-    \'to_date\' : paysheet.getStartDate(),\n
-    \'from_date\' : DateTime(paysheet.getStartDate().year(), 1, 1),\n
-    \'simulation_state\'    : [\'confirmed\', \'stopped\', \'delivered\'],\n
-    \'precision\' : paysheet.getPriceCurrencyValue().getQuantityPrecision(),\n
-    \'resource_category\' : [\'base_amount/deductible_tax\', ],\n
-  }\n
-\n
-\n
-\n
-deductible_tax = portal_simulation.getInventoryAssetPrice(**params)\n
-over_time = paysheet.PaySheetTransaction_getYearToDateOvertimeAmount()\n
-gross_salary = paysheet.PaySheetTransaction_getYearToDateGrossSalary()\n
-\n
-taxable_net_pay = gross_salary - over_time - deductible_tax\n
-\n
-return taxable_net_pay\n
-</string> </value>
-        </item>
-        <item>
-            <key> <string>_code</string> </key>
-            <value>
-              <none/>
-            </value>
-        </item>
-        <item>
-            <key> <string>_params</string> </key>
-            <value> <string>paysheet=None</string> </value>
-        </item>
-        <item>
-            <key> <string>errors</string> </key>
-            <value>
-              <tuple/>
-            </value>
-        </item>
-        <item>
-            <key> <string>func_code</string> </key>
-            <value>
-              <object>
-                <klass>
-                  <global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
-                </klass>
-                <tuple/>
-                <state>
-                  <dictionary>
-                    <item>
-                        <key> <string>co_argcount</string> </key>
-                        <value> <int>1</int> </value>
-                    </item>
-                    <item>
-                        <key> <string>co_varnames</string> </key>
-                        <value>
-                          <tuple>
-                            <string>paysheet</string>
-                            <string>None</string>
-                            <string>context</string>
-                            <string>_getattr_</string>
-                            <string>portal</string>
-                            <string>portal_simulation</string>
-                            <string>DateTime</string>
-                            <string>params</string>
-                            <string>_apply_</string>
-                            <string>deductible_tax</string>
-                            <string>over_time</string>
-                            <string>gross_salary</string>
-                            <string>taxable_net_pay</string>
-                          </tuple>
-                        </value>
-                    </item>
-                  </dictionary>
-                </state>
-              </object>
-            </value>
-        </item>
-        <item>
-            <key> <string>func_defaults</string> </key>
-            <value>
-              <tuple>
-                <none/>
-              </tuple>
-            </value>
-        </item>
-        <item>
-            <key> <string>id</string> </key>
-            <value> <string>PaySheetTransaction_getYearToDateTaxableNetPay</string> </value>
-        </item>
-        <item>
-            <key> <string>warnings</string> </key>
-            <value>
-              <tuple/>
-            </value>
-        </item>
-      </dictionary>
-    </pickle>
-  </record>
-</ZopeData>
diff --git a/bt5/erp5_payroll/bt/change_log b/bt5/erp5_payroll/bt/change_log
index 44f9d6af7a..c3ab85b0e4 100644
--- a/bt5/erp5_payroll/bt/change_log
+++ b/bt5/erp5_payroll/bt/change_log
@@ -1,3 +1,6 @@
+2009-01-28 fabien
+* remove some unused script and refeactor some very similar scripts in a generic one
+
 2009-01-21 fabien
 * remove unused field base_amount_list
 * change error messages in PaySheetTransaction_checkParameters to be consistant with other translations
diff --git a/bt5/erp5_payroll/bt/revision b/bt5/erp5_payroll/bt/revision
index 832f62a3cb..f64b48379f 100644
--- a/bt5/erp5_payroll/bt/revision
+++ b/bt5/erp5_payroll/bt/revision
@@ -1 +1 @@
-339
\ No newline at end of file
+343
\ No newline at end of file
-- 
2.30.9