Skip to content

Commit

Permalink
[FIX] Fix account_budget name unicode error
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Sandy Carter committed May 16, 2014
1 parent 1397b7a commit 5597c25
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion addons/account_budget/account_budget.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -116,7 +117,7 @@ def _prac_amt(self, cr, uid, ids, context=None):
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'):
Expand Down

0 comments on commit 5597c25

Please sign in to comment.