fix: rate auto changing from 3.9 to 39 (#8560)
* fix: rate auto changing from 3.9 to 39 * fix: codacy
This commit is contained in:
parent
86263e05f4
commit
f2f49ef3bb
1 changed files with 16 additions and 5 deletions
|
|
@ -1,12 +1,23 @@
|
|||
frappe.ui.form.ControlCurrency = frappe.ui.form.ControlFloat.extend({
|
||||
eval_expression: function(value) {
|
||||
if (typeof value === 'string'
|
||||
&& value.match(/^[0-9+-/* ]+$/)
|
||||
// paresFloat('1,44,000') returns 1.0
|
||||
// 1,44,000 are being passed when we paste rows from excel sheet to a table
|
||||
&& value.includes(',')) {
|
||||
return value.replace(",", "");
|
||||
&& value.match(/^[0-9+-/* ]+$/)) {
|
||||
if (value.includes(',')) {
|
||||
// paresFloat('1,44,000') returns 1.0
|
||||
// 1,44,000 are being passed when we paste rows from excel sheet to a table)
|
||||
|
||||
const regex = new RegExp("\\,", "g");
|
||||
value = value.replace(regex, "");
|
||||
}
|
||||
|
||||
try {
|
||||
return eval(value);
|
||||
} catch (e) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
// If not string
|
||||
return value;
|
||||
},
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue