fix: update child item schedule_date and prevent past dates (#53298)

This commit is contained in:
Pandiyan P
2026-03-12 09:57:38 +05:30
committed by GitHub
parent 9a4c7766e3
commit 77cf0afa1a
3 changed files with 11 additions and 20 deletions

View File

@@ -67,7 +67,7 @@ frappe.ui.form.on("Purchase Order", {
},
transaction_date(frm) {
prevent_past_schedule_dates(frm);
erpnext.buying.prevent_past_schedule_dates(frm);
frm.set_value("schedule_date", "");
},
@@ -87,7 +87,7 @@ frappe.ui.form.on("Purchase Order", {
if (frm.doc.docstatus == 0) {
erpnext.set_unit_price_items_note(frm);
}
prevent_past_schedule_dates(frm);
erpnext.buying.prevent_past_schedule_dates(frm);
},
get_materials_from_supplier: function (frm) {
@@ -779,11 +779,3 @@ frappe.ui.form.on("Purchase Order", "is_subcontracted", function (frm) {
erpnext.buying.get_default_bom(frm);
}
});
function prevent_past_schedule_dates(frm) {
if (frm.doc.transaction_date) {
frm.fields_dict["schedule_date"].datepicker?.update({
minDate: new Date(frm.doc.transaction_date),
});
}
}

View File

@@ -682,3 +682,10 @@ erpnext.buying.get_items_from_product_bundle = function (frm) {
dialog.show();
};
erpnext.buying.prevent_past_schedule_dates = function (frm) {
if (frm.doc.transaction_date) {
frm.fields_dict["schedule_date"].datepicker?.update({
minDate: new Date(frm.doc.transaction_date),
});
}
};

View File

@@ -116,12 +116,12 @@ frappe.ui.form.on("Material Request", {
refresh: function (frm) {
frm.events.make_custom_buttons(frm);
frm.toggle_reqd("customer", frm.doc.material_request_type == "Customer Provided");
prevent_past_schedule_dates(frm);
erpnext.buying.prevent_past_schedule_dates(frm);
frm.trigger("set_warehouse_label");
},
transaction_date(frm) {
prevent_past_schedule_dates(frm);
erpnext.buying.prevent_past_schedule_dates(frm);
frm.set_value("schedule_date", "");
},
@@ -681,11 +681,3 @@ function set_schedule_date(frm) {
);
}
}
function prevent_past_schedule_dates(frm) {
if (frm.doc.transaction_date) {
frm.fields_dict["schedule_date"].datepicker.update({
minDate: new Date(frm.doc.transaction_date),
});
}
}