Comment 1 for bug 562881

Revision history for this message
Borja López Soilán (NeoPolus) (borjals) wrote :

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:
---
   for attribute, condition in attributeChanges.items():
    for i in range(0, len(condition)):
     if condition[i][2] and isinstance(condition[i][2], list):
---

The problematic field is defined like this:
      <field attrs="{'invisible':'True'}" domain="[('type','=','service')]" name="product_id" on_change="on_change_unit_amount(product_id, unit_amount, product_uom_id)" required="1"/>

If you debug, you can see this:

ipdb> pp fieldName
'product_id'
ipdb> pp attributes
u"{'invisible':'True'}"
ipdb> pp attributeChanges
{'invisible': 'True'}
ipdb> pp attributeChanges.items()
[('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).