fix: task_id parameter for publish_progress
This commit is contained in:
parent
b23ee471c3
commit
a9c4894ccf
1 changed files with 8 additions and 5 deletions
|
|
@ -9,13 +9,16 @@ import frappe
|
|||
from frappe.utils.data import cstr
|
||||
|
||||
|
||||
def publish_progress(percent, title=None, doctype=None, docname=None, description=None):
|
||||
def publish_progress(
|
||||
percent, title=None, doctype=None, docname=None, description=None, task_id=None
|
||||
):
|
||||
publish_realtime(
|
||||
"progress",
|
||||
{"percent": percent, "title": title, "description": description},
|
||||
user=None if doctype and docname else frappe.session.user,
|
||||
doctype=doctype,
|
||||
docname=docname,
|
||||
task_id=task_id,
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -41,8 +44,11 @@ def publish_realtime(
|
|||
if message is None:
|
||||
message = {}
|
||||
|
||||
if not task_id and hasattr(frappe.local, "task_id"):
|
||||
task_id = frappe.local.task_id
|
||||
|
||||
if event is None:
|
||||
event = "task_progress" if frappe.local.task_id else "global"
|
||||
event = "task_progress" if task_id else "global"
|
||||
elif event == "msgprint" and not user:
|
||||
user = frappe.session.user
|
||||
elif event == "list_update":
|
||||
|
|
@ -51,9 +57,6 @@ def publish_realtime(
|
|||
elif event == "docinfo_update":
|
||||
room = get_doc_room(doctype, docname)
|
||||
|
||||
if not task_id and hasattr(frappe.local, "task_id"):
|
||||
task_id = frappe.local.task_id
|
||||
|
||||
if not room:
|
||||
if task_id:
|
||||
after_commit = False
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue