Comment 1 for bug 920033

Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote : Re: [6.1[RC]]: Cannot use uid along with attrs

Hi,

The "uid" dynamic value is not a valid field to be evaluated client-side. This was working previously because the clients (GTK/Web) happened to have a "uid" value available in the evaluation context, but that is not guaranteed to be the case, as far as I know.
What you are trying to do seems a little bit of a corner case (none of the standard addons do it), so I'm not sure it would be worth adding a global "uid" value to client-side evaluation context.

What we often want to do is to selectively hide fields based on user groups or document states. These 2 cases are covered by the API with the ``states`` and ``groups`` attributes.
Here you want the behavior to differ when the user is viewing one of her "own documents". A simple workaround to accomplish this would be to add a function field to that document, and have it always return the current user ID. If you named the field "uid" you could probably keep your existing `attrs`.

As for adding "uid" to the default client-side (web) evaluation context, and making it a permanent API feature, it should be discussed with the web team, so I'm reassigning it to them.