[FIX] caldav,email_template,hr_payroll,mrp: cleanup some calls to _( ) - only literal strings should ever been passed!

bzr revid: odo@openerp.com-20101118162131-s2nb25l3e4xzmnjg
This commit is contained in:
Olivier Dony
2010-11-18 17:21:31 +01:00
parent 6af95836bb
commit c90aa7f2f0
6 changed files with 36 additions and 37 deletions
+2 -3
View File
@@ -770,8 +770,7 @@ class basic_calendar_line(osv.osv):
res = cr.fetchone()
if res:
if res[0] > 0:
raise osv.except_osv(_('Warning !'), _('Can not create \
line "%s" more than once' % (vals.get('name'))))
raise osv.except_osv(_('Warning !'), _('Can not create line "%s" more than once') % (vals.get('name')))
return super(basic_calendar_line, self).create(cr, uid, vals, context=context)
basic_calendar_line()
@@ -859,7 +858,7 @@ class basic_calendar_fields(osv.osv):
line = line_obj.browse(cr, uid, l_id, context=context)[0]
line_rel = line.object_id.model
if (relation != 'NULL') and (not relation == line_rel):
raise osv.except_osv(_('Warning !'), _('Please provide proper configuration of "%s" in Calendar Lines' % (name)))
raise osv.except_osv(_('Warning !'), _('Please provide proper configuration of "%s" in Calendar Lines') % (name))
return True
def create(self, cr, uid, vals, context=None):
@@ -43,9 +43,9 @@ class email_template_mailbox(osv.osv):
self.send_all_mail(cursor, user, context)
except Exception, e:
LOGGER.notifyChannel(
_("Email Template"),
"Email Template",
netsvc.LOG_ERROR,
_("Error sending mail: %s" % str(e)))
_("Error sending mail: %s") % e)
def send_all_mail(self, cr, uid, ids=None, context=None):
if ids is None:
+3 -3
View File
@@ -473,7 +473,7 @@ class payroll_register(osv.osv):
for slip in reg.line_ids:
if not slip.employee_id.bank_account_id:
raise osv.except_osv(_('Error !'), _('Please define bank account for the %s employee' % (slip.employee_id.name)))
raise osv.except_osv(_('Error !'), _('Please define bank account for the %s employee') % (slip.employee_id.name))
pline = {
'advice_id':pid,
'name':slip.employee_id.bank_account_id.acc_number,
@@ -1261,7 +1261,7 @@ class hr_payslip(osv.osv):
paid_leave = 0.0
for hday in holiday_pool.browse(cr, uid, leave_ids, context=context):
if not hday.holiday_status_id.head_id:
raise osv.except_osv(_('Error !'), _('Please check configuration of %s, payroll head is missing' % (hday.holiday_status_id.name)))
raise osv.except_osv(_('Error !'), _('Please check configuration of %s, payroll head is missing') % (hday.holiday_status_id.name))
res = {
'slip_id':slip.id,
@@ -1448,7 +1448,7 @@ class hr_employee(osv.osv):
try:
amt = eval(base, obj)
except Exception, e:
raise osv.except_osv(_('Variable Error !'), _('Variable Error: %s ' % (e)))
raise osv.except_osv(_('Variable Error !'), _('Variable Error: %s ') % (e))
amount = 0.0
if line.amount_type == 'per':
amount = amt * line.amount
@@ -277,10 +277,10 @@ class hr_payslip(osv.osv):
if ((fiscal_year['date_start'] <= slip.date) and (fiscal_year['date_stop'] >= slip.date)):
year_exist = True
if not year_exist:
raise osv.except_osv(_('Warning !'), _('Fiscal Year is not defined for slip date %s'%slip.date))
raise osv.except_osv(_('Warning !'), _('Fiscal Year is not defined for slip date %s') % slip.date)
search_periods = period_pool.search(cr, uid, [('date_start','<=',slip.date),('date_stop','>=',slip.date)], context=context)
if not search_periods:
raise osv.except_osv(_('Warning !'), _('Period is not defined for slip date %s'%slip.date))
raise osv.except_osv(_('Warning !'), _('Period is not defined for slip date %s') % slip.date)
period_id = search_periods[0]
name = 'Payment of Salary to %s' % (slip.employee_id.name)
move = {
@@ -428,10 +428,10 @@ class hr_payslip(osv.osv):
partner_id = False
if not slip.employee_id.bank_account_id:
raise osv.except_osv(_('Integrity Error !'), _('Please defined bank account for %s !' % (slip.employee_id.name)))
raise osv.except_osv(_('Integrity Error !'), _('Please defined bank account for %s !') % (slip.employee_id.name))
if not slip.employee_id.bank_account_id.partner_id:
raise osv.except_osv(_('Integrity Error !'), _('Please defined partner in bank account for %s !' % (slip.employee_id.name)))
raise osv.except_osv(_('Integrity Error !'), _('Please defined partner in bank account for %s !') % (slip.employee_id.name))
partner = slip.employee_id.bank_account_id.partner_id
partner_id = slip.employee_id.bank_account_id.partner_id.id
@@ -450,10 +450,10 @@ class hr_payslip(osv.osv):
if ((fiscal_year['date_start'] <= slip.date) and (fiscal_year['date_stop'] >= slip.date)):
year_exist = True
if not year_exist:
raise osv.except_osv(_('Warning !'), _('Fiscal Year is not defined for slip date %s'%slip.date))
raise osv.except_osv(_('Warning !'), _('Fiscal Year is not defined for slip date %s') % slip.date)
search_periods = period_pool.search(cr,uid,[('date_start','<=',slip.date),('date_stop','>=',slip.date)], context=context)
if not search_periods:
raise osv.except_osv(_('Warning !'), _('Period is not defined for slip date %s'%slip.date))
raise osv.except_osv(_('Warning !'), _('Period is not defined for slip date %s') % slip.date)
period_id = search_periods[0]
move = {
@@ -667,4 +667,4 @@ class account_move_link_slip(osv.osv):
}
account_move_link_slip()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+1 -1
View File
@@ -465,7 +465,7 @@ class mrp_production(osv.osv):
if s['state'] in ['draft','cancel']:
unlink_ids.append(s['id'])
else:
raise osv.except_osv(_('Invalid action !'), _('Cannot delete Production Order(s) which are in %s State!' % s['state']))
raise osv.except_osv(_('Invalid action !'), _('Cannot delete Production Order(s) which are in %s State!') % s['state'])
return osv.osv.unlink(self, cr, uid, unlink_ids, context=context)
def copy(self, cr, uid, id, default=None, context=None):
+21 -21
View File
@@ -120,14 +120,14 @@ class survey_question_wiz(osv.osv_memory):
if ((context.has_key('active') and not context.get('active', False)) \
or not context.has_key('active')) and not sur_name_rec.page_no + 1:
if sur_rec.state != "open" :
raise osv.except_osv(_('Warning !'),_("You can not give answer because of survey is not open for answer"))
raise osv.except_osv(_('Warning !'),_("You can not answer because the survey is not open"))
cr.execute('select count(id) from survey_history where user_id=%s\
and survey_id=%s', (uid,survey_id))
res = cr.fetchone()[0]
user_limit = survey_obj.browse(cr, uid, survey_id)
user_limit = user_limit.response_user
if user_limit and res >= user_limit:
raise osv.except_osv(_('Warning !'),_("You can not give answer for this survey more than %s times") % (user_limit))
raise osv.except_osv(_('Warning !'),_("You can not answer this survey more than %s times") % (user_limit))
if sur_rec.max_response_limit and sur_rec.max_response_limit <= sur_rec.tot_start_survey and not sur_name_rec.page_no + 1:
survey_obj.write(cr, uid, survey_id, {'state':'close', 'date_close':strftime("%Y-%m-%d %H:%M:%S")})
@@ -150,7 +150,7 @@ class survey_question_wiz(osv.osv_memory):
pre_button = True
if flag:
pag_rec = page_obj.browse(cr, uid, p_id)
xml_form = etree.Element('form', {'string': _(tools.ustr(pag_rec.title))})
xml_form = etree.Element('form', {'string': tools.ustr(pag_rec.title)})
xml_group = etree.SubElement(xml_form, 'group', {'col': '1', 'colspan': '4'})
if context.has_key('response_id') and context.get('response_id', False) \
and int(context.get('response_id',0)[0]) > 0:
@@ -692,7 +692,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(_('Warning !'), _("'" + 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})
@@ -731,7 +731,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(_('Warning !'), _("'" + 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})
@@ -751,7 +751,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(_('Warning !'), _("'" + que_rec['question'] + "' \nPlease enter an integer value " ))
raise osv.except_osv(_('Warning !'), "'" + que_rec['question'] + "' \n" + _("Please 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''):
@@ -780,12 +780,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(_('Warning !'), _("'" + 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(_('Warning !'), _("'" + 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 the same answer more than one time"))
if not select_count:
resp_obj.write(cr, uid, resp_id, {'state':'skip'})
@@ -793,7 +793,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(_('Warning !'), _("'" + 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:
@@ -804,7 +804,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(_('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']))
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 \
@@ -813,12 +813,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(_('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']))
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(_('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']))
else:
resp_id_list = []
@@ -892,7 +892,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(_('Warning !'), _("'" + 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})
@@ -928,7 +928,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(_('Warning !'), _("'" + 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:
@@ -946,7 +946,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(_('Warning !'), _("'" + 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'})
@@ -974,13 +974,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(_('Warning !'), _("'" + 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(_('Warning !'), _("'" + 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 time'"))
if que_rec['numeric_required_sum'] and numeric_sum > que_rec['numeric_required_sum']:
raise osv.except_osv(_('Warning !'), _("'" + 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'})
@@ -992,17 +992,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(_('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']))
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(_('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']))
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