Merge pull request #33831 from dj12djdjs/perf-update-items

perf: show update items dialog
This commit is contained in:
Sagar Vora 2023-01-27 04:17:39 +00:00 committed by GitHub
commit 7e592fdf91
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -491,7 +491,20 @@ erpnext.utils.update_child_items = function(opts) {
const child_meta = frappe.get_meta(`${frm.doc.doctype} Item`);
const get_precision = (fieldname) => child_meta.fields.find(f => f.fieldname == fieldname).precision;
this.data = [];
this.data = frm.doc[opts.child_docname].map((d) => {
return {
"docname": d.name,
"name": d.name,
"item_code": d.item_code,
"delivery_date": d.delivery_date,
"schedule_date": d.schedule_date,
"conversion_factor": d.conversion_factor,
"qty": d.qty,
"rate": d.rate,
"uom": d.uom
}
});
const fields = [{
fieldtype:'Data',
fieldname:"docname",
@ -588,7 +601,7 @@ erpnext.utils.update_child_items = function(opts) {
})
}
const dialog = new frappe.ui.Dialog({
new frappe.ui.Dialog({
title: __("Update Items"),
fields: [
{
@ -624,24 +637,7 @@ erpnext.utils.update_child_items = function(opts) {
refresh_field("items");
},
primary_action_label: __('Update')
});
frm.doc[opts.child_docname].forEach(d => {
dialog.fields_dict.trans_items.df.data.push({
"docname": d.name,
"name": d.name,
"item_code": d.item_code,
"delivery_date": d.delivery_date,
"schedule_date": d.schedule_date,
"conversion_factor": d.conversion_factor,
"qty": d.qty,
"rate": d.rate,
"uom": d.uom
});
this.data = dialog.fields_dict.trans_items.df.data;
dialog.fields_dict.trans_items.grid.refresh();
})
dialog.show();
}).show();
}
erpnext.utils.map_current_doc = function(opts) {