ソースを参照

fix: fetching of child items

version-14
Saqib Ansari 4年前
コミット
54f34bdce8
1個のファイルの変更18行の追加3行の削除
  1. +18
    -3
      frappe/public/js/frappe/form/multi_select_dialog.js

+ 18
- 3
frappe/public/js/frappe/form/multi_select_dialog.js ファイルの表示

@@ -75,8 +75,9 @@ frappe.ui.form.MultiSelectDialog = class MultiSelectDialog {
primary_action: () => { primary_action: () => {
let filters_data = this.get_custom_filters(); let filters_data = this.get_custom_filters();
const data_values = cur_dialog.get_values(); // to pass values of data fields const data_values = cur_dialog.get_values(); // to pass values of data fields
const filtered_children = this.get_checked_child_names();
this.action(this.get_checked_values(), {
const filtered_children = this.get_selected_child_names();
const selected_documents = [...this.get_checked_values(), ...this.get_parent_name_of_selected_children()];
this.action(selected_documents, {
...this.args, ...this.args,
...data_values, ...data_values,
...filters_data, ...filters_data,
@@ -330,7 +331,21 @@ frappe.ui.form.MultiSelectDialog = class MultiSelectDialog {
}); });
} }


get_checked_child_names() {
get_parent_name_of_selected_children() {
if (!this.child_datatable.datamanager.rows.length) return [];

let parent_names = this.child_datatable.rowmanager.checkMap.reduce((parent_names, checked, index) => {
if (checked == 1) {
const parent_name = this.child_results[index].parent;
parent_names.push(parent_name);
}
return parent_names;
}, []);

return parent_names;
}

get_selected_child_names() {
if (!this.child_datatable.datamanager.rows.length) return []; if (!this.child_datatable.datamanager.rows.length) return [];


let checked_names = this.child_datatable.rowmanager.checkMap.reduce((checked_names, checked, index) => { let checked_names = this.child_datatable.rowmanager.checkMap.reduce((checked_names, checked, index) => {


読み込み中…
キャンセル
保存