[FIX] float formatting in form view should take digits/@digits in account
lp bug: https://launchpad.net/bugs/879346 fixed bzr revid: xmo@openerp.com-20111021122256-ld3gm8u3yt4kdn71
This commit is contained in:
parent
01897c8aa6
commit
0e9d7318fc
|
@ -1233,6 +1233,19 @@ openerp.web.form.FieldUrl = openerp.web.form.FieldChar.extend({
|
|||
});
|
||||
|
||||
openerp.web.form.FieldFloat = openerp.web.form.FieldChar.extend({
|
||||
init: function (view, node) {
|
||||
this._super(view, node);
|
||||
if (node.attrs.digits) {
|
||||
this.parse_digits(node.attrs.digits);
|
||||
} else {
|
||||
this.digits = view.fields_view.fields[node.attrs.name].digits;
|
||||
}
|
||||
},
|
||||
parse_digits: function (digits_attr) {
|
||||
// could use a Python parser instead.
|
||||
var match = /^\s*[\(\[](\d+),\s*(\d+)/.exec(digits_attr);
|
||||
return [parseInt(match[1], 10), parseInt(match[2], 10)];
|
||||
},
|
||||
set_value: function(value) {
|
||||
if (value === false || value === undefined) {
|
||||
// As in GTK client, floats default to 0
|
||||
|
|
Loading…
Reference in New Issue