From a41883663872458109c8c8ddceefb929f021e0ef Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Fri, 27 Apr 2012 19:08:37 +0200 Subject: [PATCH] [FIX] Fix issue in constraint function for res_users. --- asterisk_click2dial/asterisk_click2dial.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/asterisk_click2dial/asterisk_click2dial.py b/asterisk_click2dial/asterisk_click2dial.py index acb42a5..ba5cf6f 100644 --- a/asterisk_click2dial/asterisk_click2dial.py +++ b/asterisk_click2dial/asterisk_click2dial.py @@ -318,10 +318,11 @@ class res_users(osv.osv): def _check_validity(self, cr, uid, ids): for user in self.browse(cr, uid, ids): for check_string in [('Internal number', user.internal_number), ('Caller ID', user.callerid)]: - try: - plom = check_string[1].encode('ascii') - except UnicodeEncodeError: - raise osv.except_osv(_('Error :'), _("The '%s' for the user '%s' should only have ASCII caracters" % (check_string[0], user.name))) + if check_string[1]: + try: + plom = check_string[1].encode('ascii') + except UnicodeEncodeError: + raise osv.except_osv(_('Error :'), _("The '%s' for the user '%s' should only have ASCII caracters" % (check_string[0], user.name))) return True _constraints = [