mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-18 17:08:42 +00:00
fix: warn about existing draft orders before the supplier selection creates more
Creating through the dialog calls the endpoint directly instead of going
through open_mapped_doc, so the draft link guard that every other Create action
runs never fired, and a repeated dialog quietly produced a second set of draft
orders for the same quantity.
(cherry picked from commit f0bb70539d)
This commit is contained in:
@@ -518,7 +518,7 @@ frappe.ui.form.on("Material Request", {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
primary_action_label: __("Create"),
|
primary_action_label: __("Create"),
|
||||||
primary_action: function (values) {
|
primary_action: async function (values) {
|
||||||
const item_suppliers = (values.items || []).filter((row) => row.__checked);
|
const item_suppliers = (values.items || []).filter((row) => row.__checked);
|
||||||
if (!item_suppliers.length) {
|
if (!item_suppliers.length) {
|
||||||
frappe.throw(__("Select at least one Item"));
|
frappe.throw(__("Select at least one Item"));
|
||||||
@@ -552,6 +552,10 @@ frappe.ui.form.on("Material Request", {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!(await erpnext.utils.confirm_if_drafts_exist(frm.doc, "Purchase Order"))) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
frappe.call({
|
frappe.call({
|
||||||
method: "erpnext.stock.doctype.material_request.mapper.make_purchase_orders_by_supplier",
|
method: "erpnext.stock.doctype.material_request.mapper.make_purchase_orders_by_supplier",
|
||||||
args: { source_name: frm.doc.name, item_suppliers: item_suppliers },
|
args: { source_name: frm.doc.name, item_suppliers: item_suppliers },
|
||||||
|
|||||||
Reference in New Issue
Block a user