[6.1] GTK Client whitespace trimming (or maybe module, or maybe framework)
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Odoo GTK Client (MOVED TO GITHUB) |
New
|
Undecided
|
Unassigned |
Bug Description
If you look at this function (although there are many more) the GTK client trims the whitespace in the return causing errors when the field only contains whitespace and annoying errors when it doesn't. This example os from sale_layout, however many other modules have a similar requirement to support whitespace e.g. ' - ' gets trimmed to just '-' by GTK in product_
Note I am only assuming it is GTK behaviour as it doesn't exhibit when the value is set by defaults, but does when triggered by onchange or user input
def onchange_
temp = {}
if (not type):
return {}
if type != 'article':
temp = {
},
}
if type == 'line':
if type == 'break':
if type == 'subtotal':
return temp
return {}
affects: | openobject-addons → openobject-client |
Indeed here is the offending function in char.py line 43 I think self.widget. get_text( )).strip( ) sjohannes. wordpress. com/2009/ 04/24/unicode- with-python- 2-and-pygtk/ 'utf-8' ) set_client( model, value or False)
def set_value(self, model, model_field):
value = tools.ustr(
## PyGTK functions always return strings as str objects. In most (all?) cases,
##the strings are encoded in UTF-8. Ideally,Python programs should use unicode strings internally,
## so it’s wise to convert the output of PyGTK function calls to unicode.
## for more info:http://
value = value.decode(
return model_field.
value = tools.ustr( self.widget. get_text( )).strip( )