function remove_item_po_and_mrs(frm, data) {
const fields = remove_item()
const d = new frappe.ui.Dialog({
title: “Remove Item”,
size: “large”,
fields: remove_item(po_tbl_fields),
primary_action_label: “Remove”,
primary_action: (values) => {
console.log(“HELLOW WORLD”,values.purchase_order_item)
let mrs_item_doc =
d.fields_dict.purchase_order_item.grid.data.forEach(row => {
mrs_item_doc.push(row.purchase_invoice_name)
})
frappe.call({
method: “erpnext_config.bcbi_configuration.utils.remove_mrs_item”,
args: {
dt: frm.doc.doctype,
dn: frm.doc.name,
mr_doc: mrs_item_doc
},
callback:function(r){
if (!r.exc){
console.log(r.message);
r.message.forEach(data => {
console.log(data.idx)
// this is valid
cur_frm.get_field(“items”).grid.grid_rows[data.idx -1].remove();
})
d.hide();
cur_frm.dirty()
cur_frm.save_or_update();
}
}
})
}
});
can you explain your issue more
1 Like
I created a dialog to select an item from Purchase Order and remove that item from the row. So after I click the button remove from the dialog I want to automatically save the document or update.
After I click the remove. It needs to click the update so it fully save. Please help thanks
cur_frm.save();