Merge pull request #11610 from prssanna/grid-upload
fix: convert float type fields from string to float in grid upload
This commit is contained in:
commit
e16a49f496
1 changed files with 10 additions and 10 deletions
|
|
@ -763,6 +763,13 @@ export default class Grid {
|
|||
// download
|
||||
this.setup_download();
|
||||
|
||||
const value_formatter_map = {
|
||||
"Date": val => val ? frappe.datetime.user_to_str(val) : val,
|
||||
"Int": val => cint(val),
|
||||
"Check": val => cint(val),
|
||||
"Float": val => flt(val),
|
||||
};
|
||||
|
||||
// upload
|
||||
frappe.flags.no_socketio = true;
|
||||
$(this.wrapper).find(".grid-upload").removeClass('hidden').on("click", () => {
|
||||
|
|
@ -790,16 +797,9 @@ export default class Grid {
|
|||
var fieldname = fieldnames[ci];
|
||||
var df = frappe.meta.get_docfield(me.df.options, fieldname);
|
||||
|
||||
// convert date formatting
|
||||
if (df.fieldtype==="Date" && value) {
|
||||
value = frappe.datetime.user_to_str(value);
|
||||
}
|
||||
|
||||
if (df.fieldtype==="Int" || df.fieldtype==="Check") {
|
||||
value = cint(value);
|
||||
}
|
||||
|
||||
d[fieldnames[ci]] = value;
|
||||
d[fieldnames[ci]] = value_formatter_map[df.fieldtype]
|
||||
? value_formatter_map[df.fieldtype](value)
|
||||
: value;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue