fix: group by parent child issue
This commit is contained in:
parent
965728cd9b
commit
76f95ca1a9
2 changed files with 9 additions and 1 deletions
|
|
@ -10,11 +10,14 @@
|
|||
<option value="" disabled selected>{{ __("Select Group By...") }}</option>
|
||||
{% for (var parent_doctype in group_by_conditions) { %}
|
||||
{% for (var val of group_by_conditions[parent_doctype]) { %}
|
||||
{% field_name = val.label || val.fieldname %}
|
||||
{% if(val.parent && doctype != val.parent) field_name += " ("+parent_doctype+")" %}
|
||||
<option
|
||||
data-doctype="{{parent_doctype}}"
|
||||
value="{{val.fieldname}}"
|
||||
data-parent-doctype="{{doctype}}"
|
||||
>
|
||||
{{ __(val.label || val.fieldname, null, val.parent ) }}
|
||||
{{ __(field_name, null, val.parent ) }}
|
||||
</option>
|
||||
{% } %}
|
||||
{% } %}
|
||||
|
|
|
|||
|
|
@ -243,6 +243,11 @@ frappe.ui.GroupBy = class {
|
|||
}
|
||||
|
||||
apply_group_by() {
|
||||
if (this.group_by_doctype != this.aggregate_on_doctype) {
|
||||
frappe.msgprint("Parent-to-child or child-to-parent grouping is not allowed.");
|
||||
return false;
|
||||
}
|
||||
|
||||
this.group_by = "`tab" + this.group_by_doctype + "`.`" + this.group_by_field + "`";
|
||||
|
||||
if (this.aggregate_function === "count") {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue