[IMP] rephrase some error and warning messages in account

remove exclamation marks at the end of messages
remove first person usage ('I' and 'We')
remove unjustified capital letters
rephrase the clumsy form 'No <some attribute> is defined'

bzr revid: abo@openerp.com-20120806154410-kbf9aai2uzq2b0c4
This commit is contained in:
Antonin Bourguignon 2012-08-06 17:44:10 +02:00
parent 3bbe3ddbd5
commit 48e0915804
22 changed files with 160 additions and 160 deletions

View File

@ -409,7 +409,7 @@ class account_account(osv.osv):
period_obj = self.pool.get('account.period') period_obj = self.pool.get('account.period')
pids = period_obj.search(cr, uid, [('special','=',True),('company_id','=',account.company_id.id)], context=context) pids = period_obj.search(cr, uid, [('special','=',True),('company_id','=',account.company_id.id)], context=context)
if not pids: if not pids:
raise osv.except_osv(_('Error!'),_("No opening/closing period is defined, please create one to set the initial balance!")) raise osv.except_osv(_('Error!'),_("There is no opening/closing period defined, please create one to set the initial balance."))
move_obj = self.pool.get('account.move.line') move_obj = self.pool.get('account.move.line')
move_id = move_obj.search(cr, uid, [ move_id = move_obj.search(cr, uid, [
@ -619,9 +619,9 @@ class account_account(osv.osv):
if line_obj.search(cr, uid, [('account_id', 'in', account_ids)]): if line_obj.search(cr, uid, [('account_id', 'in', account_ids)]):
if method == 'write': if method == 'write':
raise osv.except_osv(_('Error !'), _('You cannot deactivate an account that contains some journal items.')) raise osv.except_osv(_('Error !'), _('You cannot deactivate an account that contains journal items.'))
elif method == 'unlink': elif method == 'unlink':
raise osv.except_osv(_('Error !'), _('You cannot remove an account containing journal items.')) raise osv.except_osv(_('Error !'), _('You cannot remove an account that contains journal items.'))
#Checking whether the account is set as a property to any Partner or not #Checking whether the account is set as a property to any Partner or not
value = 'account.account,' + str(ids[0]) value = 'account.account,' + str(ids[0])
partner_prop_acc = self.pool.get('ir.property').search(cr, uid, [('value_reference','=',value)], context=context) partner_prop_acc = self.pool.get('ir.property').search(cr, uid, [('value_reference','=',value)], context=context)
@ -790,7 +790,7 @@ class account_journal(osv.osv):
if 'company_id' in vals and journal.company_id.id != vals['company_id']: if 'company_id' in vals and journal.company_id.id != vals['company_id']:
move_lines = self.pool.get('account.move.line').search(cr, uid, [('journal_id', 'in', ids)]) move_lines = self.pool.get('account.move.line').search(cr, uid, [('journal_id', 'in', ids)])
if move_lines: if move_lines:
raise osv.except_osv(_('Warning !'), _('You cannot modify the company of this journal as its related record exist in journal items.')) raise osv.except_osv(_('Warning !'), _('This journal already contains items, therefore you cannot modify its company field.'))
return super(account_journal, self).write(cr, uid, ids, vals, context=context) return super(account_journal, self).write(cr, uid, ids, vals, context=context)
def create_sequence(self, cr, uid, vals, context=None): def create_sequence(self, cr, uid, vals, context=None):
@ -915,7 +915,7 @@ class account_fiscalyear(osv.osv):
return True return True
_constraints = [ _constraints = [
(_check_duration, 'Error! The start date of the fiscal year must be less than the end date.', ['date_start','date_stop']) (_check_duration, 'Error! The start date of a fiscal year must precede its end date.', ['date_start','date_stop'])
] ]
def create_period3(self, cr, uid, ids, context=None): def create_period3(self, cr, uid, ids, context=None):
@ -966,7 +966,7 @@ class account_fiscalyear(osv.osv):
ids = self.search(cr, uid, args, context=context) ids = self.search(cr, uid, args, context=context)
if not ids: if not ids:
if exception: if exception:
raise osv.except_osv(_('Error !'), _('No fiscal year is defined for this date !\nPlease create one from the configuration of the accounting menu.')) raise osv.except_osv(_('Error !'), _('There is no fiscal year defined for this date.\nPlease create one from the configuration of the accounting menu.'))
else: else:
return [] return []
return ids return ids
@ -1033,7 +1033,7 @@ class account_period(osv.osv):
_constraints = [ _constraints = [
(_check_duration, 'Error ! The duration of the Period(s) is/are invalid. ', ['date_stop']), (_check_duration, 'Error ! The duration of the Period(s) is/are invalid. ', ['date_stop']),
(_check_year_limit, 'Invalid period ! Some periods overlap or the date period which is not in the scope of the fiscal year. ', ['date_stop']) (_check_year_limit, 'Error ! The period is invalid. Either some periods are overlapping or the period\'s dates are not matching the scope of the fiscal year.', ['date_stop'])
] ]
def next(self, cr, uid, period, step, context=None): def next(self, cr, uid, period, step, context=None):
@ -1055,7 +1055,7 @@ class account_period(osv.osv):
args.append(('company_id', '=', company_id)) args.append(('company_id', '=', company_id))
ids = self.search(cr, uid, args, context=context) ids = self.search(cr, uid, args, context=context)
if not ids: if not ids:
raise osv.except_osv(_('Error !'), _('No period is defined for this date: %s !\nPlease create one.')%dt) raise osv.except_osv(_('Error !'), _('There is no period defined for this date: %s.\nPlease create one.')%dt)
return ids return ids
def action_draft(self, cr, uid, ids, *args): def action_draft(self, cr, uid, ids, *args):
@ -1080,7 +1080,7 @@ class account_period(osv.osv):
if 'company_id' in vals: if 'company_id' in vals:
move_lines = self.pool.get('account.move.line').search(cr, uid, [('period_id', 'in', ids)]) move_lines = self.pool.get('account.move.line').search(cr, uid, [('period_id', 'in', ids)])
if move_lines: if move_lines:
raise osv.except_osv(_('Warning !'), _('You cannot modify company of this period as some journal items exist.')) raise osv.except_osv(_('Warning !'), _('This journal already contains items for this period, therefore you cannot modify its company field.'))
return super(account_period, self).write(cr, uid, ids, vals, context=context) return super(account_period, self).write(cr, uid, ids, vals, context=context)
def build_ctx_periods(self, cr, uid, period_from_id, period_to_id): def build_ctx_periods(self, cr, uid, period_from_id, period_to_id):
@ -1095,7 +1095,7 @@ class account_period(osv.osv):
if company1_id != company2_id: if company1_id != company2_id:
raise osv.except_osv(_('Error!'), _('You should choose the periods that belong to the same company.')) raise osv.except_osv(_('Error!'), _('You should choose the periods that belong to the same company.'))
if period_date_start > period_date_stop: if period_date_start > period_date_stop:
raise osv.except_osv(_('Error!'), _('Start period should be smaller than End period.')) raise osv.except_osv(_('Error!'), _('Start period should precede then end period.'))
#for period from = january, we want to exclude the opening period (but it has same date_from, so we have to check if period_from is special or not to include that clause or not in the search). #for period from = january, we want to exclude the opening period (but it has same date_from, so we have to check if period_from is special or not to include that clause or not in the search).
if period_from.special: if period_from.special:
return self.search(cr, uid, [('date_start', '>=', period_date_start), ('date_stop', '<=', period_date_stop), ('company_id', '=', company1_id)]) return self.search(cr, uid, [('date_start', '>=', period_date_start), ('date_stop', '<=', period_date_stop), ('company_id', '=', company1_id)])
@ -1134,7 +1134,7 @@ class account_journal_period(osv.osv):
cr.execute('select * from account_move_line where journal_id=%s and period_id=%s limit 1', (obj.journal_id.id, obj.period_id.id)) cr.execute('select * from account_move_line where journal_id=%s and period_id=%s limit 1', (obj.journal_id.id, obj.period_id.id))
res = cr.fetchall() res = cr.fetchall()
if res: if res:
raise osv.except_osv(_('Error !'), _('You cannot modify/delete a journal with entries for this period !')) raise osv.except_osv(_('Error !'), _('You cannot modify/delete a journal with entries for this period.'))
return True return True
def write(self, cr, uid, ids, vals, context=None): def write(self, cr, uid, ids, vals, context=None):
@ -1303,7 +1303,7 @@ class account_move(osv.osv):
_constraints = [ _constraints = [
(_check_centralisation, (_check_centralisation,
'You cannot create more than one move per period on centralized journal.', 'You cannot create more than one move per period on a centralized journal.',
['journal_id']), ['journal_id']),
] ]
@ -1314,7 +1314,7 @@ class account_move(osv.osv):
valid_moves = self.validate(cr, uid, ids, context) valid_moves = self.validate(cr, uid, ids, context)
if not valid_moves: if not valid_moves:
raise osv.except_osv(_('Integrity Error !'), _('You cannot validate a non-balanced entry !\nMake sure you have configured payment terms properly !\nThe latest payment term line should be of the type "Balance" !')) raise osv.except_osv(_('Integrity Error !'), _('You cannot validate a non-balanced entry.\nMake sure you have configured payment terms properly.\nThe latest payment term line should be of the "Balance" type.'))
obj_sequence = self.pool.get('ir.sequence') obj_sequence = self.pool.get('ir.sequence')
for move in self.browse(cr, uid, valid_moves, context=context): for move in self.browse(cr, uid, valid_moves, context=context):
if move.name =='/': if move.name =='/':
@ -1328,7 +1328,7 @@ class account_move(osv.osv):
c = {'fiscalyear_id': move.period_id.fiscalyear_id.id} c = {'fiscalyear_id': move.period_id.fiscalyear_id.id}
new_name = obj_sequence.next_by_id(cr, uid, journal.sequence_id.id, c) new_name = obj_sequence.next_by_id(cr, uid, journal.sequence_id.id, c)
else: else:
raise osv.except_osv(_('Error'), _('Please define sequence on the journal !')) raise osv.except_osv(_('Error !'), _('Please define a sequence on the journal.'))
if new_name: if new_name:
self.write(cr, uid, [move.id], {'name':new_name}) self.write(cr, uid, [move.id], {'name':new_name})
@ -1358,7 +1358,7 @@ class account_move(osv.osv):
def button_cancel(self, cr, uid, ids, context=None): def button_cancel(self, cr, uid, ids, context=None):
for line in self.browse(cr, uid, ids, context=context): for line in self.browse(cr, uid, ids, context=context):
if not line.journal_id.update_posted: if not line.journal_id.update_posted:
raise osv.except_osv(_('Error !'), _('You cannot modify a posted entry of this journal !\nYou should set the journal to allow cancelling entries if you want to do that.')) raise osv.except_osv(_('Error !'), _('You cannot modify a posted entry of this journal.\nFirst you should set the journal to allow cancelling entries.'))
if ids: if ids:
cr.execute('UPDATE account_move '\ cr.execute('UPDATE account_move '\
'SET state=%s '\ 'SET state=%s '\
@ -1446,7 +1446,7 @@ class account_move(osv.osv):
for move in self.browse(cr, uid, ids, context=context): for move in self.browse(cr, uid, ids, context=context):
if move['state'] != 'draft': if move['state'] != 'draft':
raise osv.except_osv(_('UserError!'), raise osv.except_osv(_('UserError!'),
_('You cannot delete a posted journal entry "%s"!') % \ _('You cannot delete a posted journal entry "%s".') % \
move['name']) move['name'])
line_ids = map(lambda x: x.id, move.line_id) line_ids = map(lambda x: x.id, move.line_id)
context['journal_id'] = move.journal_id.id context['journal_id'] = move.journal_id.id
@ -1475,14 +1475,14 @@ class account_move(osv.osv):
mode2 = 'debit' mode2 = 'debit'
if not account_id: if not account_id:
raise osv.except_osv(_('UserError'), raise osv.except_osv(_('UserError'),
_('No default debit account is defined \n' \ _('There is no default debit account defined \n' \
'on journal "%s".') % move.journal_id.name) 'on journal "%s".') % move.journal_id.name)
else: else:
account_id = move.journal_id.default_credit_account_id.id account_id = move.journal_id.default_credit_account_id.id
mode2 = 'credit' mode2 = 'credit'
if not account_id: if not account_id:
raise osv.except_osv(_('UserError'), raise osv.except_osv(_('UserError'),
_('No default credit account is defined \n' \ _('There is no default credit account defined \n' \
'on journal "%s".') % move.journal_id.name) 'on journal "%s".') % move.journal_id.name)
# find the first line of this move with the current mode # find the first line of this move with the current mode
@ -2623,7 +2623,7 @@ class account_add_tmpl_wizard(osv.osv_memory):
ptids = tmpl_obj.read(cr, uid, [tids[0]['parent_id'][0]], ['code']) ptids = tmpl_obj.read(cr, uid, [tids[0]['parent_id'][0]], ['code'])
res = None res = None
if not ptids or not ptids[0]['code']: if not ptids or not ptids[0]['code']:
raise osv.except_osv(_('Error !'), _('I cannot locate a parent code for the template account!')) raise osv.except_osv(_('Error !'), _('There is no parent code for the template account.'))
res = acc_obj.search(cr, uid, [('code','=',ptids[0]['code'])]) res = acc_obj.search(cr, uid, [('code','=',ptids[0]['code'])])
return res and res[0] or False return res and res[0] or False

View File

@ -88,7 +88,7 @@ class account_analytic_line(osv.osv):
a = prod.categ_id.property_account_expense_categ.id a = prod.categ_id.property_account_expense_categ.id
if not a: if not a:
raise osv.except_osv(_('Error !'), raise osv.except_osv(_('Error !'),
_('No expense account is defined ' \ _('There is no expense account defined ' \
'for this product: "%s" (id:%d).') % \ 'for this product: "%s" (id:%d).') % \
(prod.name, prod.id,)) (prod.name, prod.id,))
else: else:
@ -97,7 +97,7 @@ class account_analytic_line(osv.osv):
a = prod.categ_id.property_account_income_categ.id a = prod.categ_id.property_account_income_categ.id
if not a: if not a:
raise osv.except_osv(_('Error !'), raise osv.except_osv(_('Error !'),
_('No income account is defined ' \ _('There is no income account defined ' \
'for this product: "%s" (id:%d).') % \ 'for this product: "%s" (id:%d).') % \
(prod.name, prod_id,)) (prod.name, prod_id,))

View File

@ -260,7 +260,7 @@ class account_cash_statement(osv.osv):
if journal_type == 'bank': if journal_type == 'bank':
return super(account_cash_statement, self).balance_check(cr, uid, cash_id, journal_type, context) return super(account_cash_statement, self).balance_check(cr, uid, cash_id, journal_type, context)
if not self._equal_balance(cr, uid, cash_id, context): if not self._equal_balance(cr, uid, cash_id, context):
raise osv.except_osv(_('Error !'), _('The closing balance should be equal to compute balance on the cash register !')) raise osv.except_osv(_('Error !'), _('The closing balance should be equal to compute balance on the cash register.'))
return True return True
def statement_close(self, cr, uid, ids, journal_type='bank', context=None): def statement_close(self, cr, uid, ids, journal_type='bank', context=None):
@ -290,7 +290,7 @@ class account_cash_statement(osv.osv):
for item_label, item_account in TALBES: for item_label, item_account in TALBES:
if getattr(obj.journal_id, item_account): if getattr(obj.journal_id, item_account):
raise osv.except_osv(_('Error !'), raise osv.except_osv(_('Error !'),
_('No %s Account on the Journal %s.') % (item_label, obj.journal_id.name,)) _('There is no %s Account on the journal %s.') % (item_label, obj.journal_id.name,))
is_profit = obj.difference < 0.0 is_profit = obj.difference < 0.0

View File

@ -364,7 +364,7 @@ class account_invoice(osv.osv):
except Exception, e: except Exception, e:
if '"journal_id" viol' in e.args[0]: if '"journal_id" viol' in e.args[0]:
raise orm.except_orm(_('Configuration Error!'), raise orm.except_orm(_('Configuration Error!'),
_('No Sale/Purchase Journal(s) is defined!')) _('There is no Sale/Purchase Journal(s) defined.'))
else: else:
raise orm.except_orm(_('Unknown Error!'), str(e)) raise orm.except_orm(_('Unknown Error!'), str(e))
@ -425,7 +425,7 @@ class account_invoice(osv.osv):
if t['state'] in ('draft', 'cancel') and t['internal_number']== False: if t['state'] in ('draft', 'cancel') and t['internal_number']== False:
unlink_ids.append(t['id']) unlink_ids.append(t['id'])
else: else:
raise osv.except_osv(_('Invalid action !'), _('You cannot delete an invoice which is open or paid. We suggest you to refund it instead.')) raise osv.except_osv(_('Invalid action !'), _('You cannot delete an invoice which is open or paid. You should refund it instead.'))
osv.osv.unlink(self, cr, uid, unlink_ids, context=context) osv.osv.unlink(self, cr, uid, unlink_ids, context=context)
return True return True
@ -577,7 +577,7 @@ class account_invoice(osv.osv):
obj_l = account_obj.browse(cr, uid, inv_line[2]['account_id']) obj_l = account_obj.browse(cr, uid, inv_line[2]['account_id'])
if obj_l.company_id.id != company_id: if obj_l.company_id.id != company_id:
raise osv.except_osv(_('Configuration Error !'), raise osv.except_osv(_('Configuration Error !'),
_('Company of invoice line account and the company of invoice does not match.')) _('Invoice line account\'s company and invoice\'s compnay does not match.'))
else: else:
continue continue
if company_id and type: if company_id and type:
@ -866,7 +866,7 @@ class account_invoice(osv.osv):
total_percent += line.value_amount total_percent += line.value_amount
total_fixed = (total_fixed * 100) / (inv.amount_total or 1.0) total_fixed = (total_fixed * 100) / (inv.amount_total or 1.0)
if (total_fixed + total_percent) > 100: if (total_fixed + total_percent) > 100:
raise osv.except_osv(_('Error !'), _("Cannot create the invoice !\nThe related payment term is probably misconfigured as it gives a computed amount greater than the total invoiced amount. The latest line of your payment term must be of type 'balance' to avoid rounding issues.")) raise osv.except_osv(_('Error !'), _("Cannot create the invoice.\nThe related payment term is probably misconfigured as it gives a computed amount greater than the total invoiced amount. In order to avoid rounding issues, the latest line of your payment term must be of type 'balance'."))
# one move line per tax line # one move line per tax line
iml += ait_obj.move_line_get(cr, uid, inv.id) iml += ait_obj.move_line_get(cr, uid, inv.id)
@ -1061,7 +1061,7 @@ class account_invoice(osv.osv):
pay_ids = account_move_line_obj.browse(cr, uid, i['payment_ids']) pay_ids = account_move_line_obj.browse(cr, uid, i['payment_ids'])
for move_line in pay_ids: for move_line in pay_ids:
if move_line.reconcile_partial_id and move_line.reconcile_partial_id.line_partial_ids: if move_line.reconcile_partial_id and move_line.reconcile_partial_id.line_partial_ids:
raise osv.except_osv(_('Error !'), _('You cannot cancel an invoice which is partially paid! You need to unreconcile related payment entries first!')) raise osv.except_osv(_('Error !'), _('You cannot cancel an invoice which is partially paid. You need to unreconcile related payment entries first.'))
# First, set the invoices as cancelled and detach the move ids # First, set the invoices as cancelled and detach the move ids
self.write(cr, uid, ids, {'state':'cancel', 'move_id':False}) self.write(cr, uid, ids, {'state':'cancel', 'move_id':False})
@ -1475,7 +1475,7 @@ class account_invoice_line(osv.osv):
if prod.uom_id.category_id.id != prod_uom.category_id.id: if prod.uom_id.category_id.id != prod_uom.category_id.id:
warning = { warning = {
'title': _('Warning!'), 'title': _('Warning!'),
'message': _('Selected Unit of Measure is not compatible with the Unit of Measure of the product.') 'message': _('The selected unit of measure is not compatible with the unit of measure of the product.')
} }
return {'value': res['value'], 'warning': warning} return {'value': res['value'], 'warning': warning}
return res return res

View File

@ -95,7 +95,7 @@ class account_move_line(osv.osv):
if initial_bal and not context.get('periods', False) and not where_move_lines_by_date: if initial_bal and not context.get('periods', False) and not where_move_lines_by_date:
#we didn't pass any filter in the context, and the initial balance can't be computed using only the fiscalyear otherwise entries will be summed twice #we didn't pass any filter in the context, and the initial balance can't be computed using only the fiscalyear otherwise entries will be summed twice
#so we have to invalidate this query #so we have to invalidate this query
raise osv.except_osv(_('Warning !'),_("You havenot supplied enough argument to compute the initial balance, please select a period and journal in the context.")) raise osv.except_osv(_('Warning !'),_("You have not supplied enough arguments to compute the initial balance, please select a period and a journal in the context."))
if context.get('journal_ids', False): if context.get('journal_ids', False):
@ -752,7 +752,7 @@ class account_move_line(osv.osv):
else: else:
currency_id = line.company_id.currency_id currency_id = line.company_id.currency_id
if line.reconcile_id: if line.reconcile_id:
raise osv.except_osv(_('Warning !'), _('Already Reconciled!')) raise osv.except_osv(_('Warning !'), _('Already reconciled.'))
if line.reconcile_partial_id: if line.reconcile_partial_id:
for line2 in line.reconcile_partial_id.line_partial_ids: for line2 in line.reconcile_partial_id.line_partial_ids:
if not line2.reconcile_id: if not line2.reconcile_id:
@ -823,15 +823,15 @@ class account_move_line(osv.osv):
r = cr.fetchall() r = cr.fetchall()
#TODO: move this check to a constraint in the account_move_reconcile object #TODO: move this check to a constraint in the account_move_reconcile object
if not unrec_lines: if not unrec_lines:
raise osv.except_osv(_('Error !'), _('Entry is already reconciled!')) raise osv.except_osv(_('Error !'), _('Entry is already reconciled.'))
account = account_obj.browse(cr, uid, account_id, context=context) account = account_obj.browse(cr, uid, account_id, context=context)
if r[0][1] != None: if r[0][1] != None:
raise osv.except_osv(_('Error !'), _('Some entries are already reconciled !')) raise osv.except_osv(_('Error !'), _('Some entries are already reconciled.'))
if (not currency_obj.is_zero(cr, uid, account.company_id.currency_id, writeoff)) or \ if (not currency_obj.is_zero(cr, uid, account.company_id.currency_id, writeoff)) or \
(account.currency_id and (not currency_obj.is_zero(cr, uid, account.currency_id, currency))): (account.currency_id and (not currency_obj.is_zero(cr, uid, account.currency_id, currency))):
if not writeoff_acc_id: if not writeoff_acc_id:
raise osv.except_osv(_('Warning !'), _('You have to provide an account for the write off/exchange difference entry !')) raise osv.except_osv(_('Warning !'), _('You have to provide an account for the write off/exchange difference entry.'))
if writeoff > 0: if writeoff > 0:
debit = writeoff debit = writeoff
credit = 0.0 credit = 0.0
@ -1092,7 +1092,7 @@ class account_move_line(osv.osv):
if res[1] != 'draft': if res[1] != 'draft':
raise osv.except_osv(_('UserError!'), raise osv.except_osv(_('UserError!'),
_('The account move (%s) for centralisation ' \ _('The account move (%s) for centralisation ' \
'has been confirmed!') % res[2]) 'has been confirmed.') % res[2])
return res return res
def _remove_move_reconcile(self, cr, uid, move_ids=[], context=None): def _remove_move_reconcile(self, cr, uid, move_ids=[], context=None):
@ -1139,9 +1139,9 @@ class account_move_line(osv.osv):
if isinstance(ids, (int, long)): if isinstance(ids, (int, long)):
ids = [ids] ids = [ids]
if vals.get('account_tax_id', False): if vals.get('account_tax_id', False):
raise osv.except_osv(_('Unable to change tax !'), _('You cannot change the tax, you should remove and recreate lines !')) raise osv.except_osv(_('Unable to change tax!'), _('You cannot change the tax, you should remove and recreate lines.'))
if ('account_id' in vals) and not account_obj.read(cr, uid, vals['account_id'], ['active'])['active']: if ('account_id' in vals) and not account_obj.read(cr, uid, vals['account_id'], ['active'])['active']:
raise osv.except_osv(_('Bad account!'), _('You cannot use an inactive account!')) raise osv.except_osv(_('Bad account!'), _('You cannot use an inactive account.'))
if update_check: if update_check:
if ('account_id' in vals) or ('journal_id' in vals) or ('period_id' in vals) or ('move_id' in vals) or ('debit' in vals) or ('credit' in vals) or ('date' in vals): if ('account_id' in vals) or ('journal_id' in vals) or ('period_id' in vals) or ('move_id' in vals) or ('debit' in vals) or ('credit' in vals) or ('date' in vals):
self._update_check(cr, uid, ids, context) self._update_check(cr, uid, ids, context)
@ -1202,9 +1202,9 @@ class account_move_line(osv.osv):
for line in self.browse(cr, uid, ids, context=context): for line in self.browse(cr, uid, ids, context=context):
err_msg = _('Move name (id): %s (%s)') % (line.move_id.name, str(line.move_id.id)) err_msg = _('Move name (id): %s (%s)') % (line.move_id.name, str(line.move_id.id))
if line.move_id.state <> 'draft' and (not line.journal_id.entry_posted): if line.move_id.state <> 'draft' and (not line.journal_id.entry_posted):
raise osv.except_osv(_('Error !'), _('You cannot do this modification on a confirmed entry! You can just change some non legal fields or you must unconfirm the journal entry first! \n%s.') % err_msg) raise osv.except_osv(_('Error !'), _('You cannot do this modification on a confirmed entry. You can just change some non legal fields or you must unconfirm the journal entry first.\n%s.') % err_msg)
if line.reconcile_id: if line.reconcile_id:
raise osv.except_osv(_('Error !'), _('You cannot do this modification on a reconciled entry! You can just change some non legal fields or you must unreconcile first!\n%s.') % err_msg) raise osv.except_osv(_('Error !'), _('You cannot do this modification on a reconciled entry. You can just change some non legal fields or you must unreconcile first.\n%s.') % err_msg)
t = (line.journal_id.id, line.period_id.id) t = (line.journal_id.id, line.period_id.id)
if t not in done: if t not in done:
self._update_journal_check(cr, uid, line.journal_id.id, line.period_id.id, context) self._update_journal_check(cr, uid, line.journal_id.id, line.period_id.id, context)
@ -1224,7 +1224,7 @@ class account_move_line(osv.osv):
if company_id: if company_id:
vals['company_id'] = company_id[0] vals['company_id'] = company_id[0]
if ('account_id' in vals) and not account_obj.read(cr, uid, vals['account_id'], ['active'])['active']: if ('account_id' in vals) and not account_obj.read(cr, uid, vals['account_id'], ['active'])['active']:
raise osv.except_osv(_('Bad account!'), _('You cannot use an inactive account!')) raise osv.except_osv(_('Bad account!'), _('You cannot use an inactive account.'))
if 'journal_id' in vals: if 'journal_id' in vals:
context['journal_id'] = vals['journal_id'] context['journal_id'] = vals['journal_id']
if 'period_id' in vals: if 'period_id' in vals:
@ -1237,7 +1237,7 @@ class account_move_line(osv.osv):
if 'period_id' not in context or not isinstance(context.get('period_id', ''), (int, long)): if 'period_id' not in context or not isinstance(context.get('period_id', ''), (int, long)):
period_candidate_ids = self.pool.get('account.period').name_search(cr, uid, name=context.get('period_id','')) period_candidate_ids = self.pool.get('account.period').name_search(cr, uid, name=context.get('period_id',''))
if len(period_candidate_ids) != 1: if len(period_candidate_ids) != 1:
raise osv.except_osv(_('Encoding error!'), _('No period is found or more than one period found for the given date.')) raise osv.except_osv(_('Encoding error!'), _('No period found or more than one period found for the given date.'))
context['period_id'] = period_candidate_ids[0][0] context['period_id'] = period_candidate_ids[0][0]
if not context.get('journal_id', False) and context.get('search_default_journal_id', False): if not context.get('journal_id', False) and context.get('search_default_journal_id', False):
context['journal_id'] = context.get('search_default_journal_id') context['journal_id'] = context.get('search_default_journal_id')
@ -1263,7 +1263,7 @@ class account_move_line(osv.osv):
move_id = move_obj.create(cr, uid, v, context) move_id = move_obj.create(cr, uid, v, context)
vals['move_id'] = move_id vals['move_id'] = move_id
else: else:
raise osv.except_osv(_('No piece number !'), _('Cannot create an automatic sequence for this piece!\nPut a sequence in the journal definition for automatic numbering or create a sequence manually for this piece.')) raise osv.except_osv(_('No piece number !'), _('Cannot create an automatic sequence for this piece.\nPut a sequence in the journal definition for automatic numbering or create a sequence manually for this piece.'))
ok = not (journal.type_control_ids or journal.account_control_ids) ok = not (journal.type_control_ids or journal.account_control_ids)
if ('account_id' in vals): if ('account_id' in vals):
account = account_obj.browse(cr, uid, vals['account_id'], context=context) account = account_obj.browse(cr, uid, vals['account_id'], context=context)
@ -1288,7 +1288,7 @@ class account_move_line(osv.osv):
vals['amount_currency'] = cur_obj.compute(cr, uid, account.company_id.currency_id.id, vals['amount_currency'] = cur_obj.compute(cr, uid, account.company_id.currency_id.id,
account.currency_id.id, vals.get('debit', 0.0)-vals.get('credit', 0.0), context=ctx) account.currency_id.id, vals.get('debit', 0.0)-vals.get('credit', 0.0), context=ctx)
if not ok: if not ok:
raise osv.except_osv(_('Bad account !'), _('You cannot use this general account in this journal, check the tab \'Entry Controls\' on the related journal !')) raise osv.except_osv(_('Bad account !'), _('You cannot use this general account in this journal, check the tab \'Entry Controls\' on the related journal.'))
if vals.get('analytic_account_id',False): if vals.get('analytic_account_id',False):
if journal.analytic_journal_id: if journal.analytic_journal_id:

View File

@ -89,7 +89,7 @@ class common_report_header(object):
return '' return ''
def _get_sortby(self, data): def _get_sortby(self, data):
raise (_('Error!'), _('Not implemented!')) raise (_('Error!'), _('Not implemented.'))
def _get_filter(self, data): def _get_filter(self, data):
if data.get('form', False) and data['form'].get('filter', False): if data.get('form', False) and data['form'].get('filter', False):

View File

@ -35,7 +35,7 @@ class account_change_currency(osv.osv_memory):
context = {} context = {}
if context.get('active_id',False): if context.get('active_id',False):
if obj_inv.browse(cr, uid, context['active_id']).state != 'draft': if obj_inv.browse(cr, uid, context['active_id']).state != 'draft':
raise osv.except_osv(_('Error!'), _('You can only change currency for Draft Invoice !')) raise osv.except_osv(_('Error!'), _('You can only change currency for Draft Invoice.'))
pass pass
def change_currency(self, cr, uid, ids, context=None): def change_currency(self, cr, uid, ids, context=None):
@ -56,18 +56,18 @@ class account_change_currency(osv.osv_memory):
if invoice.company_id.currency_id.id == invoice.currency_id.id: if invoice.company_id.currency_id.id == invoice.currency_id.id:
new_price = line.price_unit * rate new_price = line.price_unit * rate
if new_price <= 0: if new_price <= 0:
raise osv.except_osv(_('Error!'), _('New currency is not configured properly !')) raise osv.except_osv(_('Error!'), _('New currency is not configured properly.'))
if invoice.company_id.currency_id.id != invoice.currency_id.id and invoice.company_id.currency_id.id == new_currency: if invoice.company_id.currency_id.id != invoice.currency_id.id and invoice.company_id.currency_id.id == new_currency:
old_rate = invoice.currency_id.rate old_rate = invoice.currency_id.rate
if old_rate <= 0: if old_rate <= 0:
raise osv.except_osv(_('Error!'), _('Current currency is not configured properly !')) raise osv.except_osv(_('Error!'), _('Current currency is not configured properly.'))
new_price = line.price_unit / old_rate new_price = line.price_unit / old_rate
if invoice.company_id.currency_id.id != invoice.currency_id.id and invoice.company_id.currency_id.id != new_currency: if invoice.company_id.currency_id.id != invoice.currency_id.id and invoice.company_id.currency_id.id != new_currency:
old_rate = invoice.currency_id.rate old_rate = invoice.currency_id.rate
if old_rate <= 0: if old_rate <= 0:
raise osv.except_osv(_('Error!'), _('Current currency is not configured properly !')) raise osv.except_osv(_('Error!'), _('Current currency is not configured properly.'))
new_price = (line.price_unit / old_rate ) * rate new_price = (line.price_unit / old_rate ) * rate
obj_inv_line.write(cr, uid, [line.id], {'price_unit': new_price}) obj_inv_line.write(cr, uid, [line.id], {'price_unit': new_price})
obj_inv.write(cr, uid, [invoice.id], {'currency_id': new_currency}, context=context) obj_inv.write(cr, uid, [invoice.id], {'currency_id': new_currency}, context=context)

View File

@ -85,7 +85,7 @@ class account_fiscalyear_close(osv.osv_memory):
fy2_period_set = ','.join(map(lambda id: str(id[0]), cr.fetchall())) fy2_period_set = ','.join(map(lambda id: str(id[0]), cr.fetchall()))
if not fy_period_set or not fy2_period_set: if not fy_period_set or not fy2_period_set:
raise osv.except_osv(_('UserError!'), _('The periods to generate opening entries were not found.')) raise osv.except_osv(_('UserError!'), _('The periods to generate opening entries cannot be found.'))
period = obj_acc_period.browse(cr, uid, data[0].period_id.id, context=context) period = obj_acc_period.browse(cr, uid, data[0].period_id.id, context=context)
new_fyear = obj_acc_fiscalyear.browse(cr, uid, data[0].fy2_id.id, context=context) new_fyear = obj_acc_fiscalyear.browse(cr, uid, data[0].fy2_id.id, context=context)
@ -100,7 +100,7 @@ class account_fiscalyear_close(osv.osv_memory):
_('The journal must have default credit and debit account.')) _('The journal must have default credit and debit account.'))
if (not new_journal.centralisation) or new_journal.entry_posted: if (not new_journal.centralisation) or new_journal.entry_posted:
raise osv.except_osv(_('UserError!'), raise osv.except_osv(_('UserError!'),
_('The journal must have centralized counterpart without the Skipping draft state option checked!')) _('The journal must have centralized counterpart without the Skipping draft state option checked.'))
#delete existing move and move lines if any #delete existing move and move lines if any
move_ids = obj_acc_move.search(cr, uid, [ move_ids = obj_acc_move.search(cr, uid, [

View File

@ -108,7 +108,7 @@ class account_invoice_refund(osv.osv_memory):
if inv.state in ['draft', 'proforma2', 'cancel']: if inv.state in ['draft', 'proforma2', 'cancel']:
raise osv.except_osv(_('Error !'), _('Cannot %s draft/proforma/cancel invoice.') % (mode)) raise osv.except_osv(_('Error !'), _('Cannot %s draft/proforma/cancel invoice.') % (mode))
if inv.reconciled and mode in ('cancel', 'modify'): if inv.reconciled and mode in ('cancel', 'modify'):
raise osv.except_osv(_('Error !'), _('Cannot %s invoice which is already reconciled, invoice should be unreconciled first. You can only Refund this invoice.') % (mode)) raise osv.except_osv(_('Error !'), _('Cannot %s invoice which is already reconciled, invoice should be unreconciled first. You can only refund this invoice.') % (mode))
if form.period.id: if form.period.id:
period = form.period.id period = form.period.id
else: else:
@ -144,7 +144,7 @@ class account_invoice_refund(osv.osv_memory):
if not period: if not period:
raise osv.except_osv(_('Data Insufficient !'), \ raise osv.except_osv(_('Data Insufficient !'), \
_('No Period is found on Invoice!')) _('No period found on the invoice.'))
refund_id = inv_obj.refund(cr, uid, [inv.id], date, period, description, journal_id) refund_id = inv_obj.refund(cr, uid, [inv.id], date, period, description, journal_id)
refund = inv_obj.browse(cr, uid, refund_id[0], context=context) refund = inv_obj.browse(cr, uid, refund_id[0], context=context)

View File

@ -41,7 +41,7 @@ class account_invoice_confirm(osv.osv_memory):
for record in data_inv: for record in data_inv:
if record['state'] not in ('draft','proforma','proforma2'): if record['state'] not in ('draft','proforma','proforma2'):
raise osv.except_osv(_('Warning!'), _("Selected Invoice(s) cannot be confirmed as they are not in 'Draft' or 'Pro-Forma' state!")) raise osv.except_osv(_('Warning!'), _("Selected invoice(s) cannot be confirmed as they are not in 'Draft' or 'Pro-Forma' state."))
wf_service.trg_validate(uid, 'account.invoice', record['id'], 'invoice_open', cr) wf_service.trg_validate(uid, 'account.invoice', record['id'], 'invoice_open', cr)
return {'type': 'ir.actions.act_window_close'} return {'type': 'ir.actions.act_window_close'}
@ -65,7 +65,7 @@ class account_invoice_cancel(osv.osv_memory):
for record in data_inv: for record in data_inv:
if record['state'] in ('cancel','paid'): if record['state'] in ('cancel','paid'):
raise osv.except_osv(_('Warning!'), _("Selected Invoice(s) cannot be cancelled as they are already in 'Cancelled' or 'Done' state!")) raise osv.except_osv(_('Warning!'), _("Selected invoice(s) cannot be cancelled as they are already in 'Cancelled' or 'Done' state."))
wf_service.trg_validate(uid, 'account.invoice', record['id'], 'invoice_cancel', cr) wf_service.trg_validate(uid, 'account.invoice', record['id'], 'invoice_cancel', cr)
return {'type': 'ir.actions.act_window_close'} return {'type': 'ir.actions.act_window_close'}

View File

@ -158,7 +158,7 @@ class account_move_journal(osv.osv_memory):
state = period.state state = period.state
if state == 'done': if state == 'done':
raise osv.except_osv(_('UserError!'), _('This period is already closed !')) raise osv.except_osv(_('UserError!'), _('This period is already closed.'))
company = period.company_id.id company = period.company_id.id
res = { res = {

View File

@ -36,7 +36,7 @@ class account_open_closed_fiscalyear(osv.osv_memory):
data = self.browse(cr, uid, ids, context=context)[0] data = self.browse(cr, uid, ids, context=context)[0]
period_journal = data.fyear_id.end_journal_period_id or False period_journal = data.fyear_id.end_journal_period_id or False
if not period_journal: if not period_journal:
raise osv.except_osv(_('Error !'), _('Please define End of year journal for the fiscal year.')) raise osv.except_osv(_('Error !'), _('You have to set the end of the fiscal year for this journal.'))
ids_move = move_obj.search(cr, uid, [('journal_id','=',period_journal.journal_id.id),('period_id','=',period_journal.period_id.id)]) ids_move = move_obj.search(cr, uid, [('journal_id','=',period_journal.journal_id.id),('period_id','=',period_journal.period_id.id)])
if ids_move: if ids_move:

View File

@ -53,9 +53,9 @@ class account_aged_trial_balance(osv.osv_memory):
period_length = data['form']['period_length'] period_length = data['form']['period_length']
if period_length<=0: if period_length<=0:
raise osv.except_osv(_('UserError!'), _('You must enter a period length greater than 0 !')) raise osv.except_osv(_('UserError!'), _('You must set a period length greater than 0.'))
if not data['form']['date_from']: if not data['form']['date_from']:
raise osv.except_osv(_('UserError!'), _('Enter a Start date !')) raise osv.except_osv(_('UserError!'), _('You must set a start date.'))
start = datetime.strptime(data['form']['date_from'], "%Y-%m-%d") start = datetime.strptime(data['form']['date_from'], "%Y-%m-%d")

View File

@ -150,7 +150,7 @@ class account_common_report(osv.osv_memory):
return result return result
def _print_report(self, cr, uid, ids, data, context=None): def _print_report(self, cr, uid, ids, data, context=None):
raise (_('Error!'), _('Not implemented!')) raise (_('Error!'), _('Not implemented.'))
def check_report(self, cr, uid, ids, context=None): def check_report(self, cr, uid, ids, context=None):
if context is None: if context is None:

View File

@ -36,7 +36,7 @@ class validate_account_move(osv.osv_memory):
data = self.browse(cr, uid, ids, context=context)[0] data = self.browse(cr, uid, ids, context=context)[0]
ids_move = obj_move.search(cr, uid, [('state','=','draft'),('journal_id','=',data.journal_id.id),('period_id','=',data.period_id.id)]) ids_move = obj_move.search(cr, uid, [('state','=','draft'),('journal_id','=',data.journal_id.id),('period_id','=',data.period_id.id)])
if not ids_move: if not ids_move:
raise osv.except_osv(_('Warning!'), _('Specified Journal does not have any account move entries in draft state for this period.')) raise osv.except_osv(_('Warning!'), _('Specified journal does not have any account move entries in draft state for this period.'))
obj_move.button_validate(cr, uid, ids_move, context=context) obj_move.button_validate(cr, uid, ids_move, context=context)
return {'type': 'ir.actions.act_window_close'} return {'type': 'ir.actions.act_window_close'}
@ -58,7 +58,7 @@ class validate_account_move_lines(osv.osv_memory):
move_ids.append(line.move_id.id) move_ids.append(line.move_id.id)
move_ids = list(set(move_ids)) move_ids = list(set(move_ids))
if not move_ids: if not move_ids:
raise osv.except_osv(_('Warning'), _('Selected Entry Lines does not have any account move enties in draft state')) raise osv.except_osv(_('Warning'), _('Selected Entry Lines does not have any account move enties in draft state.'))
obj_move.button_validate(cr, uid, move_ids, context) obj_move.button_validate(cr, uid, move_ids, context)
return {'type': 'ir.actions.act_window_close'} return {'type': 'ir.actions.act_window_close'}
validate_account_move_lines() validate_account_move_lines()

View File

@ -218,7 +218,7 @@ class account_analytic_plan_instance(osv.osv):
pids = ana_plan_instance_obj.search(cr, uid, [('name','=',vals['name']), ('code','=',vals['code']), ('plan_id','<>',False)], context=context) pids = ana_plan_instance_obj.search(cr, uid, [('name','=',vals['name']), ('code','=',vals['code']), ('plan_id','<>',False)], context=context)
if pids: if pids:
raise osv.except_osv(_('Error!'), _('A model having this name and code already exists !')) raise osv.except_osv(_('Error!'), _('A model with this name and code already exists.'))
res = acct_anal_plan_line_obj.search(cr, uid, [('plan_id','=',journal.plan_id.id)], context=context) res = acct_anal_plan_line_obj.search(cr, uid, [('plan_id','=',journal.plan_id.id)], context=context)
for i in res: for i in res:

View File

@ -58,7 +58,7 @@ class account_crossovered_analytic(osv.osv_memory):
flag = False flag = False
break break
if flag: if flag:
raise osv.except_osv(_('User Error!'),_('There are no Analytic lines related to Account %s.' % name)) raise osv.except_osv(_('User Error!'),_('There are no analytic lines related to account %s.' % name))
datas = { datas = {
'ids': [], 'ids': [],

View File

@ -38,7 +38,7 @@ class analytic_plan_create_model(osv.osv_memory):
raise osv.except_osv(_('Error!'), _('Please put a name and a code before saving the model.')) raise osv.except_osv(_('Error!'), _('Please put a name and a code before saving the model.'))
pids = anlytic_plan_obj.search(cr, uid, [], context=context) pids = anlytic_plan_obj.search(cr, uid, [], context=context)
if not pids: if not pids:
raise osv.except_osv(_('Error!'), _('Please define analytic plan.')) raise osv.except_osv(_('Error!'), _('There is no analytic plan defined.'))
plan_obj.write(cr, uid, [context['active_id']], {'plan_id':pids[0]}, context=context) plan_obj.write(cr, uid, [context['active_id']], {'plan_id':pids[0]}, context=context)
model_data_ids = mod_obj.search(cr, uid, [('model', '=', 'ir.ui.view'),('name', '=', 'view_analytic_plan_create_model')], context=context) model_data_ids = mod_obj.search(cr, uid, [('model', '=', 'ir.ui.view'),('name', '=', 'view_analytic_plan_create_model')], context=context)

View File

@ -127,7 +127,7 @@ class account_bank_statement_line(osv.osv):
if context is None: if context is None:
context = {} context = {}
if context.get('block_statement_line_delete', False): if context.get('block_statement_line_delete', False):
raise osv.except_osv(_('Warning!'), _('Delete operation not allowed ! \ raise osv.except_osv(_('Warning!'), _('Delete operation not allowed. \
Please go to the associated bank statement in order to delete and/or modify bank statement line.')) Please go to the associated bank statement in order to delete and/or modify bank statement line.'))
return super(account_bank_statement_line, self).unlink(cr, uid, ids, context=context) return super(account_bank_statement_line, self).unlink(cr, uid, ids, context=context)

View File

@ -393,7 +393,7 @@ class coda_bank_statement_line(osv.osv):
if context is None: if context is None:
context = {} context = {}
if context.get('block_statement_line_delete', False): if context.get('block_statement_line_delete', False):
raise osv.except_osv('Warning', _('Delete operation not allowed !')) raise osv.except_osv('Warning', _('Delete operation not allowed.'))
return super(account_bank_statement_line, self).unlink(cr, uid, ids, context=context) return super(account_bank_statement_line, self).unlink(cr, uid, ids, context=context)
coda_bank_statement_line() coda_bank_statement_line()

View File

@ -107,7 +107,7 @@ class account_move_line(osv.osv):
if line.id not in line2bank and line.partner_id.bank_ids: if line.id not in line2bank and line.partner_id.bank_ids:
line2bank[line.id] = line.partner_id.bank_ids[0].id line2bank[line.id] = line.partner_id.bank_ids[0].id
else: else:
raise osv.except_osv(_('Error !'), _('No partner is defined on entry line.')) raise osv.except_osv(_('Error !'), _('There is no partner defined on the entry line.'))
return line2bank return line2bank
_columns = { _columns = {

View File

@ -822,7 +822,7 @@ class account_voucher(osv.osv):
def unlink(self, cr, uid, ids, context=None): def unlink(self, cr, uid, ids, context=None):
for t in self.read(cr, uid, ids, ['state'], context=context): for t in self.read(cr, uid, ids, ['state'], context=context):
if t['state'] not in ('draft', 'cancel'): if t['state'] not in ('draft', 'cancel'):
raise osv.except_osv(_('Invalid action !'), _('Cannot delete Voucher(s) which are already opened or paid.')) raise osv.except_osv(_('Invalid Action !'), _('Cannot delete voucher(s) which are already opened or paid.'))
return super(account_voucher, self).unlink(cr, uid, ids, context=context) return super(account_voucher, self).unlink(cr, uid, ids, context=context)
def onchange_payment(self, cr, uid, ids, pay_now, journal_id, partner_id, ttype='sale'): def onchange_payment(self, cr, uid, ids, pay_now, journal_id, partner_id, ttype='sale'):
@ -952,11 +952,11 @@ class account_voucher(osv.osv):
if amount_residual > 0: if amount_residual > 0:
account_id = line.voucher_id.company_id.expense_currency_exchange_account_id account_id = line.voucher_id.company_id.expense_currency_exchange_account_id
if not account_id: if not account_id:
raise osv.except_osv(_('Warning!'),_("First configure the 'Income Currency Rate' on the company,after that create accounting entry for currency rate difference.")) raise osv.except_osv(_('Warning!'),_("First you have to configure the 'Income Currency Rate' on the company, then create accounting entry for currency rate difference."))
else: else:
account_id = line.voucher_id.company_id.income_currency_exchange_account_id account_id = line.voucher_id.company_id.income_currency_exchange_account_id
if not account_id: if not account_id:
raise osv.except_osv(_('Warning!'),_("First configure the 'Expense Currency Rate' on the company,after that create accounting entry for currency rate difference.")) raise osv.except_osv(_('Warning!'),_("First you have to configure the 'Expense Currency Rate' on the company, then create accounting entry for currency rate difference."))
# Even if the amount_currency is never filled, we need to pass the foreign currency because otherwise # Even if the amount_currency is never filled, we need to pass the foreign currency because otherwise
# the receivable/payable account may have a secondary currency, which render this field mandatory # the receivable/payable account may have a secondary currency, which render this field mandatory
account_currency_id = company_currency <> current_currency and current_currency or False account_currency_id = company_currency <> current_currency and current_currency or False