From 8d1f6a7acef6b7976ac5b82a7994426ad3965162 Mon Sep 17 00:00:00 2001
From: Fabien Morin <fabien@nexedi.com>
Date: Thu, 14 Feb 2008 17:05:46 +0000
Subject: [PATCH] use portal instead contex to access portal_categories, this
 avoid aquisition problems (thanks to Jerome).

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@19318 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../erp5_payroll/PaySheetTransaction_getMovementList.xml    | 5 +++--
 .../PaySheetTransaction_getYearToDateBaseSalary.xml         | 6 ++++--
 .../PaySheetTransaction_getYearToDateGrossSalary.xml        | 6 ++++--
 .../PaySheetTransaction_getYearToDateNetPay.xml             | 6 ++++--
 .../PaySheetTransaction_getYearToDateOvertimeAmount.xml     | 6 ++++--
 .../PaySheetTransaction_getYearToDateTaxableNetPay.xml      | 6 ++++--
 bt5/erp5_payroll/bt/revision                                | 2 +-
 7 files changed, 24 insertions(+), 13 deletions(-)

diff --git a/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_getMovementList.xml b/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_getMovementList.xml
index 60b7ad5d31..1e43899b99 100644
--- a/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_getMovementList.xml
+++ b/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_getMovementList.xml
@@ -78,7 +78,7 @@ import pprint\n
 from Products.ERP5Type.Message import Message\n
 N_ = lambda msg, **kw: Message(\'erp5_ui\', msg, **kw)\n
 \n
-\n
+portal = context.getPortalObject();\n
 paysheet_line_list = context.contentValues(portal_type=\'Pay Sheet Line\')\n
 if context.getPriceCurrencyValue():\n
   precision = context.getPriceCurrencyValue().getQuantityPrecision()\n
@@ -131,7 +131,7 @@ for paysheet_line in paysheet_line_list:\n
     for item in tuple:\n
       # the dict key is the base category and value is the category path\n
       tuple_dict[item.split(\'/\')[0]] = \\\n
-          context.portal_categories.restrictedTraverse(item).getTitle()\n
+          portal.portal_categories.restrictedTraverse(item).getTitle()\n
       tuple_dict[item.split(\'/\')[0]+\'_relative_url\']=item\n
 \n
     # we want to display as lines as a paysheet line as slices\n
@@ -250,6 +250,7 @@ return line_list\n
                             <string>N_</string>
                             <string>_getattr_</string>
                             <string>context</string>
+                            <string>portal</string>
                             <string>paysheet_line_list</string>
                             <string>precision</string>
                             <string>line_list</string>
diff --git a/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_getYearToDateBaseSalary.xml b/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_getYearToDateBaseSalary.xml
index c67ff96e19..f6d96d94b0 100644
--- a/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_getYearToDateBaseSalary.xml
+++ b/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_getYearToDateBaseSalary.xml
@@ -68,14 +68,15 @@
             <value> <string>if paysheet is None:\n
     paysheet = context\n
 \n
-portal_simulation = paysheet.getPortalObject().portal_simulation\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
-        paysheet.portal_categories.tax_category.employee_share.getUid(),\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
@@ -131,6 +132,7 @@ return portal_simulation.getInventoryAssetPrice(**params)\n
                             <string>None</string>
                             <string>context</string>
                             <string>_getattr_</string>
+                            <string>portal</string>
                             <string>portal_simulation</string>
                             <string>DateTime</string>
                             <string>params</string>
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
index 60ea64ab61..024d20d214 100644
--- a/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_getYearToDateGrossSalary.xml
+++ b/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_getYearToDateGrossSalary.xml
@@ -68,14 +68,15 @@
             <value> <string>if paysheet is None:\n
     paysheet = context\n
 \n
-portal_simulation = paysheet.getPortalObject().portal_simulation\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
-        paysheet.portal_categories.tax_category.employee_share.getUid(),\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
@@ -131,6 +132,7 @@ return portal_simulation.getInventoryAssetPrice(**params)\n
                             <string>None</string>
                             <string>context</string>
                             <string>_getattr_</string>
+                            <string>portal</string>
                             <string>portal_simulation</string>
                             <string>DateTime</string>
                             <string>params</string>
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
index 9dee2b3300..aef184d757 100644
--- a/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_getYearToDateNetPay.xml
+++ b/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_getYearToDateNetPay.xml
@@ -68,13 +68,14 @@
             <value> <string>if paysheet is None:\n
   paysheet = context\n
 \n
-portal_simulation = paysheet.getPortalObject().portal_simulation\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
-        paysheet.portal_categories.tax_category.employee_share.getUid(),\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
@@ -135,6 +136,7 @@ return net_pay\n
                             <string>None</string>
                             <string>context</string>
                             <string>_getattr_</string>
+                            <string>portal</string>
                             <string>portal_simulation</string>
                             <string>DateTime</string>
                             <string>params</string>
diff --git a/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_getYearToDateOvertimeAmount.xml b/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_getYearToDateOvertimeAmount.xml
index 61db3b4a90..11c523807e 100644
--- a/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_getYearToDateOvertimeAmount.xml
+++ b/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_getYearToDateOvertimeAmount.xml
@@ -68,14 +68,15 @@
             <value> <string>if paysheet is None:\n
     paysheet = context\n
 \n
-portal_simulation = paysheet.getPortalObject().portal_simulation\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
-        paysheet.portal_categories.tax_category.employee_share.getUid(),\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
@@ -131,6 +132,7 @@ return portal_simulation.getInventoryAssetPrice(**params)\n
                             <string>None</string>
                             <string>context</string>
                             <string>_getattr_</string>
+                            <string>portal</string>
                             <string>portal_simulation</string>
                             <string>DateTime</string>
                             <string>params</string>
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
index 632555b791..a4c696de53 100644
--- a/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_getYearToDateTaxableNetPay.xml
+++ b/bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_getYearToDateTaxableNetPay.xml
@@ -68,13 +68,14 @@
             <value> <string>if paysheet is None:\n
   paysheet = context\n
 \n
-portal_simulation = paysheet.getPortalObject().portal_simulation\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
-        paysheet.portal_categories.tax_category.employee_share.getUid(),\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
@@ -137,6 +138,7 @@ return taxable_net_pay\n
                             <string>None</string>
                             <string>context</string>
                             <string>_getattr_</string>
+                            <string>portal</string>
                             <string>portal_simulation</string>
                             <string>DateTime</string>
                             <string>params</string>
diff --git a/bt5/erp5_payroll/bt/revision b/bt5/erp5_payroll/bt/revision
index e0d1ea1e9a..4c009fb2fb 100644
--- a/bt5/erp5_payroll/bt/revision
+++ b/bt5/erp5_payroll/bt/revision
@@ -1 +1 @@
-205
\ No newline at end of file
+206
\ No newline at end of file
-- 
2.30.9