Merge pull request #3150 from rmehta/is_group
[rename] group_or_ledger to is_group
This commit is contained in:
commit
ffa6d94f7a
@ -12,12 +12,12 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
||||
cur_frm.toggle_display('account_name', doc.__islocal);
|
||||
|
||||
// hide fields if group
|
||||
cur_frm.toggle_display(['account_type', 'tax_rate'], doc.group_or_ledger=='Ledger')
|
||||
cur_frm.toggle_display(['account_type', 'tax_rate'], cint(doc.is_group)==0)
|
||||
|
||||
// disable fields
|
||||
cur_frm.toggle_enable(['account_name', 'group_or_ledger', 'company'], false);
|
||||
cur_frm.toggle_enable(['account_name', 'is_group', 'company'], false);
|
||||
|
||||
if(doc.group_or_ledger=='Ledger') {
|
||||
if(cint(doc.is_group)==0) {
|
||||
cur_frm.toggle_display('freeze_account', doc.__onload && doc.__onload.can_freeze_account);
|
||||
}
|
||||
|
||||
@ -40,7 +40,7 @@ cur_frm.add_fetch('parent_account', 'report_type', 'report_type');
|
||||
cur_frm.add_fetch('parent_account', 'root_type', 'root_type');
|
||||
|
||||
cur_frm.cscript.account_type = function(doc, cdt, cdn) {
|
||||
if(doc.group_or_ledger=='Ledger') {
|
||||
if(doc.is_group==0) {
|
||||
cur_frm.toggle_display(['tax_rate'], doc.account_type == 'Tax');
|
||||
cur_frm.toggle_display('warehouse', doc.account_type=='Warehouse');
|
||||
}
|
||||
@ -50,10 +50,10 @@ cur_frm.cscript.add_toolbar_buttons = function(doc) {
|
||||
cur_frm.add_custom_button(__('Chart of Accounts'),
|
||||
function() { frappe.set_route("Accounts Browser", "Account"); }, 'icon-sitemap')
|
||||
|
||||
if (cstr(doc.group_or_ledger) == 'Group') {
|
||||
cur_frm.add_custom_button(__('Convert to Ledger'),
|
||||
if (doc.is_group == 1) {
|
||||
cur_frm.add_custom_button(__('Convert to non-Group'),
|
||||
function() { cur_frm.cscript.convert_to_ledger(); }, 'icon-retweet', 'btn-default');
|
||||
} else if (cstr(doc.group_or_ledger) == 'Ledger') {
|
||||
} else if (cint(doc.is_group) == 0) {
|
||||
cur_frm.add_custom_button(__('View Ledger'), function() {
|
||||
frappe.route_options = {
|
||||
"account": doc.name,
|
||||
@ -88,7 +88,7 @@ cur_frm.cscript.convert_to_group = function(doc, cdt, cdn) {
|
||||
cur_frm.fields_dict['parent_account'].get_query = function(doc) {
|
||||
return {
|
||||
filters: {
|
||||
"group_or_ledger": "Group",
|
||||
"is_group": 1,
|
||||
"company": doc.company
|
||||
}
|
||||
}
|
||||
|
@ -38,18 +38,12 @@
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"default": "Ledger",
|
||||
"fieldname": "group_or_ledger",
|
||||
"fieldtype": "Select",
|
||||
"in_filter": 1,
|
||||
"in_list_view": 1,
|
||||
"label": "Group or Ledger",
|
||||
"oldfieldname": "group_or_ledger",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "\nLedger\nGroup",
|
||||
"default": "0",
|
||||
"fieldname": "is_group",
|
||||
"fieldtype": "Check",
|
||||
"label": "Is Group",
|
||||
"permlevel": 0,
|
||||
"read_only": 1,
|
||||
"reqd": 1,
|
||||
"precision": "",
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
@ -177,7 +171,7 @@
|
||||
"icon": "icon-money",
|
||||
"idx": 1,
|
||||
"in_create": 0,
|
||||
"modified": "2015-02-20 05:09:22.108350",
|
||||
"modified": "2015-04-23 02:53:48.056520",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Account",
|
||||
@ -261,5 +255,5 @@
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"search_fields": "group_or_ledger"
|
||||
"search_fields": "is_group"
|
||||
}
|
@ -32,12 +32,12 @@ class Account(Document):
|
||||
"""Fetch Parent Details and validate parent account"""
|
||||
if self.parent_account:
|
||||
par = frappe.db.get_value("Account", self.parent_account,
|
||||
["name", "group_or_ledger", "report_type", "root_type", "company"], as_dict=1)
|
||||
["name", "is_group", "report_type", "root_type", "company"], as_dict=1)
|
||||
if not par:
|
||||
throw(_("Account {0}: Parent account {1} does not exist").format(self.name, self.parent_account))
|
||||
elif par.name == self.name:
|
||||
throw(_("Account {0}: You can not assign itself as parent account").format(self.name))
|
||||
elif par.group_or_ledger != 'Group':
|
||||
elif not par.is_group:
|
||||
throw(_("Account {0}: Parent account {1} can not be a ledger").format(self.name, self.parent_account))
|
||||
elif par.company != self.company:
|
||||
throw(_("Account {0}: Parent account {1} does not belong to company: {2}")
|
||||
@ -78,7 +78,7 @@ class Account(Document):
|
||||
elif self.check_gle_exists():
|
||||
throw(_("Account with existing transaction cannot be converted to ledger"))
|
||||
else:
|
||||
self.group_or_ledger = 'Ledger'
|
||||
self.is_group = 0
|
||||
self.save()
|
||||
return 1
|
||||
|
||||
@ -88,7 +88,7 @@ class Account(Document):
|
||||
elif self.account_type:
|
||||
throw(_("Cannot covert to Group because Account Type is selected."))
|
||||
else:
|
||||
self.group_or_ledger = 'Group'
|
||||
self.is_group = 1
|
||||
self.save()
|
||||
return 1
|
||||
|
||||
@ -160,10 +160,10 @@ class Account(Document):
|
||||
throw(_("Account {0} does not exist").format(new))
|
||||
|
||||
val = list(frappe.db.get_value("Account", new_account,
|
||||
["group_or_ledger", "root_type", "company"]))
|
||||
["is_group", "root_type", "company"]))
|
||||
|
||||
if val != [self.group_or_ledger, self.root_type, self.company]:
|
||||
throw(_("""Merging is only possible if following properties are same in both records. Group or Ledger, Root Type, Company"""))
|
||||
if val != [self.is_group, self.root_type, self.company]:
|
||||
throw(_("""Merging is only possible if following properties are same in both records. Is Group, Root Type, Company"""))
|
||||
|
||||
return new_account
|
||||
|
||||
@ -177,7 +177,7 @@ class Account(Document):
|
||||
|
||||
def get_parent_account(doctype, txt, searchfield, start, page_len, filters):
|
||||
return frappe.db.sql("""select name from tabAccount
|
||||
where group_or_ledger = 'Group' and docstatus != 2 and company = %s
|
||||
where is_group = 1 and docstatus != 2 and company = %s
|
||||
and %s like %s order by name limit %s, %s""" %
|
||||
("%s", searchfield, "%s", "%s", "%s"),
|
||||
(filters["company"], "%%%s%%" % txt, start, page_len), as_list=1)
|
||||
|
@ -13,18 +13,18 @@ def create_charts(chart_name, company):
|
||||
accounts = []
|
||||
|
||||
def _import_accounts(children, parent, root_type, root_account=False):
|
||||
for account_name, children in children.items():
|
||||
for account_name, child in children.items():
|
||||
if root_account:
|
||||
root_type = children.get("root_type")
|
||||
root_type = child.get("root_type")
|
||||
|
||||
if account_name not in ["account_type", "root_type", "group_or_ledger"]:
|
||||
if account_name not in ["account_type", "root_type", "is_group"]:
|
||||
|
||||
account_name_in_db = unidecode(account_name.strip().lower())
|
||||
if account_name_in_db in accounts:
|
||||
count = accounts.count(account_name_in_db)
|
||||
account_name = account_name + " " + cstr(count)
|
||||
|
||||
group_or_ledger = identify_group_or_ledger(children)
|
||||
is_group = identify_is_group(child)
|
||||
report_type = "Balance Sheet" if root_type in ["Asset", "Liability", "Equity"] \
|
||||
else "Profit and Loss"
|
||||
|
||||
@ -33,10 +33,10 @@ def create_charts(chart_name, company):
|
||||
"account_name": account_name,
|
||||
"company": company,
|
||||
"parent_account": parent,
|
||||
"group_or_ledger": group_or_ledger,
|
||||
"is_group": is_group,
|
||||
"root_type": root_type,
|
||||
"report_type": report_type,
|
||||
"account_type": children.get("account_type")
|
||||
"account_type": child.get("account_type")
|
||||
})
|
||||
|
||||
if root_account:
|
||||
@ -46,19 +46,19 @@ def create_charts(chart_name, company):
|
||||
|
||||
accounts.append(account_name_in_db)
|
||||
|
||||
_import_accounts(children, account.name, root_type)
|
||||
_import_accounts(child, account.name, root_type)
|
||||
|
||||
_import_accounts(chart, None, None, root_account=True)
|
||||
|
||||
def identify_group_or_ledger(children):
|
||||
if children.get("group_or_ledger"):
|
||||
group_or_ledger = children.get("group_or_ledger")
|
||||
elif len(set(children.keys()) - set(["account_type", "root_type", "group_or_ledger"])):
|
||||
group_or_ledger = "Group"
|
||||
def identify_is_group(child):
|
||||
if child.get("is_group"):
|
||||
is_group = child.get("is_group")
|
||||
elif len(set(child.keys()) - set(["account_type", "root_type", "is_group"])):
|
||||
is_group = 1
|
||||
else:
|
||||
group_or_ledger = "Ledger"
|
||||
is_group = 0
|
||||
|
||||
return group_or_ledger
|
||||
return is_group
|
||||
|
||||
def get_chart(chart_name):
|
||||
chart = {}
|
||||
|
@ -85,7 +85,7 @@
|
||||
},
|
||||
"Stock in Hand": {
|
||||
"account_type": "Stock",
|
||||
"group_or_ledger": "Group"
|
||||
"is_group": 1
|
||||
}
|
||||
},
|
||||
"Perliminary and Preoperating Expenses": {
|
||||
@ -326,7 +326,7 @@
|
||||
},
|
||||
"Duties and Taxes": {
|
||||
"account_type": "Tax",
|
||||
"group_or_ledger": "Group"
|
||||
"is_group": 1
|
||||
},
|
||||
"Accruals & Provisions": {
|
||||
"Accruals": {
|
||||
|
@ -12,7 +12,7 @@
|
||||
},
|
||||
"Bank Accounts": {
|
||||
"account_type": "Bank",
|
||||
"group_or_ledger": "Group"
|
||||
"is_group": 1
|
||||
},
|
||||
"Cash In Hand": {
|
||||
"Cash": {
|
||||
@ -21,17 +21,17 @@
|
||||
"account_type": "Cash"
|
||||
},
|
||||
"Loans and Advances (Assets)": {
|
||||
"group_or_ledger": "Group"
|
||||
"is_group": 1
|
||||
},
|
||||
"Securities and Deposits": {
|
||||
"Earnest Money": {}
|
||||
},
|
||||
"Stock Assets": {
|
||||
"account_type": "Stock",
|
||||
"group_or_ledger": "Group"
|
||||
"is_group": 1
|
||||
},
|
||||
"Tax Assets": {
|
||||
"group_or_ledger": "Group"
|
||||
"is_group": 1
|
||||
}
|
||||
},
|
||||
"Fixed Assets": {
|
||||
@ -52,7 +52,7 @@
|
||||
}
|
||||
},
|
||||
"Investments": {
|
||||
"group_or_ledger": "Group"
|
||||
"is_group": 1
|
||||
},
|
||||
"Temporary Accounts (Assets)": {
|
||||
"Temporary Assets": {}
|
||||
@ -146,7 +146,7 @@
|
||||
},
|
||||
"Indirect Income": {
|
||||
"account_type": "Income Account",
|
||||
"group_or_ledger": "Group"
|
||||
"is_group": 1
|
||||
},
|
||||
"root_type": "Income"
|
||||
},
|
||||
@ -168,7 +168,7 @@
|
||||
},
|
||||
"Duties and Taxes": {
|
||||
"account_type": "Tax",
|
||||
"group_or_ledger": "Group"
|
||||
"is_group": 1
|
||||
},
|
||||
"Loans (Liabilities)": {
|
||||
"Secured Loans": {},
|
||||
|
@ -32,7 +32,7 @@
|
||||
}
|
||||
},
|
||||
"Otros Equivalentes a Efectivo": {
|
||||
"group_or_ledger": "Group",
|
||||
"is_group": 1,
|
||||
"account_type": "Cash"
|
||||
}
|
||||
},
|
||||
@ -61,7 +61,7 @@
|
||||
"Estimacion para Cuentas Incobrables": {}
|
||||
},
|
||||
"Inventarios": {
|
||||
"group_or_ledger": "Group",
|
||||
"is_group": 1,
|
||||
"account_type": "Stock"
|
||||
},
|
||||
"Impuestos Acreditables": {
|
||||
@ -90,7 +90,7 @@
|
||||
"Retenciones Definitivas Sobre Rentas o Ganancias de Capital": {}
|
||||
},
|
||||
"Otras Cuentas por Cobrar": {
|
||||
"group_or_ledger": "Group",
|
||||
"is_group": 1,
|
||||
"account_type": "Receivable"
|
||||
}
|
||||
},
|
||||
@ -110,11 +110,11 @@
|
||||
},
|
||||
"Inversiones Permanentes": {
|
||||
"Inversiones Permanentes": {
|
||||
"group_or_ledger": "Group",
|
||||
"is_group": 1,
|
||||
"account_type": "Fixed Asset"
|
||||
},
|
||||
"Negocios Conjuntos": {
|
||||
"group_or_ledger": "Group",
|
||||
"is_group": 1,
|
||||
"account_type": "Fixed Asset"
|
||||
}
|
||||
},
|
||||
@ -124,25 +124,25 @@
|
||||
},
|
||||
"Activos Intangibles": {
|
||||
"Patentes": {
|
||||
"group_or_ledger": "Group"
|
||||
"is_group": 1
|
||||
},
|
||||
"Marcas Registradas": {
|
||||
"group_or_ledger": "Group"
|
||||
"is_group": 1
|
||||
},
|
||||
"Derechos de Autor": {
|
||||
"group_or_ledger": "Group"
|
||||
"is_group": 1
|
||||
},
|
||||
"Concesiones": {
|
||||
"group_or_ledger": "Group"
|
||||
"is_group": 1
|
||||
},
|
||||
"Licencias": {
|
||||
"group_or_ledger": "Group"
|
||||
"is_group": 1
|
||||
},
|
||||
"Gastos de investigacion": {
|
||||
"group_or_ledger": "Group"
|
||||
"is_group": 1
|
||||
},
|
||||
"Amortizacion de Activos Intangibles": {
|
||||
"group_or_ledger": "Group"
|
||||
"is_group": 1
|
||||
},
|
||||
"Deterioro de Valor de Activos Intangibles": {}
|
||||
},
|
||||
@ -150,29 +150,29 @@
|
||||
"Gastos de Consitucion": {},
|
||||
"Gastos Pre Operativos": {},
|
||||
"Mejoras en Bienes Arrendados": {
|
||||
"group_or_ledger": "Group"
|
||||
"is_group": 1
|
||||
},
|
||||
"Amortizacion de Activos Amortizables": {},
|
||||
"Deterioro de Valaor de Activos Amortizables": {}
|
||||
},
|
||||
"Cuentas por Cobrar a Largo Plazo": {
|
||||
"Creditos a Largo Plazo": {
|
||||
"group_or_ledger": "Group"
|
||||
"is_group": 1
|
||||
}
|
||||
},
|
||||
"Inversiones a Largo Plazo": {
|
||||
"Depositos Bancarios a Plazo": {
|
||||
"group_or_ledger": "Group"
|
||||
"is_group": 1
|
||||
},
|
||||
"Intereses percibidos por adelantado": {
|
||||
"group_or_ledger": "Group"
|
||||
"is_group": 1
|
||||
},
|
||||
"Titulos y Acciones": {
|
||||
"group_or_ledger": "Group"
|
||||
"is_group": 1
|
||||
}
|
||||
},
|
||||
"Activo por Impuestos Diferidos": {
|
||||
"group_or_ledger": "Group"
|
||||
"is_group": 1
|
||||
}
|
||||
},
|
||||
"root_type": "Asset"
|
||||
@ -199,21 +199,21 @@
|
||||
"Anticipos de Clientes": {},
|
||||
"Pasivos Financieros a Corto Plazo": {
|
||||
"Prestamos por Pagar a Corto Plazo": {
|
||||
"group_or_ledger": "Group"
|
||||
"is_group": 1
|
||||
},
|
||||
"Sobregiros Bancarios": {
|
||||
"group_or_ledger": "Group"
|
||||
"is_group": 1
|
||||
},
|
||||
"Otras Deudas Bancarias": {
|
||||
"group_or_ledger": "Group"
|
||||
"is_group": 1
|
||||
}
|
||||
},
|
||||
"Gastos por Pagar": {
|
||||
"Servicios Basicos": {
|
||||
"group_or_ledger": "Group"
|
||||
"is_group": 1
|
||||
},
|
||||
"Prestaciones Sociales": {
|
||||
"group_or_ledger": "Group"
|
||||
"is_group": 1
|
||||
},
|
||||
"Salarios por Pagar": {}
|
||||
},
|
||||
@ -287,28 +287,28 @@
|
||||
}
|
||||
},
|
||||
"Otras Cuentas por Pagar": {
|
||||
"group_or_ledger": "Group"
|
||||
"is_group": 1
|
||||
}
|
||||
},
|
||||
"Pasivo No Corriente": {
|
||||
"Prestamos a Largo Plazo": {
|
||||
"group_or_ledger": "Group"
|
||||
"is_group": 1
|
||||
},
|
||||
"Cuentas por Pagar a Largo Plaso": {
|
||||
"group_or_ledger": "Group"
|
||||
"is_group": 1
|
||||
},
|
||||
"Otras Cuentas por Pagar a Largo Plazo": {
|
||||
"group_or_ledger": "Group"
|
||||
"is_group": 1
|
||||
},
|
||||
"Otros Pasivos Financieros a Largo Plaso": {
|
||||
"group_or_ledger": "Group"
|
||||
"is_group": 1
|
||||
}
|
||||
},
|
||||
"Obligaciones por Arrendamiento Financiero a Largo Plazo": {
|
||||
"group_or_ledger": "Group"
|
||||
"is_group": 1
|
||||
},
|
||||
"Pasivo por Impuestos Diferidos": {
|
||||
"group_or_ledger": "Group"
|
||||
"is_group": 1
|
||||
},
|
||||
"root_type": "Liability"
|
||||
},
|
||||
@ -324,7 +324,7 @@
|
||||
}
|
||||
},
|
||||
"Donaciones": {
|
||||
"group_or_ledger": "Group"
|
||||
"is_group": 1
|
||||
},
|
||||
"Ganancias Acumuladas": {
|
||||
"Reservas": {
|
||||
|
@ -15,7 +15,7 @@ def get():
|
||||
},
|
||||
_("Bank Accounts"): {
|
||||
"account_type": "Bank",
|
||||
"group_or_ledger": "Group"
|
||||
"is_group": 1
|
||||
},
|
||||
_("Cash In Hand"): {
|
||||
_("Cash"): {
|
||||
@ -24,17 +24,17 @@ def get():
|
||||
"account_type": "Cash"
|
||||
},
|
||||
_("Loans and Advances (Assets)"): {
|
||||
"group_or_ledger": "Group"
|
||||
"is_group": 1
|
||||
},
|
||||
_("Securities and Deposits"): {
|
||||
_("Earnest Money"): {}
|
||||
},
|
||||
_("Stock Assets"): {
|
||||
"account_type": "Stock",
|
||||
"group_or_ledger": "Group"
|
||||
"is_group": 1
|
||||
},
|
||||
_("Tax Assets"): {
|
||||
"group_or_ledger": "Group"
|
||||
"is_group": 1
|
||||
}
|
||||
},
|
||||
_("Fixed Assets"): {
|
||||
@ -55,7 +55,7 @@ def get():
|
||||
}
|
||||
},
|
||||
_("Investments"): {
|
||||
"group_or_ledger": "Group"
|
||||
"is_group": 1
|
||||
},
|
||||
_("Temporary Accounts (Assets)"): {
|
||||
_("Temporary Assets"): {}
|
||||
@ -149,7 +149,7 @@ def get():
|
||||
},
|
||||
_("Indirect Income"): {
|
||||
"account_type": "Income Account",
|
||||
"group_or_ledger": "Group"
|
||||
"is_group": 1
|
||||
},
|
||||
"root_type": "Income"
|
||||
},
|
||||
@ -167,7 +167,7 @@ def get():
|
||||
},
|
||||
_("Duties and Taxes"): {
|
||||
"account_type": "Tax",
|
||||
"group_or_ledger": "Group"
|
||||
"is_group": 1
|
||||
},
|
||||
_("Loans (Liabilities)"): {
|
||||
_("Secured Loans"): {},
|
||||
|
@ -8,37 +8,37 @@ def _make_test_records(verbose):
|
||||
from frappe.test_runner import make_test_objects
|
||||
|
||||
accounts = [
|
||||
# [account_name, parent_account, group_or_ledger]
|
||||
["_Test Account Bank Account", "Bank Accounts", "Ledger", "Bank"],
|
||||
# [account_name, parent_account, is_group]
|
||||
["_Test Account Bank Account", "Bank Accounts", 0, "Bank"],
|
||||
|
||||
["_Test Account Stock Expenses", "Direct Expenses", "Group", None],
|
||||
["_Test Account Shipping Charges", "_Test Account Stock Expenses", "Ledger", "Chargeable"],
|
||||
["_Test Account Customs Duty", "_Test Account Stock Expenses", "Ledger", "Tax"],
|
||||
["_Test Account Insurance Charges", "_Test Account Stock Expenses", "Ledger", "Chargeable"],
|
||||
["_Test Account Stock Adjustment", "_Test Account Stock Expenses", "Ledger", "Stock Adjustment"],
|
||||
["_Test Account Stock Expenses", "Direct Expenses", 1, None],
|
||||
["_Test Account Shipping Charges", "_Test Account Stock Expenses", 0, "Chargeable"],
|
||||
["_Test Account Customs Duty", "_Test Account Stock Expenses", 0, "Tax"],
|
||||
["_Test Account Insurance Charges", "_Test Account Stock Expenses", 0, "Chargeable"],
|
||||
["_Test Account Stock Adjustment", "_Test Account Stock Expenses", 0, "Stock Adjustment"],
|
||||
|
||||
|
||||
["_Test Account Tax Assets", "Current Assets", "Group", None],
|
||||
["_Test Account VAT", "_Test Account Tax Assets", "Ledger", "Tax"],
|
||||
["_Test Account Service Tax", "_Test Account Tax Assets", "Ledger", "Tax"],
|
||||
["_Test Account Tax Assets", "Current Assets", 1, None],
|
||||
["_Test Account VAT", "_Test Account Tax Assets", 0, "Tax"],
|
||||
["_Test Account Service Tax", "_Test Account Tax Assets", 0, "Tax"],
|
||||
|
||||
["_Test Account Reserves and Surplus", "Current Liabilities", "Ledger", None],
|
||||
["_Test Account Reserves and Surplus", "Current Liabilities", 0, None],
|
||||
|
||||
["_Test Account Cost for Goods Sold", "Expenses", "Ledger", None],
|
||||
["_Test Account Excise Duty", "_Test Account Tax Assets", "Ledger", "Tax"],
|
||||
["_Test Account Education Cess", "_Test Account Tax Assets", "Ledger", "Tax"],
|
||||
["_Test Account S&H Education Cess", "_Test Account Tax Assets", "Ledger", "Tax"],
|
||||
["_Test Account CST", "Direct Expenses", "Ledger", "Tax"],
|
||||
["_Test Account Discount", "Direct Expenses", "Ledger", None],
|
||||
["_Test Write Off", "Indirect Expenses", "Ledger", None],
|
||||
["_Test Account Cost for Goods Sold", "Expenses", 0, None],
|
||||
["_Test Account Excise Duty", "_Test Account Tax Assets", 0, "Tax"],
|
||||
["_Test Account Education Cess", "_Test Account Tax Assets", 0, "Tax"],
|
||||
["_Test Account S&H Education Cess", "_Test Account Tax Assets", 0, "Tax"],
|
||||
["_Test Account CST", "Direct Expenses", 0, "Tax"],
|
||||
["_Test Account Discount", "Direct Expenses", 0, None],
|
||||
["_Test Write Off", "Indirect Expenses", 0, None],
|
||||
|
||||
# related to Account Inventory Integration
|
||||
["_Test Account Stock In Hand", "Current Assets", "Ledger", None],
|
||||
["_Test Account Fixed Assets", "Current Assets", "Ledger", None],
|
||||
["_Test Account Stock In Hand", "Current Assets", 0, None],
|
||||
["_Test Account Fixed Assets", "Current Assets", 0, None],
|
||||
|
||||
# Receivable / Payable Account
|
||||
["_Test Receivable", "Current Assets", "Ledger", "Receivable"],
|
||||
["_Test Payable", "Current Liabilities", "Ledger", "Payable"],
|
||||
["_Test Receivable", "Current Assets", 0, "Receivable"],
|
||||
["_Test Payable", "Current Liabilities", 0, "Payable"],
|
||||
]
|
||||
|
||||
for company, abbr in [["_Test Company", "_TC"], ["_Test Company 1", "_TC1"]]:
|
||||
@ -47,8 +47,8 @@ def _make_test_records(verbose):
|
||||
"account_name": account_name,
|
||||
"parent_account": parent_account + " - " + abbr,
|
||||
"company": company,
|
||||
"group_or_ledger": group_or_ledger,
|
||||
"is_group": is_group,
|
||||
"account_type": account_type
|
||||
} for account_name, parent_account, group_or_ledger, account_type in accounts])
|
||||
} for account_name, parent_account, is_group, account_type in accounts])
|
||||
|
||||
return test_objects
|
||||
|
@ -26,7 +26,7 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
||||
return {
|
||||
"filters": {
|
||||
"account_type": "Bank",
|
||||
"group_or_ledger": "Ledger"
|
||||
"is_group": 0
|
||||
}
|
||||
};
|
||||
});
|
||||
|
@ -18,7 +18,7 @@ erpnext.accounts.CostCenterController = frappe.ui.form.Controller.extend({
|
||||
filters:[
|
||||
['Account', 'company', '=', me.frm.doc.company],
|
||||
['Account', 'report_type', '=', 'Profit and Loss'],
|
||||
['Account', 'group_or_ledger', '=', 'Ledger'],
|
||||
['Account', 'is_group', '=', '0'],
|
||||
]
|
||||
}
|
||||
});
|
||||
@ -27,7 +27,7 @@ erpnext.accounts.CostCenterController = frappe.ui.form.Controller.extend({
|
||||
this.frm.set_query("parent_cost_center", function() {
|
||||
return {
|
||||
filters:[
|
||||
['Cost Center', 'group_or_ledger', '=', 'Group'],
|
||||
['Cost Center', 'is_group', '=', '1'],
|
||||
['Cost Center', 'company', '=', me.frm.doc.company],
|
||||
]
|
||||
}
|
||||
@ -40,15 +40,15 @@ $.extend(cur_frm.cscript, new erpnext.accounts.CostCenterController({frm: cur_fr
|
||||
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
||||
var intro_txt = '';
|
||||
cur_frm.toggle_display('cost_center_name', doc.__islocal);
|
||||
cur_frm.toggle_enable(['group_or_ledger', 'company'], doc.__islocal);
|
||||
cur_frm.toggle_enable(['is_group', 'company'], doc.__islocal);
|
||||
|
||||
if(!doc.__islocal && doc.group_or_ledger=='Group') {
|
||||
if(!doc.__islocal && doc.is_group==1) {
|
||||
intro_txt += __('Note: This Cost Center is a Group. Cannot make accounting entries against groups.');
|
||||
}
|
||||
|
||||
cur_frm.cscript.hide_unhide_group_ledger(doc);
|
||||
|
||||
cur_frm.toggle_display('sb1', doc.group_or_ledger=='Ledger')
|
||||
cur_frm.toggle_display('sb1', doc.is_group==0)
|
||||
cur_frm.set_intro(intro_txt);
|
||||
|
||||
cur_frm.add_custom_button(__('Chart of Cost Centers'),
|
||||
@ -62,11 +62,11 @@ cur_frm.cscript.parent_cost_center = function(doc, cdt, cdn) {
|
||||
}
|
||||
|
||||
cur_frm.cscript.hide_unhide_group_ledger = function(doc) {
|
||||
if (cstr(doc.group_or_ledger) == 'Group') {
|
||||
cur_frm.add_custom_button(__('Convert to Ledger'),
|
||||
if (doc.is_group == 1) {
|
||||
cur_frm.add_custom_button(__('Convert to non-Group'),
|
||||
function() { cur_frm.cscript.convert_to_ledger(); }, 'icon-retweet',
|
||||
"btn-default")
|
||||
} else if (cstr(doc.group_or_ledger) == 'Ledger') {
|
||||
} else if (doc.is_group == 0) {
|
||||
cur_frm.add_custom_button(__('Convert to Group'),
|
||||
function() { cur_frm.cscript.convert_to_group(); }, 'icon-retweet',
|
||||
"btn-default")
|
||||
|
@ -58,18 +58,12 @@
|
||||
"width": "50%"
|
||||
},
|
||||
{
|
||||
"fieldname": "group_or_ledger",
|
||||
"fieldtype": "Select",
|
||||
"hidden": 0,
|
||||
"label": "Group or Ledger",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "group_or_ledger",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "\nGroup\nLedger",
|
||||
"default": "0",
|
||||
"fieldname": "is_group",
|
||||
"fieldtype": "Check",
|
||||
"label": "Is Group",
|
||||
"permlevel": 0,
|
||||
"print_hide": 1,
|
||||
"report_hide": 1,
|
||||
"reqd": 1
|
||||
"precision": ""
|
||||
},
|
||||
{
|
||||
"description": "Define Budget for this Cost Center. To set budget action, see <a href=\"#!List/Company\">Company Master</a>",
|
||||
@ -145,7 +139,7 @@
|
||||
"icon": "icon-money",
|
||||
"idx": 1,
|
||||
"in_create": 0,
|
||||
"modified": "2015-02-20 05:07:59.251051",
|
||||
"modified": "2015-04-23 02:54:26.934607",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Cost Center",
|
||||
@ -198,5 +192,5 @@
|
||||
"role": "Material User"
|
||||
}
|
||||
],
|
||||
"search_fields": "parent_cost_center"
|
||||
"search_fields": "parent_cost_center, is_group"
|
||||
}
|
@ -16,9 +16,6 @@ class CostCenter(NestedSet):
|
||||
frappe.db.get_value("Company", self.company, "abbr")
|
||||
|
||||
def validate_mandatory(self):
|
||||
if not self.group_or_ledger:
|
||||
msgprint(_("Please select Group or Ledger value"), raise_exception=1)
|
||||
|
||||
if self.cost_center_name != self.company and not self.parent_cost_center:
|
||||
msgprint(_("Please enter parent cost center"), raise_exception=1)
|
||||
elif self.cost_center_name == self.company and self.parent_cost_center:
|
||||
@ -30,7 +27,7 @@ class CostCenter(NestedSet):
|
||||
elif self.check_gle_exists():
|
||||
msgprint(_("Cost Center with existing transactions can not be converted to ledger"), raise_exception=1)
|
||||
else:
|
||||
self.group_or_ledger = 'Ledger'
|
||||
self.is_group = 0
|
||||
self.save()
|
||||
return 1
|
||||
|
||||
@ -38,7 +35,7 @@ class CostCenter(NestedSet):
|
||||
if self.check_gle_exists():
|
||||
msgprint(_("Cost Center with existing transactions can not be converted to group"), raise_exception=1)
|
||||
else:
|
||||
self.group_or_ledger = 'Group'
|
||||
self.is_group = 1
|
||||
self.save()
|
||||
return 1
|
||||
|
||||
@ -52,7 +49,7 @@ class CostCenter(NestedSet):
|
||||
def validate_budget_details(self):
|
||||
check_acc_list = []
|
||||
for d in self.get('budgets'):
|
||||
if self.group_or_ledger=="Group":
|
||||
if self.is_group==1:
|
||||
msgprint(_("Budget cannot be set for Group Cost Centers"), raise_exception=1)
|
||||
|
||||
if [d.account, d.fiscal_year] in check_acc_list:
|
||||
@ -70,7 +67,7 @@ class CostCenter(NestedSet):
|
||||
new_cost_center = get_name_with_abbr(newdn, self.company)
|
||||
|
||||
# Validate properties before merging
|
||||
super(CostCenter, self).before_rename(olddn, new_cost_center, merge, "group_or_ledger")
|
||||
super(CostCenter, self).before_rename(olddn, new_cost_center, merge, "is_group")
|
||||
|
||||
return new_cost_center
|
||||
|
||||
|
@ -13,21 +13,21 @@
|
||||
"cost_center_name": "_Test Cost Center",
|
||||
"distribution_id": "_Test Distribution",
|
||||
"doctype": "Cost Center",
|
||||
"group_or_ledger": "Ledger",
|
||||
"is_group": 0,
|
||||
"parent_cost_center": "_Test Company - _TC"
|
||||
},
|
||||
{
|
||||
"company": "_Test Company",
|
||||
"cost_center_name": "_Test Cost Center 2",
|
||||
"doctype": "Cost Center",
|
||||
"group_or_ledger": "Ledger",
|
||||
"is_group": 0,
|
||||
"parent_cost_center": "_Test Company - _TC"
|
||||
},
|
||||
{
|
||||
"company": "_Test Company",
|
||||
"cost_center_name": "_Test Write Off Cost Center",
|
||||
"doctype": "Cost Center",
|
||||
"group_or_ledger": "Ledger",
|
||||
"is_group": 0,
|
||||
"parent_cost_center": "_Test Company - _TC"
|
||||
}
|
||||
]
|
||||
|
@ -63,10 +63,10 @@ class GLEntry(Document):
|
||||
def validate_account_details(self, adv_adj):
|
||||
"""Account must be ledger, active and not freezed"""
|
||||
|
||||
ret = frappe.db.sql("""select group_or_ledger, docstatus, company
|
||||
ret = frappe.db.sql("""select is_group, docstatus, company
|
||||
from tabAccount where name=%s""", self.account, as_dict=1)[0]
|
||||
|
||||
if ret.group_or_ledger=='Group':
|
||||
if ret.is_group==1:
|
||||
frappe.throw(_("Account {0} cannot be a Group").format(self.account))
|
||||
|
||||
if ret.docstatus==2:
|
||||
|
@ -36,7 +36,7 @@ erpnext.accounts.JournalVoucher = frappe.ui.form.Controller.extend({
|
||||
return {
|
||||
filters: {
|
||||
company: me.frm.doc.company,
|
||||
group_or_ledger: "Ledger"
|
||||
is_group: 0
|
||||
}
|
||||
};
|
||||
});
|
||||
|
@ -546,7 +546,7 @@ def get_payment_entry(doc):
|
||||
def get_opening_accounts(company):
|
||||
"""get all balance sheet accounts for opening entry"""
|
||||
accounts = frappe.db.sql_list("""select name from tabAccount
|
||||
where group_or_ledger='Ledger' and report_type='Balance Sheet' and company=%s""", company)
|
||||
where is_group=0 and report_type='Balance Sheet' and company=%s""", company)
|
||||
|
||||
return [{"account": a, "balance": get_balance_on(a)} for a in accounts]
|
||||
|
||||
|
@ -5,7 +5,7 @@ cur_frm.set_query("default_account", "accounts", function(doc, cdt, cdn) {
|
||||
return{
|
||||
filters: [
|
||||
['Account', 'account_type', 'in', 'Bank, Cash'],
|
||||
['Account', 'group_or_ledger', '=', 'Ledger'],
|
||||
['Account', 'is_group', '=', 0],
|
||||
['Account', 'company', '=', doc.company]
|
||||
]
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ erpnext.accounts.PaymentReconciliationController = frappe.ui.form.Controller.ext
|
||||
return{
|
||||
filters: {
|
||||
"company": me.frm.doc.company,
|
||||
"group_or_ledger": "Ledger",
|
||||
"is_group": 0,
|
||||
"account_type": (me.frm.doc.party_type == "Customer" ? "Receivable" : "Payable")
|
||||
}
|
||||
};
|
||||
@ -37,7 +37,7 @@ erpnext.accounts.PaymentReconciliationController = frappe.ui.form.Controller.ext
|
||||
return{
|
||||
filters:[
|
||||
['Account', 'company', '=', me.frm.doc.company],
|
||||
['Account', 'group_or_ledger', '=', 'Ledger'],
|
||||
['Account', 'is_group', '=', 0],
|
||||
['Account', 'account_type', 'in', ['Bank', 'Cash']]
|
||||
]
|
||||
};
|
||||
|
@ -18,7 +18,7 @@ frappe.ui.form.on("Payment Tool", "onload", function(frm) {
|
||||
return {
|
||||
filters: {
|
||||
"account_type": ["in", ["Bank", "Cash"]],
|
||||
"group_or_ledger": "Ledger",
|
||||
"is_group": 0,
|
||||
"company": frm.doc.company
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ cur_frm.fields_dict['closing_account_head'].get_query = function(doc, cdt, cdn)
|
||||
"company": doc.company,
|
||||
"report_type": "Balance Sheet",
|
||||
"freeze_account": "No",
|
||||
"group_or_ledger": "Ledger"
|
||||
"is_group": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ cur_frm.fields_dict['cash_bank_account'].get_query = function(doc,cdt,cdn) {
|
||||
return{
|
||||
filters:{
|
||||
'report_type': "Balance Sheet",
|
||||
'group_or_ledger': "Ledger",
|
||||
'is_group': 0,
|
||||
'company': doc.company
|
||||
}
|
||||
}
|
||||
@ -33,7 +33,7 @@ cur_frm.fields_dict['cash_bank_account'].get_query = function(doc,cdt,cdn) {
|
||||
cur_frm.fields_dict['income_account'].get_query = function(doc,cdt,cdn) {
|
||||
return{
|
||||
filters:{
|
||||
'group_or_ledger': "Ledger",
|
||||
'is_group': 0,
|
||||
'company': doc.company,
|
||||
'account_type': "Income Account"
|
||||
}
|
||||
@ -47,7 +47,7 @@ cur_frm.fields_dict['cost_center'].get_query = function(doc,cdt,cdn) {
|
||||
return{
|
||||
filters:{
|
||||
'company': doc.company,
|
||||
'group_or_ledger': "Ledger"
|
||||
'is_group': 0
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -60,7 +60,7 @@ cur_frm.fields_dict["expense_account"].get_query = function(doc) {
|
||||
filters: {
|
||||
"report_type": "Profit and Loss",
|
||||
"company": doc.company,
|
||||
"group_or_ledger": "Ledger"
|
||||
"is_group": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -83,7 +83,7 @@ cur_frm.fields_dict.write_off_account.get_query = function(doc) {
|
||||
return{
|
||||
filters:{
|
||||
'report_type': 'Profit and Loss',
|
||||
'group_or_ledger': 'Ledger',
|
||||
'is_group': 0,
|
||||
'company': doc.company
|
||||
}
|
||||
}
|
||||
@ -94,7 +94,7 @@ cur_frm.fields_dict.write_off_account.get_query = function(doc) {
|
||||
cur_frm.fields_dict.write_off_cost_center.get_query = function(doc) {
|
||||
return{
|
||||
filters:{
|
||||
'group_or_ledger': 'Ledger',
|
||||
'is_group': 0,
|
||||
'company': doc.company
|
||||
}
|
||||
}
|
||||
|
@ -161,7 +161,7 @@ cur_frm.fields_dict['credit_to'].get_query = function(doc) {
|
||||
filters:{
|
||||
'account_type': 'Payable',
|
||||
'root_type': 'Liability',
|
||||
'group_or_ledger': 'Ledger',
|
||||
'is_group': 0,
|
||||
'company': doc.company
|
||||
}
|
||||
}
|
||||
@ -198,7 +198,7 @@ cur_frm.fields_dict["items"].grid.get_field("cost_center").get_query = function(
|
||||
return {
|
||||
filters: {
|
||||
'company': doc.company,
|
||||
'group_or_ledger': 'Ledger'
|
||||
'is_group': 0
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -394,9 +394,9 @@ def get_expense_account(doctype, txt, searchfield, start, page_len, filters):
|
||||
return frappe.db.sql("""select tabAccount.name from `tabAccount`
|
||||
where (tabAccount.report_type = "Profit and Loss"
|
||||
or tabAccount.account_type in ("Expense Account", "Fixed Asset"))
|
||||
and tabAccount.group_or_ledger="Ledger"
|
||||
and tabAccount.is_group=0
|
||||
and tabAccount.docstatus!=2
|
||||
and tabAccount.company = '%(company)s'
|
||||
and tabAccount.%(key)s LIKE '%(txt)s'
|
||||
%(mcond)s""" % {'company': filters['company'], 'key': searchfield,
|
||||
'txt': "%%%s%%" % txt, 'mcond':get_match_cond(doctype)})
|
||||
'txt': "%%%s%%" % txt, 'mcond':get_match_cond(doctype)})
|
||||
|
@ -291,7 +291,7 @@ cur_frm.fields_dict.debit_to.get_query = function(doc) {
|
||||
return{
|
||||
filters: {
|
||||
'report_type': 'Balance Sheet',
|
||||
'group_or_ledger': 'Ledger',
|
||||
'is_group': 0,
|
||||
'company': doc.company
|
||||
}
|
||||
}
|
||||
@ -302,7 +302,7 @@ cur_frm.fields_dict.cash_bank_account.get_query = function(doc) {
|
||||
filters: [
|
||||
["Account", "account_type", "in", ["Cash", "Bank"]],
|
||||
["Account", "root_type", "=", "Asset"],
|
||||
["Account", "group_or_ledger", "=", "Ledger"],
|
||||
["Account", "is_group", "=",0],
|
||||
["Account", "company", "=", doc.company]
|
||||
]
|
||||
}
|
||||
@ -312,7 +312,7 @@ cur_frm.fields_dict.write_off_account.get_query = function(doc) {
|
||||
return{
|
||||
filters:{
|
||||
'report_type': 'Profit and Loss',
|
||||
'group_or_ledger': 'Ledger',
|
||||
'is_group': 0,
|
||||
'company': doc.company
|
||||
}
|
||||
}
|
||||
@ -323,7 +323,7 @@ cur_frm.fields_dict.write_off_account.get_query = function(doc) {
|
||||
cur_frm.fields_dict.write_off_cost_center.get_query = function(doc) {
|
||||
return{
|
||||
filters:{
|
||||
'group_or_ledger': 'Ledger',
|
||||
'is_group': 0,
|
||||
'company': doc.company
|
||||
}
|
||||
}
|
||||
@ -354,7 +354,7 @@ if (sys_defaults.auto_accounting_for_stock) {
|
||||
filters: {
|
||||
'report_type': 'Profit and Loss',
|
||||
'company': doc.company,
|
||||
'group_or_ledger': 'Ledger'
|
||||
"is_group": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -367,7 +367,7 @@ cur_frm.fields_dict["items"].grid.get_field("cost_center").get_query = function(
|
||||
return {
|
||||
filters: {
|
||||
'company': doc.company,
|
||||
'group_or_ledger': 'Ledger'
|
||||
"is_group": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -449,7 +449,7 @@ class SalesInvoice(SellingController):
|
||||
|
||||
def make_gl_entries(self, repost_future_gle=True):
|
||||
gl_entries = self.get_gl_entries()
|
||||
|
||||
|
||||
if gl_entries:
|
||||
from erpnext.accounts.general_ledger import make_gl_entries
|
||||
|
||||
@ -617,7 +617,7 @@ def get_income_account(doctype, txt, searchfield, start, page_len, filters):
|
||||
return frappe.db.sql("""select tabAccount.name from `tabAccount`
|
||||
where (tabAccount.report_type = "Profit and Loss"
|
||||
or tabAccount.account_type = "Income Account")
|
||||
and tabAccount.group_or_ledger="Ledger"
|
||||
and tabAccount.is_group=0
|
||||
and tabAccount.docstatus!=2
|
||||
and tabAccount.company = '%(company)s'
|
||||
and tabAccount.%(key)s LIKE '%(txt)s'
|
||||
|
@ -24,18 +24,16 @@ frappe.pages["Accounts Browser"].on_page_load = function(wrapper){
|
||||
'<ol>'+
|
||||
'<li>'+__('To add child nodes, explore tree and click on the node under which you want to add more nodes.')+'</li>'+
|
||||
'<li>'+
|
||||
__('Accounting Entries can be made against leaf nodes, called')+
|
||||
' <b>' +__('Ledgers')+'</b>. '+ __('Entries against ') +
|
||||
'<b>' +__('Groups') + '</b> '+ __('are not allowed.')+
|
||||
__('Accounting Entries can be made against leaf nodes. Entries against Groups are not allowed.')+
|
||||
'</li>'+
|
||||
'<li>'+__('Please do NOT create Account (Ledgers) for Customers and Suppliers. They are created directly from the Customer / Supplier masters.')+'</li>'+
|
||||
'<li>'+__('Please do NOT create Accounts for Customers and Suppliers. They are created directly from the Customer / Supplier masters.')+'</li>'+
|
||||
'<li>'+
|
||||
'<b>'+__('To create a Bank Account')+'</b>: '+
|
||||
__('Go to the appropriate group (usually Application of Funds > Current Assets > Bank Accounts and create a new Account Ledger (by clicking on Add Child) of type "Bank"')+
|
||||
__('Go to the appropriate group (usually Application of Funds > Current Assets > Bank Accounts and create a new Account (by clicking on Add Child) of type "Bank"')+
|
||||
'</li>'+
|
||||
'<li>'+
|
||||
'<b>'+__('To create a Tax Account') +'</b>: '+
|
||||
__('Go to the appropriate group (usually Source of Funds > Current Liabilities > Taxes and Duties and create a new Account Ledger (by clicking on Add Child) of type "Tax" and do mention the Tax rate.')+
|
||||
__('Go to the appropriate group (usually Source of Funds > Current Liabilities > Taxes and Duties and create a new Account (by clicking on Add Child) of type "Tax" and do mention the Tax rate.')+
|
||||
'</li>'+
|
||||
'</ol>'+
|
||||
'<p>'+__('Please setup your chart of accounts before you start Accounting Entries')+'</p></div>').appendTo(main);
|
||||
@ -201,9 +199,8 @@ erpnext.AccountsChart = Class.extend({
|
||||
fields: [
|
||||
{fieldtype:'Data', fieldname:'account_name', label:__('New Account Name'), reqd:true,
|
||||
description: __("Name of new Account. Note: Please don't create accounts for Customers and Suppliers, they are created automatically from the Customer and Supplier master")},
|
||||
{fieldtype:'Select', fieldname:'group_or_ledger', label:__('Group or Ledger'),
|
||||
options:'Group\nLedger', "default": "Ledger",
|
||||
description: __('Further accounts can be made under Groups, but entries can be made against Ledger')},
|
||||
{fieldtype:'Check', fieldname:'is_group', label:__('Is Group'),
|
||||
description: __('Further accounts can be made under Groups, but entries can be made against non-Groups')},
|
||||
{fieldtype:'Select', fieldname:'account_type', label:__('Account Type'),
|
||||
options: ['', 'Bank', 'Cash', 'Warehouse', 'Receivable', 'Payable',
|
||||
'Equity', 'Cost of Goods Sold', 'Fixed Asset', 'Expense Account',
|
||||
@ -217,8 +214,8 @@ erpnext.AccountsChart = Class.extend({
|
||||
var fd = d.fields_dict;
|
||||
|
||||
// account type if ledger
|
||||
$(fd.group_or_ledger.input).change(function() {
|
||||
if($(this).val()=='Group') {
|
||||
$(fd.is_group.input).change(function() {
|
||||
if($(this).prop("checked")) {
|
||||
$(fd.account_type.wrapper).toggle(false);
|
||||
$(fd.tax_rate.wrapper).toggle(false);
|
||||
$(fd.warehouse.wrapper).toggle(false);
|
||||
@ -263,11 +260,11 @@ erpnext.AccountsChart = Class.extend({
|
||||
|
||||
// show
|
||||
d.on_page_show = function() {
|
||||
$(fd.group_or_ledger.input).change();
|
||||
$(fd.is_group.input).change();
|
||||
$(fd.account_type.input).change();
|
||||
}
|
||||
|
||||
$(fd.group_or_ledger.input).val("Ledger").change();
|
||||
$(fd.is_group.input).prop("checked", false).change();
|
||||
d.show();
|
||||
},
|
||||
|
||||
@ -278,8 +275,8 @@ erpnext.AccountsChart = Class.extend({
|
||||
title:__('New Cost Center'),
|
||||
fields: [
|
||||
{fieldtype:'Data', fieldname:'cost_center_name', label:__('New Cost Center Name'), reqd:true},
|
||||
{fieldtype:'Select', fieldname:'group_or_ledger', label:__('Group or Ledger'),
|
||||
options:'Group\nLedger', description:__('Further accounts can be made under Groups but entries can be made against Ledger')},
|
||||
{fieldtype:'Check', fieldname:'is_group', label:__('Is Group'),
|
||||
description:__('Further cost centers can be made under Groups but entries can be made against non-Groups')},
|
||||
{fieldtype:'Button', fieldname:'create_new', label:__('Create New') }
|
||||
]
|
||||
});
|
||||
|
@ -21,7 +21,7 @@ def get_children():
|
||||
# root
|
||||
if args['parent'] in ("Accounts", "Cost Centers"):
|
||||
acc = frappe.db.sql(""" select
|
||||
name as value, if(group_or_ledger='Group', 1, 0) as expandable
|
||||
name as value, is_group as expandable
|
||||
from `tab%s`
|
||||
where ifnull(parent_%s,'') = ''
|
||||
and `company` = %s and docstatus<2
|
||||
@ -30,7 +30,7 @@ def get_children():
|
||||
else:
|
||||
# other
|
||||
acc = frappe.db.sql("""select
|
||||
name as value, if(group_or_ledger='Group', 1, 0) as expandable
|
||||
name as value, is_group as expandable
|
||||
from `tab%s`
|
||||
where ifnull(parent_%s,'') = %s
|
||||
and docstatus<2
|
||||
|
@ -265,7 +265,7 @@ erpnext.FinancialAnalytics = erpnext.AccountTreeGrid.extend({
|
||||
var me= this;
|
||||
$.each(this.data, function(i, account) {
|
||||
// update groups
|
||||
if((account.group_or_ledger == "Ledger") || (account.rgt - account.lft == 1)) {
|
||||
if((account.is_group == 0) || (account.rgt - account.lft == 1)) {
|
||||
var parent = me.parent_map[account.name];
|
||||
while(parent) {
|
||||
var parent_account = me.item_by_name[parent];
|
||||
|
@ -188,17 +188,6 @@ class ReceivablePayableReport(object):
|
||||
conditions.append("party_type=%s and party=%s")
|
||||
values += [party_type, self.filters.get(party_type_field)]
|
||||
|
||||
if self.filters.account:
|
||||
conditions.append("account=%s")
|
||||
values.append(self.filters.account)
|
||||
else:
|
||||
account_map = self.get_account_map()
|
||||
if not account_map:
|
||||
frappe.throw(_("No Customer Accounts found."))
|
||||
else:
|
||||
conditions.append("account in ({0})".format(", ".join(["%s"] * len(account_map))))
|
||||
values += account_map.keys()
|
||||
|
||||
return " and ".join(conditions), values
|
||||
|
||||
def get_gl_entries_for(self, party, party_type, against_voucher_type, against_voucher):
|
||||
|
@ -24,13 +24,13 @@ frappe.query_reports["Bank Clearance Summary"] = {
|
||||
"reqd": 1,
|
||||
"get_query": function() {
|
||||
return {
|
||||
"query": "erpnext.controllers.queries.get_account_list",
|
||||
"query": "erpnext.controllers.queries.get_account_list",
|
||||
"filters": [
|
||||
['Account', 'account_type', 'in', 'Bank, Cash'],
|
||||
['Account', 'group_or_ledger', '=', 'Ledger'],
|
||||
['Account', 'is_group', '=', 0],
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ frappe.query_reports["Bank Reconciliation Statement"] = {
|
||||
"query": "erpnext.controllers.queries.get_account_list",
|
||||
"filters": [
|
||||
['Account', 'account_type', 'in', 'Bank, Cash'],
|
||||
['Account', 'group_or_ledger', '=', 'Ledger'],
|
||||
['Account', 'is_group', '=', 0],
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ from frappe import _
|
||||
|
||||
def execute(filters=None):
|
||||
account_details = {}
|
||||
for acc in frappe.db.sql("""select name, group_or_ledger from tabAccount""", as_dict=1):
|
||||
for acc in frappe.db.sql("""select name, is_group from tabAccount""", as_dict=1):
|
||||
account_details.setdefault(acc.name, acc)
|
||||
|
||||
validate_filters(filters, account_details)
|
||||
@ -25,7 +25,7 @@ def validate_filters(filters, account_details):
|
||||
frappe.throw(_("Account {0} does not exists").format(filters.account))
|
||||
|
||||
if filters.get("account") and filters.get("group_by_account") \
|
||||
and account_details[filters.account].group_or_ledger == "Ledger":
|
||||
and account_details[filters.account].is_group == 0:
|
||||
frappe.throw(_("Can not filter based on Account, if grouped by Account"))
|
||||
|
||||
if filters.get("voucher_no") and filters.get("group_by_voucher"):
|
||||
@ -45,10 +45,10 @@ def validate_party(filters):
|
||||
frappe.throw(_("Invalid {0}: {1}").format(party_type, party))
|
||||
|
||||
def get_columns():
|
||||
return [_("Posting Date") + ":Date:90", _("Account") + ":Link/Account:200",
|
||||
_("Debit") + ":Float:100", _("Credit") + ":Float:100",
|
||||
_("Voucher Type") + "::120", _("Voucher No") + ":Dynamic Link/Voucher Type:160",
|
||||
_("Against Account") + "::120", _("Party Type") + "::80", _("Party") + "::150",
|
||||
return [_("Posting Date") + ":Date:90", _("Account") + ":Link/Account:200",
|
||||
_("Debit") + ":Float:100", _("Credit") + ":Float:100",
|
||||
_("Voucher Type") + "::120", _("Voucher No") + ":Dynamic Link/Voucher Type:160",
|
||||
_("Against Account") + "::120", _("Party Type") + "::80", _("Party") + "::150",
|
||||
_("Cost Center") + ":Link/Cost Center:100", _("Remarks") + "::400"]
|
||||
|
||||
def get_result(filters, account_details):
|
||||
@ -179,7 +179,7 @@ def get_result_as_list(data):
|
||||
for d in data:
|
||||
result.append([d.get("posting_date"), d.get("account"), d.get("debit"),
|
||||
d.get("credit"), d.get("voucher_type"), d.get("voucher_no"),
|
||||
d.get("against"), d.get("party_type"), d.get("party"),
|
||||
d.get("against"), d.get("party_type"), d.get("party"),
|
||||
d.get("cost_center"), d.get("remarks")])
|
||||
|
||||
return result
|
||||
|
@ -89,7 +89,7 @@ def get_balance_on(account=None, date=None, party_type=None, party=None):
|
||||
% year_start_date)
|
||||
|
||||
# different filter for group and ledger - improved performance
|
||||
if acc.group_or_ledger=="Group":
|
||||
if acc.is_group:
|
||||
cond.append("""exists (
|
||||
select * from `tabAccount` ac where ac.name = gle.account
|
||||
and ac.lft >= %s and ac.rgt <= %s
|
||||
|
@ -65,7 +65,7 @@ cur_frm.fields_dict['accounts'].grid.get_field('account').get_query = function(d
|
||||
filters: {
|
||||
'account_type': 'Payable',
|
||||
'company': d.company,
|
||||
'group_or_ledger': 'Ledger'
|
||||
"is_group": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ def tax_account_query(doctype, txt, searchfield, start, page_len, filters):
|
||||
tax_accounts = frappe.db.sql("""select name, parent_account from tabAccount
|
||||
where tabAccount.docstatus!=2
|
||||
and account_type in (%s)
|
||||
and group_or_ledger = 'Ledger'
|
||||
and is_group = 0
|
||||
and company = %s
|
||||
and `%s` LIKE %s
|
||||
limit %s, %s""" %
|
||||
@ -147,7 +147,7 @@ def tax_account_query(doctype, txt, searchfield, start, page_len, filters):
|
||||
start, page_len]))
|
||||
if not tax_accounts:
|
||||
tax_accounts = frappe.db.sql("""select name, parent_account from tabAccount
|
||||
where tabAccount.docstatus!=2 and group_or_ledger = 'Ledger'
|
||||
where tabAccount.docstatus!=2 and is_group = 0
|
||||
and company = %s and `%s` LIKE %s limit %s, %s"""
|
||||
% ("%s", searchfield, "%s", "%s", "%s"),
|
||||
(filters.get("company"), "%%%s%%" % txt, start, page_len))
|
||||
@ -281,8 +281,8 @@ def get_account_list(doctype, txt, searchfield, start, page_len, filters):
|
||||
elif isinstance(filters, list):
|
||||
filter_list.extend(filters)
|
||||
|
||||
if "group_or_ledger" not in [d[1] for d in filter_list]:
|
||||
filter_list.append(["Account", "group_or_ledger", "=", "Ledger"])
|
||||
if "is_group" not in [d[1] for d in filter_list]:
|
||||
filter_list.append(["Account", "is_group", "=", "0"])
|
||||
|
||||
if searchfield and txt:
|
||||
filter_list.append([doctype, searchfield, "like", "%%%s%%" % txt])
|
||||
|
@ -5,12 +5,12 @@
|
||||
"doctype": "Report",
|
||||
"idx": 1,
|
||||
"is_standard": "Yes",
|
||||
"modified": "2015-03-30 05:43:59.976254",
|
||||
"modified": "2015-04-23 03:26:35.711681",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Manufacturing",
|
||||
"name": "Open Production Orders",
|
||||
"owner": "Administrator",
|
||||
"query": "SELECT\n `tabProduction Order`.name as \"Production Order:Link/Production Order:200\",\n `tabProduction Order`.creation as \"Date:Date:120\",\n `tabProduction Order`.production_item as \"Item:Link/Item:150\",\n `tabProduction Order`.qty as \"To Produce:Int:100\",\n `tabProduction Order`.produced_qty as \"Produced:Int:100\",\n `tabProduction Order`.company as \"Company:Link/Company:\",\nFROM\n `tabProduction Order`\nWHERE\n `tabProduction Order`.docstatus=1\n AND ifnull(`tabProduction Order`.produced_qty,0) < `tabProduction Order`.qty\n AND NOT EXISTS (SELECT name from `tabStock Entry` where production_order =`tabProduction Order`.name) ",
|
||||
"query": "SELECT\n `tabProduction Order`.name as \"Production Order:Link/Production Order:200\",\n `tabProduction Order`.creation as \"Date:Date:120\",\n `tabProduction Order`.production_item as \"Item:Link/Item:150\",\n `tabProduction Order`.qty as \"To Produce:Int:100\",\n `tabProduction Order`.produced_qty as \"Produced:Int:100\",\n `tabProduction Order`.company as \"Company:Link/Company:\"\nFROM\n `tabProduction Order`\nWHERE\n `tabProduction Order`.docstatus=1\n AND ifnull(`tabProduction Order`.produced_qty,0) < `tabProduction Order`.qty\n AND NOT EXISTS (SELECT name from `tabStock Entry` where production_order =`tabProduction Order`.name) ",
|
||||
"ref_doctype": "Production Order",
|
||||
"report_name": "Open Production Orders",
|
||||
"report_type": "Query Report"
|
||||
|
@ -101,6 +101,7 @@ execute:frappe.reload_doc('crm', 'doctype', 'lead')
|
||||
execute:frappe.reload_doc('crm', 'doctype', 'opportunity')
|
||||
erpnext.patches.v5_0.rename_table_fieldnames
|
||||
execute:frappe.db.sql("update `tabJournal Entry` set voucher_type='Journal Entry' where ifnull(voucher_type, '')=''")
|
||||
erpnext.patches.v5_0.is_group
|
||||
erpnext.patches.v4_2.party_model
|
||||
erpnext.patches.v5_0.party_model_patch_fix
|
||||
erpnext.patches.v4_1.fix_jv_remarks
|
||||
|
@ -25,7 +25,7 @@ def create_receivable_payable_account():
|
||||
|
||||
def _create_account(args):
|
||||
account = frappe.new_doc("Account")
|
||||
account.group_or_ledger = "Ledger"
|
||||
account.is_group = 0
|
||||
account.update(args)
|
||||
account.insert()
|
||||
|
||||
@ -87,7 +87,7 @@ def set_party_in_jv_and_gl_entry(receivable_payable_accounts):
|
||||
|
||||
frappe.db.sql("update `tab{0}` set account=%s, party_type=%s, party=%s where name=%s".format(dt),
|
||||
(new_account, account_details.get("master_type"), account_details.get("master_name"), d.name))
|
||||
|
||||
|
||||
if i%500 == 0:
|
||||
frappe.db.commit()
|
||||
|
||||
|
9
erpnext/patches/v5_0/is_group.py
Normal file
9
erpnext/patches/v5_0/is_group.py
Normal file
@ -0,0 +1,9 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
frappe.reload_doctype("Account")
|
||||
frappe.reload_doctype("Cost Center")
|
||||
frappe.db.sql("update tabAccount set is_group = if(group_or_ledger='Group', 1, 0)")
|
||||
frappe.db.sql("update `tabCost Center` set is_group = if(group_or_ledger='Group', 1, 0)")
|
@ -178,7 +178,7 @@ erpnext.AccountTreeGrid = frappe.views.TreeGridReport.extend({
|
||||
var me= this;
|
||||
$.each(this.data, function(i, account) {
|
||||
// update groups
|
||||
if((account.group_or_ledger == "Ledger") || (account.rgt - account.lft == 1)) {
|
||||
if((account.is_group == 0) || (account.rgt - account.lft == 1)) {
|
||||
var parent = me.parent_map[account.name];
|
||||
while(parent) {
|
||||
var parent_account = me.item_by_name[parent];
|
||||
|
@ -162,7 +162,7 @@ frappe.ui.form.on(cur_frm.doctype, "onload", function(frm) {
|
||||
return {
|
||||
filters: {
|
||||
'company': doc.company,
|
||||
'group_or_ledger': "Ledger"
|
||||
"is_group": 0
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -93,7 +93,7 @@ cur_frm.fields_dict['accounts'].grid.get_field('account').get_query = function(d
|
||||
filters: {
|
||||
'account_type': 'Receivable',
|
||||
'company': d.company,
|
||||
'group_or_ledger': 'Ledger'
|
||||
"is_group": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ cur_frm.fields_dict.default_bank_account.get_query = function(doc) {
|
||||
return{
|
||||
filters: [
|
||||
['Account', 'account_type', '=', 'Bank'],
|
||||
['Account', 'group_or_ledger', '=', 'Ledger'],
|
||||
['Account', 'is_group', '=', 0],
|
||||
['Account', 'company', '=', doc.name]
|
||||
]
|
||||
}
|
||||
@ -124,7 +124,7 @@ cur_frm.fields_dict.default_cash_account.get_query = function(doc) {
|
||||
return{
|
||||
filters: [
|
||||
['Account', 'account_type', '=', 'Cash'],
|
||||
['Account', 'group_or_ledger', '=', 'Ledger'],
|
||||
['Account', 'is_group', '=', 0],
|
||||
['Account', 'company', '=', doc.name]
|
||||
]
|
||||
}
|
||||
@ -134,7 +134,7 @@ cur_frm.fields_dict.default_receivable_account.get_query = function(doc) {
|
||||
return{
|
||||
filters:{
|
||||
'company': doc.name,
|
||||
'group_or_ledger': "Ledger",
|
||||
"is_group": 0,
|
||||
"account_type": "Receivable"
|
||||
}
|
||||
}
|
||||
@ -144,7 +144,7 @@ cur_frm.fields_dict.default_payable_account.get_query = function(doc) {
|
||||
return{
|
||||
filters:{
|
||||
'company': doc.name,
|
||||
'group_or_ledger': "Ledger",
|
||||
"is_group": 0,
|
||||
"account_type": "Payable"
|
||||
}
|
||||
}
|
||||
@ -156,7 +156,7 @@ cur_frm.fields_dict.default_expense_account.get_query = function(doc) {
|
||||
return{
|
||||
filters:{
|
||||
'company': doc.name,
|
||||
'group_or_ledger': "Ledger",
|
||||
"is_group": 0,
|
||||
"report_type": "Profit and Loss"
|
||||
}
|
||||
}
|
||||
@ -166,7 +166,7 @@ cur_frm.fields_dict.default_income_account.get_query = function(doc) {
|
||||
return{
|
||||
filters:{
|
||||
'company': doc.name,
|
||||
'group_or_ledger': "Ledger",
|
||||
"is_group": 0,
|
||||
"report_type": "Profit and Loss"
|
||||
}
|
||||
}
|
||||
@ -176,7 +176,7 @@ cur_frm.fields_dict.cost_center.get_query = function(doc) {
|
||||
return{
|
||||
filters:{
|
||||
'company': doc.name,
|
||||
'group_or_ledger': "Ledger",
|
||||
"is_group": 0,
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -187,7 +187,7 @@ if (sys_defaults.auto_accounting_for_stock) {
|
||||
"filters": {
|
||||
"report_type": "Profit and Loss",
|
||||
"company": doc.name,
|
||||
'group_or_ledger': "Ledger"
|
||||
"is_group": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -200,7 +200,7 @@ if (sys_defaults.auto_accounting_for_stock) {
|
||||
"filters": {
|
||||
"report_type": "Balance Sheet",
|
||||
"company": doc.name,
|
||||
'group_or_ledger': "Ledger"
|
||||
"is_group": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ class Company(Document):
|
||||
self.create_default_warehouses()
|
||||
self.install_country_fixtures()
|
||||
|
||||
if not frappe.db.get_value("Cost Center", {"group_or_ledger": "Ledger", "company": self.name}):
|
||||
if not frappe.db.get_value("Cost Center", {"is_group": 0, "company": self.name}):
|
||||
self.create_default_cost_center()
|
||||
|
||||
self.set_default_accounts()
|
||||
@ -71,7 +71,7 @@ class Company(Document):
|
||||
for whname in (_("Stores"), _("Work In Progress"), _("Finished Goods")):
|
||||
if not frappe.db.exists("Warehouse", whname + " - " + self.abbr):
|
||||
stock_group = frappe.db.get_value("Account", {"account_type": "Stock",
|
||||
"group_or_ledger": "Group", "company": self.name})
|
||||
"is_group": 1, "company": self.name})
|
||||
if stock_group:
|
||||
frappe.get_doc({
|
||||
"doctype":"Warehouse",
|
||||
@ -125,7 +125,7 @@ class Company(Document):
|
||||
return
|
||||
|
||||
account = frappe.db.get_value("Account", {"account_type": account_type,
|
||||
"group_or_ledger": "Ledger", "company": self.name})
|
||||
"is_group": 0, "company": self.name})
|
||||
|
||||
if account:
|
||||
self.db_set(fieldname, account)
|
||||
@ -135,13 +135,13 @@ class Company(Document):
|
||||
{
|
||||
'cost_center_name': self.name,
|
||||
'company':self.name,
|
||||
'group_or_ledger':'Group',
|
||||
'is_group': 1,
|
||||
'parent_cost_center':None
|
||||
},
|
||||
{
|
||||
'cost_center_name':_('Main'),
|
||||
'company':self.name,
|
||||
'group_or_ledger':'Ledger',
|
||||
'is_group':0,
|
||||
'parent_cost_center':self.name + ' - ' + self.abbr
|
||||
},
|
||||
]
|
||||
|
@ -32,7 +32,7 @@ cur_frm.fields_dict['accounts'].grid.get_field('account').get_query = function(d
|
||||
filters: {
|
||||
'account_type': 'Receivable',
|
||||
'company': d.company,
|
||||
'group_or_ledger': 'Ledger'
|
||||
"is_group": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -394,7 +394,7 @@ class EmailDigest(Document):
|
||||
if not hasattr(self, "accounts"):
|
||||
self.accounts = frappe.db.sql("""select name, account_type, account_name, root_type
|
||||
from `tabAccount` where company=%s and docstatus < 2
|
||||
and group_or_ledger = "Ledger" order by lft""",
|
||||
and is_group = 0 order by lft""",
|
||||
(self.company,), as_dict=1)
|
||||
return self.accounts
|
||||
|
||||
|
@ -11,7 +11,7 @@ cur_frm.fields_dict['accounts'].grid.get_field('account').get_query = function(d
|
||||
filters: {
|
||||
'account_type': 'Payable',
|
||||
'company': d.company,
|
||||
'group_or_ledger': 'Ledger'
|
||||
"is_group": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -297,14 +297,14 @@ def create_taxes(args):
|
||||
|
||||
try:
|
||||
tax_group = frappe.db.get_value("Account", {"company": args.get("company_name"),
|
||||
"group_or_ledger": "Group", "account_type": "Tax", "root_type": "Liability"})
|
||||
"is_group": 1, "account_type": "Tax", "root_type": "Liability"})
|
||||
if tax_group:
|
||||
frappe.get_doc({
|
||||
"doctype":"Account",
|
||||
"company": args.get("company_name").strip(),
|
||||
"parent_account": tax_group,
|
||||
"account_name": args.get("tax_" + str(i)),
|
||||
"group_or_ledger": "Ledger",
|
||||
"is_group": 0,
|
||||
"report_type": "Balance Sheet",
|
||||
"account_type": "Tax",
|
||||
"tax_rate": flt(tax_rate) if tax_rate else None
|
||||
@ -330,69 +330,78 @@ def create_items(args):
|
||||
"company": args.get("company_name").strip()
|
||||
})
|
||||
|
||||
frappe.get_doc({
|
||||
"doctype":"Item",
|
||||
"item_code": item,
|
||||
"item_name": item,
|
||||
"description": item,
|
||||
"is_sales_item": "Yes" if is_sales_item else "No",
|
||||
"is_purchase_item": "Yes" if is_purchase_item else "No",
|
||||
"show_in_website": 1,
|
||||
"is_stock_item": is_stock_item and "Yes" or "No",
|
||||
"item_group": item_group,
|
||||
"stock_uom": args.get("item_uom_" + str(i)),
|
||||
"default_warehouse": default_warehouse
|
||||
}).insert()
|
||||
try:
|
||||
frappe.get_doc({
|
||||
"doctype":"Item",
|
||||
"item_code": item,
|
||||
"item_name": item,
|
||||
"description": item,
|
||||
"is_sales_item": "Yes" if is_sales_item else "No",
|
||||
"is_purchase_item": "Yes" if is_purchase_item else "No",
|
||||
"show_in_website": 1,
|
||||
"is_stock_item": is_stock_item and "Yes" or "No",
|
||||
"item_group": item_group,
|
||||
"stock_uom": args.get("item_uom_" + str(i)),
|
||||
"default_warehouse": default_warehouse
|
||||
}).insert()
|
||||
|
||||
if args.get("item_img_" + str(i)):
|
||||
item_image = args.get("item_img_" + str(i)).split(",")
|
||||
if len(item_image)==3:
|
||||
filename, filetype, content = item_image
|
||||
fileurl = save_file(filename, content, "Item", item, decode=True).file_url
|
||||
frappe.db.set_value("Item", item, "image", fileurl)
|
||||
if args.get("item_img_" + str(i)):
|
||||
item_image = args.get("item_img_" + str(i)).split(",")
|
||||
if len(item_image)==3:
|
||||
filename, filetype, content = item_image
|
||||
fileurl = save_file(filename, content, "Item", item, decode=True).file_url
|
||||
frappe.db.set_value("Item", item, "image", fileurl)
|
||||
except frappe.NameError:
|
||||
pass
|
||||
|
||||
def create_customers(args):
|
||||
for i in xrange(1,6):
|
||||
customer = args.get("customer_" + str(i))
|
||||
if customer:
|
||||
frappe.get_doc({
|
||||
"doctype":"Customer",
|
||||
"customer_name": customer,
|
||||
"customer_type": "Company",
|
||||
"customer_group": _("Commercial"),
|
||||
"territory": args.get("country"),
|
||||
"company": args.get("company_name").strip()
|
||||
}).insert()
|
||||
|
||||
if args.get("customer_contact_" + str(i)):
|
||||
contact = args.get("customer_contact_" + str(i)).split(" ")
|
||||
try:
|
||||
frappe.get_doc({
|
||||
"doctype":"Contact",
|
||||
"customer": customer,
|
||||
"first_name":contact[0],
|
||||
"last_name": len(contact) > 1 and contact[1] or ""
|
||||
"doctype":"Customer",
|
||||
"customer_name": customer,
|
||||
"customer_type": "Company",
|
||||
"customer_group": _("Commercial"),
|
||||
"territory": args.get("country"),
|
||||
"company": args.get("company_name").strip()
|
||||
}).insert()
|
||||
|
||||
if args.get("customer_contact_" + str(i)):
|
||||
contact = args.get("customer_contact_" + str(i)).split(" ")
|
||||
frappe.get_doc({
|
||||
"doctype":"Contact",
|
||||
"customer": customer,
|
||||
"first_name":contact[0],
|
||||
"last_name": len(contact) > 1 and contact[1] or ""
|
||||
}).insert()
|
||||
except frappe.NameError:
|
||||
pass
|
||||
|
||||
def create_suppliers(args):
|
||||
for i in xrange(1,6):
|
||||
supplier = args.get("supplier_" + str(i))
|
||||
if supplier:
|
||||
frappe.get_doc({
|
||||
"doctype":"Supplier",
|
||||
"supplier_name": supplier,
|
||||
"supplier_type": _("Local"),
|
||||
"company": args.get("company_name").strip()
|
||||
}).insert()
|
||||
|
||||
if args.get("supplier_contact_" + str(i)):
|
||||
contact = args.get("supplier_contact_" + str(i)).split(" ")
|
||||
try:
|
||||
frappe.get_doc({
|
||||
"doctype":"Contact",
|
||||
"supplier": supplier,
|
||||
"first_name":contact[0],
|
||||
"last_name": len(contact) > 1 and contact[1] or ""
|
||||
"doctype":"Supplier",
|
||||
"supplier_name": supplier,
|
||||
"supplier_type": _("Local"),
|
||||
"company": args.get("company_name").strip()
|
||||
}).insert()
|
||||
|
||||
if args.get("supplier_contact_" + str(i)):
|
||||
contact = args.get("supplier_contact_" + str(i)).split(" ")
|
||||
frappe.get_doc({
|
||||
"doctype":"Contact",
|
||||
"supplier": supplier,
|
||||
"first_name":contact[0],
|
||||
"last_name": len(contact) > 1 and contact[1] or ""
|
||||
}).insert()
|
||||
except frappe.NameError:
|
||||
pass
|
||||
|
||||
|
||||
def create_letter_head(args):
|
||||
if args.get("attach_letterhead"):
|
||||
|
@ -19,7 +19,7 @@ data_map = {
|
||||
# Accounts
|
||||
"Account": {
|
||||
"columns": ["name", "parent_account", "lft", "rgt", "report_type",
|
||||
"company", "group_or_ledger"],
|
||||
"company", "is_group"],
|
||||
"conditions": ["docstatus < 2"],
|
||||
"order_by": "lft",
|
||||
"links": {
|
||||
|
@ -214,7 +214,7 @@ if (sys_defaults.auto_accounting_for_stock) {
|
||||
filters: {
|
||||
"report_type": "Profit and Loss",
|
||||
"company": doc.company,
|
||||
"group_or_ledger": "Ledger"
|
||||
"is_group": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -236,7 +236,7 @@ if (sys_defaults.auto_accounting_for_stock) {
|
||||
|
||||
filters: {
|
||||
'company': doc.company,
|
||||
'group_or_ledger': "Ledger"
|
||||
"is_group": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ $.extend(erpnext.item, {
|
||||
return {
|
||||
filters: {
|
||||
"report_type": "Profit and Loss",
|
||||
"group_or_ledger": "Ledger"
|
||||
"is_group": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -133,7 +133,7 @@ $.extend(erpnext.item, {
|
||||
return {
|
||||
filters: {
|
||||
"report_type": "Profit and Loss",
|
||||
'group_or_ledger': "Ledger",
|
||||
"is_group": 0,
|
||||
'account_type': "Income Account"
|
||||
}
|
||||
}
|
||||
@ -144,7 +144,7 @@ $.extend(erpnext.item, {
|
||||
// -----------------------------
|
||||
frm.fields_dict['buying_cost_center'].get_query = function(doc) {
|
||||
return {
|
||||
filters:{ 'group_or_ledger': "Ledger" }
|
||||
filters:{ "is_group": 0 }
|
||||
}
|
||||
}
|
||||
|
||||
@ -153,7 +153,7 @@ $.extend(erpnext.item, {
|
||||
// -----------------------------
|
||||
frm.fields_dict['selling_cost_center'].get_query = function(doc) {
|
||||
return {
|
||||
filters:{ 'group_or_ledger': "Ledger" }
|
||||
filters:{ "is_group": 0 }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({
|
||||
return {
|
||||
filters: {
|
||||
"company": me.frm.doc.company,
|
||||
"group_or_ledger": "Ledger"
|
||||
"is_group": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ erpnext.stock.StockReconciliation = erpnext.stock.StockController.extend({
|
||||
return {
|
||||
"filters": {
|
||||
'company': me.frm.doc.company,
|
||||
'group_or_ledger': 'Ledger'
|
||||
"is_group": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -73,7 +73,7 @@ erpnext.stock.StockReconciliation = erpnext.stock.StockController.extend({
|
||||
return {
|
||||
"filters": {
|
||||
'company': me.frm.doc.company,
|
||||
'group_or_ledger': 'Ledger'
|
||||
"is_group": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ cur_frm.set_query("create_account_under", function() {
|
||||
return {
|
||||
filters: {
|
||||
"company": cur_frm.doc.company,
|
||||
'group_or_ledger': "Group"
|
||||
'is_group': 1
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -48,7 +48,7 @@ class Warehouse(Document):
|
||||
"doctype": "Account",
|
||||
'account_name': self.warehouse_name,
|
||||
'parent_account': self.create_account_under,
|
||||
'group_or_ledger':'Ledger',
|
||||
'is_group':0,
|
||||
'company':self.company,
|
||||
"account_type": "Warehouse",
|
||||
"warehouse": self.name,
|
||||
|
Loading…
x
Reference in New Issue
Block a user