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(
init: function (view) {
this._super(view);
this.view.inputs.push(this);
+ this.style = undefined;
},
get_context: function () {
throw new Error(
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# */{
*/
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);
},
*/
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 "
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"/>
<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"
<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>
<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"/>