From 3387a35fed08c5129abad7d434a6e1fbab24629d Mon Sep 17 00:00:00 2001 From: Zlash65 Date: Thu, 19 Apr 2018 18:23:31 +0530 Subject: [PATCH 01/11] rename supplier-type to supplier-group --- .../__init__.py | 0 .../supplier_group.js} | 4 ++-- .../supplier_group.json} | 21 +++++++++---------- .../doctype/supplier_group/supplier_group.py | 10 +++++++++ .../doctype/supplier_group/test_records.json | 7 +++++++ .../test_supplier_group.js} | 6 +++--- .../supplier_group/test_supplier_group.py | 7 +++++++ erpnext/setup/doctype/supplier_type/README.md | 1 - .../doctype/supplier_type/supplier_type.py | 10 --------- .../doctype/supplier_type/test_records.json | 6 ------ .../supplier_type/test_supplier_type.py | 7 ------- 11 files changed, 39 insertions(+), 40 deletions(-) rename erpnext/setup/doctype/{supplier_type => supplier_group}/__init__.py (100%) rename erpnext/setup/doctype/{supplier_type/supplier_type.js => supplier_group/supplier_group.js} (74%) rename erpnext/setup/doctype/{supplier_type/supplier_type.json => supplier_group/supplier_group.json} (94%) create mode 100644 erpnext/setup/doctype/supplier_group/supplier_group.py create mode 100644 erpnext/setup/doctype/supplier_group/test_records.json rename erpnext/setup/doctype/{supplier_type/test_supplier_type.js => supplier_group/test_supplier_group.js} (71%) create mode 100644 erpnext/setup/doctype/supplier_group/test_supplier_group.py delete mode 100644 erpnext/setup/doctype/supplier_type/README.md delete mode 100644 erpnext/setup/doctype/supplier_type/supplier_type.py delete mode 100644 erpnext/setup/doctype/supplier_type/test_records.json delete mode 100644 erpnext/setup/doctype/supplier_type/test_supplier_type.py diff --git a/erpnext/setup/doctype/supplier_type/__init__.py b/erpnext/setup/doctype/supplier_group/__init__.py similarity index 100% rename from erpnext/setup/doctype/supplier_type/__init__.py rename to erpnext/setup/doctype/supplier_group/__init__.py diff --git a/erpnext/setup/doctype/supplier_type/supplier_type.js b/erpnext/setup/doctype/supplier_group/supplier_group.js similarity index 74% rename from erpnext/setup/doctype/supplier_type/supplier_type.js rename to erpnext/setup/doctype/supplier_group/supplier_group.js index f1c5d70640..10e5c04dcc 100644 --- a/erpnext/setup/doctype/supplier_type/supplier_type.js +++ b/erpnext/setup/doctype/supplier_group/supplier_group.js @@ -1,5 +1,5 @@ -// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors -// License: GNU General Public License v3. See license.txt +// Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and contributors +// For license information, please see license.txt cur_frm.cscript.refresh = function(doc) { cur_frm.set_intro(doc.__islocal ? "" : __("There is nothing to edit.")) diff --git a/erpnext/setup/doctype/supplier_type/supplier_type.json b/erpnext/setup/doctype/supplier_group/supplier_group.json similarity index 94% rename from erpnext/setup/doctype/supplier_type/supplier_type.json rename to erpnext/setup/doctype/supplier_group/supplier_group.json index d7d7084d7f..35fafac4ff 100644 --- a/erpnext/setup/doctype/supplier_type/supplier_type.json +++ b/erpnext/setup/doctype/supplier_group/supplier_group.json @@ -3,7 +3,7 @@ "allow_guest_to_view": 0, "allow_import": 1, "allow_rename": 1, - "autoname": "field:supplier_type", + "autoname": "field:supplier_group_name", "beta": 0, "creation": "2013-01-10 16:34:24", "custom": 0, @@ -18,7 +18,7 @@ "bold": 0, "collapsible": 0, "columns": 0, - "fieldname": "supplier_type", + "fieldname": "supplier_group_name", "fieldtype": "Data", "hidden": 0, "ignore_user_permissions": 0, @@ -27,7 +27,7 @@ "in_global_search": 0, "in_list_view": 1, "in_standard_filter": 0, - "label": "Supplier Type", + "label": "Supplier Group Name", "length": 0, "no_copy": 0, "oldfieldname": "supplier_type", @@ -41,6 +41,7 @@ "reqd": 1, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -71,6 +72,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -102,6 +104,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -131,6 +134,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -163,6 +167,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 } ], @@ -177,15 +182,14 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2017-09-04 18:54:10.093500", + "modified": "2018-04-19 07:45:03.495577", "modified_by": "Administrator", "module": "Setup", - "name": "Supplier Type", + "name": "Supplier Group", "owner": "Administrator", "permissions": [ { "amend": 0, - "apply_user_permissions": 0, "cancel": 0, "create": 0, "delete": 0, @@ -205,7 +209,6 @@ }, { "amend": 0, - "apply_user_permissions": 0, "cancel": 0, "create": 0, "delete": 0, @@ -225,7 +228,6 @@ }, { "amend": 0, - "apply_user_permissions": 0, "cancel": 0, "create": 1, "delete": 1, @@ -245,7 +247,6 @@ }, { "amend": 0, - "apply_user_permissions": 0, "cancel": 0, "create": 0, "delete": 0, @@ -265,7 +266,6 @@ }, { "amend": 0, - "apply_user_permissions": 0, "cancel": 0, "create": 0, "delete": 0, @@ -285,7 +285,6 @@ }, { "amend": 0, - "apply_user_permissions": 0, "cancel": 0, "create": 0, "delete": 0, diff --git a/erpnext/setup/doctype/supplier_group/supplier_group.py b/erpnext/setup/doctype/supplier_group/supplier_group.py new file mode 100644 index 0000000000..53ab215190 --- /dev/null +++ b/erpnext/setup/doctype/supplier_group/supplier_group.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class SupplierGroup(Document): + pass diff --git a/erpnext/setup/doctype/supplier_group/test_records.json b/erpnext/setup/doctype/supplier_group/test_records.json new file mode 100644 index 0000000000..1681e2a647 --- /dev/null +++ b/erpnext/setup/doctype/supplier_group/test_records.json @@ -0,0 +1,7 @@ +[ + { + "doctype": "Supplier Group", + "supplier_group_name": "_Test Supplier Group" + } +] + \ No newline at end of file diff --git a/erpnext/setup/doctype/supplier_type/test_supplier_type.js b/erpnext/setup/doctype/supplier_group/test_supplier_group.js similarity index 71% rename from erpnext/setup/doctype/supplier_type/test_supplier_type.js rename to erpnext/setup/doctype/supplier_group/test_supplier_group.js index 085dddd0b6..976dd2cc4f 100644 --- a/erpnext/setup/doctype/supplier_type/test_supplier_type.js +++ b/erpnext/setup/doctype/supplier_group/test_supplier_group.js @@ -2,15 +2,15 @@ // rename this file from _test_[name] to test_[name] to activate // and remove above this line -QUnit.test("test: Supplier Type", function (assert) { +QUnit.test("test: Supplier Group", function (assert) { let done = assert.async(); // number of asserts assert.expect(1); frappe.run_serially([ - // insert a new Supplier Type - () => frappe.tests.make('Supplier Type', [ + // insert a new Supplier Group + () => frappe.tests.make('Supplier Group', [ // values to be set {key: 'value'} ]), diff --git a/erpnext/setup/doctype/supplier_group/test_supplier_group.py b/erpnext/setup/doctype/supplier_group/test_supplier_group.py new file mode 100644 index 0000000000..0e3d23d6bd --- /dev/null +++ b/erpnext/setup/doctype/supplier_group/test_supplier_group.py @@ -0,0 +1,7 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +test_records = frappe.get_test_records('Supplier Group') diff --git a/erpnext/setup/doctype/supplier_type/README.md b/erpnext/setup/doctype/supplier_type/README.md deleted file mode 100644 index 0da4c708ac..0000000000 --- a/erpnext/setup/doctype/supplier_type/README.md +++ /dev/null @@ -1 +0,0 @@ -Supplier classification. \ No newline at end of file diff --git a/erpnext/setup/doctype/supplier_type/supplier_type.py b/erpnext/setup/doctype/supplier_type/supplier_type.py deleted file mode 100644 index 0d237469e3..0000000000 --- a/erpnext/setup/doctype/supplier_type/supplier_type.py +++ /dev/null @@ -1,10 +0,0 @@ -# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors -# License: GNU General Public License v3. See license.txt - -from __future__ import unicode_literals -import frappe - -from frappe.model.document import Document - -class SupplierType(Document): - pass \ No newline at end of file diff --git a/erpnext/setup/doctype/supplier_type/test_records.json b/erpnext/setup/doctype/supplier_type/test_records.json deleted file mode 100644 index fd632c5afd..0000000000 --- a/erpnext/setup/doctype/supplier_type/test_records.json +++ /dev/null @@ -1,6 +0,0 @@ -[ - { - "doctype": "Supplier Type", - "supplier_type": "_Test Supplier Type" - } -] diff --git a/erpnext/setup/doctype/supplier_type/test_supplier_type.py b/erpnext/setup/doctype/supplier_type/test_supplier_type.py deleted file mode 100644 index 9fa8a44b1d..0000000000 --- a/erpnext/setup/doctype/supplier_type/test_supplier_type.py +++ /dev/null @@ -1,7 +0,0 @@ -# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors -# License: GNU General Public License v3. See license.txt -from __future__ import unicode_literals - - -import frappe -test_records = frappe.get_test_records('Supplier Type') \ No newline at end of file From 4437a5ed18cd4affd29d6fa5770cda65fb25577a Mon Sep 17 00:00:00 2001 From: Zlash65 Date: Thu, 19 Apr 2018 18:30:16 +0530 Subject: [PATCH 02/11] json level changes --- .../doctype/pricing_rule/pricing_rule.json | 60 +++++++++--- .../accounts/doctype/tax_rule/tax_rule.json | 66 +++++++++++-- .../buying_settings/buying_settings.json | 97 +++++++++++++++++-- erpnext/buying/doctype/supplier/supplier.json | 66 ++++++------- .../buying/doctype/supplier/test_records.json | 14 +-- 5 files changed, 238 insertions(+), 65 deletions(-) diff --git a/erpnext/accounts/doctype/pricing_rule/pricing_rule.json b/erpnext/accounts/doctype/pricing_rule/pricing_rule.json index 1c30fa4357..ac5990427e 100644 --- a/erpnext/accounts/doctype/pricing_rule/pricing_rule.json +++ b/erpnext/accounts/doctype/pricing_rule/pricing_rule.json @@ -39,6 +39,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -69,6 +70,7 @@ "reqd": 1, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -100,6 +102,7 @@ "reqd": 1, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -131,6 +134,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -162,6 +166,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -193,6 +198,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -222,6 +228,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -253,6 +260,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -282,6 +290,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -311,6 +320,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -340,6 +350,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -369,6 +380,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -398,6 +410,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -419,7 +432,7 @@ "label": "Applicable For", "length": 0, "no_copy": 0, - "options": "\nCustomer\nCustomer Group\nTerritory\nSales Partner\nCampaign\nSupplier\nSupplier Type", + "options": "\nCustomer\nCustomer Group\nTerritory\nSales Partner\nCampaign\nSupplier\nSupplier Group", "permlevel": 0, "print_hide": 0, "print_hide_if_no_value": 0, @@ -429,6 +442,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -460,6 +474,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -491,6 +506,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -522,6 +538,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -553,6 +570,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -584,6 +602,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -615,6 +634,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -623,8 +643,8 @@ "bold": 0, "collapsible": 0, "columns": 0, - "depends_on": "eval:doc.applicable_for==\"Supplier Type\"", - "fieldname": "supplier_type", + "depends_on": "eval:doc.applicable_for==\"Supplier Group\"", + "fieldname": "supplier_group", "fieldtype": "Link", "hidden": 0, "ignore_user_permissions": 0, @@ -633,10 +653,10 @@ "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, - "label": "Supplier Type", + "label": "Supplier Group", "length": 0, "no_copy": 0, - "options": "Supplier Type", + "options": "Supplier Group", "permlevel": 0, "print_hide": 0, "print_hide_if_no_value": 0, @@ -646,6 +666,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -675,6 +696,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -704,6 +726,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -733,6 +756,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -762,6 +786,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -791,6 +816,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -821,6 +847,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -850,6 +877,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -878,6 +906,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -908,6 +937,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -940,6 +970,7 @@ "reqd": 1, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -971,6 +1002,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -1003,6 +1035,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -1032,6 +1065,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -1064,6 +1098,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -1093,6 +1128,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -1124,6 +1160,7 @@ "reqd": 1, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -1152,6 +1189,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -1182,6 +1220,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -1212,6 +1251,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -1243,6 +1283,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -1273,6 +1314,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { @@ -1302,6 +1344,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 } ], @@ -1316,7 +1359,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2018-02-12 17:21:22.559996", + "modified": "2018-04-19 07:52:41.024618", "modified_by": "Administrator", "module": "Accounts", "name": "Pricing Rule", @@ -1324,7 +1367,6 @@ "permissions": [ { "amend": 0, - "apply_user_permissions": 0, "cancel": 0, "create": 1, "delete": 1, @@ -1344,7 +1386,6 @@ }, { "amend": 0, - "apply_user_permissions": 0, "cancel": 0, "create": 1, "delete": 1, @@ -1364,7 +1405,6 @@ }, { "amend": 0, - "apply_user_permissions": 0, "cancel": 0, "create": 1, "delete": 1, @@ -1384,7 +1424,6 @@ }, { "amend": 0, - "apply_user_permissions": 0, "cancel": 0, "create": 1, "delete": 1, @@ -1404,7 +1443,6 @@ }, { "amend": 0, - "apply_user_permissions": 0, "cancel": 0, "create": 1, "delete": 1, diff --git a/erpnext/accounts/doctype/tax_rule/tax_rule.json b/erpnext/accounts/doctype/tax_rule/tax_rule.json index a746dafa04..56ca055770 100644 --- a/erpnext/accounts/doctype/tax_rule/tax_rule.json +++ b/erpnext/accounts/doctype/tax_rule/tax_rule.json @@ -1,5 +1,6 @@ { "allow_copy": 0, + "allow_guest_to_view": 0, "allow_import": 1, "allow_rename": 0, "autoname": "TR.####", @@ -12,6 +13,7 @@ "editable_grid": 0, "fields": [ { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -40,9 +42,11 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -69,9 +73,11 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -97,9 +103,11 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -128,9 +136,11 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -159,9 +169,11 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -188,9 +200,11 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -219,9 +233,11 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -250,9 +266,11 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -279,9 +297,11 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -308,9 +328,11 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -337,9 +359,11 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -367,9 +391,11 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -395,9 +421,11 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -426,15 +454,17 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, "columns": 0, "depends_on": "eval:doc.tax_type==\"Purchase\"", - "fieldname": "supplier_type", + "fieldname": "supplier_group", "fieldtype": "Link", "hidden": 0, "ignore_user_permissions": 0, @@ -443,10 +473,10 @@ "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, - "label": "Supplier Type", + "label": "Supplier Group", "length": 0, "no_copy": 0, - "options": "Supplier Type", + "options": "Supplier Group", "permlevel": 0, "precision": "", "print_hide": 0, @@ -457,9 +487,11 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -486,9 +518,11 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -515,9 +549,11 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -544,9 +580,11 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -574,9 +612,11 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -603,9 +643,11 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -632,9 +674,11 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -660,9 +704,11 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -689,9 +735,11 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -717,9 +765,11 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -747,9 +797,11 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -775,9 +827,11 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -805,20 +859,21 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 } ], + "has_web_view": 0, "hide_heading": 0, "hide_toolbar": 0, "idx": 0, "image_view": 0, "in_create": 0, - "in_dialog": 0, "is_submittable": 0, "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2017-02-17 16:22:42.501765", + "modified": "2018-04-19 07:53:43.020808", "modified_by": "Administrator", "module": "Accounts", "name": "Tax Rule", @@ -827,7 +882,6 @@ "permissions": [ { "amend": 0, - "apply_user_permissions": 0, "cancel": 0, "create": 1, "delete": 1, diff --git a/erpnext/buying/doctype/buying_settings/buying_settings.json b/erpnext/buying/doctype/buying_settings/buying_settings.json index bb2b47def7..c0684f939a 100644 --- a/erpnext/buying/doctype/buying_settings/buying_settings.json +++ b/erpnext/buying/doctype/buying_settings/buying_settings.json @@ -1,188 +1,263 @@ { "allow_copy": 0, + "allow_guest_to_view": 0, "allow_import": 0, "allow_rename": 0, + "beta": 0, "creation": "2013-06-25 11:04:03", "custom": 0, "description": "Settings for Buying Module", "docstatus": 0, "doctype": "DocType", "document_type": "Other", + "editable_grid": 0, "fields": [ { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "default": "Supplier Name", "fieldname": "supp_master_name", "fieldtype": "Select", "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": "Supplier Naming By", + "length": 0, "no_copy": 0, "options": "Supplier Name\nNaming Series", "permlevel": 0, "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, "bold": 0, "collapsible": 0, - "fieldname": "supplier_type", + "columns": 0, + "fieldname": "supplier_group", "fieldtype": "Link", "hidden": 0, "ignore_user_permissions": 0, + "ignore_xss_filter": 0, "in_filter": 0, + "in_global_search": 0, "in_list_view": 0, - "label": "Default Supplier Type", + "in_standard_filter": 0, + "label": "Default Supplier Group", + "length": 0, "no_copy": 0, - "options": "Supplier Type", + "options": "Supplier Group", "permlevel": 0, "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, "bold": 0, "collapsible": 0, + "columns": 0, "fieldname": "buying_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": "Default Buying Price List", + "length": 0, "no_copy": 0, "options": "Price List", "permlevel": 0, "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, "bold": 0, "collapsible": 0, + "columns": 0, "fieldname": "column_break_3", "fieldtype": "Column 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, + "length": 0, "no_copy": 0, "permlevel": 0, "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, "bold": 0, "collapsible": 0, + "columns": 0, "fieldname": "po_required", "fieldtype": "Select", "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": "Purchase Order Required", + "length": 0, "no_copy": 0, "options": "No\nYes", "permlevel": 0, "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, "bold": 0, "collapsible": 0, + "columns": 0, "fieldname": "pr_required", "fieldtype": "Select", "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": "Purchase Receipt Required", + "length": 0, "no_copy": 0, "options": "No\nYes", "permlevel": 0, "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, "bold": 0, "collapsible": 0, + "columns": 0, "fieldname": "maintain_same_rate", "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": "Maintain same rate throughout purchase cycle", + "length": 0, "no_copy": 0, "permlevel": 0, "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, "bold": 0, "collapsible": 0, + "columns": 0, "fieldname": "allow_multiple_items", "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": "Allow Item to be added multiple times in a transaction", + "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_on_submit": 0, @@ -213,19 +288,22 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 } ], + "has_web_view": 0, "hide_heading": 0, "hide_toolbar": 0, "icon": "fa fa-cog", "idx": 1, + "image_view": 0, "in_create": 0, - "in_dialog": 0, "is_submittable": 0, "issingle": 1, "istable": 0, - "modified": "2017-12-27 15:20:06.052342", + "max_attachments": 0, + "modified": "2018-04-19 07:56:42.888821", "modified_by": "Administrator", "module": "Buying", "name": "Buying Settings", @@ -233,7 +311,6 @@ "permissions": [ { "amend": 0, - "apply_user_permissions": 0, "cancel": 0, "create": 1, "delete": 0, @@ -252,6 +329,10 @@ "write": 1 } ], + "quick_entry": 0, "read_only": 0, - "read_only_onload": 0 + "read_only_onload": 0, + "show_name_in_global_search": 0, + "track_changes": 0, + "track_seen": 0 } \ No newline at end of file diff --git a/erpnext/buying/doctype/supplier/supplier.json b/erpnext/buying/doctype/supplier/supplier.json index afb8899dcb..d342e115b7 100644 --- a/erpnext/buying/doctype/supplier/supplier.json +++ b/erpnext/buying/doctype/supplier/supplier.json @@ -43,7 +43,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, - "translatable": 0, + "translatable": 0, "unique": 0 }, { @@ -76,7 +76,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 1, - "translatable": 0, + "translatable": 0, "unique": 0 }, { @@ -108,7 +108,7 @@ "reqd": 1, "search_index": 0, "set_only_once": 0, - "translatable": 0, + "translatable": 0, "unique": 0 }, { @@ -140,7 +140,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, - "translatable": 0, + "translatable": 0, "unique": 0 }, { @@ -171,7 +171,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, - "translatable": 0, + "translatable": 0, "unique": 0 }, { @@ -267,7 +267,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, - "translatable": 0, + "translatable": 0, "unique": 0 }, { @@ -296,7 +296,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, - "translatable": 0, + "translatable": 0, "unique": 0, "width": "50%" }, @@ -306,7 +306,7 @@ "bold": 0, "collapsible": 0, "columns": 0, - "fieldname": "supplier_type", + "fieldname": "supplier_group", "fieldtype": "Link", "hidden": 0, "ignore_user_permissions": 0, @@ -315,12 +315,12 @@ "in_global_search": 0, "in_list_view": 1, "in_standard_filter": 1, - "label": "Supplier Type", + "label": "Supplier Group", "length": 0, "no_copy": 0, "oldfieldname": "supplier_type", "oldfieldtype": "Link", - "options": "Supplier Type", + "options": "Supplier Group", "permlevel": 0, "print_hide": 0, "print_hide_if_no_value": 0, @@ -330,7 +330,7 @@ "reqd": 1, "search_index": 0, "set_only_once": 0, - "translatable": 0, + "translatable": 0, "unique": 0 }, { @@ -362,7 +362,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, - "translatable": 0, + "translatable": 0, "unique": 0 }, { @@ -394,7 +394,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, - "translatable": 0, + "translatable": 0, "unique": 0 }, { @@ -425,7 +425,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, - "translatable": 0, + "translatable": 0, "unique": 0 }, { @@ -456,7 +456,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, - "translatable": 0, + "translatable": 0, "unique": 0 }, { @@ -487,7 +487,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, - "translatable": 0, + "translatable": 0, "unique": 0 }, { @@ -518,7 +518,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, - "translatable": 0, + "translatable": 0, "unique": 0 }, { @@ -614,7 +614,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, - "translatable": 0, + "translatable": 0, "unique": 0 }, { @@ -645,7 +645,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, - "translatable": 0, + "translatable": 0, "unique": 0 }, { @@ -675,7 +675,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, - "translatable": 0, + "translatable": 0, "unique": 0 }, { @@ -706,7 +706,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, - "translatable": 0, + "translatable": 0, "unique": 0 }, { @@ -737,7 +737,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, - "translatable": 0, + "translatable": 0, "unique": 0 }, { @@ -770,7 +770,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, - "translatable": 0, + "translatable": 0, "unique": 0 }, { @@ -803,7 +803,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, - "translatable": 0, + "translatable": 0, "unique": 0 }, { @@ -833,7 +833,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, - "translatable": 0, + "translatable": 0, "unique": 0 }, { @@ -862,7 +862,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, - "translatable": 0, + "translatable": 0, "unique": 0, "width": "50%" }, @@ -893,7 +893,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, - "translatable": 0, + "translatable": 0, "unique": 0 }, { @@ -924,7 +924,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, - "translatable": 0, + "translatable": 0, "unique": 0 }, { @@ -957,7 +957,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, - "translatable": 0, + "translatable": 0, "unique": 0 }, { @@ -988,7 +988,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, - "translatable": 0, + "translatable": 0, "unique": 0, "width": "50%" }, @@ -1021,7 +1021,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, - "translatable": 0, + "translatable": 0, "unique": 0 }, { @@ -1163,7 +1163,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2018-04-19 12:19:52.519026", + "modified": "2018-05-11 12:19:52.519026", "modified_by": "Administrator", "module": "Buying", "name": "Supplier", @@ -1307,7 +1307,7 @@ "quick_entry": 1, "read_only": 0, "read_only_onload": 0, - "search_fields": "supplier_name, supplier_type", + "search_fields": "supplier_name, supplier_group", "show_name_in_global_search": 1, "sort_order": "ASC", "title_field": "supplier_name", diff --git a/erpnext/buying/doctype/supplier/test_records.json b/erpnext/buying/doctype/supplier/test_records.json index 2536721326..9c019898cb 100644 --- a/erpnext/buying/doctype/supplier/test_records.json +++ b/erpnext/buying/doctype/supplier/test_records.json @@ -2,39 +2,39 @@ { "doctype": "Supplier", "supplier_name": "_Test Supplier With Template 1", - "supplier_type": "_Test Supplier Type", + "supplier_group": "_Test Supplier Group", "payment_terms": "_Test Payment Term Template 3" }, { "doctype": "Supplier", "supplier_name": "_Test Supplier P", - "supplier_type": "_Test Supplier Type" + "supplier_group": "_Test Supplier Group" }, { "doctype": "Supplier", "supplier_name": "_Test Supplier with Country", - "supplier_type": "_Test Supplier Type", + "supplier_group": "_Test Supplier Group", "country": "Greece" }, { "doctype": "Supplier", "supplier_name": "_Test Supplier", - "supplier_type": "_Test Supplier Type" + "supplier_group": "_Test Supplier Group" }, { "doctype": "Supplier", "supplier_name": "_Test Supplier 1", - "supplier_type": "_Test Supplier Type" + "supplier_group": "_Test Supplier Group" }, { "doctype": "Supplier", "supplier_name": "_Test Supplier 2", - "supplier_type": "_Test Supplier Type" + "supplier_group": "_Test Supplier Group" }, { "doctype": "Supplier", "supplier_name": "_Test Supplier USD", - "supplier_type": "_Test Supplier Type", + "supplier_group": "_Test Supplier Group", "accounts": [{ "company": "_Test Company", "account": "_Test Payable USD - _TC" From 0a50554417995dcc3abab5df4c7b970558380dc7 Mon Sep 17 00:00:00 2001 From: Zlash65 Date: Thu, 19 Apr 2018 18:32:48 +0530 Subject: [PATCH 03/11] doctype level changes --- .../opening_invoice_creation_tool.py | 8 ++++---- .../doctype/pricing_rule/pricing_rule.js | 6 +++--- .../doctype/pricing_rule/pricing_rule.py | 16 ++++++++-------- erpnext/accounts/doctype/tax_rule/tax_rule.js | 2 +- erpnext/accounts/doctype/tax_rule/tax_rule.py | 6 +++--- .../doctype/buying_settings/buying_settings.py | 2 +- .../request_for_quotation.js | 14 +++++++------- .../test_request_for_quotation.py | 2 +- erpnext/buying/doctype/supplier/supplier_list.js | 2 +- erpnext/buying/doctype/supplier/test_supplier.js | 4 ++-- erpnext/buying/doctype/supplier/test_supplier.py | 10 +++++----- .../selling/doctype/sales_order/sales_order.py | 4 ++-- .../stock/doctype/delivery_note/delivery_note.js | 2 +- 13 files changed, 39 insertions(+), 39 deletions(-) diff --git a/erpnext/accounts/doctype/opening_invoice_creation_tool/opening_invoice_creation_tool.py b/erpnext/accounts/doctype/opening_invoice_creation_tool/opening_invoice_creation_tool.py index 753540eb42..5712bf83ab 100644 --- a/erpnext/accounts/doctype/opening_invoice_creation_tool/opening_invoice_creation_tool.py +++ b/erpnext/accounts/doctype/opening_invoice_creation_tool/opening_invoice_creation_tool.py @@ -120,12 +120,12 @@ class OpeningInvoiceCreationTool(Document): if party_type == "Customer": party_doc.customer_name = party else: - supplier_type = frappe.db.get_single_value("Buying Settings", "supplier_type") - if not supplier_type: - frappe.throw(_("Please Set Supplier Type in Buying Settings.")) + supplier_group = frappe.db.get_single_value("Buying Settings", "supplier_group") + if not supplier_group: + frappe.throw(_("Please Set Supplier Group in Buying Settings.")) party_doc.supplier_name = party - party_doc.supplier_type = supplier_type + party_doc.supplier_group = supplier_group party_doc.flags.ignore_mandatory = True party_doc.save(ignore_permissions=True) diff --git a/erpnext/accounts/doctype/pricing_rule/pricing_rule.js b/erpnext/accounts/doctype/pricing_rule/pricing_rule.js index dcbf354c16..4be09deb4b 100644 --- a/erpnext/accounts/doctype/pricing_rule/pricing_rule.js +++ b/erpnext/accounts/doctype/pricing_rule/pricing_rule.js @@ -33,7 +33,7 @@ frappe.ui.form.on("Pricing Rule", "refresh", function(frm) { ${__("Pricing Rule is first selected based on 'Apply On' field, which can be Item, Item Group or Brand.")}
  • - ${__("Then Pricing Rules are filtered out based on Customer, Customer Group, Territory, Supplier, Supplier Type, Campaign, Sales Partner etc.")} + ${__("Then Pricing Rules are filtered out based on Customer, Customer Group, Territory, Supplier, Supplier Group, Campaign, Sales Partner etc.")}
  • ${__('Pricing Rules are further filtered based on quantity.')} @@ -51,7 +51,7 @@ frappe.ui.form.on("Pricing Rule", "refresh", function(frm) { ${__('Customer > Customer Group > Territory')}
  • - ${__('Supplier > Supplier Type')} + ${__('Supplier > Supplier Group')}
  • @@ -75,7 +75,7 @@ cur_frm.cscript.set_options_for_applicable_for = function() { options = $.merge(options, ["Customer", "Customer Group", "Territory", "Sales Partner", "Campaign"]); } if(cur_frm.doc.buying) { - $.merge(options, ["Supplier", "Supplier Type"]); + $.merge(options, ["Supplier", "Supplier Group"]); } set_field_options("applicable_for", options.join("\n")); diff --git a/erpnext/accounts/doctype/pricing_rule/pricing_rule.py b/erpnext/accounts/doctype/pricing_rule/pricing_rule.py index e047b6d67e..9b73fcd968 100644 --- a/erpnext/accounts/doctype/pricing_rule/pricing_rule.py +++ b/erpnext/accounts/doctype/pricing_rule/pricing_rule.py @@ -41,7 +41,7 @@ class PricingRule(Document): throw(_("Selling must be checked, if Applicable For is selected as {0}" .format(self.applicable_for))) - if not self.buying and self.applicable_for in ["Supplier", "Supplier Type"]: + if not self.buying and self.applicable_for in ["Supplier", "Supplier Group"]: throw(_("Buying must be checked, if Applicable For is selected as {0}" .format(self.applicable_for))) @@ -85,7 +85,7 @@ def apply_pricing_rule(args): "customer_group": "something", "territory": "something", "supplier": "something", - "supplier_type": "something", + "supplier_group": "something", "currency": "something", "conversion_rate": "something", "price_list": "something", @@ -165,10 +165,10 @@ def get_pricing_rule_for_item(args): if customer: args.customer_group, args.territory = customer - args.supplier = args.supplier_type = None + args.supplier = args.supplier_group = None - elif args.supplier and not args.supplier_type: - args.supplier_type = frappe.db.get_value("Supplier", args.supplier, "supplier_type") + elif args.supplier and not args.supplier_group: + args.supplier_group = frappe.db.get_value("Supplier", args.supplier, "supplier_group") args.customer = args.customer_group = args.territory = None pricing_rules = get_pricing_rules(args) @@ -258,7 +258,7 @@ def get_pricing_rules(args): conditions = item_variant_condition = "" values = {"item_code": args.get("item_code"), "brand": args.get("brand")} - for field in ["company", "customer", "supplier", "supplier_type", "campaign", "sales_partner"]: + for field in ["company", "customer", "supplier", "supplier_group", "campaign", "sales_partner"]: if args.get(field): conditions += " and ifnull("+field+", '') in (%("+field+")s, '')" values[field] = args.get(field) @@ -324,11 +324,11 @@ def filter_pricing_rules(args, pricing_rules): # apply internal priority all_fields = ["item_code", "item_group", "brand", "customer", "customer_group", "territory", - "supplier", "supplier_type", "campaign", "sales_partner", "variant_of"] + "supplier", "supplier_group", "campaign", "sales_partner", "variant_of"] if len(pricing_rules) > 1: for field_set in [["item_code", "variant_of", "item_group", "brand"], - ["customer", "customer_group", "territory"], ["supplier", "supplier_type"]]: + ["customer", "customer_group", "territory"], ["supplier", "supplier_group"]]: remaining_fields = list(set(all_fields) - set(field_set)) if if_all_rules_same(pricing_rules, remaining_fields): pricing_rules = apply_internal_priority(pricing_rules, field_set, args) diff --git a/erpnext/accounts/doctype/tax_rule/tax_rule.js b/erpnext/accounts/doctype/tax_rule/tax_rule.js index 84c42a3da3..370890e4d8 100644 --- a/erpnext/accounts/doctype/tax_rule/tax_rule.js +++ b/erpnext/accounts/doctype/tax_rule/tax_rule.js @@ -2,7 +2,7 @@ // License: GNU General Public License v3. See license.txt cur_frm.add_fetch("customer", "customer_group", "customer_group" ); -cur_frm.add_fetch("supplier", "supplier_type", "supplier_type" ); +cur_frm.add_fetch("supplier", "supplier_group_name", "supplier_group" ); frappe.ui.form.on("Tax Rule", "tax_type", function(frm) { frm.toggle_reqd("sales_tax_template", frm.doc.tax_type=="Sales"); diff --git a/erpnext/accounts/doctype/tax_rule/tax_rule.py b/erpnext/accounts/doctype/tax_rule/tax_rule.py index ddef65799b..56bd2870ba 100644 --- a/erpnext/accounts/doctype/tax_rule/tax_rule.py +++ b/erpnext/accounts/doctype/tax_rule/tax_rule.py @@ -30,7 +30,7 @@ class TaxRule(Document): def validate_tax_template(self): if self.tax_type== "Sales": - self.purchase_tax_template = self.supplier = self.supplier_type = None + self.purchase_tax_template = self.supplier = self.supplier_group = None if self.customer: self.customer_group = None @@ -38,7 +38,7 @@ class TaxRule(Document): self.sales_tax_template = self.customer = self.customer_group = None if self.supplier: - self.supplier_type = None + self.supplier_group = None if not (self.sales_tax_template or self.purchase_tax_template): frappe.throw(_("Tax Template is mandatory.")) @@ -53,7 +53,7 @@ class TaxRule(Document): "customer": self.customer, "customer_group": self.customer_group, "supplier": self.supplier, - "supplier_type": self.supplier_type, + "supplier_group": self.supplier_group, "billing_city": self.billing_city, "billing_county": self.billing_county, "billing_state": self.billing_state, diff --git a/erpnext/buying/doctype/buying_settings/buying_settings.py b/erpnext/buying/doctype/buying_settings/buying_settings.py index 1f0184b82c..a634a0908b 100644 --- a/erpnext/buying/doctype/buying_settings/buying_settings.py +++ b/erpnext/buying/doctype/buying_settings/buying_settings.py @@ -10,7 +10,7 @@ from frappe.model.document import Document class BuyingSettings(Document): def validate(self): - for key in ["supplier_type", "supp_master_name", "maintain_same_rate", "buying_price_list"]: + for key in ["supplier_group", "supp_master_name", "maintain_same_rate", "buying_price_list"]: frappe.db.set_default(key, self.get(key, "")) from erpnext.setup.doctype.naming_series.naming_series import set_by_naming_series diff --git a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.js b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.js index de87e04443..2ff80755df 100644 --- a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.js +++ b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.js @@ -61,11 +61,11 @@ frappe.ui.form.on("Request for Quotation",{ fields: [ { "fieldtype": "Select", "label": __("Get Suppliers By"), "fieldname": "search_type", - "options": "Tag\nSupplier Type", "reqd": 1 }, - { "fieldtype": "Link", "label": __("Supplier Type"), - "fieldname": "supplier_type", - "options": "Supplier Type", "reqd": 0, - "depends_on": "eval:doc.search_type == 'Supplier Type'"}, + "options": "Tag\nSupplier Group", "reqd": 1 }, + { "fieldtype": "Link", "label": __("Supplier Group"), + "fieldname": "supplier_group", + "options": "Supplier Group", "reqd": 0, + "depends_on": "eval:doc.search_type == 'Supplier Group'"}, { "fieldtype": "Data", "label": __("Tag"), "fieldname": "tag", "reqd": 0, "depends_on": "eval:doc.search_type == 'Tag'" }, @@ -121,14 +121,14 @@ frappe.ui.form.on("Request for Quotation",{ }, callback: load_suppliers }); - } else if (args.supplier_type) { + } else if (args.supplier_group) { return frappe.call({ method: "frappe.client.get_list", args: { doctype: "Supplier", order_by: "name", fields: ["name"], - filters: [["Supplier", "supplier_type", "=", args.supplier_type]] + filters: [["Supplier", "supplier_group_name", "=", args.supplier_group]] }, callback: load_suppliers diff --git a/erpnext/buying/doctype/request_for_quotation/test_request_for_quotation.py b/erpnext/buying/doctype/request_for_quotation/test_request_for_quotation.py index 7eb741f06a..dbd9f02278 100644 --- a/erpnext/buying/doctype/request_for_quotation/test_request_for_quotation.py +++ b/erpnext/buying/doctype/request_for_quotation/test_request_for_quotation.py @@ -56,7 +56,7 @@ class TestRequestforQuotation(unittest.TestCase): frappe.delete_doc_if_exists("Supplier", "_Test Supplier '1", force=1) supplier = frappe.new_doc("Supplier") supplier.supplier_name = "_Test Supplier '1" - supplier.supplier_type = "_Test Supplier Type" + supplier.supplier_group = "_Test Supplier Group" supplier.insert() rfq = make_request_for_quotation(supplier_wt_appos) diff --git a/erpnext/buying/doctype/supplier/supplier_list.js b/erpnext/buying/doctype/supplier/supplier_list.js index ab25d2c8fc..d99e3f8f0f 100644 --- a/erpnext/buying/doctype/supplier/supplier_list.js +++ b/erpnext/buying/doctype/supplier/supplier_list.js @@ -1,3 +1,3 @@ frappe.listview_settings['Supplier'] = { - add_fields: ["supplier_name", "supplier_type", "image"], + add_fields: ["supplier_name", "supplier_group", "image"], }; diff --git a/erpnext/buying/doctype/supplier/test_supplier.js b/erpnext/buying/doctype/supplier/test_supplier.js index 51e3c09788..bf7c192c91 100644 --- a/erpnext/buying/doctype/supplier/test_supplier.js +++ b/erpnext/buying/doctype/supplier/test_supplier.js @@ -7,7 +7,7 @@ QUnit.test("test: supplier", function(assert) { () => { return frappe.tests.make('Supplier', [ {supplier_name: 'Test Supplier'}, - {supplier_type: 'Hardware'}, + {supplier_group: 'Hardware'}, {country: 'India'}, {default_currency: 'INR'}, {accounts: [ @@ -66,7 +66,7 @@ QUnit.test("test: supplier", function(assert) { () => { assert.ok(cur_frm.doc.supplier_name == 'Test Supplier', "Name correct"); - assert.ok(cur_frm.doc.supplier_type == 'Hardware', "Type correct"); + assert.ok(cur_frm.doc.supplier_group == 'Hardware', "Type correct"); assert.ok(cur_frm.doc.default_currency == 'INR', "Currency correct"); assert.ok(cur_frm.doc.accounts[0].account == 'Creditors - '+frappe.get_abbr('For Testing'), " Account Head abbr correct"); assert.ok($('.address-box:nth-child(3) p').text().includes('Shipping City 3'), "Address correct"); diff --git a/erpnext/buying/doctype/supplier/test_supplier.py b/erpnext/buying/doctype/supplier/test_supplier.py index 16dda5c5ff..2211db7e0d 100644 --- a/erpnext/buying/doctype/supplier/test_supplier.py +++ b/erpnext/buying/doctype/supplier/test_supplier.py @@ -36,14 +36,14 @@ class TestSupplier(unittest.TestCase): frappe.db.set_value("Supplier", "_Test Supplier With Template 1", "payment_terms", "") - # Set credit limit for the supplier type instead of supplier and evaluate the due date - frappe.db.set_value("Supplier Type", "_Test Supplier Type", "payment_terms", "_Test Payment Term Template 3") + # Set credit limit for the supplier group instead of supplier and evaluate the due date + frappe.db.set_value("Supplier Group", "_Test Supplier Group", "payment_terms", "_Test Payment Term Template 3") due_date = get_due_date("2016-01-22", "Supplier", "_Test Supplier With Template 1") self.assertEqual(due_date, "2016-02-21") - # Payment terms for Supplier Type instead of supplier and evaluate the due date - frappe.db.set_value("Supplier Type", "_Test Supplier Type", "payment_terms", "_Test Payment Term Template 1") + # Payment terms for Supplier Group instead of supplier and evaluate the due date + frappe.db.set_value("Supplier Group", "_Test Supplier Group", "payment_terms", "_Test Payment Term Template 1") # Leap year due_date = get_due_date("2016-01-22", "Supplier", "_Test Supplier With Template 1") @@ -53,7 +53,7 @@ class TestSupplier(unittest.TestCase): self.assertEqual(due_date, "2017-02-28") # Supplier with no default Payment Terms Template - frappe.db.set_value("Supplier Type", "_Test Supplier Type", "payment_terms", "") + frappe.db.set_value("Supplier Group", "_Test Supplier Group", "payment_terms", "") frappe.db.set_value("Supplier", "_Test Supplier", "payment_terms", "") due_date = get_due_date("2016-01-22", "Supplier", "_Test Supplier") diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py index 40c2cf0358..72723eb115 100755 --- a/erpnext/selling/doctype/sales_order/sales_order.py +++ b/erpnext/selling/doctype/sales_order/sales_order.py @@ -755,9 +755,9 @@ def make_purchase_order_for_drop_shipment(source_name, for_supplier, target_doc= def get_supplier(doctype, txt, searchfield, start, page_len, filters): supp_master_name = frappe.defaults.get_user_default("supp_master_name") if supp_master_name == "Supplier Name": - fields = ["name", "supplier_type"] + fields = ["name", "supplier_group"] else: - fields = ["name", "supplier_name", "supplier_type"] + fields = ["name", "supplier_name", "supplier_group"] fields = ", ".join(fields) return frappe.db.sql("""select {field} from `tabSupplier` diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.js b/erpnext/stock/doctype/delivery_note/delivery_note.js index e6029aa4ea..7ee0c5c2d0 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.js +++ b/erpnext/stock/doctype/delivery_note/delivery_note.js @@ -34,7 +34,7 @@ frappe.ui.form.on("Delivery Note", { frm.set_query('transporter_name', function(doc) { return { - filters: { 'supplier_type': "transporter" } + filters: { 'supplier_group': "transporter" } } }); From 890707854d7efca4a875b33725dd7f96c5ac5e68 Mon Sep 17 00:00:00 2001 From: Zlash65 Date: Thu, 19 Apr 2018 18:37:29 +0530 Subject: [PATCH 04/11] config/utility level changes --- erpnext/accounts/party.py | 24 +++++++------- .../accounts_receivable.py | 12 +++---- .../accounts_receivable_summary.py | 6 ++-- .../purchase_register/purchase_register.py | 8 ++--- .../purchase_analytics/purchase_analytics.js | 32 +++++++++---------- erpnext/config/buying.py | 4 +-- erpnext/demo/setup/setup_data.py | 2 +- .../operations/install_fixtures.py | 16 +++++----- erpnext/startup/report_data_map.py | 6 ++-- erpnext/utilities/user_progress_utils.py | 2 +- 10 files changed, 56 insertions(+), 56 deletions(-) diff --git a/erpnext/accounts/party.py b/erpnext/accounts/party.py index 6f272cf833..652272dbe1 100644 --- a/erpnext/accounts/party.py +++ b/erpnext/accounts/party.py @@ -47,7 +47,7 @@ def _get_party_details(party=None, account=None, party_type="Customer", company= set_contact_details(out, party, party_type) set_other_values(out, party, party_type) set_price_list(out, party, party_type, price_list) - out["taxes_and_charges"] = set_taxes(party.name, party_type, posting_date, company, out.customer_group, out.supplier_type) + out["taxes_and_charges"] = set_taxes(party.name, party_type, posting_date, company, out.customer_group, out.supplier_group) out["payment_terms_template"] = get_pyt_term_template(party.name, party_type, company) if not out.get("currency"): @@ -105,7 +105,7 @@ def set_other_values(out, party, party_type): if party_type=="Customer": to_copy = ["customer_name", "customer_group", "territory", "language"] else: - to_copy = ["supplier_name", "supplier_type", "language"] + to_copy = ["supplier_name", "supplier_group", "language"] for f in to_copy: out[f] = party.get(f) @@ -169,7 +169,7 @@ def set_account_and_due_date(party, account, party_type, company, posting_date, def get_party_account(party_type, party, company): """Returns the account for the given `party`. Will first search in party (Customer / Supplier) record, if not found, - will search in group (Customer Group / Supplier Type), + will search in group (Customer Group / Supplier Group), finally will return default.""" if not company: frappe.throw(_("Please select a Company")) @@ -181,7 +181,7 @@ def get_party_account(party_type, party, company): {"parenttype": party_type, "parent": party, "company": company}, "account") if not account and party_type in ['Customer', 'Supplier']: - party_group_doctype = "Customer Group" if party_type=="Customer" else "Supplier Type" + party_group_doctype = "Customer Group" if party_type=="Customer" else "Supplier Group" group = frappe.db.get_value(party_type, party, scrub(party_group_doctype)) account = frappe.db.get_value("Party Account", {"parenttype": party_group_doctype, "parent": group, "company": company}, "account") @@ -274,8 +274,8 @@ def get_due_date(posting_date, party_type, party, company=None, bill_date=None): due_date = get_due_date_from_template(template_name, posting_date, bill_date).strftime("%Y-%m-%d") else: if party_type == "Supplier": - supplier_type = frappe.db.get_value(party_type, party, fieldname="supplier_type") - template_name = frappe.db.get_value("Supplier Type", supplier_type, fieldname="payment_terms") + supplier_group = frappe.db.get_value(party_type, party, fieldname="supplier_group") + template_name = frappe.db.get_value("Supplier Group", supplier_group, fieldname="payment_terms") if template_name: due_date = get_due_date_from_template(template_name, posting_date, bill_date).strftime("%Y-%m-%d") # If due date is calculated from bill_date, check this condition @@ -321,7 +321,7 @@ def validate_due_date(posting_date, due_date, party_type, party, company=None, b .format(formatdate(default_due_date))) @frappe.whitelist() -def set_taxes(party, party_type, posting_date, company, customer_group=None, supplier_type=None, +def set_taxes(party, party_type, posting_date, company, customer_group=None, supplier_group=None, billing_address=None, shipping_address=None, use_for_shopping_cart=None): from erpnext.accounts.doctype.tax_rule.tax_rule import get_tax_template, get_party_details args = { @@ -332,8 +332,8 @@ def set_taxes(party, party_type, posting_date, company, customer_group=None, sup if customer_group: args['customer_group'] = customer_group - if supplier_type: - args['supplier_type'] = supplier_type + if supplier_group: + args['supplier_group'] = supplier_group if billing_address or shipping_address: args.update(get_party_details(party, party_type, {"billing_address": billing_address, \ @@ -371,10 +371,10 @@ def get_pyt_term_template(party_name, party_type, company=None): customer.customer_group, fieldname='payment_terms') else: supplier = frappe.db.get_value("Supplier", party_name, - fieldname=['payment_terms', "supplier_type"], as_dict=1) + fieldname=['payment_terms', "supplier_group"], as_dict=1) template = supplier.payment_terms - if not template and supplier.supplier_type: - template = frappe.db.get_value("Supplier Type", supplier.supplier_type, fieldname='payment_terms') + if not template and supplier.supplier_group: + template = frappe.db.get_value("Supplier Group", supplier.supplier_group, fieldname='payment_terms') if not template and company: template = frappe.db.get_value("Company", company, fieldname='payment_terms') diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py index fc76be406e..ca806bfc4a 100644 --- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py +++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py @@ -112,7 +112,7 @@ class ReceivablePayableReport(object): _("Customer Group") + ":Link/Customer Group:120" ] if args.get("party_type") == "Supplier": - columns += [_("Supplier Type") + ":Link/Supplier Type:80"] + columns += [_("Supplier Group") + ":Link/Supplier Group:80"] columns.append(_("Remarks") + "::200") @@ -194,11 +194,11 @@ class ReceivablePayableReport(object): # Delivery Note row += [voucher_details.get(gle.voucher_no, {}).get("delivery_note")] - # customer territory / supplier type + # customer territory / supplier group if args.get("party_type") == "Customer": row += [self.get_territory(gle.party), self.get_customer_group(gle.party)] if args.get("party_type") == "Supplier": - row += [self.get_supplier_type(gle.party)] + row += [self.get_supplier_group(gle.party)] row.append(gle.remarks) data.append(row) @@ -260,15 +260,15 @@ class ReceivablePayableReport(object): def get_customer_group(self, party_name): return self.get_party_map("Customer").get(party_name, {}).get("customer_group") or "" - def get_supplier_type(self, party_name): - return self.get_party_map("Supplier").get(party_name, {}).get("supplier_type") or "" + def get_supplier_group(self, party_name): + return self.get_party_map("Supplier").get(party_name, {}).get("supplier_group") or "" def get_party_map(self, party_type): if not hasattr(self, "party_map"): if party_type == "Customer": select_fields = "name, customer_name, territory, customer_group" elif party_type == "Supplier": - select_fields = "name, supplier_name, supplier_type" + select_fields = "name, supplier_name, supplier_group" self.party_map = dict(((r.name, r) for r in frappe.db.sql("select {0} from `tab{1}`" .format(select_fields, party_type), as_dict=True))) diff --git a/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.py b/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.py index 08b24fb147..9b50960f4b 100644 --- a/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.py +++ b/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.py @@ -35,7 +35,7 @@ class AccountsReceivableSummary(ReceivablePayableReport): _("Customer Group") + ":Link/Customer Group:120" ] if args.get("party_type") == "Supplier": - columns += [_("Supplier Type") + ":Link/Supplier Type:80"] + columns += [_("Supplier Group") + ":Link/Supplier Group:80"] columns.append({ "fieldname": "currency", @@ -66,7 +66,7 @@ class AccountsReceivableSummary(ReceivablePayableReport): if args.get("party_type") == "Customer": row += [self.get_territory(party), self.get_customer_group(party)] if args.get("party_type") == "Supplier": - row += [self.get_supplier_type(party)] + row += [self.get_supplier_group(party)] row.append(party_dict.currency) data.append(row) @@ -113,7 +113,7 @@ class AccountsReceivableSummary(ReceivablePayableReport): "outstanding_amt", "age", "range1", "range2", "range3", "range4", "currency"] if args.get("party_type") == "Supplier": - cols += ["supplier_type", "remarks"] + cols += ["supplier_group", "remarks"] if args.get("party_type") == "Customer": cols += ["territory", "customer_group", "remarks"] diff --git a/erpnext/accounts/report/purchase_register/purchase_register.py b/erpnext/accounts/report/purchase_register/purchase_register.py index cf599a0ccc..7a298b322f 100644 --- a/erpnext/accounts/report/purchase_register/purchase_register.py +++ b/erpnext/accounts/report/purchase_register/purchase_register.py @@ -42,7 +42,7 @@ def _execute(filters=None, additional_table_columns=None, additional_query_colum row.append(inv.get(col)) row += [ - supplier_details.get(inv.supplier), # supplier_type + supplier_details.get(inv.supplier), # supplier_group inv.tax_id, inv.credit_to, inv.mode_of_payment, ", ".join(project), inv.bill_no, inv.bill_date, inv.remarks, ", ".join(purchase_order), ", ".join(purchase_receipt), company_currency @@ -83,7 +83,7 @@ def get_columns(invoice_list, additional_table_columns): columns += additional_table_columns columns += [ - _("Supplier Type") + ":Link/Supplier Type:120", _("Tax Id") + "::80", _("Payable Account") + ":Link/Account:120", + _("Supplier Group") + ":Link/Supplier Group:120", _("Tax Id") + "::80", _("Payable Account") + ":Link/Account:120", _("Mode of Payment") + ":Link/Mode of Payment:80", _("Project") + ":Link/Project:80", _("Bill No") + "::120", _("Bill Date") + ":Date:80", _("Remarks") + "::150", _("Purchase Order") + ":Link/Purchase Order:100", @@ -229,8 +229,8 @@ def get_account_details(invoice_list): def get_supplier_details(suppliers): supplier_details = {} - for supp in frappe.db.sql("""select name, supplier_type from `tabSupplier` + for supp in frappe.db.sql("""select name, supplier_group from `tabSupplier` where name in (%s)""" % ", ".join(["%s"]*len(suppliers)), tuple(suppliers), as_dict=1): - supplier_details.setdefault(supp.name, supp.supplier_type) + supplier_details.setdefault(supp.name, supp.supplier_group) return supplier_details diff --git a/erpnext/buying/page/purchase_analytics/purchase_analytics.js b/erpnext/buying/page/purchase_analytics/purchase_analytics.js index 442a8bbd3e..df5790e826 100644 --- a/erpnext/buying/page/purchase_analytics/purchase_analytics.js +++ b/erpnext/buying/page/purchase_analytics/purchase_analytics.js @@ -19,7 +19,7 @@ erpnext.PurchaseAnalytics = frappe.views.TreeGridReport.extend({ title: __("Purchase Analytics"), parent: $(wrapper).find('.layout-main'), page: wrapper.page, - doctypes: ["Item", "Item Group", "Supplier", "Supplier Type", "Company", "Fiscal Year", + doctypes: ["Item", "Item Group", "Supplier", "Supplier Group", "Company", "Fiscal Year", "Purchase Invoice", "Purchase Invoice Item", "Purchase Order", "Purchase Order Item[Purchase Analytics]", "Purchase Receipt", "Purchase Receipt Item[Purchase Analytics]"], @@ -27,11 +27,11 @@ erpnext.PurchaseAnalytics = frappe.views.TreeGridReport.extend({ }); this.tree_grids = { - "Supplier Type": { - label: __("Supplier Type / Supplier"), + "Supplier Group": { + label: __("Supplier Group / Supplier"), show: true, item_key: "supplier", - parent_field: "parent_supplier_type", + parent_field: "parent_supplier_group", formatter: function(item) { return item.supplier_name ? item.supplier_name + " (" + item.name + ")" : item.name; } @@ -77,7 +77,7 @@ erpnext.PurchaseAnalytics = frappe.views.TreeGridReport.extend({ }, filters: [ {fieldtype:"Select", label: __("Tree Type"), fieldname: "tree_type", - options:["Supplier Type", "Supplier", "Item Group", "Item"], + options:["Supplier Group", "Supplier", "Item Group", "Item"], filter: function(val, item, opts, me) { return me.apply_zero_filter(val, item, opts, me); }}, @@ -110,22 +110,22 @@ erpnext.PurchaseAnalytics = frappe.views.TreeGridReport.extend({ var me = this; if (!this.tl) { // add 'Not Set' Supplier & Item - // Add 'All Supplier Types' Supplier Type + // Add 'All Supplier Groups' Supplier Group // (Supplier / Item are not mandatory!!) - // Set parent supplier type for tree view + // Set parent supplier group for tree view - $.each(frappe.report_dump.data["Supplier Type"], function(i, v) { - v['parent_supplier_type'] = __("All Supplier Types") + $.each(frappe.report_dump.data["Supplier Group"], function(i, v) { + v['parent_supplier_group'] = __("All Supplier Groups") }) - frappe.report_dump.data["Supplier Type"] = [{ - name: __("All Supplier Types"), - id: "All Supplier Types", - }].concat(frappe.report_dump.data["Supplier Type"]); + frappe.report_dump.data["Supplier Group"] = [{ + name: __("All Supplier Groups"), + id: "All Supplier Groups", + }].concat(frappe.report_dump.data["Supplier Group"]); frappe.report_dump.data["Supplier"].push({ name: __("Not Set"), - parent_supplier_type: __("All Supplier Types"), + parent_supplier_group: __("All Supplier Groups"), id: "Not Set", }); @@ -144,8 +144,8 @@ erpnext.PurchaseAnalytics = frappe.views.TreeGridReport.extend({ if(!this.data || me.item_type != me.tree_type) { if(me.tree_type=='Supplier') { var items = frappe.report_dump.data["Supplier"]; - } if(me.tree_type=='Supplier Type') { - var items = this.prepare_tree("Supplier", "Supplier Type"); + } if(me.tree_type=='Supplier Group') { + var items = this.prepare_tree("Supplier", "Supplier Group"); } else if(me.tree_type=="Item Group") { var items = this.prepare_tree("Item", "Item Group"); } else if(me.tree_type=="Item") { diff --git a/erpnext/config/buying.py b/erpnext/config/buying.py index ba29125ca0..e20d514a23 100644 --- a/erpnext/config/buying.py +++ b/erpnext/config/buying.py @@ -39,8 +39,8 @@ def get_data(): }, { "type": "doctype", - "name": "Supplier Type", - "description": _("Supplier Type master.") + "name": "Supplier Group", + "description": _("Supplier Group master.") }, { "type": "doctype", diff --git a/erpnext/demo/setup/setup_data.py b/erpnext/demo/setup/setup_data.py index 4ed4df9176..42d079db34 100644 --- a/erpnext/demo/setup/setup_data.py +++ b/erpnext/demo/setup/setup_data.py @@ -275,7 +275,7 @@ def setup_supplier(): frappe.get_doc({ "doctype": "Supplier", "supplier_name": s, - "supplier_type": random.choice(["Services", "Raw Material"]), + "supplier_group": random.choice(["Services", "Raw Material"]), }).insert() def setup_warehouse(): diff --git a/erpnext/setup/setup_wizard/operations/install_fixtures.py b/erpnext/setup/setup_wizard/operations/install_fixtures.py index 8f761e5946..2c294af2a1 100644 --- a/erpnext/setup/setup_wizard/operations/install_fixtures.py +++ b/erpnext/setup/setup_wizard/operations/install_fixtures.py @@ -147,14 +147,14 @@ def install(country=None): {'doctype': 'Customer Group', 'customer_group_name': _('Non Profit'), 'is_group': 0, 'parent_customer_group': _('All Customer Groups')}, {'doctype': 'Customer Group', 'customer_group_name': _('Government'), 'is_group': 0, 'parent_customer_group': _('All Customer Groups')}, - # supplier type - {'doctype': 'Supplier Type', 'supplier_type': _('Services')}, - {'doctype': 'Supplier Type', 'supplier_type': _('Local')}, - {'doctype': 'Supplier Type', 'supplier_type': _('Raw Material')}, - {'doctype': 'Supplier Type', 'supplier_type': _('Electrical')}, - {'doctype': 'Supplier Type', 'supplier_type': _('Hardware')}, - {'doctype': 'Supplier Type', 'supplier_type': _('Pharmaceutical')}, - {'doctype': 'Supplier Type', 'supplier_type': _('Distributor')}, + # supplier group + {'doctype': 'Supplier Group', 'supplier_group_name': _('Services')}, + {'doctype': 'Supplier Group', 'supplier_group_name': _('Local')}, + {'doctype': 'Supplier Group', 'supplier_group_name': _('Raw Material')}, + {'doctype': 'Supplier Group', 'supplier_group_name': _('Electrical')}, + {'doctype': 'Supplier Group', 'supplier_group_name': _('Hardware')}, + {'doctype': 'Supplier Group', 'supplier_group_name': _('Pharmaceutical')}, + {'doctype': 'Supplier Group', 'supplier_group_name': _('Distributor')}, # Sales Person {'doctype': 'Sales Person', 'sales_person_name': _('Sales Team'), 'is_group': 1, "parent_sales_person": ""}, diff --git a/erpnext/startup/report_data_map.py b/erpnext/startup/report_data_map.py index daf6fdd3bd..3720017804 100644 --- a/erpnext/startup/report_data_map.py +++ b/erpnext/startup/report_data_map.py @@ -208,14 +208,14 @@ data_map = { }, "Supplier": { "columns": ["name", "if(supplier_name=name, '', supplier_name) as supplier_name", - "supplier_type as parent_supplier_type"], + "supplier_group as parent_supplier_group"], "conditions": ["docstatus < 2"], "order_by": "name", "links": { - "parent_supplier_type": ["Supplier Type", "name"], + "parent_supplier_group": ["Supplier Group", "name"], } }, - "Supplier Type": { + "Supplier Group": { "columns": ["name"], "conditions": ["docstatus < 2"], "order_by": "name" diff --git a/erpnext/utilities/user_progress_utils.py b/erpnext/utilities/user_progress_utils.py index 5bd855f719..20e533e91a 100644 --- a/erpnext/utilities/user_progress_utils.py +++ b/erpnext/utilities/user_progress_utils.py @@ -63,7 +63,7 @@ def create_suppliers(args_data): doc = frappe.get_doc({ "doctype":"Supplier", "supplier_name": supplier, - "supplier_type": _("Local"), + "supplier_group": _("Local"), "company": defaults.get("company") }).insert() From 2e0809801d35812d197ffe669aa580071bfeb36c Mon Sep 17 00:00:00 2001 From: Zlash65 Date: Thu, 19 Apr 2018 18:37:53 +0530 Subject: [PATCH 05/11] controller and other changes --- erpnext/controllers/queries.py | 4 ++-- erpnext/controllers/trends.py | 12 ++++++------ erpnext/hub_node/__init__.py | 2 +- erpnext/public/js/conf.js | 2 +- erpnext/public/js/controllers/transaction.js | 2 +- erpnext/public/js/hub/hub_form.js | 4 ++-- erpnext/public/js/purchase_trends_filters.js | 2 +- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/erpnext/controllers/queries.py b/erpnext/controllers/queries.py index fd13c1353e..3bf720fd5d 100644 --- a/erpnext/controllers/queries.py +++ b/erpnext/controllers/queries.py @@ -102,9 +102,9 @@ def customer_query(doctype, txt, searchfield, start, page_len, filters): def supplier_query(doctype, txt, searchfield, start, page_len, filters): supp_master_name = frappe.defaults.get_user_default("supp_master_name") if supp_master_name == "Supplier Name": - fields = ["name", "supplier_type"] + fields = ["name", "supplier_group"] else: - fields = ["name", "supplier_name", "supplier_type"] + fields = ["name", "supplier_name", "supplier_group"] fields = ", ".join(fields) return frappe.db.sql("""select {field} from `tabSupplier` diff --git a/erpnext/controllers/trends.py b/erpnext/controllers/trends.py index ef698c2a16..28a8fddfac 100644 --- a/erpnext/controllers/trends.py +++ b/erpnext/controllers/trends.py @@ -235,16 +235,16 @@ def based_wise_columns_query(based_on, trans): based_on_details["addl_tables"] = '' elif based_on == 'Supplier': - based_on_details["based_on_cols"] = ["Supplier:Link/Supplier:120", "Supplier Type:Link/Supplier Type:140"] - based_on_details["based_on_select"] = "t1.supplier, t3.supplier_type," + based_on_details["based_on_cols"] = ["Supplier:Link/Supplier:120", "Supplier Group:Link/Supplier Group:140"] + based_on_details["based_on_select"] = "t1.supplier, t3.supplier_group," based_on_details["based_on_group_by"] = 't1.supplier' based_on_details["addl_tables"] = ',`tabSupplier` t3' based_on_details["addl_tables_relational_cond"] = " and t1.supplier = t3.name" - elif based_on == 'Supplier Type': - based_on_details["based_on_cols"] = ["Supplier Type:Link/Supplier Type:140"] - based_on_details["based_on_select"] = "t3.supplier_type," - based_on_details["based_on_group_by"] = 't3.supplier_type' + elif based_on == 'Supplier Group': + based_on_details["based_on_cols"] = ["Supplier Group:Link/Supplier Group:140"] + based_on_details["based_on_select"] = "t3.supplier_group," + based_on_details["based_on_group_by"] = 't3.supplier_group' based_on_details["addl_tables"] = ',`tabSupplier` t3' based_on_details["addl_tables_relational_cond"] = " and t1.supplier = t3.name" diff --git a/erpnext/hub_node/__init__.py b/erpnext/hub_node/__init__.py index 89ee926d55..65b1386466 100644 --- a/erpnext/hub_node/__init__.py +++ b/erpnext/hub_node/__init__.py @@ -187,7 +187,7 @@ def make_supplier(supplier): supplier_doc = frappe.get_doc({ 'doctype': 'Supplier', 'supplier_name': supplier.supplier_name, - 'supplier_type': supplier.supplier_type, + 'supplier_group': supplier.supplier_group, 'supplier_email': supplier.supplier_email }).insert() else: diff --git a/erpnext/public/js/conf.js b/erpnext/public/js/conf.js index d256c08e13..08f8d43e50 100644 --- a/erpnext/public/js/conf.js +++ b/erpnext/public/js/conf.js @@ -49,7 +49,7 @@ $.extend(frappe.create_routes, { $.extend(frappe.breadcrumbs.preferred, { "Item Group": "Stock", "Customer Group": "Selling", - "Supplier Type": "Buying", + "Supplier Group": "Buying", "Territory": "Selling", "Sales Person": "Selling", "Sales Partner": "Selling", diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index 1551b1dfc3..eb4a7001f3 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -980,7 +980,7 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({ "customer_group": me.frm.doc.customer_group, "territory": me.frm.doc.territory, "supplier": me.frm.doc.supplier, - "supplier_type": me.frm.doc.supplier_type, + "supplier_group": me.frm.doc.supplier_group, "currency": me.frm.doc.currency, "conversion_rate": me.frm.doc.conversion_rate, "price_list": me.frm.doc.selling_price_list || me.frm.doc.buying_price_list, diff --git a/erpnext/public/js/hub/hub_form.js b/erpnext/public/js/hub/hub_form.js index 62c44fcb33..4a8c4eb3ec 100644 --- a/erpnext/public/js/hub/hub_form.js +++ b/erpnext/public/js/hub/hub_form.js @@ -444,8 +444,8 @@ erpnext.hub.ItemPage = class ItemPage extends erpnext.hub.HubDetailsPage { { label: __('Supplier Name'), fieldtype: 'Data', fieldname: 'supplier_name', default: item.company_name }, { label: __('Supplier Email'), fieldtype: 'Data', fieldname: 'supplier_email', default: item.seller }, { fieldtype: 'Column Break' }, - { label: __('Supplier Type'), fieldname: 'supplier_type', - fieldtype: 'Link', options: 'Supplier Type' } + { label: __('Supplier Group'), fieldname: 'supplier_group', + fieldtype: 'Link', options: 'Supplier Group' } ]; fields = fields.map(f => { f.reqd = 1; return f; }); diff --git a/erpnext/public/js/purchase_trends_filters.js b/erpnext/public/js/purchase_trends_filters.js index 117d4eb08c..595a138f12 100644 --- a/erpnext/public/js/purchase_trends_filters.js +++ b/erpnext/public/js/purchase_trends_filters.js @@ -23,7 +23,7 @@ erpnext.get_purchase_trends_filters = function() { { "value": "Item", "label": __("Item") }, { "value": "Item Group", "label": __("Item Group") }, { "value": "Supplier", "label": __("Supplier") }, - { "value": "Supplier Type", "label": __("Supplier Type") }, + { "value": "Supplier Group", "label": __("Supplier Group") }, { "value": "Project", "label": __("Project") } ], "default": "Item" From 540d7aa635080677e2678ab70712e0310646b747 Mon Sep 17 00:00:00 2001 From: Zlash65 Date: Fri, 20 Apr 2018 09:39:29 +0530 Subject: [PATCH 06/11] patch to reload_doc and rename field --- erpnext/patches.txt | 1 + .../rename_supplier_type_to_supplier_group.py | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 erpnext/patches/v11_0/rename_supplier_type_to_supplier_group.py diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 3fffade9bb..a8696fa24b 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -527,3 +527,4 @@ erpnext.patches.v11_0.rename_field_max_days_allowed erpnext.patches.v11_0.create_salary_structure_assignments erpnext.patches.v11_0.rename_health_insurance erpnext.patches.v11_0.rebuild_tree_for_company +erpnext.patches.v11_0.rename_supplier_type_to_supplier_group diff --git a/erpnext/patches/v11_0/rename_supplier_type_to_supplier_group.py b/erpnext/patches/v11_0/rename_supplier_type_to_supplier_group.py new file mode 100644 index 0000000000..b5b1bf4090 --- /dev/null +++ b/erpnext/patches/v11_0/rename_supplier_type_to_supplier_group.py @@ -0,0 +1,17 @@ +import frappe +from frappe.model.rename_doc import rename_doc +from frappe.model.utils.rename_field import rename_field + +def execute(): + if frappe.db.table_exists("Supplier Type") and not frappe.db.table_exists("Supplier Group"): + rename_doc("DocType", "Supplier Type", "Supplier Group", force=True) + frappe.reload_doc('setup', 'doctype', 'supplier_group') + frappe.reload_doc("accounts", "doctype", "pricing_rule") + frappe.reload_doc("accounts", "doctype", "tax_rule") + frappe.reload_doc("buying", "doctype", "buying_settings") + frappe.reload_doc("buying", "doctype", "supplier") + rename_field("Supplier Group", "supplier_type", "supplier_group_name") + rename_field("Supplier", "supplier_type", "supplier_group") + rename_field("Buying Settings", "supplier_type", "supplier_group") + rename_field("Pricing Rule", "supplier_type", "supplier_group") + rename_field("Tax Rule", "supplier_type", "supplier_group") From c88ce364cef3450b81eb8ed00adfad50378a474f Mon Sep 17 00:00:00 2001 From: Zlash65 Date: Fri, 20 Apr 2018 11:06:15 +0530 Subject: [PATCH 07/11] treeview implemented for supplier group --- .../rename_supplier_type_to_supplier_group.py | 17 ++ .../supplier_group/supplier_group.json | 161 +++++++++++++++++- .../supplier_group/supplier_group_tree.js | 3 + 3 files changed, 179 insertions(+), 2 deletions(-) create mode 100644 erpnext/setup/doctype/supplier_group/supplier_group_tree.js diff --git a/erpnext/patches/v11_0/rename_supplier_type_to_supplier_group.py b/erpnext/patches/v11_0/rename_supplier_type_to_supplier_group.py index b5b1bf4090..4db5704ad6 100644 --- a/erpnext/patches/v11_0/rename_supplier_type_to_supplier_group.py +++ b/erpnext/patches/v11_0/rename_supplier_type_to_supplier_group.py @@ -1,6 +1,8 @@ import frappe from frappe.model.rename_doc import rename_doc from frappe.model.utils.rename_field import rename_field +from frappe import _ +from frappe.utils.nestedset import rebuild_tree def execute(): if frappe.db.table_exists("Supplier Type") and not frappe.db.table_exists("Supplier Group"): @@ -15,3 +17,18 @@ def execute(): rename_field("Buying Settings", "supplier_type", "supplier_group") rename_field("Pricing Rule", "supplier_type", "supplier_group") rename_field("Tax Rule", "supplier_type", "supplier_group") + + build_tree() + +def build_tree(): + if not frappe.db.exists("Supplier Group", _('All Supplier Groups')): + frappe.get_doc({ + 'doctype': 'Supplier Group', + 'supplier_group_name': _('All Supplier Groups'), + 'is_group': 1 + }).insert(ignore_permissions=True) + + frappe.db.sql("""update `tabSupplier Group` set parent_supplier_group = '{0}' + where is_group = 0""".format(_('All Supplier Groups'))) + + rebuild_tree("Supplier Group", "parent_supplier_group") diff --git a/erpnext/setup/doctype/supplier_group/supplier_group.json b/erpnext/setup/doctype/supplier_group/supplier_group.json index 35fafac4ff..dc8b2631f1 100644 --- a/erpnext/setup/doctype/supplier_group/supplier_group.json +++ b/erpnext/setup/doctype/supplier_group/supplier_group.json @@ -25,7 +25,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_global_search": 0, - "in_list_view": 1, + "in_list_view": 0, "in_standard_filter": 0, "label": "Supplier Group Name", "length": 0, @@ -44,6 +44,69 @@ "translatable": 0, "unique": 0 }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 1, + "collapsible": 0, + "columns": 0, + "fieldname": "parent_supplier_group", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 1, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Parent Supplier Group", + "length": 0, + "no_copy": 0, + "options": "Supplier Group", + "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, + "bold": 1, + "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": 1, + "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, + "translatable": 0, + "unique": 0 + }, { "allow_bulk_edit": 0, "allow_on_submit": 0, @@ -169,6 +232,100 @@ "set_only_once": 0, "translatable": 0, "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "lft", + "fieldtype": "Int", + "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": "lft", + "length": 0, + "no_copy": 1, + "permlevel": 0, + "precision": "", + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 1, + "reqd": 0, + "search_index": 1, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "rgt", + "fieldtype": "Int", + "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": "rgt", + "length": 0, + "no_copy": 1, + "permlevel": 0, + "precision": "", + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 1, + "reqd": 0, + "search_index": 1, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "old_parent", + "fieldtype": "Link", + "hidden": 1, + "ignore_user_permissions": 1, + "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": 1, + "options": "Supplier Group", + "permlevel": 0, + "precision": "", + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 1, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 } ], "has_web_view": 0, @@ -182,7 +339,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2018-04-19 07:45:03.495577", + "modified": "2018-04-20 00:54:48.724120", "modified_by": "Administrator", "module": "Setup", "name": "Supplier Group", diff --git a/erpnext/setup/doctype/supplier_group/supplier_group_tree.js b/erpnext/setup/doctype/supplier_group/supplier_group_tree.js new file mode 100644 index 0000000000..24328bdd5a --- /dev/null +++ b/erpnext/setup/doctype/supplier_group/supplier_group_tree.js @@ -0,0 +1,3 @@ +frappe.treeview_settings["Supplier Group"] = { + ignore_fields:["parent_supplier_group"] +} \ No newline at end of file From 93d6b555d78170b522f43720727c593a09677fa6 Mon Sep 17 00:00:00 2001 From: Zlash65 Date: Fri, 20 Apr 2018 11:07:19 +0530 Subject: [PATCH 08/11] added fixtures for supplier-group, changed analytics report accordingly --- .../page/purchase_analytics/purchase_analytics.js | 12 ------------ .../setup_wizard/operations/install_fixtures.py | 15 ++++++++------- erpnext/startup/report_data_map.py | 2 +- 3 files changed, 9 insertions(+), 20 deletions(-) diff --git a/erpnext/buying/page/purchase_analytics/purchase_analytics.js b/erpnext/buying/page/purchase_analytics/purchase_analytics.js index df5790e826..b503113837 100644 --- a/erpnext/buying/page/purchase_analytics/purchase_analytics.js +++ b/erpnext/buying/page/purchase_analytics/purchase_analytics.js @@ -110,19 +110,7 @@ erpnext.PurchaseAnalytics = frappe.views.TreeGridReport.extend({ var me = this; if (!this.tl) { // add 'Not Set' Supplier & Item - // Add 'All Supplier Groups' Supplier Group // (Supplier / Item are not mandatory!!) - // Set parent supplier group for tree view - - $.each(frappe.report_dump.data["Supplier Group"], function(i, v) { - v['parent_supplier_group'] = __("All Supplier Groups") - }) - - frappe.report_dump.data["Supplier Group"] = [{ - name: __("All Supplier Groups"), - id: "All Supplier Groups", - }].concat(frappe.report_dump.data["Supplier Group"]); - frappe.report_dump.data["Supplier"].push({ name: __("Not Set"), parent_supplier_group: __("All Supplier Groups"), diff --git a/erpnext/setup/setup_wizard/operations/install_fixtures.py b/erpnext/setup/setup_wizard/operations/install_fixtures.py index 2c294af2a1..c686ed3080 100644 --- a/erpnext/setup/setup_wizard/operations/install_fixtures.py +++ b/erpnext/setup/setup_wizard/operations/install_fixtures.py @@ -148,13 +148,14 @@ def install(country=None): {'doctype': 'Customer Group', 'customer_group_name': _('Government'), 'is_group': 0, 'parent_customer_group': _('All Customer Groups')}, # supplier group - {'doctype': 'Supplier Group', 'supplier_group_name': _('Services')}, - {'doctype': 'Supplier Group', 'supplier_group_name': _('Local')}, - {'doctype': 'Supplier Group', 'supplier_group_name': _('Raw Material')}, - {'doctype': 'Supplier Group', 'supplier_group_name': _('Electrical')}, - {'doctype': 'Supplier Group', 'supplier_group_name': _('Hardware')}, - {'doctype': 'Supplier Group', 'supplier_group_name': _('Pharmaceutical')}, - {'doctype': 'Supplier Group', 'supplier_group_name': _('Distributor')}, + {'doctype': 'Supplier Group', 'supplier_group_name': _('All Supplier Groups'), 'is_group': 1, 'name': _('All Supplier Groups'), 'parent_supplier_group': ''}, + {'doctype': 'Supplier Group', 'supplier_group_name': _('Services'), 'is_group': 0, 'parent_supplier_group': _('All Supplier Groups')}, + {'doctype': 'Supplier Group', 'supplier_group_name': _('Local'), 'is_group': 0, 'parent_supplier_group': _('All Supplier Groups')}, + {'doctype': 'Supplier Group', 'supplier_group_name': _('Raw Material'), 'is_group': 0, 'parent_supplier_group': _('All Supplier Groups')}, + {'doctype': 'Supplier Group', 'supplier_group_name': _('Electrical'), 'is_group': 0, 'parent_supplier_group': _('All Supplier Groups')}, + {'doctype': 'Supplier Group', 'supplier_group_name': _('Hardware'), 'is_group': 0, 'parent_supplier_group': _('All Supplier Groups')}, + {'doctype': 'Supplier Group', 'supplier_group_name': _('Pharmaceutical'), 'is_group': 0, 'parent_supplier_group': _('All Supplier Groups')}, + {'doctype': 'Supplier Group', 'supplier_group_name': _('Distributor'), 'is_group': 0, 'parent_supplier_group': _('All Supplier Groups')}, # Sales Person {'doctype': 'Sales Person', 'sales_person_name': _('Sales Team'), 'is_group': 1, "parent_sales_person": ""}, diff --git a/erpnext/startup/report_data_map.py b/erpnext/startup/report_data_map.py index 3720017804..5de7998c7d 100644 --- a/erpnext/startup/report_data_map.py +++ b/erpnext/startup/report_data_map.py @@ -216,7 +216,7 @@ data_map = { } }, "Supplier Group": { - "columns": ["name"], + "columns": ["name", "parent_supplier_group"], "conditions": ["docstatus < 2"], "order_by": "name" }, From f665189ab3e8b209dfefdc9578d5065df7323e72 Mon Sep 17 00:00:00 2001 From: Zlash65 Date: Fri, 20 Apr 2018 16:00:55 +0530 Subject: [PATCH 09/11] tree based changes --- .../doctype/supplier_group/supplier_group.js | 22 ++++++++++++++++++- .../doctype/supplier_group/supplier_group.py | 16 +++++++++++--- 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/erpnext/setup/doctype/supplier_group/supplier_group.js b/erpnext/setup/doctype/supplier_group/supplier_group.js index 10e5c04dcc..ea92726e2a 100644 --- a/erpnext/setup/doctype/supplier_group/supplier_group.js +++ b/erpnext/setup/doctype/supplier_group/supplier_group.js @@ -2,7 +2,27 @@ // For license information, please see license.txt cur_frm.cscript.refresh = function(doc) { - cur_frm.set_intro(doc.__islocal ? "" : __("There is nothing to edit.")) + cur_frm.set_intro(doc.__islocal ? "" : __("There is nothing to edit.")); + cur_frm.cscript.set_root_readonly(doc); +} + +cur_frm.cscript.set_root_readonly = function(doc) { + // read-only for root customer group + if(!doc.parent_supplier_group) { + cur_frm.set_read_only(); + cur_frm.set_intro(__("This is a root supplier group and cannot be edited.")); + } else { + cur_frm.set_intro(null); + } +} + +//get query select Customer Group +cur_frm.fields_dict['parent_supplier_group'].get_query = function(doc,cdt,cdn) { + return { + filters: { + 'is_group': 1 + } + } } cur_frm.fields_dict['accounts'].grid.get_field('account').get_query = function(doc, cdt, cdn) { diff --git a/erpnext/setup/doctype/supplier_group/supplier_group.py b/erpnext/setup/doctype/supplier_group/supplier_group.py index 53ab215190..747560a533 100644 --- a/erpnext/setup/doctype/supplier_group/supplier_group.py +++ b/erpnext/setup/doctype/supplier_group/supplier_group.py @@ -4,7 +4,17 @@ from __future__ import unicode_literals import frappe -from frappe.model.document import Document +from frappe.utils.nestedset import NestedSet -class SupplierGroup(Document): - pass +class SupplierGroup(NestedSet): + nsm_parent_field = 'parent_supplier_group'; + + def update_nsm_model(self): + frappe.utils.nestedset.update_nsm(self) + + def on_update(self): + self.update_nsm_model() + self.validate_one_root() + + def on_trash(self): + self.update_nsm_model() From 39097c7fbe963c5df9c5df4a1166266993efad61 Mon Sep 17 00:00:00 2001 From: Zlash65 Date: Mon, 7 May 2018 14:54:25 +0530 Subject: [PATCH 10/11] codacy fix --- .../purchase_analytics/purchase_analytics.js | 11 ++++++----- .../doctype/supplier_group/supplier_group.js | 16 ++++++++-------- .../supplier_group/supplier_group_tree.js | 2 +- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/erpnext/buying/page/purchase_analytics/purchase_analytics.js b/erpnext/buying/page/purchase_analytics/purchase_analytics.js index b503113837..06764a3c60 100644 --- a/erpnext/buying/page/purchase_analytics/purchase_analytics.js +++ b/erpnext/buying/page/purchase_analytics/purchase_analytics.js @@ -130,14 +130,15 @@ erpnext.PurchaseAnalytics = frappe.views.TreeGridReport.extend({ if(!this.data || me.item_type != me.tree_type) { + var items; if(me.tree_type=='Supplier') { - var items = frappe.report_dump.data["Supplier"]; - } if(me.tree_type=='Supplier Group') { - var items = this.prepare_tree("Supplier", "Supplier Group"); + items = frappe.report_dump.data["Supplier"]; + } else if(me.tree_type=='Supplier Group') { + items = this.prepare_tree("Supplier", "Supplier Group"); } else if(me.tree_type=="Item Group") { - var items = this.prepare_tree("Item", "Item Group"); + items = this.prepare_tree("Item", "Item Group"); } else if(me.tree_type=="Item") { - var items = frappe.report_dump.data["Item"]; + items = frappe.report_dump.data["Item"]; } me.item_type = me.tree_type diff --git a/erpnext/setup/doctype/supplier_group/supplier_group.js b/erpnext/setup/doctype/supplier_group/supplier_group.js index ea92726e2a..ac5bda6e2c 100644 --- a/erpnext/setup/doctype/supplier_group/supplier_group.js +++ b/erpnext/setup/doctype/supplier_group/supplier_group.js @@ -4,7 +4,7 @@ cur_frm.cscript.refresh = function(doc) { cur_frm.set_intro(doc.__islocal ? "" : __("There is nothing to edit.")); cur_frm.cscript.set_root_readonly(doc); -} +}; cur_frm.cscript.set_root_readonly = function(doc) { // read-only for root customer group @@ -14,16 +14,16 @@ cur_frm.cscript.set_root_readonly = function(doc) { } else { cur_frm.set_intro(null); } -} +}; -//get query select Customer Group -cur_frm.fields_dict['parent_supplier_group'].get_query = function(doc,cdt,cdn) { +// get query select Customer Group +cur_frm.fields_dict['parent_supplier_group'].get_query = function() { return { filters: { 'is_group': 1 } - } -} + }; +}; cur_frm.fields_dict['accounts'].grid.get_field('account').get_query = function(doc, cdt, cdn) { var d = locals[cdt][cdn]; @@ -33,5 +33,5 @@ cur_frm.fields_dict['accounts'].grid.get_field('account').get_query = function(d 'company': d.company, "is_group": 0 } - } -} + }; +}; diff --git a/erpnext/setup/doctype/supplier_group/supplier_group_tree.js b/erpnext/setup/doctype/supplier_group/supplier_group_tree.js index 24328bdd5a..73926992e8 100644 --- a/erpnext/setup/doctype/supplier_group/supplier_group_tree.js +++ b/erpnext/setup/doctype/supplier_group/supplier_group_tree.js @@ -1,3 +1,3 @@ frappe.treeview_settings["Supplier Group"] = { ignore_fields:["parent_supplier_group"] -} \ No newline at end of file +}; \ No newline at end of file From 513f13df272de2ceb190d898204753eafbeedf47 Mon Sep 17 00:00:00 2001 From: Zlash65 Date: Mon, 14 May 2018 16:05:16 +0530 Subject: [PATCH 11/11] patch fix --- .../patches/v11_0/rename_supplier_type_to_supplier_group.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/patches/v11_0/rename_supplier_type_to_supplier_group.py b/erpnext/patches/v11_0/rename_supplier_type_to_supplier_group.py index 4db5704ad6..f0907af333 100644 --- a/erpnext/patches/v11_0/rename_supplier_type_to_supplier_group.py +++ b/erpnext/patches/v11_0/rename_supplier_type_to_supplier_group.py @@ -21,6 +21,9 @@ def execute(): build_tree() def build_tree(): + frappe.db.sql("""update `tabSupplier Group` set parent_supplier_group = '{0}' + where is_group = 0""".format(_('All Supplier Groups'))) + if not frappe.db.exists("Supplier Group", _('All Supplier Groups')): frappe.get_doc({ 'doctype': 'Supplier Group', @@ -28,7 +31,4 @@ def build_tree(): 'is_group': 1 }).insert(ignore_permissions=True) - frappe.db.sql("""update `tabSupplier Group` set parent_supplier_group = '{0}' - where is_group = 0""".format(_('All Supplier Groups'))) - rebuild_tree("Supplier Group", "parent_supplier_group")