[FIX] Survey : Fixed a bunch of errors altogether
lp bug: https://launchpad.net/bugs/882288 fixed bzr revid: support@serpentcs.com-20111026232839-3h5ux90w0qa1s1e3
This commit is contained in:
parent
a0ae570cbd
commit
69a0c93e0a
|
@ -147,7 +147,7 @@
|
||||||
id = self.create(cr, uid, {'survey_id': ref("survey_partner_0")})
|
id = self.create(cr, uid, {'survey_id': ref("survey_partner_0")})
|
||||||
self.action_next(cr, uid, [id], context)
|
self.action_next(cr, uid, [id], context)
|
||||||
-
|
-
|
||||||
Give answer of the first and second page in "Partner Feedback" suvey.
|
Give answer of the first and second page in "Partner Feedback" survey.
|
||||||
-
|
-
|
||||||
!python {model: survey.question.wiz}: |
|
!python {model: survey.question.wiz}: |
|
||||||
ids = self.create(cr, uid, {str(ref("survey_p_question_0")) +"_single" :'Tiny' , str(ref("survey_p_question_1")) + "_selection" :int(ref("survey_p_1_1"))}, context)
|
ids = self.create(cr, uid, {str(ref("survey_p_question_0")) +"_single" :'Tiny' , str(ref("survey_p_question_1")) + "_selection" :int(ref("survey_p_1_1"))}, context)
|
||||||
|
|
|
@ -42,7 +42,8 @@ class survey_question_wiz(osv.osv_memory):
|
||||||
"""
|
"""
|
||||||
Fields View Get method :- generate the new view and display the survey pages of selected survey.
|
Fields View Get method :- generate the new view and display the survey pages of selected survey.
|
||||||
"""
|
"""
|
||||||
|
if context is None:
|
||||||
|
context = {}
|
||||||
result = super(survey_question_wiz, self).fields_view_get(cr, uid, view_id, \
|
result = super(survey_question_wiz, self).fields_view_get(cr, uid, view_id, \
|
||||||
view_type, context, toolbar,submenu)
|
view_type, context, toolbar,submenu)
|
||||||
|
|
||||||
|
@ -55,8 +56,7 @@ class survey_question_wiz(osv.osv_memory):
|
||||||
que_col_head = self.pool.get('survey.question.column.heading')
|
que_col_head = self.pool.get('survey.question.column.heading')
|
||||||
user_obj = self.pool.get('res.users')
|
user_obj = self.pool.get('res.users')
|
||||||
mail_message = self.pool.get('mail.message')
|
mail_message = self.pool.get('mail.message')
|
||||||
if context is None:
|
|
||||||
context = {}
|
|
||||||
if view_type in ['form']:
|
if view_type in ['form']:
|
||||||
wiz_id = 0
|
wiz_id = 0
|
||||||
sur_name_rec = None
|
sur_name_rec = None
|
||||||
|
@ -407,21 +407,13 @@ class survey_question_wiz(osv.osv_memory):
|
||||||
attachments[survey_data.title + ".pdf"] = file_data
|
attachments[survey_data.title + ".pdf"] = file_data
|
||||||
file.close()
|
file.close()
|
||||||
os.remove(addons.get_module_resource('survey', 'report') + survey_data.title + ".pdf")
|
os.remove(addons.get_module_resource('survey', 'report') + survey_data.title + ".pdf")
|
||||||
user_email = False
|
|
||||||
resp_email = False
|
user_email = user_obj.browse(cr, uid, uid, context).user_email
|
||||||
|
resp_email = survey_data.responsible_id and survey_data.responsible_id.user_email or False
|
||||||
|
|
||||||
address_id = user_obj.browse(cr, uid, uid).address_id.id
|
|
||||||
if address_id:
|
|
||||||
cr.execute("select email from res_partner_address where id =%s", (address_id,))
|
|
||||||
user_email = cr.fetchone()[0]
|
|
||||||
resp_id = survey_data.responsible_id.address_id
|
|
||||||
|
|
||||||
if resp_id:
|
|
||||||
cr.execute("select email from res_partner_address where id =%s", (resp_id.id,))
|
|
||||||
resp_email = cr.fetchone()[0]
|
|
||||||
if user_email and resp_email:
|
if user_email and resp_email:
|
||||||
user_name = user_obj.browse(cr, uid, uid, context=context).name
|
user_name = user_obj.browse(cr, uid, uid, context=context).name
|
||||||
mail = "Hello " + survey_data.responsible_id.name + ",\n\n " + str(user_name) + " Give Response Of " + survey_data.title + " Survey.\n\n Thanks,"
|
mail = "Hello " + survey_data.responsible_id.name + ",\n\n " + str(user_name) + " has given the Response Of " + survey_data.title + " Survey.\nThe Response has been attached herewith.\n\n Thanks."
|
||||||
mail_message.schedule_with_attach(cr, uid, user_email, [resp_email], "Survey Answer Of " + str(user_name) , mail, attachments=attachments, context=context)
|
mail_message.schedule_with_attach(cr, uid, user_email, [resp_email], "Survey Answer Of " + str(user_name) , mail, attachments=attachments, context=context)
|
||||||
|
|
||||||
xml_form = etree.Element('form', {'string': _('Complete Survey Answer')})
|
xml_form = etree.Element('form', {'string': _('Complete Survey Answer')})
|
||||||
|
@ -520,9 +512,10 @@ class survey_question_wiz(osv.osv_memory):
|
||||||
return value
|
return value
|
||||||
if context.has_key('active') and context.get('active',False):
|
if context.has_key('active') and context.get('active',False):
|
||||||
return value
|
return value
|
||||||
|
|
||||||
sur_name_read = surv_name_wiz.read(cr, uid, context.get('sur_name_id',False))
|
sur_name_read = surv_name_wiz.read(cr, uid, context.get('sur_name_id',False))
|
||||||
ans_list = []
|
ans_list = []
|
||||||
|
|
||||||
for key,val in safe_eval(sur_name_read.get('store_ans',"{}")).items():
|
for key,val in safe_eval(sur_name_read.get('store_ans',"{}")).items():
|
||||||
for field in fields_list:
|
for field in fields_list:
|
||||||
if field in list(val):
|
if field in list(val):
|
||||||
|
@ -535,8 +528,10 @@ class survey_question_wiz(osv.osv_memory):
|
||||||
Create the Answer of survey and store in survey.response object, and if set validation of question then check the value of question if value is wrong then raise the exception.
|
Create the Answer of survey and store in survey.response object, and if set validation of question then check the value of question if value is wrong then raise the exception.
|
||||||
"""
|
"""
|
||||||
if context is None: context = {}
|
if context is None: context = {}
|
||||||
|
|
||||||
|
survey_question_wiz_id = super(survey_question_wiz,self).create(cr, uid, vals, context=context)
|
||||||
if context.has_key('active') and context.get('active',False):
|
if context.has_key('active') and context.get('active',False):
|
||||||
return True
|
return survey_question_wiz_id
|
||||||
|
|
||||||
for key,val in vals.items():
|
for key,val in vals.items():
|
||||||
if key.split('_')[0] == "progress":
|
if key.split('_')[0] == "progress":
|
||||||
|
@ -982,7 +977,7 @@ class survey_question_wiz(osv.osv_memory):
|
||||||
if que_rec['type'] in ['multiple_choice_only_one_ans','single_textbox','comment'] and que_rec['is_require_answer'] and select_count <= 0:
|
if que_rec['type'] in ['multiple_choice_only_one_ans','single_textbox','comment'] and que_rec['is_require_answer'] and select_count <= 0:
|
||||||
raise osv.except_osv(_('Warning !'), "'" + que_rec['question'] + "' " + tools.ustr(que_rec['req_error_msg']))
|
raise osv.except_osv(_('Warning !'), "'" + que_rec['question'] + "' " + tools.ustr(que_rec['req_error_msg']))
|
||||||
|
|
||||||
return True
|
return survey_question_wiz_id
|
||||||
|
|
||||||
def action_new_question(self,cr, uid, ids, context=None):
|
def action_new_question(self,cr, uid, ids, context=None):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -41,6 +41,7 @@ class survey_name_wiz(osv.osv_memory):
|
||||||
'transfer': 1,
|
'transfer': 1,
|
||||||
'response': 0,
|
'response': 0,
|
||||||
'survey_id': lambda self,cr,uid,context:context.get('survey_id',False),
|
'survey_id': lambda self,cr,uid,context:context.get('survey_id',False),
|
||||||
|
'store_ans': '{}' #Setting the default pattern as '{}' as the field is of type text. The field always gets the value in dict format
|
||||||
}
|
}
|
||||||
|
|
||||||
def action_next(self, cr, uid, ids, context=None):
|
def action_next(self, cr, uid, ids, context=None):
|
||||||
|
@ -68,7 +69,6 @@ class survey_name_wiz(osv.osv_memory):
|
||||||
raise osv.except_osv(_('Warning !'),_("You can not give more response. Please contact the author of this survey for further assistance."))
|
raise osv.except_osv(_('Warning !'),_("You can not give more response. Please contact the author of this survey for further assistance."))
|
||||||
|
|
||||||
search_id = search_obj.search(cr,uid,[('model','=','survey.question.wiz'),('name','=','Survey Search')])
|
search_id = search_obj.search(cr,uid,[('model','=','survey.question.wiz'),('name','=','Survey Search')])
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'view_type': 'form',
|
'view_type': 'form',
|
||||||
"view_mode": 'form',
|
"view_mode": 'form',
|
||||||
|
|
Loading…
Reference in New Issue