account_budget has UnicodeEncodeError when raising except_osv

Bug #1292245 reported by Sandy Carter (http://www.savoirfairelinux.com)
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
New
Undecided
OpenERP Publisher's Warranty Team
OpenERP Community Backports (Addons)
Status tracked in 7.0
7.0
Fix Committed
Undecided
Unassigned

Bug Description

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 é.

How to reproduce:
* Fresh database, install account_budget without demo.
* Under menu (Invoicing|Budgets|Budgets)
** Create a new budget, name it what you want, add the dates and code you want.
** Add a budget line, choose whatever dates you want and add a new budgetary position by clicking Create and Edit.
*** In the Budgetary Position form, put whatever code you want, but Give it a name with a utf character such as "Testé".
*** Do not add an account to the budgetary position.
*** Save the budgetary position
** Save and close the budgetary line
* Save the Budget form

Expected output:
OpenERP outputs a Warning (except_osv) which reads:
Error!

The Budget 'Testé' has no accounts!

Actual output:
OpenERP outputs an error message with the following output

Server Traceback (most recent call last):
  File "web/addons/web/session.py", line 89, in send
    return openerp.netsvc.dispatch_rpc(service_name, method, args)
  File "openerp/netsvc.py", line 358, in dispatch_rpc
    result = ExportService.getService(service_name).dispatch(method, params)
  File "openerp/service/web_services.py", line 626, in dispatch
    res = fn(db, uid, *params)
  File "openerp/osv/osv.py", line 190, in execute_kw
    return self.execute(db, uid, obj, method, *args, **kw or {})
  File "openerp/osv/osv.py", line 132, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "openerp/osv/osv.py", line 199, in execute
    res = self.execute_cr(cr, uid, obj, method, *args, **kw)
  File "openerp/osv/osv.py", line 187, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "server/openerp/osv/orm.py", line 3674, in read
    result = self._read_flat(cr, user, select, fields, context, load)
  File "openerp/osv/orm.py", line 3795, in _read_flat
    res2 = self._columns[f].get(cr, self, ids, f, user, context=context, values=res)
  File "openerp/osv/fields.py", line 1142, in get
    result = self._fnct(obj, cr, uid, ids, name, self._arg, context)
  File "account_budget/account_budget.py", line 139, in _prac
    res[line.id] = self._prac_amt(cr, uid, [line.id], context=context)[line.id]
  File "account_budget/account_budget.py", line 119, in _prac_amt
    raise osv.except_osv(_('Error!'),_("The Budget '%s' has no accounts!") % str(line.general_budget_id.name))
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 4: ordinal not in range(128)

Version 7.0
addons: r9900
server: r5259
web: 4159

Related branches

tags: added: maintenance
Changed in openobject-addons:
assignee: nobody → OpenERP Publisher's Warranty Team (openerp-opw)
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.