From dc90ca2d4a7c2f931ea3133ac3cfb7c4c331fff7 Mon Sep 17 00:00:00 2001
From: Nicolas Dumazet <nicolas.dumazet@nexedi.com>
Date: Fri, 19 Mar 2010 09:00:24 +0000
Subject: [PATCH] fix Transformation_viewGlobalReport:

* it is incorrect to pass a Transformation object as an argument to
   getAggregatedAmountList, as it is not an Amount.
* hacking the REQUEST to pass it to asContext just to set variation_category on
   the new temp Document was quite nasty


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@33902 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../Transformation_getAggregatedAmountList.xml     | 14 ++++++++------
 bt5/erp5_pdm/bt/revision                           |  2 +-
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Transformation_getAggregatedAmountList.xml b/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Transformation_getAggregatedAmountList.xml
index 66d370fbfd..7f55852823 100644
--- a/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Transformation_getAggregatedAmountList.xml
+++ b/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/Transformation_getAggregatedAmountList.xml
@@ -53,9 +53,11 @@
         </item>
         <item>
             <key> <string>_body</string> </key>
-            <value> <string>request = context.REQUEST\n
-request.other[\'categories\'] = reference_variation_category_list\n
-tmp_context = context.asContext(context=context, REQUEST=request)\n
+            <value> <string>from Products.ERP5Type.Document import newTempAmount\n
+tmp_context = newTempAmount(context, "temp_context",\n
+                            quantity=1.0,\n
+                            variation_category_list=reference_variation_category_list,\n
+                            resource=context.getRelativeUrl()) \n
 price_currency = kw.get(\'price_currency\', None)\n
 \n
 result = context.getAggregatedAmountList(tmp_context)\n
@@ -107,10 +109,10 @@ return result\n
                           <tuple>
                             <string>reference_variation_category_list</string>
                             <string>kw</string>
-                            <string>_getattr_</string>
+                            <string>Products.ERP5Type.Document</string>
+                            <string>newTempAmount</string>
                             <string>context</string>
-                            <string>request</string>
-                            <string>_write_</string>
+                            <string>_getattr_</string>
                             <string>tmp_context</string>
                             <string>None</string>
                             <string>price_currency</string>
diff --git a/bt5/erp5_pdm/bt/revision b/bt5/erp5_pdm/bt/revision
index 6efca19ea0..9f8ebf73f9 100644
--- a/bt5/erp5_pdm/bt/revision
+++ b/bt5/erp5_pdm/bt/revision
@@ -1 +1 @@
-481
\ No newline at end of file
+482
\ No newline at end of file
-- 
2.30.9