mirror of
https://github.com/frappe/erpnext.git
synced 2026-02-17 00:25:01 +00:00
Merge pull request #50946 from frappe/mergify/bp/version-15-hotfix/pr-50931
fix(bulk transaction process): skip records creation if original records are marked 'On Hold' or 'Closed' (backport #50931)
This commit is contained in:
@@ -16,9 +16,30 @@ def transaction_processing(data, from_doctype, to_doctype):
|
||||
else:
|
||||
deserialized_data = data
|
||||
|
||||
skipped_records = [d for d in deserialized_data if d.get("status") in ("On Hold", "Closed")]
|
||||
|
||||
deserialized_data = [d for d in deserialized_data if d.get("status") not in ("On Hold", "Closed")]
|
||||
|
||||
length_of_data = len(deserialized_data)
|
||||
|
||||
frappe.msgprint(_("Started a background job to create {1} {0}").format(to_doctype, length_of_data))
|
||||
skipped_msg = ""
|
||||
|
||||
if skipped_records:
|
||||
skipped_msg = _("{0} creation for the following records will be skipped.").format(to_doctype)
|
||||
|
||||
skipped_msg += (
|
||||
"<br><br><ul>"
|
||||
+ "".join(_("<li>{}</li>").format(frappe.bold(row.get("name"))) for row in skipped_records)
|
||||
+ "</ul>"
|
||||
)
|
||||
|
||||
if not length_of_data:
|
||||
frappe.msgprint(skipped_msg)
|
||||
return
|
||||
|
||||
frappe.msgprint(
|
||||
_("Started a background job to create {1} {0}. {2}").format(to_doctype, length_of_data, skipped_msg)
|
||||
)
|
||||
frappe.enqueue(
|
||||
job,
|
||||
deserialized_data=deserialized_data,
|
||||
|
||||
Reference in New Issue
Block a user