"object of type 'int' has no len()"

Bug #976909 reported by GEM
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Web Client
Won't Fix
Undecided
Unassigned

Bug Description

Hi,
this bug is for web client 6.0 (perhaps for 5.0 too)
I saw some bugs with this message "object of type 'int' has no len()" , but seems to be not this I had, I explain :

I have 2 classes.
For each class, I have 2 fields type many2many (then, there is a total of 4 m2m for the 2 classes)
I want to update values of the first class with values of the second class (there is a common key between them naturally), the first field of the class one is updated with the first field of the class two, the second field of the class one is updated with the second field of the class two, using the common key of the 2 fields of the two classes (the key is a type integer).
to update the first class with the second I use an on_change method, inwhich I return the result with return {'value': res}
This return works with client gtk, but with client web I have this error when I do "save" for the form :

   84 if (self.ids or self.id) and self.count == 0:
   85 if self.ids and len(self.ids) < self.limit:
   86 self.count = len(self.ids)
   87 else:
self = Screen, self.ids = 11, builtin len = <built-in function len>, self.limit = 50

<type 'exceptions.TypeError'>: object of type 'int' has no len()
      args = ("object of type 'int' has no len()",)
      message = "object of type 'int' has no len()"

If I try to return just one field (the one or the second), it works in client web too.

I find a patch to solve this bug by changing in client web (in fact I do a list of integer which can be read by method len() :

in openerp-web/addons/openerp/widgets/screen.py line 85 :
-if self.ids and len(self.ids) < self.limit:
+if isinstance(self.ids, (int, long)):
+ self.ids = [self.ids]
+if self.ids and len(self.ids) < self.limit:

Bye

GEM (nimp3)
description: updated
description: updated
description: updated
Revision history for this message
Amit Parik (amit-parik) wrote :

Hello GEM,

First of all latest 6.1 is released and we have already developed a new web client for 6.1.

Our bug management policy are mainly for trunk version as well as bocking point of stable which is the generic way.

I have checked your issue and this type of code(customised) not in official addons. So we can not consider this issue as a generic way.

So would you please try with latest 6.1.

For these type of issues of v6, If you have a support and maintenance contact with us then you can conact our OPW team at <email address hidden>.

Thanks for understanding!

Changed in openobject-client-web:
status: New → Won't Fix
Revision history for this message
GEM (nimp3) wrote :

Hi Amit,
I understand the policy of openerp, I did not work actually with the 6.1 version (future 7 if I understood well), I suppose this should work if the client web use directly the orm server.
Good luck to the openerp team, with the debugging of the 7 version ;) .
Bye

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.