Merge pull request #11246 from prssanna/child-table-row-index
feat(Report Builder): Ability to show child table row index number
This commit is contained in:
commit
1fd2dcdf52
1 changed files with 18 additions and 2 deletions
|
|
@ -836,8 +836,15 @@ frappe.views.ReportView = class ReportView extends frappe.views.ListView {
|
|||
const child_table_fields = frappe.meta.get_docfields(cdt).filter(standard_fields_filter);
|
||||
|
||||
out[cdt] = child_table_fields;
|
||||
});
|
||||
|
||||
// add index column for child tables
|
||||
out[cdt].push({
|
||||
label: __('Index'),
|
||||
fieldname: 'idx',
|
||||
fieldtype: 'Int',
|
||||
parent: cdt
|
||||
});
|
||||
});
|
||||
return out;
|
||||
}
|
||||
|
||||
|
|
@ -857,7 +864,7 @@ frappe.views.ReportView = class ReportView extends frappe.views.ListView {
|
|||
.map(df => ({
|
||||
label: __(df.label),
|
||||
value: df.fieldname,
|
||||
checked: this.fields.find(f => f[0] === df.fieldname)
|
||||
checked: this.fields.find(f => f[0] === df.fieldname && f[1] === this.doctype)
|
||||
}))
|
||||
});
|
||||
|
||||
|
|
@ -936,6 +943,15 @@ frappe.views.ReportView = class ReportView extends frappe.views.ListView {
|
|||
docfield = this.group_by_control.get_group_by_docfield();
|
||||
}
|
||||
|
||||
// child table index column
|
||||
if (fieldname === 'idx' && doctype !== this.doctype) {
|
||||
docfield = {
|
||||
label: "Index",
|
||||
fieldtype: "Int",
|
||||
parent: doctype,
|
||||
};
|
||||
}
|
||||
|
||||
if (!docfield) {
|
||||
docfield = frappe.model.get_std_field(fieldname, true);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue