mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-12 22:21:50 +00:00
fix: reject the same Material Request item twice in one supplier selection
Each row was checked against the pending quantity on its own, so a payload that
listed one item under two suppliers passed both checks and ordered the pending
quantity twice. The dialog cannot produce that, a direct call to the endpoint
can.
(cherry picked from commit 99d56cc850)
This commit is contained in:
@@ -215,11 +215,17 @@ def make_purchase_orders_by_supplier(source_name: str, item_suppliers: str | lis
|
||||
}
|
||||
|
||||
items_by_supplier = {}
|
||||
requested_items = set()
|
||||
for row in item_suppliers:
|
||||
row = frappe._dict(row)
|
||||
pending = pending_items.get(row.material_request_item) or frappe._dict()
|
||||
item_link = get_link_to_form("Item", row.item_code)
|
||||
|
||||
if row.material_request_item in requested_items:
|
||||
frappe.throw(_("Item {0} cannot be ordered more than once").format(item_link))
|
||||
|
||||
requested_items.add(row.material_request_item)
|
||||
|
||||
if not row.supplier:
|
||||
frappe.throw(_("Select a Supplier for Item {0}").format(item_link))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user