mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-30 12:08:26 +00:00
[hub] test progress trigger
This commit is contained in:
@@ -73,14 +73,18 @@ def publish_selected_items(items_to_publish):
|
||||
if not len(items_to_publish):
|
||||
return
|
||||
|
||||
for item_code in items_to_publish:
|
||||
frappe.db.set_value('Item', item_code, 'publish_in_hub', 1)
|
||||
# TODO: sync
|
||||
# for item_code in items_to_publish:
|
||||
# frappe.db.set_value('Item', item_code, 'publish_in_hub', 1)
|
||||
|
||||
# hub_settings = frappe.get_doc('Hub Settings')
|
||||
# remote_id = item_sync_preprocess()
|
||||
# hub_settings.sync(remote_id)
|
||||
|
||||
# return remote_id
|
||||
|
||||
hub_settings = frappe.get_doc('Hub Settings')
|
||||
remote_id = item_sync_preprocess()
|
||||
hub_settings.sync(remote_id)
|
||||
|
||||
return remote_id
|
||||
hub_settings.sync('TEST')
|
||||
|
||||
def item_sync_preprocess():
|
||||
# Call Hub to make a new activity
|
||||
@@ -108,6 +112,7 @@ def item_sync_postprocess(obj):
|
||||
|
||||
if response:
|
||||
frappe.db.set_value('Hub Settings', 'Hub Settings', 'sync_in_progress', 0)
|
||||
frappe.db.set_value('Hub Settings', 'Hub Settings', 'last_sync_datetime', frappe.utils.now())
|
||||
else:
|
||||
frappe.throw('Unable to update remote activity')
|
||||
|
||||
|
||||
@@ -538,7 +538,7 @@
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"depends_on": "publish",
|
||||
"depends_on": "",
|
||||
"fieldname": "last_sync_datetime",
|
||||
"fieldtype": "Datetime",
|
||||
"hidden": 0,
|
||||
@@ -555,7 +555,7 @@
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -675,7 +675,7 @@
|
||||
"issingle": 1,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2018-07-30 08:01:09.024358",
|
||||
"modified": "2018-07-30 10:43:28.818498",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Hub Node",
|
||||
"name": "Hub Settings",
|
||||
|
||||
@@ -37,12 +37,31 @@ class HubSettings(Document):
|
||||
'doctype': 'Data Migration Run',
|
||||
'data_migration_plan': 'Hub Sync',
|
||||
'data_migration_connector': 'Hub Connector',
|
||||
'remote_id': remote_id
|
||||
'remote_id': remote_id,
|
||||
'trigger_name': 'items-sync'
|
||||
}).insert()
|
||||
|
||||
self.sync_in_progress = 1
|
||||
# time.sleep(10)
|
||||
doc.run()
|
||||
time.sleep(2)
|
||||
frappe.publish_realtime('items-sync', {"progress_percent": 20})
|
||||
print("=======================")
|
||||
|
||||
time.sleep(2)
|
||||
frappe.publish_realtime('items-sync', {"progress_percent": 40})
|
||||
print("=======================")
|
||||
|
||||
time.sleep(1)
|
||||
frappe.publish_realtime('items-sync', {"progress_percent": 80})
|
||||
print("=======================")
|
||||
|
||||
time.sleep(2)
|
||||
frappe.publish_realtime('items-sync', {"progress_percent": 100})
|
||||
print("=======================")
|
||||
|
||||
frappe.db.set_value('Hub Settings', 'Hub Settings', 'last_sync_datetime', frappe.utils.now())
|
||||
|
||||
# TODO: sync
|
||||
# self.sync_in_progress = 1
|
||||
# doc.run()
|
||||
else:
|
||||
frappe.throw("No remote ID specified")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user