Skip to content

Commit

Permalink
perf: show update items dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
dj12djdjs committed Jan 26, 2023
1 parent b31b850 commit a835c1a
Showing 1 changed file with 16 additions and 20 deletions.
36 changes: 16 additions & 20 deletions erpnext/public/js/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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: [
{
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit a835c1a

Please sign in to comment.