mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-12 14:11:46 +00:00
fix: open the Purchase Order when the supplier selection creates only one
Naming a single order in a message and leaving the buyer to click it is a step
for nothing. The form opens directly when there is one order; the message stays
for the case it was meant for, several orders at once.
(cherry picked from commit 3856eaa35e)
This commit is contained in:
@@ -260,11 +260,12 @@ def make_purchase_orders_by_supplier(source_name: str, item_suppliers: str | lis
|
|||||||
indicator="orange",
|
indicator="orange",
|
||||||
)
|
)
|
||||||
|
|
||||||
frappe.msgprint(
|
if len(purchase_orders) > 1:
|
||||||
_("{0} created").format(
|
frappe.msgprint(
|
||||||
comma_and([get_link_to_form("Purchase Order", name) for name in purchase_orders])
|
_("{0} created").format(
|
||||||
|
comma_and([get_link_to_form("Purchase Order", name) for name in purchase_orders])
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
|
|
||||||
return purchase_orders
|
return purchase_orders
|
||||||
|
|
||||||
|
|||||||
@@ -550,8 +550,13 @@ frappe.ui.form.on("Material Request", {
|
|||||||
args: { source_name: frm.doc.name, item_suppliers: item_suppliers },
|
args: { source_name: frm.doc.name, item_suppliers: item_suppliers },
|
||||||
freeze: true,
|
freeze: true,
|
||||||
callback: function (r) {
|
callback: function (r) {
|
||||||
if (!r.exc) {
|
if (r.exc) return;
|
||||||
dialog.hide();
|
|
||||||
|
dialog.hide();
|
||||||
|
|
||||||
|
const purchase_orders = r.message || [];
|
||||||
|
if (purchase_orders.length === 1) {
|
||||||
|
frappe.set_route("Form", "Purchase Order", purchase_orders[0]);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user