From 6af654f7bf5ebb32788f8ec583d358b74a77bcd5 Mon Sep 17 00:00:00 2001 From: "aag (OpenERP)" Date: Fri, 4 Feb 2011 13:13:05 +0530 Subject: [PATCH] [IMP] survey: Add context and chech for Read method is working bzr revid: aag@tinyerp.co.in-20110204074305-tscrng9ju5sha0zv --- addons/survey/wizard/survey_browse_answer.py | 3 ++- addons/survey/wizard/survey_print.py | 4 ++-- addons/survey/wizard/survey_print_answer.py | 2 +- addons/survey/wizard/survey_print_statistics.py | 2 +- addons/survey/wizard/survey_selection.py | 4 ++-- addons/survey/wizard/survey_send_invitation.py | 2 +- 6 files changed, 9 insertions(+), 8 deletions(-) diff --git a/addons/survey/wizard/survey_browse_answer.py b/addons/survey/wizard/survey_browse_answer.py index 52664eb48cc..7b73c180cac 100644 --- a/addons/survey/wizard/survey_browse_answer.py +++ b/addons/survey/wizard/survey_browse_answer.py @@ -61,9 +61,10 @@ class survey_browse_answer(osv.osv_memory): @return : Dictionary value for Open the browse answer wizard. """ if context is None: context = {} - record = self.read(cr, uid, ids, []) + record = self.read(cr, uid, ids, [],context=context) record = record and record[0] or {} if record['response_id']: + record['response_id'] = record['response_id'][0] res_id = [(record['response_id'])] else: sur_response_obj = self.pool.get('survey.response') diff --git a/addons/survey/wizard/survey_print.py b/addons/survey/wizard/survey_print.py index ed6479885dc..ddaec0a4600 100644 --- a/addons/survey/wizard/survey_print.py +++ b/addons/survey/wizard/survey_print.py @@ -56,9 +56,9 @@ class survey_print(osv.osv_memory): @return : Dictionary value for print survey form. """ - datas = {'ids' : self.read(cr, uid, ids, [], context)[0]['survey_ids']} + datas = {'ids' : self.read(cr, uid, ids, [], context=context)[0]['survey_ids']} res = self.read(cr, uid, ids, ['survey_title', 'orientation', 'paper_size',\ - 'page_number', 'without_pagebreak'], context) + 'page_number', 'without_pagebreak'], context=context) res = res and res[0] or {} datas['form'] = res datas['model'] = 'survey.print' diff --git a/addons/survey/wizard/survey_print_answer.py b/addons/survey/wizard/survey_print_answer.py index 8375868e9db..02db236d233 100644 --- a/addons/survey/wizard/survey_print_answer.py +++ b/addons/survey/wizard/survey_print_answer.py @@ -59,7 +59,7 @@ class survey_print_answer(osv.osv_memory): context = {} datas = {'ids': context.get('active_ids', [])} res = self.read(cr, uid, ids, ['response_ids', 'orientation', 'paper_size',\ - 'page_number', 'without_pagebreak'], context) + 'page_number', 'without_pagebreak'], context=context) res = res and res[0] or {} datas['form'] = res datas['model'] = 'survey.print.answer' diff --git a/addons/survey/wizard/survey_print_statistics.py b/addons/survey/wizard/survey_print_statistics.py index 9c10d138e0e..10b321fcf45 100644 --- a/addons/survey/wizard/survey_print_statistics.py +++ b/addons/survey/wizard/survey_print_statistics.py @@ -44,7 +44,7 @@ class survey_print_statistics(osv.osv_memory): if context is None: context = {} datas = {'ids': context.get('active_ids', [])} - res = self.read(cr, uid, ids, ['survey_ids'], context) + res = self.read(cr, uid, ids, ['survey_ids'], context=context) res = res and res[0] or {} datas['form'] = res datas['model'] = 'survey.print.statistics' diff --git a/addons/survey/wizard/survey_selection.py b/addons/survey/wizard/survey_selection.py index 04b829077f3..4d246c2b0c3 100644 --- a/addons/survey/wizard/survey_selection.py +++ b/addons/survey/wizard/survey_selection.py @@ -122,7 +122,7 @@ class survey_name_wiz(osv.osv_memory): search_obj = self.pool.get('ir.ui.view') if context is None: context = {} - sur_id = self.read(cr, uid, ids, [])[0] + sur_id = self.read(cr, uid, ids, [], context=context)[0] survey_id = sur_id['survey_id'] context.update({'survey_id': survey_id, 'sur_name_id': sur_id['id']}) cr.execute('select count(id) from survey_history where user_id=%s\ @@ -133,7 +133,7 @@ class survey_name_wiz(osv.osv_memory): if user_limit and res >= user_limit: raise osv.except_osv(_('Warning !'),_("You can not give response for this survey more than %s times") % (user_limit)) - sur_rec = survey_obj.read(cr,uid,self.read(cr,uid,ids)[0]['survey_id']) + sur_rec = survey_obj.read(cr,uid,self.read(cr,uid,ids, context=context)[0]['survey_id']) if sur_rec['max_response_limit'] and sur_rec['max_response_limit'] <= sur_rec['tot_start_survey']: raise osv.except_osv(_('Warning !'),_("You can not give more response. Please contact the author of this survey for further assistance.")) diff --git a/addons/survey/wizard/survey_send_invitation.py b/addons/survey/wizard/survey_send_invitation.py index 361f7388f6f..f091653c499 100644 --- a/addons/survey/wizard/survey_send_invitation.py +++ b/addons/survey/wizard/survey_send_invitation.py @@ -97,7 +97,7 @@ class survey_send_invitation(osv.osv_memory): if context is None: context = {} record = self.read(cr, uid, ids, []) - survey_ids = context.get('active_ids', []) + survey_ids = context.get('active_ids', [], context=context) record = record and record[0] partner_ids = record['partner_ids'] user_ref= self.pool.get('res.users')