Browse Source

fix: Check if df.options exists before setting docfields

Fixes: https://github.com/frappe/frappe/issues/12793
version-14
Suraj Shetty 4 years ago
parent
commit
a71066f3a4
1 changed files with 2 additions and 1 deletions
  1. +2
    -1
      frappe/public/js/frappe/form/grid_row.js

+ 2
- 1
frappe/public/js/frappe/form/grid_row.js View File

@@ -5,7 +5,7 @@ export default class GridRow {
this.on_grid_fields_dict = {}; this.on_grid_fields_dict = {};
this.on_grid_fields = []; this.on_grid_fields = [];
$.extend(this, opts); $.extend(this, opts);
if (this.doc) {
if (this.doc && this.parent_df.options) {
this.docfields = frappe.meta.get_docfields(this.parent_df.options, this.doc.name); this.docfields = frappe.meta.get_docfields(this.parent_df.options, this.doc.name);
} }
this.columns = {}; this.columns = {};
@@ -255,6 +255,7 @@ export default class GridRow {
this.grid.visible_columns.forEach((col, ci) => { this.grid.visible_columns.forEach((col, ci) => {
// to get update df for the row // to get update df for the row
let df = this.docfields.find(field => field.fieldname === col[0].fieldname); let df = this.docfields.find(field => field.fieldname === col[0].fieldname);

let colsize = col[1]; let colsize = col[1];
let txt = this.doc ? let txt = this.doc ?
frappe.format(this.doc[df.fieldname], df, null, this.doc) : frappe.format(this.doc[df.fieldname], df, null, this.doc) :


Loading…
Cancel
Save