Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import frappe
- import time
- from frappe.model.document import Document
- class LessHourRequest(Document):
- def validate(self):
- # self.set_publish_progress_bar()
- frappe.enqueue_doc(
- self.doctype,
- self.name,
- "set_publish_progress_bar", # name of the controller method
- queue="long",
- timeout=4000,
- param="My Discription"
- )
- def set_publish_progress_bar(self, **kwargs):
- for i in range(1,101):
- time.sleep(1)
- description = f"frappe.publish_realtime {i} and Keyword Argument {kwargs}"
- frappe.publish_realtime('custom_event', {'message': f'{i}% of the preocess done from 100%', 'current':i, 'total':100}, user=frappe.session.user)
- # frappe.publish_progress(i, title='Some title', description=description, doctype=self.doctype)
Advertisement
Add Comment
Please, Sign In to add comment