[FIX] Fix account_budget name unicode error

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 <sandy.carter@savoirfairelinux.com>
This commit is contained in:
Sandy Carter 2014-05-16 16:43:38 -04:00
parent 1397b7aa34
commit 5597c25acf
1 changed files with 2 additions and 1 deletions

View File

@ -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'):