field names might not accept accentuated characters
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenERP Brazilian Portuguese Localization (pt_BR) |
Confirmed
|
Undecided
|
Unassigned |
Bug Description
Hello,
it looks like if we use accentuated chars in business object fields as it is currently done in the l10n-br module, then we have the following error while navigating with the web-client under v6:
[23/Aug/
File "/usr/lib/
cherrypy.
File "/usr/lib/
return self.callable(
File "/opt/openerp-
res = func(*args, **kw)
File "/opt/openerp-
return request.handler()
File "/usr/lib/
return self.callable(
File "/opt/openerp-
return fn(*args, **kw)
File "/opt/openerp-
res = func(*args, **kw)
File "/opt/openerp-
'ids': kw.get('id')})
File "/opt/openerp-
report_
File "/opt/openerp-
return execute(action, **data)
File "/opt/openerp-
search_view = data['search_
File "/opt/openerp-
return Form().
File "/opt/openerp-
return fn(*args, **kw)
File "/opt/openerp-
res = func(*args, **kw)
File "/opt/openerp-
form = self.create_
File "/opt/openerp-
return tw.form_
File "/opt/openerp-
res = func(self, *args, **kw)
File "/opt/openerp-
filter_
File "/opt/openerp-
res = func(self, *args, **kw)
File "/opt/openerp-
self.
File "/opt/openerp-
self.
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 5: ordinal not in range(128)
It seems that it doesn't come from the Portuguese language (if you only load Portuguese without installing l10n_br it's working), but only comes from the accents in the field names.
adding some print statements, I can see that trying to access the sale order list, I have those fields to sort in search.py line 269:
[('origin', u'Documento Origem', 'char'), ('incoterm', u'Forma de Entrega', 'selection'), ('create_date', u'Data de Cria\xe7\xe3o', 'date'), ('true_project_id', 'Project', 'many2one'), ('name', u'Refer\xeancia da Ordem', 'char'), ('order_line', u'Linhas de Pedido', 'one2many'), ('picking_policy', u'Politica de Separa\xe7\xe3o', 'selection'), ('order_policy', u'Pol\xedtica de Embarque', 'selection'), ('partner_
I tried several things but couldn't have the lambda + cmp methods working upon that list.
Since we could also load field translations and put them in plain English, may be this would be the best solution?
Thoughts?
Changed in openerp.pt-br-localiz: | |
status: | Fix Committed → Confirmed |
All right,
so one more detail about this one:
the field that create the web-client bug is the ('fiscal_ operation_ id', 'Opera\ xc3\xa7\ xc3\xa3o Fiscal', 'many2one') field on the sale.order that is brought by the l10n_br localization.
Actually, the other sale.order fields from the list given here also have accents, but those are brought by the translation layer, and consequently comes as unicode (u'translated_ field_name' ). That's why they don't cause bugs if l10n_br isn't installed.
The question is whether Openobject should accept accents in field names. Using the same reasoning as for bug https:/ /bugs.launchpad .net/openobject -server/ +bug/613721 (OpenERP should truly be RAD), I think we should accept them, at least for the fields manually created in the user interface.
Then I'll propose a patch that will encode in unicode field names that are not unicode inside self.fields_ list.sort( lambda x, y: cmp(x[1], y[1]))
May be we should encode all field names at the source, but that choice is up to OpenERP S.A. I guess.