null value for fields.related with type in ('many2one','many2many') returns False instead of []

Bug #589083 reported by Frédéric (Ferme du Sart)
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Server (MOVED TO GITHUB)
Fix Released
Undecided
Unassigned

Bug Description

This may raise an exception:

orm.py, line 231, in __getitem__
    elif f._type in ('one2many', 'many2many') and len(data[n]):
TypeError: object of type 'bool' has no len()

Revision history for this message
Frédéric (Ferme du Sart) (frederic-declercq) wrote :
Revision history for this message
Stephane Wirtel (OpenERP) (stephane-openerp) wrote :

You can remove the length function in the condition

Revision history for this message
Frédéric (Ferme du Sart) (frederic-declercq) wrote :

On removing the length function, maybe you're right, and many2many / one2many will can answer False.

But we may have to overwrite many functions in standard modules (ie: fields.function, stock validation, accounting write...) because devoloppers may not have think about a False answer for fields moved to related.

Revision history for this message
Frédéric (Ferme du Sart) (frederic-declercq) wrote :

Notice:
Linked patch is for fields.py

Revision history for this message
Jay Vora (Serpent Consulting Services) (jayvora) wrote :

Hello Fredric,

I would like to know how you met to this error?

Thanks.

Revision history for this message
Jay Vora (Serpent Consulting Services) (jayvora) wrote :

It has been covered by revision 2087 <email address hidden>.
Thanks.

Changed in openobject-server:
milestone: none → 5.0.13
status: New → Fix Released
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.