fix(realtime): Restrict updates to only last modified or current user (#33034)
This commit is contained in:
parent
df096688f7
commit
dd2493a541
@ -20,7 +20,6 @@ frappe.ui.form.on('Opening Invoice Creation Tool', {
|
||||
frm.dashboard.reset();
|
||||
frm.doc.import_in_progress = true;
|
||||
}
|
||||
if (data.user != frappe.session.user) return;
|
||||
if (data.count == data.total) {
|
||||
setTimeout(() => {
|
||||
frm.doc.import_in_progress = false;
|
||||
|
@ -260,10 +260,10 @@ def publish(index, total, doctype):
|
||||
dict(
|
||||
title=_("Opening Invoice Creation In Progress"),
|
||||
message=_("Creating {} out of {} {}").format(index + 1, total, doctype),
|
||||
user=frappe.session.user,
|
||||
count=index + 1,
|
||||
total=total,
|
||||
),
|
||||
user=frappe.session.user,
|
||||
)
|
||||
|
||||
|
||||
|
@ -25,7 +25,7 @@ frappe.ui.form.on('POS Closing Entry', {
|
||||
|
||||
frappe.realtime.on('closing_process_complete', async function(data) {
|
||||
await frm.reload_doc();
|
||||
if (frm.doc.status == 'Failed' && frm.doc.error_message && data.user == frappe.session.user) {
|
||||
if (frm.doc.status == 'Failed' && frm.doc.error_message) {
|
||||
frappe.msgprint({
|
||||
title: __('POS Closing Failed'),
|
||||
message: frm.doc.error_message,
|
||||
|
@ -430,7 +430,7 @@ def create_merge_logs(invoice_by_customer, closing_entry=None):
|
||||
|
||||
finally:
|
||||
frappe.db.commit()
|
||||
frappe.publish_realtime("closing_process_complete", {"user": frappe.session.user})
|
||||
frappe.publish_realtime("closing_process_complete", user=frappe.session.user)
|
||||
|
||||
|
||||
def cancel_merge_logs(merge_logs, closing_entry=None):
|
||||
@ -457,7 +457,7 @@ def cancel_merge_logs(merge_logs, closing_entry=None):
|
||||
|
||||
finally:
|
||||
frappe.db.commit()
|
||||
frappe.publish_realtime("closing_process_complete", {"user": frappe.session.user})
|
||||
frappe.publish_realtime("closing_process_complete", user=frappe.session.user)
|
||||
|
||||
|
||||
def enqueue_job(job, **kwargs):
|
||||
|
@ -1345,7 +1345,7 @@ class QuickBooksMigrator(Document):
|
||||
)[0]["name"]
|
||||
|
||||
def _publish(self, *args, **kwargs):
|
||||
frappe.publish_realtime("quickbooks_progress_update", *args, **kwargs)
|
||||
frappe.publish_realtime("quickbooks_progress_update", *args, **kwargs, user=self.modified_by)
|
||||
|
||||
def _get_unique_account_name(self, quickbooks_name, number=0):
|
||||
if number:
|
||||
|
@ -304,6 +304,7 @@ class TallyMigration(Document):
|
||||
frappe.publish_realtime(
|
||||
"tally_migration_progress_update",
|
||||
{"title": title, "message": message, "count": count, "total": total},
|
||||
user=self.modified_by,
|
||||
)
|
||||
|
||||
def _import_master_data(self):
|
||||
|
@ -146,7 +146,9 @@ class ImportSupplierInvoice(Document):
|
||||
|
||||
def publish(self, title, message, count, total):
|
||||
frappe.publish_realtime(
|
||||
"import_invoice_update", {"title": title, "message": message, "count": count, "total": total}
|
||||
"import_invoice_update",
|
||||
{"title": title, "message": message, "count": count, "total": total},
|
||||
user=self.modified_by,
|
||||
)
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user