From 6bc7b892c4f340dedf55f661f47b3a4645f87b75 Mon Sep 17 00:00:00 2001
From: Saurabh
Date: Thu, 14 Jul 2016 14:03:19 +0530
Subject: [PATCH 1/9] [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 c251c31133f..83519e61a8d 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 00000000000..eab4401cc85
--- /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 c1f09a51033..7c4bf0f2c70 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 b5234f1f747..5b41ad8b05b 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 654abd90a5c..c199a8e57f1 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 34d13bd5abb..38bb558bf54 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 cc3f87e0988..4c472b886a6 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 d6adebce97c..46d403417d9 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 37d8c81585d..63e9b17f69f 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 60336f0c087..74f464199b9 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 669cabfff8a..cb66b7f9cb2 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 2ee3974a225..2388739b7f8 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 e99d14f6dfc..b42adcab389 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 fd2127d0136..077cf3b4484 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 cd29d40b1ae..75d6cd3797a 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 317278aad81..69f761a6876 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 4ce0fff3485..3f799ee6df8 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 251861942bf..6011a388646 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 3ea2539ba17..a0e52dd8e18 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 824786b1c43..eb5c5d937f6 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},
]
From de8418efe5f349654bfa141649db7503dc46310b Mon Sep 17 00:00:00 2001
From: Rohit Waghchaure
Date: Thu, 14 Jul 2016 14:32:15 +0530
Subject: [PATCH 2/9] [Fix] Timesheet patch
---
erpnext/patches/v7_0/convert_timelog_to_timesheet.py | 3 +--
erpnext/patches/v7_0/rename_time_sheet_doctype.py | 2 +-
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/erpnext/patches/v7_0/convert_timelog_to_timesheet.py b/erpnext/patches/v7_0/convert_timelog_to_timesheet.py
index 3f5cca1da8a..cb16466dae7 100644
--- a/erpnext/patches/v7_0/convert_timelog_to_timesheet.py
+++ b/erpnext/patches/v7_0/convert_timelog_to_timesheet.py
@@ -3,8 +3,7 @@ import frappe
from erpnext.manufacturing.doctype.production_order.production_order import make_timesheet, add_timesheet_detail
def execute():
- if "note" not in frappe.db.get_table_columns("timesheet"):
- frappe.reload_doc('projects', 'doctype', 'timesheet')
+ frappe.reload_doc('projects', 'doctype', 'timesheet')
for data in frappe.get_all('Time Log', fields=["*"],
filters = [["docstatus", "<", "2"]]):
diff --git a/erpnext/patches/v7_0/rename_time_sheet_doctype.py b/erpnext/patches/v7_0/rename_time_sheet_doctype.py
index dc2fadabb6d..a00804518b5 100644
--- a/erpnext/patches/v7_0/rename_time_sheet_doctype.py
+++ b/erpnext/patches/v7_0/rename_time_sheet_doctype.py
@@ -1,7 +1,7 @@
import frappe
def execute():
- if frappe.db.table_exists("Time Sheet"):
+ if frappe.db.table_exists("Time Sheet") and not frappe.db.table_exists("Timesheet"):
frappe.rename_doc("DocType", "Time Sheet", "Timesheet")
frappe.rename_doc("DocType", "Time Sheet Detail", "Timesheet Detail")
From 92d1b8cc6d8a8af98980c0bde729c419f9cccca7 Mon Sep 17 00:00:00 2001
From: Rushabh Mehta
Date: Thu, 14 Jul 2016 15:46:12 +0530
Subject: [PATCH 3/9] [fix] [demo] permissions for accounting
---
erpnext/demo/demo.py | 5 ++---
erpnext/demo/setup_data.py | 2 +-
erpnext/demo/user/accounts.py | 3 +--
erpnext/demo/user/purchase.py | 7 +++++--
erpnext/stock/doctype/delivery_note/delivery_note.js | 9 +++++++++
5 files changed, 18 insertions(+), 8 deletions(-)
diff --git a/erpnext/demo/demo.py b/erpnext/demo/demo.py
index 9b9d89836a6..6642e7b5ebd 100644
--- a/erpnext/demo/demo.py
+++ b/erpnext/demo/demo.py
@@ -4,7 +4,7 @@ import frappe, sys
import erpnext
import frappe.utils
from erpnext.demo.setup_data import setup_data
-from erpnext.demo.user import hr, sales, purchase, manufacturing, stock
+from erpnext.demo.user import hr, sales, purchase, manufacturing, stock, accounts
"""
Make a demo
@@ -68,8 +68,7 @@ def simulate():
purchase.work()
manufacturing.work()
stock.work()
- # run_stock()
- # run_accounts()
+ accounts.work()
# run_projects()
# run_messages()
diff --git a/erpnext/demo/setup_data.py b/erpnext/demo/setup_data.py
index 1033f7deec8..6f1fb0a7de9 100644
--- a/erpnext/demo/setup_data.py
+++ b/erpnext/demo/setup_data.py
@@ -330,6 +330,6 @@ def setup_user_roles():
if not frappe.db.get_global('demo_accounts_user'):
user = frappe.get_doc('User', 'LeonAbdulov@example.com')
- user.add_roles('Accounts User', 'Accounts Manager')
+ user.add_roles('Accounts User', 'Accounts Manager', 'Sales User', 'Purchase User')
frappe.db.set_global('demo_accounts_user', user.name)
diff --git a/erpnext/demo/user/accounts.py b/erpnext/demo/user/accounts.py
index 4a514ef54e9..d3df6278c0b 100644
--- a/erpnext/demo/user/accounts.py
+++ b/erpnext/demo/user/accounts.py
@@ -15,8 +15,7 @@ def work():
if random.random() < 0.5:
from erpnext.selling.doctype.sales_order.sales_order import make_sales_invoice
report = "Ordered Items to be Billed"
- for so in list(set([r[0] for r in
- query_report.run(report)["result"]
+ for so in list(set([r[0] for r in query_report.run(report)["result"]
if r[0]!="Total"]))[:random.randint(1, 5)]:
si = frappe.get_doc(make_sales_invoice(so))
si.posting_date = frappe.flags.current_date
diff --git a/erpnext/demo/user/purchase.py b/erpnext/demo/user/purchase.py
index ff40e748c41..6f06f26fb11 100644
--- a/erpnext/demo/user/purchase.py
+++ b/erpnext/demo/user/purchase.py
@@ -131,10 +131,13 @@ def make_subcontract():
po.is_subcontracted = "Yes"
po.supplier = get_random("Supplier")
+ item_code = get_random("Item", {"is_sub_contracted_item": 1})
+ moq = frappe.db.get_value('Item', item_code, 'min_order_qty')
+
po.append("items", {
- "item_code": get_random("Item", {"is_sub_contracted_item": 1}),
+ "item_code": item_code,
"schedule_date": frappe.utils.add_days(frappe.flags.current_date, 7),
- "qty": 20
+ "qty": moq
})
po.set_missing_values()
try:
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.js b/erpnext/stock/doctype/delivery_note/delivery_note.js
index c5fce7d7602..ab8297c3e3c 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.js
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.js
@@ -5,6 +5,15 @@
frappe.provide("erpnext.stock");
frappe.provide("erpnext.stock.delivery_note");
+
+frappe.ui.form.on('Delivery Note', 'onload', function(frm) {
+ frm.set_indicator_formatter('item_code',
+ function(doc) {
+ return (doc.docstatus==1 || doc.qty<=doc.actual_qty) ? "green" : "orange"
+ })
+
+})
+
erpnext.stock.DeliveryNoteController = erpnext.selling.SellingController.extend({
refresh: function(doc, dt, dn) {
this._super();
From 528e145a546483fe774cd7a7a0b8f7d620a8e4a0 Mon Sep 17 00:00:00 2001
From: Rushabh Mehta
Date: Thu, 14 Jul 2016 16:59:58 +0530
Subject: [PATCH 4/9] [docs] fixes #5697
---
.../profit_and_loss_statement/profit_and_loss_statement.js | 3 ++-
erpnext/docs/license.html | 2 +-
.../docs/user/manual/de/Beispiel/{Beispiel.md => index.md} | 0
erpnext/stock/page/stock_balance/stock_balance.json | 4 ++--
erpnext/stock/report/stock_balance/stock_balance.py | 5 ++---
5 files changed, 7 insertions(+), 7 deletions(-)
rename erpnext/docs/user/manual/de/Beispiel/{Beispiel.md => index.md} (100%)
diff --git a/erpnext/accounts/report/profit_and_loss_statement/profit_and_loss_statement.js b/erpnext/accounts/report/profit_and_loss_statement/profit_and_loss_statement.js
index 91ec9d93ca1..0f7a6b6ef34 100644
--- a/erpnext/accounts/report/profit_and_loss_statement/profit_and_loss_statement.js
+++ b/erpnext/accounts/report/profit_and_loss_statement/profit_and_loss_statement.js
@@ -2,7 +2,8 @@
// License: GNU General Public License v3. See license.txt
frappe.require("assets/erpnext/js/financial_statements.js", function() {
- frappe.query_reports["Profit and Loss Statement"] = $.extend({}, erpnext.financial_statements);
+ frappe.query_reports["Profit and Loss Statement"] = $.extend({},
+ erpnext.financial_statements);
frappe.query_reports["Profit and Loss Statement"]["filters"].push({
"fieldname": "accumulated_values",
diff --git a/erpnext/docs/license.html b/erpnext/docs/license.html
index b0310f64f2e..6aa4e645b37 100644
--- a/erpnext/docs/license.html
+++ b/erpnext/docs/license.html
@@ -13,7 +13,7 @@ ERPNext is a trademark of Frappe Technologies
Version 3, 29 June 2007
-http://www.gnu.org/copyleft/gpl.html
+http://www.gnu.org/copyleft/gpl.html
TERMS AND CONDITIONS
0. Definitions.
diff --git a/erpnext/docs/user/manual/de/Beispiel/Beispiel.md b/erpnext/docs/user/manual/de/Beispiel/index.md
similarity index 100%
rename from erpnext/docs/user/manual/de/Beispiel/Beispiel.md
rename to erpnext/docs/user/manual/de/Beispiel/index.md
diff --git a/erpnext/stock/page/stock_balance/stock_balance.json b/erpnext/stock/page/stock_balance/stock_balance.json
index d908875edb9..05039daa59a 100644
--- a/erpnext/stock/page/stock_balance/stock_balance.json
+++ b/erpnext/stock/page/stock_balance/stock_balance.json
@@ -4,7 +4,7 @@
"docstatus": 0,
"doctype": "Page",
"idx": 0,
- "modified": "2016-04-21 05:04:30.228526",
+ "modified": "2016-07-14 06:39:09.096256",
"modified_by": "Administrator",
"module": "Stock",
"name": "stock-balance",
@@ -18,5 +18,5 @@
"script": null,
"standard": "Yes",
"style": null,
- "title": "Stock Balance"
+ "title": "Stock Summary"
}
\ No newline at end of file
diff --git a/erpnext/stock/report/stock_balance/stock_balance.py b/erpnext/stock/report/stock_balance/stock_balance.py
index 696f2b0059f..2777d3d216b 100644
--- a/erpnext/stock/report/stock_balance/stock_balance.py
+++ b/erpnext/stock/report/stock_balance/stock_balance.py
@@ -8,7 +8,7 @@ from frappe.utils import flt, getdate
def execute(filters=None):
if not filters: filters = {}
-
+
validate_filters(filters)
columns = get_columns()
@@ -83,7 +83,7 @@ def get_stock_ledger_entries(filters):
company, voucher_type, qty_after_transaction, stock_value_difference
from `tabStock Ledger Entry` sle force index (posting_sort_index)
where docstatus < 2 %s order by posting_date, posting_time, name""" %
- conditions, as_dict=1, debug=1)
+ conditions, as_dict=1)
def get_item_warehouse_map(filters):
iwb_map = {}
@@ -147,4 +147,3 @@ def validate_filters(filters):
sle_count = flt(frappe.db.sql("""select count(name) from `tabStock Ledger Entry`""")[0][0])
if sle_count > 500000:
frappe.throw(_("Please set filter based on Item or Warehouse"))
-
\ No newline at end of file
From 176b63b3540b714a5bcc349998a4abe7db663861 Mon Sep 17 00:00:00 2001
From: Rushabh Mehta
Date: Thu, 14 Jul 2016 17:43:48 +0530
Subject: [PATCH 5/9] [fix] remove first row on mapping, fixes #5707
---
.../purchase_invoice/purchase_invoice.js | 4 +-
.../doctype/sales_invoice/sales_invoice.js | 4 +-
.../bank_clearance_summary.py | 34 +++++------
.../doctype/purchase_order/purchase_order.js | 6 +-
.../request_for_quotation.js | 2 +-
.../supplier_quotation/supplier_quotation.js | 2 +-
.../crm/doctype/opportunity/opportunity.js | 2 +-
erpnext/hr/doctype/appraisal/appraisal.js | 2 +-
.../maintenance_schedule.js | 2 +-
.../maintenance_visit/maintenance_visit.js | 6 +-
.../v7_0/make_is_group_fieldtype_as_check.py | 4 +-
erpnext/public/js/utils.js | 59 +++++++++++++++++++
.../installation_note/installation_note.js | 2 +-
.../selling/doctype/quotation/quotation.js | 2 +-
.../doctype/sales_order/sales_order.js | 2 +-
.../doctype/delivery_note/delivery_note.js | 2 +-
.../material_request/material_request.js | 2 +-
.../purchase_receipt/purchase_receipt.js | 2 +-
18 files changed, 99 insertions(+), 40 deletions(-)
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
index 444c3b51e6b..c655626b86e 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
@@ -47,7 +47,7 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({
if(doc.docstatus===0) {
cur_frm.add_custom_button(__('Purchase Order'), function() {
- frappe.model.map_current_doc({
+ erpnext.utils.map_current_doc({
method: "erpnext.buying.doctype.purchase_order.purchase_order.make_purchase_invoice",
source_doctype: "Purchase Order",
get_query_filters: {
@@ -61,7 +61,7 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({
}, __("Get items from"));
cur_frm.add_custom_button(__('Purchase Receipt'), function() {
- frappe.model.map_current_doc({
+ erpnext.utils.map_current_doc({
method: "erpnext.stock.doctype.purchase_receipt.purchase_receipt.make_purchase_invoice",
source_doctype: "Purchase Receipt",
get_query_filters: {
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
index 1d48df02115..64379a16e90 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
@@ -101,7 +101,7 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
sales_order_btn: function() {
this.$sales_order_btn = cur_frm.add_custom_button(__('Sales Order'),
function() {
- frappe.model.map_current_doc({
+ erpnext.utils.map_current_doc({
method: "erpnext.selling.doctype.sales_order.sales_order.make_sales_invoice",
source_doctype: "Sales Order",
get_query_filters: {
@@ -118,7 +118,7 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
delivery_note_btn: function() {
this.$delivery_note_btn = cur_frm.add_custom_button(__('Delivery Note'),
function() {
- frappe.model.map_current_doc({
+ erpnext.utils.map_current_doc({
method: "erpnext.stock.doctype.delivery_note.delivery_note.make_sales_invoice",
source_doctype: "Delivery Note",
get_query: function() {
diff --git a/erpnext/accounts/report/bank_clearance_summary/bank_clearance_summary.py b/erpnext/accounts/report/bank_clearance_summary/bank_clearance_summary.py
index 07ab969b84a..d9bac3cb5b2 100644
--- a/erpnext/accounts/report/bank_clearance_summary/bank_clearance_summary.py
+++ b/erpnext/accounts/report/bank_clearance_summary/bank_clearance_summary.py
@@ -8,43 +8,43 @@ from frappe.utils import nowdate, getdate
def execute(filters=None):
if not filters: filters = {}
-
+
columns = get_columns()
data = get_entries(filters)
-
+
return columns, data
-
+
def get_columns():
return [
- _("Payment Document") + ":Link/DocType:130",
- _("Payment Entry") + ":Dynamic Link/"+_("Payment Document")+":110",
- _("Posting Date") + ":Date:100",
+ _("Payment Document") + ":Link/DocType:130",
+ _("Payment Entry") + ":Dynamic Link/"+_("Payment Document")+":110",
+ _("Posting Date") + ":Date:100",
_("Cheque/Reference No") + "::120",
- _("Clearance Date") + ":Date:100",
- _("Against Account") + ":Link/Account:170",
+ _("Clearance Date") + ":Date:100",
+ _("Against Account") + ":Link/Account:170",
_("Amount") + ":Currency:120"
]
def get_conditions(filters):
conditions = ""
-
+
if filters.get("from_date"): conditions += " and posting_date>=%(from_date)s"
if filters.get("to_date"): conditions += " and posting_date<=%(to_date)s"
-
+
return conditions
-
+
def get_entries(filters):
conditions = get_conditions(filters)
- journal_entries = frappe.db.sql("""select "Journal Entry", jv.name, jv.posting_date,
+ journal_entries = frappe.db.sql("""select "Journal Entry", jv.name, jv.posting_date,
jv.cheque_no, jv.clearance_date, jvd.against_account, (jvd.debit - jvd.credit)
- from `tabJournal Entry Account` jvd, `tabJournal Entry` jv
+ from `tabJournal Entry Account` jvd, `tabJournal Entry` jv
where jvd.parent = jv.name and jv.docstatus=1 and jvd.account = %(account)s {0}
order by posting_date DESC, jv.name DESC""".format(conditions), filters, as_list=1)
-
- payment_entries = frappe.db.sql("""select "Payment Entry", name, posting_date,
+
+ payment_entries = frappe.db.sql("""select "Payment Entry", name, posting_date,
reference_no, clearance_date, party, if(paid_from=%(account)s, paid_amount, received_amount)
from `tabPayment Entry`
where docstatus=1 and (paid_from = %(account)s or paid_to = %(account)s) {0}
- order by posting_date DESC, name DESC""".format(conditions), filters, as_list=1, debug=1)
-
+ order by posting_date DESC, name DESC""".format(conditions), filters, as_list=1)
+
return sorted(journal_entries + payment_entries, key=lambda k: k[2] or getdate(nowdate()))
\ No newline at end of file
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.js b/erpnext/buying/doctype/purchase_order/purchase_order.js
index 9624967a2b7..15356fd471b 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.js
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.js
@@ -87,7 +87,7 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend(
},
get_items_from_open_material_requests: function() {
- frappe.model.map_current_doc({
+ erpnext.utils.map_current_doc({
method: "erpnext.stock.doctype.material_request.material_request.make_purchase_order_based_on_supplier",
source_name: this.frm.doc.supplier,
get_query_filters: {
@@ -150,7 +150,7 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend(
add_from_mappers: function() {
cur_frm.add_custom_button(__('Material Request'),
function() {
- frappe.model.map_current_doc({
+ erpnext.utils.map_current_doc({
method: "erpnext.stock.doctype.material_request.material_request.make_purchase_order",
source_doctype: "Material Request",
get_query_filters: {
@@ -165,7 +165,7 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend(
cur_frm.add_custom_button(__('Supplier Quotation'),
function() {
- frappe.model.map_current_doc({
+ erpnext.utils.map_current_doc({
method: "erpnext.buying.doctype.supplier_quotation.supplier_quotation.make_purchase_order",
source_doctype: "Supplier Quotation",
get_query_filters: {
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 9a814675529..ce1c088263d 100644
--- a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.js
+++ b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.js
@@ -135,7 +135,7 @@ erpnext.buying.RequestforQuotationController = erpnext.buying.BuyingController.e
if (this.frm.doc.docstatus===0) {
cur_frm.add_custom_button(__('Material Request'),
function() {
- frappe.model.map_current_doc({
+ erpnext.utils.map_current_doc({
method: "erpnext.stock.doctype.material_request.material_request.make_request_for_quotation",
source_doctype: "Material Request",
get_query_filters: {
diff --git a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js
index b3030f77455..1859cf5005a 100644
--- a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js
+++ b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js
@@ -15,7 +15,7 @@ erpnext.buying.SupplierQuotationController = erpnext.buying.BuyingController.ext
else if (this.frm.doc.docstatus===0) {
cur_frm.add_custom_button(__('Material Request'),
function() {
- frappe.model.map_current_doc({
+ erpnext.utils.map_current_doc({
method: "erpnext.stock.doctype.material_request.material_request.make_supplier_quotation",
source_doctype: "Material Request",
get_query_filters: {
diff --git a/erpnext/crm/doctype/opportunity/opportunity.js b/erpnext/crm/doctype/opportunity/opportunity.js
index 9144692b887..21a7429be2d 100644
--- a/erpnext/crm/doctype/opportunity/opportunity.js
+++ b/erpnext/crm/doctype/opportunity/opportunity.js
@@ -128,7 +128,7 @@ cur_frm.cscript.item_code = function(doc, cdt, cdn) {
cur_frm.cscript.lead = function(doc, cdt, cdn) {
cur_frm.toggle_display("contact_info", doc.customer || doc.lead);
- frappe.model.map_current_doc({
+ erpnext.utils.map_current_doc({
method: "erpnext.crm.doctype.lead.lead.make_opportunity",
source_name: cur_frm.doc.lead,
frm: cur_frm
diff --git a/erpnext/hr/doctype/appraisal/appraisal.js b/erpnext/hr/doctype/appraisal/appraisal.js
index 4cfcd7eb687..728e5c2f2c0 100644
--- a/erpnext/hr/doctype/appraisal/appraisal.js
+++ b/erpnext/hr/doctype/appraisal/appraisal.js
@@ -24,7 +24,7 @@ cur_frm.cscript.refresh = function(doc,cdt,cdn){
}
cur_frm.cscript.kra_template = function(doc, dt, dn) {
- frappe.model.map_current_doc({
+ erpnext.utils.map_current_doc({
method: "erpnext.hr.doctype.appraisal.appraisal.fetch_appraisal_template",
source_name: cur_frm.doc.kra_template,
frm: cur_frm
diff --git a/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.js b/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.js
index cf0ee510b30..bcf1ae6932d 100644
--- a/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.js
+++ b/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.js
@@ -20,7 +20,7 @@ erpnext.maintenance.MaintenanceSchedule = frappe.ui.form.Controller.extend({
if (this.frm.doc.docstatus === 0) {
this.frm.add_custom_button(__('Sales Order'),
function() {
- frappe.model.map_current_doc({
+ erpnext.utils.map_current_doc({
method: "erpnext.selling.doctype.sales_order.sales_order.make_maintenance_schedule",
source_doctype: "Sales Order",
get_query_filters: {
diff --git a/erpnext/maintenance/doctype/maintenance_visit/maintenance_visit.js b/erpnext/maintenance/doctype/maintenance_visit/maintenance_visit.js
index 561588651d5..38c20dadd45 100644
--- a/erpnext/maintenance/doctype/maintenance_visit/maintenance_visit.js
+++ b/erpnext/maintenance/doctype/maintenance_visit/maintenance_visit.js
@@ -19,7 +19,7 @@ erpnext.maintenance.MaintenanceVisit = frappe.ui.form.Controller.extend({
if (this.frm.doc.docstatus===0) {
cur_frm.add_custom_button(__('Maintenance Schedule'),
function() {
- frappe.model.map_current_doc({
+ erpnext.utils.map_current_doc({
method: "erpnext.maintenance.doctype.maintenance_schedule.maintenance_schedule.make_maintenance_visit",
source_doctype: "Maintenance Schedule",
get_query_filters: {
@@ -31,7 +31,7 @@ erpnext.maintenance.MaintenanceVisit = frappe.ui.form.Controller.extend({
}, __("Get items from"));
cur_frm.add_custom_button(__('Warranty Claim'),
function() {
- frappe.model.map_current_doc({
+ erpnext.utils.map_current_doc({
method: "erpnext.support.doctype.warranty_claim.warranty_claim.make_maintenance_visit",
source_doctype: "Warranty Claim",
get_query_filters: {
@@ -43,7 +43,7 @@ erpnext.maintenance.MaintenanceVisit = frappe.ui.form.Controller.extend({
}, __("Get items from"));
cur_frm.add_custom_button(__('Sales Order'),
function() {
- frappe.model.map_current_doc({
+ erpnext.utils.map_current_doc({
method: "erpnext.selling.doctype.sales_order.sales_order.make_maintenance_visit",
source_doctype: "Sales Order",
get_query_filters: {
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
index eab4401cc85..aef0306b563 100644
--- a/erpnext/patches/v7_0/make_is_group_fieldtype_as_check.py
+++ b/erpnext/patches/v7_0/make_is_group_fieldtype_as_check.py
@@ -8,6 +8,6 @@ def execute():
#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 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)
+ """.format(doctype=doctype, field=doctype.strip().lower().replace(' ','_')))
diff --git a/erpnext/public/js/utils.js b/erpnext/public/js/utils.js
index ea28fd5fa86..d3472279fba 100644
--- a/erpnext/public/js/utils.js
+++ b/erpnext/public/js/utils.js
@@ -120,6 +120,65 @@ $.extend(erpnext.utils, {
}
});
+erpnext.utils.map_current_doc = function(opts) {
+ if(opts.get_query_filters) {
+ opts.get_query = function() {
+ return {filters: opts.get_query_filters};
+ }
+ }
+ var _map = function() {
+ // remove first item row if empty
+ if($.isArray(cur_frm.doc.items)) {
+ if(!cur_frm.doc.items[0].item_code) {
+ cur_frm.doc.items = cur_frm.doc.items.splice(1);
+ }
+ }
+
+ return frappe.call({
+ // Sometimes we hit the limit for URL length of a GET request
+ // as we send the full target_doc. Hence this is a POST request.
+ type: "POST",
+ method: opts.method,
+ args: {
+ "source_name": opts.source_name,
+ "target_doc": cur_frm.doc
+ },
+ callback: function(r) {
+ if(!r.exc) {
+ var doc = frappe.model.sync(r.message);
+ cur_frm.refresh();
+ }
+ }
+ });
+ }
+ if(opts.source_doctype) {
+ var d = new frappe.ui.Dialog({
+ title: __("Get From ") + __(opts.source_doctype),
+ fields: [
+ {
+ fieldtype: "Link",
+ label: __(opts.source_doctype),
+ fieldname: opts.source_doctype,
+ options: opts.source_doctype,
+ get_query: opts.get_query,
+ reqd:1
+ },
+ ]
+ });
+ d.set_primary_action(__('Get Items'), function() {
+ var values = d.get_values();
+ if(!values)
+ return;
+ opts.source_name = values[opts.source_doctype];
+ d.hide();
+ _map();
+ })
+ d.show();
+ } else if(opts.source_name) {
+ _map();
+ }
+}
+
// add description on posting time
$(document).on('app_ready', function() {
if(!frappe.datetime.is_timezone_same()) {
diff --git a/erpnext/selling/doctype/installation_note/installation_note.js b/erpnext/selling/doctype/installation_note/installation_note.js
index 09deea2e2dc..5b996911128 100644
--- a/erpnext/selling/doctype/installation_note/installation_note.js
+++ b/erpnext/selling/doctype/installation_note/installation_note.js
@@ -49,7 +49,7 @@ erpnext.selling.InstallationNote = frappe.ui.form.Controller.extend({
if (this.frm.doc.docstatus===0) {
cur_frm.add_custom_button(__('From Delivery Note'),
function() {
- frappe.model.map_current_doc({
+ erpnext.utils.map_current_doc({
method: "erpnext.stock.doctype.delivery_note.delivery_note.make_installation_note",
source_doctype: "Delivery Note",
get_query_filters: {
diff --git a/erpnext/selling/doctype/quotation/quotation.js b/erpnext/selling/doctype/quotation/quotation.js
index f61f0e9849e..d111c147342 100644
--- a/erpnext/selling/doctype/quotation/quotation.js
+++ b/erpnext/selling/doctype/quotation/quotation.js
@@ -29,7 +29,7 @@ erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({
if (this.frm.doc.docstatus===0) {
cur_frm.add_custom_button(__('Opportunity'),
function() {
- frappe.model.map_current_doc({
+ erpnext.utils.map_current_doc({
method: "erpnext.crm.doctype.opportunity.opportunity.make_quotation",
source_doctype: "Opportunity",
get_query_filters: {
diff --git a/erpnext/selling/doctype/sales_order/sales_order.js b/erpnext/selling/doctype/sales_order/sales_order.js
index d8ed59189fc..f1eeccc7508 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.js
+++ b/erpnext/selling/doctype/sales_order/sales_order.js
@@ -97,7 +97,7 @@ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend(
if (this.frm.doc.docstatus===0) {
cur_frm.add_custom_button(__('Quotation'),
function() {
- frappe.model.map_current_doc({
+ erpnext.utils.map_current_doc({
method: "erpnext.selling.doctype.quotation.quotation.make_sales_order",
source_doctype: "Quotation",
get_query_filters: {
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.js b/erpnext/stock/doctype/delivery_note/delivery_note.js
index ab8297c3e3c..65658d6421b 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.js
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.js
@@ -37,7 +37,7 @@ erpnext.stock.DeliveryNoteController = erpnext.selling.SellingController.extend(
if (this.frm.doc.docstatus===0) {
cur_frm.add_custom_button(__('Sales Order'),
function() {
- frappe.model.map_current_doc({
+ erpnext.utils.map_current_doc({
method: "erpnext.selling.doctype.sales_order.sales_order.make_delivery_note",
source_doctype: "Sales Order",
get_query_filters: {
diff --git a/erpnext/stock/doctype/material_request/material_request.js b/erpnext/stock/doctype/material_request/material_request.js
index 0a075821055..bbd312d72a2 100644
--- a/erpnext/stock/doctype/material_request/material_request.js
+++ b/erpnext/stock/doctype/material_request/material_request.js
@@ -87,7 +87,7 @@ erpnext.buying.MaterialRequestController = erpnext.buying.BuyingController.exten
if (this.frm.doc.docstatus===0) {
cur_frm.add_custom_button(__('Sales Order'),
function() {
- frappe.model.map_current_doc({
+ erpnext.utils.map_current_doc({
method: "erpnext.selling.doctype.sales_order.sales_order.make_material_request",
source_doctype: "Sales Order",
get_query_filters: {
diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js
index f622b635682..792f269bcf5 100644
--- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js
+++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js
@@ -52,7 +52,7 @@ erpnext.stock.PurchaseReceiptController = erpnext.buying.BuyingController.extend
if(this.frm.doc.docstatus==0) {
cur_frm.add_custom_button(__('Purchase Order'),
function() {
- frappe.model.map_current_doc({
+ erpnext.utils.map_current_doc({
method: "erpnext.buying.doctype.purchase_order.purchase_order.make_purchase_receipt",
source_doctype: "Purchase Order",
get_query_filters: {
From c63f2e2993b0c32d7bc2de617dfb147c0f6a2d89 Mon Sep 17 00:00:00 2001
From: Saurabh
Date: Thu, 14 Jul 2016 18:23:22 +0530
Subject: [PATCH 6/9] [fix] patch fix
---
.../v7_0/make_is_group_fieldtype_as_check.py | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
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
index aef0306b563..ba82e869fa1 100644
--- a/erpnext/patches/v7_0/make_is_group_fieldtype_as_check.py
+++ b/erpnext/patches/v7_0/make_is_group_fieldtype_as_check.py
@@ -1,13 +1,18 @@
+from __future__ import unicode_literals
import frappe
def execute():
for doctype in ["Sales Person", "Customer Group", "Item Group", "Territory"]:
+
+ # convert to 1 or 0
+ frappe.db.sql("update `tab{doctype}` set is_group = if(is_group='Yes',1,0) "
+ .format(doctype=doctype))
+
+ frappe.db.commit()
+
+ # alter fields to int
+
+ frappe.db.sql("alter table `tab{doctype}` change is_group is_group int(1) default '0'"
+ .format(doctype=doctype))
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(' ','_')))
From 3bc6a958c70ac64733507fb704ffb332f6a2eb21 Mon Sep 17 00:00:00 2001
From: Rohit Waghchaure
Date: Wed, 13 Jul 2016 16:04:38 +0530
Subject: [PATCH 7/9] [Fix] Timesheet overlap issue
---
.../salary_structure/salary_structure.js | 4 +-
.../salary_structure/salary_structure.json | 57 +++++++--------
erpnext/patches.txt | 3 +-
.../doctype/timesheet/test_timesheet.py | 12 ++--
.../projects/doctype/timesheet/timesheet.js | 1 +
.../projects/doctype/timesheet/timesheet.json | 69 +++++++++++++++++--
.../projects/doctype/timesheet/timesheet.py | 27 ++++----
7 files changed, 121 insertions(+), 52 deletions(-)
diff --git a/erpnext/hr/doctype/salary_structure/salary_structure.js b/erpnext/hr/doctype/salary_structure/salary_structure.js
index 10b7544c42e..fab7ac4c501 100755
--- a/erpnext/hr/doctype/salary_structure/salary_structure.js
+++ b/erpnext/hr/doctype/salary_structure/salary_structure.js
@@ -32,8 +32,8 @@ frappe.ui.form.on('Salary Structure', {
},
toggle_fields: function(frm) {
- frm.toggle_display('time_sheet_earning_detail', frm.doc.salary_slip_based_on_timesheet);
- frm.toggle_reqd('salary_component', frm.doc.salary_slip_based_on_timesheet);
+ frm.toggle_display(['salary_component', 'hour_rate'], frm.doc.salary_slip_based_on_timesheet);
+ frm.toggle_reqd(['salary_component', 'hour_rate'], frm.doc.salary_slip_based_on_timesheet);
}
})
diff --git a/erpnext/hr/doctype/salary_structure/salary_structure.json b/erpnext/hr/doctype/salary_structure/salary_structure.json
index 08b035517bf..4cdc67b7f0e 100644
--- a/erpnext/hr/doctype/salary_structure/salary_structure.json
+++ b/erpnext/hr/doctype/salary_structure/salary_structure.json
@@ -8,6 +8,7 @@
"docstatus": 0,
"doctype": "DocType",
"document_type": "Document",
+ "editable_grid": 0,
"fields": [
{
"allow_on_submit": 0,
@@ -349,6 +350,31 @@
"set_only_once": 0,
"unique": 0
},
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "fieldname": "time_sheet_earning_detail",
+ "fieldtype": "Section Break",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "label": "",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
+ },
{
"allow_on_submit": 0,
"bold": 0,
@@ -379,14 +405,13 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
- "fieldname": "time_sheet_earning_detail",
- "fieldtype": "Section Break",
+ "fieldname": "column_break_17",
+ "fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
- "label": "",
"length": 0,
"no_copy": 0,
"permlevel": 0,
@@ -428,30 +453,6 @@
"set_only_once": 0,
"unique": 0
},
- {
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "fieldname": "column_break_17",
- "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,
- "precision": "",
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "read_only": 0,
- "report_hide": 0,
- "reqd": 0,
- "search_index": 0,
- "set_only_once": 0,
- "unique": 0
- },
{
"allow_on_submit": 0,
"bold": 0,
@@ -779,7 +780,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
- "modified": "2016-07-02 18:04:06.529332",
+ "modified": "2016-07-13 23:56:01.550518",
"modified_by": "Administrator",
"module": "HR",
"name": "Salary Structure",
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index 83519e61a8d..979c1a55b5d 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -291,4 +291,5 @@ 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")
-erpnext.patches.v7_0.make_is_group_fieldtype_as_check
\ No newline at end of file
+erpnext.patches.v7_0.make_is_group_fieldtype_as_check
+execute:frappe.reload_doc('projects', 'doctype', 'timesheet', force=True)
diff --git a/erpnext/projects/doctype/timesheet/test_timesheet.py b/erpnext/projects/doctype/timesheet/test_timesheet.py
index 281414b0ed0..300933aac66 100644
--- a/erpnext/projects/doctype/timesheet/test_timesheet.py
+++ b/erpnext/projects/doctype/timesheet/test_timesheet.py
@@ -86,28 +86,30 @@ def make_salary_structure(employee):
return salary_structure
-def make_timesheet(employee, simulate=False, billable = 0):
- update_activity_type("_Test Activity Type")
+def make_timesheet(employee, simulate=False, billable = 0, activity_type="_Test Activity Type", project=None, task=None):
+ update_activity_type(activity_type)
timesheet = frappe.new_doc("Timesheet")
timesheet.employee = employee
timesheet_detail = timesheet.append('time_logs', {})
timesheet_detail.billable = billable
- timesheet_detail.activity_type = "_Test Activity Type"
+ timesheet_detail.activity_type = activity_type
timesheet_detail.from_time = now_datetime()
timesheet_detail.hours = 2
timesheet_detail.to_time = timesheet_detail.from_time + datetime.timedelta(hours= timesheet_detail.hours)
+ timesheet_detail.project = project
+ timesheet_detail.task = task
for data in timesheet.get('time_logs'):
if simulate:
while True:
try:
- timesheet.save()
+ timesheet.save(ignore_permissions=True)
break
except OverlapError:
data.from_time = data.from_time + datetime.timedelta(minutes=10)
data.to_time = data.from_time + datetime.timedelta(hours= data.hours)
else:
- timesheet.save()
+ timesheet.save(ignore_permissions=True)
timesheet.submit()
diff --git a/erpnext/projects/doctype/timesheet/timesheet.js b/erpnext/projects/doctype/timesheet/timesheet.js
index dfd7abef290..4d162959790 100644
--- a/erpnext/projects/doctype/timesheet/timesheet.js
+++ b/erpnext/projects/doctype/timesheet/timesheet.js
@@ -1,5 +1,6 @@
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt
+cur_frm.add_fetch('employee', 'employee_name', 'employee_name');
frappe.ui.form.on("Timesheet", {
setup: function(frm) {
diff --git a/erpnext/projects/doctype/timesheet/timesheet.json b/erpnext/projects/doctype/timesheet/timesheet.json
index ac6093ee082..a15522b880f 100644
--- a/erpnext/projects/doctype/timesheet/timesheet.json
+++ b/erpnext/projects/doctype/timesheet/timesheet.json
@@ -225,8 +225,9 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "depends_on": "employee",
"fieldname": "employee_name",
- "fieldtype": "Read Only",
+ "fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
@@ -235,12 +236,12 @@
"label": "Employee Name",
"length": 0,
"no_copy": 0,
- "options": "employee.employee_name",
+ "options": "",
"permlevel": 0,
"precision": "",
"print_hide": 1,
"print_hide_if_no_value": 0,
- "read_only": 0,
+ "read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@@ -636,7 +637,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
- "modified": "2016-07-13 01:18:57.918882",
+ "modified": "2016-07-13 23:44:05.086570",
"modified_by": "Administrator",
"module": "Projects",
"name": "Timesheet",
@@ -661,6 +662,66 @@
"share": 1,
"submit": 1,
"write": 1
+ },
+ {
+ "amend": 1,
+ "apply_user_permissions": 0,
+ "cancel": 1,
+ "create": 1,
+ "delete": 1,
+ "email": 1,
+ "export": 1,
+ "if_owner": 0,
+ "import": 0,
+ "permlevel": 0,
+ "print": 1,
+ "read": 1,
+ "report": 1,
+ "role": "HR User",
+ "set_user_permissions": 0,
+ "share": 1,
+ "submit": 1,
+ "write": 1
+ },
+ {
+ "amend": 1,
+ "apply_user_permissions": 0,
+ "cancel": 1,
+ "create": 1,
+ "delete": 1,
+ "email": 1,
+ "export": 1,
+ "if_owner": 0,
+ "import": 0,
+ "permlevel": 0,
+ "print": 1,
+ "read": 1,
+ "report": 1,
+ "role": "Manufacturing User",
+ "set_user_permissions": 0,
+ "share": 1,
+ "submit": 1,
+ "write": 1
+ },
+ {
+ "amend": 0,
+ "apply_user_permissions": 0,
+ "cancel": 0,
+ "create": 1,
+ "delete": 0,
+ "email": 0,
+ "export": 0,
+ "if_owner": 0,
+ "import": 0,
+ "permlevel": 0,
+ "print": 0,
+ "read": 1,
+ "report": 0,
+ "role": "Employee",
+ "set_user_permissions": 0,
+ "share": 0,
+ "submit": 0,
+ "write": 1
}
],
"quick_entry": 0,
diff --git a/erpnext/projects/doctype/timesheet/timesheet.py b/erpnext/projects/doctype/timesheet/timesheet.py
index 24a379671be..686f7c2f784 100644
--- a/erpnext/projects/doctype/timesheet/timesheet.py
+++ b/erpnext/projects/doctype/timesheet/timesheet.py
@@ -141,31 +141,34 @@ class Timesheet(Document):
def validate_overlap(self, data):
if self.production_order:
- self.validate_overlap_for("workstation", data)
+ self.validate_overlap_for("workstation", data, data.workstation)
else:
- self.validate_overlap_for("user", data)
- self.validate_overlap_for("employee", data)
+ self.validate_overlap_for("user", data, self.user)
+ self.validate_overlap_for("employee", data, self.employee)
- def validate_overlap_for(self, fieldname, args):
- existing = self.get_overlap_for(fieldname, args)
+ def validate_overlap_for(self, fieldname, args, value):
+ if not value: return
+
+ existing = self.get_overlap_for(fieldname, args, value)
if existing:
frappe.throw(_("Row {0}: From Time and To Time overlap with existing from and to time").format(args.idx),
OverlapError)
- def get_overlap_for(self, fieldname, args):
- if not args.get(fieldname):
- return
+ def get_overlap_for(self, fieldname, args, value):
+ cond = "ts.`{0}`".format(fieldname)
+ if fieldname == 'workstation':
+ cond = "tsd.`{0}`".format(fieldname)
existing = frappe.db.sql("""select ts.name as name, tsd.from_time as from_time, tsd.to_time as to_time from
- `tabTimesheet Detail` tsd, `tabTimesheet` ts where tsd.`{0}`=%(val)s and tsd.parent = ts.name and
+ `tabTimesheet Detail` tsd, `tabTimesheet` ts where {0}=%(val)s and tsd.parent = ts.name and
(
(%(from_time)s > tsd.from_time and %(from_time)s < tsd.to_time) or
(%(to_time)s > tsd.from_time and %(to_time)s < tsd.to_time) or
(%(from_time)s <= tsd.from_time and %(to_time)s >= tsd.to_time))
and tsd.name!=%(name)s
- and ts.docstatus < 2""".format(fieldname),
+ and ts.docstatus < 2""".format(cond),
{
- "val": args.get(fieldname),
+ "val": value,
"from_time": args.from_time,
"to_time": args.to_time,
"name": args.name or "No Name"
@@ -184,7 +187,7 @@ class Timesheet(Document):
if self.time_logs:
for data in self.time_logs:
if data.idx == index:
- overlapping = self.get_overlap_for("workstation", data)
+ overlapping = self.get_overlap_for("workstation", data, data.workstation)
if not overlapping:
frappe.throw(_("Logical error: Must find overlapping"))
From b8bdfbcead2d039716c87d9b6cf4c2ac032ce493 Mon Sep 17 00:00:00 2001
From: Rushabh Mehta
Date: Fri, 15 Jul 2016 12:40:47 +0530
Subject: [PATCH 8/9] [minor] optimize item attribute validation for #5756
---
erpnext/controllers/item_variant.py | 26 ++++++++++++-------
.../doctype/item_attribute/item_attribute.py | 6 ++---
2 files changed, 20 insertions(+), 12 deletions(-)
diff --git a/erpnext/controllers/item_variant.py b/erpnext/controllers/item_variant.py
index 41b8b880552..4f1bb6e027a 100644
--- a/erpnext/controllers/item_variant.py
+++ b/erpnext/controllers/item_variant.py
@@ -28,16 +28,14 @@ def get_variant(template, args, variant=None):
return find_variant(template, args, variant)
-def validate_item_variant_attributes(item, args):
- attribute_values = {}
- for t in frappe.get_all("Item Attribute Value", fields=["parent", "attribute_value"],
- filters={"parent": ["in", args.keys()]}):
+def validate_item_variant_attributes(item, args=None):
+ if not args:
+ args = {d.attribute:d.attribute_value for d in item.attributes}
- (attribute_values.setdefault(t.parent.lower(), [])).append(t.attribute_value)
+ attribute_values = get_attribute_values()
- numeric_attributes = frappe._dict((t.attribute.lower(), t) for t in \
- frappe.db.sql("""select attribute, from_range, to_range, increment from `tabItem Variant Attribute`
- where parent = %s and numeric_values=1""", (item), as_dict=1))
+ numeric_attributes = frappe._dict({d.attribute: d for d
+ in item.attributes if d.numeric_values==1})
for attribute, value in args.items():
if attribute.lower() in numeric_attributes:
@@ -56,7 +54,7 @@ def validate_item_variant_attributes(item, args):
#avoid precision error by rounding the remainder
remainder = flt((flt(value) - from_range) % increment, precision)
- is_incremental = remainder==0 or remainder==0 or remainder==increment
+ is_incremental = remainder==0 or remainder==increment
if not (is_in_range and is_incremental):
frappe.throw(_("Value for Attribute {0} must be within the range of {1} to {2} in the increments of {3}")\
@@ -66,6 +64,16 @@ def validate_item_variant_attributes(item, args):
frappe.throw(_("Value {0} for Attribute {1} does not exist in the list of valid Item Attribute Values").format(
value, attribute), InvalidItemAttributeValueError)
+def get_attribute_values():
+ if not frappe.flags.attribute_values:
+ attribute_values = {}
+ for t in frappe.get_all("Item Attribute Value", fields=["parent", "attribute_value"]):
+ (attribute_values.setdefault(t.parent.lower(), [])).append(t.attribute_value)
+
+ frappe.flags.attribute_values = attribute_values
+
+ return frappe.flags.attribute_values
+
def find_variant(template, args, variant_item_code=None):
conditions = ["""(iv_attribute.attribute="{0}" and iv_attribute.attribute_value="{1}")"""\
.format(frappe.db.escape(key), frappe.db.escape(cstr(value))) for key, value in args.items()]
diff --git a/erpnext/stock/doctype/item_attribute/item_attribute.py b/erpnext/stock/doctype/item_attribute/item_attribute.py
index 7bcb21a32f5..7529ef6fc03 100644
--- a/erpnext/stock/doctype/item_attribute/item_attribute.py
+++ b/erpnext/stock/doctype/item_attribute/item_attribute.py
@@ -6,7 +6,7 @@ import frappe
from frappe.model.document import Document
from frappe import _
-from erpnext.controllers.item_variant import InvalidItemAttributeValueError
+from erpnext.controllers.item_variant import validate_item_variant_attributes, InvalidItemAttributeValueError
class ItemAttributeIncrementError(frappe.ValidationError): pass
@@ -24,9 +24,9 @@ class ItemAttribute(Document):
def validate_exising_items(self):
'''Validate that if there are existing items with attributes, they are valid'''
- for item in frappe.db.sql('''select i.name from `tabItem Variant Attribute` iva, `tabItem` i
+ for item in frappe.db.sql('''select distinct i.name from `tabItem Variant Attribute` iva, `tabItem` i
where iva.attribute = %s and iva.parent = i.name and i.has_variants = 0''', self.name):
- frappe.get_doc('Item', item[0]).validate_variant_attributes()
+ validate_item_variant_attributes(frappe.get_doc('Item', item[0]))
def validate_numeric(self):
if self.numeric_values:
From 20122aef7951968dff29e88c4b5e89095276d4b6 Mon Sep 17 00:00:00 2001
From: Rushabh Mehta
Date: Fri, 15 Jul 2016 12:42:41 +0530
Subject: [PATCH 9/9] [minor] optimize item attribute validation for #5756
---
erpnext/controllers/item_variant.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/erpnext/controllers/item_variant.py b/erpnext/controllers/item_variant.py
index 4f1bb6e027a..3ff3d88050b 100644
--- a/erpnext/controllers/item_variant.py
+++ b/erpnext/controllers/item_variant.py
@@ -30,11 +30,11 @@ def get_variant(template, args, variant=None):
def validate_item_variant_attributes(item, args=None):
if not args:
- args = {d.attribute:d.attribute_value for d in item.attributes}
+ args = {d.attribute.lower():d.attribute_value for d in item.attributes}
attribute_values = get_attribute_values()
- numeric_attributes = frappe._dict({d.attribute: d for d
+ numeric_attributes = frappe._dict({d.attribute.lower(): d for d
in item.attributes if d.numeric_values==1})
for attribute, value in args.items():