[hub] Move sync, correct legacy code

This commit is contained in:
Prateeksha Singh 2018-08-06 17:48:45 +05:30
parent a5f6e54b70
commit b614ece991
3 changed files with 20 additions and 5 deletions

View File

@ -10,3 +10,8 @@ def enable_hub():
hub_settings.register() hub_settings.register()
frappe.db.commit() frappe.db.commit()
return hub_settings return hub_settings
@frappe.whitelist()
def sync():
hub_settings = frappe.get_doc('Hub Settings')
hub_settings.sync()

View File

@ -109,11 +109,6 @@ def reset_hub_settings(last_sync_datetime = ""):
doc.save() doc.save()
frappe.msgprint(_("Successfully unregistered.")) frappe.msgprint(_("Successfully unregistered."))
@frappe.whitelist()
def sync():
hub_settings = frappe.get_doc('Hub Settings')
hub_settings.sync()
@frappe.whitelist() @frappe.whitelist()
def register_seller(**kwargs): def register_seller(**kwargs):
settings = frappe.get_doc('Hub Settings') settings = frappe.get_doc('Hub Settings')

View File

@ -2,6 +2,21 @@ from __future__ import unicode_literals
import frappe, requests, json import frappe, requests, json
from frappe.utils import now, nowdate from frappe.utils import now, nowdate
from frappe.frappeclient import FrappeClient from frappe.frappeclient import FrappeClient
from frappe.utils.nestedset import get_root_of
from frappe.contacts.doctype.contact.contact import get_default_contact
def get_list(doctype, start, limit, fields, filters, order_by):
pass
def get_hub_connection():
if frappe.db.exists('Data Migration Connector', 'Hub Connector'):
hub_connector = frappe.get_doc('Data Migration Connector', 'Hub Connector')
hub_connection = hub_connector.get_connection()
return hub_connection.connection
# read-only connection
hub_connection = FrappeClient(frappe.conf.hub_url)
return hub_connection
@frappe.whitelist() @frappe.whitelist()
def get_item_favourites(start=0, limit=20, fields=["*"], order_by=None): def get_item_favourites(start=0, limit=20, fields=["*"], order_by=None):