← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 366089] Re: Read function inconsistent between orm and orm_memory

 

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.

** Patch added: "orm_read_patch.diff"
   https://bugs.launchpad.net/openobject-server/5.0/+bug/366089/+attachment/1758277/+files/orm_read_patch.diff

** Changed in: openobject-server/5.0
       Status: Confirmed => In Progress

-- 
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.
https://bugs.launchpad.net/bugs/366089

Title:
  Read function inconsistent between orm and orm_memory

Status in OpenObject Server:
  Fix Released
Status in OpenObject Server 5.0 series:
  In Progress
Status in OpenObject Server trunk series:
  Fix Released

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).