From 6bc7b892c4f340dedf55f661f47b3a4645f87b75 Mon Sep 17 00:00:00 2001 From: Saurabh Date: Thu, 14 Jul 2016 14:03:19 +0530 Subject: [PATCH] [fix] alter fieldtype for is_group from select to check --- erpnext/patches.txt | 3 +- .../v7_0/make_is_group_fieldtype_as_check.py | 13 ++++++ erpnext/public/js/queries.js | 2 +- erpnext/selling/doctype/customer/customer.js | 2 +- .../doctype/customer_group/customer_group.js | 2 +- .../customer_group/customer_group.json | 42 ++++++++++++++++--- .../doctype/customer_group/test_records.json | 4 +- .../setup/doctype/item_group/item_group.js | 2 +- .../setup/doctype/item_group/item_group.json | 9 ++-- .../doctype/item_group/test_records.json | 22 +++++----- .../doctype/sales_partner/sales_partner.js | 2 +- .../doctype/sales_person/sales_person.js | 2 +- .../doctype/sales_person/sales_person.json | 28 ++++++++++--- .../doctype/sales_person/sales_person_tree.js | 2 +- .../doctype/sales_person/test_records.json | 6 +-- erpnext/setup/doctype/territory/territory.js | 2 +- .../setup/doctype/territory/territory.json | 38 ++++++++++++++--- .../setup/doctype/territory/test_records.json | 10 ++--- .../setup/setup_wizard/install_fixtures.py | 26 ++++++------ erpnext/stock/__init__.py | 4 +- 20 files changed, 157 insertions(+), 64 deletions(-) create mode 100644 erpnext/patches/v7_0/make_is_group_fieldtype_as_check.py diff --git a/erpnext/patches.txt b/erpnext/patches.txt index c251c31133..83519e61a8 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -290,4 +290,5 @@ erpnext.patches.v7_0.rename_advance_table_fields erpnext.patches.v7_0.rename_salary_components erpnext.patches.v7_0.rename_prevdoc_fields erpnext.patches.v7_0.rename_time_sheet_doctype -execute:frappe.delete_doc_if_exists("Report", "Customers Not Buying Since Long Time") \ No newline at end of file +execute:frappe.delete_doc_if_exists("Report", "Customers Not Buying Since Long Time") +erpnext.patches.v7_0.make_is_group_fieldtype_as_check \ No newline at end of file diff --git a/erpnext/patches/v7_0/make_is_group_fieldtype_as_check.py b/erpnext/patches/v7_0/make_is_group_fieldtype_as_check.py new file mode 100644 index 0000000000..eab4401cc8 --- /dev/null +++ b/erpnext/patches/v7_0/make_is_group_fieldtype_as_check.py @@ -0,0 +1,13 @@ +import frappe + +def execute(): + for doctype in ["Sales Person", "Customer Group", "Item Group", "Territory"]: + + frappe.reload_doctype(doctype) + + #In MySQL, you can't modify the same table which you use in the SELECT part. + + frappe.db.sql(""" update `tab{doctype}` set is_group = 1 + where name in (select parent_{field} from (select distinct parent_{field} from `tab{doctype}` + where parent_{field} != '') as dummy_table) + """.format(doctype=doctype, field=doctype.strip().lower().replace(' ','_')), debug=1) diff --git a/erpnext/public/js/queries.js b/erpnext/public/js/queries.js index c1f09a5103..7c4bf0f2c7 100644 --- a/erpnext/public/js/queries.js +++ b/erpnext/public/js/queries.js @@ -62,7 +62,7 @@ $.extend(erpnext.queries, { }, not_a_group_filter: function() { - return { filters: { is_group: "No" } }; + return { filters: { is_group: 0 } }; }, employee: function() { diff --git a/erpnext/selling/doctype/customer/customer.js b/erpnext/selling/doctype/customer/customer.js index b5234f1f74..5b41ad8b05 100644 --- a/erpnext/selling/doctype/customer/customer.js +++ b/erpnext/selling/doctype/customer/customer.js @@ -46,7 +46,7 @@ cur_frm.add_fetch('default_sales_partner','commission_rate','default_commission_ cur_frm.fields_dict['customer_group'].get_query = function(doc, dt, dn) { return{ - filters:{'is_group': 'No'} + filters:{'is_group': 0} } } diff --git a/erpnext/setup/doctype/customer_group/customer_group.js b/erpnext/setup/doctype/customer_group/customer_group.js index 654abd90a5..c199a8e57f 100644 --- a/erpnext/setup/doctype/customer_group/customer_group.js +++ b/erpnext/setup/doctype/customer_group/customer_group.js @@ -20,7 +20,7 @@ cur_frm.cscript.set_root_readonly = function(doc) { cur_frm.fields_dict['parent_customer_group'].get_query = function(doc,cdt,cdn) { return { filters: { - 'is_group': "Yes" + 'is_group': 1 } } } diff --git a/erpnext/setup/doctype/customer_group/customer_group.json b/erpnext/setup/doctype/customer_group/customer_group.json index 34d13bd5ab..38bb558bf5 100644 --- a/erpnext/setup/doctype/customer_group/customer_group.json +++ b/erpnext/setup/doctype/customer_group/customer_group.json @@ -3,11 +3,13 @@ "allow_import": 1, "allow_rename": 1, "autoname": "field:customer_group_name", + "beta": 0, "creation": "2013-01-10 16:34:23", "custom": 0, "docstatus": 0, "doctype": "DocType", "document_type": "Setup", + "editable_grid": 0, "fields": [ { "allow_on_submit": 0, @@ -17,6 +19,7 @@ "fieldtype": "Data", "hidden": 0, "ignore_user_permissions": 0, + "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 1, "label": "Customer Group Name", @@ -26,6 +29,7 @@ "oldfieldtype": "Data", "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 1, @@ -42,6 +46,7 @@ "fieldtype": "Link", "hidden": 0, "ignore_user_permissions": 1, + "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 1, "label": "Parent Customer Group", @@ -52,6 +57,7 @@ "options": "Customer Group", "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -65,19 +71,21 @@ "collapsible": 0, "description": "Only leaf nodes are allowed in transaction", "fieldname": "is_group", - "fieldtype": "Select", + "fieldtype": "Check", "hidden": 0, "ignore_user_permissions": 0, + "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 1, - "label": "Has Child Node", + "label": "Is Group", "length": 0, "no_copy": 0, "oldfieldname": "is_group", "oldfieldtype": "Select", - "options": "\nYes\nNo", + "options": "", "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 1, @@ -93,12 +101,14 @@ "fieldtype": "Column Break", "hidden": 0, "ignore_user_permissions": 0, + "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, "length": 0, "no_copy": 0, "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -114,6 +124,7 @@ "fieldtype": "Link", "hidden": 0, "ignore_user_permissions": 1, + "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, "label": "Default Price List", @@ -122,6 +133,7 @@ "options": "Price List", "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -137,6 +149,7 @@ "fieldtype": "Select", "hidden": 0, "ignore_user_permissions": 0, + "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, "label": "Credit Days Based On", @@ -146,6 +159,7 @@ "permlevel": 0, "precision": "", "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -162,6 +176,7 @@ "fieldtype": "Int", "hidden": 0, "ignore_user_permissions": 0, + "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, "label": "Credit Days", @@ -169,6 +184,7 @@ "no_copy": 0, "permlevel": 1, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -184,6 +200,7 @@ "fieldtype": "Currency", "hidden": 0, "ignore_user_permissions": 0, + "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, "label": "Credit Limit", @@ -191,6 +208,7 @@ "no_copy": 0, "permlevel": 1, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -206,6 +224,7 @@ "fieldtype": "Int", "hidden": 1, "ignore_user_permissions": 0, + "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, "label": "lft", @@ -215,6 +234,7 @@ "oldfieldtype": "Int", "permlevel": 0, "print_hide": 1, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 1, "reqd": 0, @@ -230,6 +250,7 @@ "fieldtype": "Int", "hidden": 1, "ignore_user_permissions": 0, + "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, "label": "rgt", @@ -239,6 +260,7 @@ "oldfieldtype": "Int", "permlevel": 0, "print_hide": 1, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 1, "reqd": 0, @@ -255,6 +277,7 @@ "fieldtype": "Link", "hidden": 1, "ignore_user_permissions": 1, + "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, "label": "old_parent", @@ -265,6 +288,7 @@ "options": "Customer Group", "permlevel": 0, "print_hide": 1, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 1, "reqd": 0, @@ -280,6 +304,7 @@ "fieldtype": "Section Break", "hidden": 0, "ignore_user_permissions": 0, + "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, "label": "Default Receivable Account", @@ -287,6 +312,7 @@ "no_copy": 0, "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -304,6 +330,7 @@ "fieldtype": "Table", "hidden": 0, "ignore_user_permissions": 0, + "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, "label": "Accounts", @@ -312,6 +339,7 @@ "options": "Party Account", "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -324,13 +352,14 @@ "hide_toolbar": 0, "icon": "icon-sitemap", "idx": 1, + "image_view": 0, "in_create": 0, "in_dialog": 0, "is_submittable": 0, "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2015-11-16 06:29:44.374615", + "modified": "2016-07-14 12:43:08.949307", "modified_by": "Administrator", "module": "Setup", "name": "Customer Group", @@ -457,7 +486,10 @@ "write": 0 } ], + "quick_entry": 0, "read_only": 0, "read_only_onload": 0, - "search_fields": "parent_customer_group" + "search_fields": "parent_customer_group", + "sort_order": "DESC", + "track_seen": 0 } \ No newline at end of file diff --git a/erpnext/setup/doctype/customer_group/test_records.json b/erpnext/setup/doctype/customer_group/test_records.json index cc3f87e098..4c472b886a 100644 --- a/erpnext/setup/doctype/customer_group/test_records.json +++ b/erpnext/setup/doctype/customer_group/test_records.json @@ -2,13 +2,13 @@ { "customer_group_name": "_Test Customer Group", "doctype": "Customer Group", - "is_group": "No", + "is_group": 0, "parent_customer_group": "All Customer Groups" }, { "customer_group_name": "_Test Customer Group 1", "doctype": "Customer Group", - "is_group": "No", + "is_group": 0, "parent_customer_group": "All Customer Groups" } ] diff --git a/erpnext/setup/doctype/item_group/item_group.js b/erpnext/setup/doctype/item_group/item_group.js index d6adebce97..46d403417d 100644 --- a/erpnext/setup/doctype/item_group/item_group.js +++ b/erpnext/setup/doctype/item_group/item_group.js @@ -9,7 +9,7 @@ frappe.ui.form.on("Item Group", { frm.fields_dict['parent_item_group'].get_query = function(doc,cdt,cdn) { return{ filters:[ - ['Item Group', 'is_group', '=', 'Yes'], + ['Item Group', 'is_group', '=', 1], ['Item Group', 'name', '!=', doc.item_group_name] ] } diff --git a/erpnext/setup/doctype/item_group/item_group.json b/erpnext/setup/doctype/item_group/item_group.json index 37d8c81585..63e9b17f69 100644 --- a/erpnext/setup/doctype/item_group/item_group.json +++ b/erpnext/setup/doctype/item_group/item_group.json @@ -10,6 +10,7 @@ "docstatus": 0, "doctype": "DocType", "document_type": "Setup", + "editable_grid": 0, "fields": [ { "allow_on_submit": 0, @@ -95,18 +96,18 @@ "collapsible": 0, "description": "Only leaf nodes are allowed in transaction", "fieldname": "is_group", - "fieldtype": "Select", + "fieldtype": "Check", "hidden": 0, "ignore_user_permissions": 0, "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 1, - "label": "Has Child Node", + "label": "Is Group", "length": 0, "no_copy": 0, "oldfieldname": "is_group", "oldfieldtype": "Select", - "options": "\nYes\nNo", + "options": "", "permlevel": 0, "print_hide": 0, "print_hide_if_no_value": 0, @@ -461,7 +462,7 @@ "issingle": 0, "istable": 0, "max_attachments": 3, - "modified": "2016-06-23 14:44:46.228923", + "modified": "2016-07-14 12:41:09.269478", "modified_by": "Administrator", "module": "Setup", "name": "Item Group", diff --git a/erpnext/setup/doctype/item_group/test_records.json b/erpnext/setup/doctype/item_group/test_records.json index 60336f0c08..74f464199b 100644 --- a/erpnext/setup/doctype/item_group/test_records.json +++ b/erpnext/setup/doctype/item_group/test_records.json @@ -1,68 +1,68 @@ [ { "doctype": "Item Group", - "is_group": "No", + "is_group": 0, "item_group_name": "_Test Item Group", "parent_item_group": "All Item Groups", "default_cost_center": "_Test Cost Center 2 - _TC" }, { "doctype": "Item Group", - "is_group": "No", + "is_group": 0, "item_group_name": "_Test Item Group Desktops", "parent_item_group": "All Item Groups" }, { "doctype": "Item Group", - "is_group": "Yes", + "is_group": 1, "item_group_name": "_Test Item Group A", "parent_item_group": "All Item Groups" }, { "doctype": "Item Group", - "is_group": "Yes", + "is_group": 1, "item_group_name": "_Test Item Group B", "parent_item_group": "All Item Groups" }, { "doctype": "Item Group", - "is_group": "Yes", + "is_group": 1, "item_group_name": "_Test Item Group B - 1", "parent_item_group": "_Test Item Group B" }, { "doctype": "Item Group", - "is_group": "Yes", + "is_group": 1, "item_group_name": "_Test Item Group B - 2", "parent_item_group": "_Test Item Group B" }, { "doctype": "Item Group", - "is_group": "No", + "is_group": 0, "item_group_name": "_Test Item Group B - 3", "parent_item_group": "_Test Item Group B" }, { "doctype": "Item Group", - "is_group": "Yes", + "is_group": 1, "item_group_name": "_Test Item Group C", "parent_item_group": "All Item Groups" }, { "doctype": "Item Group", - "is_group": "Yes", + "is_group": 1, "item_group_name": "_Test Item Group C - 1", "parent_item_group": "_Test Item Group C" }, { "doctype": "Item Group", - "is_group": "Yes", + "is_group": 1, "item_group_name": "_Test Item Group C - 2", "parent_item_group": "_Test Item Group C" }, { "doctype": "Item Group", - "is_group": "Yes", + "is_group": 1, "item_group_name": "_Test Item Group D", "parent_item_group": "All Item Groups" } diff --git a/erpnext/setup/doctype/sales_partner/sales_partner.js b/erpnext/setup/doctype/sales_partner/sales_partner.js index 669cabfff8..cb66b7f9cb 100644 --- a/erpnext/setup/doctype/sales_partner/sales_partner.js +++ b/erpnext/setup/doctype/sales_partner/sales_partner.js @@ -15,6 +15,6 @@ cur_frm.cscript.refresh = function(doc,dt,dn){ cur_frm.fields_dict['targets'].grid.get_field("item_group").get_query = function(doc, dt, dn) { return{ - filters:{ 'is_group': "No" } + filters:{ 'is_group': 0 } } } diff --git a/erpnext/setup/doctype/sales_person/sales_person.js b/erpnext/setup/doctype/sales_person/sales_person.js index 2ee3974a22..2388739b7f 100644 --- a/erpnext/setup/doctype/sales_person/sales_person.js +++ b/erpnext/setup/doctype/sales_person/sales_person.js @@ -20,7 +20,7 @@ cur_frm.cscript.set_root_readonly = function(doc) { cur_frm.fields_dict['parent_sales_person'].get_query = function(doc, cdt, cdn) { return{ filters: [ - ['Sales Person', 'is_group', '=', 'Yes'], + ['Sales Person', 'is_group', '=', 1], ['Sales Person', 'name', '!=', doc.sales_person_name] ] } diff --git a/erpnext/setup/doctype/sales_person/sales_person.json b/erpnext/setup/doctype/sales_person/sales_person.json index e99d14f6df..b42adcab38 100644 --- a/erpnext/setup/doctype/sales_person/sales_person.json +++ b/erpnext/setup/doctype/sales_person/sales_person.json @@ -3,12 +3,14 @@ "allow_import": 1, "allow_rename": 1, "autoname": "field:sales_person_name", + "beta": 0, "creation": "2013-01-10 16:34:24", "custom": 0, "description": "All Sales Transactions can be tagged against multiple **Sales Persons** so that you can set and monitor targets.", "docstatus": 0, "doctype": "DocType", "document_type": "Setup", + "editable_grid": 0, "fields": [ { "allow_on_submit": 0, @@ -18,6 +20,7 @@ "fieldtype": "Section Break", "hidden": 0, "ignore_user_permissions": 0, + "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, "label": "Name and Employee ID", @@ -42,6 +45,7 @@ "fieldtype": "Data", "hidden": 0, "ignore_user_permissions": 0, + "ignore_xss_filter": 0, "in_filter": 1, "in_list_view": 1, "label": "Sales Person Name", @@ -68,6 +72,7 @@ "fieldtype": "Link", "hidden": 0, "ignore_user_permissions": 1, + "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 1, "label": "Parent Sales Person", @@ -91,17 +96,18 @@ "bold": 0, "collapsible": 0, "fieldname": "is_group", - "fieldtype": "Select", + "fieldtype": "Check", "hidden": 0, "ignore_user_permissions": 0, + "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 1, - "label": "Has Child Node", + "label": "Is Group", "length": 0, "no_copy": 0, "oldfieldname": "is_group", "oldfieldtype": "Select", - "options": "\nYes\nNo", + "options": "", "permlevel": 0, "print_hide": 0, "print_hide_if_no_value": 0, @@ -120,6 +126,7 @@ "fieldtype": "Column Break", "hidden": 0, "ignore_user_permissions": 0, + "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, "length": 0, @@ -142,6 +149,7 @@ "fieldtype": "Link", "hidden": 0, "ignore_user_permissions": 0, + "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, "label": "Employee", @@ -166,6 +174,7 @@ "fieldtype": "Int", "hidden": 1, "ignore_user_permissions": 0, + "ignore_xss_filter": 0, "in_filter": 1, "in_list_view": 0, "label": "lft", @@ -191,6 +200,7 @@ "fieldtype": "Int", "hidden": 1, "ignore_user_permissions": 0, + "ignore_xss_filter": 0, "in_filter": 1, "in_list_view": 0, "label": "rgt", @@ -216,6 +226,7 @@ "fieldtype": "Data", "hidden": 1, "ignore_user_permissions": 0, + "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, "label": "old_parent", @@ -242,6 +253,7 @@ "fieldtype": "Section Break", "hidden": 0, "ignore_user_permissions": 0, + "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, "label": "Sales Person Targets", @@ -267,6 +279,7 @@ "fieldtype": "Table", "hidden": 0, "ignore_user_permissions": 0, + "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, "label": "Targets", @@ -294,6 +307,7 @@ "fieldtype": "Link", "hidden": 0, "ignore_user_permissions": 0, + "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, "label": "Target Distribution", @@ -317,13 +331,14 @@ "hide_toolbar": 0, "icon": "icon-user", "idx": 1, + "image_view": 0, "in_create": 0, "in_dialog": 0, "is_submittable": 0, "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2016-01-06 02:36:22.551330", + "modified": "2016-07-14 12:44:43.408367", "modified_by": "Administrator", "module": "Setup", "name": "Sales Person", @@ -390,7 +405,10 @@ "write": 1 } ], + "quick_entry": 0, "read_only": 0, "read_only_onload": 0, - "search_fields": "parent_sales_person" + "search_fields": "parent_sales_person", + "sort_order": "ASC", + "track_seen": 0 } \ No newline at end of file diff --git a/erpnext/setup/doctype/sales_person/sales_person_tree.js b/erpnext/setup/doctype/sales_person/sales_person_tree.js index fd2127d013..077cf3b448 100644 --- a/erpnext/setup/doctype/sales_person/sales_person_tree.js +++ b/erpnext/setup/doctype/sales_person/sales_person_tree.js @@ -5,7 +5,7 @@ frappe.treeview_settings["Sales Person"] = { {fieldtype:'Link', fieldname:'employee', label:__('Employee'), options:'Employee', description: __("Please enter Employee Id of this sales person")}, - {fieldtype:'Select', fieldname:'is_group', label:__('Group Node'), options:'No\nYes', + {fieldtype:'Check', fieldname:'is_group', label:__('Group Node'), description: __("Further nodes can be only created under 'Group' type nodes")} ], } \ No newline at end of file diff --git a/erpnext/setup/doctype/sales_person/test_records.json b/erpnext/setup/doctype/sales_person/test_records.json index cd29d40b1a..75d6cd3797 100644 --- a/erpnext/setup/doctype/sales_person/test_records.json +++ b/erpnext/setup/doctype/sales_person/test_records.json @@ -2,21 +2,21 @@ { "doctype": "Sales Person", "employee": "_T-Employee-0001", - "is_group": "No", + "is_group": 0, "parent_sales_person": "Sales Team", "sales_person_name": "_Test Sales Person" }, { "doctype": "Sales Person", "employee": "_T-Employee-0002", - "is_group": "No", + "is_group": 0, "parent_sales_person": "Sales Team", "sales_person_name": "_Test Sales Person 1" }, { "doctype": "Sales Person", "employee": "_T-Employee-0003", - "is_group": "No", + "is_group": 0, "parent_sales_person": "Sales Team", "sales_person_name": "_Test Sales Person 2" } diff --git a/erpnext/setup/doctype/territory/territory.js b/erpnext/setup/doctype/territory/territory.js index 317278aad8..69f761a687 100644 --- a/erpnext/setup/doctype/territory/territory.js +++ b/erpnext/setup/doctype/territory/territory.js @@ -20,7 +20,7 @@ cur_frm.cscript.set_root_readonly = function(doc) { cur_frm.fields_dict['parent_territory'].get_query = function(doc,cdt,cdn) { return{ filters:[ - ['Territory', 'is_group', '=', 'Yes'], + ['Territory', 'is_group', '=', 1], ['Territory', 'name', '!=', doc.territory_name] ] } diff --git a/erpnext/setup/doctype/territory/territory.json b/erpnext/setup/doctype/territory/territory.json index 4ce0fff348..3f799ee6df 100644 --- a/erpnext/setup/doctype/territory/territory.json +++ b/erpnext/setup/doctype/territory/territory.json @@ -3,12 +3,14 @@ "allow_import": 1, "allow_rename": 1, "autoname": "field:territory_name", + "beta": 0, "creation": "2013-01-10 16:34:24", "custom": 0, "description": "Classification of Customers by region", "docstatus": 0, "doctype": "DocType", "document_type": "Setup", + "editable_grid": 0, "fields": [ { "allow_on_submit": 0, @@ -18,6 +20,7 @@ "fieldtype": "Data", "hidden": 0, "ignore_user_permissions": 0, + "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 1, "label": "Territory Name", @@ -27,6 +30,7 @@ "oldfieldtype": "Data", "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 1, @@ -43,6 +47,7 @@ "fieldtype": "Link", "hidden": 0, "ignore_user_permissions": 1, + "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 1, "label": "Parent Territory", @@ -53,6 +58,7 @@ "options": "Territory", "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -66,19 +72,21 @@ "collapsible": 0, "description": "Only leaf nodes are allowed in transaction", "fieldname": "is_group", - "fieldtype": "Select", + "fieldtype": "Check", "hidden": 0, "ignore_user_permissions": 0, + "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 1, - "label": "Has Child Node", + "label": "Is Group", "length": 0, "no_copy": 0, "oldfieldname": "is_group", "oldfieldtype": "Select", - "options": "\nYes\nNo", + "options": "", "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 1, @@ -94,12 +102,14 @@ "fieldtype": "Column Break", "hidden": 0, "ignore_user_permissions": 0, + "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, "length": 0, "no_copy": 0, "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -116,6 +126,7 @@ "fieldtype": "Link", "hidden": 0, "ignore_user_permissions": 0, + "ignore_xss_filter": 0, "in_filter": 1, "in_list_view": 1, "label": "Territory Manager", @@ -126,6 +137,7 @@ "options": "Sales Person", "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -141,6 +153,7 @@ "fieldtype": "Int", "hidden": 1, "ignore_user_permissions": 0, + "ignore_xss_filter": 0, "in_filter": 1, "in_list_view": 0, "label": "lft", @@ -150,6 +163,7 @@ "oldfieldtype": "Int", "permlevel": 0, "print_hide": 1, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -165,6 +179,7 @@ "fieldtype": "Int", "hidden": 1, "ignore_user_permissions": 0, + "ignore_xss_filter": 0, "in_filter": 1, "in_list_view": 0, "label": "rgt", @@ -174,6 +189,7 @@ "oldfieldtype": "Int", "permlevel": 0, "print_hide": 1, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -190,6 +206,7 @@ "fieldtype": "Link", "hidden": 1, "ignore_user_permissions": 1, + "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, "label": "old_parent", @@ -200,6 +217,7 @@ "options": "Territory", "permlevel": 0, "print_hide": 1, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 1, "reqd": 0, @@ -216,6 +234,7 @@ "fieldtype": "Section Break", "hidden": 0, "ignore_user_permissions": 0, + "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, "label": "Territory Targets", @@ -224,6 +243,7 @@ "oldfieldtype": "Section Break", "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -239,6 +259,7 @@ "fieldtype": "Table", "hidden": 0, "ignore_user_permissions": 0, + "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, "label": "Targets", @@ -249,6 +270,7 @@ "options": "Target Detail", "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -265,6 +287,7 @@ "fieldtype": "Link", "hidden": 0, "ignore_user_permissions": 0, + "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, "label": "Target Distribution", @@ -275,6 +298,7 @@ "options": "Monthly Distribution", "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -287,13 +311,14 @@ "hide_toolbar": 0, "icon": "icon-map-marker", "idx": 1, + "image_view": 0, "in_create": 0, "in_dialog": 0, "is_submittable": 0, "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2015-11-16 06:29:59.337250", + "modified": "2016-07-14 12:43:36.619881", "modified_by": "Administrator", "module": "Setup", "name": "Territory", @@ -401,7 +426,10 @@ "write": 0 } ], + "quick_entry": 0, "read_only": 0, "read_only_onload": 0, - "search_fields": "parent_territory,territory_manager" + "search_fields": "parent_territory,territory_manager", + "sort_order": "DESC", + "track_seen": 0 } \ No newline at end of file diff --git a/erpnext/setup/doctype/territory/test_records.json b/erpnext/setup/doctype/territory/test_records.json index 251861942b..6011a38864 100644 --- a/erpnext/setup/doctype/territory/test_records.json +++ b/erpnext/setup/doctype/territory/test_records.json @@ -1,31 +1,31 @@ [ { "doctype": "Territory", - "is_group": "No", + "is_group": 0, "parent_territory": "All Territories", "territory_name": "_Test Territory" }, { "doctype": "Territory", - "is_group": "Yes", + "is_group": 1, "parent_territory": "All Territories", "territory_name": "_Test Territory India" }, { "doctype": "Territory", - "is_group": "No", + "is_group": 0, "parent_territory": "_Test Territory India", "territory_name": "_Test Territory Maharashtra" }, { "doctype": "Territory", - "is_group": "No", + "is_group": 0, "parent_territory": "All Territories", "territory_name": "_Test Territory Rest Of The World" }, { "doctype": "Territory", - "is_group": "No", + "is_group": 0, "parent_territory": "All Territories", "territory_name": "_Test Territory United States" } diff --git a/erpnext/setup/setup_wizard/install_fixtures.py b/erpnext/setup/setup_wizard/install_fixtures.py index 3ea2539ba1..a0e52dd8e1 100644 --- a/erpnext/setup/setup_wizard/install_fixtures.py +++ b/erpnext/setup/setup_wizard/install_fixtures.py @@ -15,17 +15,17 @@ def install(country=None): # item group {'doctype': 'Item Group', 'item_group_name': _('All Item Groups'), - 'is_group': 'Yes', 'parent_item_group': ''}, + 'is_group': 1, 'parent_item_group': ''}, {'doctype': 'Item Group', 'item_group_name': _('Products'), - 'is_group': 'No', 'parent_item_group': _('All Item Groups'), "show_in_website": 1 }, + 'is_group': 0, 'parent_item_group': _('All Item Groups'), "show_in_website": 1 }, {'doctype': 'Item Group', 'item_group_name': _('Raw Material'), - 'is_group': 'No', 'parent_item_group': _('All Item Groups') }, + 'is_group': 0, 'parent_item_group': _('All Item Groups') }, {'doctype': 'Item Group', 'item_group_name': _('Services'), - 'is_group': 'No', 'parent_item_group': _('All Item Groups') }, + 'is_group': 0, 'parent_item_group': _('All Item Groups') }, {'doctype': 'Item Group', 'item_group_name': _('Sub Assemblies'), - 'is_group': 'No', 'parent_item_group': _('All Item Groups') }, + 'is_group': 0, 'parent_item_group': _('All Item Groups') }, {'doctype': 'Item Group', 'item_group_name': _('Consumable'), - 'is_group': 'No', 'parent_item_group': _('All Item Groups') }, + 'is_group': 0, 'parent_item_group': _('All Item Groups') }, # deduction type {'doctype': 'Deduction Type', 'name': _('Income Tax'), 'description': _('Income Tax'), 'deduction_name': _('Income Tax')}, @@ -95,14 +95,14 @@ def install(country=None): {'doctype': 'Designation', 'designation_name': _('Researcher')}, # territory - {'doctype': 'Territory', 'territory_name': _('All Territories'), 'is_group': 'Yes', 'name': _('All Territories'), 'parent_territory': ''}, + {'doctype': 'Territory', 'territory_name': _('All Territories'), 'is_group': 1, 'name': _('All Territories'), 'parent_territory': ''}, # customer group - {'doctype': 'Customer Group', 'customer_group_name': _('All Customer Groups'), 'is_group': 'Yes', 'name': _('All Customer Groups'), 'parent_customer_group': ''}, - {'doctype': 'Customer Group', 'customer_group_name': _('Individual'), 'is_group': 'No', 'parent_customer_group': _('All Customer Groups')}, - {'doctype': 'Customer Group', 'customer_group_name': _('Commercial'), 'is_group': 'No', 'parent_customer_group': _('All Customer Groups')}, - {'doctype': 'Customer Group', 'customer_group_name': _('Non Profit'), 'is_group': 'No', 'parent_customer_group': _('All Customer Groups')}, - {'doctype': 'Customer Group', 'customer_group_name': _('Government'), 'is_group': 'No', 'parent_customer_group': _('All Customer Groups')}, + {'doctype': 'Customer Group', 'customer_group_name': _('All Customer Groups'), 'is_group': 1, 'name': _('All Customer Groups'), 'parent_customer_group': ''}, + {'doctype': 'Customer Group', 'customer_group_name': _('Individual'), 'is_group': 0, 'parent_customer_group': _('All Customer Groups')}, + {'doctype': 'Customer Group', 'customer_group_name': _('Commercial'), 'is_group': 0, 'parent_customer_group': _('All Customer Groups')}, + {'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')}, @@ -114,7 +114,7 @@ def install(country=None): {'doctype': 'Supplier Type', 'supplier_type': _('Distributor')}, # Sales Person - {'doctype': 'Sales Person', 'sales_person_name': _('Sales Team'), 'is_group': "Yes", "parent_sales_person": ""}, + {'doctype': 'Sales Person', 'sales_person_name': _('Sales Team'), 'is_group': 1, "parent_sales_person": ""}, # UOM {'uom_name': _('Unit'), 'doctype': 'UOM', 'name': _('Unit'), "must_be_whole_number": 1}, diff --git a/erpnext/stock/__init__.py b/erpnext/stock/__init__.py index 824786b1c4..eb5c5d937f 100644 --- a/erpnext/stock/__init__.py +++ b/erpnext/stock/__init__.py @@ -4,7 +4,7 @@ install_docs = [ {"doctype":"Role", "role_name":"Item Manager", "name":"Item Manager"}, {"doctype":"Role", "role_name":"Stock User", "name":"Stock User"}, {"doctype":"Role", "role_name":"Quality Manager", "name":"Quality Manager"}, - {"doctype":"Item Group", "item_group_name":"All Item Groups", "is_group":"Yes"}, + {"doctype":"Item Group", "item_group_name":"All Item Groups", "is_group": 1}, {"doctype":"Item Group", "item_group_name":"Default", - "parent_item_group":"All Item Groups", "is_group":"No"}, + "parent_item_group":"All Item Groups", "is_group": 0}, ]