fix(Event Streaming): set remote docname and site name before inserting mapped doc
- needed to differentiate a remote doc at the time of insertion
This commit is contained in:
parent
6dfbf7b19e
commit
4c965d54df
1 changed files with 3 additions and 8 deletions
|
|
@ -315,8 +315,9 @@ def set_insert(update, producer_site, event_producer):
|
|||
else:
|
||||
# if event consumer is not saving documents with the same name as the producer
|
||||
# store the remote docname in a custom field for future updates
|
||||
local_doc = doc.insert(set_child_names=False)
|
||||
set_custom_fields(local_doc, update.docname, event_producer)
|
||||
doc.remote_docname = update.docname
|
||||
doc.remote_site_name = event_producer
|
||||
doc.insert(set_child_names=False)
|
||||
|
||||
|
||||
def set_update(update, producer_site):
|
||||
|
|
@ -567,9 +568,3 @@ def resync(update):
|
|||
update = get_mapped_update(update, producer_site)
|
||||
update.data = json.loads(update.data)
|
||||
return sync(update, producer_site, event_producer, in_retry=True)
|
||||
|
||||
|
||||
def set_custom_fields(local_doc, remote_docname, remote_site_name):
|
||||
"""sets custom field in doc for storing remote docname"""
|
||||
frappe.db.set_value(local_doc.doctype, local_doc.name, "remote_docname", remote_docname)
|
||||
frappe.db.set_value(local_doc.doctype, local_doc.name, "remote_site_name", remote_site_name)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue