Merge pull request #5331 from nabinhait/multi-fix-55

Multiple fixes
diff --git a/erpnext/accounts/page/accounts_browser/accounts_browser.js b/erpnext/accounts/page/accounts_browser/accounts_browser.js
index 222682e..ec906f8 100644
--- a/erpnext/accounts/page/accounts_browser/accounts_browser.js
+++ b/erpnext/accounts/page/accounts_browser/accounts_browser.js
@@ -232,7 +232,7 @@
 				$(fd.tax_rate.wrapper).toggle(false);
 				$(fd.warehouse.wrapper).toggle(false);
 			} else {
-				$(fd.account_type.wrapper).toggle(true);
+				$(fd.account_type.wrapper).toggle(node.root ? false : true);
 				fd.account_type.$input.trigger("change");
 			}
 		});
@@ -243,9 +243,6 @@
 			$(fd.warehouse.wrapper).toggle(fd.account_type.get_value()==='Warehouse');
 		})
 
-		// root type if root
-		$(fd.root_type.wrapper).toggle(node.root);
-
 		// create
 		d.set_primary_action(__("Create New"), function() {
 			var btn = this;
@@ -262,10 +259,10 @@
 			v.company = me.company;
 
 			if(node.root) {
-				v.is_root = true;
+				v.is_root = 1;
 				v.parent_account = null;
 			} else {
-				v.is_root = false;
+				v.is_root = 0;
 				v.root_type = null;
 			}
 
@@ -289,6 +286,11 @@
 		}
 
 		$(fd.is_group.input).prop("checked", false).change();
+		
+		// In case of root, show root type and hide account_type, is_group
+		$(fd.root_type.wrapper).toggle(node.root);
+		$(fd.is_group.wrapper).toggle(!node.root);
+		
 		d.show();
 	},
 
diff --git a/erpnext/accounts/report/accounts_payable/accounts_payable.html b/erpnext/accounts/report/accounts_payable/accounts_payable.html
index d3020b2..07f9e47 100644
--- a/erpnext/accounts/report/accounts_payable/accounts_payable.html
+++ b/erpnext/accounts/report/accounts_payable/accounts_payable.html
@@ -1 +1 @@
-{% include "accounts/report/accounts_receivable/accounts_receivable.html" %}
+{% include "erpnext/accounts/report/accounts_receivable/accounts_receivable.html" %}
diff --git a/erpnext/accounts/report/accounts_payable_summary/accounts_payable_summary.html b/erpnext/accounts/report/accounts_payable_summary/accounts_payable_summary.html
index d3020b2..07f9e47 100644
--- a/erpnext/accounts/report/accounts_payable_summary/accounts_payable_summary.html
+++ b/erpnext/accounts/report/accounts_payable_summary/accounts_payable_summary.html
@@ -1 +1 @@
-{% include "accounts/report/accounts_receivable/accounts_receivable.html" %}
+{% include "erpnext/accounts/report/accounts_receivable/accounts_receivable.html" %}
diff --git a/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.html b/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.html
index d3020b2..07f9e47 100644
--- a/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.html
+++ b/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.html
@@ -1 +1 @@
-{% include "accounts/report/accounts_receivable/accounts_receivable.html" %}
+{% include "erpnext/accounts/report/accounts_receivable/accounts_receivable.html" %}
diff --git a/erpnext/accounts/report/balance_sheet/balance_sheet.html b/erpnext/accounts/report/balance_sheet/balance_sheet.html
index d4ae54d..14dc0a6 100644
--- a/erpnext/accounts/report/balance_sheet/balance_sheet.html
+++ b/erpnext/accounts/report/balance_sheet/balance_sheet.html
@@ -1 +1 @@
-{% include "accounts/report/financial_statements.html" %}
+{% include "erpnext/accounts/report/financial_statements.html" %}
diff --git a/erpnext/accounts/report/profit_and_loss_statement/profit_and_loss_statement.html b/erpnext/accounts/report/profit_and_loss_statement/profit_and_loss_statement.html
index d4ae54d..14dc0a6 100644
--- a/erpnext/accounts/report/profit_and_loss_statement/profit_and_loss_statement.html
+++ b/erpnext/accounts/report/profit_and_loss_statement/profit_and_loss_statement.html
@@ -1 +1 @@
-{% include "accounts/report/financial_statements.html" %}
+{% include "erpnext/accounts/report/financial_statements.html" %}
diff --git a/erpnext/accounts/report/trial_balance/trial_balance.html b/erpnext/accounts/report/trial_balance/trial_balance.html
index d4ae54d..14dc0a6 100644
--- a/erpnext/accounts/report/trial_balance/trial_balance.html
+++ b/erpnext/accounts/report/trial_balance/trial_balance.html
@@ -1 +1 @@
-{% include "accounts/report/financial_statements.html" %}
+{% include "erpnext/accounts/report/financial_statements.html" %}
diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py
index 48668fa..077fcb4 100644
--- a/erpnext/accounts/utils.py
+++ b/erpnext/accounts/utils.py
@@ -4,7 +4,7 @@
 from __future__ import unicode_literals
 
 import frappe
-from frappe.utils import nowdate, cstr, flt, now, getdate, add_months
+from frappe.utils import nowdate, cstr, flt, cint, now, getdate, add_months
 from frappe import throw, _
 from frappe.utils import formatdate
 import frappe.desk.reportview
@@ -129,12 +129,13 @@
 	if not args:
 		args = frappe.local.form_dict
 		args.pop("cmd")
-
+	
 	ac = frappe.new_doc("Account")
 	ac.update(args)
 	ac.old_parent = ""
 	ac.freeze_account = "No"
-	if ac.get("is_root"):
+	if cint(ac.get("is_root")):
+		ac.parent_account = None
 		ac.flags.ignore_mandatory = True
 	ac.insert()