fix: rename Update Log to Event Update Log for consistency
This commit is contained in:
parent
4d9a67f32c
commit
f99cbf9690
12 changed files with 19 additions and 19 deletions
|
|
@ -90,7 +90,7 @@ def get_data():
|
|||
},
|
||||
{
|
||||
"type": "doctype",
|
||||
"name": "Update Log",
|
||||
"name": "Event Update Log",
|
||||
"description": _("Maintains a Log of all inserts, updates and deletions on Event Producer site for documents that have consumers.")
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ def get_consumer_site(consumer_url):
|
|||
return consumer_site
|
||||
|
||||
def get_last_update():
|
||||
updates = frappe.get_list('Update Log', 'creation', ignore_permissions=True, limit = 1, order_by = 'creation desc')
|
||||
updates = frappe.get_list('Event Update Log', 'creation', ignore_permissions=True, limit = 1, order_by = 'creation desc')
|
||||
if updates:
|
||||
return updates[0].creation
|
||||
return frappe.utils.now_datetime()
|
||||
|
|
|
|||
|
|
@ -260,7 +260,7 @@ def set_delete(update):
|
|||
|
||||
def get_updates(producer_site, last_update, doctypes):
|
||||
docs = producer_site.get_list(
|
||||
doctype = 'Update Log',
|
||||
doctype = 'Event Update Log',
|
||||
filters = {'ref_doctype': ('in', doctypes), 'creation': ('>', last_update)},
|
||||
fields = ['update_type', 'ref_doctype', 'docname', 'data', 'name', 'creation']
|
||||
)
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ class TestEventProducer(unittest.TestCase):
|
|||
def test_update_log(self):
|
||||
producer = self.get_remote_site()
|
||||
producer_doc = insert_into_producer(producer, 'test update log')
|
||||
update_log_doc = producer.get_value('Update Log', 'docname', {'docname': producer_doc.get('name')})
|
||||
update_log_doc = producer.get_value('Event Update Log', 'docname', {'docname': producer_doc.get('name')})
|
||||
self.assertEqual(update_log_doc.get('docname'), producer_doc.get('name'))
|
||||
|
||||
def test_event_sync_log(self):
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors
|
||||
// For license information, please see license.txt
|
||||
|
||||
frappe.ui.form.on('Update Log', {
|
||||
frappe.ui.form.on('Event Update Log', {
|
||||
// refresh: function(frm) {
|
||||
|
||||
// }
|
||||
|
|
@ -45,7 +45,7 @@
|
|||
"modified": "2019-09-24 23:16:07.207707",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Events Streaming",
|
||||
"name": "Update Log",
|
||||
"name": "Event Update Log",
|
||||
"owner": "Administrator",
|
||||
"permissions": [
|
||||
{
|
||||
|
|
@ -8,7 +8,7 @@ from frappe.model.document import Document
|
|||
from frappe.utils.background_jobs import get_jobs
|
||||
from frappe.model import no_value_fields, table_fields
|
||||
|
||||
class UpdateLog(Document):
|
||||
class EventUpdateLog(Document):
|
||||
pass
|
||||
|
||||
def notify_consumers(doc, method=None):
|
||||
|
|
@ -6,5 +6,5 @@ from __future__ import unicode_literals
|
|||
# import frappe
|
||||
import unittest
|
||||
|
||||
class TestUpdateLog(unittest.TestCase):
|
||||
class TestEventUpdateLog(unittest.TestCase):
|
||||
pass
|
||||
|
|
@ -155,8 +155,8 @@ doc_events = {
|
|||
"Page": {
|
||||
"after_save": "frappe.cache_manager.build_domain_restriced_page_cache",
|
||||
},
|
||||
"Update Log": {
|
||||
"after_insert": "frappe.events_streaming.doctype.update_log.update_log.notify_consumers"
|
||||
"Event Update Log": {
|
||||
"after_insert": "frappe.events_streaming.doctype.event_update_log.event_update_log.notify_consumers"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ from frappe.model.naming import revert_series_if_last
|
|||
from frappe.utils.global_search import delete_for_document
|
||||
from frappe.desk.doctype.tag.tag import delete_tags_for_document
|
||||
from frappe.exceptions import FileNotFoundError
|
||||
from frappe.model.document import make_update_log, check_doctype_has_consumers
|
||||
from frappe.model.document import make_event_update_log, check_doctype_has_consumers
|
||||
|
||||
doctypes_to_skip = ("Communication", "ToDo", "DocShare", "Email Unsubscribe", "Activity Log", "File",
|
||||
"Version", "Document Follow", "Comment" , "View Log", "Tag Link", "Notification Log")
|
||||
|
|
@ -123,7 +123,7 @@ def delete_doc(doctype=None, name=None, force=0, ignore_doctypes=None, for_reloa
|
|||
|
||||
# update log if doctype has event consumers
|
||||
if not frappe.flags.in_install and not frappe.flags.in_migrate and check_doctype_has_consumers(doc.doctype):
|
||||
make_update_log(doc, update_type = 'Delete')
|
||||
make_event_update_log(doc, update_type = 'Delete')
|
||||
|
||||
if doc and not for_reload:
|
||||
add_to_deleted_document(doc)
|
||||
|
|
|
|||
|
|
@ -256,7 +256,7 @@ class Document(BaseDocument):
|
|||
if self.get("amended_from"):
|
||||
self.copy_attachments_from_amended_from()
|
||||
|
||||
#flag to prevent creation of update log for create and update both, during document creation
|
||||
#flag to prevent creation of event update log for create and update both, during document creation
|
||||
self.flags.update_log_for_doc_creation = True
|
||||
self.run_post_save_methods()
|
||||
self.flags.in_insert = False
|
||||
|
|
@ -946,18 +946,18 @@ class Document(BaseDocument):
|
|||
if (self.doctype, self.name) in frappe.flags.currently_saving:
|
||||
frappe.flags.currently_saving.remove((self.doctype, self.name))
|
||||
|
||||
# make update log for doctypes having event consumers
|
||||
# make event update log for doctypes having event consumers
|
||||
if not frappe.flags.in_install and not frappe.flags.in_migrate and check_doctype_has_consumers(self.doctype):
|
||||
if self.flags.update_log_for_doc_creation:
|
||||
make_update_log(self, update_type = 'Create')
|
||||
make_event_update_log(self, update_type = 'Create')
|
||||
self.flags.update_log_for_doc_creation = False
|
||||
else:
|
||||
from frappe.events_streaming.doctype.update_log.update_log import get_update
|
||||
from frappe.events_streaming.doctype.event_update_log.event_update_log import get_update
|
||||
diff = get_update(self._doc_before_save, self)
|
||||
if diff:
|
||||
doc = self
|
||||
doc.diff = diff
|
||||
make_update_log(doc, update_type = 'Update')
|
||||
make_event_update_log(doc, update_type = 'Update')
|
||||
|
||||
self.latest = None
|
||||
|
||||
|
|
@ -1284,7 +1284,7 @@ def execute_action(doctype, name, action, **kwargs):
|
|||
doc.add_comment('Comment', _('Action Failed') + '<br><br>' + msg)
|
||||
doc.notify_update()
|
||||
|
||||
def make_update_log(doc, update_type):
|
||||
def make_event_update_log(doc, update_type):
|
||||
'''Save update info for doctypes that have event consumers'''
|
||||
if update_type != 'Delete':
|
||||
#diff for update type, doc for create type
|
||||
|
|
@ -1292,7 +1292,7 @@ def make_update_log(doc, update_type):
|
|||
else:
|
||||
data = None
|
||||
log_doc = frappe.get_doc({
|
||||
'doctype': 'Update Log',
|
||||
'doctype': 'Event Update Log',
|
||||
'update_type': update_type,
|
||||
'ref_doctype': doc.doctype,
|
||||
'docname': doc.name,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue