From bb73d77ceca069b559d776ab88be24f033705384 Mon Sep 17 00:00:00 2001 From: Devin Slauenwhite Date: Fri, 8 Dec 2023 19:08:34 +0000 Subject: [PATCH] fix: grid row default values with not using model --- frappe/public/js/frappe/form/grid.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/frappe/public/js/frappe/form/grid.js b/frappe/public/js/frappe/form/grid.js index b5942c7f46..0d97ce165d 100644 --- a/frappe/public/js/frappe/form/grid.js +++ b/frappe/public/js/frappe/form/grid.js @@ -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(); }