mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-13 18:21:22 +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:
|
else:
|
||||||
deserialized_data = data
|
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)
|
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(
|
frappe.enqueue(
|
||||||
job,
|
job,
|
||||||
deserialized_data=deserialized_data,
|
deserialized_data=deserialized_data,
|
||||||
|
|||||||
Reference in New Issue
Block a user