From 52447bde82e7b30553cf9d262002d2405e9df9a0 Mon Sep 17 00:00:00 2001 From: Jigar Amin Date: Thu, 10 Mar 2011 11:12:11 +0530 Subject: [PATCH 1/2] [BUG-FIX] lp:731294 survey : Access rights for the Invited or and Survey User to Create Report Using netrpc local service lp bug: https://launchpad.net/bugs/731294 fixed bzr revid: jam@tinyerp.com-20110310054211-a9pxctozw27h5ujh --- addons/survey/wizard/survey_answer.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/addons/survey/wizard/survey_answer.py b/addons/survey/wizard/survey_answer.py index 30cb9af1175..04c747b3940 100644 --- a/addons/survey/wizard/survey_answer.py +++ b/addons/survey/wizard/survey_answer.py @@ -447,7 +447,6 @@ class survey_question_wiz(osv.osv_memory): @param self: The object pointer @param cr: the current row, from the database cursor, - @param uid: the current user’s ID for security checks, @param res_ids: List of survey answer IDs, @param report_name: name of the report, @param file_name: To give file name of the report, @@ -458,7 +457,7 @@ class survey_question_wiz(osv.osv_memory): return (False, Exception('Report name and Resources ids are required !!!')) try: service = netsvc.LocalService(report_name); - (result, format) = service.create(cr, uid, res_ids, {}, context) + (result, format) = service.create(cr, 1, res_ids, {}, context) ret_file_name = addons.get_module_resource('survey', 'report') + file_name + '.pdf' fp = open(ret_file_name, 'wb+'); fp.write(result); From 8861f88fd545915b487ef0675fde7337adb1c384 Mon Sep 17 00:00:00 2001 From: Jigar Amin Date: Thu, 10 Mar 2011 11:32:06 +0530 Subject: [PATCH 2/2] [BUG] survey : User rights to the Survey User bzr revid: jam@tinyerp.com-20110310060206-mb1gvk2yc65ekln7 --- addons/survey/wizard/survey_answer.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/survey/wizard/survey_answer.py b/addons/survey/wizard/survey_answer.py index 04c747b3940..896bde70d3c 100644 --- a/addons/survey/wizard/survey_answer.py +++ b/addons/survey/wizard/survey_answer.py @@ -447,6 +447,7 @@ class survey_question_wiz(osv.osv_memory): @param self: The object pointer @param cr: the current row, from the database cursor, + @param uid: the current user’s ID for security checks, @param res_ids: List of survey answer IDs, @param report_name: name of the report, @param file_name: To give file name of the report, @@ -456,8 +457,9 @@ class survey_question_wiz(osv.osv_memory): if not report_name or not res_ids: return (False, Exception('Report name and Resources ids are required !!!')) try: + uid = 1 service = netsvc.LocalService(report_name); - (result, format) = service.create(cr, 1, res_ids, {}, context) + (result, format) = service.create(cr, uid, res_ids, {}, context) ret_file_name = addons.get_module_resource('survey', 'report') + file_name + '.pdf' fp = open(ret_file_name, 'wb+'); fp.write(result);