fix: grid row default values with not using model

This commit is contained in:
Devin Slauenwhite 2023-12-08 19:08:34 +00:00
parent 91dce0b007
commit bb73d77cec

View file

@ -834,7 +834,13 @@ export default class Grid {
if (!this.df.data) {
this.df.data = this.get_data() || [];
}
this.df.data.push({ idx: this.df.data.length + 1, __islocal: true });
const defaults = this.docfields.reduce((acc, d) => {
acc[d.fieldname] = d.default;
return acc;
}, {});
this.df.data.push(
$.extend({ idx: this.df.data.length + 1, __islocal: true }, defaults)
);
this.refresh();
}