fix: Set hub_url in Hub Settings

- add patch to set the value
This commit is contained in:
Faris Ansari 2018-08-29 18:24:49 +05:30
parent e4c7729089
commit 114d595de9
6 changed files with 46 additions and 12 deletions

View File

@ -180,9 +180,9 @@ def get_hub_connection():
# 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 []

View File

@ -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");

View File

@ -12,6 +12,39 @@
"document_type": "",
"editable_grid": 0,
"fields": [
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"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,
@ -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
}

View File

@ -18,9 +18,7 @@ class HubSettings(Document):
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 """

View File

@ -559,3 +559,4 @@ erpnext.patches.v11_0.add_item_group_defaults
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

View File

@ -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')