From 431b4fba7264f3087e9bc6cce1ba40ace96c6c01 Mon Sep 17 00:00:00 2001 From: johnhkelley1 Date: Wed, 5 Sep 2018 00:13:28 -0600 Subject: [PATCH 01/14] Allow for 0 valuation rate in Stock Reconciliation (#15313) Currently, a valuation rate of 0 gets treated the same as an omitted valuation rate, and gets overwritten during validation. This hotfix allows a Stock Reconciliation Item's valuation rate to be set to 0. --- .../stock/doctype/stock_reconciliation/stock_reconciliation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py index 5e6966437b..5b6e706674 100644 --- a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py +++ b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py @@ -109,7 +109,7 @@ class StockReconciliation(StockController): self.validation_messages.append(_get_msg(row_num, _("Negative Valuation Rate is not allowed"))) - if row.qty and not row.valuation_rate: + if row.qty and row.valuation_rate in ["", None]: row.valuation_rate = get_stock_balance(row.item_code, row.warehouse, self.posting_date, self.posting_time, with_valuation_rate=True)[1] if not row.valuation_rate: From 0d931e1d7d2a60b0aa46d51a15f57bd3b22cccd6 Mon Sep 17 00:00:00 2001 From: Zarrar Date: Thu, 6 Sep 2018 13:08:58 +0530 Subject: [PATCH 02/14] fix uom & stock_uom print hide logic (#15327) --- .../templates/print_formats/includes/item_table_qty.html | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/erpnext/templates/print_formats/includes/item_table_qty.html b/erpnext/templates/print_formats/includes/item_table_qty.html index 0c80069885..239859eea1 100644 --- a/erpnext/templates/print_formats/includes/item_table_qty.html +++ b/erpnext/templates/print_formats/includes/item_table_qty.html @@ -1,4 +1,6 @@ -{% if (doc.stock_uom and not doc.is_print_hide("stock_uom")) or (doc.uom and not doc.is_print_hide("uom")) -%} -{{ _(doc.uom or doc.stock_uom) }} +{% if (doc.uom and not doc.is_print_hide("uom")) %} + {{ _(doc.uom) }} +{% elif (doc.stock_uom and not doc.is_print_hide("stock_uom")) %} + {{ _(doc.stock_uom) }} {%- endif %} {{ doc.get_formatted("qty", doc) }} From 3ccbb8f8b7d99476656a0faf8ab6e18d320314d4 Mon Sep 17 00:00:00 2001 From: Prateeksha Singh Date: Thu, 6 Sep 2018 13:28:47 +0530 Subject: [PATCH 03/14] [remove-hub] delete hub_settings and hub_category --- .../hub_node/doctype/hub_category/__init__.py | 0 .../doctype/hub_category/hub_category.js | 8 - .../doctype/hub_category/hub_category.json | 275 --------- .../doctype/hub_category/hub_category.py | 11 - .../doctype/hub_category/hub_category_tree.js | 4 - .../doctype/hub_category/test_hub_category.js | 23 - .../doctype/hub_category/test_hub_category.py | 10 - .../hub_node/doctype/hub_settings/__init__.py | 0 .../doctype/hub_settings/hub_settings.js | 87 --- .../doctype/hub_settings/hub_settings.json | 525 ------------------ .../doctype/hub_settings/hub_settings.py | 103 ---- .../doctype/hub_settings/test_hub_settings.js | 23 - .../doctype/hub_settings/test_hub_settings.py | 10 - 13 files changed, 1079 deletions(-) delete mode 100644 erpnext/hub_node/doctype/hub_category/__init__.py delete mode 100644 erpnext/hub_node/doctype/hub_category/hub_category.js delete mode 100644 erpnext/hub_node/doctype/hub_category/hub_category.json delete mode 100644 erpnext/hub_node/doctype/hub_category/hub_category.py delete mode 100644 erpnext/hub_node/doctype/hub_category/hub_category_tree.js delete mode 100644 erpnext/hub_node/doctype/hub_category/test_hub_category.js delete mode 100644 erpnext/hub_node/doctype/hub_category/test_hub_category.py delete mode 100644 erpnext/hub_node/doctype/hub_settings/__init__.py delete mode 100644 erpnext/hub_node/doctype/hub_settings/hub_settings.js delete mode 100644 erpnext/hub_node/doctype/hub_settings/hub_settings.json delete mode 100644 erpnext/hub_node/doctype/hub_settings/hub_settings.py delete mode 100644 erpnext/hub_node/doctype/hub_settings/test_hub_settings.js delete mode 100644 erpnext/hub_node/doctype/hub_settings/test_hub_settings.py diff --git a/erpnext/hub_node/doctype/hub_category/__init__.py b/erpnext/hub_node/doctype/hub_category/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/erpnext/hub_node/doctype/hub_category/hub_category.js b/erpnext/hub_node/doctype/hub_category/hub_category.js deleted file mode 100644 index 9f54166e14..0000000000 --- a/erpnext/hub_node/doctype/hub_category/hub_category.js +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors -// For license information, please see license.txt - -frappe.ui.form.on('Hub Category', { - refresh: function(frm) { - - } -}); diff --git a/erpnext/hub_node/doctype/hub_category/hub_category.json b/erpnext/hub_node/doctype/hub_category/hub_category.json deleted file mode 100644 index 4f8d66ace0..0000000000 --- a/erpnext/hub_node/doctype/hub_category/hub_category.json +++ /dev/null @@ -1,275 +0,0 @@ -{ - "allow_copy": 0, - "allow_guest_to_view": 0, - "allow_import": 0, - "allow_rename": 0, - "autoname": "field:hub_category_name", - "beta": 0, - "creation": "2017-08-22 11:31:10.410322", - "custom": 0, - "docstatus": 0, - "doctype": "DocType", - "document_type": "", - "editable_grid": 1, - "engine": "InnoDB", - "fields": [ - { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "hub_category_name", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 1, - "in_standard_filter": 0, - "label": "Category Name", - "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": 1, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "parent_hub_category", - "fieldtype": "Link", - "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": "Parent Category", - "length": 0, - "no_copy": 0, - "options": "Hub Category", - "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, - "unique": 0 - }, - { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "is_group", - "fieldtype": "Check", - "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": "Is Group", - "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, - "unique": 0 - }, - { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "description", - "fieldtype": "Text Editor", - "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": "Description", - "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, - "unique": 0 - }, - { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "lft", - "fieldtype": "Int", - "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": "Left", - "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, - "unique": 0 - }, - { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "rgt", - "fieldtype": "Int", - "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": "Right", - "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, - "unique": 0 - }, - { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "old_parent", - "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": "Old Parent", - "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, - "unique": 0 - } - ], - "has_web_view": 0, - "hide_heading": 0, - "hide_toolbar": 0, - "idx": 0, - "image_view": 0, - "in_create": 0, - "is_submittable": 0, - "issingle": 0, - "istable": 0, - "max_attachments": 0, - "modified": "2017-09-03 22:04:22.958831", - "modified_by": "Administrator", - "module": "Hub Node", - "name": "Hub Category", - "name_case": "", - "owner": "Administrator", - "permissions": [ - { - "amend": 0, - "apply_user_permissions": 0, - "cancel": 0, - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "if_owner": 0, - "import": 0, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "System Manager", - "set_user_permissions": 0, - "share": 1, - "submit": 0, - "write": 1 - } - ], - "quick_entry": 1, - "read_only": 0, - "read_only_onload": 0, - "show_name_in_global_search": 0, - "sort_field": "modified", - "sort_order": "DESC", - "title_field": "hub_category_name", - "track_changes": 1, - "track_seen": 0 -} \ No newline at end of file diff --git a/erpnext/hub_node/doctype/hub_category/hub_category.py b/erpnext/hub_node/doctype/hub_category/hub_category.py deleted file mode 100644 index 5d19082324..0000000000 --- a/erpnext/hub_node/doctype/hub_category/hub_category.py +++ /dev/null @@ -1,11 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors -# For license information, please see license.txt - -from __future__ import unicode_literals -import frappe -from frappe.utils.nestedset import NestedSet -from frappe.model.document import Document - -class HubCategory(NestedSet): - pass diff --git a/erpnext/hub_node/doctype/hub_category/hub_category_tree.js b/erpnext/hub_node/doctype/hub_category/hub_category_tree.js deleted file mode 100644 index d0309e3d98..0000000000 --- a/erpnext/hub_node/doctype/hub_category/hub_category_tree.js +++ /dev/null @@ -1,4 +0,0 @@ -frappe.treeview_settings["Hub Category"] = { - title: __("Hub Category"), - breadcrumb: "Hub" -} \ No newline at end of file diff --git a/erpnext/hub_node/doctype/hub_category/test_hub_category.js b/erpnext/hub_node/doctype/hub_category/test_hub_category.js deleted file mode 100644 index 73c06d5a92..0000000000 --- a/erpnext/hub_node/doctype/hub_category/test_hub_category.js +++ /dev/null @@ -1,23 +0,0 @@ -/* eslint-disable */ -// rename this file from _test_[name] to test_[name] to activate -// and remove above this line - -QUnit.test("test: Hub Category", function (assert) { - let done = assert.async(); - - // number of asserts - assert.expect(1); - - frappe.run_serially([ - // insert a new Hub Category - () => frappe.tests.make('Hub Category', [ - // values to be set - {key: 'value'} - ]), - () => { - assert.equal(cur_frm.doc.key, 'value'); - }, - () => done() - ]); - -}); diff --git a/erpnext/hub_node/doctype/hub_category/test_hub_category.py b/erpnext/hub_node/doctype/hub_category/test_hub_category.py deleted file mode 100644 index 7df20889a7..0000000000 --- a/erpnext/hub_node/doctype/hub_category/test_hub_category.py +++ /dev/null @@ -1,10 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors -# See license.txt -from __future__ import unicode_literals - -import frappe -import unittest - -class TestHubCategory(unittest.TestCase): - pass diff --git a/erpnext/hub_node/doctype/hub_settings/__init__.py b/erpnext/hub_node/doctype/hub_settings/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/erpnext/hub_node/doctype/hub_settings/hub_settings.js b/erpnext/hub_node/doctype/hub_settings/hub_settings.js deleted file mode 100644 index ce0f8bc352..0000000000 --- a/erpnext/hub_node/doctype/hub_settings/hub_settings.js +++ /dev/null @@ -1,87 +0,0 @@ -frappe.ui.form.on("Hub Settings", { - refresh: function(frm) { - frm.add_custom_button(__('Logs'), - () => frappe.set_route('List', 'Data Migration Run', { - data_migration_plan: 'Hub Sync' - })); - - frm.trigger("enabled"); - if (frm.doc.enabled) { - frm.add_custom_button(__('View Hub'), - () => frappe.set_route('hub')); - frm.add_custom_button(__('Sync'), - () => frm.call('sync')); - } - }, - onload: function(frm) { - if(!frm.doc.country) { - frm.set_value("country", frappe.defaults.get_default("Country")); - } - if(!frm.doc.company) { - frm.set_value("company", frappe.defaults.get_default("Company")); - } - }, - onload_post_render: function(frm) { - if(frm.get_field("unregister_from_hub").$input) - frm.get_field("unregister_from_hub").$input.addClass("btn-danger"); - }, - on_update: function(frm) { - }, - enabled: function(frm) { - if(!frm.doc.enabled) { - frm.trigger("set_enable_hub_primary_button"); - } else { - frm.page.set_primary_action(__("Save Settings"), () => { - frm.save(); - }); - } - }, - - hub_user_email: function(frm) { - if(frm.doc.hub_user_email){ - frm.set_value("hub_user_name", frappe.user.full_name(frm.doc.hub_user_email)); - } - }, - - set_enable_hub_primary_button: (frm) => { - frm.page.set_primary_action(__("Enable Hub"), () => { - if(frappe.session.user === "Administrator") { - frappe.msgprint("Please login as another user.") - } else { - frappe.verify_password(() => { - this.frm.call({ - doc: this.frm.doc, - method: "register", - args: {}, - freeze: true, - callback: function(r) {}, - onerror: function() { - frappe.msgprint(__("Wrong Password")); - frm.set_value("enabled", 0); - } - }); - } ); - } - }); - }, - - // update_hub: (frm) => { - // this.frm.call({ - // doc: this.frm.doc, - // method: "update_hub", - // args: {}, - // freeze: true, - // callback: function(r) { }, - // onerror: function() { } - // }); - // }, - - unregister_from_hub: (frm) => { - frappe.verify_password(() => { - var d = frappe.confirm(__('Are you sure you want to unregister?'), () => { - frm.call('unregister'); - }, () => {}, __('Confirm Action')); - d.get_primary_btn().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 deleted file mode 100644 index b96d6b3643..0000000000 --- a/erpnext/hub_node/doctype/hub_settings/hub_settings.json +++ /dev/null @@ -1,525 +0,0 @@ -{ - "allow_copy": 0, - "allow_guest_to_view": 0, - "allow_import": 0, - "allow_rename": 0, - "beta": 1, - "creation": "2015-02-18 00:59:34.560476", - "custom": 0, - "description": "", - "docstatus": 0, - "doctype": "DocType", - "document_type": "", - "editable_grid": 0, - "fields": [ - { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "enabled", - "fieldtype": "Check", - "hidden": 1, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Enabled", - "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, - "unique": 0 - }, - { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "suspended", - "fieldtype": "Check", - "hidden": 1, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Suspended", - "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, - "unique": 0 - }, - { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "user", - "fieldtype": "Link", - "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": "User", - "length": 0, - "no_copy": 0, - "options": "User", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 1, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 1, - "collapsible_depends_on": "eval:(!doc.enabled)", - "columns": 0, - "depends_on": "", - "fieldname": "seller_profile_section", - "fieldtype": "Section Break", - "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": "Company and Seller Profile", - "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, - "unique": 0 - }, - { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "company", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 1, - "in_standard_filter": 0, - "label": "Company", - "length": 0, - "no_copy": 0, - "options": "Company", - "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, - "unique": 0 - }, - { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "country", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 1, - "in_standard_filter": 0, - "label": "Country", - "length": 0, - "no_copy": 0, - "options": "Country", - "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, - "unique": 0 - }, - { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "seller_description", - "fieldtype": "Text Editor", - "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": "Description", - "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, - "unique": 0 - }, - { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "enabled", - "fieldname": "publish_section", - "fieldtype": "Section Break", - "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": "Publish", - "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, - "unique": 0 - }, - { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "publish", - "fieldtype": "Check", - "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": "Publish Items to Hub", - "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, - "unique": 0 - }, - { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "publish", - "fieldname": "publish_pricing", - "fieldtype": "Check", - "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": "Publish Pricing", - "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, - "unique": 0 - }, - { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "eval:(doc.publish && doc.publish_pricing)", - "fieldname": "selling_price_list", - "fieldtype": "Link", - "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": "Selling Price List", - "length": 0, - "no_copy": 0, - "options": "Price List", - "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, - "unique": 0 - }, - { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "publish", - "fieldname": "publish_availability", - "fieldtype": "Check", - "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": "Publish Availability", - "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, - "unique": 0 - }, - { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "publish", - "fieldname": "last_sync_datetime", - "fieldtype": "Datetime", - "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": "Last Sync On", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 1, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "collapsible_depends_on": "", - "columns": 0, - "depends_on": "enabled", - "fieldname": "unregister_section", - "fieldtype": "Section Break", - "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": "Unregister", - "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, - "unique": 0 - }, - { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "unregister_from_hub", - "fieldtype": "Button", - "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": "Unregister from Hub", - "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, - "unique": 0 - } - ], - "has_web_view": 0, - "hide_heading": 0, - "hide_toolbar": 0, - "idx": 0, - "image_view": 0, - "in_create": 0, - "is_submittable": 0, - "issingle": 1, - "istable": 0, - "max_attachments": 0, - "modified": "2017-09-21 12:13:50.841646", - "modified_by": "manas@erpnext.com", - "module": "Hub Node", - "name": "Hub Settings", - "name_case": "", - "owner": "Administrator", - "permissions": [ - { - "amend": 0, - "apply_user_permissions": 0, - "cancel": 0, - "create": 1, - "delete": 0, - "email": 0, - "export": 0, - "if_owner": 0, - "import": 0, - "permlevel": 0, - "print": 0, - "read": 1, - "report": 0, - "role": "System Manager", - "set_user_permissions": 0, - "share": 0, - "submit": 0, - "write": 1 - } - ], - "quick_entry": 0, - "read_only": 0, - "read_only_onload": 0, - "show_name_in_global_search": 0, - "sort_field": "modified", - "sort_order": "DESC", - "track_changes": 1, - "track_seen": 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 deleted file mode 100644 index 59807532e0..0000000000 --- a/erpnext/hub_node/doctype/hub_settings/hub_settings.py +++ /dev/null @@ -1,103 +0,0 @@ -# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors and contributors -# For license information, please see license.txt - -from __future__ import unicode_literals -import frappe, requests, json - -from frappe.model.document import Document -from frappe.utils import add_years, now, get_datetime, get_datetime_str -from frappe import _ -from erpnext.utilities.product import get_price, get_qty_in_stock -from six import string_types - -hub_url = "https://hubmarket.org" - -class HubSetupError(frappe.ValidationError): pass - -class HubSettings(Document): - - def validate(self): - if self.publish_pricing and not self.selling_price_list: - frappe.throw(_("Please select a Price List to publish pricing")) - - def get_hub_url(self): - return hub_url - - def sync(self): - """Create and execute Data Migration Run for Hub Sync plan""" - frappe.has_permission('Hub Settings', throw=True) - - doc = frappe.get_doc({ - 'doctype': 'Data Migration Run', - 'data_migration_plan': 'Hub Sync', - 'data_migration_connector': 'Hub Connector' - }).insert() - - doc.run() - - def register(self): - """ Create a User on hub.erpnext.org and return username/password """ - data = { - 'email': frappe.session.user - } - post_url = hub_url + '/api/method/hub.hub.api.register' - - response = requests.post(post_url, data=data) - response.raise_for_status() - message = response.json().get('message') - - if message and message.get('password'): - self.user = frappe.session.user - self.create_hub_connector(message) - self.company = frappe.defaults.get_user_default('company') - self.enabled = 1 - self.save() - - def unregister(self): - """ Disable the User on hub.erpnext.org""" - - hub_connector = frappe.get_doc( - 'Data Migration Connector', 'Hub Connector') - - connection = hub_connector.get_connection() - response_doc = connection.update('User', frappe._dict({'enabled': 0}), hub_connector.username) - - if response_doc['enabled'] == 0: - self.enabled = 0 - self.save() - - def create_hub_connector(self, message): - if frappe.db.exists('Data Migration Connector', 'Hub Connector'): - hub_connector = frappe.get_doc('Data Migration Connector', 'Hub Connector') - hub_connector.username = message['email'] - hub_connector.password = message['password'] - hub_connector.save() - return - - frappe.get_doc({ - 'doctype': 'Data Migration Connector', - 'connector_type': 'Frappe', - 'connector_name': 'Hub Connector', - 'hostname': hub_url, - 'username': message['email'], - 'password': message['password'] - }).insert() - -def reset_hub_publishing_settings(last_sync_datetime = ""): - doc = frappe.get_doc("Hub Settings", "Hub Settings") - doc.reset_publishing_settings(last_sync_datetime) - doc.in_callback = 1 - doc.save() - -def reset_hub_settings(last_sync_datetime = ""): - doc = frappe.get_doc("Hub Settings", "Hub Settings") - doc.reset_publishing_settings(last_sync_datetime) - doc.reset_enable() - doc.in_callback = 1 - doc.save() - frappe.msgprint(_("Successfully unregistered.")) - -@frappe.whitelist() -def sync(): - hub_settings = frappe.get_doc('Hub Settings') - hub_settings.sync() diff --git a/erpnext/hub_node/doctype/hub_settings/test_hub_settings.js b/erpnext/hub_node/doctype/hub_settings/test_hub_settings.js deleted file mode 100644 index 546ce1504c..0000000000 --- a/erpnext/hub_node/doctype/hub_settings/test_hub_settings.js +++ /dev/null @@ -1,23 +0,0 @@ -/* eslint-disable */ -// rename this file from _test_[name] to test_[name] to activate -// and remove above this line - -QUnit.test("test: Hub Settings", function (assert) { - let done = assert.async(); - - // number of asserts - assert.expect(1); - - frappe.run_serially('Hub Settings', [ - // insert a new Hub Settings - () => frappe.tests.make([ - // values to be set - {key: 'value'} - ]), - () => { - assert.equal(cur_frm.doc.key, 'value'); - }, - () => done() - ]); - -}); diff --git a/erpnext/hub_node/doctype/hub_settings/test_hub_settings.py b/erpnext/hub_node/doctype/hub_settings/test_hub_settings.py deleted file mode 100644 index 1299adc17e..0000000000 --- a/erpnext/hub_node/doctype/hub_settings/test_hub_settings.py +++ /dev/null @@ -1,10 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors -# See license.txt -from __future__ import unicode_literals - -import frappe -import unittest - -class TestHubSettings(unittest.TestCase): - pass From df327f2974e096522c7c6d56ca0195d413c48b20 Mon Sep 17 00:00:00 2001 From: Prateeksha Singh Date: Thu, 6 Sep 2018 13:34:47 +0530 Subject: [PATCH 04/14] [remove-hub] delete hub module --- erpnext/config/desktop.py | 8 - erpnext/config/hub_node.py | 24 --- erpnext/hub_node/__init__.py | 184 ------------------ .../data_migration_mapping/__init__.py | 0 .../company_to_hub_company/__init__.py | 0 .../company_to_hub_company.json | 45 ----- .../hub_message_to_lead/__init__.py | 29 --- .../hub_message_to_lead.json | 31 --- .../item_to_hub_item/__init__.py | 0 .../item_to_hub_item/item_to_hub_item.json | 55 ------ .../hub_sync/hub_sync.json | 26 --- erpnext/hub_node/doctype/__init__.py | 0 12 files changed, 402 deletions(-) delete mode 100644 erpnext/config/hub_node.py delete mode 100644 erpnext/hub_node/__init__.py delete mode 100644 erpnext/hub_node/data_migration_mapping/__init__.py delete mode 100644 erpnext/hub_node/data_migration_mapping/company_to_hub_company/__init__.py delete mode 100644 erpnext/hub_node/data_migration_mapping/company_to_hub_company/company_to_hub_company.json delete mode 100644 erpnext/hub_node/data_migration_mapping/hub_message_to_lead/__init__.py delete mode 100644 erpnext/hub_node/data_migration_mapping/hub_message_to_lead/hub_message_to_lead.json delete mode 100644 erpnext/hub_node/data_migration_mapping/item_to_hub_item/__init__.py delete mode 100644 erpnext/hub_node/data_migration_mapping/item_to_hub_item/item_to_hub_item.json delete mode 100644 erpnext/hub_node/data_migration_plan/hub_sync/hub_sync.json delete mode 100644 erpnext/hub_node/doctype/__init__.py diff --git a/erpnext/config/desktop.py b/erpnext/config/desktop.py index 6d4fe02360..26bc21e01b 100644 --- a/erpnext/config/desktop.py +++ b/erpnext/config/desktop.py @@ -291,14 +291,6 @@ def get_data(): "label": _("Healthcare"), "hidden": 1 }, - { - "module_name": "Hub", - "color": "#009248", - "icon": "/assets/erpnext/images/hub_logo.svg", - "type": "page", - "link": "hub", - "label": _("Hub") - }, { "module_name": "Data Import", "color": "#FFF168", diff --git a/erpnext/config/hub_node.py b/erpnext/config/hub_node.py deleted file mode 100644 index c9d5b97bf0..0000000000 --- a/erpnext/config/hub_node.py +++ /dev/null @@ -1,24 +0,0 @@ -from __future__ import unicode_literals -from frappe import _ - -def get_data(): - return [ - { - "label": _("Setup"), - "items": [ - { - "type": "doctype", - "name": "Hub Settings" - }, - ] - }, - { - "label": _("Hub"), - "items": [ - { - "type": "page", - "name": "hub" - }, - ] - }, - ] \ No newline at end of file diff --git a/erpnext/hub_node/__init__.py b/erpnext/hub_node/__init__.py deleted file mode 100644 index 8eb10747fd..0000000000 --- a/erpnext/hub_node/__init__.py +++ /dev/null @@ -1,184 +0,0 @@ -# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors and contributors -# For license information, please see license.txt - -from __future__ import unicode_literals -import frappe, requests, json -from frappe.utils import now, nowdate, cint -from frappe.utils.nestedset import get_root_of -from frappe.contacts.doctype.contact.contact import get_default_contact - -@frappe.whitelist() -def enable_hub(): - hub_settings = frappe.get_doc('Hub Settings') - hub_settings.register() - frappe.db.commit() - return hub_settings - -@frappe.whitelist() -def get_items(start=0, limit=20, category=None, order_by=None, company=None, text=None): - connection = get_client_connection() - filters = { - 'hub_category': category, - } - if text: - filters.update({'item_name': ('like', '%' + text + '%')}) - if company: - filters.update({'company_name': company}) - - response = connection.get_list('Hub Item', - limit_start=start, limit_page_length=limit, - filters=filters) - return response - -@frappe.whitelist() -def get_categories(): - connection = get_client_connection() - response = connection.get_list('Hub Category') - return response - -@frappe.whitelist() -def get_item_details(hub_sync_id=None): - if not hub_sync_id: - return - connection = get_client_connection() - return connection.get_doc('Hub Item', 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 - hub_connection = get_hub_connection() - return hub_connection.connection - -def get_hub_connection(): - hub_connector = frappe.get_doc( - 'Data Migration Connector', 'Hub Connector') - hub_connection = hub_connector.get_connection() - return hub_connection - -def make_opportunity(buyer_name, email_id): - buyer_name = "HUB-" + buyer_name - - if not frappe.db.exists('Lead', {'email_id': email_id}): - lead = frappe.new_doc("Lead") - lead.lead_name = buyer_name - lead.email_id = email_id - lead.save(ignore_permissions=True) - - o = frappe.new_doc("Opportunity") - o.enquiry_from = "Lead" - o.lead = frappe.get_all("Lead", filters={"email_id": email_id}, fields = ["name"])[0]["name"] - o.save(ignore_permissions=True) - -@frappe.whitelist() -def make_rfq_and_send_opportunity(item, supplier): - supplier = make_supplier(supplier) - contact = make_contact(supplier) - item = make_item(item) - rfq = make_rfq(item, supplier, contact) - status = send_opportunity(contact) - - return { - 'rfq': rfq, - 'hub_document_created': status - } - -def make_supplier(supplier): - # make supplier if not already exists - supplier = frappe._dict(json.loads(supplier)) - - if not frappe.db.exists('Supplier', {'supplier_name': supplier.supplier_name}): - supplier_doc = frappe.get_doc({ - 'doctype': 'Supplier', - 'supplier_name': supplier.supplier_name, - 'supplier_type': supplier.supplier_type, - 'supplier_email': supplier.supplier_email - }).insert() - else: - supplier_doc = frappe.get_doc('Supplier', supplier.supplier_name) - - return supplier_doc - -def make_contact(supplier): - contact_name = get_default_contact('Supplier', supplier.supplier_name) - # make contact if not already exists - if not contact_name: - contact = frappe.get_doc({ - 'doctype': 'Contact', - 'first_name': supplier.supplier_name, - 'email_id': supplier.supplier_email, - 'is_primary_contact': 1, - 'links': [ - {'link_doctype': 'Supplier', 'link_name': supplier.supplier_name} - ] - }).insert() - else: - contact = frappe.get_doc('Contact', contact_name) - - return contact - -def make_item(item): - # make item if not already exists - item = frappe._dict(json.loads(item)) - - if not frappe.db.exists('Item', {'item_code': item.item_code}): - item_doc = frappe.get_doc({ - 'doctype': 'Item', - 'item_code': item.item_code, - 'item_group': item.item_group, - 'is_item_from_hub': 1 - }).insert() - else: - item_doc = frappe.get_doc('Item', item.item_code) - - return item_doc - -def make_rfq(item, supplier, contact): - # make rfq - rfq = frappe.get_doc({ - 'doctype': 'Request for Quotation', - 'transaction_date': nowdate(), - 'status': 'Draft', - 'company': frappe.db.get_single_value('Hub Settings', 'company'), - 'message_for_supplier': 'Please supply the specified items at the best possible rates', - 'suppliers': [ - { 'supplier': supplier.name, 'contact': contact.name } - ], - 'items': [ - { - 'item_code': item.item_code, - 'qty': 1, - 'schedule_date': nowdate(), - 'warehouse': item.default_warehouse or get_root_of("Warehouse"), - 'description': item.description, - 'uom': item.stock_uom - } - ] - }).insert() - - rfq.save() - rfq.submit() - return rfq - -def send_opportunity(contact): - # Make Hub Message on Hub with lead data - doc = { - 'doctype': 'Lead', - 'lead_name': frappe.db.get_single_value('Hub Settings', 'company'), - 'email_id': frappe.db.get_single_value('Hub Settings', 'user') - } - - args = frappe._dict(dict( - doctype='Hub Message', - reference_doctype='Lead', - data=json.dumps(doc), - user=contact.email_id - )) - - connection = get_hub_connection() - response = connection.insert('Hub Message', args) - - return response.ok diff --git a/erpnext/hub_node/data_migration_mapping/__init__.py b/erpnext/hub_node/data_migration_mapping/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/erpnext/hub_node/data_migration_mapping/company_to_hub_company/__init__.py b/erpnext/hub_node/data_migration_mapping/company_to_hub_company/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/erpnext/hub_node/data_migration_mapping/company_to_hub_company/company_to_hub_company.json b/erpnext/hub_node/data_migration_mapping/company_to_hub_company/company_to_hub_company.json deleted file mode 100644 index 0a916dac3f..0000000000 --- a/erpnext/hub_node/data_migration_mapping/company_to_hub_company/company_to_hub_company.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "condition": "{'name': ('=', frappe.db.get_single_value('Hub Settings', 'company'))}", - "creation": "2017-09-07 11:38:43.169065", - "docstatus": 0, - "doctype": "Data Migration Mapping", - "fields": [ - { - "is_child_table": 0, - "local_fieldname": "name", - "remote_fieldname": "company_name" - }, - { - "is_child_table": 0, - "local_fieldname": "country", - "remote_fieldname": "country" - }, - { - "is_child_table": 0, - "local_fieldname": "\"city\"", - "remote_fieldname": "seller_city" - }, - { - "is_child_table": 0, - "local_fieldname": "eval:frappe.local.site", - "remote_fieldname": "site_name" - }, - { - "is_child_table": 0, - "local_fieldname": "eval:frappe.session.user", - "remote_fieldname": "user" - } - ], - "idx": 2, - "local_doctype": "Company", - "mapping_name": "Company to Hub Company", - "mapping_type": "Push", - "migration_id_field": "hub_sync_id", - "modified": "2017-10-09 17:30:17.853929", - "modified_by": "Administrator", - "name": "Company to Hub Company", - "owner": "Administrator", - "page_length": 10, - "remote_objectname": "Hub Company", - "remote_primary_key": "name" -} \ No newline at end of file diff --git a/erpnext/hub_node/data_migration_mapping/hub_message_to_lead/__init__.py b/erpnext/hub_node/data_migration_mapping/hub_message_to_lead/__init__.py deleted file mode 100644 index 0ea1bc4b1a..0000000000 --- a/erpnext/hub_node/data_migration_mapping/hub_message_to_lead/__init__.py +++ /dev/null @@ -1,29 +0,0 @@ -import frappe, json - -def pre_process(doc): - return json.loads(doc['data']) - -def post_process(remote_doc=None, local_doc=None, **kwargs): - if not local_doc: - return - - hub_message = remote_doc - # update hub message on hub - hub_connector = frappe.get_doc('Data Migration Connector', 'Hub Connector') - connection = hub_connector.get_connection() - connection.update('Hub Message', dict( - status='Synced' - ), hub_message['name']) - - # make opportunity after lead is created - lead = local_doc - opportunity = frappe.get_doc({ - 'doctype': 'Opportunity', - 'naming_series': 'OPTY-', - 'opportunity_type': 'Hub', - 'enquiry_from': 'Lead', - 'status': 'Open', - 'lead': lead.name, - 'company': lead.company, - 'transaction_date': frappe.utils.today() - }).insert() diff --git a/erpnext/hub_node/data_migration_mapping/hub_message_to_lead/hub_message_to_lead.json b/erpnext/hub_node/data_migration_mapping/hub_message_to_lead/hub_message_to_lead.json deleted file mode 100644 index cd9fb693d3..0000000000 --- a/erpnext/hub_node/data_migration_mapping/hub_message_to_lead/hub_message_to_lead.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "condition": "{'reference_doctype': 'Lead', 'user': frappe.db.get_single_value('Hub Settings', 'user'), 'status': 'Pending'}", - "creation": "2017-09-20 15:06:40.279930", - "docstatus": 0, - "doctype": "Data Migration Mapping", - "fields": [ - { - "is_child_table": 0, - "local_fieldname": "email_id", - "remote_fieldname": "email_id" - }, - { - "is_child_table": 0, - "local_fieldname": "lead_name", - "remote_fieldname": "lead_name" - } - ], - "idx": 0, - "local_doctype": "Lead", - "local_primary_key": "email_id", - "mapping_name": "Hub Message to Lead", - "mapping_type": "Pull", - "migration_id_field": "hub_sync_id", - "modified": "2017-10-09 17:30:17.908830", - "modified_by": "Administrator", - "name": "Hub Message to Lead", - "owner": "frappetest@gmail.com", - "page_length": 10, - "remote_objectname": "Hub Message", - "remote_primary_key": "name" -} \ No newline at end of file diff --git a/erpnext/hub_node/data_migration_mapping/item_to_hub_item/__init__.py b/erpnext/hub_node/data_migration_mapping/item_to_hub_item/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/erpnext/hub_node/data_migration_mapping/item_to_hub_item/item_to_hub_item.json b/erpnext/hub_node/data_migration_mapping/item_to_hub_item/item_to_hub_item.json deleted file mode 100644 index e4168c75b5..0000000000 --- a/erpnext/hub_node/data_migration_mapping/item_to_hub_item/item_to_hub_item.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "condition": "{\"publish_in_hub\": 1}", - "creation": "2017-09-07 13:27:52.726350", - "docstatus": 0, - "doctype": "Data Migration Mapping", - "fields": [ - { - "is_child_table": 0, - "local_fieldname": "item_code", - "remote_fieldname": "item_code" - }, - { - "is_child_table": 0, - "local_fieldname": "item_name", - "remote_fieldname": "item_name" - }, - { - "is_child_table": 0, - "local_fieldname": "eval:frappe.db.get_default(\"company\")", - "remote_fieldname": "company_name" - }, - { - "is_child_table": 0, - "local_fieldname": "image", - "remote_fieldname": "image" - }, - { - "is_child_table": 0, - "local_fieldname": "item_group", - "remote_fieldname": "item_group" - }, - { - "is_child_table": 0, - "local_fieldname": "eval:frappe.session.user", - "remote_fieldname": "seller" - }, - { - "is_child_table": 0, - "local_fieldname": "eval:frappe.db.get_default(\"country\")", - "remote_fieldname": "country" - } - ], - "idx": 1, - "local_doctype": "Item", - "mapping_name": "Item to Hub Item", - "mapping_type": "Push", - "migration_id_field": "hub_sync_id", - "modified": "2017-10-09 17:30:17.890337", - "modified_by": "Administrator", - "name": "Item to Hub Item", - "owner": "Administrator", - "page_length": 10, - "remote_objectname": "Hub Item", - "remote_primary_key": "item_code" -} \ No newline at end of file diff --git a/erpnext/hub_node/data_migration_plan/hub_sync/hub_sync.json b/erpnext/hub_node/data_migration_plan/hub_sync/hub_sync.json deleted file mode 100644 index 40513cd250..0000000000 --- a/erpnext/hub_node/data_migration_plan/hub_sync/hub_sync.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "creation": "2017-09-07 11:39:38.445902", - "docstatus": 0, - "doctype": "Data Migration Plan", - "idx": 1, - "mappings": [ - { - "enabled": 1, - "mapping": "Company to Hub Company" - }, - { - "enabled": 1, - "mapping": "Item to Hub Item" - }, - { - "enabled": 1, - "mapping": "Hub Message to Lead" - } - ], - "modified": "2017-10-09 17:30:17.680059", - "modified_by": "Administrator", - "module": "Hub Node", - "name": "Hub Sync", - "owner": "Administrator", - "plan_name": "Hub Sync" -} \ No newline at end of file diff --git a/erpnext/hub_node/doctype/__init__.py b/erpnext/hub_node/doctype/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 From 4e372a30fa22849c94e60cef7e2408d9b6bc0d8c Mon Sep 17 00:00:00 2001 From: Faris Ansari Date: Thu, 6 Sep 2018 14:08:31 +0530 Subject: [PATCH 05/14] fix(patch): Remove old Hub Page (#15328) --- erpnext/patches.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/patches.txt b/erpnext/patches.txt index e99bf59348..e5644a3818 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -504,4 +504,5 @@ erpnext.patches.v10_0.show_leaves_of_all_department_members_in_calendar erpnext.patches.v10_0.update_status_in_purchase_receipt erpnext.patches.v10_0.update_address_template_for_india erpnext.patches.v10_0.set_discount_amount -erpnext.patches.v10_0.recalculate_gross_margin_for_project \ No newline at end of file +erpnext.patches.v10_0.recalculate_gross_margin_for_project +execute:frappe.delete_doc("Page", "hub", ignore_missing=True) From 8652bce9e39de86bb5ec0fe9aa3e40a28f4bb22b Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 6 Sep 2018 14:18:49 +0530 Subject: [PATCH 06/14] Update modules.txt --- erpnext/modules.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/erpnext/modules.txt b/erpnext/modules.txt index 42f0f0beaa..27db884799 100644 --- a/erpnext/modules.txt +++ b/erpnext/modules.txt @@ -11,7 +11,6 @@ Support Utilities Shopping Cart Assets -Hub Node Portal Maintenance Education @@ -20,4 +19,4 @@ Healthcare Restaurant Agriculture ERPNext Integrations -Non Profit \ No newline at end of file +Non Profit From b892cc8b0240a9bf42400d74b24e0adab4c1b393 Mon Sep 17 00:00:00 2001 From: Faris Ansari Date: Thu, 6 Sep 2018 18:02:48 +0530 Subject: [PATCH 07/14] fix(item): Remove Hub Category field (#15331) --- erpnext/stock/doctype/item/item.json | 34 +--------------------------- 1 file changed, 1 insertion(+), 33 deletions(-) diff --git a/erpnext/stock/doctype/item/item.json b/erpnext/stock/doctype/item/item.json index 747ed6118a..4a7d72eff0 100644 --- a/erpnext/stock/doctype/item/item.json +++ b/erpnext/stock/doctype/item/item.json @@ -3451,38 +3451,6 @@ "translatable": 0, "unique": 0 }, - { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "hub_category_to_publish", - "fieldtype": "Link", - "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 Category to Publish", - "length": 0, - "no_copy": 0, - "options": "Hub Category", - "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_on_submit": 0, @@ -3561,7 +3529,7 @@ "issingle": 0, "istable": 0, "max_attachments": 1, - "modified": "2018-04-11 12:21:48.715529", + "modified": "2018-09-06 14:45:48.715529", "modified_by": "Administrator", "module": "Stock", "name": "Item", From 4fd1cebf9565ed037d6092966b32d45a7dbfd0ee Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 6 Sep 2018 18:53:31 +0530 Subject: [PATCH 08/14] fix(patch): Delete all documents from Hub Node module --- erpnext/patches.txt | 2 +- erpnext/patches/v10_0/delete_hub_documents.py | 17 +++++++++++++++++ .../v10_0/setup_vat_for_uae_and_saudi_arabia.py | 1 - erpnext/patches/v8_1/setup_gst_india.py | 1 - 4 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 erpnext/patches/v10_0/delete_hub_documents.py diff --git a/erpnext/patches.txt b/erpnext/patches.txt index e5644a3818..313f3789fd 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -505,4 +505,4 @@ erpnext.patches.v10_0.update_status_in_purchase_receipt erpnext.patches.v10_0.update_address_template_for_india erpnext.patches.v10_0.set_discount_amount erpnext.patches.v10_0.recalculate_gross_margin_for_project -execute:frappe.delete_doc("Page", "hub", ignore_missing=True) +erpnext.patches.v10_0.delete_hub_documents \ No newline at end of file diff --git a/erpnext/patches/v10_0/delete_hub_documents.py b/erpnext/patches/v10_0/delete_hub_documents.py new file mode 100644 index 0000000000..293969b29b --- /dev/null +++ b/erpnext/patches/v10_0/delete_hub_documents.py @@ -0,0 +1,17 @@ + +import frappe +from frappe.model.utils.rename_field import rename_field + +def execute(): + for dt, dn in (("Page", "Hub"), ("DocType", "Hub Settings"), ("DocType", "Hub Category")): + frappe.delete_doc(dt, dn, ignore_missing=True) + + data_migration_plans = frappe.get_all("Data Migration Plan", filters={"module": 'Hub Node'}) + for plan in data_migration_plans: + plan_doc = frappe.get_doc("Data Migration Plan", plan.name) + for m in plan_doc.get("mappings"): + frappe.delete_doc("Data Migration Mapping", m.mapping, force=True) + frappe.delete_doc("Data Migration Plan", plan.name) + + frappe.delete_doc("Module Def", "Hub Node", ignore_missing=True) + \ No newline at end of file diff --git a/erpnext/patches/v10_0/setup_vat_for_uae_and_saudi_arabia.py b/erpnext/patches/v10_0/setup_vat_for_uae_and_saudi_arabia.py index 587fee1f9a..a8d90499d8 100644 --- a/erpnext/patches/v10_0/setup_vat_for_uae_and_saudi_arabia.py +++ b/erpnext/patches/v10_0/setup_vat_for_uae_and_saudi_arabia.py @@ -7,7 +7,6 @@ from erpnext.setup.doctype.company.company import install_country_fixtures def execute(): frappe.reload_doc("accounts", "doctype", "account") - frappe.reload_doc("hub_node", "doctype", "hub_category") frappe.reload_doc("accounts", "doctype", "payment_schedule") for d in frappe.get_all('Company', filters={'country': ('in', ['Saudi Arabia', 'United Arab Emirates'])}): diff --git a/erpnext/patches/v8_1/setup_gst_india.py b/erpnext/patches/v8_1/setup_gst_india.py index a9133ae9a6..5370fa2aa5 100644 --- a/erpnext/patches/v8_1/setup_gst_india.py +++ b/erpnext/patches/v8_1/setup_gst_india.py @@ -4,7 +4,6 @@ from frappe.email import sendmail_to_system_managers def execute(): frappe.reload_doc('stock', 'doctype', 'item') frappe.reload_doc("stock", "doctype", "customs_tariff_number") - frappe.reload_doc("hub_node", "doctype", "hub_category") frappe.reload_doc("accounts", "doctype", "payment_terms_template") frappe.reload_doc("accounts", "doctype", "payment_schedule") From bd4348db107ea7dc5a17f465fc722575951805d2 Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Fri, 7 Sep 2018 16:16:23 +0530 Subject: [PATCH 09/14] [Enhance] Add additional cost of the manufacture stock entry in the project costing (#15341) --- erpnext/stock/doctype/stock_entry/stock_entry.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py index 4905446c91..4cd15efaa2 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/stock_entry.py @@ -109,6 +109,16 @@ class StockEntry(StockController): and (sed.t_warehouse is null or sed.t_warehouse = '')""", self.project, as_list=1) amount = amount[0][0] if amount else 0 + additional_costs = frappe.db.sql(""" select ifnull(sum(sed.amount), 0) + from + `tabStock Entry` se, `tabLanded Cost Taxes and Charges` sed + where + se.docstatus = 1 and se.project = %s and sed.parent = se.name + and se.purpose = 'Manufacture'""", self.project, as_list=1) + + additional_cost_amt = additional_costs[0][0] if additional_costs else 0 + + amount += additional_cost_amt frappe.db.set_value('Project', self.project, 'total_consumed_material_cost', amount) def validate_item(self): From 3cc77b52e7ecca8f8313c1f0c0ae1c9b83ecd4e1 Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Fri, 7 Sep 2018 16:16:58 +0530 Subject: [PATCH 10/14] [Fix] Timeout error for bom update tool (#15343) --- .../manufacturing/doctype/bom_update_tool/bom_update_tool.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/manufacturing/doctype/bom_update_tool/bom_update_tool.py b/erpnext/manufacturing/doctype/bom_update_tool/bom_update_tool.py index 04f9717c08..c91bb8f332 100644 --- a/erpnext/manufacturing/doctype/bom_update_tool/bom_update_tool.py +++ b/erpnext/manufacturing/doctype/bom_update_tool/bom_update_tool.py @@ -62,7 +62,7 @@ def enqueue_replace_bom(args): if isinstance(args, string_types): args = json.loads(args) - frappe.enqueue("erpnext.manufacturing.doctype.bom_update_tool.bom_update_tool.replace_bom", args=args) + frappe.enqueue("erpnext.manufacturing.doctype.bom_update_tool.bom_update_tool.replace_bom", args=args, timeout=4000) frappe.msgprint(_("Queued for replacing the BOM. It may take a few minutes.")) @frappe.whitelist() From 68000c66fc152d92e4a8b5225056b4fb58a32579 Mon Sep 17 00:00:00 2001 From: Zarrar Date: Sun, 9 Sep 2018 19:19:13 +0530 Subject: [PATCH 11/14] check if Data Migration Plan exists before deleting (#15368) --- erpnext/patches/v10_0/delete_hub_documents.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/erpnext/patches/v10_0/delete_hub_documents.py b/erpnext/patches/v10_0/delete_hub_documents.py index 293969b29b..0d81bd5263 100644 --- a/erpnext/patches/v10_0/delete_hub_documents.py +++ b/erpnext/patches/v10_0/delete_hub_documents.py @@ -6,12 +6,12 @@ def execute(): for dt, dn in (("Page", "Hub"), ("DocType", "Hub Settings"), ("DocType", "Hub Category")): frappe.delete_doc(dt, dn, ignore_missing=True) - data_migration_plans = frappe.get_all("Data Migration Plan", filters={"module": 'Hub Node'}) - for plan in data_migration_plans: - plan_doc = frappe.get_doc("Data Migration Plan", plan.name) - for m in plan_doc.get("mappings"): - frappe.delete_doc("Data Migration Mapping", m.mapping, force=True) - frappe.delete_doc("Data Migration Plan", plan.name) + if frappe.db.exists("DocType", "Data Migration Plan"): + data_migration_plans = frappe.get_all("Data Migration Plan", filters={"module": 'Hub Node'}) + for plan in data_migration_plans: + plan_doc = frappe.get_doc("Data Migration Plan", plan.name) + for m in plan_doc.get("mappings"): + frappe.delete_doc("Data Migration Mapping", m.mapping, force=True) + frappe.delete_doc("Data Migration Plan", plan.name) frappe.delete_doc("Module Def", "Hub Node", ignore_missing=True) - \ No newline at end of file From e11f299b21f5d235b0e6939aea7239cd09ccff63 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 11 Sep 2018 11:36:05 +0530 Subject: [PATCH 12/14] Update production_order.py --- .../manufacturing/doctype/production_order/production_order.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/manufacturing/doctype/production_order/production_order.py b/erpnext/manufacturing/doctype/production_order/production_order.py index 158c4433d5..2f2c40ef2d 100644 --- a/erpnext/manufacturing/doctype/production_order/production_order.py +++ b/erpnext/manufacturing/doctype/production_order/production_order.py @@ -318,7 +318,7 @@ class ProductionOrder(Document): from_time, to_time = self.get_start_end_time(timesheet, d.name) - if date_diff(from_time, original_start_time) > plan_days: + if date_diff(from_time, original_start_time) > cint(plan_days): frappe.throw(_("Unable to find Time Slot in the next {0} days for Operation {1}").format(plan_days, d.operation)) break From 20d8c52d2a22041cf377665f7049020391b655e1 Mon Sep 17 00:00:00 2001 From: Ahmed Madi Date: Wed, 12 Sep 2018 08:32:57 +0300 Subject: [PATCH 13/14] Update salary_slip.js (#15200) --- erpnext/hr/doctype/salary_slip/salary_slip.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/erpnext/hr/doctype/salary_slip/salary_slip.js b/erpnext/hr/doctype/salary_slip/salary_slip.js index cec53563a6..afb7f1a287 100644 --- a/erpnext/hr/doctype/salary_slip/salary_slip.js +++ b/erpnext/hr/doctype/salary_slip/salary_slip.js @@ -126,7 +126,6 @@ var get_emp_and_leave_details = function(doc, dt, dn) { } cur_frm.cscript.employee = function(doc,dt,dn){ - doc.salary_structure = '' get_emp_and_leave_details(doc, dt, dn); } @@ -249,4 +248,4 @@ var total_work_hours = function(frm, dt, dn) { frm.refresh_field('gross_pay'); calculate_net_pay(frm.doc, dt, dn); }); -} \ No newline at end of file +} From 6d5a29af6a4cf020892c17e90a200f8457414cab Mon Sep 17 00:00:00 2001 From: Saurabh Date: Wed, 12 Sep 2018 15:14:25 +0600 Subject: [PATCH 14/14] bumped to version 10.1.52 --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 7be524a539..7b247f6403 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -5,7 +5,7 @@ import frappe from erpnext.hooks import regional_overrides from frappe.utils import getdate -__version__ = '10.1.51' +__version__ = '10.1.52' def get_default_company(user=None): '''Get default company for user'''