[IMP] survey: Add context and chech for Read method is working
bzr revid: aag@tinyerp.co.in-20110204074305-tscrng9ju5sha0zv
This commit is contained in:
@@ -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')
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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."))
|
||||
|
||||
|
||||
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user