diff --git a/erpnext/hub_node/api.py b/erpnext/hub_node/api.py index 0d01c67650..f362539ee7 100644 --- a/erpnext/hub_node/api.py +++ b/erpnext/hub_node/api.py @@ -115,6 +115,16 @@ def get_valid_items(search_value=''): return valid_items +@frappe.whitelist() +def update_item(ref_doc, data): + data = json.loads(data) + + data.update(dict(doctype='Hub Item', name=ref_doc)) + try: + connection = get_hub_connection() + connection.update(data) + except Exception as e: + frappe.log_error(message=e, title='Hub Sync Error') @frappe.whitelist() def publish_selected_items(items_to_publish): diff --git a/erpnext/public/js/hub/components/edit_details_dialog.js b/erpnext/public/js/hub/components/edit_details_dialog.js new file mode 100644 index 0000000000..97c5f83a13 --- /dev/null +++ b/erpnext/public/js/hub/components/edit_details_dialog.js @@ -0,0 +1,41 @@ +function edit_details_dialog(params) { + let dialog = new frappe.ui.Dialog({ + title: __('Update Details'), + fields: [ + { + label: 'Item Name', + fieldname: 'item_name', + fieldtype: 'Data', + default: params.defaults.item_name, + reqd: 1 + }, + { + label: 'Hub Category', + fieldname: 'hub_category', + fieldtype: 'Autocomplete', + default: params.defaults.hub_category, + options: [], + reqd: 1 + }, + { + label: 'Description', + fieldname: 'description', + fieldtype: 'Text', + default: params.defaults.description, + options: [], + reqd: 1 + } + ], + primary_action_label: params.primary_action.label || __('Update Details'), + primary_action: params.primary_action.fn + }); + + hub.call('get_categories').then(categories => { + categories = categories.map(d => d.name); + dialog.fields_dict.hub_category.set_data(categories); + }); + + return dialog; +} + +export { edit_details_dialog }; diff --git a/erpnext/public/js/hub/pages/Item.vue b/erpnext/public/js/hub/pages/Item.vue index 841d0046db..11744781b7 100644 --- a/erpnext/public/js/hub/pages/Item.vue +++ b/erpnext/public/js/hub/pages/Item.vue @@ -1,10 +1,5 @@