From 75f80571dfaf2c92ffee501a01ca8bf2574e6f69 Mon Sep 17 00:00:00 2001 From: Antonin Bourguignon Date: Thu, 14 Feb 2013 18:34:13 +0100 Subject: [PATCH] [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 --- addons/account/account_invoice.py | 4 ++-- addons/auth_signup/res_users.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/account/account_invoice.py b/addons/account/account_invoice.py index fe10e10f7b4..e1e0fccd253 100644 --- a/addons/account/account_invoice.py +++ b/addons/account/account_invoice.py @@ -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: diff --git a/addons/auth_signup/res_users.py b/addons/auth_signup/res_users.py index 077a0feded9..4e86de5b474 100644 --- a/addons/auth_signup/res_users.py +++ b/addons/auth_signup/res_users.py @@ -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',