diff --git a/models.py b/models.py
index 0148386..f63c642 100644
--- a/models.py
+++ b/models.py
@@ -76,6 +76,7 @@ Slice - use "domain" for total and "won_domain" for target
'type': self.type,
'model': self.model_id.model,
'domain': str(domain),
+ 'precision': self.precision,
}
obj = self.env[self.model_id.model]
if self.type == 'list':
diff --git a/static/src/css/main.css b/static/src/css/main.css
index 6658f16..add6083 100644
--- a/static/src/css/main.css
+++ b/static/src/css/main.css
@@ -17,6 +17,7 @@
.openerp .oe_mail_wall .oe_goal .oe_goals_list .oe_cell.oe_goal_current .oe_form_field_monetary{
font-weight: normal;
font-size: 70%;
+ white-space: nowrap;
}
.openerp .oe_mail_wall .oe_goal .oe_goals_list .oe_cell.oe_goal_current .oe_form_field_monetary .oe_form_char_content {
font-weight: bold;
diff --git a/static/src/js/main.js b/static/src/js/main.js
index de7edf1..a4ac00a 100644
--- a/static/src/js/main.js
+++ b/static/src/js/main.js
@@ -64,6 +64,7 @@ openerp.mail_wall_widgets = function(instance) {
_.each(result, function(item){
var $item = $(QWeb.render(self.widget_templates[item.model], {info: item}));
self.render_money_fields($item);
+ self.render_float_fields($item);
//self.render_user_avatars($item);
self.$el.find('.oe_mail_wall_widgets').append($item);
});
@@ -76,17 +77,38 @@ openerp.mail_wall_widgets = function(instance) {
// Generate a FieldMonetary for each .oe_goal_field_monetary
item.find(".oe_goal_field_monetary").each(function() {
var currency_id = parseInt( $(this).attr('data-id'), 10);
- money_field = new instance.web.form.FieldMonetary(self.dfm, {
+ var precision = parseFloat( $(this).attr('data-precision') , 10) || 1;
+ var digits = [69,0];
+ if (precision && precision<1)
+ digits[1] = ($(this).attr('data-precision') || '0.01').slice(2).indexOf('1')+1;
+ var money_field = new instance.web.form.FieldMonetary(self.dfm, {
attrs: {
- modifiers: '{"readonly": true}'
+ 'modifiers': '{"readonly": true}',
+ 'digits': digits
}
});
money_field.set('currency', currency_id);
money_field.get_currency_info();
- money_field.set('value', parseInt($(this).text(), 10));
+ money_field.set('value', parseInt(parseFloat($(this).text(), 10)/precision)*precision);
money_field.replace($(this));
});
},
+ render_float_fields: function(item) {
+ var self = this;
+ // Generate a FieldMonetary for each .oe_goal_field_monetary
+ item.find(".oe_goal_field_float").each(function() {
+ var value = $(this).text();
+ if (!value)
+ return;
+ var precision = parseFloat( $(this).attr('data-precision'), 10) || 1;
+ var digits = [69,0];
+ if (precision && precision<1)
+ digits[1] = ($(this).attr('data-precision') || '0.01').slice(2).indexOf('1')+1;
+
+ value = instance.web.format_value(parseFloat(value), {type: "float", digits: digits}, '')
+ $(this).text(value)
+ });
+ },
render_user_avatars: function(item) {
var self = this;
item.find(".oe_user_avatar").each(function() {
diff --git a/static/src/xml/main.xml b/static/src/xml/main.xml
index 0eea01b..5b632ae 100644
--- a/static/src/xml/main.xml
+++ b/static/src/xml/main.xml
@@ -17,7 +17,7 @@