fix: Set hub_url in Hub Settings
- add patch to set the value
diff --git a/erpnext/hub_node/api.py b/erpnext/hub_node/api.py
index 441d30b..74219da 100644
--- a/erpnext/hub_node/api.py
+++ b/erpnext/hub_node/api.py
@@ -180,9 +180,9 @@
# read-only connection
if read_only:
- hub_connection = FrappeClient(frappe.conf.hub_url)
+ hub_url = frappe.db.get_single_value('Hub Settings', 'hub_url')
+ hub_connection = FrappeClient(hub_url)
return hub_connection
-
def get_field_mappings():
return []
diff --git a/erpnext/hub_node/doctype/hub_settings/hub_settings.js b/erpnext/hub_node/doctype/hub_settings/hub_settings.js
index be8fe21..03314bb 100644
--- a/erpnext/hub_node/doctype/hub_settings/hub_settings.js
+++ b/erpnext/hub_node/doctype/hub_settings/hub_settings.js
@@ -1,8 +1,4 @@
frappe.ui.form.on("Hub Settings", {
- refresh: function(frm) {
- frm.disable_save();
- },
-
onload_post_render: function(frm) {
if(frm.get_field("unregister_from_hub").$input)
frm.get_field("unregister_from_hub").$input.addClass("btn-danger");
diff --git a/erpnext/hub_node/doctype/hub_settings/hub_settings.json b/erpnext/hub_node/doctype/hub_settings/hub_settings.json
index 30eaa0b..e230515 100644
--- a/erpnext/hub_node/doctype/hub_settings/hub_settings.json
+++ b/erpnext/hub_node/doctype/hub_settings/hub_settings.json
@@ -19,6 +19,39 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "default": "https://hubmarket.org",
+ "fieldname": "hub_url",
+ "fieldtype": "Data",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Hub URL",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
"fieldname": "registered",
"fieldtype": "Check",
"hidden": 0,
@@ -446,8 +479,8 @@
"issingle": 1,
"istable": 0,
"max_attachments": 0,
- "modified": "2018-08-29 16:56:37.560417",
- "modified_by": "faris@erpnext.com",
+ "modified": "2018-08-29 17:46:30.413159",
+ "modified_by": "Administrator",
"module": "Hub Node",
"name": "Hub Settings",
"name_case": "",
@@ -480,5 +513,6 @@
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1,
- "track_seen": 0
+ "track_seen": 0,
+ "track_views": 0
}
\ No newline at end of file
diff --git a/erpnext/hub_node/doctype/hub_settings/hub_settings.py b/erpnext/hub_node/doctype/hub_settings/hub_settings.py
index e112015..7478db9 100644
--- a/erpnext/hub_node/doctype/hub_settings/hub_settings.py
+++ b/erpnext/hub_node/doctype/hub_settings/hub_settings.py
@@ -18,9 +18,7 @@
self.site_name = frappe.utils.get_url()
def get_hub_url(self):
- if not frappe.conf.hub_url:
- frappe.throw('hub_url is not set in site_config')
- return frappe.conf.hub_url
+ return self.hub_url
def register(self):
""" Create a User on hub.erpnext.org and return username/password """
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index ce69968..6738598 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -559,3 +559,4 @@
erpnext.patches.v10_0.update_address_template_for_india
execute:frappe.delete_doc("Page", "hub")
erpnext.patches.v11_0.reset_publish_in_hub_for_all_items
+erpnext.patches.v11_0.update_hub_url
\ No newline at end of file
diff --git a/erpnext/patches/v11_0/update_hub_url.py b/erpnext/patches/v11_0/update_hub_url.py
new file mode 100644
index 0000000..ced2aaf
--- /dev/null
+++ b/erpnext/patches/v11_0/update_hub_url.py
@@ -0,0 +1,5 @@
+import frappe
+
+def execute():
+ frappe.reload_doc('hub_node', 'doctype', 'Hub Settings')
+ frappe.db.set_value('Hub Settings', 'Hub Settings', 'hub_url', 'https://hubmarket.org')