Read function inconsistent between orm and orm_memory

Bug #366089 reported by Xavier Fernandez http://www.smile.fr
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Odoo Server (MOVED TO GITHUB)
Status tracked in Trunk
5.0
Fix Released
Undecided
Anup(SerpentCS)
Trunk
Fix Released
Undecided
Unassigned

Bug Description

In orm.py:

The function read in orm object is designed to return a single dictionnary if the argument 'ids' is a single id and a list of dictionnary if 'ids' is itself a list.

The function read in orm_memory seems to have been designed to do the same but currently it can only return a list:

'ids' is tested at the beginning but is also modified:
            if isinstance(ids, (int, long)):
                ids = [ids]
making the last check located a few lines later totally useless:
            if isinstance(ids, (int, long)):
                return result[0]

An easy patch is attached (I tested it quickly).

Revision history for this message
Xavier Fernandez http://www.smile.fr (xav-fernandez) wrote :
Revision history for this message
Fabien (Open ERP) (fp-tinyerp) wrote :

fixed in trunk.

Changed in openobject-server:
status: New → Fix Released
Revision history for this message
Cédric Krier (cedk) wrote :

This issue also affect 5.0, the patch must be back-ported to get a consistent API.

Revision history for this message
Anup(SerpentCS) (anup-serpent) wrote :

Hello Cedric,

    I agree with you. Indeed it must be changed. Thanks a lot for pointing out such a crucial issue. I have attached solution for 5.0. Would you please check the attached patch and notify?
    We appreciate your efforts.Keep Posting.

Thanks.

Revision history for this message
Cédric Krier (cedk) wrote :

@Anup
Why don't you make just a backport of the fix of the trunk?

Revision history for this message
Anup(SerpentCS) (anup-serpent) wrote :

Hello Guys,

   It has been fixed by revision 2157 <email address hidden>

Thanks.

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.