← Back to team overview

openerp-dev-web team mailing list archive

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

 

Tested and this work fine, and your solution really better of mine

Good Job.

-- 
You received this bug notification because you are a member of OpenERP
SA's Web Client R&D, which is a bug assignee.
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:
  Fix Released

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