[IMP] survey :- change string error to warning

bzr revid: ysa@tinyerp.co.in-20100329103033-y32a82qt96g84i60
This commit is contained in:
Ysa (Open ERP) 2010-03-29 16:00:33 +05:30
parent fcd7f7b2bd
commit 926ea1d245
3 changed files with 41 additions and 41 deletions

View File

@ -93,7 +93,7 @@ class survey(osv.osv):
return True
def copy(self, cr, uid, id, default=None,context={}):
raise osv.except_osv(_('Error !'),_('You cannot duplicate the resource!'))
raise osv.except_osv(_('Warning !'),_('You cannot duplicate the resource!'))
survey()
@ -154,7 +154,7 @@ class survey_page(osv.osv):
}
def copy(self, cr, uid, id, default=None, context={}):
raise osv.except_osv(_('Error !'),_('You cannot duplicate the resource!'))
raise osv.except_osv(_('Warning !'),_('You cannot duplicate the resource!'))
survey_page()
@ -318,7 +318,7 @@ class survey_question(osv.osv):
if que_type in ['matrix_of_choices_only_one_ans', 'matrix_of_choices_only_multi_ans',\
'matrix_of_drop_down_menus', 'rating_scale']:
if not col_len:
raise osv.except_osv(_('Error !'),_("You must enter one or more column heading."))
raise osv.except_osv(_('Warning !'),_("You must enter one or more column heading."))
ans_len = len(question['answer_choice_ids'])
if vals.has_key('answer_choice_ids'):
@ -330,7 +330,7 @@ class survey_question(osv.osv):
if que_type not in ['descriptive_text', 'single_textbox', 'comment','table']:
if not ans_len:
raise osv.except_osv(_('Error !'),_("You must enter one or more Answer."))
raise osv.except_osv(_('Warning !'),_("You must enter one or more Answer."))
req_type = ""
if vals.has_key('required_type'):
@ -344,12 +344,12 @@ class survey_question(osv.osv):
if req_type in ['at least', 'at most', 'exactly']:
if vals.has_key('req_ans'):
if not vals['req_ans'] or vals['req_ans'] > ans_len:
raise osv.except_osv(_('Error !'),_("#Required Answer you entered \
raise osv.except_osv(_('Warning !'),_("#Required Answer you entered \
is greater than the number of answer. \
Please use a number that is smaller than %d.") % (ans_len + 1))
else:
if not question['req_ans'] or question['req_ans'] > ans_len:
raise osv.except_osv(_('Error !'),_("#Required Answer you entered is \
raise osv.except_osv(_('Warning !'),_("#Required Answer you entered is \
greater than the number of answer.\
Please use a number that is smaller than %d.") % (ans_len + 1))
@ -359,39 +359,39 @@ class survey_question(osv.osv):
if vals.has_key('minimum_req_ans'):
minimum_ans = vals['minimum_req_ans']
if not vals['minimum_req_ans'] or vals['minimum_req_ans'] > ans_len:
raise osv.except_osv(_('Error !'),_("Minimum Required Answer\
raise osv.except_osv(_('Warning !'),_("Minimum Required Answer\
you entered is greater than the number of answer.\
Please use a number that is smaller than %d.") % (ans_len + 1))
else:
minimum_ans = question['minimum_req_ans']
if not question['minimum_req_ans'] or question['minimum_req_ans'] > ans_len:
raise osv.except_osv(_('Error !'),_("Minimum Required Answer you\
raise osv.except_osv(_('Warning !'),_("Minimum Required Answer you\
entered is greater than the number of answer. \
Please use a number that is smaller than %d.") % (ans_len + 1))
if vals.has_key('maximum_req_ans'):
maximum_ans = vals['maximum_req_ans']
if not vals['maximum_req_ans'] or vals['maximum_req_ans'] > ans_len:
raise osv.except_osv(_('Error !'),_("Maximum Required Answer you \
raise osv.except_osv(_('Warning !'),_("Maximum Required Answer you \
entered for your maximum is greater than the number of answer.\
Please use a number that is smaller than %d.") % (ans_len + 1))
else:
maximum_ans = question['maximum_req_ans']
if not question['maximum_req_ans'] or question['maximum_req_ans'] > ans_len:
raise osv.except_osv(_('Error !'),_("Maximum Required Answer you\
raise osv.except_osv(_('Warning !'),_("Maximum Required Answer you\
entered for your maximum is greater than the number of answer.\
Please use a number that is smaller than %d.") % (ans_len + 1))
if maximum_ans <= minimum_ans:
raise osv.except_osv(_('Error !'),_("Maximum Required Answer is greater \
raise osv.except_osv(_('Warning !'),_("Maximum Required Answer is greater \
than Minimum Required Answer"))
if question['type'] == 'matrix_of_drop_down_menus' and vals.has_key('column_heading_ids'):
for col in vals['column_heading_ids']:
if not col[2] or not col[2].has_key('menu_choice') or not col[2]['menu_choice']:
raise osv.except_osv(_('Error !'),_("You must enter one or more menu choices\
raise osv.except_osv(_('Warning !'),_("You must enter one or more menu choices\
in column heading"))
elif not col[2] or not col[2].has_key('menu_choice') or\
col[2]['menu_choice'].strip() == '':
raise osv.except_osv(_('Error !'),_("You must enter one or more menu \
raise osv.except_osv(_('Warning !'),_("You must enter one or more menu \
choices in column heading (white spaces not allowed)"))
return super(survey_question, self).write(cr, uid, ids, vals, context=context)
@ -401,33 +401,33 @@ class survey_question(osv.osv):
maximum_ans = 0
if vals.has_key('answer_choice_ids') and not len(vals['answer_choice_ids']):
if vals.has_key('type') and vals['type'] not in ['descriptive_text', 'single_textbox', 'comment','table']:
raise osv.except_osv(_('Error !'),_("You must enter one or more answer."))
raise osv.except_osv(_('Warning !'),_("You must enter one or more answer."))
if vals.has_key('column_heading_ids') and not len(vals['column_heading_ids']):
if vals.has_key('type') and vals['type'] in ['matrix_of_choices_only_one_ans', 'matrix_of_choices_only_multi_ans', 'matrix_of_drop_down_menus', 'rating_scale']:
raise osv.except_osv(_('Error !'),_("You must enter one or more column heading."))
raise osv.except_osv(_('Warning !'),_("You must enter one or more column heading."))
if vals['type'] in ['multiple_choice_multiple_ans','matrix_of_choices_only_one_ans', 'matrix_of_choices_only_multi_ans', 'matrix_of_drop_down_menus', 'rating_scale','multiple_textboxes','numerical_textboxes','date','date_and_time']:
if vals.has_key('is_require_answer') and vals.has_key('required_type') and vals['required_type'] in ['at least', 'at most', 'exactly']:
if vals.has_key('answer_choice_ids') and vals['req_ans'] > len(vals['answer_choice_ids']) or not vals['req_ans']:
raise osv.except_osv(_('Error !'),_("#Required Answer you entered is greater than the number of answer. Please use a number that is smaller than %d.") % (len(vals['answer_choice_ids'])+1))
raise osv.except_osv(_('Warning !'),_("#Required Answer you entered is greater than the number of answer. Please use a number that is smaller than %d.") % (len(vals['answer_choice_ids'])+1))
if vals.has_key('is_require_answer') and vals.has_key('required_type') and vals['required_type'] == 'a range':
minimum_ans = vals['minimum_req_ans']
maximum_ans = vals['maximum_req_ans']
if vals.has_key('answer_choice_ids') or vals['minimum_req_ans'] > len(vals['answer_choice_ids']) or not vals['minimum_req_ans']:
raise osv.except_osv(_('Error !'),_("Minimum Required Answer you entered is greater than the number of answer. Please use a number that is smaller than %d.") % (len(vals['answer_choice_ids'])+1))
raise osv.except_osv(_('Warning !'),_("Minimum Required Answer you entered is greater than the number of answer. Please use a number that is smaller than %d.") % (len(vals['answer_choice_ids'])+1))
if vals.has_key('answer_choice_ids') or vals['maximum_req_ans'] > len(vals['answer_choice_ids']) or not vals['maximum_req_ans']:
raise osv.except_osv(_('Error !'),_("Maximum Required Answer you entered for your maximum is greater than the number of answer. Please use a number that is smaller than %d.") % (len(vals['answer_choice_ids'])+1))
raise osv.except_osv(_('Warning !'),_("Maximum Required Answer you entered for your maximum is greater than the number of answer. Please use a number that is smaller than %d.") % (len(vals['answer_choice_ids'])+1))
if maximum_ans <= minimum_ans:
raise osv.except_osv(_('Error !'),_("Maximum Required Answer is greater than Minimum Required Answer"))
raise osv.except_osv(_('Warning !'),_("Maximum Required Answer is greater than Minimum Required Answer"))
if vals['type'] == 'matrix_of_drop_down_menus':
for col in vals['column_heading_ids']:
if not col[2] or not col[2].has_key('menu_choice') or not col[2]['menu_choice']:
raise osv.except_osv(_('Error !'),_("You must enter one or more menu choices in column heading"))
raise osv.except_osv(_('Warning !'),_("You must enter one or more menu choices in column heading"))
elif not col[2] or not col[2].has_key('menu_choice') or col[2]['menu_choice'].strip() == '':
raise osv.except_osv(_('Error !'),_("You must enter one or more menu choices in column heading (white spaces not allowed)"))
raise osv.except_osv(_('Warning !'),_("You must enter one or more menu choices in column heading (white spaces not allowed)"))
res = super(survey_question, self).create(cr, uid, vals, context)
return res
@ -576,7 +576,7 @@ class survey_response(osv.osv):
return res
def copy(self, cr, uid, id, default=None,context={}):
raise osv.except_osv(_('Error !'),_('You cannot duplicate the resource!'))
raise osv.except_osv(_('Warning !'),_('You cannot duplicate the resource!'))
survey_response()

View File

@ -677,7 +677,7 @@ class survey_question_wiz(osv.osv_memory):
if error:
for res in resp_id_list:
sur_name_read['store_ans'].pop(res)
raise osv.except_osv(_('Error !'), _("'" + que_rec['question'] + "' \n" + tools.ustr(que_rec['comment_valid_err_msg'])))
raise osv.except_osv(_('Warning !'), _("'" + que_rec['question'] + "' \n" + tools.ustr(que_rec['comment_valid_err_msg'])))
resp_obj.write(cr, uid, resp_id, {'comment':val1})
sur_name_read['store_ans'][resp_id].update({key1:val1})
@ -716,7 +716,7 @@ class survey_question_wiz(osv.osv_memory):
if error:
for res in resp_id_list:
sur_name_read['store_ans'].pop(res)
raise osv.except_osv(_('Error !'), _("'" + que_rec['question'] + "' \n" + tools.ustr(que_rec['validation_valid_err_msg'])))
raise osv.except_osv(_('Warning !'), _("'" + que_rec['question'] + "' \n" + tools.ustr(que_rec['validation_valid_err_msg'])))
if key1.split('_')[1] == "single" :
resp_obj.write(cr, uid, resp_id, {'single_text':val1})
@ -736,7 +736,7 @@ class survey_question_wiz(osv.osv_memory):
except:
for res in resp_id_list:
sur_name_read['store_ans'].pop(res)
raise osv.except_osv(_('Error !'), _("'" + que_rec['question'] + "' \nPlease enter an integer value " ))
raise osv.except_osv(_('Warning !'), _("'" + que_rec['question'] + "' \nPlease enter an integer value " ))
elif val1 and que_id == key1.split('_')[0] and len(key1.split('_')) == 3:
if type(val1) == type('') or type(val1) == type(u''):
@ -765,12 +765,12 @@ class survey_question_wiz(osv.osv_memory):
if comment_field and comment_value:
for res in resp_id_list:
sur_name_read['store_ans'].pop(res)
raise osv.except_osv(_('Error re !'), _("'" + que_rec['question'] + "' " + tools.ustr(que_rec['make_comment_field_err_msg'])))
raise osv.except_osv(_('Warning !'), _("'" + que_rec['question'] + "' " + tools.ustr(que_rec['make_comment_field_err_msg'])))
if que_rec['type'] == "rating_scale" and que_rec['rating_allow_one_column_require'] and len(selected_value) > len(list(set(selected_value))):
for res in resp_id_list:
sur_name_read['store_ans'].pop(res)
raise osv.except_osv(_('Error re !'), _("'" + que_rec['question'] + "\n you cannot select same answer more than one times'"))
raise osv.except_osv(_('Warning !'), _("'" + que_rec['question'] + "\n you cannot select same answer more than one times'"))
if not select_count:
resp_obj.write(cr, uid, resp_id, {'state':'skip'})
@ -778,7 +778,7 @@ class survey_question_wiz(osv.osv_memory):
if que_rec['numeric_required_sum'] and numeric_sum > que_rec['numeric_required_sum']:
for res in resp_id_list:
sur_name_read['store_ans'].pop(res)
raise osv.except_osv(_('Error re !'), _("'" + que_rec['question'] + "' " + tools.ustr(que_rec['numeric_required_sum_err_msg'])))
raise osv.except_osv(_('Warning !'), _("'" + que_rec['question'] + "' " + tools.ustr(que_rec['numeric_required_sum_err_msg'])))
if que_rec['type'] in ['multiple_textboxes_diff_type', 'multiple_choice_multiple_ans','matrix_of_choices_only_one_ans','matrix_of_choices_only_multi_ans','matrix_of_drop_down_menus','rating_scale','multiple_textboxes','numerical_textboxes','date','date_and_time'] and que_rec['is_require_answer']:
if matrix_list:
@ -789,7 +789,7 @@ class survey_question_wiz(osv.osv_memory):
(que_rec['required_type'] == 'a range' and (len(list(set(matrix_list))) < que_rec['minimum_req_ans'] or len(list(set(matrix_list))) > que_rec['maximum_req_ans'])):
for res in resp_id_list:
sur_name_read['store_ans'].pop(res)
raise osv.except_osv(_('Error !'), _("'" + 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'])))
elif (que_rec['required_type'] == 'all' and select_count < len(que_rec['answer_choice_ids'])) or \
(que_rec['required_type'] == 'at least' and select_count < que_rec['req_ans']) or \
@ -798,12 +798,12 @@ class survey_question_wiz(osv.osv_memory):
(que_rec['required_type'] == 'a range' and (select_count < que_rec['minimum_req_ans'] or select_count > que_rec['maximum_req_ans'])):
for res in resp_id_list:
sur_name_read['store_ans'].pop(res)
raise osv.except_osv(_('Error !'), _("'" + 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'])))
if que_rec['type'] in ['multiple_choice_only_one_ans','single_textbox','comment'] and que_rec['is_require_answer'] and select_count <= 0:
for res in resp_id_list:
sur_name_read['store_ans'].pop(res)
raise osv.except_osv(_('Error re !'), _("'" + 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'])))
else:
resp_id_list = []
@ -877,7 +877,7 @@ class survey_question_wiz(osv.osv_memory):
if re.match("^[a-zA-Z0-9._%-+]+@[a-zA-Z0-9._%-]+.[a-zA-Z]{2,6}$", val) == None:
error = True
if error:
raise osv.except_osv(_('Error !'), _("'" + que_rec['question'] + "' \n" + tools.ustr(que_rec['comment_valid_err_msg'])))
raise osv.except_osv(_('Warning !'), _("'" + que_rec['question'] + "' \n" + tools.ustr(que_rec['comment_valid_err_msg'])))
resp_obj.write(cr, uid, update, {'comment':val,'state': 'done'})
sur_name_read['store_ans'][update].update({key:val})
@ -913,7 +913,7 @@ class survey_question_wiz(osv.osv_memory):
if re.match("^[a-zA-Z0-9._%-+]+@[a-zA-Z0-9._%-]+.[a-zA-Z]{2,6}$", val) == None:
error = True
if error:
raise osv.except_osv(_('Error !'), _("'" + que_rec['question'] + "' \n" + tools.ustr(que_rec['validation_valid_err_msg'])))
raise osv.except_osv(_('Warning !'), _("'" + que_rec['question'] + "' \n" + tools.ustr(que_rec['validation_valid_err_msg'])))
if key.split('_')[1] == "single" :
resp_obj.write(cr, uid, update, {'single_text':val,'state': 'done'})
else:
@ -931,7 +931,7 @@ class survey_question_wiz(osv.osv_memory):
sur_name_read['store_ans'][update].update({key:val})
select_count += 1
except:
raise osv.except_osv(_('Error !'), _("'" + que_rec['question'] + "' \n Please enter an integer value " ))
raise osv.except_osv(_('Warning !'), _("'" + que_rec['question'] + "' \n Please enter an integer value " ))
elif val and len(key.split('_')) == 3:
resp_obj.write(cr, uid, update, {'state': 'done'})
@ -959,13 +959,13 @@ class survey_question_wiz(osv.osv_memory):
sur_name_read['store_ans'][update].update({key:val})
if comment_field and comment_value:
raise osv.except_osv(_('Error re !'), _("'" + que_rec['question'] + "' " + tools.ustr(que_rec['make_comment_field_err_msg'])))
raise osv.except_osv(_('Warning !'), _("'" + que_rec['question'] + "' " + tools.ustr(que_rec['make_comment_field_err_msg'])))
if que_rec['type'] == "rating_scale" and que_rec['rating_allow_one_column_require'] and len(selected_value) > len(list(set(selected_value))):
raise osv.except_osv(_('Error re !'), _("'" + que_rec['question'] + "\n you cannot select same answer more than one times'"))
raise osv.except_osv(_('Warning !'), _("'" + que_rec['question'] + "\n you cannot select same answer more than one times'"))
if que_rec['numeric_required_sum'] and numeric_sum > que_rec['numeric_required_sum']:
raise osv.except_osv(_('Error re !'), _("'" + que_rec['question'] + "' " + tools.ustr(que_rec['numeric_required_sum_err_msg'])))
raise osv.except_osv(_('Warning !'), _("'" + que_rec['question'] + "' " + tools.ustr(que_rec['numeric_required_sum_err_msg'])))
if not select_count:
resp_obj.write(cr, uid, update, {'state': 'skip'})
@ -977,17 +977,17 @@ class survey_question_wiz(osv.osv_memory):
(que_rec['required_type'] == 'at most' and len(list(set(matrix_list))) > que_rec['req_ans']) or \
(que_rec['required_type'] == 'exactly' and len(list(set(matrix_list))) != que_rec['req_ans']) or \
(que_rec['required_type'] == 'a range' and (len(list(set(matrix_list))) < que_rec['minimum_req_ans'] or len(list(set(matrix_list))) > que_rec['maximum_req_ans'])):
raise osv.except_osv(_('Error !'), _("'" + 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'])))
elif (que_rec['required_type'] == 'all' and select_count < len(que_rec['answer_choice_ids'])) or \
(que_rec['required_type'] == 'at least' and select_count < que_rec['req_ans']) or \
(que_rec['required_type'] == 'at most' and select_count > que_rec['req_ans']) or \
(que_rec['required_type'] == 'exactly' and select_count != que_rec['req_ans']) or \
(que_rec['required_type'] == 'a range' and (select_count < que_rec['minimum_req_ans'] or select_count > que_rec['maximum_req_ans'])):
raise osv.except_osv(_('Error !'), _("'" + 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'])))
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(_('Error re !'), _("'" + 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

View File

@ -69,7 +69,7 @@ class survey_send_invitation(osv.osv_memory):
if sur.state != 'open':
msg += sur.title + "\n"
if msg:
raise osv.except_osv(_('Error !'), _('%sSurvey is not in open state') % msg)
raise osv.except_osv(_('Warning !'), _('%sSurvey is not in open state') % msg)
data['mail'] = '''Hello %(name)s, \n\n We are inviting you for following survey. \
\n ''' + name + '''\n Your login ID: %(login)s, Your password: %(passwd)s
\n link :- http://'''+ str(socket.gethostname()) + ''':8080 \n\n Thanks,'''