Skip to content

Commit

Permalink
feat: provision to update items in Stock Reservation dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
s-aga-r committed Dec 4, 2023
1 parent c8693cd commit 9471d8f
Showing 1 changed file with 26 additions and 3 deletions.
29 changes: 26 additions & 3 deletions erpnext/selling/doctype/sales_order/sales_order.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ frappe.ui.form.on("Sales Order", {
create_stock_reservation_entries(frm) {
const dialog = new frappe.ui.Dialog({
title: __("Stock Reservation"),
size: "large",
size: "extra-large",
fields: [
{
fieldname: "set_warehouse",
Expand Down Expand Up @@ -218,10 +218,33 @@ frappe.ui.form.on("Sales Order", {
fields: [
{
fieldname: "sales_order_item",
fieldtype: "Data",
fieldtype: "Link",
label: __("Sales Order Item"),
options: "Sales Order Item",
reqd: 1,
read_only: 1,
in_list_view: 1,
get_query: () => {
return {
filters: {
"parenttype": frm.doc.doctype,
"parent": frm.doc.name,
"reserve_stock": 1,
}
}
},
onchange: (event) => {
if (event) {
let name = $(event.currentTarget).closest(".grid-row").attr("data-name");
let item_row = dialog.fields_dict.items.grid.grid_rows_by_docname[name].doc;

frm.doc.items.forEach(item => {
if (item.name === item_row.sales_order_item) {
item_row.item_code = item.item_code;
}
});
dialog.fields_dict.items.grid.refresh();
}
}
},
{
fieldname: "item_code",
Expand Down

0 comments on commit 9471d8f

Please sign in to comment.