mirror of
https://github.com/frappe/erpnext.git
synced 2026-03-30 17:42:32 +02:00
fix(realtime): Restrict updates to only last modified or current user (#33034)
(cherry picked from commit dd2493a541)
This commit is contained in:
@@ -20,7 +20,6 @@ frappe.ui.form.on('Opening Invoice Creation Tool', {
|
|||||||
frm.dashboard.reset();
|
frm.dashboard.reset();
|
||||||
frm.doc.import_in_progress = true;
|
frm.doc.import_in_progress = true;
|
||||||
}
|
}
|
||||||
if (data.user != frappe.session.user) return;
|
|
||||||
if (data.count == data.total) {
|
if (data.count == data.total) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
frm.doc.import_in_progress = false;
|
frm.doc.import_in_progress = false;
|
||||||
|
|||||||
@@ -262,10 +262,10 @@ def publish(index, total, doctype):
|
|||||||
dict(
|
dict(
|
||||||
title=_("Opening Invoice Creation In Progress"),
|
title=_("Opening Invoice Creation In Progress"),
|
||||||
message=_("Creating {} out of {} {}").format(index + 1, total, doctype),
|
message=_("Creating {} out of {} {}").format(index + 1, total, doctype),
|
||||||
user=frappe.session.user,
|
|
||||||
count=index + 1,
|
count=index + 1,
|
||||||
total=total,
|
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) {
|
frappe.realtime.on('closing_process_complete', async function(data) {
|
||||||
await frm.reload_doc();
|
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({
|
frappe.msgprint({
|
||||||
title: __('POS Closing Failed'),
|
title: __('POS Closing Failed'),
|
||||||
message: frm.doc.error_message,
|
message: frm.doc.error_message,
|
||||||
|
|||||||
@@ -431,7 +431,7 @@ def create_merge_logs(invoice_by_customer, closing_entry=None):
|
|||||||
|
|
||||||
finally:
|
finally:
|
||||||
frappe.db.commit()
|
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):
|
def cancel_merge_logs(merge_logs, closing_entry=None):
|
||||||
@@ -458,7 +458,7 @@ def cancel_merge_logs(merge_logs, closing_entry=None):
|
|||||||
|
|
||||||
finally:
|
finally:
|
||||||
frappe.db.commit()
|
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):
|
def enqueue_job(job, **kwargs):
|
||||||
|
|||||||
@@ -1345,7 +1345,7 @@ class QuickBooksMigrator(Document):
|
|||||||
)[0]["name"]
|
)[0]["name"]
|
||||||
|
|
||||||
def _publish(self, *args, **kwargs):
|
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):
|
def _get_unique_account_name(self, quickbooks_name, number=0):
|
||||||
if number:
|
if number:
|
||||||
|
|||||||
@@ -304,6 +304,7 @@ class TallyMigration(Document):
|
|||||||
frappe.publish_realtime(
|
frappe.publish_realtime(
|
||||||
"tally_migration_progress_update",
|
"tally_migration_progress_update",
|
||||||
{"title": title, "message": message, "count": count, "total": total},
|
{"title": title, "message": message, "count": count, "total": total},
|
||||||
|
user=self.modified_by,
|
||||||
)
|
)
|
||||||
|
|
||||||
def _import_master_data(self):
|
def _import_master_data(self):
|
||||||
|
|||||||
@@ -146,7 +146,9 @@ class ImportSupplierInvoice(Document):
|
|||||||
|
|
||||||
def publish(self, title, message, count, total):
|
def publish(self, title, message, count, total):
|
||||||
frappe.publish_realtime(
|
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,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user