From 5597c25acf0b98b6e73f5e305c268c2a4da88d79 Mon Sep 17 00:00:00 2001 From: Sandy Carter Date: Fri, 16 May 2014 16:43:38 -0400 Subject: [PATCH] [FIX] Fix account_budget name unicode error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix bug https://bugs.launchpad.net/openobject-addons/+bug/1292245: Invoice budget's warning when crossovered budget lines are not related to any account will cause a UnicodeEncodeError if the account has unicode-only characters such as é. Make sure that the budget name is a unicode to avoid UnicodeEncodeError which happens when budget name contains UTF-8 characters. Signed-off-by: Sandy Carter --- addons/account_budget/account_budget.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/account_budget/account_budget.py b/addons/account_budget/account_budget.py index daec4ea0a2f..c20871ed65e 100644 --- a/addons/account_budget/account_budget.py +++ b/addons/account_budget/account_budget.py @@ -22,6 +22,7 @@ import datetime from openerp.osv import fields, osv +from openerp.tools import ustr from openerp.tools.translate import _ import openerp.addons.decimal_precision as dp @@ -116,7 +117,7 @@ class crossovered_budget_lines(osv.osv): for line in self.browse(cr, uid, ids, context=context): acc_ids = [x.id for x in line.general_budget_id.account_ids] if not acc_ids: - raise osv.except_osv(_('Error!'),_("The Budget '%s' has no accounts!") % str(line.general_budget_id.name)) + raise osv.except_osv(_('Error!'),_("The Budget '%s' has no accounts!") % ustr(line.general_budget_id.name)) date_to = line.date_to date_from = line.date_from if context.has_key('wizard_date_from'):