diff --git a/erpnext/hub_node/__init__.py b/erpnext/hub_node/__init__.py
index ea1693d3777..df365528c3e 100644
--- a/erpnext/hub_node/__init__.py
+++ b/erpnext/hub_node/__init__.py
@@ -34,22 +34,29 @@ def get_meta(doctype):
def get_categories():
# get categories info with parent category and stuff
connection = get_client_connection()
- response = connection.get_list('Hub Category')
+ categories = connection.get_list('Hub Category')
+ print("============================================================")
+ print(categories)
+ response = [{'value': c.get('name'), 'expandable': c.get('is_group')} for c in categories]
return response
+ # return [
+ # {'value': 'Men', 'expandable': 1},
+ # {'value': 'Women', 'expandable': 0}
+ # ]
+
@frappe.whitelist()
-def get_item_details(hub_sync_id=None):
+def get_details(hub_sync_id=None, doctype='Hub Item'):
if not hub_sync_id:
return
connection = get_client_connection()
- item_details = connection.get_doc('Hub Item', hub_sync_id)
- print(item_details)
- return item_details
+ details = connection.get_doc(doctype, hub_sync_id)
+ return details
-@frappe.whitelist()
-def get_company_details(hub_sync_id):
- connection = get_client_connection()
- return connection.get_doc('Hub Company', hub_sync_id)
+# @frappe.whitelist()
+# def get_company_details(hub_sync_id):
+# connection = get_client_connection()
+# return connection.get_doc('Hub Company', hub_sync_id)
def get_client_connection():
# frappeclient connection
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index 69d8a4752cd..45a5b1145a6 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -484,7 +484,7 @@ erpnext.patches.v10_0.enabled_regional_print_format_based_on_country
erpnext.patches.v10_0.update_asset_calculate_depreciation
erpnext.patches.v10_0.add_guardian_role_for_parent_portal
erpnext.patches.v10_0.set_numeric_ranges_in_template_if_blank
-erpnext.patches.v10_0.update_reserved_qty_for_purchase_order
+#erpnext.patches.v10_0.update_reserved_qty_for_purchase_order
erpnext.patches.v10_0.fichier_des_ecritures_comptables_for_france
erpnext.patches.v10_0.update_assessment_plan
erpnext.patches.v10_0.update_assessment_result
@@ -493,4 +493,4 @@ erpnext.patches.v10_0.workflow_leave_application #2018-01-24 #2018-02-02 #2018-0
erpnext.patches.v10_0.set_default_payment_terms_based_on_company
erpnext.patches.v10_0.update_sales_order_link_to_purchase_order
erpnext.patches.v10_0.added_extra_gst_custom_field_in_gstr2
-erpnext.patches.v10_0.item_barcode_childtable_migrate
+#erpnext.patches.v10_0.item_barcode_childtable_migrate
diff --git a/erpnext/public/js/hub/hub_factory.js b/erpnext/public/js/hub/hub_factory.js
index 6789b80b84f..0318c998740 100644
--- a/erpnext/public/js/hub/hub_factory.js
+++ b/erpnext/public/js/hub/hub_factory.js
@@ -17,26 +17,19 @@ frappe.views.HubFactory = frappe.views.Factory.extend({
};
if (!erpnext.hub.pages[page_name]) {
- if (page === 'Item' && !route[2]) {
+ if (!route[2]) {
+ // page === 'Item' &&
frappe.require(assets['List'], () => {
- erpnext.hub.pages[page_name] = new erpnext.hub.ItemListing({
+ erpnext.hub.pages[page_name] = new erpnext.hub[page+'Listing']({
doctype: 'Hub Settings',
parent: this.make_page(true, page_name)
});
window.hub_page = erpnext.hub.pages[page_name];
});
- } if (page === 'Company' && !route[2]) {
- frappe.require(assets['List'], () => {
- erpnext.hub.pages[page_name] = new erpnext.hub.CompanyListing({
- doctype: 'Hub Settings',
- parent: this.make_page(true, page_name)
- });
- window.hub_page = erpnext.hub.pages[page_name];
- });
- } else if(route[2]) {
+ } else {
frappe.require(assets['Form'], () => {
- erpnext.hub.pages[page_name] = new erpnext.hub.HubForm({
- hub_item_code: route[2],
+ erpnext.hub.pages[page_name] = new erpnext.hub[page+'Page']({
+ unique_id: route[2],
doctype: 'Hub Settings',
parent: this.make_page(true, page_name)
});
diff --git a/erpnext/public/js/hub/hub_form.js b/erpnext/public/js/hub/hub_form.js
index 208af417ab8..eb7c6b4fb07 100644
--- a/erpnext/public/js/hub/hub_form.js
+++ b/erpnext/public/js/hub/hub_form.js
@@ -3,22 +3,23 @@ frappe.provide('erpnext.hub');
erpnext.hub.HubForm = class HubForm extends frappe.views.BaseList {
setup_defaults() {
super.setup_defaults();
- this.page_title = this.data.item_name || this.hub_item_code || __('Hub Item');
- this.method = 'erpnext.hub_node.get_item_details';
- }
-
- setup_fields() {
- this.fields = ['hub_item_code', 'item_name', 'item_code', 'description', 'seller', 'company_name', 'country'];
+ this.method = 'erpnext.hub_node.get_details';
+ //doctype, unique_id,
}
set_breadcrumbs() {
+ this.set_title();
frappe.breadcrumbs.add({
label: __('Hub'),
- route: '#Hub/Item',
+ route: '#Hub/' + this.doctype,
type: 'Custom'
});
}
+ set_title() {
+ this.page_title = this.data.item_name || this.hub_item_code || 'Hub' + this.doctype;
+ }
+
setup_side_bar() {
this.sidebar = new frappe.ui.Sidebar({
wrapper: this.$page.find('.layout-side-section'),
@@ -26,17 +27,14 @@ erpnext.hub.HubForm = class HubForm extends frappe.views.BaseList {
});
}
- setup_filter_area() {
+ setup_filter_area() { }
- }
-
- setup_sort_selector() {
-
- }
+ setup_sort_selector() { }
get_args() {
return {
- hub_sync_id: this.hub_item_code
+ hub_sync_id: this.unique_id,
+ doctype: 'Hub ' + this.doctype
};
}
@@ -49,8 +47,13 @@ erpnext.hub.HubForm = class HubForm extends frappe.views.BaseList {
}
render() {
+ const image_html = this.data[this.image_field_name] ?
+ `
+ ` :
+ `