[IMP] introduce two examples of use of the new get_config_warning() helper
Typical use: self.pool.get("res.config.settings").get_config_warning(cr, _("Excpt message"), context) More documentation and examples in res_config.py doc (see method get_config_warning()) bzr revid: abo@openerp.com-20130214173413-lm4jm86eolinwz69
This commit is contained in:
parent
496a580335
commit
75f80571df
|
@ -586,8 +586,8 @@ class account_invoice(osv.osv):
|
|||
pay_res_id = pay_line_data and pay_line_data[0].get('value_reference',False) and int(pay_line_data[0]['value_reference'].split(',')[1]) or False
|
||||
|
||||
if not rec_res_id and not pay_res_id:
|
||||
raise osv.except_osv(_('Configuration Error!'),
|
||||
_('Cannot find a chart of account, you should create one from Settings\Configuration\Accounting menu.'))
|
||||
raise self.pool.get('res.config.settings').get_config_warning(cr, _('Cannot find any chart of account: you can create a new one from %(menu:account.menu_account_config)s.'), context)
|
||||
|
||||
if type in ('out_invoice', 'out_refund'):
|
||||
acc_id = rec_res_id
|
||||
else:
|
||||
|
|
|
@ -268,7 +268,7 @@ class res_users(osv.Model):
|
|||
mail_state = mail_obj.read(cr, uid, mail_id, ['state'], context=context)
|
||||
|
||||
if mail_state and mail_state['state'] == 'exception':
|
||||
raise osv.except_osv(_("Cannot send email: no outgoing email server configured.\nYou can configure it under Settings/General Settings."), user.name)
|
||||
raise self.pool.get('res.config.settings').get_config_warning(cr, _("Cannot send email: no outgoing email server configured.\nYou can configure it under %(menu:base_setup.menu_general_configuration)s."), context)
|
||||
else:
|
||||
return {
|
||||
'type': 'ir.actions.client',
|
||||
|
|
Loading…
Reference in New Issue