mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-13 02:01:21 +00:00
[hub][publish] in_progress/empty state
This commit is contained in:
@@ -55,13 +55,15 @@ def get_valid_items(search_value=''):
|
||||
|
||||
@frappe.whitelist()
|
||||
def publish_selected_items(items_to_publish):
|
||||
# for item_code in json.loads(items_to_publish):
|
||||
# frappe.db.set_value('Item', item_code, 'publish_in_hub', 1)
|
||||
for item_code in json.loads(items_to_publish):
|
||||
frappe.db.set_value('Item', item_code, 'publish_in_hub', 1)
|
||||
|
||||
time.sleep(3)
|
||||
# frappe.db.set_value("Hub Settings", "Hub Settings", "sync_in_progress", 1)
|
||||
# time.sleep(10)
|
||||
# frappe.db.set_value("Hub Settings", "Hub Settings", "sync_in_progress", 0)
|
||||
|
||||
# hub_settings = frappe.get_doc('Hub Settings')
|
||||
# hub_settings.sync()
|
||||
hub_settings = frappe.get_doc('Hub Settings')
|
||||
hub_settings.sync()
|
||||
|
||||
return
|
||||
|
||||
|
||||
@@ -46,10 +46,12 @@ class HubSettings(Document):
|
||||
doc = frappe.get_doc({
|
||||
'doctype': 'Data Migration Run',
|
||||
'data_migration_plan': 'Hub Sync',
|
||||
'data_migration_connector': 'Hub Connector'
|
||||
'data_migration_connector': 'Hub Connector',
|
||||
}).insert()
|
||||
|
||||
self.sync_in_progress = 1
|
||||
doc.run()
|
||||
self.sync_in_progress = 0
|
||||
|
||||
def pre_reg(self):
|
||||
site_name = frappe.local.site + ':' + str(frappe.conf.webserver_port)
|
||||
@@ -86,9 +88,9 @@ class HubSettings(Document):
|
||||
post_url = hub_url + '/api/method/hub.hub.api.register'
|
||||
|
||||
response = requests.post(post_url, data=data, headers = {'accept': 'application/json'})
|
||||
|
||||
|
||||
response.raise_for_status()
|
||||
|
||||
|
||||
if response.ok:
|
||||
message = response.json().get('message')
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user