Browse Source

Merge pull request #437 from laslabs/bugfix/9.0/#431-web_widget_float_formula-focused

[IMP] web_widget_float_formula: Focused bug fix
pull/416/merge
Pedro M. Baeza 8 years ago
committed by GitHub
parent
commit
42f706ec5f
  1. 9
      web_widget_float_formula/static/src/js/web_widget_float_formula.js

9
web_widget_float_formula/static/src/js/web_widget_float_formula.js

@ -15,7 +15,7 @@ odoo.define('web_widget_float_formula', function(require) {
for (var f in this.fields) { for (var f in this.fields) {
if (!this.fields.hasOwnProperty(f)) { continue; } if (!this.fields.hasOwnProperty(f)) { continue; }
f = this.fields[f]; f = this.fields[f];
if (f.hasOwnProperty('_formula_text')) {
if (f.hasOwnProperty('_formula_text') && f.$el.find('input').length > 0) {
f._compute_result(); f._compute_result();
f._clean_formula_text(); f._clean_formula_text();
} }
@ -52,12 +52,7 @@ odoo.define('web_widget_float_formula', function(require) {
}, },
_process_formula: function(formula) { _process_formula: function(formula) {
try{
formula = formula.toString();
} catch (ex) {
return false;
}
var clean_formula = formula.replace(/^\s+|\s+$/g, '');
var clean_formula = formula.toString().replace(/^\s+|\s+$/g, '');
if (clean_formula[0] == '=') { if (clean_formula[0] == '=') {
clean_formula = clean_formula.substring(1); clean_formula = clean_formula.substring(1);
var myreg = new RegExp('[0-9]|\\s|\\.|,|\\(|\\)|\\+|\\-|\\*|\\/', 'g'); var myreg = new RegExp('[0-9]|\\s|\\.|,|\\(|\\)|\\+|\\-|\\*|\\/', 'g');

Loading…
Cancel
Save