← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 701092] [NEW] [trunk version 4281] attrs invisible with a contidion on a selection, dont work

 

Public bug reported:

To see the error

Create 2 fields, field1 and field2

Field 2 is a selection on what you want

Field 1 visible only is a selection is make in field 2

EX : attrs="{'invisible':[('field2','=',False)]}"

In addons/openerp/static/javascript
function form_evalExpr

line 200

var elem_value = elem.attr('value') || elem.text();

after my trace i see, when we select noting, value is empty but
elem.text return text of first element, so elem_value never empty

i have no time to make a good patch, so i do a little fast patch for my
test

        var elem_value = elem.attr('value') || elem.text();

		if (elem[0] == '[object HTMLSelectElement]'){
			if (elem.attr('value') == "") {
				elem_value = 0;
			}
		}

So if the element is a select and is the value is empty, change the
elem_value to 0, this change work, but i think is not the best, i let
you found a better way to do it.


This bug is important for me, because at the moment user can see field when he not supposed to see it.

Thank

** Affects: openobject-client-web
     Importance: Undecided
         Status: New

-- 
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/701092

Title:
  [trunk version 4281] attrs invisible with a contidion on a selection, dont work

Status in OpenObject Web Client:
  New

Bug description:
  To see the error

Create 2 fields, field1 and field2

Field 2 is a selection on what you want

Field 1 visible only is a selection is make in field 2

EX : attrs="{'invisible':[('field2','=',False)]}"

In addons/openerp/static/javascript
function form_evalExpr

line 200

var elem_value = elem.attr('value') || elem.text();

after my trace i see, when we select noting, value is empty but elem.text return text of first element, so elem_value never empty

i have no time to make a good patch, so i do a little fast patch for my test

        var elem_value = elem.attr('value') || elem.text();

		if (elem[0] == '[object HTMLSelectElement]'){
			if (elem.attr('value') == "") {
				elem_value = 0;
			}
		}

So if the element is a select and is the value is empty, change the elem_value to 0, this change work, but i think is not the best, i let you found a better way to do it.


This bug is important for me, because at the moment user can see field when he not supposed to see it.

Thank





Follow ups

References