uid not supported in attrs in web client only

Bug #497967 reported by Sebastien LANGE - http://www.Syleam.fr
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Web Client
Fix Released
Wishlist
Amit Mendapara

Bug Description

In GTK client rev 1016, the uid is supported in attrs but not web client.

http://bazaar.launchpad.net/~openerp/openobject-client/5.0/revision/1016

Thanks

Related branches

Revision history for this message
Sananaz (Open ERP) (sma-tiny) wrote :

Hello Sebastien,

We have applied attrs attribute with button tag for uid like:
<button colspan="2" name="483" string="Select Invoices to Pay" type="action" attrs="{'invisible':[(uid,'=',1)]}"/>

When i connect using uid=1 then button is display on gtk form it means gtk also does not support uid on attrs...so please give us example how you set uid with attrs. So that we can test on both gtk and webclient.

Thanks.

Revision history for this message
Christophe CHAUVET (christophe-chauvet) wrote :

Hi sma

You can test this on the crm.case object like

<field name="priority" attrs="{'readonly': [('user_id','!=', uid)]}"/>

Only the user who is affect to this case can change the priority

Regards,

Revision history for this message
Amit Mendapara (cristatus) wrote :

Web client only supports basic expressions (should be compatible with JavaScript) and values will be evaluated against current view fields. As `uid` in this expression is not a defined field in the view, it won't get evaluated (in gtk it's evaluated by python code, while in web client it's JavaScript) so some python specific expressions/vars are not available in web client, like `uid, date, context` etc.

For workaround to this problem, you can define a hidden (invisible) field `uid` and setting it's default value to current `uid` in the view.

Changed in openobject-client-web:
status: New → Won't Fix
Revision history for this message
Christophe CHAUVET (christophe-chauvet) wrote :

Hi

Sorry but i think this issue must be fix, it works for context and domain and why not in attrs ?

And this issue works with the GTK client, the both clients must be have the same features.

In our case, we use readonly in attrs (not only invisible)

Changed in openobject-client-web:
status: Won't Fix → Confirmed
Revision history for this message
Amit Mendapara (cristatus) wrote :

In order to implement the feature (python expression evaluation), we need to send request (ajax) to server (web server) every time which might be slow for `attrs` (intended for quick UI changes).

The original requirement of the attrs feature (attrs first implemented in eTiny) are to enable quick UI changes using simple JavaScript compatible expressions based on the current form state.

This is not a bug but a design limitation of the web client feature...

Changed in openobject-client-web:
assignee: nobody → ame (Tiny) (ame-tiny)
Revision history for this message
Raphaël Valyi - http://www.akretion.com (rvalyi) wrote : Re: [Bug 497967] Re: uid not supported in attrs in web client only

Hello,

I understand the limitation due to the lack of a Python runtime in the
browser. However, I think it's possible to work a bit more on the Javascript
expression parser in order to change the expression eventually (regexp
replacement eventually) and support a few more basic stuff, time and uid
being included. I'm pretty sure the Javascript and Python syntax are not so
different for the very basic maths operations involved, so defining the
right values in the the expression scope, such as uid and time and
eventually hacking a bit the expression (most basic evaluated requirement)
and eventually making a few basic methods available would improve the
situation a lot, no?

I think that uid and time are so basic things that if they are not supported
the feature loss is too large...

Thoughts?

On Wed, Dec 23, 2009 at 4:49 AM, ame (Tiny) <email address hidden> wrote:

> In order to implement the feature (python expression evaluation), we
> need to send request (ajax) to server (web server) every time which
> might be slow for `attrs` (intended for quick UI changes).
>
> The original requirement of the attrs feature (attrs first implemented
> in eTiny) are to enable quick UI changes using simple JavaScript
> compatible expressions based on the current form state.
>
> This is not a bug but a design limitation of the web client feature...
>
>
> ** Changed in: openobject-client-web
> Assignee: (unassigned) => ame (Tiny) (ame-tiny)
>
> --
> uid not supported in attrs in web client only
> https://bugs.launchpad.net/bugs/497967
> You received this bug notification because you are a member of OpenERP
> Drivers, which is subscribed to OpenObject Web Client.
>
> Status in OpenObject Web Client: Confirmed
>
> Bug description:
> In GTK client rev 1016, the uid is supported in attrs but not web client.
>
> http://bazaar.launchpad.net/~openerp/openobject-client/5.0/revision/1016
>
> Thanks
>
>
>

Changed in openobject-client-web:
status: Confirmed → Won't Fix
status: Won't Fix → Confirmed
importance: Undecided → Wishlist
Revision history for this message
Amit Mendapara (cristatus) wrote :

@rvalyi, yes we can improve the expression evaluation to support common operations, but there might be problem with localized values (date, number etc). I'm marking this bug as wishlist...

Revision history for this message
Amit Mendapara (cristatus) wrote :

`uid` support has been committed in stable 5.0 branch

Changed in openobject-client-web:
milestone: none → 5.0.7
status: Confirmed → Fix Committed
Changed in openobject-client-web:
status: Fix Committed → Fix Released
Revision history for this message
Jaf Faizal (jaffaizal) wrote :

I am a newbie. This problem exist in 6.1.1
How to solve it.

Thank you

Revision history for this message
Jaf Faizal (jaffaizal) wrote :

Hi Amit,

I'm using v6.1.1 and the problem still exist.

BTW, how to assign the uid to and invisible field in the XML code?

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.