[FIX] form selection field: don't interpret value 0 as false in the template when the code doesn't do so
bzr revid: xmo@openerp.com-20121206135114-nuwc3wdc6zatbl3d
This commit is contained in:
parent
96408a36f0
commit
7ac99cbeaf
|
@ -2680,13 +2680,10 @@ instance.web.form.FieldSelection = instance.web.form.AbstractField.extend(instan
|
|||
init: function(field_manager, node) {
|
||||
var self = this;
|
||||
this._super(field_manager, node);
|
||||
this.values = _.clone(this.field.selection);
|
||||
_.each(this.values, function(v, i) {
|
||||
if (v[0] === false && v[1] === '') {
|
||||
self.values.splice(i, 1);
|
||||
}
|
||||
});
|
||||
this.values.unshift([false, '']);
|
||||
this.values = _(this.field.selection).chain()
|
||||
.reject(function (v) { return v[0] === false && v[1] === ''; })
|
||||
.unshift([false, ''])
|
||||
.value();
|
||||
},
|
||||
initialize_content: function() {
|
||||
// Flag indicating whether we're in an event chain containing a change
|
||||
|
|
|
@ -1054,7 +1054,10 @@
|
|||
t-att-autofocus="widget.node.attrs.autofocus"
|
||||
t-att-id="widget.id_for_label">
|
||||
<t t-foreach="widget.values" t-as="option">
|
||||
<option><t t-esc="widget.node.attrs.placeholder" t-if="option[0] == false and widget.node.attrs.placeholder"/><t t-esc="option[1]" t-if="option[0] != false"/></option>
|
||||
<option>
|
||||
<t t-esc="widget.node.attrs.placeholder" t-if="option[0] === false and widget.node.attrs.placeholder"/>
|
||||
<t t-esc="option[1]" t-if="option[0] !== false"/>
|
||||
</option>
|
||||
</t>
|
||||
</select>
|
||||
</span>
|
||||
|
|
Loading…
Reference in New Issue