Removed debit_or_credit field
diff --git a/erpnext/accounts/doctype/account/account.js b/erpnext/accounts/doctype/account/account.js
index f4ec79b..a77bce5 100644
--- a/erpnext/accounts/doctype/account/account.js
+++ b/erpnext/accounts/doctype/account/account.js
@@ -1,14 +1,6 @@
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt
-
-// Onload
-// -----------------------------------------
-cur_frm.cscript.onload = function(doc, cdt, cdn) {
-}
-
-// Refresh
-// -----------------------------------------
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
if(doc.__islocal) {
msgprint(frappe._("Please create new account from Chart of Accounts."));
@@ -22,8 +14,7 @@
'credit_days', 'credit_limit', 'tax_rate'], doc.group_or_ledger=='Ledger')
// disable fields
- cur_frm.toggle_enable(['account_name', 'debit_or_credit', 'group_or_ledger',
- 'is_pl_account', 'company'], false);
+ cur_frm.toggle_enable(['account_name', 'group_or_ledger', 'is_pl_account', 'company'], false);
if(doc.group_or_ledger=='Ledger') {
frappe.model.with_doc("Accounts Settings", "Accounts Settings", function (name) {
@@ -61,14 +52,8 @@
in_list(['Customer', 'Supplier'], doc.master_type));
}
-
-// Fetch parent details
-// -----------------------------------------
-cur_frm.add_fetch('parent_account', 'debit_or_credit', 'debit_or_credit');
cur_frm.add_fetch('parent_account', 'is_pl_account', 'is_pl_account');
-// Hide tax rate based on account type
-// -----------------------------------------
cur_frm.cscript.account_type = function(doc, cdt, cdn) {
if(doc.group_or_ledger=='Ledger') {
cur_frm.toggle_display(['tax_rate'], doc.account_type == 'Tax');
@@ -78,8 +63,6 @@
}
}
-// Hide/unhide group or ledger
-// -----------------------------------------
cur_frm.cscript.add_toolbar_buttons = function(doc) {
cur_frm.appframe.add_button(frappe._('Chart of Accounts'),
function() { frappe.set_route("Accounts Browser", "Account"); }, 'icon-sitemap')
@@ -102,8 +85,7 @@
}, "icon-table");
}
}
-// Convert group to ledger
-// -----------------------------------------
+
cur_frm.cscript.convert_to_ledger = function(doc, cdt, cdn) {
return $c_obj(cur_frm.get_doclist(),'convert_group_to_ledger','',function(r,rt) {
if(r.message == 1) {
@@ -112,8 +94,6 @@
});
}
-// Convert ledger to group
-// -----------------------------------------
cur_frm.cscript.convert_to_group = function(doc, cdt, cdn) {
return $c_obj(cur_frm.get_doclist(),'convert_ledger_to_group','',function(r,rt) {
if(r.message == 1) {
diff --git a/erpnext/accounts/doctype/account/account.py b/erpnext/accounts/doctype/account/account.py
index b4bc9a9..aec889c 100644
--- a/erpnext/accounts/doctype/account/account.py
+++ b/erpnext/accounts/doctype/account/account.py
@@ -48,7 +48,7 @@
def validate_parent(self):
"""Fetch Parent Details and validation for account not to be created under ledger"""
if self.doc.parent_account:
- par = frappe.db.sql("""select name, group_or_ledger, is_pl_account, debit_or_credit
+ par = frappe.db.sql("""select name, group_or_ledger, is_pl_account
from tabAccount where name =%s""", self.doc.parent_account)
if not par:
throw(_("Parent account does not exists"))
@@ -56,19 +56,9 @@
throw(_("You can not assign itself as parent account"))
elif par[0][1] != 'Group':
throw(_("Parent account can not be a ledger"))
- elif self.doc.debit_or_credit and par[0][3] != self.doc.debit_or_credit:
- throw("{msg} {debit_or_credit} {under} {account} {acc}".format(**{
- "msg": _("You cannot move a"),
- "debit_or_credit": self.doc.debit_or_credit,
- "under": _("account under"),
- "account": par[0][3],
- "acc": _("account")
- }))
if not self.doc.is_pl_account:
self.doc.is_pl_account = par[0][2]
- if not self.doc.debit_or_credit:
- self.doc.debit_or_credit = par[0][3]
def validate_duplicate_account(self):
if self.doc.fields.get('__islocal') or not self.doc.name:
@@ -131,8 +121,6 @@
and docstatus != 2""", self.doc.name)
def validate_mandatory(self):
- if not self.doc.debit_or_credit:
- throw(_("Debit or Credit field is mandatory"))
if not self.doc.is_pl_account:
throw(_("Is PL Account field is mandatory"))
@@ -215,9 +203,9 @@
throw(_("Account ") + new +_(" does not exists"))
val = list(frappe.db.get_value("Account", new_account,
- ["group_or_ledger", "debit_or_credit", "is_pl_account", "company"]))
+ ["group_or_ledger", "is_pl_account", "company"]))
- if val != [self.doc.group_or_ledger, self.doc.debit_or_credit, self.doc.is_pl_account, self.doc.company]:
+ if val != [self.doc.group_or_ledger, self.doc.is_pl_account, self.doc.company]:
throw(_("""Merging is only possible if following \
properties are same in both records.
Group or Ledger, Debit or Credit, Is PL Account"""))
diff --git a/erpnext/accounts/doctype/account/account.txt b/erpnext/accounts/doctype/account/account.txt
index e262215..7b5a951 100644
--- a/erpnext/accounts/doctype/account/account.txt
+++ b/erpnext/accounts/doctype/account/account.txt
@@ -2,7 +2,7 @@
{
"creation": "2013-01-30 12:49:46",
"docstatus": 0,
- "modified": "2014-01-20 17:48:20",
+ "modified": "2014-03-03 17:21:07",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -16,7 +16,7 @@
"in_create": 1,
"module": "Accounts",
"name": "__common__",
- "search_fields": "debit_or_credit, group_or_ledger"
+ "search_fields": "group_or_ledger"
},
{
"doctype": "DocField",
@@ -95,17 +95,6 @@
},
{
"doctype": "DocField",
- "fieldname": "debit_or_credit",
- "fieldtype": "Data",
- "in_filter": 1,
- "label": "Debit or Credit",
- "oldfieldname": "debit_or_credit",
- "oldfieldtype": "Data",
- "read_only": 1,
- "search_index": 1
- },
- {
- "doctype": "DocField",
"fieldname": "is_pl_account",
"fieldtype": "Select",
"in_filter": 1,
@@ -147,6 +136,13 @@
"search_index": 1
},
{
+ "doctype": "DocField",
+ "fieldname": "root_type",
+ "fieldtype": "Select",
+ "label": "Root Type",
+ "options": "\nAsset\nLiability\nExpense\nIncome\nEquity"
+ },
+ {
"description": "Setting Account Type helps in selecting this Account in transactions.",
"doctype": "DocField",
"fieldname": "account_type",
diff --git a/erpnext/accounts/doctype/cost_center/cost_center.js b/erpnext/accounts/doctype/cost_center/cost_center.js
index 7fb4afe..d271ab3 100644
--- a/erpnext/accounts/doctype/cost_center/cost_center.js
+++ b/erpnext/accounts/doctype/cost_center/cost_center.js
@@ -15,7 +15,6 @@
filters:[
['Account', 'company', '=', me.frm.doc.company],
['Account', 'is_pl_account', '=', 'Yes'],
- ['Account', 'debit_or_credit', '=', 'Debit'],
['Account', 'group_or_ledger', '!=', 'Group'],
]
}
diff --git a/erpnext/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.py b/erpnext/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.py
index b8c1bd6..e0bd61d 100644
--- a/erpnext/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.py
+++ b/erpnext/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.py
@@ -15,8 +15,10 @@
self.doclist = doclist
def set_account_type(self):
- self.doc.account_type = self.doc.account and \
- frappe.db.get_value("Account", self.doc.account, "debit_or_credit").lower() or ""
+ self.doc.account_type = ""
+ if self.doc.account:
+ root_type = frappe.db.get_value("Account", self.doc.account, "root_type")
+ self.doc.account_type = "debit" if root_type in ["Asset", "Income"] else "credit"
def get_voucher_details(self):
total_amount = frappe.db.sql("""select sum(%s) from `tabGL Entry`
diff --git a/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.js b/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.js
index 56eb330..1d28f69 100644
--- a/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.js
+++ b/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.js
@@ -13,8 +13,8 @@
return{
filters:{
'is_pl_account': "No",
- "debit_or_credit": "Credit",
"company": doc.company,
+ "root_type": "Liability",
"freeze_account": "No",
"group_or_ledger": "Ledger"
}
diff --git a/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py b/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py
index 98befa0..b336716 100644
--- a/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py
+++ b/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py
@@ -3,8 +3,8 @@
from __future__ import unicode_literals
import frappe
-from frappe.utils import cstr, flt, getdate
-from frappe import msgprint, _
+from frappe.utils import cstr, flt
+from frappe import _
from erpnext.controllers.accounts_controller import AccountsController
class DocType(AccountsController):
@@ -25,10 +25,8 @@
where voucher_type = 'Period Closing Voucher' and voucher_no=%s""", self.doc.name)
def validate_account_head(self):
- debit_or_credit, is_pl_account = frappe.db.get_value("Account",
- self.doc.closing_account_head, ["debit_or_credit", "is_pl_account"])
-
- if debit_or_credit != 'Credit' or is_pl_account != 'No':
+ if frappe.db.get_value("Account", self.doc.closing_account_head, "root_type") \
+ != "Liability":
frappe.throw(_("Account") + ": " + self.doc.closing_account_head +
_("must be a Liability account"))
@@ -48,16 +46,14 @@
select sum(ifnull(t1.debit,0))-sum(ifnull(t1.credit,0))
from `tabGL Entry` t1, tabAccount t2
where t1.account = t2.name and t1.posting_date between %s and %s
- and t2.debit_or_credit = 'Credit' and t2.is_pl_account = 'Yes'
- and t2.docstatus < 2 and t2.company = %s""",
+ and t2.root_type = 'Income' and t2.docstatus < 2 and t2.company = %s""",
(self.year_start_date, self.doc.posting_date, self.doc.company))
expense_bal = frappe.db.sql("""
select sum(ifnull(t1.debit,0))-sum(ifnull(t1.credit,0))
from `tabGL Entry` t1, tabAccount t2
where t1.account = t2.name and t1.posting_date between %s and %s
- and t2.debit_or_credit = 'Debit' and t2.is_pl_account = 'Yes'
- and t2.docstatus < 2 and t2.company=%s""",
+ and t2.root_type = 'Expense' and t2.docstatus < 2 and t2.company=%s""",
(self.year_start_date, self.doc.posting_date, self.doc.company))
income_bal = income_bal and income_bal[0][0] or 0
diff --git a/erpnext/accounts/doctype/pos_setting/pos_setting.js b/erpnext/accounts/doctype/pos_setting/pos_setting.js
index 5e7afc6..ea08fd2 100755
--- a/erpnext/accounts/doctype/pos_setting/pos_setting.js
+++ b/erpnext/accounts/doctype/pos_setting/pos_setting.js
@@ -16,7 +16,7 @@
cur_frm.fields_dict['cash_bank_account'].get_query = function(doc,cdt,cdn) {
return{
filters:{
- 'debit_or_credit': "Debit",
+ 'root_type': "Asset",
'is_pl_account': "No",
'group_or_ledger': "Ledger",
'company': doc.company
@@ -29,7 +29,6 @@
cur_frm.fields_dict['income_account'].get_query = function(doc,cdt,cdn) {
return{
filters:{
- 'debit_or_credit': "Credit",
'group_or_ledger': "Ledger",
'company': doc.company,
'account_type': "Income Account"
@@ -56,7 +55,7 @@
return {
filters: {
"is_pl_account": "Yes",
- "debit_or_credit": "Debit",
+ "root_type": "Expense",
"company": doc.company,
"group_or_ledger": "Ledger"
}
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
index 202179d..f4a0da1 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
@@ -158,7 +158,7 @@
cur_frm.fields_dict['credit_to'].get_query = function(doc) {
return{
filters:{
- 'debit_or_credit': 'Credit',
+ 'root_type': 'Liability',
'is_pl_account': 'No',
'group_or_ledger': 'Ledger',
'company': doc.company
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
index 1d7af8a..0b255b6 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
@@ -4,7 +4,7 @@
from __future__ import unicode_literals
import frappe
-from frappe.utils import add_days, cint, cstr, flt, formatdate
+from frappe.utils import cint, cstr, flt, formatdate
from frappe.model.bean import getlist
from frappe.model.code import get_obj
from frappe import msgprint, _
@@ -109,17 +109,8 @@
self.doc.remarks = "No Remarks"
def validate_credit_acc(self):
- acc = frappe.db.sql("select debit_or_credit, is_pl_account from tabAccount where name = %s",
- self.doc.credit_to)
- if not acc:
- msgprint("Account: "+ self.doc.credit_to + "does not exist")
- raise Exception
- elif acc[0][0] and acc[0][0] != 'Credit':
- msgprint("Account: "+ self.doc.credit_to + "is not a credit account")
- raise Exception
- elif acc[0][1] and acc[0][1] != 'No':
- msgprint("Account: "+ self.doc.credit_to + "is a pl account")
- raise Exception
+ if frappe.db.get_value("Account", self.doc.debit_to, "root_type") != "Liability":
+ frappe.throw(_("Account must be an liability account"))
# Validate Acc Head of Supplier and Credit To Account entered
# ------------------------------------------------------------
@@ -433,7 +424,7 @@
# but can also be a Liability account with account_type='Expense Account' in special circumstances.
# Hence the first condition is an "OR"
return frappe.db.sql("""select tabAccount.name from `tabAccount`
- where (tabAccount.debit_or_credit="Debit"
+ where (tabAccount.root_type in ("Asset", "Expense")
or tabAccount.account_type = "Expense Account")
and tabAccount.group_or_ledger="Ledger"
and tabAccount.docstatus!=2
diff --git a/erpnext/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.js b/erpnext/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.js
index b87915a..aa4ec27 100644
--- a/erpnext/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.js
+++ b/erpnext/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.js
@@ -138,7 +138,7 @@
query: "erpnext.controllers.queries.tax_account_query",
filters: {
"account_type": ["Tax", "Chargeable", "Expense Account"],
- "debit_or_credit": "Debit",
+ "root_type": "Expense",
"company": doc.company
}
}
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
index fdbead9..aeab04c 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
@@ -289,7 +289,7 @@
cur_frm.fields_dict.debit_to.get_query = function(doc) {
return{
filters: {
- 'debit_or_credit': 'Debit',
+ 'root_type': 'Asset',
'is_pl_account': 'No',
'group_or_ledger': 'Ledger',
'company': doc.company
@@ -300,7 +300,7 @@
cur_frm.fields_dict.cash_bank_account.get_query = function(doc) {
return{
filters: {
- 'debit_or_credit': 'Debit',
+ 'root_type': 'Asset',
'is_pl_account': 'No',
'group_or_ledger': 'Ledger',
'company': doc.company
@@ -311,7 +311,7 @@
cur_frm.fields_dict.write_off_account.get_query = function(doc) {
return{
filters:{
- 'debit_or_credit': 'Debit',
+ 'root_type': 'Expense',
'is_pl_account': 'Yes',
'group_or_ledger': 'Ledger',
'company': doc.company
@@ -354,7 +354,7 @@
return {
filters: {
'is_pl_account': 'Yes',
- 'debit_or_credit': 'Debit',
+ 'root_type': 'Expense',
'company': doc.company,
'group_or_ledger': 'Ledger'
}
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
index a261334..0a145b5 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
@@ -257,18 +257,9 @@
def validate_debit_acc(self):
- acc = frappe.db.sql("select debit_or_credit, is_pl_account from tabAccount where name = %s and docstatus != 2", self.doc.debit_to)
- if not acc:
- msgprint("Account: "+ self.doc.debit_to + " does not exist")
- raise Exception
- elif acc[0][0] and acc[0][0] != 'Debit':
- msgprint("Account: "+ self.doc.debit_to + " is not a debit account")
- raise Exception
- elif acc[0][1] and acc[0][1] != 'No':
- msgprint("Account: "+ self.doc.debit_to + " is a pl account")
- raise Exception
-
-
+ if frappe.db.get_value("Account", self.doc.debit_to, "root_type") != "Asset":
+ frappe.throw(_("Account must be an asset account"))
+
def validate_fixed_asset_account(self):
"""Validate Fixed Asset Account and whether Income Account Entered Exists"""
for d in getlist(self.doclist,'entries'):
@@ -796,7 +787,7 @@
# but can also be a Asset account with account_type='Income Account' in special circumstances.
# Hence the first condition is an "OR"
return frappe.db.sql("""select tabAccount.name from `tabAccount`
- where (tabAccount.debit_or_credit="Credit"
+ where (tabAccount.root_type in ("Liability", "Income")
or tabAccount.account_type = "Income Account")
and tabAccount.group_or_ledger="Ledger"
and tabAccount.docstatus!=2
diff --git a/erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js b/erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js
index f33eb27..c5e9689 100644
--- a/erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js
+++ b/erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js
@@ -137,7 +137,7 @@
query: "erpnext.controllers.queries.tax_account_query",
filters: {
"account_type": ["Tax", "Chargeable", "Income Account"],
- "debit_or_credit": "Credit",
+ "root_type": "Income",
"company": doc.company
}
}
diff --git a/erpnext/accounts/report/accounts_payable/accounts_payable.js b/erpnext/accounts/report/accounts_payable/accounts_payable.js
index 855aae1..9b6fcae 100644
--- a/erpnext/accounts/report/accounts_payable/accounts_payable.js
+++ b/erpnext/accounts/report/accounts_payable/accounts_payable.js
@@ -21,7 +21,7 @@
"query": "accounts.utils.get_account_list",
"filters": {
"is_pl_account": "No",
- "debit_or_credit": "Credit",
+ "root_type": "Liability",
"company": company,
"master_type": "Supplier"
}
diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.js b/erpnext/accounts/report/accounts_receivable/accounts_receivable.js
index bb3bf5b..1437fde 100644
--- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.js
+++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.js
@@ -21,7 +21,7 @@
"query": "accounts.utils.get_account_list",
"filters": {
"is_pl_account": "No",
- "debit_or_credit": "Debit",
+ "root_type": "Asset",
"company": company,
"master_type": "Customer"
}
diff --git a/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py b/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py
index 4cb14db..607227b 100644
--- a/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py
+++ b/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py
@@ -7,9 +7,7 @@
def execute(filters=None):
if not filters: filters = {}
-
- debit_or_credit = frappe.db.get_value("Account", filters["account"], "debit_or_credit")
-
+
columns = get_columns()
data = get_entries(filters)
@@ -21,15 +19,12 @@
total_debit += flt(d[4])
total_credit += flt(d[5])
- if debit_or_credit == 'Debit':
- bank_bal = flt(balance_as_per_company) - flt(total_debit) + flt(total_credit)
- else:
- bank_bal = flt(balance_as_per_company) + flt(total_debit) - flt(total_credit)
+ bank_bal = flt(balance_as_per_company) + flt(total_debit) - flt(total_credit)
data += [
- get_balance_row("Balance as per company books", balance_as_per_company, debit_or_credit),
+ get_balance_row("Balance as per company books", balance_as_per_company),
["", "", "", "Amounts not reflected in bank", total_debit, total_credit],
- get_balance_row("Balance as per bank", bank_bal, debit_or_credit)
+ get_balance_row("Balance as per bank", bank_bal)
]
return columns, data
@@ -52,8 +47,8 @@
return entries
-def get_balance_row(label, amount, debit_or_credit):
- if debit_or_credit == "Debit":
+def get_balance_row(label, amount):
+ if amount > 0:
return ["", "", "", label, amount, 0]
else:
return ["", "", "", label, 0, amount]
diff --git a/erpnext/accounts/report/general_ledger/general_ledger.py b/erpnext/accounts/report/general_ledger/general_ledger.py
index e130e29..17af02f 100644
--- a/erpnext/accounts/report/general_ledger/general_ledger.py
+++ b/erpnext/accounts/report/general_ledger/general_ledger.py
@@ -8,8 +8,7 @@
def execute(filters=None):
account_details = {}
- for acc in frappe.db.sql("""select name, debit_or_credit, group_or_ledger
- from tabAccount""", as_dict=1):
+ for acc in frappe.db.sql("""select name, group_or_ledger from tabAccount""", as_dict=1):
account_details.setdefault(acc.name, acc)
validate_filters(filters, account_details)
@@ -88,15 +87,13 @@
# Opening for filtered account
if filters.get("account"):
- data += [get_balance_row("Opening", account_details[filters.account].debit_or_credit,
- opening), {}]
+ data += [get_balance_row("Opening", opening), {}]
for acc, acc_dict in gle_map.items():
if acc_dict.entries:
# Opening for individual ledger, if grouped by account
if filters.get("group_by_account"):
- data.append(get_balance_row("Opening", account_details[acc].debit_or_credit,
- acc_dict.opening))
+ data.append(get_balance_row("Opening", acc_dict.opening))
data += acc_dict.entries
@@ -105,8 +102,7 @@
data += [{"account": "Totals", "debit": acc_dict.total_debit,
"credit": acc_dict.total_credit},
get_balance_row("Closing (Opening + Totals)",
- account_details[acc].debit_or_credit, (acc_dict.opening
- + acc_dict.total_debit - acc_dict.total_credit)), {}]
+ (acc_dict.opening + acc_dict.total_debit - acc_dict.total_credit)), {}]
# Total debit and credit between from and to date
if total_debit or total_credit:
@@ -115,7 +111,6 @@
# Closing for filtered account
if filters.get("account"):
data.append(get_balance_row("Closing (Opening + Totals)",
- account_details[filters.account].debit_or_credit,
(opening + total_debit - total_credit)))
return data
@@ -151,11 +146,11 @@
return opening, total_debit, total_credit, gle_map
-def get_balance_row(label, debit_or_credit, balance):
+def get_balance_row(label, balance):
return {
"account": label,
- "debit": balance if debit_or_credit=="Debit" else 0,
- "credit": -1*balance if debit_or_credit=="Credit" else 0,
+ "debit": balance if balance > 0 else 0,
+ "credit": -1*balance if balance < 0 else 0,
}
def get_result_as_list(data):
diff --git a/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.js b/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.js
index 4196c85..5f6d631 100644
--- a/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.js
+++ b/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.js
@@ -33,7 +33,7 @@
"query": "accounts.utils.get_account_list",
"filters": {
"is_pl_account": "No",
- "debit_or_credit": "Credit",
+ "root_type": "Liability",
"company": company,
"master_type": "Supplier"
}
diff --git a/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.js b/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.js
index 1828f694..f54b94b 100644
--- a/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.js
+++ b/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.js
@@ -27,7 +27,7 @@
"query": "accounts.utils.get_account_list",
"filters": {
"is_pl_account": "No",
- "debit_or_credit": "Debit",
+ "root_type": "Asset",
"company": company,
"master_type": "Customer"
}
diff --git a/erpnext/accounts/report/purchase_register/purchase_register.js b/erpnext/accounts/report/purchase_register/purchase_register.js
index 78eb762..10bd9aa 100644
--- a/erpnext/accounts/report/purchase_register/purchase_register.js
+++ b/erpnext/accounts/report/purchase_register/purchase_register.js
@@ -27,7 +27,7 @@
"query": "accounts.utils.get_account_list",
"filters": {
"is_pl_account": "No",
- "debit_or_credit": "Credit",
+ "root_type": "Liability",
"company": company,
"master_type": "Supplier"
}
diff --git a/erpnext/accounts/report/sales_register/sales_register.js b/erpnext/accounts/report/sales_register/sales_register.js
index f0d00ce..683027a 100644
--- a/erpnext/accounts/report/sales_register/sales_register.js
+++ b/erpnext/accounts/report/sales_register/sales_register.js
@@ -27,7 +27,7 @@
"query": "accounts.utils.get_account_list",
"filters": {
"is_pl_account": "No",
- "debit_or_credit": "Debit",
+ "root_type": "Asset",
"company": company,
"master_type": "Customer"
}
diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py
index 0964478..b279814 100644
--- a/erpnext/accounts/utils.py
+++ b/erpnext/accounts/utils.py
@@ -74,7 +74,7 @@
return 0.0
acc = frappe.db.get_value('Account', account, \
- ['lft', 'rgt', 'debit_or_credit', 'is_pl_account', 'group_or_ledger'], as_dict=1)
+ ['lft', 'rgt', 'is_pl_account', 'group_or_ledger'], as_dict=1)
# for pl accounts, get balance within a fiscal year
if acc.is_pl_account == 'Yes':
@@ -95,10 +95,6 @@
FROM `tabGL Entry` gle
WHERE %s""" % " and ".join(cond))[0][0]
- # if credit account, it should calculate credit - debit
- if bal and acc.debit_or_credit == 'Credit':
- bal = -bal
-
# if bal is None, return 0
return flt(bal)
@@ -290,7 +286,7 @@
def validate_expense_against_budget(args):
args = frappe._dict(args)
if frappe.db.get_value("Account", {"name": args.account, "is_pl_account": "Yes",
- "debit_or_credit": "Debit"}):
+ "root_type": "Expense"}):
budget = frappe.db.sql("""
select bd.budget_allocated, cc.distribution_id
from `tabCost Center` cc, `tabBudget Detail` bd
diff --git a/erpnext/controllers/queries.py b/erpnext/controllers/queries.py
index 1f8077f..449a493 100644
--- a/erpnext/controllers/queries.py
+++ b/erpnext/controllers/queries.py
@@ -106,18 +106,16 @@
'page_len': page_len})
def tax_account_query(doctype, txt, searchfield, start, page_len, filters):
- return frappe.db.sql("""select name, parent_account, debit_or_credit
- from tabAccount
+ return frappe.db.sql("""select name, parent_account from tabAccount
where tabAccount.docstatus!=2
- and (account_type in (%s) or
- (ifnull(is_pl_account, 'No') = 'Yes' and debit_or_credit = %s) )
+ and (account_type in (%s) or root_type = %s)
and group_or_ledger = 'Ledger'
and company = %s
and `%s` LIKE %s
limit %s, %s""" %
(", ".join(['%s']*len(filters.get("account_type"))),
"%s", "%s", searchfield, "%s", "%s", "%s"),
- tuple(filters.get("account_type") + [filters.get("debit_or_credit"),
+ tuple(filters.get("account_type") + [filters.get("root_type"),
filters.get("company"), "%%%s%%" % txt, start, page_len]))
def item_query(doctype, txt, searchfield, start, page_len, filters):
diff --git a/erpnext/setup/doctype/company/company.js b/erpnext/setup/doctype/company/company.js
index 7ce369c..5556858 100644
--- a/erpnext/setup/doctype/company/company.js
+++ b/erpnext/setup/doctype/company/company.js
@@ -106,7 +106,7 @@
'company': doc.name,
'group_or_ledger': "Ledger",
'is_pl_account': "Yes",
- 'debit_or_credit': "Debit"
+ 'root_type': "Expense"
}
}
}
@@ -117,7 +117,7 @@
'company': doc.name,
'group_or_ledger': "Ledger",
'is_pl_account': "Yes",
- 'debit_or_credit': "Credit"
+ 'root_type': "Income"
}
}
}
@@ -136,7 +136,7 @@
return {
"filters": {
"is_pl_account": "Yes",
- "debit_or_credit": "Debit",
+ "root_type": "Expense",
"company": doc.name,
'group_or_ledger': "Ledger"
}
@@ -150,7 +150,7 @@
return {
"filters": {
"is_pl_account": "No",
- "debit_or_credit": "Credit",
+ "root_type": "Liability",
"company": doc.name,
'group_or_ledger': "Ledger"
}
diff --git a/erpnext/setup/doctype/company/company.py b/erpnext/setup/doctype/company/company.py
index fb3059b..7f6d846 100644
--- a/erpnext/setup/doctype/company/company.py
+++ b/erpnext/setup/doctype/company/company.py
@@ -101,117 +101,117 @@
style_settings.save()
def create_default_accounts(self):
- self.fld_dict = {'account_name':0,'parent_account':1,'group_or_ledger':2,'is_pl_account':3,'account_type':4,'debit_or_credit':5,'company':6,'tax_rate':7}
+ self.fld_dict = {'account_name':0,'parent_account':1,'group_or_ledger':2,'is_pl_account':3,'account_type':4,'root_type':5,'company':6,'tax_rate':7}
acc_list_common = [
- ['Application of Funds (Assets)','','Group','No','','Debit',self.doc.name,''],
- ['Current Assets','Application of Funds (Assets)','Group','No','','Debit',self.doc.name,''],
- ['Accounts Receivable','Current Assets','Group','No','','Debit',self.doc.name,''],
- ['Bank Accounts','Current Assets','Group','No','Bank or Cash','Debit',self.doc.name,''],
- ['Cash In Hand','Current Assets','Group','No','Bank or Cash','Debit',self.doc.name,''],
- ['Cash','Cash In Hand','Ledger','No','Bank or Cash','Debit',self.doc.name,''],
- ['Loans and Advances (Assets)','Current Assets','Group','No','','Debit',self.doc.name,''],
- ['Securities and Deposits','Current Assets','Group','No','','Debit',self.doc.name,''],
- ['Earnest Money','Securities and Deposits','Ledger','No','','Debit',self.doc.name,''],
- ['Stock Assets','Current Assets','Group','No','','Debit',self.doc.name,''],
- ['Tax Assets','Current Assets','Group','No','','Debit',self.doc.name,''],
- ['Fixed Assets','Application of Funds (Assets)','Group','No','','Debit',self.doc.name,''],
- ['Capital Equipments','Fixed Assets','Ledger','No','Fixed Asset Account','Debit',self.doc.name,''],
- ['Computers','Fixed Assets','Ledger','No','Fixed Asset Account','Debit',self.doc.name,''],
- ['Furniture and Fixture','Fixed Assets','Ledger','No','Fixed Asset Account','Debit',self.doc.name,''],
- ['Office Equipments','Fixed Assets','Ledger','No','Fixed Asset Account','Debit',self.doc.name,''],
- ['Plant and Machinery','Fixed Assets','Ledger','No','Fixed Asset Account','Debit',self.doc.name,''],
- ['Investments','Application of Funds (Assets)','Group','No','','Debit',self.doc.name,''],
- ['Temporary Accounts (Assets)','Application of Funds (Assets)','Group','No','','Debit',self.doc.name,''],
- ['Temporary Account (Assets)','Temporary Accounts (Assets)','Ledger','No','','Debit',self.doc.name,''],
- ['Expenses','','Group','Yes','Expense Account','Debit',self.doc.name,''],
- ['Direct Expenses','Expenses','Group','Yes','Expense Account','Debit',self.doc.name,''],
- ['Stock Expenses','Direct Expenses','Group','Yes','Expense Account','Debit',self.doc.name,''],
- ['Cost of Goods Sold','Stock Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
- ['Stock Adjustment','Stock Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
- ['Expenses Included In Valuation', "Stock Expenses", 'Ledger', 'Yes', 'Expense Account', 'Debit', self.doc.name, ''],
- ['Indirect Expenses','Expenses','Group','Yes','Expense Account','Debit',self.doc.name,''],
- ['Advertising and Publicity','Indirect Expenses','Ledger','Yes','Chargeable','Debit',self.doc.name,''],
- ['Bad Debts Written Off','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
- ['Bank Charges','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
- ['Books and Periodicals','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
- ['Charity and Donations','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
- ['Commission on Sales','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
- ['Conveyance Expenses','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
- ['Customer Entertainment Expenses','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
- ['Depreciation Account','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
- ['Freight and Forwarding Charges','Indirect Expenses','Ledger','Yes','Chargeable','Debit',self.doc.name,''],
- ['Legal Expenses','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
- ['Miscellaneous Expenses','Indirect Expenses','Ledger','Yes','Chargeable','Debit',self.doc.name,''],
- ['Office Maintenance Expenses','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
- ['Office Rent','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
- ['Postal Expenses','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
- ['Print and Stationary','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
- ['Rounded Off','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
- ['Salary','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
- ['Sales Promotion Expenses','Indirect Expenses','Ledger','Yes','Chargeable','Debit',self.doc.name,''],
- ['Service Charges Paid','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
- ['Staff Welfare Expenses','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
- ['Telephone Expenses','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
- ['Travelling Expenses','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
- ['Water and Electricity Expenses','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
- ['Income','','Group','Yes','','Credit',self.doc.name,''],
- ['Direct Income','Income','Group','Yes','Income Account','Credit',self.doc.name,''],
- ['Sales','Direct Income','Ledger','Yes','Income Account','Credit',self.doc.name,''],
- ['Service','Direct Income','Ledger','Yes','Income Account','Credit',self.doc.name,''],
- ['Indirect Income','Income','Group','Yes','Income Account','Credit',self.doc.name,''],
- ['Source of Funds (Liabilities)','','Group','No','','Credit',self.doc.name,''],
- ['Capital Account','Source of Funds (Liabilities)','Group','No','','Credit',self.doc.name,''],
- ['Reserves and Surplus','Capital Account','Ledger','No','','Credit',self.doc.name,''],
- ['Shareholders Funds','Capital Account','Ledger','No','','Credit',self.doc.name,''],
- ['Current Liabilities','Source of Funds (Liabilities)','Group','No','','Credit',self.doc.name,''],
- ['Accounts Payable','Current Liabilities','Group','No','','Credit',self.doc.name,''],
- ['Stock Liabilities','Current Liabilities','Group','No','','Credit',self.doc.name,''],
+ ['Application of Funds (Assets)','','Group','No','','Asset',self.doc.name,''],
+ ['Current Assets','Application of Funds (Assets)','Group','No','','Asset',self.doc.name,''],
+ ['Accounts Receivable','Current Assets','Group','No','','Asset',self.doc.name,''],
+ ['Bank Accounts','Current Assets','Group','No','Bank or Cash','Asset',self.doc.name,''],
+ ['Cash In Hand','Current Assets','Group','No','Bank or Cash','Asset',self.doc.name,''],
+ ['Cash','Cash In Hand','Ledger','No','Bank or Cash','Asset',self.doc.name,''],
+ ['Loans and Advances (Assets)','Current Assets','Group','No','','Asset',self.doc.name,''],
+ ['Securities and Deposits','Current Assets','Group','No','','Asset',self.doc.name,''],
+ ['Earnest Money','Securities and Deposits','Ledger','No','','Asset',self.doc.name,''],
+ ['Stock Assets','Current Assets','Group','No','','Asset',self.doc.name,''],
+ ['Tax Assets','Current Assets','Group','No','','Asset',self.doc.name,''],
+ ['Fixed Assets','Application of Funds (Assets)','Group','No','','Asset',self.doc.name,''],
+ ['Capital Equipments','Fixed Assets','Ledger','No','Fixed Asset Account','Asset',self.doc.name,''],
+ ['Computers','Fixed Assets','Ledger','No','Fixed Asset Account','Asset',self.doc.name,''],
+ ['Furniture and Fixture','Fixed Assets','Ledger','No','Fixed Asset Account','Asset',self.doc.name,''],
+ ['Office Equipments','Fixed Assets','Ledger','No','Fixed Asset Account','Asset',self.doc.name,''],
+ ['Plant and Machinery','Fixed Assets','Ledger','No','Fixed Asset Account','Asset',self.doc.name,''],
+ ['Investments','Application of Funds (Assets)','Group','No','','Asset',self.doc.name,''],
+ ['Temporary Accounts (Assets)','Application of Funds (Assets)','Group','No','','Asset',self.doc.name,''],
+ ['Temporary Account (Assets)','Temporary Accounts (Assets)','Ledger','No','','Asset',self.doc.name,''],
+ ['Expenses','','Group','Yes','Expense Account','Expense',self.doc.name,''],
+ ['Direct Expenses','Expenses','Group','Yes','Expense Account','Expense',self.doc.name,''],
+ ['Stock Expenses','Direct Expenses','Group','Yes','Expense Account','Expense',self.doc.name,''],
+ ['Cost of Goods Sold','Stock Expenses','Ledger','Yes','Expense Account','Expense',self.doc.name,''],
+ ['Stock Adjustment','Stock Expenses','Ledger','Yes','Expense Account','Expense',self.doc.name,''],
+ ['Expenses Included In Valuation', "Stock Expenses", 'Ledger', 'Yes', 'Expense Account', 'Expense', self.doc.name, ''],
+ ['Indirect Expenses','Expenses','Group','Yes','Expense Account','Expense',self.doc.name,''],
+ ['Advertising and Publicity','Indirect Expenses','Ledger','Yes','Chargeable','Expense',self.doc.name,''],
+ ['Bad Debts Written Off','Indirect Expenses','Ledger','Yes','Expense Account','Expense',self.doc.name,''],
+ ['Bank Charges','Indirect Expenses','Ledger','Yes','Expense Account','Expense',self.doc.name,''],
+ ['Books and Periodicals','Indirect Expenses','Ledger','Yes','Expense Account','Expense',self.doc.name,''],
+ ['Charity and Donations','Indirect Expenses','Ledger','Yes','Expense Account','Expense',self.doc.name,''],
+ ['Commission on Sales','Indirect Expenses','Ledger','Yes','Expense Account','Expense',self.doc.name,''],
+ ['Conveyance Expenses','Indirect Expenses','Ledger','Yes','Expense Account','Expense',self.doc.name,''],
+ ['Customer Entertainment Expenses','Indirect Expenses','Ledger','Yes','Expense Account','Expense',self.doc.name,''],
+ ['Depreciation Account','Indirect Expenses','Ledger','Yes','Expense Account','Expense',self.doc.name,''],
+ ['Freight and Forwarding Charges','Indirect Expenses','Ledger','Yes','Chargeable','Expense',self.doc.name,''],
+ ['Legal Expenses','Indirect Expenses','Ledger','Yes','Expense Account','Expense',self.doc.name,''],
+ ['Miscellaneous Expenses','Indirect Expenses','Ledger','Yes','Chargeable','Expense',self.doc.name,''],
+ ['Office Maintenance Expenses','Indirect Expenses','Ledger','Yes','Expense Account','Expense',self.doc.name,''],
+ ['Office Rent','Indirect Expenses','Ledger','Yes','Expense Account','Expense',self.doc.name,''],
+ ['Postal Expenses','Indirect Expenses','Ledger','Yes','Expense Account','Expense',self.doc.name,''],
+ ['Print and Stationary','Indirect Expenses','Ledger','Yes','Expense Account','Expense',self.doc.name,''],
+ ['Rounded Off','Indirect Expenses','Ledger','Yes','Expense Account','Expense',self.doc.name,''],
+ ['Salary','Indirect Expenses','Ledger','Yes','Expense Account','Expense',self.doc.name,''],
+ ['Sales Promotion Expenses','Indirect Expenses','Ledger','Yes','Chargeable','Expense',self.doc.name,''],
+ ['Service Charges Paid','Indirect Expenses','Ledger','Yes','Expense Account','Expense',self.doc.name,''],
+ ['Staff Welfare Expenses','Indirect Expenses','Ledger','Yes','Expense Account','Expense',self.doc.name,''],
+ ['Telephone Expenses','Indirect Expenses','Ledger','Yes','Expense Account','Expense',self.doc.name,''],
+ ['Travelling Expenses','Indirect Expenses','Ledger','Yes','Expense Account','Expense',self.doc.name,''],
+ ['Water and Electricity Expenses','Indirect Expenses','Ledger','Yes','Expense Account','Expense',self.doc.name,''],
+ ['Income','','Group','Yes','','Income',self.doc.name,''],
+ ['Direct Income','Income','Group','Yes','Income Account','Income',self.doc.name,''],
+ ['Sales','Direct Income','Ledger','Yes','Income Account','Income',self.doc.name,''],
+ ['Service','Direct Income','Ledger','Yes','Income Account','Income',self.doc.name,''],
+ ['Indirect Income','Income','Group','Yes','Income Account','Income',self.doc.name,''],
+ ['Source of Funds (Liabilities)','','Group','No','','Liability',self.doc.name,''],
+ ['Capital Account','Source of Funds (Liabilities)','Group','No','','Liability',self.doc.name,''],
+ ['Reserves and Surplus','Capital Account','Ledger','No','','Liability',self.doc.name,''],
+ ['Shareholders Funds','Capital Account','Ledger','No','','Liability',self.doc.name,''],
+ ['Current Liabilities','Source of Funds (Liabilities)','Group','No','','Liability',self.doc.name,''],
+ ['Accounts Payable','Current Liabilities','Group','No','','Liability',self.doc.name,''],
+ ['Stock Liabilities','Current Liabilities','Group','No','','Liability',self.doc.name,''],
['Stock Received But Not Billed', 'Stock Liabilities', 'Ledger',
- 'No', '', 'Credit', self.doc.name, ''],
- ['Duties and Taxes','Current Liabilities','Group','No','','Credit',self.doc.name,''],
- ['Loans (Liabilities)','Current Liabilities','Group','No','','Credit',self.doc.name,''],
- ['Secured Loans','Loans (Liabilities)','Group','No','','Credit',self.doc.name,''],
- ['Unsecured Loans','Loans (Liabilities)','Group','No','','Credit',self.doc.name,''],
- ['Bank Overdraft Account','Loans (Liabilities)','Group','No','','Credit',self.doc.name,''],
- ['Temporary Accounts (Liabilities)','Source of Funds (Liabilities)','Group','No','','Credit',self.doc.name,''],
- ['Temporary Account (Liabilities)','Temporary Accounts (Liabilities)','Ledger','No','','Credit',self.doc.name,'']
+ 'No', '', 'Liability', self.doc.name, ''],
+ ['Duties and Taxes','Current Liabilities','Group','No','','Liability',self.doc.name,''],
+ ['Loans (Liabilities)','Current Liabilities','Group','No','','Liability',self.doc.name,''],
+ ['Secured Loans','Loans (Liabilities)','Group','No','','Liability',self.doc.name,''],
+ ['Unsecured Loans','Loans (Liabilities)','Group','No','','Liability',self.doc.name,''],
+ ['Bank Overdraft Account','Loans (Liabilities)','Group','No','','Liability',self.doc.name,''],
+ ['Temporary Accounts (Liabilities)','Source of Funds (Liabilities)','Group','No','','Liability',self.doc.name,''],
+ ['Temporary Account (Liabilities)','Temporary Accounts (Liabilities)','Ledger','No','','Liability',self.doc.name,'']
]
acc_list_india = [
- ['CENVAT Capital Goods','Tax Assets','Ledger','No','Chargeable','Debit',self.doc.name,''],
- ['CENVAT','Tax Assets','Ledger','No','Chargeable','Debit',self.doc.name,''],
- ['CENVAT Service Tax','Tax Assets','Ledger','No','Chargeable','Debit',self.doc.name,''],
- ['CENVAT Service Tax Cess 1','Tax Assets','Ledger','No','Chargeable','Debit',self.doc.name,''],
- ['CENVAT Service Tax Cess 2','Tax Assets','Ledger','No','Chargeable','Debit',self.doc.name,''],
- ['CENVAT Edu Cess','Tax Assets','Ledger','No','Chargeable','Debit',self.doc.name,''],
- ['CENVAT SHE Cess','Tax Assets','Ledger','No','Chargeable','Debit',self.doc.name,''],
- ['Excise Duty 4','Tax Assets','Ledger','No','Tax','Debit',self.doc.name,'4.00'],
- ['Excise Duty 8','Tax Assets','Ledger','No','Tax','Debit',self.doc.name,'8.00'],
- ['Excise Duty 10','Tax Assets','Ledger','No','Tax','Debit',self.doc.name,'10.00'],
- ['Excise Duty 14','Tax Assets','Ledger','No','Tax','Debit',self.doc.name,'14.00'],
- ['Excise Duty Edu Cess 2','Tax Assets','Ledger','No','Tax','Debit',self.doc.name,'2.00'],
- ['Excise Duty SHE Cess 1','Tax Assets','Ledger','No','Tax','Debit',self.doc.name,'1.00'],
- ['P L A','Tax Assets','Ledger','No','Chargeable','Debit',self.doc.name,''],
- ['P L A - Cess Portion','Tax Assets','Ledger','No','Chargeable','Debit',self.doc.name,''],
- ['Edu. Cess on Excise','Duties and Taxes','Ledger','No','Tax','Credit',self.doc.name,'2.00'],
- ['Edu. Cess on Service Tax','Duties and Taxes','Ledger','No','Tax','Credit',self.doc.name,'2.00'],
- ['Edu. Cess on TDS','Duties and Taxes','Ledger','No','Tax','Credit',self.doc.name,'2.00'],
- ['Excise Duty @ 4','Duties and Taxes','Ledger','No','Tax','Credit',self.doc.name,'4.00'],
- ['Excise Duty @ 8','Duties and Taxes','Ledger','No','Tax','Credit',self.doc.name,'8.00'],
- ['Excise Duty @ 10','Duties and Taxes','Ledger','No','Tax','Credit',self.doc.name,'10.00'],
- ['Excise Duty @ 14','Duties and Taxes','Ledger','No','Tax','Credit',self.doc.name,'14.00'],
- ['Service Tax','Duties and Taxes','Ledger','No','Tax','Credit',self.doc.name,'10.3'],
- ['SHE Cess on Excise','Duties and Taxes','Ledger','No','Tax','Credit',self.doc.name,'1.00'],
- ['SHE Cess on Service Tax','Duties and Taxes','Ledger','No','Tax','Credit',self.doc.name,'1.00'],
- ['SHE Cess on TDS','Duties and Taxes','Ledger','No','Tax','Credit',self.doc.name,'1.00'],
- ['Professional Tax','Duties and Taxes','Ledger','No','Chargeable','Credit',self.doc.name,''],
- ['VAT','Duties and Taxes','Ledger','No','Chargeable','Credit',self.doc.name,''],
- ['TDS (Advertisement)','Duties and Taxes','Ledger','No','Chargeable','Credit',self.doc.name,''],
- ['TDS (Commission)','Duties and Taxes','Ledger','No','Chargeable','Credit',self.doc.name,''],
- ['TDS (Contractor)','Duties and Taxes','Ledger','No','Chargeable','Credit',self.doc.name,''],
- ['TDS (Interest)','Duties and Taxes','Ledger','No','Chargeable','Credit',self.doc.name,''],
- ['TDS (Rent)','Duties and Taxes','Ledger','No','Chargeable','Credit',self.doc.name,''],
- ['TDS (Salary)','Duties and Taxes','Ledger','No','Chargeable','Credit',self.doc.name,'']
+ ['CENVAT Capital Goods','Tax Assets','Ledger','No','Chargeable','Asset',self.doc.name,''],
+ ['CENVAT','Tax Assets','Ledger','No','Chargeable','Asset',self.doc.name,''],
+ ['CENVAT Service Tax','Tax Assets','Ledger','No','Chargeable','Asset',self.doc.name,''],
+ ['CENVAT Service Tax Cess 1','Tax Assets','Ledger','No','Chargeable','Asset',self.doc.name,''],
+ ['CENVAT Service Tax Cess 2','Tax Assets','Ledger','No','Chargeable','Asset',self.doc.name,''],
+ ['CENVAT Edu Cess','Tax Assets','Ledger','No','Chargeable','Asset',self.doc.name,''],
+ ['CENVAT SHE Cess','Tax Assets','Ledger','No','Chargeable','Asset',self.doc.name,''],
+ ['Excise Duty 4','Tax Assets','Ledger','No','Tax','Asset',self.doc.name,'4.00'],
+ ['Excise Duty 8','Tax Assets','Ledger','No','Tax','Asset',self.doc.name,'8.00'],
+ ['Excise Duty 10','Tax Assets','Ledger','No','Tax','Asset',self.doc.name,'10.00'],
+ ['Excise Duty 14','Tax Assets','Ledger','No','Tax','Asset',self.doc.name,'14.00'],
+ ['Excise Duty Edu Cess 2','Tax Assets','Ledger','No','Tax','Asset',self.doc.name,'2.00'],
+ ['Excise Duty SHE Cess 1','Tax Assets','Ledger','No','Tax','Asset',self.doc.name,'1.00'],
+ ['P L A','Tax Assets','Ledger','No','Chargeable','Asset',self.doc.name,''],
+ ['P L A - Cess Portion','Tax Assets','Ledger','No','Chargeable','Asset',self.doc.name,''],
+ ['Edu. Cess on Excise','Duties and Taxes','Ledger','No','Tax','Liability',self.doc.name,'2.00'],
+ ['Edu. Cess on Service Tax','Duties and Taxes','Ledger','No','Tax','Liability',self.doc.name,'2.00'],
+ ['Edu. Cess on TDS','Duties and Taxes','Ledger','No','Tax','Liability',self.doc.name,'2.00'],
+ ['Excise Duty @ 4','Duties and Taxes','Ledger','No','Tax','Liability',self.doc.name,'4.00'],
+ ['Excise Duty @ 8','Duties and Taxes','Ledger','No','Tax','Liability',self.doc.name,'8.00'],
+ ['Excise Duty @ 10','Duties and Taxes','Ledger','No','Tax','Liability',self.doc.name,'10.00'],
+ ['Excise Duty @ 14','Duties and Taxes','Ledger','No','Tax','Liability',self.doc.name,'14.00'],
+ ['Service Tax','Duties and Taxes','Ledger','No','Tax','Liability',self.doc.name,'10.3'],
+ ['SHE Cess on Excise','Duties and Taxes','Ledger','No','Tax','Liability',self.doc.name,'1.00'],
+ ['SHE Cess on Service Tax','Duties and Taxes','Ledger','No','Tax','Liability',self.doc.name,'1.00'],
+ ['SHE Cess on TDS','Duties and Taxes','Ledger','No','Tax','Liability',self.doc.name,'1.00'],
+ ['Professional Tax','Duties and Taxes','Ledger','No','Chargeable','Liability',self.doc.name,''],
+ ['VAT','Duties and Taxes','Ledger','No','Chargeable','Liability',self.doc.name,''],
+ ['TDS (Advertisement)','Duties and Taxes','Ledger','No','Chargeable','Liability',self.doc.name,''],
+ ['TDS (Commission)','Duties and Taxes','Ledger','No','Chargeable','Liability',self.doc.name,''],
+ ['TDS (Contractor)','Duties and Taxes','Ledger','No','Chargeable','Liability',self.doc.name,''],
+ ['TDS (Interest)','Duties and Taxes','Ledger','No','Chargeable','Liability',self.doc.name,''],
+ ['TDS (Rent)','Duties and Taxes','Ledger','No','Chargeable','Liability',self.doc.name,''],
+ ['TDS (Salary)','Duties and Taxes','Ledger','No','Chargeable','Liability',self.doc.name,'']
]
# load common account heads
for d in acc_list_common:
diff --git a/erpnext/setup/doctype/email_digest/email_digest.py b/erpnext/setup/doctype/email_digest/email_digest.py
index aeabf49..5b57837 100644
--- a/erpnext/setup/doctype/email_digest/email_digest.py
+++ b/erpnext/setup/doctype/email_digest/email_digest.py
@@ -177,8 +177,7 @@
def get_income(self, from_date=None, label=None):
# account is PL Account and Credit type account
- accounts = [a["name"] for a in self.get_accounts()
- if a["is_pl_account"]=="Yes" and a["debit_or_credit"]=="Credit"]
+ accounts = [a["name"] for a in self.get_accounts() if a["root_type"]=="Income"]
income = 0
for gle in self.get_gl_entries(from_date or self.from_date, self.to_date):
@@ -190,8 +189,7 @@
def get_expenses_booked(self):
# account is PL Account and Debit type account
- accounts = [a["name"] for a in self.get_accounts()
- if a["is_pl_account"]=="Yes" and a["debit_or_credit"]=="Debit"]
+ accounts = [a["name"] for a in self.get_accounts() if a["root_type"]=="Expense"]
expense = 0
for gle in self.get_gl_entries(self.from_date, self.to_date):
@@ -392,7 +390,7 @@
def get_accounts(self):
if not hasattr(self, "accounts"):
self.accounts = frappe.db.sql("""select name, is_pl_account,
- debit_or_credit, account_type, account_name, master_type
+ root_type, account_type, account_name, master_type
from `tabAccount` where company=%s and docstatus < 2
and group_or_ledger = "Ledger" order by lft""",
(self.doc.company,), as_dict=1)
diff --git a/erpnext/startup/report_data_map.py b/erpnext/startup/report_data_map.py
index 87be60a..5916634 100644
--- a/erpnext/startup/report_data_map.py
+++ b/erpnext/startup/report_data_map.py
@@ -18,7 +18,7 @@
# Accounts
"Account": {
- "columns": ["name", "parent_account", "lft", "rgt", "debit_or_credit",
+ "columns": ["name", "parent_account", "lft", "rgt", "root_type",
"is_pl_account", "company", "group_or_ledger"],
"conditions": ["docstatus < 2"],
"order_by": "lft",
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.js b/erpnext/stock/doctype/delivery_note/delivery_note.js
index aa9db09..6743cd3 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.js
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.js
@@ -218,7 +218,7 @@
return {
filters: {
"is_pl_account": "Yes",
- "debit_or_credit": "Debit",
+ "root_type": "Expense",
"company": doc.company,
"group_or_ledger": "Ledger"
}
diff --git a/erpnext/stock/doctype/item/item.js b/erpnext/stock/doctype/item/item.js
index 8f08d5a..d4e31ee 100644
--- a/erpnext/stock/doctype/item/item.js
+++ b/erpnext/stock/doctype/item/item.js
@@ -55,7 +55,7 @@
cur_frm.fields_dict['expense_account'].get_query = function(doc) {
return {
filters: {
- 'debit_or_credit': "Debit",
+ 'root_type': "Expense",
'group_or_ledger': "Ledger"
}
}
@@ -66,7 +66,7 @@
cur_frm.fields_dict['income_account'].get_query = function(doc) {
return {
filters: {
- 'debit_or_credit': "Credit",
+ 'root_type': "Income",
'group_or_ledger': "Ledger",
'account_type': "Income Account"
}
diff --git a/erpnext/stock/doctype/landed_cost_wizard/landed_cost_wizard.js b/erpnext/stock/doctype/landed_cost_wizard/landed_cost_wizard.js
index 68a29a7..6917efc 100644
--- a/erpnext/stock/doctype/landed_cost_wizard/landed_cost_wizard.js
+++ b/erpnext/stock/doctype/landed_cost_wizard/landed_cost_wizard.js
@@ -25,8 +25,6 @@
filters:[
['Account', 'group_or_ledger', '=', 'Ledger'],
['Account', 'account_type', 'in', 'Tax, Chargeable'],
- ['Account', 'is_pl_account', '=', 'Yes'],
- ['Account', 'debit_or_credit', '=', 'Debit'],
['Account', 'company', '=', me.frm.doc.company]
]
}
diff --git a/erpnext/stock/doctype/material_request/material_request.js b/erpnext/stock/doctype/material_request/material_request.js
index c7eb888..c830775 100644
--- a/erpnext/stock/doctype/material_request/material_request.js
+++ b/erpnext/stock/doctype/material_request/material_request.js
@@ -8,6 +8,16 @@
{% include 'utilities/doctype/sms_control/sms_control.js' %}
erpnext.buying.MaterialRequestController = erpnext.buying.BuyingController.extend({
+ onload: function(doc) {
+ this._super();
+ this.frm.set_query("item_code", this.frm.cscript.fname, function() {
+ return {
+ query: "erpnext.controllers.queries.item_query",
+ filters: {'is_stock_item': 'Yes'}
+ }
+ });
+ },
+
refresh: function(doc) {
this._super();
@@ -177,4 +187,4 @@
cur_frm.refresh();
});
}
-};
+};
\ No newline at end of file
diff --git a/erpnext/stock/doctype/warehouse/warehouse.js b/erpnext/stock/doctype/warehouse/warehouse.js
index ac6ac63..e9df13c 100644
--- a/erpnext/stock/doctype/warehouse/warehouse.js
+++ b/erpnext/stock/doctype/warehouse/warehouse.js
@@ -9,7 +9,6 @@
return {
filters: {
"company": cur_frm.doc.company,
- "debit_or_credit": "Debit",
'group_or_ledger': "Group"
}
}