Comment 4 for bug 1124130

Revision history for this message
Gustavo Adrian Marino (gamarino) wrote : Re: [Bug 1124130] Re: [table].id IN (false) HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.

The problem arises because the function receives 3 types of res
dictionaries:
- values with None/False
- simple ints
- tuples (id, name)
The attached patch handles the three cases correctly

2013/2/13 Olivier Dony (OpenERP) <email address hidden>

> Looks correct, thanks for the analysis and for the patch!
>
> ** Changed in: openobject-server
> Importance: Undecided => Medium
>
> ** Changed in: openobject-server
> Status: New => Confirmed
>
> ** Changed in: openobject-server
> Assignee: (unassigned) => OpenERP's Framework R&D
> (openerp-dev-framework)
>
> --
> You received this bug notification because you are subscribed to OpenERP
> Server.
> https://bugs.launchpad.net/bugs/1124130
>
> Title:
> [table].id IN (false) HINT: No operator matches the given name and
> argument type(s). You might need to add explicit type casts.
>
> Status in OpenERP Server:
> Confirmed
>
> Bug description:
> When getting many2one fields via the value= parameter which *name* is
> False, the error above is thrown.
>
> This is caused by the fact that bool is an instance of int and
> http://bazaar.launchpad.net/~openerp/openobject-
> server/trunk/view/head:/openerp/osv/fields.py#L465 filters out [x for
> x in res.values() if isinstance(x, (int,long))]
>
> This applies to 6.1, 7.0, trunk, MPs follow
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/openobject-server/+bug/1124130/+subscriptions
>

--

Gustavo Adrian Marino

Mobile: +54 911 5498 2515

Email: <email address hidden>

Skype: gustavo.adrian.marino