String index out of range opening some views (like H.R. Working Hours)
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
KDE OpenObject Client |
Invalid
|
Undecided
|
Unassigned |
Bug Description
Trying to open some views, like the Working Hours in the human resources module, will cause Koo to halt while displaying again and again (about one each second) this traceback:
---
Traceback (most recent call last):
File "/usr/local/
value = self.value( index.row(), index.column(), index.internalP
File "/usr/local/
return model.value( field )
File "/usr/local/
self.
File "/usr/local/
self.
File "/usr/local/
self.
File "/usr/local/
if condition[i][2] and isinstance(
IndexError: string index out of range
---
Ok, I debuged it a bit and found that the root problem was on the view (had invalid attrs), but the Web and GTK clients just ignore this invalid attrs, while Koo halts:
This is the code where the IndexError is raised: s.items( ): condition[ i][2], list):
---
for attribute, condition in attributeChange
for i in range(0, len(condition)):
if condition[i][2] and isinstance(
---
The problematic field is defined like this: {'invisible' :'True' }" domain= "[('type' ,'=','service' )]" name="product_id" on_change= "on_change_ unit_amount( product_ id, unit_amount, product_uom_id)" required="1"/>
<field attrs="
If you debug, you can see this:
ipdb> pp fieldName :'True' }" s.items( )
'product_id'
ipdb> pp attributes
u"{'invisible'
ipdb> pp attributeChanges
{'invisible': 'True'}
ipdb> pp attributeChange
[('invisible', 'True')]
ipdb> pp condition[0] # Condition elements aren't list or tuples! so we can't do condition[i][2]!
'T'
ipdb> pp condition[0][2] # This won't work: condition[0] is a single-char string
*** IndexError: IndexError('string index out of range',)
So, the problem is that the attrs was invalid: "attrs: Python map defining dynamic conditions on these attributes: readonly, invisible, required based on search tuples on other field values"
That is, the root problem, it's not a Koo problem, but a problem in the view. Though Koo is not handling it like the other clients (ignoring it), but it instead prints a stacktrace for each record (that hungs the client for several minutes).