[FIX] behavior of invisible search inputs: they can still be active and should be present in the view, just not visible
bzr revid: xmo@openerp.com-20111216151108-b2x0orfy40qzw050
This commit is contained in:
parent
c380b4db89
commit
847cbbcb2c
|
@ -68,11 +68,6 @@ openerp.web.SearchView = openerp.web.Widget.extend(/** @lends openerp.web.Search
|
|||
rows.push(row);
|
||||
var filters = [];
|
||||
_.each(items, function (item) {
|
||||
if (item.attrs.modifiers) {
|
||||
var modifiers = item.attrs.modifiers = JSON.parse(
|
||||
item.attrs.modifiers);
|
||||
if (modifiers.invisible) { return; }
|
||||
}
|
||||
if (filters.length && item.tag !== 'filter') {
|
||||
row.push(
|
||||
new openerp.web.search.FilterGroup(
|
||||
|
@ -588,6 +583,7 @@ openerp.web.search.Input = openerp.web.search.Widget.extend( /** @lends openerp.
|
|||
init: function (view) {
|
||||
this._super(view);
|
||||
this.view.inputs.push(this);
|
||||
this.style = undefined;
|
||||
},
|
||||
get_context: function () {
|
||||
throw new Error(
|
||||
|
@ -596,6 +592,16 @@ openerp.web.search.Input = openerp.web.search.Widget.extend( /** @lends openerp.
|
|||
get_domain: function () {
|
||||
throw new Error(
|
||||
"get_domain not implemented for widget " + this.attrs.type);
|
||||
},
|
||||
load_attrs: function (attrs) {
|
||||
if (attrs.modifiers) {
|
||||
attrs.modifiers = JSON.parse(attrs.modifiers);
|
||||
attrs.invisible = attrs.modifiers.invisible || false;
|
||||
if (attrs.invisible) {
|
||||
this.style = 'display: none;'
|
||||
}
|
||||
}
|
||||
this.attrs = attrs;
|
||||
}
|
||||
});
|
||||
openerp.web.search.FilterGroup = openerp.web.search.Input.extend(/** @lends openerp.web.search.FilterGroup# */{
|
||||
|
@ -656,7 +662,7 @@ openerp.web.search.Filter = openerp.web.search.Input.extend(/** @lends openerp.w
|
|||
*/
|
||||
init: function (node, view) {
|
||||
this._super(view);
|
||||
this.attrs = node.attrs;
|
||||
this.load_attrs(node.attrs);
|
||||
this.classes = [this.attrs.string ? 'filter_label' : 'filter_icon'];
|
||||
this.make_id('filter', this.attrs.name);
|
||||
},
|
||||
|
@ -714,14 +720,9 @@ openerp.web.search.Field = openerp.web.search.Input.extend( /** @lends openerp.w
|
|||
*/
|
||||
init: function (view_section, field, view) {
|
||||
this._super(view);
|
||||
this.attrs = _.extend({}, field, view_section.attrs);
|
||||
this.load_attrs(_.extend({}, field, view_section.attrs));
|
||||
this.filters = new openerp.web.search.FilterGroup(_.compact(_.map(
|
||||
view_section.children, function (filter_node) {
|
||||
if (filter_node.attrs.modifiers) {
|
||||
var modifiers = filter_node.attrs.modifiers = JSON.parse(
|
||||
filter_node.attrs.modifiers);
|
||||
if (modifiers.invisible) { return; }
|
||||
}
|
||||
if (filter_node.attrs.string &&
|
||||
typeof console !== 'undefined' && console.debug) {
|
||||
console.debug("Filter-in-field with a 'string' attribute "
|
||||
|
|
|
@ -1210,6 +1210,7 @@
|
|||
t-att-id="element_id"
|
||||
t-att-title="attrs.help"
|
||||
t-att-class="classes.join(' ')"
|
||||
t-att-style="style"
|
||||
t-att-autofocus="attrs.default_focus === '1' ? 'autofocus' : undefined">
|
||||
<img t-att-src="_s + '/web/static/src/img/icons/' + (attrs.icon || 'gtk-home') + '.png'" width="16" height="16"/>
|
||||
<br t-if="attrs.string"/>
|
||||
|
@ -1222,11 +1223,12 @@
|
|||
<t t-name="SearchView.field">
|
||||
<label t-att-class="'oe_label' + (attrs.help ? '_help' : '')"
|
||||
t-att-title="attrs.help"
|
||||
t-att-for="element_id">
|
||||
t-att-for="element_id"
|
||||
t-att-style="style">
|
||||
<t t-esc="attrs.string || attrs.name"/>
|
||||
<span t-if="attrs.help">?</span>
|
||||
</label>
|
||||
<div>
|
||||
<div t-att-style="style">
|
||||
<input type="text" size="15" t-att-name="attrs.name"
|
||||
t-att-autofocus="attrs.default_focus === '1' ? 'autofocus' : undefined"
|
||||
t-att-id="element_id"
|
||||
|
@ -1237,11 +1239,12 @@
|
|||
<t t-name="SearchView.date">
|
||||
<label t-att-class="'oe_label' + (attrs.help ? '_help' : '')"
|
||||
t-att-title="attrs.help"
|
||||
t-att-for="element_id">
|
||||
t-att-for="element_id"
|
||||
t-att-style="style">
|
||||
<t t-esc="attrs.string || attrs.name"/>
|
||||
<span t-if="attrs.help">?</span>
|
||||
</label>
|
||||
<div>
|
||||
<div t-att-style="style">
|
||||
<span t-att-id="element_id"></span>
|
||||
<t t-if="filters.length" t-raw="filters.render(defaults)"/>
|
||||
</div>
|
||||
|
@ -1249,11 +1252,12 @@
|
|||
<t t-name="SearchView.field.selection">
|
||||
<label t-att-title="attrs.help"
|
||||
t-att-class="'oe_label' + (attrs.help ? '_help' : '')"
|
||||
t-att-for="element_id">
|
||||
t-att-for="element_id"
|
||||
t-att-style="style">
|
||||
<t t-esc="attrs.string || attrs.name"/>
|
||||
<span t-if="attrs.help">?</span>
|
||||
</label>
|
||||
<div>
|
||||
<div t-att-style="style">
|
||||
<select t-att-name="attrs.name" t-att-id="element_id"
|
||||
t-att-autofocus="attrs.default_focus === '1' || undefined">
|
||||
<option t-if="prepend_empty"/>
|
||||
|
|
Loading…
Reference in New Issue