diff options
| author | niv-openerp <nicolas.vanhoren@openerp.com> | 2012-11-09 14:49:58 +0100 |
|---|---|---|
| committer | niv-openerp <nicolas.vanhoren@openerp.com> | 2012-11-09 14:49:58 +0100 |
| commit | fac7bea3a21017eeca615083c70efded0aee9c75 (patch) | |
| tree | b5c4823fe081e35ae974c867f2cee63b9e23a188 /addons/web/static/src/js/view_form.js | |
| parent | 0a7d680313f7cb5f92f28a0fef33bc61a1a26de6 (diff) | |
[FIX] problems with the progressbar widget in form view
bzr revid: nicolas.vanhoren@openerp.com-20121109134958-kp44r6gix54uouhu
Diffstat (limited to 'addons/web/static/src/js/view_form.js')
| -rw-r--r-- | addons/web/static/src/js/view_form.js | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 906f1d8fe36..8c84e302a19 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -2639,22 +2639,18 @@ instance.web.form.FieldBoolean = instance.web.form.AbstractField.extend({ } }); +/** + The progressbar field expect a float from 0 to 100. +*/ instance.web.form.FieldProgressBar = instance.web.form.AbstractField.extend({ template: 'FieldProgressBar', - start: function() { - this._super.apply(this, arguments); + render_value: function() { this.$el.progressbar({ - value: this.get('value'), + value: this.get('value') || 0, disabled: this.get("effective_readonly") }); - }, - render_value: function() { - var show_value = Number(this.get('value')); - if (isNaN(show_value)) { - show_value = 0; - } - var formatted_value = instance.web.format_value(show_value, { type : 'float' }, '0'); - this.$el.progressbar('option', 'value', show_value).find('span').html(formatted_value + '%'); + var formatted_value = instance.web.format_value(this.get('value') || 0, { type : 'float' }); + this.$('span').html(formatted_value + '%'); } }); |
