[FIX] web: fixed fieldbarchart, now accepting JSON; fixed statinfo, now properly managing values

bzr revid: tde@openerp.com-20140408123922-tqg2t3it3sm2dw44
This commit is contained in:
Thibault Delavallée 2014-04-08 14:39:22 +02:00
parent a43998c41f
commit ab12151b58
1 changed files with 10 additions and 2 deletions

View File

@ -2871,7 +2871,7 @@ instance.web.form.FieldBarChart = instance.web.form.AbstractField.extend({
template: 'FieldBarChart',
render_value: function() {
var value = this.get('value');
var value = JSON.parse(this.get('value'));
var svg = this.$('svg')[0];
svg.innerHTML = "";
nv.addGraph(function() {
@ -5954,9 +5954,16 @@ instance.web.form.X2ManyCounter = instance.web.form.AbstractField.extend(instanc
display a simple string "<value of field> <label of the field>"
*/
instance.web.form.StatInfo = instance.web.form.AbstractField.extend({
is_field_number: true,
init: function() {
this._super.apply(this, arguments);
this.set("value", 0);
this.internal_set_value(0);
},
set_value: function(value_) {
if (value_ === false || value_ === undefined) {
value_ = 0;
}
this._super.apply(this, [value_]);
},
render_value: function() {
var options = {
@ -5970,6 +5977,7 @@ instance.web.form.StatInfo = instance.web.form.AbstractField.extend({
});
/**
* Registry of form fields, called by :js:`instance.web.FormView`.
*