Merge lp:~savoirfairelinux-openerp/ocb-addons/crossovered_unicode_1292245 into lp:ocb-addons

Status: Merged
Approved by: Holger Brunn (Therp)
Approved revision: no longer in the source branch.
Merged at revision: 10059
Proposed branch: lp:~savoirfairelinux-openerp/ocb-addons/crossovered_unicode_1292245
Merge into: lp:ocb-addons
Diff against target: 20 lines (+2/-1)
1 file modified
account_budget/account_budget.py (+2/-1)
To merge this branch: bzr merge lp:~savoirfairelinux-openerp/ocb-addons/crossovered_unicode_1292245
Reviewer Review Type Date Requested Status
Raphaël Valyi - http://www.akretion.com Approve
Holger Brunn (Therp) code review Approve
Pedro Manuel Baeza code review Approve
Review via email: mp+210926@code.launchpad.net

Description of the change

This fixes bug lp:1292245

Makes sure that the budget name is a unicode to avoid UnicodeEncodeError which happens when budget name contains UFT-8 characters.

To post a comment you must log in.
Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

Thanks!

review: Approve (code review)
Revision history for this message
Holger Brunn (Therp) (hbrunn) :
review: Approve (code review)
Revision history for this message
Sandy Carter (http://www.savoirfairelinux.com) (sandy-carter) wrote :

I've been told it's better to use tools.ustr()

Revision history for this message
Raphaël Valyi - http://www.akretion.com (rvalyi) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account_budget/account_budget.py'
2--- account_budget/account_budget.py 2013-10-10 08:41:57 +0000
3+++ account_budget/account_budget.py 2014-03-18 13:56:57 +0000
4@@ -22,6 +22,7 @@
5 import datetime
6
7 from openerp.osv import fields, osv
8+from openerp.tools import ustr
9 from openerp.tools.translate import _
10
11 import openerp.addons.decimal_precision as dp
12@@ -118,7 +119,7 @@
13 acc_ids = [x.id for x in line.general_budget_id.account_ids]
14 acc_ids = account_obj._get_children_and_consol(cr, uid, acc_ids, context=context)
15 if not acc_ids:
16- raise osv.except_osv(_('Error!'),_("The Budget '%s' has no accounts!") % str(line.general_budget_id.name))
17+ raise osv.except_osv(_('Error!'),_("The Budget '%s' has no accounts!") % ustr(line.general_budget_id.name))
18 date_to = line.date_to
19 date_from = line.date_from
20 if context.has_key('wizard_date_from'):