Field / button 'attrs' not evaluated correctly with multiple conditions [FIX PROVIDED]

Bug #718925 reported by Russell Briggs
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Web Client
New
Undecided
OpenERP Publisher's Warranty Team

Bug Description

I have the following button in my form:

<button name="button_completed" string="Completed" type="object" icon="gtk-index"
  attrs="{'invisible':['|',('order_type','not in',['sample','stock']),('state','!=','new')]}" />

The attrs is designed to show the button only for orders of type 'sample' and 'stock', with a status of 'new', however only the first part of the condition (order_type) was being evaluated correctly.

I tracked this down to a tiny javascript error in 'form_evalExpr' function in form_state.js. As it loops through each condition, it does not reset the value of 'elem' to null, so it simply reuses the first element for each of the subsequent evaluations.

Fix attached.

Tags: maintenance
Revision history for this message
Russell Briggs (russell-briggs) wrote :
Revision history for this message
filsys (office-filsystem) wrote : Re: [Bug 718925] Re: [6.0.1] Field / button 'attrs' not evaluated correctly with multiple conditions [FIX PROVIDED]

I have tested your patch with a many2one filed:

<field name="prodlot_id"
domain="[('product_id','=',product_id),('stock_available','&gt;',0)]"
attrs="{'invisible':
['|',('prodlot_id','&lt;&gt;',False),('tracking','=',False)]}"/>

Did not work.

Pe 14.02.2011 20:52, Russell Briggs a scris:
> ** Patch added: "fix_attrs_eval.patch"
> https://bugs.launchpad.net/bugs/718925/+attachment/1849826/+files/fix_attrs_eval.patch
>

Revision history for this message
Russell Briggs (russell-briggs) wrote : Re: [6.0.1] Field / button 'attrs' not evaluated correctly with multiple conditions [FIX PROVIDED]

Have you checked the conditions work correctly individually? I would try adding some alert or console.log statements to the 'form_evalExpr' function then you will be able to see the results of the evaluations

Revision history for this message
DBR (OpenERP) (dbr-openerp) wrote :

Hello Russell Briggs,

I have checked "attrs" of multi condition with Button and field at our end
But did not face any problem.
Would you please provide us related proper example?
So, It will be more helpful to reproduce and qualify bug.

Thank you.

Changed in openobject-client-web:
status: New → Incomplete
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for OpenERP Web Client because there has been no activity for 60 days.]

Changed in openobject-client-web:
status: Incomplete → Expired
Revision history for this message
DBR (OpenERP) (dbr-openerp) wrote :

Hello,

I have check the " attrs " again with latest stable code.
It is working fine .So, For now I am closing this bug.
If you still face the same problem again you can reopen this bug.
I have attached a video for your reference.

Thanks.

summary: - [6.0.1] Field / button 'attrs' not evaluated correctly with multiple
- conditions [FIX PROVIDED]
+ Field / button 'attrs' not evaluated correctly with multiple conditions
+ [FIX PROVIDED]
Changed in openobject-client-web:
status: Expired → Invalid
Revision history for this message
DBR (OpenERP) (dbr-openerp) wrote :
Changed in openobject-client-web:
assignee: nobody → OpenERP Publisher's Warranty Team (openerp-opw)
status: Invalid → New
tags: added: maintenance
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.