chore: add Reserve Stock check field in Sales Order

This commit is contained in:
s-aga-r 2023-03-20 23:55:33 +05:30
parent 1b7fb6d7e7
commit 0700063379
3 changed files with 30 additions and 2 deletions

View File

@ -46,6 +46,18 @@ frappe.ui.form.on("Sales Order", {
frm.set_df_property('packed_items', 'cannot_add_rows', true);
frm.set_df_property('packed_items', 'cannot_delete_rows', true);
frappe.db.get_single_value("Stock Settings", "enable_stock_reservation").then((value) => {
if (value) {
frappe.db.get_single_value("Stock Settings", "reserve_stock_on_sales_order_submission").then((value) => {
if (value) {
frm.set_value("reserve_stock", 1);
}
})
} else {
frm.set_df_property("reserve_stock", "read_only", 1);
}
})
},
refresh: function(frm) {
if(frm.doc.docstatus === 1 && frm.doc.status !== 'Closed'

View File

@ -46,6 +46,7 @@
"scan_barcode",
"column_break_28",
"set_warehouse",
"reserve_stock",
"items_section",
"items",
"section_break_31",
@ -1637,13 +1638,20 @@
"fieldname": "named_place",
"fieldtype": "Data",
"label": "Named Place"
},
{
"default": "0",
"fieldname": "reserve_stock",
"fieldtype": "Check",
"label": "Reserve Stock",
"no_copy": 1
}
],
"icon": "fa fa-file-text",
"idx": 105,
"is_submittable": 1,
"links": [],
"modified": "2022-12-12 18:34:00.681780",
"modified": "2023-03-20 23:51:04.036757",
"modified_by": "Administrator",
"module": "Selling",
"name": "Sales Order",

View File

@ -10,6 +10,7 @@
"item_code",
"customer_item_code",
"ensure_delivery_based_on_produced_serial_no",
"reserve_stock",
"col_break1",
"delivery_date",
"item_name",
@ -859,12 +860,19 @@
"fieldname": "material_request_item",
"fieldtype": "Data",
"label": "Material Request Item"
},
{
"default": "1",
"depends_on": "eval: parent.reserve_stock",
"fieldname": "reserve_stock",
"fieldtype": "Check",
"label": "Reserve Stock"
}
],
"idx": 1,
"istable": 1,
"links": [],
"modified": "2022-12-25 02:51:10.247569",
"modified": "2023-03-20 23:43:15.099790",
"modified_by": "Administrator",
"module": "Selling",
"name": "Sales Order Item",