Merge branch 'develop' into payment-terms

This commit is contained in:
Nabin Hait 2017-11-17 12:41:56 +05:30 committed by GitHub
commit 1c4653ed97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
245 changed files with 45464 additions and 35143 deletions

View File

@ -4,7 +4,7 @@ import inspect
import frappe
from erpnext.hooks import regional_overrides
__version__ = '9.2.11'
__version__ = '9.2.13'
def get_default_company(user=None):
'''Get default company for user'''

View File

@ -47,6 +47,12 @@ frappe.ui.form.on('Account', {
// show / hide convert buttons
frm.trigger('add_toolbar_buttons');
}
if(!frm.doc.__islocal) {
frm.add_custom_button(__('Update Account Number'), function () {
frm.trigger("update_account_number");
});
}
},
account_type: function (frm) {
if (frm.doc.is_group == 0) {
@ -90,6 +96,46 @@ frappe.ui.form.on('Account', {
});
});
}
},
update_account_number: function(frm) {
var d = new frappe.ui.Dialog({
title: __('Update Account Number'),
fields: [
{
"label": "Account Number",
"fieldname": "account_number",
"fieldtype": "Data",
"reqd": 1
}
],
primary_action: function() {
var data = d.get_values();
if(data.account_number === frm.doc.account_number) {
d.hide();
return;
}
frappe.call({
method: "erpnext.accounts.doctype.account.account.update_account_number",
args: {
account_number: data.account_number,
name: frm.doc.name
},
callback: function(r) {
if(!r.exc) {
if(r.message) {
frappe.set_route("Form", "Account", r.message);
} else {
frm.set_value("account_number", data.account_number);
}
d.hide();
}
}
});
},
primary_action_label: __('Update')
});
d.show();
}
});

View File

@ -102,6 +102,36 @@
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "account_number",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 1,
"label": "Account Number",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
@ -545,7 +575,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2017-08-11 15:28:35.855809",
"modified": "2017-08-22 17:39:10.711343",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Account",
@ -655,7 +685,7 @@
"quick_entry": 0,
"read_only": 0,
"read_only_onload": 0,
"search_fields": "",
"search_fields": "account_number",
"show_name_in_global_search": 1,
"sort_order": "ASC",
"track_changes": 1,

View File

@ -3,14 +3,14 @@
from __future__ import unicode_literals
import frappe
from frappe.utils import cint, fmt_money
from frappe.utils import cint, cstr
from frappe import throw, _
from frappe.model.document import Document
from frappe.utils.nestedset import NestedSet
class RootNotEditable(frappe.ValidationError): pass
class BalanceMismatchError(frappe.ValidationError): pass
class Account(Document):
class Account(NestedSet):
nsm_parent_field = 'parent_account'
def onload(self):
@ -20,18 +20,14 @@ class Account(Document):
self.set_onload("can_freeze_account", True)
def autoname(self):
# first validate if company exists
company = frappe.db.get_value("Company", self.company, ["abbr", "name"], as_dict=True)
if not company:
frappe.throw(_('Company {0} does not exist').format(self.company))
self.name = self.account_name.strip() + ' - ' + company.abbr
self.name = get_account_autoname(self.account_number, self.account_name, self.company)
def validate(self):
if frappe.local.flags.allow_unverified_charts:
return
self.validate_parent()
self.validate_root_details()
validate_account_number(self.name, self.account_number, self.company)
self.validate_group_or_ledger()
self.set_root_and_report_type()
self.validate_mandatory()
@ -56,12 +52,15 @@ class Account(Document):
def set_root_and_report_type(self):
if self.parent_account:
par = frappe.db.get_value("Account", self.parent_account, ["report_type", "root_type"], as_dict=1)
par = frappe.db.get_value("Account", self.parent_account,
["report_type", "root_type", "account_type"], as_dict=1)
if par.report_type:
self.report_type = par.report_type
if par.root_type:
self.root_type = par.root_type
if par.account_type and not self.account_type:
self.account_type = par.account_type
if self.is_group:
db_value = frappe.db.get_value("Account", self.name, ["report_type", "root_type"], as_dict=1)
@ -161,31 +160,18 @@ class Account(Document):
if not self.report_type:
throw(_("Report Type is mandatory"))
def update_nsm_model(self):
"""update lft, rgt indices for nested set model"""
import frappe
import frappe.utils.nestedset
frappe.utils.nestedset.update_nsm(self)
def on_update(self):
self.update_nsm_model()
def validate_trash(self):
"""checks gl entries and if child exists"""
def on_trash(self):
# checks gl entries and if child exists
if self.check_gle_exists():
throw(_("Account with existing transaction can not be deleted"))
if self.check_if_child_exists():
throw(_("Child account exists for this account. You can not delete this account."))
def on_trash(self):
self.validate_trash()
self.update_nsm_model()
super(Account, self).on_trash()
def before_rename(self, old, new, merge=False):
# Add company abbr if not provided
from erpnext.setup.doctype.company.company import get_name_with_abbr
new_account = get_name_with_abbr(new, self.company)
new_account = get_name_with_number(new_account, self.account_number)
# Validate properties before merging
if merge:
@ -208,7 +194,25 @@ class Account(Document):
super(Account, self).after_rename(old, new, merge)
if not merge:
frappe.db.set_value("Account", new, "account_name", " - ".join(new.split(" - ")[:-1]))
new_acc = frappe.db.get_value("Account", new, ["account_name", "account_number"], as_dict=1)
# exclude company abbr
new_parts = new.split(" - ")[:-1]
# update account number and remove from parts
if new_parts[0][0].isdigit():
# if account number is separate by space, split using space
if len(new_parts) == 1:
new_parts = new.split(" ")
if new_acc.account_number != new_parts[0]:
self.account_number = new_parts[0]
self.db_set("account_number", new_parts[0])
new_parts = new_parts[1:]
# update account name
account_name = " - ".join(new_parts)
if new_acc.account_name != account_name:
self.account_name = account_name
self.db_set("account_name", account_name)
def get_parent_account(doctype, txt, searchfield, start, page_len, filters):
return frappe.db.sql("""select name from tabAccount
@ -229,3 +233,46 @@ def get_account_currency(account):
return account_currency
return frappe.local_cache("account_currency", account, generator)
def get_account_autoname(account_number, account_name, company):
# first validate if company exists
company = frappe.db.get_value("Company", company, ["abbr", "name"], as_dict=True)
if not company:
frappe.throw(_('Company {0} does not exist').format(company))
parts = [account_name.strip(), company.abbr]
if cstr(account_number).strip():
parts.insert(0, cstr(account_number).strip())
return ' - '.join(parts)
def validate_account_number(name, account_number, company):
if account_number:
account_with_same_number = frappe.db.get_value("Account",
{"account_number": account_number, "company": company, "name": ["!=", name]})
if account_with_same_number:
frappe.throw(_("Account Number {0} already used in account {1}")
.format(account_number, account_with_same_number))
@frappe.whitelist()
def update_account_number(name, account_number):
account = frappe.db.get_value("Account", name, ["account_name", "company"], as_dict=True)
validate_account_number(name, account_number, account.company)
frappe.db.set_value("Account", name, "account_number", account_number)
account_name = account.account_name
if account_name[0].isdigit():
separator = " - " if " - " in account_name else " "
account_name = account_name.split(separator, 1)[1]
frappe.db.set_value("Account", name, "account_name", account_name)
new_name = get_account_autoname(account_number, account_name, account.company)
if name != new_name:
frappe.rename_doc("Account", name, new_name)
return new_name
def get_name_with_number(new_account, account_number):
if account_number and not new_account[0].isdigit():
new_account = account_number + " - " + new_account
return new_account

View File

@ -24,6 +24,8 @@ frappe.treeview_settings["Account"] = {
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")},
{fieldtype:'Data', fieldname:'account_number', label:__('Account Number'),
description: __("Number of new Account, it will be included in the account name as a prefix")},
{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:'root_type', label:__('Root Type'),
@ -41,6 +43,41 @@ frappe.treeview_settings["Account"] = {
description: __("Optional. Sets company's default currency, if not specified.")}
],
ignore_fields:["parent_account"],
onload: function(treeview) {
function get_company() {
return treeview.page.fields_dict.company.get_value();
}
// tools
treeview.page.add_inner_button(__("Chart of Cost Centers"), function() {
frappe.set_route('Tree', 'Cost Center', {company: get_company()});
}, __('View'));
treeview.page.add_inner_button(__("Opening Invoice Creation Tool"), function() {
frappe.set_route('Form', 'Opening Invoice Creation Tool', {company: get_company()});
}, __('View'));
treeview.page.add_inner_button(__("Period Closing Voucher"), function() {
frappe.set_route('List', 'Period Closing Voucher', {company: get_company()});
}, __('View'));
// make
treeview.page.add_inner_button(__("Journal Entry"), function() {
frappe.new_doc('Journal Entry', {company: get_company()});
}, __('Make'));
treeview.page.add_inner_button(__("New Company"), function() {
frappe.new_doc('Company');
}, __('Make'));
// financial statements
for (let report of ['Trial Balance', 'General Ledger', 'Balance Sheet',
'Profit and Loss', 'Cash Flow Statement', 'Accounts Payable', 'Accounts Receivable']) {
treeview.page.add_inner_button(__(report), function() {
frappe.set_route('query-report', report, {company: get_company()});
}, __('Financial Statements'));
}
},
onrender: function(node) {
var dr_or_cr = node.data.balance < 0 ? "Cr" : "Dr";
if (node.data && node.data.balance!==undefined) {

View File

@ -16,12 +16,12 @@ def create_charts(company, chart_template=None, existing_company=None):
if root_account:
root_type = child.get("root_type")
if account_name not in ["account_type", "root_type", "is_group", "tax_rate"]:
if account_name not in ["account_number", "account_type",
"root_type", "is_group", "tax_rate"]:
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)
account_number = cstr(child.get("account_number")).strip()
account_name, account_name_in_db = add_suffix_if_duplicate(account_name,
account_number, accounts)
is_group = identify_is_group(child)
report_type = "Balance Sheet" if root_type in ["Asset", "Liability", "Equity"] \
@ -35,6 +35,7 @@ def create_charts(company, chart_template=None, existing_company=None):
"is_group": is_group,
"root_type": root_type,
"report_type": report_type,
"account_number": account_number,
"account_type": child.get("account_type"),
"account_currency": frappe.db.get_value("Company", company, "default_currency"),
"tax_rate": child.get("tax_rate")
@ -53,10 +54,23 @@ def create_charts(company, chart_template=None, existing_company=None):
_import_accounts(chart, None, None, root_account=True)
def add_suffix_if_duplicate(account_name, account_number, accounts):
if account_number:
account_name_in_db = unidecode(" - ".join([account_number,
account_name.strip().lower()]))
else:
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)
return account_name, account_name_in_db
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", "tax_rate"])):
elif len(set(child.keys()) - set(["account_type", "root_type", "is_group", "tax_rate", "account_number"])):
is_group = 1
else:
is_group = 0
@ -71,6 +85,10 @@ def get_chart(chart_template, existing_company=None):
elif chart_template == "Standard":
from erpnext.accounts.doctype.account.chart_of_accounts.verified import standard_chart_of_accounts
return standard_chart_of_accounts.get()
elif chart_template == "Standard with Numbers":
from erpnext.accounts.doctype.account.chart_of_accounts.verified \
import standard_chart_of_accounts_with_account_number
return standard_chart_of_accounts_with_account_number.get()
else:
folders = ("verified",)
if frappe.local.flags.allow_unverified_charts:
@ -86,7 +104,7 @@ def get_chart(chart_template, existing_company=None):
return json.loads(chart).get("tree")
@frappe.whitelist()
def get_charts_for_country(country):
def get_charts_for_country(country, with_standard=False):
charts = []
def _get_chart_name(content):
@ -111,26 +129,26 @@ def get_charts_for_country(country):
with open(os.path.join(path, fname), "r") as f:
_get_chart_name(f.read())
if len(charts) != 1:
charts.append("Standard")
if len(charts) != 1 or with_standard:
charts += ["Standard", "Standard with Numbers"]
return charts
def get_account_tree_from_existing_company(existing_company):
all_accounts = frappe.get_all('Account',
filters={'company': existing_company},
fields = ["name", "account_name", "parent_account", "account_type",
"is_group", "root_type", "tax_rate"],
all_accounts = frappe.get_all('Account',
filters={'company': existing_company},
fields = ["name", "account_name", "parent_account", "account_type",
"is_group", "root_type", "tax_rate", "account_number"],
order_by="lft, rgt")
account_tree = {}
# fill in tree starting with root accounts (those with no parent)
if all_accounts:
build_account_tree(account_tree, None, all_accounts)
return account_tree
def build_account_tree(tree, parent, all_accounts):
# find children
parent_account = parent.name if parent else ""
@ -139,17 +157,16 @@ def build_account_tree(tree, parent, all_accounts):
# if no children, but a group account
if not children and parent.is_group:
tree["is_group"] = 1
tree["account_number"] = parent.account_number
# build a subtree for each child
for child in children:
if child.account_type == "Stock" and not child.is_group:
tree["is_group"] = 1
continue
# start new subtree
tree[child.account_name] = {}
# assign account_type and root_type
if child.account_type:
tree[child.account_name]["account_number"] = child.account_number
if child.account_type:
tree[child.account_name]["account_type"] = child.account_type
if child.tax_rate:

View File

@ -1,209 +0,0 @@
{
"country_code": "ar",
"name": "Argentina - Plan de Cuentas",
"tree": {
"Cuentas Patrimoniales": {
"ACTIVO": {
"Bienes Inmateriales": {
"Bienes Inmateriales / (-) Amortizaci\u00f3n Acumulada": {},
"Bienes Inmateriales / Concesiones y Franquicias": {},
"Bienes Inmateriales / Marcas de F\u00e1brica": {},
"Bienes Inmateriales / Patentes de Invenci\u00f3n": {}
},
"Bienes de Cambio": {
"(-) Previsi\u00f3n para Desvalorizaci\u00f3n de Bienes de Cambio": {},
"Bienes de Cambio - Mercader\u00edas": {
"Bienes de Cambio - Mercader\u00edas / Categoria de productos 01": {}
},
"Bienes de Cambio - Mercader\u00edas en Tr\u00e1nsito": {},
"Materiales Varios ": {},
"Materias primas": {},
"Productos Elaborados": {},
"Productos en Curso de Elaboraci\u00f3n": {}
},
"Bienes de Uso": {
"Bienes de Uso / (-) Depreciaci\u00f3n Acumulada": {},
"Bienes de Uso / Equipos": {},
"Bienes de Uso / Inmuebles": {},
"Bienes de Uso / Maquinaria": {},
"Bienes de Uso / Rodados": {}
},
"Caja y Bancos": {
"Caja y Bancos - Caja": {
"Caja y bancos - Caja / efectivo ARS": {}
},
"Caja y Bancos - Cuentas Corrientes": {
"Caja y Bancos.../ BCO. CTA CTE ARS": {}
},
"Caja y Bancos - Fondos fijos": {
"Caja y ...- Fondos fijos / caja chica 01 ARS": {}
},
"Caja y Bancos - Moneda Extranjera": {
"Caja y bancos - Caja / efectivo USD": {}
},
"Caja y bancos - Recaudaciones a Depositar ": {},
"Caja y bancos - Valores a Depositar ": {}
},
"Inversiones": {
"Inversiones / (-) Previsi\u00f3n para Devalorizaci\u00f3n de Acciones": {},
"Inversiones / Acciones Permanentes": {},
"Inversiones / Acciones Transitorias": {},
"Inversiones / T\u00edtulos P\u00fablicos": {}
}
},
"Cr\u00e9ditos por Ventas": {
"Cr\u00e9ditos por Ventas / (-) Previsi\u00f3n para Ds. Incobrables": {},
"Cr\u00e9ditos por Ventas / Deudores Morosos": {},
"Cr\u00e9ditos por Ventas / Deudores Varios": {},
"Cr\u00e9ditos por Ventas / Deudores en Gesti\u00f3n Judicial": {},
"Cr\u00e9ditos por Ventas / Deudores por Ventas": {}
},
"Otros Cr\u00e9ditos": {
"Otros Cr\u00e9ditos / (-) Intereses (+) a Devengar": {},
"Otros Cr\u00e9ditos / (-) Previsi\u00f3n para Descuentos": {},
"Otros Cr\u00e9ditos / Accionistas": {},
"Otros Cr\u00e9ditos / Alquileres Pagados por Adelantado": {},
"Otros Cr\u00e9ditos / Anticipo al Personal": {},
"Otros Cr\u00e9ditos / Anticipo de Impuestos": {},
"Otros Cr\u00e9ditos / Anticipos a Proveedores": {},
"Otros Cr\u00e9ditos / Intereses Pagados por Adelantado": {},
"Otros Cr\u00e9ditos / Pr\u00e9stamos otorgados": {}
},
"PASIVO": {
"Deudas Bancarias y Financieras": {
"Deudas Bancarias y Financieras / Adelantos en Cuenta Corriente": {},
"Deudas Bancarias y Financieras / Debentures Emitidos": {},
"Deudas Bancarias y Financieras / Intereses a Pagar": {},
"Deudas Bancarias y Financieras / Obligaciones a Pagar": {},
"Deudas Bancarias y Financieras / Prestamos": {}
},
"Deudas Comerciales": {
"Deudas Comerciales / (-) Intereses a Devengar por Compras al Cr\u00e9dito": {},
"Deudas Comerciales / Anticipos de Clientes": {},
"Deudas Comerciales / Proveedores": {}
},
"Deudas Fiscales": {
"Deudas Fiscales / IVA a Pagar": {},
"Deudas Fiscales / Impuesto a la Ganancia M\u00ednima Presunta a Pagar": {},
"Deudas Fiscales / Impuesto a las Ganancias a Pagar": {},
"Deudas Fiscales / Impuesto a los D\u00e9bitos y Cr\u00e9ditos Bancarios a Pagar": {},
"Deudas Fiscales / Impuesto sobre los Bienes Personales a Pagar": {},
"Deudas Fiscales / Monotributo a Pagar": {}
},
"Deudas Sociales": {
"Deudas Sociales / Cargas Sociales a Pagar": {},
"Deudas Sociales / Provisi\u00f3n para Sueldo Anual Complementario": {},
"Deudas Sociales / Retenciones a Depositar": {},
"Deudas Sociales / Sueldos a Pagar": {}
},
"Otras Deudas": {
"Otras Deudas / Acreedores Varios": {},
"Otras Deudas / Cobros por Adelantado": {},
"Otras Deudas / Dividendos a Pagar": {},
"Otras Deudas / Honorarios Directores y S\u00edndicos a Pagar": {}
},
"Previsiones": {
"Previsiones / Previsi\u00f3n Indemnizaci\u00f3n por Despidos": {},
"Previsiones / Previsi\u00f3n para Garant\u00edas por Service": {},
"Previsiones / Previsi\u00f3n para juicios Pendientes": {}
}
},
"PATRIMONIO NETO": {
"Ajustes al Patrimonio": {
"Ajustes al Patrimonio / Revaluo T\u00e9cnico de Bienes de Uso": {}
},
"Aportes No Capitalizados": {
"Aportes No Capitalizados / Aportes Irrevocables Futura Suscripci\u00f3n de Acciones": {},
"Aportes No Capitalizados / Primas de Emsi\u00f3n": {}
},
"Capital Social": {
"Capital social / (-) Descuento de Emisi\u00f3n de Acciones": {},
"Capital social / Acciones en Circulaci\u00f3n": {},
"Capital social / Capital Suscripto": {},
"Capital social / Dividendos a Distribuir en Acciones": {}
},
"Ganancias Reservadas": {
"Reserva Estatutaria": {},
"Reserva Facultativa": {},
"Reserva Legal": {},
"Reserva para Renovaci\u00f3n de Bienes de Uso": {}
},
"Resultados No Asignados": {
"Ganancias y P\u00e9rdidas del Ejercicio": {},
"Resultado del Ejercicio": {},
"Resultados Acumulados": {},
"Resultados Acumulados del Ejercicio Anterior": {}
}
},
"root_type": ""
},
"Cuentas de Movimiento": {
"Compras": {
"Compras - Categoria de productos 01": {}
},
"Costos de Producci\u00f3n": {},
"Gastos de Administraci\u00f3n": {},
"Gastos de Comercializaci\u00f3n": {},
"root_type": ""
},
"Cuentas de Orden": {
"CUENTAS DE ORDEN ACREEDORAS": {
"Acreedor por Documentos Descontados": {},
"Acreedor por Garant\u00edas Otorgadas": {},
"Comitente por Mercaderias Recibidas en Consignaci\u00f3n": {}
},
"CUENTAS DE ORDEN DEUDORAS": {
"Dep\u00f3sito de Valores Recibos en Garant\u00eda": {},
"Documentos Descontados": {},
"Documentos Endosados": {},
"Garantias Otorgadas": {},
"Mercaderias Recibidas en Consignaci\u00f3n": {}
},
"root_type": ""
},
"Cuentas de Resultado": {
"RESULTADOS NEGATIVOS": {
"Resultados Negativos Extraordinarios": {
"Donaciones Cedidas, Otorgadas": {},
"Gastos en Siniestros": {},
"P\u00e9rdida Venta Bienes de Uso": {}
},
"Resultados Negativos Ordinarios": {
"Costo de Mercader\u00edas Vendidas": {
"Costo de Mercader\u00edas Vendidas - Categoria de productos 01": {}
},
"Gastos Bancarios": {},
"Gastos de Publicidad y Propaganda": {},
"Gastos en Amortizaci\u00f3n": {},
"Gastos en Cargas Sociales": {},
"Gastos en Depreciaci\u00f3n de Bienes de Uso": {},
"Gastos en Impuestos": {},
"Gastos en Servicios P\u00fablicos": {},
"Gastos en Sueldos y Jormales": {}
}
},
"RESULTADOS POSITIVOS": {
"Resultados Positivos Extraordinarios": {
"Donaciones obtenidas, ganandas, percibidas": {},
"Ganancia Venta Inversiones Permanentes": {},
"Ganancia Venta de Bienes de Uso": {},
"Recupero de Deudores Incobrables": {},
"Recupero de Rezagos": {}
},
"Resultados Positivos Ordinarios": {
"Alquileres gananados, obtenidos, percibidos": {},
"Comisiones gananados, obtenidos, percibidos": {},
"Descuentos gananados, obtenidos, percibidos": {},
"Ganancia Venta de Acciones": {},
"Honorarios gananados, obtenidos, percibidos": {},
"Intereses gananados, obtenidos, percibidos": {},
"Renta de T\u00edtulos P\u00fablicos": {},
"Resultados Positivos Ordinarios": {
"Ventas - Categoria de productos 01": {}
}
}
},
"root_type": ""
}
}
}

View File

@ -1,172 +0,0 @@
{
"country_code": "ca",
"name": "Canada - Chart of Accounts for english-speaking provinces",
"tree": {
"ASSETS": {
"CURRENT ASSETS": {
"ACCOUNTS RECEIVABLES": {
"ALLOWANCE FOR DOUBTFUL ACCOUNTS": {},
"Customers Account": {
"account_type": "Receivable"
}
},
"CASH": {},
"CERTIFICATES OF DEPOSITS": {},
"INVESTMENTS HELD FOR TRADING": {},
"PREPAID EXPENSES": {},
"STOCKS": {
"Stock Delivered But Not Billed": {},
"Stock In Hand": {}
},
"TAXES RECEIVABLES": {
"GST receivable": {
"account_type": "Receivable"
},
"HST receivable": {
"HST receivable - 13%": {
"account_type": "Receivable"
},
"HST receivable - 14%": {
"account_type": "Receivable"
},
"HST receivable - 15%": {
"account_type": "Receivable"
}
},
"PST/QST receivable": {
"account_type": "Receivable"
}
},
"TREASURY OR TREASURY EQUIVALENTS": {}
},
"NON-CURRENT ASSETS": {
"INTANGIBLE ASSETS": {
"PATENTS, TRADEMARKS AND COPYRIGHTS": {}
},
"INVESTMENTS AVAILABLE FOR SALE": {},
"TANGIBLE ASSETS": {
"ACCUMULATED DEPRECIATIONS": {}
}
},
"root_type": "Asset"
},
"EQUITY": {
"CONTRIBUTED SURPLUS": {},
"DIVIDENDS": {},
"PREMIUMS": {},
"RETAINED EARNINGS": {},
"SHARE CAPITAL": {},
"TRANSLATION ADJUSTMENTS": {},
"root_type": "Equity"
},
"EXPENSES": {
"NON-OPERATING EXPENSES": {
"INTERESTS EXPENSES": {},
"OTHER NON-OPERATING EXPENSES": {}
},
"OPERATING EXPENSES": {
"COST OF GOODS SOLD": {
"Inside Purchases": {},
"International Purchases": {},
"Purchases in harmonized provinces": {},
"Purchases in non-harmonized provinces": {}
},
"GENERAL EXPENSES": {},
"LABOUR EXPENSES": {
"Annuities": {},
"Employment Insurance": {},
"Federal Income Tax": {},
"Health Services Fund": {},
"Holidays": {},
"Labour Health and Safety": {},
"Labour Standards": {},
"Parental Insurance": {},
"Provincial Income Tax": {},
"Salaries, wages and commissions": {}
},
"OTHER OPERATING EXPENSES": {},
"RESEARCH AND DEVELOPMENT EXPENSES": {},
"SALES EXPENSES": {}
},
"root_type": "Expense"
},
"INCOMES": {
"NON-OPERATING INCOMES": {
"INTERESTS": {},
"OTHER NON-OPERATING INCOMES": {}
},
"OPERATING INCOMES": {
"Harmonized Provinces Sales": {},
"Inside Sales": {},
"International Sales": {},
"Non-Harmonized Provinces Sales": {},
"OTHER OPERATING INCOMES": {}
},
"root_type": "Income"
},
"LIABILITIES": {
"CURRENT LIABILITIES": {
"ACCOUNTS PAYABLES": {
"Suppliers Account": {
"account_type": "Payable"
}
},
"CURRENT FINANCIAL DEBTS": {},
"LABOUR TAXES TO PAY": {
"CANADIAN REVENU AGENCY": {
"EMPLOYMENT INSURANCE TO PAY": {
"EI - Employees Contribution": {},
"EI - Employer Contribution": {}
},
"Federal Income Tax": {}
},
"PROVINCIAL REVENU AGENCY": {
"ANNUITIES TO PAY": {
"Annuities - Employees Contribution": {},
"Annuities - Employer Contribution": {}
},
"Health Services Fund to pay": {},
"Labour Health and Safety to pay": {},
"Labour Standards to pay": {},
"PARENTAL INSURANCE PLAN TO PAY": {
"PAP - Employee Contribution": {},
"PAP - Employer Contribution": {}
},
"Provincial Income Tax": {}
}
},
"LIABILITIES ASSETS HELD FOR TRANSFER": {
"Stock Received But Not Billed": {}
},
"OTHER ACCOUNTS PAYABLES": {},
"STOCK LIABILITIES": {},
"TAXES PAYABLES": {
"GST to pay": {
"account_type": "Payable"
},
"HST to pay": {
"HST to pay - 13%": {
"account_type": "Payable"
},
"HST to pay - 14%": {
"account_type": "Payable"
},
"HST to pay - 15%": {
"account_type": "Payable"
}
},
"PST/QST to pay": {
"account_type": "Payable"
}
}
},
"NON-CURRENT LIABILITIES": {
"DEFERRED TAXES": {},
"NON-CURRENT FINANCIAL DEBTS": {},
"OTHER NON-CURRENT LIABILITIES": {},
"PROVISIONS FOR PENSIONS AND OTHER POST-EMPLOYMENT ADVANTAGES": {}
},
"root_type": "Liability"
}
}
}

View File

@ -1,355 +0,0 @@
{
"country_code": "hu",
"name": "Hungary - Magyar f\u0151k\u00f6nyvi kivonat",
"tree": {
"Eredm\u00e9ny sz\u00e1ml\u00e1k": {
"AZ \u00c9RT\u00c9KES\u00cdT\u00c9S \u00c1RBEV\u00c9TELE, BEV\u00c9TELEK": {
"BELF\u00d6LDI \u00c9RK\u00c9KES\u00cdT\u00c9S \u00c1RBEV\u00c9TELE": {
"Belf\u00f6ldi \u00e9rt\u00e9kes\u00edt\u00e9s \u00e1rbev\u00e9tele": {}
},
"BELF\u00d6LDI \u00c9RT\u00c9KES\u00cdT\u00c9S \u00c1RBEV\u00c9TELE": {
"Belf\u00f6ldi \u00e9rt\u00e9kes\u00edt\u00e9s \u00e1rbev\u00e9tele": {}
},
"EGY\u00c9B BEV\u00c9TELEK": {
"Az \u00fczleti \u00e9vhez kapcs. egy\u00e9b bev\u00e9telek": {},
"Biztos\u00edt\u00f3 \u00e1ltal visszaig. k\u00e1rt\u00e9r\u00edt\u00e9s \u00f6.": {},
"C\u00e9ltartal\u00e9k felhaszn\u00e1l\u00e1sa": {},
"K\u00fcl\u00f6nf\u00e9le egy\u00e9b bev\u00e9telek": {},
"Ut\u00f3lag kapott p\u00fc. rendezett engedm\u00e9ny": {},
"Visszafiz. k\u00f6t. n\u00e9lk\u00fcl kapott t\u00e1mogat\u00e1s": {},
"\u00c9rt,\u00e1truh\u00e1zott k\u00f6vetel\u00e9sek elism.m\u00e9rt\u00e9ke": {},
"\u00c9rt.immat. javak, t\u00e1rgyi eszk.bev\u00e9tele": {},
"\u00c9rt\u00e9kveszt\u00e9sek vissza\u00edr\u00e1sa, tervenf.\u00e9cs.": {}
},
"EXPORT \u00c9RT\u00c9KES\u00cdT\u00c9S \u00c1RBEV\u00c9TELE": {
"Export \u00e9rt\u00e9kes\u00edt\u00e9s \u00e1rbev. EU tagorsz\u00e1gba": {},
"Export \u00e9rt\u00e9kes\u00edt\u00e9s \u00e1rbev.nem EU tagorsz.": {}
},
"P\u00c9NZ\u00dcGYI M\u00dcVELETEK BEV\u00c9TELEI": {
"Befekt. p\u00fci.eszk. kamatai, \u00e1rf.nyeres.": {},
"Egy\u00e9b kapott kamatok,kamatjell.bev\u00e9telek": {},
"Egy\u00e9b p\u00e9nz\u00fcgyi m\u00fbveletek bev\u00e9telei": {},
"Egy\u00e9b \u00e1rfolyamnyeres\u00e9gek, opci\u00f3s bev.": {},
"Forg\u00f3eszk. \u00e9rt\u00e9kpap\u00edr \u00e1rfolyamnyeres\u00e9ge": {},
"Kapott (j\u00e1r\u00f3) osztal\u00e9k, r\u00e9szesed\u00e9s": {},
"R\u00e9szesed\u00e9sek \u00e9rt. \u00e1rfolyamnyeres\u00e9ge": {},
"V\u00e1s. k\u00f6vetel\u00e9sekkel kapcs. bev\u00e9telek": {},
"\u00c1tv\u00e1lt\u00e1si, \u00e1t\u00e9rt\u00e9kel\u00e9skori \u00e1rf.nyeres\u00e9g": {}
},
"RENDKIV\u00dcLI BEV\u00c9TELEK": {
"Rendk\u00edv\u00fcli bev\u00e9telek": {}
}
},
"AZ \u00c9RT\u00c9KES\u00cdT\u00c9S \u00d6NK\u00d6LTS. \u00c9S R\u00c1FORD\u00cdT\u00c1SOK": {
"ANYAGJELLEG\u00db R\u00c1FORD\u00cdT\u00c1SOK": {
"Anyagk\u00f6lts\u00e9g": {},
"Egy\u00e9b szolg\u00e1ltat\u00e1sok \u00e9rt\u00e9ke": {},
"Eladott (k\u00f6zvet\u00edtett) szolg. \u00e9rt\u00e9ke": {},
"Eladott \u00e1ruk beszerz\u00e9si \u00e9rt\u00e9ke": {},
"Ig\u00e9nybevett szolg\u00e1ltat\u00e1sok \u00e9rt\u00e9ke": {}
},
"EGY\u00c9B R\u00c1FORD\u00cdT\u00c1SOK": {
"Ad\u00f3k, illet\u00e9kek, hozz\u00e1j\u00e1rul\u00e1sok": {},
"Az \u00fczleti \u00e9vhez kapcs. r\u00e1ford\u00edt\u00e1sok": {},
"C\u00e9ltartal\u00e9k k\u00e9pz\u00e9se": {},
"Elsz\u00e1molt \u00e9rt\u00e9kveszt\u00e9s, tervenf. \u00e9rt\u00e9kcs": {},
"K\u00fcl\u00f6nf\u00e9le egy\u00e9b r\u00e1ford\u00edt\u00e1sok": {},
"Ut\u00f3lag adott p\u00fc. rendezett engedm\u00e9ny": {},
"\u00c9rt.\u00e1truh\u00e1zott k\u00f6vetel\u00e9sek k\u00f6nyvsz. \u00e9rt.": {},
"\u00c9rt\u00e9kes\u00edtett eszk.imm.javak nytsz \u00e9rt\u00e9ke": {}
},
"NYERES\u00c9GET TERHEL\u00d6 AD\u00d3K": {
"Egyszer\u00fcs\u00edtett v\u00e1llalkoz\u00f3i ad\u00f3": {},
"T\u00e1rsas v\u00e1llalkoz\u00e1s k\u00fcl\u00f6nad\u00f3ja": {},
"T\u00e1rsas\u00e1gi ad\u00f3": {}
},
"P\u00c9NZ\u00dcGYI M\u00dcVELETEK R\u00c1FORD\u00cdT\u00c1SAI": {
"Befektetett p\u00fci. eszk. \u00e1rf.vesztes\u00e9ge": {},
"Egy\u00e9b p\u00e9nz\u00fcgyi r\u00e1ford\u00edt\u00e1sok": {},
"Egy\u00e9b \u00e1rfolyamvesztes\u00e9gek, opci\u00f3s d\u00edjak": {},
"Fizetend\u00f5 kamatok, kamatjell. r\u00e1ford.": {},
"Forg\u00f3eszk. \u00e9rt\u00e9kpap\u00edr \u00e1rf.vesztes\u00e9ge": {},
"R\u00e9szesed\u00e9sek,\u00e9.pap\u00edrok,bankb. \u00e9rt\u00e9kveszt": {},
"V\u00e1s\u00e1rolt k\u00f6v. kapcs. r\u00e1ford\u00edt\u00e1sok": {},
"\u00c1tv\u00e1lt\u00e1si, \u00e9rt\u00e9kel\u00e9si \u00e1rfolyamvesztes\u00e9g": {}
},
"RENDKIV\u00dcLI R\u00c1FORD\u00cdT\u00c1SOK": {
"Egy\u00e9b vagyoncs\u00f6kk. rendk\u00edv\u00fcli r\u00e1ford\u00edt\u00e1s": {},
"Saj\u00e1t \u00fczletr\u00e9sz nyilv\u00e1ntart\u00e1si \u00e9rt\u00e9ke": {},
"Tartoz\u00e1s\u00e1tv. szerz. szerinti \u00f6sszege": {},
"T\u00e1rsas\u00e1gban bevitt eszk. nytsz. \u00e9rt\u00e9ke": {}
},
"SZEM\u00c9LYI JELLEG\u00fb R\u00c1FORD\u00cdT\u00c1SOK": {
"B\u00e9rj\u00e1rul\u00e9kok": {},
"B\u00e9rk\u00f6lts\u00e9g": {},
"Szem\u00e9lyi jelleg\u00fc egy\u00e9b kifizet\u00e9sek": {}
},
"\u00c9RT\u00c9KCS\u00d6KKEN\u00c9SI LE\u00cdR\u00c1S": {}
},
"K\u00d6LTS\u00c9GNEMEK": {
"AKT\u00cdV\u00c1LT SAJ\u00c1T TELJES\u00cdTM\u00c9NYEK \u00c9RT\u00c9KE": {
"Saj\u00e1t el\u00f5\u00e1ll\u00edt\u00e1si eszk\u00f6z\u00f6k aktiv\u00e1lt \u00e9rt.": {},
"Saj\u00e1t term. k\u00e9szletek \u00e1llom\u00e1nyv\u00e1ltoz\u00e1sa": {}
},
"ANYAGK\u00d6LTS\u00c9G": {
"Anyagk\u00f6lts\u00e9g megt\u00e9r\u00fcl\u00e9s": {},
"Egy \u00e9ven bel\u00fcl elhaszn. anyagi eszk\u00f6z\u00f6k": {},
"Egy\u00e9b anyagk\u00f6lts\u00e9g": {},
"V\u00e1s\u00e1rolt anyagok k\u00f6lts\u00e9gei": {}
},
"B\u00c9RJ\u00c1RUL\u00c9KOK": {
"Egyszer\u00fbs\u00edtett fogl. k\u00f6zteher": {},
"Egyszer\u00fbs\u00edtett k\u00f6ztehervisel\u00e9si hj\u00e1r": {},
"Eg\u00e9szs\u00e9g\u00fcgyi hozz\u00e1j\u00e1rul\u00e1s": {},
"K\u00f6zteherjegy": {},
"Munkaad\u00f3i j\u00e1rul\u00e9k": {},
"Rehabilit\u00e1ci\u00f3s hozz\u00e1j\u00e1rul\u00e1s": {},
"Szakk\u00e9pz\u00e9si hozz\u00e1j\u00e1rul\u00e1s": {},
"T\u00e1rsadalombiztos\u00edt\u00e1si j\u00e1rul\u00e9k": {}
},
"B\u00c9RK\u00d6LTS\u00c9G": {
"Egyszer\u00fbs\u00edtett fogl. b\u00e9rk\u00f6lts\u00e9ge": {},
"Megb\u00edz\u00e1si d\u00edjak b\u00e9rk\u00f6lts\u00e9g terh\u00e9re": {},
"Munkav\u00e1llal\u00f3k munkab\u00e9r k\u00f6lts\u00e9ge": {},
"Tagok szem\u00e9lyes k\u00f6zr. ellen\u00e9rt\u00e9ke": {}
},
"EGY\u00c9B SZOLG\u00c1LTAT\u00c1SOK K\u00d6LTS\u00c9GEI": {
"Biztos\u00edt\u00e1si d\u00edjak": {},
"Hat\u00f3s\u00e1gi igazgat\u00e1si d\u00edjak (illet\u00e9kek)": {},
"P\u00e9nz\u00fcgyi szolg-i d\u00edjak, bankk\u00f6lts\u00e9gek": {}
},
"IG\u00c9NYBE VETT SZOLG\u00c1LTAT\u00c1SOK K\u00d6LTS\u00c9GEI": {
"B\u00e9rleti d\u00edjak": {},
"Egy\u00e9b ig\u00e9nybevett szolg\u00e1ltat\u00e1sok ktg-ei": {},
"Hirdet\u00e9s, rekl\u00e1m-propaganda k\u00f6lts\u00e9g": {},
"Jav\u00edt\u00e1si, karbantart\u00e1si k\u00f6lts\u00e9gek": {},
"Oktat\u00e1si, tov\u00e1bbk\u00e9pz\u00e9si k\u00f6lts\u00e9gek": {},
"Postai, t\u00e1vk\u00f6zl\u00e9si k\u00f6lts\u00e9gek": {},
"Szakk\u00f6nyv, foly\u00f3irat, napilap beszerz\u00e9s": {},
"Sz\u00e1ll\u00edt\u00e1si, rakod\u00e1si k\u00f6lts\u00e9g": {},
"Utaz\u00e1si- \u00e9s kik\u00fcldet\u00e9si k\u00f6lts\u00e9gek": {}
},
"K\u00d6LTS\u00c9GNEM \u00c1TVEZET\u00c9SI SZ\u00c1MLA": {
"Anyagk\u00f6lts\u00e9g \u00e1tvezet\u00e9si szla": {},
"B\u00e9rj\u00e1rul\u00e9kok \u00e1tvezet\u00e9si szla": {},
"B\u00e9rk\u00f6lts\u00e9g \u00e1tvezet\u00e9si szla": {},
"Egy\u00e9b szolg\u00e1ltat\u00e1sok \u00e1tvezet\u00e9si szla": {},
"Ig\u00e9nybevett szolg. \u00e1tvezet\u00e9si szla": {},
"Szem\u00e9lyi jell. kif. \u00e1tvezet\u00e9si szla": {},
"\u00c9rt\u00e9kcs\u00f6kken\u00e9si le\u00edr\u00e1s \u00e1tvez. szla": {}
},
"SZEM\u00c9LYI JELLEG\u00fb EGY\u00c9B KIFIZET\u00c9SEK": {
"Egy\u00e9b szem\u00e9lyi jelleg\u00fb kifizet\u00e9sek": {},
"Foglalkoztat\u00f3t terhel\u00f5 t\u00e1pp\u00e9nz hj\u00e1rul\u00e1s": {},
"J\u00f3l\u00e9ti \u00e9s kultur\u00e1lis k\u00f6lts\u00e9gek": {},
"Kifizet\u00f5t terhel\u00f5 szem\u00e9lyi j\u00f6vedelemad\u00f3": {},
"Mag\u00e1nnyugd\u00edjp\u00e9nzt\u00e1ri tagd\u00edjak, hozz\u00e1j\u00e1r.": {},
"Szem\u00e9lyi jelleg\u00fb kifizet\u00e9sek": {},
"Term\u00e9szetbeni juttat\u00e1sok": {}
},
"\u00c9RT\u00c9KCS\u00d6KKEN\u00c9SI LE\u00cdR\u00c1S": {
"Terv szerinti egy\u00f6sszeg\u00fb (kis\u00e9rt\u00e9k\u00fbek)": {},
"Terv szerinti \u00e9rt\u00e9kcs\u00f6kken\u00e9s line\u00e1ris": {}
}
},
"root_type": ""
},
"M\u00e9rleg sz\u00e1ml\u00e1k": {
"BEFEKTETETT ESZK\u00d6Z\u00d6K": {
"BEFEKTETETT P\u00fc.I ESZK\u00d6Z\u00d6K R\u00c9SZESED\u00c9SEK": {
"Egy\u00e9b tart\u00f3s r\u00e9szesed\u00e9s": {},
"R\u00e9szesed\u00e9sek \u00e9rt\u00e9khelyesb\u00edt\u00e9se": {},
"R\u00e9szesed\u00e9sek \u00e9rt\u00e9kveszt\u00e9se, vissza\u00edr\u00e1sa": {},
"Tart\u00f3s r\u00e9szesed\u00e9s kapcs. v\u00e1llalkoz\u00e1sban": {}
},
"BERUH\u00c1Z\u00c1SOK, FEL\u00faJ\u00cdT\u00c1SOK": {
"Befejezetlen beruh\u00e1z\u00e1sok": {},
"Beruh\u00e1z\u00e1sok terven fel\u00fcli \u00e9rt\u00e9kcs\u00f6kk.": {},
"Fel\u00faj\u00edt\u00e1sok": {}
},
"EGY\u00c9B BERENDEZ\u00c9SEK, FELSZ., J\u00c1RM\u00dcVEK": {
"Egy\u00e9b g\u00e9pek,felsz,j\u00e1rm. \u00e9rt\u00e9khelyesb\u00edt\u00e9s": {},
"Egy\u00e9b j\u00e1rm\u00fbvek": {},
"Irodai, igazgat\u00e1si berendez\u00e9sek": {},
"\u00dczemi berendez\u00e9sek, g\u00e9pek,felszerel\u00e9sek": {},
"\u00dczemk\u00f6r\u00f6n kiv\u00fcli berendez\u00e9sek, felsz.": {}
},
"HITELVISZONYT MEGTESTES\u00cdT\u00d6 \u00c9RT\u00c9KPAP\u00cdROK": {
"Egy\u00e9b v\u00e1llalkoz\u00e1sok \u00e9rt\u00e9kpap\u00edrjai": {},
"Kapcsolt v\u00e1llalkoz\u00e1sok \u00e9rt\u00e9kpap\u00edrjai": {},
"Tart\u00f3s diszkont \u00e9rt\u00e9kpap\u00edrok": {},
"\u00c1llamk\u00f6tv\u00e9nyek": {},
"\u00c9rt\u00e9kpap\u00edrok \u00e9rt\u00e9kveszt\u00e9se, vissza\u00edr\u00e1sa": {}
},
"IMMATERI\u00c1LIS JAVAK": {
"Alap\u00edt\u00e1s-\u00e1tszervez\u00e9s akt\u00edv\u00e1lt \u00e9rt\u00e9ke": {},
"Immateri\u00e1lis javak \u00e9rt\u00e9khelyesb\u00edt\u00e9se": {},
"K\u00eds\u00e9rleti fejleszt\u00e9s akt\u00edv\u00e1lt \u00e9rt\u00e9ke": {},
"Szellemi term\u00e9kek": {},
"Vagyoni \u00e9rt\u00e9k\u00fb jogok": {},
"\u00dczleti vagy c\u00e9g\u00e9rt\u00e9k": {}
},
"INGATLANOK, KAPCS. VAGYONI \u00c9RT. JOGOK": {
"Egy\u00e9b \u00e9p\u00edtm\u00e9nyek": {},
"F\u00f6ldter\u00fclet": {},
"Ingatlanhoz kapcs. vagyoni \u00e9rt. jogok": {},
"Ingatlanok \u00e9rt\u00e9khelyesb\u00edt\u00e9se": {},
"Telek, telkes\u00edt\u00e9s": {},
"\u00c9p\u00fcletek,\u00e9p\u00fcletr\u00e9szek,tulajdoni h\u00e1nyadok": {},
"\u00dczemk\u00f6r\u00f6n kiv\u00fcli ingatlanok, \u00e9p\u00fcletek": {}
},
"M\u00dcSZAKI BERENDEZ\u00c9SEK, G\u00c9PEK, J\u00c1RM\u00dcVEK": {
"M\u00fcszaki g\u00e9pek,felsz,j\u00e1rm. \u00e9rt\u00e9khelyesb.": {},
"Termel\u00e9sben r\u00e9sztvev\u00f5 j\u00e1rm\u00fbvek": {},
"Termel\u00f5 g\u00e9pek, berendez\u00e9sek, gy\u00e1rt\u00f3eszk.": {}
},
"TART\u00d3SAN ADOTT K\u00d6LCS\u00d6N\u00d6K": {
"Egy\u00e9b tart\u00f3s bankbet\u00e9tek": {},
"Egy\u00e9b tart\u00f3san adott k\u00f6lcs\u00f6n\u00f6k": {},
"P\u00e9nz\u00fcgyi l\u00edzing miatti tart\u00f3s k\u00f6vetel\u00e9s": {},
"Tart\u00f3s bankbet\u00e9tek egy\u00e9b r\u00e9sz. v\u00e1ll.-ban": {},
"Tart\u00f3s bankbet\u00e9tek kapcs. v\u00e1ll.-ban": {},
"Tart\u00f3san adott k\u00f6lcs\u00f6n egy\u00e9b r\u00e9sz.v\u00e1ll.": {},
"Tart\u00f3san adott k\u00f6lcs\u00f6n\u00f6k kapcs. v\u00e1ll.": {},
"Tart\u00f3san adott k\u00f6lcs\u00f6n\u00f6k \u00e9rt\u00e9kveszt\u00e9se": {}
},
"TENY\u00c9SZ\u00c1LLATOK": {
"Teny\u00e9sz\u00e1llatok": {}
}
},
"FORR\u00c1SOK (PASSZ\u00cdV\u00c1K)": {
"C\u00c9LTARTAL\u00c9KOK": {
"C\u00e9ltartal\u00e9k v\u00e1rhat\u00f3 k\u00f6telezetts\u00e9gre": {}
},
"EGY\u00c9B R\u00d6VID LEJ\u00c1RAT\u00fa K\u00d6TELEZETTS\u00c9GEK": {
"El\u00f5zetesen felsz\u00e1m\u00edtott \u00e1lt.forgalmi ad\u00f3": {},
"Fizetend\u00f5 \u00e1ltal\u00e1nos forgalmi ad\u00f3": {},
"K\u00f6lts\u00e9gvet\u00e9si befizet\u00e9si k\u00f6t.teljes\u00edt\u00e9se": {},
"K\u00f6lts\u00e9gvet\u00e9si befizet\u00e9si k\u00f6telezetts\u00e9gek": {},
"Szem\u00e9lyi j\u00f6vedelemad\u00f3 elsz\u00e1mol\u00e1sa": {},
"T\u00e1rsas\u00e1gi ad\u00f3 \u00e9s osztal\u00e9kad\u00f3 elsz\u00e1mol\u00e1s": {},
"V\u00e1m- \u00e9s P\u00e9nz\u00fcgy\u00f5rs\u00e9g elsz\u00e1mol\u00e1si sz\u00e1mla": {},
"\u00c1fa p\u00e9nz\u00fcgyi elsz\u00e1mol\u00e1si sz\u00e1mla": {},
"\u00d6nkorm\u00e1nyzati ad\u00f3k elsz\u00e1mol\u00e1si sz\u00e1mla": {}
},
"HOSSZ\u00da LEJ\u00c1RAT\u00da K\u00d6TELEZETTS\u00c9GEK": {
"Beruh\u00e1z\u00e1si \u00e9s fejleszt\u00e9si hitelek": {},
"Egy\u00e9b hossz\u00fa lej. k\u00f6telezetts\u00e9gek": {},
"Egy\u00e9b hossz\u00fa lej\u00e1rat\u00fa hitelek": {},
"Hossz\u00fa lej\u00e1ratra kapott k\u00f6lcs\u00f6n\u00f6k": {},
"P\u00e9nz\u00fcgyi l\u00edzinggel kapcsolatos k\u00f6telez.": {},
"Tartoz\u00e1sok k\u00f6tv\u00e9nykibocs\u00e1t\u00e1sb\u00f3l": {},
"Tart\u00f3s k\u00f6t. egy\u00e9b r\u00e9sz. v\u00e1ll. szemben": {},
"Tart\u00f3s k\u00f6t. kapcs. v\u00e1llalkoz\u00e1ssal sz.": {},
"\u00c1tv\u00e1ltoztathat\u00f3 k\u00f6tv\u00e9nyek": {}
},
"H\u00c1TRASOROLT K\u00d6TELEZETTS\u00c9GEK": {
"H\u00e1trasorolt k\u00f6telezetts\u00e9g": {}
},
"PASSZ\u00cdV ID\u00d6BELI ELHAT\u00c1ROL\u00c1S": {
"Bev\u00e9telek passz\u00edv id\u00f5beli elhat\u00e1rol\u00e1sa": {},
"Halasztott bev\u00e9telek": {},
"K\u00f6lts\u00e9gek,r\u00e1ford. passz\u00edv id\u00f5beli elhat.": {}
},
"R\u00d6VID LEJ\u00c1RAT\u00fa K\u00d6TELEZETTS\u00c9GEK": {
"R\u00f6vid lej\u00e1rat\u00fa hitelek": {},
"R\u00f6vid lej\u00e1rat\u00fa k\u00f6lcs\u00f6n\u00f6k": {},
"Sz\u00e1ll\u00edt\u00f3k": {
"Belf\u00f6ldi sz\u00e1ll\u00edt\u00f3k": {
"account_type": "Payable"
},
"K\u00fclf\u00f6ldi sz\u00e1ll\u00edt\u00f3k": {
"account_type": "Payable"
}
},
"Vev\u00f5kt\u00f5l kapott el\u00f5legek": {}
},
"SAJ\u00c1T T\u00d6KE": {
"Eredm\u00e9nytartal\u00e9k": {},
"Jegyzett t\u00f5ke": {},
"Lek\u00f6t\u00f6tt tartal\u00e9k": {},
"M\u00e9rleg szerinti eredm\u00e9ny": {},
"T\u00f5ketartal\u00e9k": {},
"\u00c9rt\u00e9kel\u00e9si tartal\u00e9k": {}
},
"\u00c9VI M\u00c9RLEG SZ\u00c1ML\u00c1K": {
"Nyit\u00f3m\u00e9rleg sz\u00e1mla": {}
}
},
"K\u00c9SZLETEK": {
"ANYAGOK": {
"Seg\u00e9danyagok": {}
},
"BEFEJEZETLEN TERMEL\u00c9S \u00c9S F\u00c9LK\u00c9SZTERM\u00c9KEK": {
"Befejezetlen termel\u00e9s": {}
},
"BET\u00c9TD\u00cdJAS G\u00d6NGY\u00d6LEGEK": {
"Bet\u00e9td\u00edjas g\u00f6ngy\u00f6legek": {}
},
"K\u00c9SZTERM\u00c9KEK": {
"K\u00e9szterm\u00e9kek": {}
},
"K\u00d6ZVET\u00cdTETT SZOLG\u00c1LTAT\u00c1SOK": {
"K\u00f6zvet\u00edtett szolg\u00e1ltat\u00e1sok": {}
},
"\u00c1RUK": {
"\u00c1ruk beszerz\u00e9si \u00e1ron": {}
}
},
"K\u00d6VETEL\u00c9SEK,P\u00c9NZ\u00dcGYI ESZK,AKT\u00cdV ID\u00d6B.ELH": {
"ADOTT EL\u00d6LEGEK": {
"Adott el\u00f5legek": {}
},
"AKT\u00cdV ID\u00d6BELI ELHAT\u00c1ROL\u00c1S": {
"Akt\u00edv id\u00f5beli elhat\u00e1rol\u00e1sa": {}
},
"EGY\u00c9B K\u00d6VETEL\u00c9SEK": {
"K\u00fcl\u00f6nf\u00e9le egy\u00e9b k\u00f6vetel\u00e9sek": {},
"Munkav\u00e1llal\u00f3kkal szembeni k\u00f6vetel\u00e9s": {}
},
"K\u00d6VETEL\u00c9SEK \u00c1RUSZ\u00c1LL.- SZOLG\u00c1LTAT\u00c1SB\u00d3L": {
"Belf\u00f6ldi k\u00f6vetel\u00e9sek": {
"account_type": "Receivable"
},
"K\u00fclf\u00f6ldi k\u00f6vetel\u00e9sek": {
"account_type": "Receivable"
}
},
"P\u00c9NZESZK\u00d6Z\u00d6K": {
"Deviza bet\u00e9tsz\u00e1mla": {
"account_type": "Bank"
},
"Elk\u00fcl\u00f6n\u00edtett bet\u00e9tsz\u00e1ml\u00e1k": {
"account_type": "Bank"
},
"Elsz\u00e1mol\u00e1si bet\u00e9tsz\u00e1mla": {
"Banksz\u00e1mla": {
"account_type": "Bank"
}
},
"P\u00e9nzhelyettes\u00edt\u00f5 eszk. (utalv\u00e1ny, jegy)": {
"account_type": "Bank"
},
"P\u00e9nzt\u00e1rak": {
"P\u00e9nzt\u00e1r": {
"account_type": "Cash"
}
},
"Valuta p\u00e9nzt\u00e1r": {
"account_type": "Cash"
},
"\u00c1tvezet\u00e9si sz\u00e1mla": {
"account_type": "Bank"
}
},
"\u00c9RT\u00c9KPAP\u00cdROK": {
"Egy\u00e9b r\u00e9szesed\u00e9s": {},
"Forgat\u00e1si c\u00e9l\u00fa hitelv. m. \u00e9rt\u00e9kpap\u00edrok": {},
"R\u00e9szesed\u00e9s kapcsolt v\u00e1llalkoz\u00e1sban": {},
"Saj\u00e1t r\u00e9szv\u00e9nyek, saj\u00e1t \u00fczletr\u00e9szek": {}
}
},
"root_type": ""
}
}
}

View File

@ -1,716 +0,0 @@
{
"country_code": "nl",
"name": "Nederlands - Grootboekschema",
"tree": {
"FABRIKAGEREKENINGEN": {
"root_type": ""
},
"FINANCIELE REKENINGEN, KORTLOPENDE VORDERINGEN EN SCHULDEN": {
"KORTLOPENDE SCHULDEN": {
"Accountantskosten": {},
"Af te dragen Btw-verlegd": {
"account_type": "Tax"
},
"Afdracht loonheffing": {},
"Btw af te dragen hoog": {
"account_type": "Tax"
},
"Btw af te dragen laag": {
"account_type": "Tax"
},
"Btw af te dragen overig": {
"account_type": "Tax"
},
"Btw oude jaren": {
"account_type": "Tax"
},
"Btw te vorderen hoog": {
"account_type": "Tax"
},
"Btw te vorderen laag": {
"account_type": "Tax"
},
"Btw te vorderen overig": {
"account_type": "Tax"
},
"Btw-afdracht": {
"account_type": "Tax"
},
"Crediteuren": {
"account_type": "Payable"
},
"Dividend": {},
"Dividendbelasting": {},
"Energiekosten": {},
"Investeringsaftrek": {},
"Loonheffing": {},
"Overige te betalen posten": {},
"Pensioenpremies": {},
"Premie WIR": {},
"Rekening-courant inkoopvereniging": {},
"Rente": {},
"Sociale lasten": {},
"Tanti\u00e8mes": {},
"Te vorderen Btw-verlegd": {
"account_type": "Tax"
},
"Telefoon/telefax": {},
"Termijnen onderh. werk": {},
"Vakantiedagen": {},
"Vakantiegeld": {},
"Vakantiezegels": {},
"Vennootschapsbelasting": {},
"Vooruit ontvangen bedr.": {}
},
"LIQUIDE MIDDELEN": {
"ABN-AMRO bank": {
"account_type": "Cash"
},
"BIZNER bank": {
"account_type": "Cash"
},
"Bankbetaalkaarten": {},
"Effecten": {},
"Girobetaalkaarten": {},
"Kas": {
"account_type": "Cash"
},
"Kas valuta": {
"account_type": "Cash"
},
"Kleine kas": {
"account_type": "Cash"
},
"Kruisposten": {},
"Postbank": {
"account_type": "Cash"
},
"RABO bank": {
"account_type": "Cash"
}
},
"VORDERINGEN": {
"Debiteuren": {
"account_type": "Receivable"
},
"Dubieuze debiteuren": {},
"Overige vorderingen": {},
"Rekening-courant directie": {},
"Te ontvangen ziekengeld": {},
"Voorschotten personeel": {},
"Vooruitbetaalde kosten": {},
"Voorziening dubieuze debiteuren": {}
},
"root_type": ""
},
"INDIRECTE KOSTEN": {
"root_type": ""
},
"KOSTENREKENINGEN": {
"AFSCHRIJVINGEN": {
"Aanhangwagens": {},
"Aankoopkosten": {},
"Aanloopkosten": {},
"Auteursrechten": {},
"Bedrijfsgebouwen": {},
"Bedrijfsinventaris": {},
"Drankvergunningen": {},
"Fabrieksinventaris": {},
"Gebouwen": {},
"Gereedschappen": {},
"Goodwill": {},
"Grondverbetering": {},
"Heftrucks": {},
"Kantine-inventaris": {},
"Kantoorinventaris": {},
"Kantoormachines": {},
"Licenties": {},
"Machines": {},
"Magazijninventaris": {},
"Octrooien": {},
"Ontwikkelingskosten": {},
"Pachtersinvestering": {},
"Parkeerplaats": {},
"Personenauto's": {},
"Rijwielen en bromfietsen": {},
"Tonnagevergunningen": {},
"Verbouwingen": {},
"Vergunningen": {},
"Voorraadverschillen": {},
"Vrachtauto's": {},
"Winkels": {},
"Woon-winkelhuis": {}
},
"ALGEMENE KOSTEN": {
"Accountantskosten": {},
"Advieskosten": {},
"Assuranties": {},
"Bankkosten": {},
"Juridische kosten": {},
"Overige algemene kosten": {},
"Toev. Ass. eigen risico": {}
},
"BEDRIJFSKOSTEN": {
"Assuranties": {},
"Energie (krachtstroom)": {},
"Gereedschappen": {},
"Hulpmaterialen": {},
"Huur inventaris": {},
"Huur machines": {},
"Leasing invent.operational": {},
"Leasing mach. operational": {},
"Onderhoud inventaris": {},
"Onderhoud machines": {},
"Ophalen/vervoer afval": {},
"Overige bedrijfskosten": {}
},
"FINANCIERINGSKOSTEN": {
"Overige rentebaten": {},
"Overige rentelasten": {},
"Rente bankkrediet": {},
"Rente huurkoopcontracten": {},
"Rente hypotheek": {},
"Rente leasecontracten": {},
"Rente lening o/g": {},
"Rente lening u/g": {}
},
"HUISVESTINGSKOSTEN": {
"Assurantie onroerend goed": {},
"Belastingen onr. Goed": {},
"Energiekosten": {},
"Groot onderhoud onr. Goed": {},
"Huur": {},
"Huurwaarde woongedeelte": {},
"Onderhoud onroerend goed": {},
"Ontvangen huren": {},
"Overige huisvestingskosten": {},
"Pacht": {},
"Schoonmaakkosten": {},
"Toevoeging egalisatieres. Groot onderhoud": {}
},
"KANTOORKOSTEN": {
"Administratiekosten": {},
"Contributies/abonnementen": {},
"Huur kantoorapparatuur": {},
"Internetaansluiting": {},
"Kantoorbenodigdh./drukw.": {},
"Onderhoud kantoorinvent.": {},
"Overige kantoorkosten": {},
"Porti": {},
"Telefoon/telefax": {}
},
"OVERIGE BATEN EN LASTEN": {
"Betaalde schadevergoed.": {},
"Boekverlies vaste activa": {},
"Boekwinst van vaste activa": {},
"K.O. regeling OB": {},
"Kasverschillen": {},
"Kosten loonbelasting": {},
"Kosten omzetbelasting": {},
"Nadelige koersverschillen": {},
"Naheffing bedrijfsver.": {},
"Ontvangen schadevergoed.": {},
"Overige baten": {},
"Overige lasten": {},
"Voordelige koersverschil.": {}
},
"PERSONEELSKOSTEN": {
"Autokostenvergoeding": {},
"Bedrijfskleding": {},
"Belastingvrije uitkeringen": {},
"Bijzondere beloningen": {},
"Congressen, seminars en symposia": {},
"Gereedschapsgeld": {},
"Geschenken personeel": {},
"Gratificaties": {},
"Inhouding pensioenpremies": {},
"Inhouding sociale lasten": {},
"Kantinekosten": {},
"Lonen en salarissen": {},
"Loonwerk": {},
"Managementvergoedingen": {},
"Opleidingskosten": {},
"Oprenting stamrechtverpl.": {},
"Overhevelingstoeslag": {},
"Overige kostenverg.": {},
"Overige personeelskosten": {},
"Overige uitkeringen": {},
"Pensioenpremies": {},
"Provisie": {},
"Reiskosten": {},
"Rijwielvergoeding": {},
"Sociale lasten": {},
"Tanti\u00e8mes": {},
"Thuiswerkers": {},
"Toev. Backservice pens.verpl.": {},
"Toevoeging pensioenverpl.": {},
"Uitkering ziekengeld": {},
"Uitzendkrachten": {},
"Vakantiebonnen": {},
"Vakantiegeld": {},
"Vergoeding studiekosten": {},
"Wervingskosten personeel": {}
},
"VERKOOPKOSTEN": {
"Advertenties": {},
"Afschrijving dubieuze deb.": {},
"Beurskosten": {},
"Etalagekosten": {},
"Exportkosten": {},
"Kascorrecties": {},
"Overige verkoopkosten": {},
"Provisie": {},
"Reclame": {},
"Reis en verblijfkosten": {},
"Relatiegeschenken": {},
"Representatiekosten": {},
"Uitgaande vrachten": {},
"Veilingkosten": {},
"Verpakkingsmateriaal": {},
"Websitekosten": {}
},
"VERVOERSKOSTEN": {
"Assuranties auto's": {},
"Brandstoffen": {},
"Leasing auto's": {},
"Onderhoud personenauto's": {},
"Onderhoud vrachtauto's": {},
"Overige vervoerskosten": {},
"Priv\u00e9-gebruik auto's": {},
"Wegenbelasting": {}
},
"root_type": ""
},
"OVERIGE RESULTATEN": {
"Memoriaal": {
"account_type": "Cash"
},
"Opbrengsten deelnemingen": {},
"Reorganisatiekosten": {},
"Verlies verkoop deelnem.": {},
"Voorz. Verlies deelnem.": {},
"Vpb bijzonder resultaat": {},
"Vpb normaal resultaat": {},
"Winst": {},
"Winst bij verkoop deelnem.": {},
"root_type": ""
},
"TUSSENREKENINGEN": {
"Betaalwijze cadeaubonnen": {
"account_type": "Cash"
},
"Betaalwijze chipknip": {
"account_type": "Cash"
},
"Betaalwijze contant": {
"account_type": "Cash"
},
"Betaalwijze pin": {
"account_type": "Cash"
},
"Inkopen Nederland hoog": {
"account_type": "Cash"
},
"Inkopen Nederland laag": {
"account_type": "Cash"
},
"Inkopen Nederland onbelast": {
"account_type": "Cash"
},
"Inkopen Nederland overig": {
"account_type": "Cash"
},
"Inkopen Nederland verlegd": {
"account_type": "Cash"
},
"Inkopen binnen EU hoog": {
"account_type": "Cash"
},
"Inkopen binnen EU laag": {
"account_type": "Cash"
},
"Inkopen binnen EU overig": {
"account_type": "Cash"
},
"Inkopen buiten EU hoog": {
"account_type": "Cash"
},
"Inkopen buiten EU laag": {
"account_type": "Cash"
},
"Inkopen buiten EU overig": {
"account_type": "Cash"
},
"Kassa 1": {
"account_type": "Cash"
},
"Kassa 2": {
"account_type": "Cash"
},
"Netto lonen": {
"account_type": "Cash"
},
"Tegenrekening Inkopen": {
"account_type": "Cash"
},
"Tussenrek. autom. betalingen": {
"account_type": "Cash"
},
"Tussenrek. autom. loonbetalingen": {
"account_type": "Cash"
},
"Tussenrek. cadeaubonbetalingen": {
"account_type": "Cash"
},
"Tussenrekening balans": {
"account_type": "Cash"
},
"Tussenrekening chipknip": {
"account_type": "Cash"
},
"Tussenrekening correcties": {
"account_type": "Cash"
},
"Tussenrekening pin": {
"account_type": "Cash"
},
"Vraagposten": {
"account_type": "Cash"
},
"root_type": ""
},
"VASTE ACTIVA, EIGEN VERMOGEN, LANGLOPEND VREEMD VERMOGEN EN VOORZIENINGEN": {
"EIGEN VERMOGEN": {
"Aandelenkapitaal": {
"account_type": "Equity"
},
"Assuranties": {
"account_type": "Equity"
},
"Buitengewone lasten": {
"account_type": "Equity"
},
"Giften": {
"account_type": "Equity"
},
"Huishoudgeld": {
"account_type": "Equity"
},
"Inkomstenbelasting": {
"account_type": "Equity"
},
"Kapitaal": {
"account_type": "Equity"
},
"Overige persoonlijke verplichtingen": {
"account_type": "Equity"
},
"Overige priv\u00e9-uitgaven": {
"account_type": "Equity"
},
"Overige reserves": {
"account_type": "Equity"
},
"Premie lijfrenteverzekeringen": {
"account_type": "Equity"
},
"Premie volksverzekeringen": {
"account_type": "Equity"
},
"Priv\u00e9-gebruik": {
"account_type": "Equity"
},
"Priv\u00e9-opnamen/stortingen": {
"account_type": "Equity"
},
"Vermogensbelasting": {
"account_type": "Equity"
},
"WAO en ziekengeldverzekeringen": {
"account_type": "Equity"
},
"Wettelijke reserves": {
"account_type": "Equity"
}
},
"FINANCIELE VASTE ACTIVA EN LANGLOPENDE VORDERINGEN": {
"FINANCIELE VASTE ACTIVA": {
"Aandeel inkoopcombinatie": {},
"Meerderheidsdeelnemingen": {},
"Minderheidsdeelnemingen": {}
},
"LANGLOPENDE VORDERINGEN": {
"Financieringskosten": {},
"Financieringskosten huurkoop": {},
"Hypotheken u/g 1": {},
"Hypotheken u/g 2": {},
"Hypotheken u/g 3": {},
"Leningen u/g 1": {},
"Leningen u/g 2": {},
"Leningen u/g 3": {},
"Leningen u/g 4": {},
"Leningen u/g 5": {},
"Vorderingen op deelnemingen": {},
"Waarborgsommen": {}
}
},
"IMMATERIELE ACTIVA": {
"Aanschafwaarde Aanloopkosten": {},
"Aanschafwaarde Auteursrechten": {},
"Aanschafwaarde Drankvergunningen": {},
"Aanschafwaarde Goodwill": {},
"Aanschafwaarde Octrooien": {},
"Aanschafwaarde Ontwikkelingskosten": {},
"Aanschafwaarde Tonnagevergunningen": {},
"Aanschafwaarde Vergunningen": {},
"Afschrijving Aanloopkosten": {},
"Afschrijving Auteursrechten": {},
"Afschrijving Drankvergunningen": {},
"Afschrijving Goodwill": {},
"Afschrijving Licenties": {},
"Afschrijving Octrooien": {},
"Afschrijving Ontwikkelingskosten": {},
"Afschrijving Tonnagevergunningen": {},
"Afschrijving Vergunningen": {}
},
"LANGLOPENDE SCHULDEN EN AFLOSSINGEN": {
"AFLOSSINGEN": {
"Huurkoopverplichtingen": {},
"Hypotheek o/g 1": {},
"Hypotheek o/g 2": {},
"Hypotheek o/g 3": {},
"Hypotheek o/g 4": {},
"Hypotheek o/g 5": {},
"Lease-verplichtingen": {}
},
"LANGLOPENDE SCHULDEN": {
"Huurkoopverplichtingen": {},
"Hypotheken o/g 1": {},
"Hypotheken o/g 2": {},
"Hypotheken o/g 3": {},
"Hypotheken o/g 4": {},
"Hypotheken o/g 5": {},
"Lease-verplichtingen": {},
"Leningen o/g 1": {},
"Leningen o/g 2": {},
"Leningen o/g 3": {},
"Leningen o/g 4": {},
"Leningen o/g 5": {},
"Rekening-courant directie": {}
}
},
"MACHINES EN INVENTARIS": {
"INVENTARIS": {
"Aanschafwaarde Bedrijfsinventaris": {},
"Aanschafwaarde Fabrieksinventaris": {},
"Aanschafwaarde Gereedschappen": {},
"Aanschafwaarde Kantine-inventaris": {},
"Aanschafwaarde Kantoorinventaris": {},
"Aanschafwaarde Kantoormachines": {},
"Aanschafwaarde Magazijninventaris": {},
"Afschrijving Bedrijfsinventaris": {},
"Afschrijving Fabrieksinventaris": {},
"Afschrijving Gereedschappen": {},
"Afschrijving Kantine-inventaris": {},
"Afschrijving Kantoorinventaris": {},
"Afschrijving Kantoormachines": {},
"Afschrijving Magazijninventaris": {}
},
"MACHINES": {
"Aanschafwaarde Machines 1": {},
"Aanschafwaarde Machines 2": {},
"Aanschafwaarde Machines 3": {},
"Aanschafwaarde Machines 4": {},
"Aanschafwaarde Machines 5": {},
"Afschrijving Machines 1": {},
"Afschrijving Machines 2": {},
"Afschrijving Machines 3": {},
"Afschrijving Machines 4": {},
"Afschrijving Machines 5": {}
}
},
"ONROERENDE GOEDEREN": {
"Aanschafwaarde Aanloopkosten": {},
"Aanschafwaarde Bedrijfsgebouwen": {},
"Aanschafwaarde Gebouwen": {},
"Aanschafwaarde Grondverbetering": {},
"Aanschafwaarde Landerijen": {},
"Aanschafwaarde Ondergrond gebouwen": {},
"Aanschafwaarde Pachtersinvesteringen": {},
"Aanschafwaarde Parkeerplaats": {},
"Aanschafwaarde Verbouwingen": {},
"Aanschafwaarde Winkels": {},
"Aanschafwaarde Woon-winkelhuis": {},
"Afschrijving Aanloopkosten": {},
"Afschrijving Bedrijfsgebouwen": {},
"Afschrijving Gebouwen": {},
"Afschrijving Grondverbetering": {},
"Afschrijving Pachtersinvesteringen": {},
"Afschrijving Parkeerplaats": {},
"Afschrijving Verbouwingen": {},
"Afschrijving Winkels": {},
"Afschrijving Woon-winkelhuis": {}
},
"VERVOERMIDDELEN": {
"Aanschafwaarde Aanhangwagens": {},
"Aanschafwaarde Heftrucks": {},
"Aanschafwaarde Personenauto's": {},
"Aanschafwaarde Rijwielen en bromfietsen": {},
"Aanschafwaarde Vrachtauto's": {},
"Afschrijving Aanhangwagens": {},
"Afschrijving Heftrucks": {},
"Afschrijving Personenauto's": {},
"Afschrijving Rijwielen en bromfietsen": {},
"Afschrijving Vrachtauto's": {}
},
"VOORZIENINGEN": {
"Assurantie eigen risico": {
"account_type": "Equity"
},
"Backservice pensioenverpl.": {
"account_type": "Equity"
},
"Egalisatierekening WIR": {
"account_type": "Equity"
},
"Egalisatieres. grootonderh.": {
"account_type": "Equity"
},
"Garantieverplichtingen": {
"account_type": "Equity"
},
"Latente belastingverpl.": {
"account_type": "Equity"
},
"Pens.voorz. eigen beheer": {
"account_type": "Equity"
},
"Pensioenverplichtingen": {
"account_type": "Equity"
},
"Stamrechtverplichtingen": {
"account_type": "Equity"
},
"Vervangingsreserve": {
"account_type": "Equity"
},
"Voorziening deelnemingen": {
"account_type": "Equity"
}
},
"root_type": ""
},
"VERKOOPRESULTATEN": {
"Diensten fabric. 0% niet-EU": {},
"Diensten fabricage 0% EU": {},
"Diensten fabricage hoog": {},
"Diensten fabricage laag": {},
"Diensten fabricage overig": {},
"Diensten handel 0% EU": {},
"Diensten handel 0% niet-EU": {},
"Diensten handel hoog tarief": {},
"Diensten handel laag tarief": {},
"Verkopen Fabric. 0% niet-EU": {},
"Verkopen Handel 0% niet-EU": {},
"Verkopen fabric. 0 % EU": {},
"Verkopen fabricage hoog": {},
"Verkopen fabricage laag": {},
"Verkopen fabricage overig": {},
"Verkopen handel 0% EU": {},
"Verkopen handel hoog": {},
"Verkopen handel laag": {},
"Verkopen handel overig": {},
"Verleende Kredietbep. fabricage": {},
"Verleende Kredietbep. handel": {},
"root_type": ""
},
"VOORRAAD GEREED PRODUCT EN ONDERHANDEN WERK": {
"Betalingskort. crediteuren": {},
"Garantiekosten": {},
"Hulpmaterialen": {},
"Inkomende vrachten": {},
"Inkoop import buiten EU hoog": {},
"Inkoop import buiten EU laag": {},
"Inkoop import buiten EU overig": {},
"Inkoopbonussen": {},
"Inkoopkosten": {},
"Inkoopprovisie": {},
"Inkopen BTW verlegd": {},
"Inkopen EU hoog tarief": {},
"Inkopen EU laag tarief": {},
"Inkopen EU overig": {},
"Inkopen hoog": {},
"Inkopen laag": {},
"Inkopen nul": {},
"Inkopen overig": {},
"Invoerkosten": {},
"Kosten inkoopvereniging": {},
"Kostprijs omzet grondstoffen": {},
"Kostprijs omzet handelsgoederen": {},
"Onttrekking uitgev.garantie": {},
"Priv\u00e9-gebruik goederen": {},
"Tegenrekening inkoop": {},
"Toev. Voorz. incour. grondst.": {},
"Toevoeging garantieverpl.": {},
"Toevoeging voorz. incour. handelsgoed.": {},
"Uitbesteed werk": {},
"Voorz. Incourourant grondst.": {},
"Voorz.incour. handelsgoed.": {},
"root_type": ""
},
"VOORRAAD GRONDSTOFFEN, HULPMATERIALEN EN HANDELSGOEDEREN": {
"Emballage": {
"account_type": "Cash"
},
"Gereed product 1": {
"account_type": "Cash"
},
"Gereed product 2": {
"account_type": "Cash"
},
"Goederen 1": {
"account_type": "Cash"
},
"Goederen 2": {
"account_type": "Cash"
},
"Goederen in consignatie": {
"account_type": "Cash"
},
"Goederen onderweg": {
"account_type": "Cash"
},
"Grondstoffen 1": {
"account_type": "Cash"
},
"Grondstoffen 2": {
"account_type": "Cash"
},
"Halffabrikaten 1": {
"account_type": "Cash"
},
"Halffabrikaten 2": {
"account_type": "Cash"
},
"Hulpstoffen 1": {
"account_type": "Cash"
},
"Hulpstoffen 2": {
"account_type": "Cash"
},
"Kantoorbenodigdheden": {
"account_type": "Cash"
},
"Onderhanden werk": {
"account_type": "Cash"
},
"Verpakkingsmateriaal": {
"account_type": "Cash"
},
"Zegels": {
"account_type": "Cash"
},
"root_type": ""
}
}
}

View File

@ -1,6 +1,6 @@
{
"country_code": "fr",
"name": "France - Plan Comptable G\u00e9n\u00e9ral",
"name": "France - Plan Comptable General",
"tree": {
"1-Comptes de Capitaux": {
"10-Capital et R\u00e9serves": {

View File

@ -2,7 +2,394 @@
"country_code": "gt",
"name": "Guatemala - Cuentas",
"tree": {
"02 - Pasivos": {
"Activos": {
"Activo Corriente": {
"Activos Biol\u00f3gicos": {
"Activos Biol\u00f3gicos a Valor Razonable": {
"Animales": {
"account_number": "1.5.2.1",
"account_type": "Stock",
"is_group": 1
},
"Plantas": {
"account_number": "1.5.2.2",
"account_type": "Stock",
"is_group": 1
},
"account_number": "1.5.2",
"account_type": "Stock"
},
"Activos Biol\u00f3gicos al Costo": {
"account_number": "1.5.1",
"account_type": "Stock",
"is_group": 1
},
"account_number": "1.5",
"account_type": "Stock"
},
"Activos Corrientes Adicionales": {
"Activos Diferidos o Restringidos": {
"Cr\u00e9dito Fiscal (IVA Por Cobrar)": {
"account_number": "1.1.2.1",
"account_type": "Chargeable",
"is_group": 1
},
"account_number": "1.1.2",
"account_type": "Chargeable"
},
"Inversiones Corrientes no Clasificados como Equivalentes de Caja y Bancos": {
"account_number": "1.1.1"
},
"account_number": "1.1",
"account_type": "Chargeable"
},
"Activos Devengables y Otros Activos": {
"Activos Adicionales y Otros": {
"account_number": "1.6.6",
"account_type": "Chargeable",
"is_group": 1
},
"Cobrables Relacionados con Impuestos": {
"account_number": "1.6.2",
"account_type": "Chargeable",
"is_group": 1
},
"Contratos de Construccion": {
"account_number": "1.6.4",
"account_type": "Chargeable",
"is_group": 1
},
"Costos de Montaje": {
"account_number": "1.6.5",
"account_type": "Chargeable",
"is_group": 1
},
"Pagos Anticipados y Otros Activos Circulantes": {
"Seguro Pagado Anticipadamente": {
"account_number": "1.6.1.0",
"account_type": "Chargeable"
},
"account_number": "1.6.1",
"account_type": "Chargeable"
},
"Proveedores de Servicio": {
"account_number": "1.6.3",
"account_type": "Chargeable",
"is_group": 1
},
"account_number": "1.6",
"account_type": "Chargeable"
},
"Activos Financieros": {
"Activos Financieros Clasificados por Designaci\u00f3n": {
"account_number": "1.4.6",
"account_type": "Chargeable",
"is_group": 1
},
"Activos Financieros Derivados": {
"account_number": "1.4.3",
"account_type": "Chargeable",
"is_group": 1
},
"Inversion o Participaci\u00f3n Accionaria en Empresas Afiliadas": {
"account_number": "1.4.1",
"account_type": "Chargeable",
"is_group": 1
},
"Inversiones Burs\u00e1tiles e Instrumentos Financieros": {
"account_number": "1.4.2",
"account_type": "Chargeable",
"is_group": 1
},
"Otros Activos Financieros": {
"account_number": "1.4.4",
"account_type": "Chargeable",
"is_group": 1
},
"Provisi\u00f3n por Riesgo de Cr\u00e9dito (agregado) (Contra-activo)": {
"account_number": "1.4.5",
"account_type": "Round Off",
"is_group": 1
},
"account_number": "1.4",
"account_type": "Chargeable"
},
"Activos Intangibles": {
"account_number": "1.3",
"account_type": "Chargeable",
"is_group": 1
},
"Caja y Equivalentes": {
"Caja": {
"account_number": "1.9.1",
"account_type": "Cash",
"is_group": 1
},
"Equivalentes de Efectivo (Bancos)": {
"Bancos Internacionales": {
"HSBC": {
"account_number": "1.9.2.2.1",
"account_type": "Bank"
},
"account_number": "1.9.2.2",
"account_type": "Bank"
},
"Bancos Nacionales": {
"Banco Agromercantil de Guatemala": {
"account_number": "1.9.2.1.2",
"account_type": "Bank"
},
"Banco G&T Continental": {
"account_number": "1.9.2.1.5",
"account_type": "Bank"
},
"Banco Industrial": {
"account_number": "1.9.2.1.1",
"account_type": "Bank",
"is_group": 1
},
"Banco Internacional": {
"account_number": "1.9.2.1.6",
"account_type": "Bank"
},
"Banco Prom\u00e9rica": {
"account_number": "1.9.2.1.3",
"account_type": "Bank"
},
"Banco de Am\u00e9rica Central": {
"account_number": "1.9.2.1.4",
"account_type": "Bank"
},
"Banco de Desarrollo Rural": {
"account_number": "1.9.2.1.7",
"account_type": "Bank"
},
"Banco de los Trabajadores": {
"account_number": "1.9.2.1.8",
"account_type": "Bank"
},
"Vivibanco": {
"account_number": "1.9.2.1.9",
"account_type": "Bank"
},
"account_number": "1.9.2.1",
"account_type": "Bank"
},
"Cadena de Bloques (Blockchain)": {
"Billetera Bitcoin 1234567890abcdefg": {
"account_number": "1.9.2.3.1",
"account_type": "Cash"
},
"account_number": "1.9.2.3",
"account_type": "Cash"
},
"account_number": "1.9.2",
"account_type": "Bank"
},
"Inversiones a Corto Plazo": {
"account_number": "1.9.3",
"account_type": "Bank",
"is_group": 1
},
"Otros Equivalentes de Caja y Bancos": {
"account_number": "1.9.4",
"account_type": "Cash",
"is_group": 1
},
"account_number": "1.9",
"account_type": "Bank"
},
"Cobrables": {
"Activos bajo Contrato": {
"account_number": "1.8.2",
"account_type": "Receivable",
"is_group": 1
},
"Ajustes": {
"account_number": "1.8.4",
"account_type": "Chargeable",
"is_group": 1
},
"Otras Cuentas por Cobrar": {
"Cuentas Por Cobrar Compa\u00f1\u00edas Afiliadas": {
"Compa\u00f1\u00eda subsidiaria (EJEMPLO)": {
"account_number": "1.8.3.2.1",
"account_type": "Receivable"
},
"account_number": "1.8.3.2",
"account_type": "Receivable"
},
"Cuentas por Cobrar a Empleados": {
"Prestamo EJEMPLO": {
"account_number": "1.8.3.3.1",
"account_type": "Receivable"
},
"account_number": "1.8.3.3",
"account_type": "Receivable"
},
"Cuentas por Cobrar a Otras Entidades no Afiliadas": {
"Compa\u00f1\u00eda No Afiliada (EJEMPLO)": {
"account_number": "1.8.3.1.1",
"account_type": "Receivable"
},
"account_number": "1.8.3.1",
"account_type": "Receivable"
},
"account_number": "1.8.3",
"account_type": "Receivable"
},
"Ventas al Cr\u00e9dito": {
"account_number": "1.8.1",
"account_type": "Receivable",
"is_group": 1
},
"account_number": "1.8",
"account_type": "Receivable"
},
"Impuestos por Cobrar": {
"Retenciones de IVA recibidas": {}
},
"Inventario": {
"Art\u00edculos de Inventario Adicionales": {
"account_number": "1.7.8",
"account_type": "Stock",
"is_group": 1
},
"Combustibles": {
"account_number": "1.7.5",
"account_type": "Stock",
"is_group": 1
},
"Inventarios Pignorados Como Garant\u00eda de Pasivo": {
"account_number": "1.7.10",
"account_type": "Stock",
"is_group": 1
},
"Inventarios a Valor Razonable Menos Costos de Venta": {
"account_number": "1.7.11",
"account_type": "Stock",
"is_group": 1
},
"Materia Prima": {
"account_number": "1.7.1",
"account_type": "Stock",
"is_group": 1
},
"Mercader\u00eda (Mercanc\u00edas)": {
"account_number": "1.7.2",
"account_type": "Stock",
"is_group": 1
},
"Otros Inventarios": {
"Merma o Ajuste de Inventario": {
"account_number": "1.7.9.1",
"account_type": "Stock Adjustment",
"is_group": 1
},
"account_number": "1.7.9",
"account_type": "Stock"
},
"Producto Terminado": {
"account_number": "1.7.7",
"account_type": "Stock",
"is_group": 1
},
"Repuestos": {
"Respuestos en Transito": {
"account_number": "1.7.4.0",
"account_type": "Stock",
"is_group": 1
},
"account_number": "1.7.4",
"account_type": "Stock"
},
"Suministros de Producci\u00f3n y Consumibles": {
"account_number": "1.7.3",
"account_type": "Stock",
"is_group": 1
},
"Trabajo en Progeso": {
"account_number": "1.7.6",
"account_type": "Stock",
"is_group": 1
},
"account_number": "1.7",
"account_type": "Stock"
},
"Inversion en Propiedades": {
"Inversion Inmobiliaria Bajo Construccion": {
"account_number": "1.2.1",
"account_type": "Chargeable"
},
"Inversion Inmobiliaria Construida": {
"account_number": "1.2.2",
"account_type": "Chargeable",
"is_group": 1
},
"account_number": "1.2",
"account_type": "Chargeable"
},
"account_number": "1.0"
},
"No Corriente": {
"Activos Fijos": {
"account_type": "Fixed Asset"
},
"Cargos Diferidos": {}
},
"account_number": "1",
"root_type": "Asset"
},
"Costos": {
"Costo de Ventas": {
"account_type": "Cost of Goods Sold"
},
"Costos Incluidos en la Valuaci\u00f3n": {
"account_type": "Expenses Included In Valuation"
},
"Merma o Ajuste de Inventario": {
"account_type": "Stock Adjustment"
},
"account_number": "5",
"root_type": "Expense"
},
"Gastos": {
"Alquileres": {},
"Depreciaciones": {
"account_type": "Depreciation"
},
"Gastos Diversos": {},
"Gastos de Personal": {},
"Honorarios Profesionales": {},
"Mantenimiento": {},
"Seguros": {},
"Servicios B\u00e1sicos": {},
"account_number": "6",
"root_type": "Expense"
},
"Ingresos": {
"Productos": {},
"Servicios": {},
"account_number": "4",
"root_type": "Income"
},
"Otros Gastos y Productos Financieros": {
"Otros Gastos": {
"Otros Gastos y Productos Financieros 2": {
"Intereses 1": {},
"Otros Gastos Financieros 1": {}
}
},
"Otros Ingresos": {
"Otros Gastos y Productos Financieros 1": {
"Intereses": {},
"Otros Gastos Financieros": {}
}
},
"account_number": "7",
"root_type": "Expense"
},
"Pasivos": {
"Pasivo Corriente": {
"Acreedores 1": {
"account_type": "Payable"
@ -22,329 +409,14 @@
"Acreedores": {},
"Provisi\u00f3n para Indemnizaciones": {}
},
"account_number": "2",
"root_type": "Liability"
},
"03 - Patrimonio": {
"Patrimonio": {
"Capital": {},
"Resultados del Ejercicio": {},
"Utilidades Retenidas": {},
"root_type": "Asset"
},
"04 - Ingresos": {
"Productos": {},
"Servicios": {},
"root_type": "Income"
},
"05 - Costos": {
"Costo de Ventas": {
"account_type": "Cost of Goods Sold"
},
"Costos Incluidos en la Valuaci\u00f3n": {
"account_type": "Expenses Included In Valuation"
},
"Merma o Ajuste de Inventario": {
"account_type": "Stock Adjustment"
},
"root_type": "Expense"
},
"06 - Gastos": {
"Alquileres": {},
"Depreciaciones": {
"account_type": "Depreciation"
},
"Gastos Diversos": {},
"Gastos de Personal": {},
"Honorarios Profesionales": {},
"Mantenimiento": {},
"Seguros": {},
"Servicios B\u00e1sicos": {},
"root_type": "Expense"
},
"07 - Otros Gastos y Productos Financieros": {
"Otros Gastos": {
"Otros Gastos y Productos Financieros 2": {
"Intereses 1": {},
"Otros Gastos Financieros 1": {}
}
},
"Otros Ingresos": {
"Otros Gastos y Productos Financieros 1": {
"Intereses": {},
"Otros Gastos Financieros": {}
}
},
"root_type": "Expense"
},
"1 - Activos": {
"1. Activo Corriente": {
"1.10 Activos Corrientes Adicionales": {
"1.10.1 Inversiones Corrientes no Clasificados como Equivalentes de Caja y Bancos": {},
"1.10.2 Activos Diferidos o Restringidos": {
"1.10.2.1 Cr\u00e9dito Fiscal (IVA Por Cobrar)": {
"account_type": "Chargeable",
"is_group": 1
},
"account_type": "Chargeable"
},
"account_type": "Chargeable"
},
"1.2 Inversion en Propiedades": {
"1.2.1 Inversion Inmobiliaria Bajo Construccion": {
"account_type": "Chargeable"
},
"1.2.2 Inversion Inmobiliaria Construida": {
"account_type": "Chargeable",
"is_group": 1
},
"account_type": "Chargeable"
},
"1.3 Activos Intangibles": {
"account_type": "Chargeable",
"is_group": 1
},
"1.4 Activos Financieros": {
"1.4.1 Inversion o Participaci\u00f3n Accionaria en Empresas Afiliadas": {
"account_type": "Chargeable",
"is_group": 1
},
"1.4.2 Inversiones Burs\u00e1tiles e Instrumentos Financieros": {
"account_type": "Chargeable",
"is_group": 1
},
"1.4.3 Activos Financieros Derivados": {
"account_type": "Chargeable",
"is_group": 1
},
"1.4.4 Otros Activos Financieros": {
"account_type": "Chargeable",
"is_group": 1
},
"1.4.5 Provisi\u00f3n por Riesgo de Cr\u00e9dito (agregado) (Contra-activo)": {
"account_type": "Round Off",
"is_group": 1
},
"1.4.6 Activos Financieros Clasificados por Designaci\u00f3n": {
"account_type": "Chargeable",
"is_group": 1
},
"account_type": "Chargeable"
},
"1.5 Activos Biol\u00f3gicos": {
"1.5.1 Activos Biol\u00f3gicos al Costo": {
"account_type": "Stock",
"is_group": 1
},
"1.5.2 Activos Biol\u00f3gicos a Valor Razonable": {
"1.5.2.1 Animales": {
"account_type": "Stock",
"is_group": 1
},
"1.5.2.2 Plantas": {
"1.5.2.2.1 Division productiva 1er nivel EJEMPLO": {
"1.5.2.2.1.1 Division Productiva 2do nivel EJEMPLO": {
"1.5.2.2.1.1.1 Division Productiva 3er Nivel EJEMPLO": {
"1.5.2.2.1.1.1.1 Divisi\u00f3n Productiva 4\u00ba Nivel EJEMPLO": {},
"account_type": "Stock"
},
"account_type": "Stock"
},
"account_type": "Stock"
},
"account_type": "Stock"
},
"account_type": "Stock"
},
"account_type": "Stock"
},
"1.6 Activos Devengables y Otros Activos": {
"1.6.1 Pagos Anticipados y Otros Activos Circulantes": {
"1.6.1.0 Seguro Pagado Anticipadamente": {
"account_type": "Chargeable"
},
"account_type": "Chargeable"
},
"1.6.2 Cobrables Relacionados con Impuestos": {
"account_type": "Chargeable",
"is_group": 1
},
"1.6.3 Proveedores de Servicio": {
"account_type": "Chargeable",
"is_group": 1
},
"1.6.4 Contratos de Construccion": {
"account_type": "Chargeable",
"is_group": 1
},
"1.6.5 Costos de Montaje": {
"account_type": "Chargeable",
"is_group": 1
},
"1.6.6 Activos Adicionales y Otros": {
"account_type": "Chargeable",
"is_group": 1
},
"account_type": "Chargeable"
},
"1.7 Inventario": {
"1.7.1 Materia Prima": {
"account_type": "Stock",
"is_group": 1
},
"1.7.10 Inventarios Pignorados Como Garant\u00eda de Pasivo": {
"account_type": "Stock",
"is_group": 1
},
"1.7.11 Inventarios a Valor Razonable Menos Costos de Venta": {
"account_type": "Stock",
"is_group": 1
},
"1.7.2 Mercader\u00eda (Mercanc\u00edas)": {
"account_type": "Stock",
"is_group": 1
},
"1.7.3 Suministros de Producci\u00f3n y Consumibles": {
"account_type": "Stock",
"is_group": 1
},
"1.7.4 Repuestos": {
"1.7.4.0 Respuestos en Transito": {
"account_type": "Stock",
"is_group": 1
},
"account_type": "Stock"
},
"1.7.5 Combustibles": {
"account_type": "Stock",
"is_group": 1
},
"1.7.6 Trabajo en Progeso": {
"account_type": "Stock",
"is_group": 1
},
"1.7.7 Producto Terminado": {
"account_type": "Stock",
"is_group": 1
},
"1.7.8 Art\u00edculos de Inventario Adicionales": {
"account_type": "Stock",
"is_group": 1
},
"1.7.9 Otros Inventarios": {
"1.7.9.1 Merma o Ajuste de Inventario": {
"account_type": "Stock Adjustment",
"is_group": 1
},
"account_type": "Stock"
},
"account_type": "Stock"
},
"1.8 Cobrables": {
"1.8.1 Ventas al Cr\u00e9dito": {
"account_type": "Receivable",
"is_group": 1
},
"1.8.2 Activos bajo Contrato": {
"account_type": "Receivable",
"is_group": 1
},
"1.8.3 Otras Cuentas por Cobrar": {
"1.8.3.1 Cuentas por Cobrar a Otras Entidades no Afiliadas": {
"1.8.3.1.1 Compa\u00f1\u00eda No Afiliada (EJEMPLO)": {
"account_type": "Receivable"
},
"account_type": "Receivable"
},
"1.8.3.2 Cuentas Por Cobrar Compa\u00f1\u00edas Afiliadas": {
"1.8.3.2.1 Compa\u00f1\u00eda subsidiaria (EJEMPLO)": {
"account_type": "Receivable"
},
"account_type": "Receivable"
},
"1.8.3.3 Cuentas por Cobrar a Empleados": {
"1.8.3.3.1 Prestamo EJEMPLO": {
"account_type": "Receivable"
},
"account_type": "Receivable"
},
"account_type": "Receivable"
},
"1.8.4 Ajustes": {
"account_type": "Chargeable",
"is_group": 1
},
"account_type": "Receivable"
},
"1.9 Caja y Equivalentes": {
"1.9.1 Caja": {
"account_type": "Cash",
"is_group": 1
},
"1.9.2 Equivalentes de Efectivo (Bancos)": {
"1.9.2.1 Bancos Nacionales": {
"1.9.2.1.1 Banco Industrial": {
"account_type": "Bank",
"is_group": 1
},
"1.9.2.1.2 Banco Agromercantil de Guatemala": {
"account_type": "Bank"
},
"1.9.2.1.3 Banco Prom\u00e9rica": {
"account_type": "Bank"
},
"1.9.2.1.4 Banco de Am\u00e9rica Central": {
"account_type": "Bank"
},
"1.9.2.1.5 Banco G&T Continental": {
"account_type": "Bank"
},
"1.9.2.1.6 Banco Internacional": {
"account_type": "Bank"
},
"1.9.2.1.7 Banco de Desarrollo Rural": {
"account_type": "Bank"
},
"1.9.2.1.8 Banco de los Trabajadores": {
"account_type": "Bank"
},
"1.9.2.1.9 Vivibanco": {
"account_type": "Bank"
},
"account_type": "Bank"
},
"1.9.2.2 Bancos Internacionales": {
"1.9.2.2.1 HSBC": {
"account_type": "Bank"
},
"account_type": "Bank"
},
"1.9.2.3 Cadena de Bloques (Blockchain)": {
"1.9.2.3.1 Billetera Bitcoin 1234567890abcdefg": {
"account_type": "Cash"
},
"account_type": "Cash"
},
"account_type": "Bank"
},
"1.9.3 Inversiones a Corto Plazo": {
"account_type": "Bank",
"is_group": 1
},
"1.9.4 Otros Equivalentes de Caja y Bancos": {
"account_type": "Cash",
"is_group": 1
},
"account_type": "Bank"
},
"Impuestos por Cobrar": {
"Retenciones de IVA recibidas": {}
}
},
"No Corriente": {
"Activos Fijos": {
"account_type": "Fixed Asset"
},
"Cargos Diferidos": {}
},
"account_number": "3",
"root_type": "Asset"
}
}

View File

@ -527,7 +527,7 @@
"root_type": "Liability"
},
"5. SZ\u00c1MLAOSZT\u00c1LY K\u00d6LTS\u00c9GNEMEK": {
"51 - 53 ANYAGJELLEG\u00db R\u00c1FORD\u00cdT\u00c1SOK ": {
"51 - 53. ANYAGJELLEG\u00db R\u00c1FORD\u00cdT\u00c1SOK ": {
"51. ANYAGK\u00d6LTS\u00c9G": {
"511. V\u00e1s\u00e1rolt anyagok k\u00f6lts\u00e9gei ": {
"5111. Alapanyag k\u00f6lts\u00e9gek": {},
@ -618,23 +618,8 @@
"581. Saj\u00e1t termel\u00e9s\u0171 k\u00e9szletek \u00e1llom\u00e1nyv\u00e1ltoz\u00e1sa ": {},
"582. Saj\u00e1t el\u0151\u00e1ll\u00edt\u00e1s\u00fa eszk\u00f6z\u00f6k aktiv\u00e1lt \u00e9rt\u00e9ke": {},
"589. Aktiv\u00e1lt saj\u00e1t teljes\u00edtm\u00e9nyek \u00e1tvezet\u00e9si sz\u00e1mla": {}
},
"59. K\u00d6LTS\u00c9GNEM ELLENSZ\u00c1MLA (els\u0151dleges k\u00f6lts\u00e9ghely-k\u00f6lts\u00e9gvisel\u0151 elsz\u00e1mol\u00f3s eset\u00e9n) ": {
"is_group": 1
},
"59. K\u00d6LTS\u00c9GNEM \u00c1TVEZET\u00c9SI SZ\u00c1MLA (els\u0151dleges k\u00f6lts\u00e9gnem-elsz\u00e1mol\u00e1s eset\u00e9n)": {
"is_group": 1
},
"59. K\u00d6LTS\u00c9GNEM \u00c1TVEZET\u00c9SI SZ\u00c1MLA (els\u0151dleges k\u00f6lts\u00e9gnem-elsz\u00e1mol\u00e1s eset\u00e9n, kiz\u00e1r\u00f3lag \u00f6sszk\u00f6lts\u00e9g elj\u00e1r\u00e1ssal)": {
"59/51. Anyagk\u00f6lts\u00e9g \u00e1tvezet\u00e9si sz\u00e1mla": {},
"59/52. Ig\u00e9nybe vett szolg\u00e1ltat\u00e1sok k\u00f6lts\u00e9gei \u00e1tvezet\u00e9si sz\u00e1mla ": {},
"59/53. Egy\u00e9b szolg\u00e1ltat\u00e1sok k\u00f6lts\u00e9gei \u00e1tvezet\u00e9si sz\u00e1mla ": {},
"59/54. B\u00e9rk\u00f6lts\u00e9g \u00e1tvezet\u00e9si sz\u00e1mla": {},
"59/55. Szem\u00e9lyi jelleg\u0171 egy\u00e9b kifizet\u00e9sek \u00e1tvezet\u00e9si sz\u00e1mla ": {},
"59/56. B\u00e9rj\u00e1rul\u00e9kok \u00e1tvezet\u00e9si sz\u00e1mla": {},
"59/57. \u00c9rt\u00e9kcs\u00f6kken\u00e9si le\u00edr\u00e1s \u00e1tvezet\u00e9si sz\u00e1mla ": {}
},
"59. K\u00d6LTS\u00c9GNEM \u00c1TVEZET\u00c9SI SZ\u00c1MLA (kiz\u00e1r\u00f3lag k\u00f6lts\u00e9gnem-elsz\u00e1mol\u00e1s \u00e9s forgalmi k\u00f6lts\u00e9g elj\u00e1r\u00e1ssal)": {
},
"59. K\u00d6LTS\u00c9GNEM \u00c1TVEZET\u00c9SI SZ\u00c1MLA": {
"is_group": 1
},
"root_type": "Expense"

View File

@ -2,160 +2,161 @@
"country_code": "in",
"name": "India - Chart of Accounts",
"tree": {
"Application of Funds (Assets)": {
"Current Assets": {
"Accounts Receivable": {
"Debtors": {
"account_type": "Receivable"
}
},
"Bank Accounts": {
"account_type": "Bank",
"is_group": 1
},
"Cash In Hand": {
"Cash": {
"account_type": "Cash"
},
"account_type": "Cash"
},
"Loans and Advances (Assets)": {
"is_group": 1
},
"Securities and Deposits": {
"Earnest Money": {}
},
"Stock Assets": {
"Stock in Hand": {
"account_type": "Stock"
}
},
"Tax Assets": {
"is_group": 1
}
},
"Fixed Assets": {
"Capital Equipments": {
"account_type": "Fixed Asset"
},
"Electronic Equipments": {
"account_type": "Fixed Asset"
},
"Furnitures and Fixtures": {
"account_type": "Fixed Asset"
},
"Office Equipments": {
"account_type": "Fixed Asset"
},
"Plants and Machineries": {
"account_type": "Fixed Asset"
},
"Buildings": {
"account_type": "Fixed Asset"
},
"Accumulated Depreciations": {
"account_type": "Accumulated Depreciation"
}
},
"Investments": {
"is_group": 1
},
"Temporary Accounts": {
"Temporary Opening": {
"account_type": "Temporary"
}
},
"root_type": "Asset"
},
"Expenses": {
"Direct Expenses": {
"Stock Expenses": {
"Cost of Goods Sold": {
"account_type": "Cost of Goods Sold"
},
"Expenses Included In Valuation": {
"account_type": "Expenses Included In Valuation"
},
"Stock Adjustment": {
"account_type": "Stock Adjustment"
}
}
},
"Indirect Expenses": {
"Administrative Expenses": {},
"Commission on Sales": {},
"Depreciation": {
"account_type": "Depreciation"
},
"Entertainment Expenses": {},
"Freight and Forwarding Charges": {
"account_type": "Chargeable"
},
"Legal Expenses": {},
"Marketing Expenses": {},
"Miscellaneous Expenses": {},
"Office Maintenance Expenses": {},
"Office Rent": {},
"Postal Expenses": {},
"Print and Stationary": {},
"Rounded Off": {
"account_type": "Round Off"
},
"Salary": {},
"Sales Expenses": {},
"Telephone Expenses": {},
"Travel Expenses": {},
"Utility Expenses": {},
"Write Off": {},
"Exchange Gain/Loss": {},
"Gain/Loss on Asset Disposal": {}
},
"root_type": "Expense"
},
"Income": {
"Direct Income": {
"Sales": {
"account_type": "Income Account"
},
"Service": {
"account_type": "Income Account"
},
"account_type": "Income Account"
},
"Indirect Income": {
"account_type": "Income Account",
"is_group": 1
},
"root_type": "Income"
},
"Source of Funds (Liabilities)": {
"Capital Account": {
"Reserves and Surplus": {},
"Shareholders Funds": {}
},
"Current Liabilities": {
"Accounts Payable": {
"Creditors": {
"account_type": "Payable"
},
"Payroll Payable": {}
},
"Stock Liabilities": {
"Stock Received But Not Billed": {
"account_type": "Stock Received But Not Billed"
}
},
"Duties and Taxes": {
"account_type": "Tax",
"is_group": 1
},
"Loans (Liabilities)": {
"Secured Loans": {},
"Unsecured Loans": {},
"Bank Overdraft Account": {}
}
},
"root_type": "Liability"
}
}
"Application of Funds (Assets)": {
"Current Assets": {
"Accounts Receivable": {
"Debtors": {
"account_type": "Receivable"
}
},
"Bank Accounts": {
"account_type": "Bank",
"is_group": 1
},
"Cash In Hand": {
"Cash": {
"account_type": "Cash"
},
"account_type": "Cash"
},
"Loans and Advances (Assets)": {
"is_group": 1
},
"Securities and Deposits": {
"Earnest Money": {}
},
"Stock Assets": {
"Stock In Hand": {
"account_type": "Stock"
},
"account_type": "Stock"
},
"Tax Assets": {
"is_group": 1
}
},
"Fixed Assets": {
"Capital Equipments": {
"account_type": "Fixed Asset"
},
"Electronic Equipments": {
"account_type": "Fixed Asset"
},
"Furnitures and Fixtures": {
"account_type": "Fixed Asset"
},
"Office Equipments": {
"account_type": "Fixed Asset"
},
"Plants and Machineries": {
"account_type": "Fixed Asset"
},
"Buildings": {
"account_type": "Fixed Asset"
},
"Accumulated Depreciations": {
"account_type": "Accumulated Depreciation"
}
},
"Investments": {
"is_group": 1
},
"Temporary Accounts": {
"Temporary Opening": {
"account_type": "Temporary"
}
},
"root_type": "Asset"
},
"Expenses": {
"Direct Expenses": {
"Stock Expenses": {
"Cost of Goods Sold": {
"account_type": "Cost of Goods Sold"
},
"Expenses Included In Valuation": {
"account_type": "Expenses Included In Valuation"
},
"Stock Adjustment": {
"account_type": "Stock Adjustment"
}
}
},
"Indirect Expenses": {
"Administrative Expenses": {},
"Commission on Sales": {},
"Depreciation": {
"account_type": "Depreciation"
},
"Entertainment Expenses": {},
"Freight and Forwarding Charges": {
"account_type": "Chargeable"
},
"Legal Expenses": {},
"Marketing Expenses": {},
"Miscellaneous Expenses": {},
"Office Maintenance Expenses": {},
"Office Rent": {},
"Postal Expenses": {},
"Print and Stationary": {},
"Rounded Off": {
"account_type": "Round Off"
},
"Salary": {},
"Sales Expenses": {},
"Telephone Expenses": {},
"Travel Expenses": {},
"Utility Expenses": {},
"Write Off": {},
"Exchange Gain/Loss": {},
"Gain/Loss on Asset Disposal": {}
},
"root_type": "Expense"
},
"Income": {
"Direct Income": {
"Sales": {
"account_type": "Income Account"
},
"Service": {
"account_type": "Income Account"
},
"account_type": "Income Account"
},
"Indirect Income": {
"account_type": "Income Account",
"is_group": 1
},
"root_type": "Income"
},
"Source of Funds (Liabilities)": {
"Capital Account": {
"Reserves and Surplus": {},
"Shareholders Funds": {}
},
"Current Liabilities": {
"Accounts Payable": {
"Creditors": {
"account_type": "Payable"
},
"Payroll Payable": {}
},
"Stock Liabilities": {
"Stock Received But Not Billed": {
"account_type": "Stock Received But Not Billed"
}
},
"Duties and Taxes": {
"account_type": "Tax",
"is_group": 1
},
"Loans (Liabilities)": {
"Secured Loans": {},
"Unsecured Loans": {},
"Bank Overdraft Account": {}
}
},
"root_type": "Liability"
}
}
}

View File

@ -0,0 +1,275 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
from frappe import _
def get():
return {
_("Application of Funds (Assets)"): {
_("Current Assets"): {
_("Accounts Receivable"): {
_("Debtors"): {
"account_type": "Receivable",
"account_number": "1310"
},
"account_number": "1300"
},
_("Bank Accounts"): {
"account_type": "Bank",
"is_group": 1,
"account_number": "1200"
},
_("Cash In Hand"): {
_("Cash"): {
"account_type": "Cash",
"account_number": "1110"
},
"account_type": "Cash",
"account_number": "1100"
},
_("Loans and Advances (Assets)"): {
"is_group": 1,
"account_number": "1600"
},
_("Securities and Deposits"): {
_("Earnest Money"): {
"account_number": "1651"
},
"account_number": "1650"
},
_("Stock Assets"): {
_("Stock In Hand"): {
"account_type": "Stock",
"account_number": "1410"
},
"account_type": "Stock",
"account_number": "1400"
},
_("Tax Assets"): {
"is_group": 1,
"account_number": "1500"
},
"account_number": "1100-1600"
},
_("Fixed Assets"): {
_("Capital Equipments"): {
"account_type": "Fixed Asset",
"account_number": "1710"
},
_("Electronic Equipments"): {
"account_type": "Fixed Asset",
"account_number": "1720"
},
_("Furnitures and Fixtures"): {
"account_type": "Fixed Asset",
"account_number": "1730"
},
_("Office Equipments"): {
"account_type": "Fixed Asset",
"account_number": "1740"
},
_("Plants and Machineries"): {
"account_type": "Fixed Asset",
"account_number": "1750"
},
_("Buildings"): {
"account_type": "Fixed Asset",
"account_number": "1760"
},
_("Softwares"): {
"account_type": "Fixed Asset",
"account_number": "1770"
},
_("Accumulated Depreciation"): {
"account_type": "Accumulated Depreciation",
"account_number": "1780"
},
"account_number": "1700"
},
_("Investments"): {
"is_group": 1,
"account_number": "1800"
},
_("Temporary Accounts"): {
_("Temporary Opening"): {
"account_type": "Temporary",
"account_number": "1910"
},
"account_number": "1900"
},
"root_type": "Asset",
"account_number": "1000"
},
_("Expenses"): {
_("Direct Expenses"): {
_("Stock Expenses"): {
_("Cost of Goods Sold"): {
"account_type": "Cost of Goods Sold",
"account_number": "5111"
},
_("Expenses Included In Valuation"): {
"account_type": "Expenses Included In Valuation",
"account_number": "5118"
},
_("Stock Adjustment"): {
"account_type": "Stock Adjustment",
"account_number": "5119"
},
"account_number": "5110"
},
"account_number": "5100"
},
_("Indirect Expenses"): {
_("Administrative Expenses"): {
"account_number": "5201"
},
_("Commission on Sales"): {
"account_number": "5202"
},
_("Depreciation"): {
"account_type": "Depreciation",
"account_number": "5203"
},
_("Entertainment Expenses"): {
"account_number": "5204"
},
_("Freight and Forwarding Charges"): {
"account_type": "Chargeable",
"account_number": "5205"
},
_("Legal Expenses"): {
"account_number": "5206"
},
_("Marketing Expenses"): {
"account_type": "Chargeable",
"account_number": "5207"
},
_("Office Maintenance Expenses"): {
"account_number": "5208"
},
_("Office Rent"): {
"account_number": "5209"
},
_("Postal Expenses"): {
"account_number": "5210"
},
_("Print and Stationery"): {
"account_number": "5211"
},
_("Round Off"): {
"account_type": "Round Off",
"account_number": "5212"
},
_("Salary"): {
"account_number": "5213"
},
_("Sales Expenses"): {
"account_number": "5214"
},
_("Telephone Expenses"): {
"account_number": "5215"
},
_("Travel Expenses"): {
"account_number": "5216"
},
_("Utility Expenses"): {
"account_number": "5217"
},
_("Write Off"): {
"account_number": "5218"
},
_("Exchange Gain/Loss"): {
"account_number": "5219"
},
_("Gain/Loss on Asset Disposal"): {
"account_number": "5220"
},
_("Miscellaneous Expenses"): {
"account_type": "Chargeable",
"account_number": "5221"
},
"account_number": "5200"
},
"root_type": "Expense",
"account_number": "5000"
},
_("Income"): {
_("Direct Income"): {
_("Sales"): {
"account_number": "4110"
},
_("Service"): {
"account_number": "4120"
},
"account_number": "4100"
},
_("Indirect Income"): {
"is_group": 1,
"account_number": "4200"
},
"root_type": "Income",
"account_number": "4000"
},
_("Source of Funds (Liabilities)"): {
_("Current Liabilities"): {
_("Accounts Payable"): {
_("Creditors"): {
"account_type": "Payable",
"account_number": "2110"
},
_("Payroll Payable"): {
"account_number": "2120"
},
"account_number": "2100"
},
_("Stock Liabilities"): {
_("Stock Received But Not Billed"): {
"account_type": "Stock Received But Not Billed",
"account_number": "2210"
},
"account_number": "2200"
},
_("Duties and Taxes"): {
"account_type": "Tax",
"is_group": 1,
"account_number": "2300"
},
_("Loans (Liabilities)"): {
_("Secured Loans"): {
"account_number": "2410"
},
_("Unsecured Loans"): {
"account_number": "2420"
},
_("Bank Overdraft Account"): {
"account_number": "2430"
},
"account_number": "2400"
},
"account_number": "2100-2400"
},
"root_type": "Liability",
"account_number": "2000"
},
_("Equity"): {
_("Capital Stock"): {
"account_type": "Equity",
"account_number": "3100"
},
_("Dividends Paid"): {
"account_type": "Equity",
"account_number": "3200"
},
_("Opening Balance Equity"): {
"account_type": "Equity",
"account_number": "3300"
},
_("Retained Earnings"): {
"account_type": "Equity",
"account_number": "3400"
},
"root_type": "Equity",
"account_number": "3000"
}
}

View File

@ -2,9 +2,40 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import unittest
import frappe
from erpnext.stock import get_warehouse_account, get_company_default_inventory_account
class TestAccount(unittest.TestCase):
def test_rename_account(self):
if not frappe.db.exists("Account", "1210 - Debtors - _TC"):
acc = frappe.new_doc("Account")
acc.account_name = "Debtors"
acc.parent_account = "Accounts Receivable - _TC"
acc.account_number = "1210"
acc.company = "_Test Company"
acc.insert()
account_number, account_name = frappe.db.get_value("Account", "1210 - Debtors - _TC",
["account_number", "account_name"])
self.assertEqual(account_number, "1210")
self.assertEqual(account_name, "Debtors")
frappe.rename_doc("Account", "1210 - Debtors - _TC", "1211 - Debtors 1 - _TC")
new_acc = frappe.db.get_value("Account", "1211 - Debtors 1 - _TC",
["account_name", "account_number"], as_dict=1)
self.assertEqual(new_acc.account_name, "Debtors 1")
self.assertEqual(new_acc.account_number, "1211")
frappe.rename_doc("Account", "1211 - Debtors 1 - _TC", "Debtors 2")
new_acc = frappe.db.get_value("Account", "1211 - Debtors 2 - _TC",
["account_name", "account_number"], as_dict=1)
self.assertEqual(new_acc.account_name, "Debtors 2")
self.assertEqual(new_acc.account_number, "1211")
frappe.delete_doc("Account", "1211 - Debtors 2 - _TC")
def _make_test_records(verbose):
from frappe.test_runner import make_test_objects

View File

@ -0,0 +1,69 @@
QUnit.module('accounts');
QUnit.test("test account with number", function(assert) {
assert.expect(7);
let done = assert.async();
frappe.run_serially([
() => frappe.set_route('Tree', 'Account'),
() => frappe.click_link('Income'),
() => frappe.click_button('Add Child'),
() => frappe.timeout(.5),
() => {
cur_dialog.fields_dict.account_name.$input.val("Test Income");
cur_dialog.fields_dict.account_number.$input.val("4010");
},
() => frappe.click_button('Create New'),
() => frappe.timeout(1),
() => {
assert.ok($('a:contains("4010 - Test Income"):visible').length!=0, "Account created with number");
},
() => frappe.click_link('4010 - Test Income'),
() => frappe.click_button('Edit'),
() => frappe.timeout(.5),
() => frappe.click_button('Update Account Number'),
() => frappe.timeout(.5),
() => {
cur_dialog.fields_dict.account_number.$input.val("4020");
},
() => frappe.timeout(1),
() => cur_dialog.primary_action(),
() => frappe.timeout(1),
() => cur_frm.refresh_fields(),
() => frappe.timeout(.5),
() => {
var abbr = frappe.get_abbr(frappe.defaults.get_default("Company"));
var new_account = "4020 - Test Income - " + abbr;
assert.ok(cur_frm.doc.name==new_account, "Account renamed");
assert.ok(cur_frm.doc.account_name=="Test Income", "account name remained same");
assert.ok(cur_frm.doc.account_number=="4020", "Account number updated to 4020");
},
() => frappe.timeout(1),
() => frappe.click_button('Menu'),
() => frappe.click_link('Rename'),
() => frappe.timeout(.5),
() => {
cur_dialog.fields_dict.new_name.$input.val("4030 - Test Income");
},
() => frappe.timeout(.5),
() => frappe.click_button("Rename"),
() => frappe.timeout(1),
() => {
assert.ok(cur_frm.doc.account_name=="Test Income", "account name remained same");
assert.ok(cur_frm.doc.account_number=="4030", "Account number updated to 4030");
},
() => frappe.timeout(.5),
() => frappe.click_button('Chart of Accounts'),
() => frappe.timeout(.5),
() => frappe.click_button('Menu'),
() => frappe.click_link('Refresh'),
() => frappe.click_button('Expand All'),
() => frappe.click_link('4030 - Test Income'),
() => frappe.click_button('Delete'),
() => frappe.click_button('Yes'),
() => frappe.timeout(.5),
() => {
assert.ok($('a:contains("4030 - Test Account"):visible').length==0, "Account deleted");
},
() => done()
]);
});

View File

@ -23,5 +23,30 @@ frappe.treeview_settings["Cost Center"] = {
{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')}
],
ignore_fields:["parent_cost_center"]
ignore_fields:["parent_cost_center"],
onload: function(treeview) {
function get_company() {
return treeview.page.fields_dict.company.get_value();
}
// tools
treeview.page.add_inner_button(__("Chart of Accounts"), function() {
frappe.set_route('Tree', 'Account', {company: get_company()});
}, __('View'));
// make
treeview.page.add_inner_button(__("Budget List"), function() {
frappe.set_route('List', 'Budget', {company: get_company()});
}, __('Budget'));
treeview.page.add_inner_button(__("Monthly Distribution"), function() {
frappe.set_route('List', 'Monthly Distribution', {company: get_company()});
}, __('Budget'));
treeview.page.add_inner_button(__("Budget Variance Report"), function() {
frappe.set_route('query-report', 'Budget Variance Report', {company: get_company()});
}, __('Budget'));
},
}

View File

@ -0,0 +1,96 @@
// Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt
frappe.ui.form.on('Opening Invoice Creation Tool', {
setup: function(frm) {
frm.set_query('party_type', 'invoices', function(doc, cdt, cdn) {
return {
filters: {
'name': ['in', 'Customer,Supplier']
}
};
});
},
refresh: function(frm) {
frm.disable_save();
frm.trigger("make_dashboard");
frm.page.set_primary_action(__("Make Invoices"), () => {
let btn_primary = frm.page.btn_primary.get(0);
return frm.call({
doc: frm.doc,
freeze: true,
btn: $(btn_primary),
method: "make_invoices",
freeze_message: __("Creating {0} Invoice", [frm.doc.invoice_type]),
callback: (r) => {
if(!r.exc){
frappe.msgprint(__("Opening {0} Invoice created", [frm.doc.invoice_type]));
frm.clear_table("invoices");
frm.refresh_fields();
frm.reload_doc();
}
}
});
});
},
company: function(frm) {
frappe.call({
method: 'erpnext.accounts.doctype.opening_invoice_creation_tool.opening_invoice_creation_tool.get_temporary_opening_account',
args: {
company: frm.doc.company
},
callback: (r) => {
if (r.message) {
frm.doc.__onload.temporary_opening_account = r.message;
frm.trigger('update_invoice_table');
}
}
})
},
invoice_type: function(frm) {
$.each(frm.doc.invoices, (idx, row) => {
row.party_type = frm.doc.invoice_type == "Sales"? "Customer": "Supplier";
row.party = "";
});
frm.refresh_fields();
},
make_dashboard: function(frm) {
let max_count = frm.doc.__onload.max_count;
let opening_invoices_summary = frm.doc.__onload.opening_invoices_summary;
if(!$.isEmptyObject(opening_invoices_summary)) {
let section = frm.dashboard.add_section(
frappe.render_template('opening_invoice_creation_tool_dashboard', {
data: opening_invoices_summary,
max_count: max_count
})
);
section.on('click', '.invoice-link', function() {
let doctype = $(this).attr('data-type');
let company = $(this).attr('data-company');
frappe.set_route('List', doctype,
{'is_opening': 'Yes', 'company': company, 'docstatus': 1});
});
frm.dashboard.show();
}
},
update_invoice_table: function(frm) {
$.each(frm.doc.invoices, (idx, row) => {
if (!row.temporary_opening_account) {
row.temporary_opening_account = frm.doc.__onload.temporary_opening_account;
}
row.party_type = frm.doc.invoice_type == "Sales"? "Customer": "Supplier";
});
}
});
frappe.ui.form.on('Opening Invoice Creation Tool Item', {
invoices_add: (frm) => {
frm.trigger('update_invoice_table');
}
});

View File

@ -0,0 +1,184 @@
{
"allow_copy": 1,
"allow_guest_to_view": 0,
"allow_import": 0,
"allow_rename": 0,
"beta": 1,
"creation": "2017-08-29 02:22:54.947711",
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"document_type": "",
"editable_grid": 1,
"engine": "InnoDB",
"fields": [
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "company",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Company",
"length": 0,
"no_copy": 0,
"options": "Company",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "invoice_type",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Invoice Type",
"length": 0,
"no_copy": 0,
"options": "Sales\nPurchase",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "section_break_4",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Invoices",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 1,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "invoices",
"fieldtype": "Table",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"options": "Opening Invoice Creation Tool Item",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0
}
],
"has_web_view": 0,
"hide_heading": 0,
"hide_toolbar": 1,
"idx": 0,
"image_view": 0,
"in_create": 0,
"is_submittable": 0,
"issingle": 1,
"istable": 0,
"max_attachments": 0,
"modified": "2017-09-05 01:30:33.235664",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Opening Invoice Creation Tool",
"name_case": "",
"owner": "Administrator",
"permissions": [
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 1,
"delete": 0,
"email": 1,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 0,
"role": "System Manager",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"write": 1
}
],
"quick_entry": 1,
"read_only": 0,
"read_only_onload": 0,
"show_name_in_global_search": 0,
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1,
"track_seen": 0
}

View File

@ -0,0 +1,163 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.utils import flt
from frappe.model.document import Document
class OpeningInvoiceCreationTool(Document):
def onload(self):
"""Load the Opening Invoice summary"""
summary, max_count = self.get_opening_invoice_summary()
self.set_onload('opening_invoices_summary', summary)
self.set_onload('max_count', max_count)
self.set_onload('temporary_opening_account', get_temporary_opening_account(self.company))
def get_opening_invoice_summary(self):
def prepare_invoice_summary(doctype, invoices):
# add company wise sales / purchase invoice summary
paid_amount = []
outstanding_amount = []
for invoice in invoices:
company = invoice.pop("company")
_summary = invoices_summary.get(company, {})
_summary.update({
"currency": company_wise_currency.get(company),
doctype: invoice
})
invoices_summary.update({company: _summary})
paid_amount.append(invoice.paid_amount)
outstanding_amount.append(invoice.outstanding_amount)
if paid_amount or outstanding_amount:
max_count.update({
doctype: {
"max_paid": max(paid_amount) if paid_amount else 0.0,
"max_due": max(outstanding_amount) if outstanding_amount else 0.0
}
})
invoices_summary = {}
max_count = {}
fields = [
"company", "count(name) as total_invoices", "sum(outstanding_amount) as outstanding_amount"
]
companies = frappe.get_all("Company", fields=["name as company", "default_currency as currency"])
if not companies:
return None, None
company_wise_currency = {row.company: row.currency for row in companies}
for doctype in ["Sales Invoice", "Purchase Invoice"]:
invoices = frappe.get_all(doctype, filters=dict(is_opening="Yes", docstatus=1),
fields=fields, group_by="company")
prepare_invoice_summary(doctype, invoices)
return invoices_summary, max_count
def make_invoices(self):
names = []
mandatory_error_msg = _("Row {idx}: {field} is required to create the Opening {invoice_type} Invoices")
if not self.company:
frappe.throw(_("Please select the Company"))
for row in self.invoices:
if not row.qty:
row.qty = 1.0
if not row.party:
frappe.throw(mandatory_error_msg.format(
idx=row.idx,
field= _("Party"),
invoice_type=self.invoice_type
))
# set party type if not available
if not row.party_type:
row.party_type = "Customer" if self.invoice_type == "Sales" else "Supplier"
if not row.posting_date:
frappe.throw(mandatory_error_msg.format(
idx=row.idx,
field= _("Party"),
invoice_type=self.invoice_type
))
if not row.outstanding_amount:
frappe.throw(mandatory_error_msg.format(
idx=row.idx,
field= _("Outstanding Amount"),
invoice_type=self.invoice_type
))
args = self.get_invoice_dict(row=row)
if not args:
continue
doc = frappe.get_doc(args).insert()
doc.submit()
names.append(doc.name)
if(len(self.invoices) > 5):
frappe.publish_realtime("progress",
dict(progress=[row.idx, len(self.invoices)], title=_('Creating {0}').format(doc.doctype)),
user=frappe.session.user)
return names
def get_invoice_dict(self, row=None):
def get_item_dict():
default_uom = frappe.db.get_single_value("Stock Settings", "stock_uom") or _("Nos")
cost_center = frappe.db.get_value("Company", self.company, "cost_center")
if not cost_center:
frappe.throw(_("Please set the Default Cost Center in {0} company").format(frappe.bold(self.company)))
rate = flt(row.outstanding_amount) / row.qty
return frappe._dict({
"uom": default_uom,
"rate": rate or 0.0,
"qty": row.qty,
"conversion_factor": 1.0,
"item_name": row.item_name or "Opening Invoice Item",
"description": row.item_name or "Opening Invoice Item",
income_expense_account_field: row.temporary_opening_account,
"cost_center": cost_center
})
if not row:
return None
party_type = "Customer"
income_expense_account_field = "income_account"
if self.invoice_type == "Purchase":
party_type = "Supplier"
income_expense_account_field = "expense_account"
item = get_item_dict()
return frappe._dict({
"items": [item],
"is_opening": "Yes",
"set_posting_time": 1,
"company": self.company,
"due_date": row.due_date,
"posting_date": row.posting_date,
frappe.scrub(party_type): row.party,
"doctype": "Sales Invoice" if self.invoice_type == "Sales" \
else "Purchase Invoice",
"currency": frappe.db.get_value("Company", self.company, "default_currency")
})
@frappe.whitelist()
def get_temporary_opening_account(company=None):
if not company:
return
accounts = frappe.get_all("Account", filters={
'company': company,
'account_type': 'Temporary'
})
if not accounts:
frappe.throw(_("Please add a Temporary Opening account in Chart of Accounts"))
return accounts[0].name

View File

@ -0,0 +1,32 @@
<h5 style="margin-top: 0px;">{{ __("Opening Invoices Summary") }}</h5>
{% $.each(data, (company, summary) => { %}
<h6 style="margin: 15px 0px -10px 0px;"><a class="company-link"> {{ company }}</a></h6>
<table class="table table-bordered small">
<thead>
<tr>
<td style="width: 33%">{{ __("Invoice Type") }}</td>
<td style="width: 33%" class="text-right">{{ __("Opening Invoices") }}</td>
<td style="width: 33%" class="text-right">{{ __("Total Outstanding") }}</td>
</tr>
</thead>
<tbody>
{% $.each(["Sales Invoice", "Purchase Invoice"], (idx, doctype) => { %}
{% if summary[doctype] %}
<tr>
<td>
<a class="invoice-link" data-type="{{ doctype }}" data-company="{{ company }}">
{{ __(doctype) }}</a>
</td>
<td class="text-right">
{{ summary[doctype].total_invoices }}
</td>
<td class="text-right">
{{ format_currency(summary[doctype].outstanding_amount, summary.currency, 2) }}
</td>
</div>
{% endif %}
{% }); %}
</tbody>
</table>
{% }); %}

View File

@ -0,0 +1,23 @@
/* eslint-disable */
// rename this file from _test_[name] to test_[name] to activate
// and remove above this line
QUnit.test("test: Opening Invoice Creation Tool", function (assert) {
let done = assert.async();
// number of asserts
assert.expect(1);
frappe.run_serially([
// insert a new Opening Invoice Creation Tool
() => frappe.tests.make('Opening Invoice Creation Tool', [
// values to be set
{key: 'value'}
]),
() => {
assert.equal(cur_frm.doc.key, 'value');
},
() => done()
]);
});

View File

@ -0,0 +1,79 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
import frappe
import unittest
test_dependencies = ["Customer", "Supplier"]
from erpnext.accounts.doctype.opening_invoice_creation_tool.opening_invoice_creation_tool import get_temporary_opening_account
class TestOpeningInvoiceCreationTool(unittest.TestCase):
def make_invoices(self, invoice_type="Sales"):
doc = frappe.get_single("Opening Invoice Creation Tool")
args = get_opening_invoice_creation_dict(invoice_type=invoice_type)
doc.update(args)
return doc.make_invoices()
def test_opening_sales_invoice_creation(self):
invoices = self.make_invoices()
self.assertEqual(len(invoices), 2)
expected_value = {
"keys": ["customer", "outstanding_amount", "status"],
0: ["_Test Customer", 300, "Overdue"],
1: ["_Test Customer 1", 250, "Overdue"],
}
self.check_expected_values(invoices, expected_value)
def check_expected_values(self, invoices, expected_value, invoice_type="Sales"):
doctype = "Sales Invoice" if invoice_type == "Sales" else "Purchase Invoice"
for invoice_idx, invoice in enumerate(invoices or []):
si = frappe.get_doc(doctype, invoice)
for field_idx, field in enumerate(expected_value["keys"]):
self.assertEqual(si.get(field, ""), expected_value[invoice_idx][field_idx])
def test_opening_purchase_invoice_creation(self):
invoices = self.make_invoices(invoice_type="Purchase")
self.assertEqual(len(invoices), 2)
expected_value = {
"keys": ["supplier", "outstanding_amount", "status"],
0: ["_Test Supplier", 300, "Overdue"],
1: ["_Test Supplier 1", 250, "Overdue"],
}
self.check_expected_values(invoices, expected_value, invoice_type="Purchase", )
def get_opening_invoice_creation_dict(**args):
party = "Customer" if args.get("invoice_type", "Sales") == "Sales" else "Supplier"
company = args.get("company", "_Test Company")
invoice_dict = frappe._dict({
"company": company,
"invoice_type": args.get("invoice_type", "Sales"),
"invoices": [
{
"qty": 1.0,
"outstanding_amount": 300,
"party": "_Test {0}".format(party),
"item_name": "Opening Item",
"due_date": "2016-09-10",
"posting_date": "2016-09-05",
"temporary_opening_account": get_temporary_opening_account(company)
},
{
"qty": 2.0,
"outstanding_amount": 250,
"party": "_Test {0} 1".format(party),
"item_name": "Opening Item",
"due_date": "2016-09-10",
"posting_date": "2016-09-05",
"temporary_opening_account": get_temporary_opening_account(company)
}
]
})
invoice_dict.update(args)
return invoice_dict

View File

@ -0,0 +1,318 @@
{
"allow_copy": 0,
"allow_guest_to_view": 0,
"allow_import": 0,
"allow_rename": 0,
"beta": 0,
"creation": "2017-08-29 04:26:36.159247",
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"document_type": "",
"editable_grid": 1,
"engine": "InnoDB",
"fields": [
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "party_type",
"fieldtype": "Link",
"hidden": 1,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Party Type",
"length": 0,
"no_copy": 0,
"options": "DocType",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "party",
"fieldtype": "Dynamic Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Party",
"length": 0,
"no_copy": 0,
"options": "party_type",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "temporary_opening_account",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Temporary Opening Account",
"length": 0,
"no_copy": 0,
"options": "Account",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "column_break_3",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"default": "Today",
"fieldname": "posting_date",
"fieldtype": "Date",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Posting Date",
"length": 0,
"no_copy": 0,
"options": "",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"default": "Today",
"fieldname": "due_date",
"fieldtype": "Date",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Due Date",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "section_break_5",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"default": "Opening Invoice Item",
"fieldname": "item_name",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Item Name",
"length": 0,
"no_copy": 0,
"options": "",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"default": "0",
"fieldname": "outstanding_amount",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Outstanding Amount",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
}
],
"has_web_view": 0,
"hide_heading": 0,
"hide_toolbar": 0,
"idx": 0,
"image_view": 0,
"in_create": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 1,
"max_attachments": 0,
"modified": "2017-11-15 14:19:00.433148",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Opening Invoice Creation Tool Item",
"name_case": "",
"owner": "Administrator",
"permissions": [],
"quick_entry": 1,
"read_only": 0,
"read_only_onload": 0,
"show_name_in_global_search": 0,
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1,
"track_seen": 0
}

View File

@ -0,0 +1,10 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class OpeningInvoiceCreationToolItem(Document):
pass

View File

@ -286,6 +286,36 @@
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "allow_print_before_pay",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Allow Print Before Pay",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,

View File

@ -17,12 +17,13 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({
if(!this.frm.doc.supplier && this.frm.doc.credit_to) {
this.frm.set_df_property("credit_to", "print_hide", 0);
}
} else {
this.frm.set_value("disable_rounded_total", frappe.sys_defaults.disable_rounded_total);
}
// formatter for material request item
this.frm.set_indicator_formatter('item_code',
function(doc) { return (doc.qty<=doc.received_qty) ? "green" : "orange" })
},
refresh: function(doc) {

View File

@ -128,6 +128,7 @@
"no_copy": 0,
"oldfieldname": "supplier_name",
"oldfieldtype": "Data",
"options": "supplier.supplier_name",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
@ -2103,6 +2104,38 @@
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "eval:!doc.disable_rounded_total",
"fieldname": "base_rounded_total",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Rounded Total (Company Currency)",
"length": 0,
"no_copy": 1,
"options": "Company:company:default_currency",
"permlevel": 0,
"precision": "",
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
@ -2228,6 +2261,38 @@
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "eval:!doc.disable_rounded_total",
"fieldname": "rounded_total",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Rounded Total",
"length": 0,
"no_copy": 1,
"options": "currency",
"permlevel": 0,
"precision": "",
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
@ -2323,6 +2388,37 @@
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "grand_total",
"fieldname": "disable_rounded_total",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Disable Rounded Total",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
@ -3668,8 +3764,8 @@
"istable": 0,
"max_attachments": 0,
"menu_index": 0,
"modified": "2017-10-24 12:51:51.199594",
"modified_by": "Administrator",
"modified": "2017-11-17 01:04:15.308603",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Purchase Invoice",
"name_case": "Title Case",

View File

@ -77,8 +77,10 @@ class PurchaseInvoice(BuyingController):
if not self.cash_bank_account and flt(self.paid_amount):
frappe.throw(_("Cash or Bank Account is mandatory for making payment entry"))
if flt(self.paid_amount) + flt(self.write_off_amount) \
- flt(self.grand_total) > 1/(10**(self.precision("base_grand_total") + 1)):
if (flt(self.paid_amount) + flt(self.write_off_amount)
- flt(self.get("rounded_total") or self.grand_total)
> 1/(10**(self.precision("base_grand_total") + 1))):
frappe.throw(_("""Paid amount + Write Off Amount can not be greater than Grand Total"""))
def create_remarks(self):
@ -359,6 +361,7 @@ class PurchaseInvoice(BuyingController):
return gl_entries
def make_supplier_gl_entry(self, gl_entries):
grand_total = self.rounded_total or self.grand_total
if self.get("payment_schedule"):
for d in self.get("payment_schedule"):
payment_amount_in_company_currency = flt(d.payment_amount * self.conversion_rate,
@ -379,9 +382,9 @@ class PurchaseInvoice(BuyingController):
}, self.party_account_currency)
)
elif self.grand_total:
elif grand_total:
# Didnot use base_grand_total to book rounding loss gle
grand_total_in_company_currency = flt(self.grand_total * self.conversion_rate,
grand_total_in_company_currency = flt(grand_total * self.conversion_rate,
self.precision("grand_total"))
gl_entries.append(
self.get_gl_dict({
@ -391,7 +394,7 @@ class PurchaseInvoice(BuyingController):
"against": self.against_expense_account,
"credit": grand_total_in_company_currency,
"credit_in_account_currency": grand_total_in_company_currency \
if self.party_account_currency==self.company_currency else self.grand_total,
if self.party_account_currency==self.company_currency else grand_total,
"against_voucher": self.return_against if cint(self.is_return) else self.name,
"against_voucher_type": self.doctype,
}, self.party_account_currency)

View File

@ -36,7 +36,7 @@ class TestPurchaseInvoice(unittest.TestCase):
dl = wrapper
expected_gl_entries = {
"_Test Payable - _TC": [0, 1512.30],
"_Test Payable - _TC": [0, 1512.0],
"_Test Account Cost for Goods Sold - _TC": [1250, 0],
"_Test Account Shipping Charges - _TC": [100, 0],
"_Test Account Excise Duty - _TC": [140, 0],
@ -45,6 +45,7 @@ class TestPurchaseInvoice(unittest.TestCase):
"_Test Account CST - _TC": [29.88, 0],
"_Test Account VAT - _TC": [156.25, 0],
"_Test Account Discount - _TC": [0, 168.03],
"Round Off - _TC": [0, 0.3]
}
gl_entries = frappe.db.sql("""select account, debit, credit from `tabGL Entry`
where voucher_type = 'Purchase Invoice' and voucher_no = %s""", dl.name, as_dict=1)
@ -240,6 +241,7 @@ class TestPurchaseInvoice(unittest.TestCase):
jv.submit()
pi = frappe.copy_doc(test_records[0])
pi.disable_rounded_total = 1
pi.append("advances", {
"reference_type": "Journal Entry",
"reference_name": jv.name,
@ -249,6 +251,13 @@ class TestPurchaseInvoice(unittest.TestCase):
"remarks": jv.remark
})
pi.insert()
self.assertEqual(pi.outstanding_amount, 1212.30)
pi.disable_rounded_total = 0
pi.save()
self.assertEqual(pi.outstanding_amount, 1212.0)
pi.submit()
pi.load_from_db()
@ -256,8 +265,6 @@ class TestPurchaseInvoice(unittest.TestCase):
where reference_type='Purchase Invoice'
and reference_name=%s and debit_in_account_currency=300""", pi.name))
self.assertEqual(pi.outstanding_amount, 1212.30)
pi.cancel()
self.assertFalse(frappe.db.sql("""select name from `tabJournal Entry Account`
@ -547,7 +554,7 @@ class TestPurchaseInvoice(unittest.TestCase):
pi.load_from_db()
#check outstanding after advance allocation
self.assertEqual(flt(pi.outstanding_amount), flt(pi.grand_total - pi.total_advance))
self.assertEqual(flt(pi.outstanding_amount), flt(pi.rounded_total - pi.total_advance))
#added to avoid Document has been modified exception
jv = frappe.get_doc("Journal Entry", jv.name)
@ -555,7 +562,7 @@ class TestPurchaseInvoice(unittest.TestCase):
pi.load_from_db()
#check outstanding after advance cancellation
self.assertEqual(flt(pi.outstanding_amount), flt(pi.grand_total + pi.total_advance))
self.assertEqual(flt(pi.outstanding_amount), flt(pi.rounded_total + pi.total_advance))
def test_outstanding_amount_after_advance_payment_entry_cancelation(self):
pe = frappe.get_doc({
@ -577,7 +584,7 @@ class TestPurchaseInvoice(unittest.TestCase):
})
pe.insert()
pe.submit()
pi = frappe.copy_doc(test_records[0])
pi.is_pos = 0
pi.append("advances", {
@ -590,19 +597,19 @@ class TestPurchaseInvoice(unittest.TestCase):
})
pi.insert()
pi.submit()
pi.load_from_db()
#check outstanding after advance allocation
self.assertEqual(flt(pi.outstanding_amount), flt(pi.grand_total - pi.total_advance))
self.assertEqual(flt(pi.outstanding_amount), flt(pi.rounded_total - pi.total_advance))
#added to avoid Document has been modified exception
pe = frappe.get_doc("Payment Entry", pe.name)
pe.cancel()
pi.load_from_db()
#check outstanding after advance cancellation
self.assertEqual(flt(pi.outstanding_amount), flt(pi.grand_total + pi.total_advance))
self.assertEqual(flt(pi.outstanding_amount), flt(pi.rounded_total + pi.total_advance))
def test_gl_entry_based_on_payment_schedule(self):
pi = make_purchase_invoice(do_not_save=True, supplier="_Test Supplier P")

View File

@ -1,5 +1,6 @@
{
"allow_copy": 0,
"allow_guest_to_view": 0,
"allow_import": 0,
"allow_rename": 0,
"autoname": "hash",
@ -10,8 +11,10 @@
"doctype": "DocType",
"document_type": "Setup",
"editable_grid": 1,
"engine": "InnoDB",
"fields": [
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -23,7 +26,9 @@
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Consider Tax or Charge for",
"length": 0,
"no_copy": 0,
@ -34,6 +39,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
@ -41,6 +47,7 @@
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -52,7 +59,9 @@
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Add or Deduct",
"length": 0,
"no_copy": 0,
@ -63,6 +72,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
@ -70,6 +80,7 @@
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -80,7 +91,9 @@
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Type",
"length": 0,
"no_copy": 0,
@ -91,6 +104,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
@ -98,6 +112,7 @@
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -109,7 +124,9 @@
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Reference Row #",
"length": 0,
"no_copy": 0,
@ -119,6 +136,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@ -126,6 +144,7 @@
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -137,7 +156,9 @@
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Is this Tax included in Basic Rate?",
"length": 0,
"no_copy": 0,
@ -146,6 +167,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 1,
"reqd": 0,
"search_index": 0,
@ -153,6 +175,7 @@
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -163,13 +186,16 @@
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@ -177,6 +203,7 @@
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -187,7 +214,9 @@
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Account Head",
"length": 0,
"no_copy": 0,
@ -198,6 +227,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
@ -205,6 +235,7 @@
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -216,7 +247,9 @@
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Cost Center",
"length": 0,
"no_copy": 0,
@ -227,6 +260,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@ -234,17 +268,20 @@
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "description",
"fieldtype": "Text Editor",
"fieldtype": "Small Text",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Description",
"length": 0,
"no_copy": 0,
@ -255,6 +292,7 @@
"print_hide_if_no_value": 0,
"print_width": "300px",
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
@ -263,6 +301,7 @@
"width": "300px"
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -273,7 +312,9 @@
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
@ -281,6 +322,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@ -288,6 +330,7 @@
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -298,7 +341,9 @@
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Rate",
"length": 0,
"no_copy": 0,
@ -308,6 +353,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@ -315,6 +361,7 @@
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -325,7 +372,9 @@
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
@ -333,6 +382,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@ -340,6 +390,7 @@
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -350,7 +401,9 @@
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Amount",
"length": 0,
"no_copy": 0,
@ -361,6 +414,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@ -368,6 +422,7 @@
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -378,7 +433,9 @@
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Tax Amount After Discount Amount",
"length": 0,
"no_copy": 0,
@ -388,6 +445,7 @@
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@ -395,6 +453,7 @@
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -405,7 +464,9 @@
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Total",
"length": 0,
"no_copy": 0,
@ -416,6 +477,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@ -423,6 +485,7 @@
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -433,7 +496,9 @@
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
@ -441,6 +506,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@ -448,6 +514,7 @@
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -458,7 +525,9 @@
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Amount (Company Currency)",
"length": 0,
"no_copy": 0,
@ -468,6 +537,7 @@
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@ -475,6 +545,7 @@
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -485,7 +556,9 @@
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Total (Company Currency)",
"length": 0,
"no_copy": 0,
@ -495,6 +568,7 @@
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@ -502,6 +576,7 @@
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -512,7 +587,9 @@
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Tax Amount After Discount Amount",
"length": 0,
"no_copy": 0,
@ -522,6 +599,7 @@
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@ -529,6 +607,7 @@
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -539,7 +618,9 @@
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Item Wise Tax Detail ",
"length": 0,
"no_copy": 0,
@ -549,6 +630,7 @@
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@ -556,6 +638,7 @@
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -565,8 +648,10 @@
"hidden": 1,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 1,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Parenttype",
"length": 0,
"no_copy": 0,
@ -576,6 +661,7 @@
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@ -583,17 +669,17 @@
"unique": 0
}
],
"has_web_view": 0,
"hide_heading": 1,
"hide_toolbar": 0,
"idx": 1,
"image_view": 0,
"in_create": 0,
"in_dialog": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 1,
"max_attachments": 0,
"modified": "2016-08-26 03:20:22.118330",
"modified": "2017-11-15 19:26:57.074345",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Purchase Taxes and Charges",
@ -602,5 +688,7 @@
"quick_entry": 0,
"read_only": 0,
"read_only_onload": 0,
"show_name_in_global_search": 0,
"track_changes": 1,
"track_seen": 0
}

View File

@ -95,8 +95,9 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
// Show buttons only when pos view is active
if (cint(doc.docstatus==0) && cur_frm.page.current_view_name!=="pos" && !doc.is_return) {
cur_frm.cscript.sales_order_btn();
cur_frm.cscript.delivery_note_btn();
this.frm.cscript.sales_order_btn();
this.frm.cscript.delivery_note_btn();
this.frm.cscript.quotation_btn();
}
this.set_default_print_format();
@ -157,6 +158,26 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
})
}, __("Get items from"));
},
quotation_btn: function() {
var me = this;
this.$quotation_btn = this.frm.add_custom_button(__('Quotation'),
function() {
erpnext.utils.map_current_doc({
method: "erpnext.selling.doctype.quotation.quotation.make_sales_invoice",
source_doctype: "Quotation",
target: me.frm,
setters: {
customer: me.frm.doc.customer || undefined,
},
get_query_filters: {
docstatus: 1,
status: ["!=", "Lost"],
company: me.frm.doc.company
}
})
}, __("Get items from"));
},
delivery_note_btn: function() {
var me = this;

View File

@ -160,6 +160,7 @@
"no_copy": 0,
"oldfieldname": "customer_name",
"oldfieldtype": "Data",
"options": "customer.customer_name",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
@ -368,7 +369,7 @@
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"in_standard_filter": 1,
"label": "Company",
"length": 0,
"no_copy": 0,
@ -4531,7 +4532,7 @@
"istable": 0,
"max_attachments": 0,
"menu_index": 0,
"modified": "2017-11-03 05:31:56.636424",
"modified": "2017-11-17 01:02:36.885752",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Sales Invoice",

View File

@ -632,6 +632,7 @@ class SalesInvoice(SellingController):
return gl_entries
def make_customer_gl_entry(self, gl_entries):
grand_total = self.rounded_total or self.grand_total
if self.get("payment_schedule"):
for d in self.get("payment_schedule"):
payment_amount_in_company_currency = flt(d.payment_amount * self.conversion_rate,
@ -652,9 +653,9 @@ class SalesInvoice(SellingController):
}, self.party_account_currency)
)
elif self.grand_total:
elif grand_total:
# Didnot use base_grand_total to book rounding loss gle
grand_total_in_company_currency = flt(self.grand_total * self.conversion_rate,
grand_total_in_company_currency = flt(grand_total * self.conversion_rate,
self.precision("grand_total"))
gl_entries.append(
@ -665,7 +666,7 @@ class SalesInvoice(SellingController):
"against": self.against_income_account,
"debit": grand_total_in_company_currency,
"debit_in_account_currency": grand_total_in_company_currency \
if self.party_account_currency==self.company_currency else self.grand_total,
if self.party_account_currency==self.company_currency else grand_total,
"against_voucher": self.return_against if cint(self.is_return) else self.name,
"against_voucher_type": self.doctype
}, self.party_account_currency)

View File

@ -556,7 +556,7 @@ class TestSalesInvoice(unittest.TestCase):
def test_outstanding(self):
w = self.make()
self.assertEquals(w.outstanding_amount, w.base_grand_total)
self.assertEquals(w.outstanding_amount, w.base_rounded_total)
def test_payment(self):
w = self.make()
@ -570,7 +570,7 @@ class TestSalesInvoice(unittest.TestCase):
jv.insert()
jv.submit()
self.assertEquals(frappe.db.get_value("Sales Invoice", w.name, "outstanding_amount"), 161.8)
self.assertEquals(frappe.db.get_value("Sales Invoice", w.name, "outstanding_amount"), 162.0)
link_data = get_dynamic_link_map().get('Sales Invoice', [])
link_doctypes = [d.parent for d in link_data]
@ -579,7 +579,7 @@ class TestSalesInvoice(unittest.TestCase):
self.assertTrue(link_doctypes.index('GL Entry') > link_doctypes.index('Journal Entry Account'))
jv.cancel()
self.assertEquals(frappe.db.get_value("Sales Invoice", w.name, "outstanding_amount"), 561.8)
self.assertEquals(frappe.db.get_value("Sales Invoice", w.name, "outstanding_amount"), 562.0)
def test_sales_invoice_gl_entry_without_perpetual_inventory(self):
si = frappe.copy_doc(test_records[1])
@ -858,7 +858,7 @@ class TestSalesInvoice(unittest.TestCase):
self.assertTrue(frappe.db.sql("""select name from `tabJournal Entry Account`
where reference_name=%s and credit_in_account_currency=300""", si.name))
self.assertEqual(si.outstanding_amount, 261.8)
self.assertEqual(si.outstanding_amount, 262.0)
si.cancel()
@ -1148,7 +1148,8 @@ class TestSalesInvoice(unittest.TestCase):
si.load_from_db()
#check outstanding after advance allocation
self.assertEqual(flt(si.outstanding_amount), flt(si.grand_total - si.total_advance, si.precision("outstanding_amount")))
self.assertEqual(flt(si.outstanding_amount),
flt(si.rounded_total - si.total_advance, si.precision("outstanding_amount")))
#added to avoid Document has been modified exception
jv = frappe.get_doc("Journal Entry", jv.name)
@ -1156,7 +1157,8 @@ class TestSalesInvoice(unittest.TestCase):
si.load_from_db()
#check outstanding after advance cancellation
self.assertEqual(flt(si.outstanding_amount), flt(si.grand_total + si.total_advance, si.precision("outstanding_amount")))
self.assertEqual(flt(si.outstanding_amount),
flt(si.rounded_total + si.total_advance, si.precision("outstanding_amount")))
def test_outstanding_amount_after_advance_payment_entry_cancelation(self):
pe = frappe.get_doc({
@ -1195,7 +1197,8 @@ class TestSalesInvoice(unittest.TestCase):
si.load_from_db()
#check outstanding after advance allocation
self.assertEqual(flt(si.outstanding_amount), flt(si.grand_total - si.total_advance, si.precision("outstanding_amount")))
self.assertEqual(flt(si.outstanding_amount),
flt(si.rounded_total - si.total_advance, si.precision("outstanding_amount")))
#added to avoid Document has been modified exception
pe = frappe.get_doc("Payment Entry", pe.name)
@ -1203,7 +1206,8 @@ class TestSalesInvoice(unittest.TestCase):
si.load_from_db()
#check outstanding after advance cancellation
self.assertEqual(flt(si.outstanding_amount), flt(si.grand_total + si.total_advance, si.precision("outstanding_amount")))
self.assertEqual(flt(si.outstanding_amount),
flt(si.rounded_total + si.total_advance, si.precision("outstanding_amount")))
def test_multiple_uom_in_selling(self):
frappe.db.sql("""delete from `tabItem Price`

View File

@ -0,0 +1,36 @@
QUnit.module('Accounts');
QUnit.test("test sales invoice with margin", function(assert) {
assert.expect(3);
let done = assert.async();
frappe.run_serially([
() => {
return frappe.tests.make('Sales Invoice', [
{customer: 'Test Customer 1'},
{selling_price_list: 'Test-Selling-USD'},
{currency: 'USD'},
{items: [
[
{'item_code': 'Test Product 3'},
{'delivery_date': frappe.datetime.add_days(frappe.defaults.get_default("year_end_date"), 1)},
{'qty': 1},
{'margin_type': 'Percentage'},
{'margin_rate_or_amount': 20}
]
]}
]);
},
() => cur_frm.save(),
() => {
assert.ok(cur_frm.doc.items[0].rate_with_margin == 240, "Margin rate correct");
assert.ok(cur_frm.doc.items[0].base_rate_with_margin == cur_frm.doc.conversion_rate * 240, "Base margin rate correct");
assert.ok(cur_frm.doc.total == 240, "Amount correct");
},
() => frappe.tests.click_button('Submit'),
() => frappe.tests.click_button('Yes'),
() => frappe.timeout(0.3),
() => done()
]);
});

View File

@ -729,6 +729,7 @@
"label": "Rate With Margin",
"length": 0,
"no_copy": 0,
"options": "currency",
"permlevel": 0,
"precision": "2",
"print_hide": 1,
@ -803,6 +804,38 @@
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.margin_type && doc.price_list_rate && doc.margin_rate_or_amount",
"fieldname": "base_rate_with_margin",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Rate With Margin (Company Currency)",
"length": 0,
"no_copy": 0,
"options": "Company:company:default_currency",
"permlevel": 0,
"precision": "2",
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
@ -2166,7 +2199,7 @@
"issingle": 0,
"istable": 1,
"max_attachments": 0,
"modified": "2017-09-27 08:31:37.827893",
"modified": "2017-11-03 11:33:36.004844",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Sales Invoice Item",

View File

@ -1,5 +1,6 @@
{
"allow_copy": 0,
"allow_guest_to_view": 0,
"allow_import": 0,
"allow_rename": 0,
"autoname": "INVTD.######",
@ -12,6 +13,7 @@
"editable_grid": 1,
"fields": [
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -22,7 +24,9 @@
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Type",
"length": 0,
"no_copy": 0,
@ -33,6 +37,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
@ -40,6 +45,7 @@
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -51,7 +57,9 @@
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Reference Row #",
"length": 0,
"no_copy": 0,
@ -61,6 +69,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@ -68,6 +77,7 @@
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -78,7 +88,9 @@
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Account Head",
"length": 0,
"no_copy": 0,
@ -89,6 +101,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 1,
@ -96,6 +109,7 @@
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -107,7 +121,9 @@
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Cost Center",
"length": 0,
"no_copy": 0,
@ -118,6 +134,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@ -125,6 +142,7 @@
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -135,13 +153,16 @@
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@ -150,17 +171,20 @@
"width": "50%"
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "description",
"fieldtype": "Text Editor",
"fieldtype": "Small Text",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Description",
"length": 0,
"no_copy": 0,
@ -171,6 +195,7 @@
"print_hide_if_no_value": 0,
"print_width": "300px",
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
@ -179,6 +204,7 @@
"width": "300px"
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -190,7 +216,9 @@
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Is this Tax included in Basic Rate?",
"length": 0,
"no_copy": 0,
@ -199,6 +227,7 @@
"print_hide_if_no_value": 0,
"print_width": "150px",
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 1,
"reqd": 0,
"search_index": 0,
@ -207,6 +236,7 @@
"width": "150px"
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -217,7 +247,9 @@
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
@ -225,6 +257,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@ -232,6 +265,7 @@
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -242,7 +276,9 @@
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Rate",
"length": 0,
"no_copy": 0,
@ -252,6 +288,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@ -259,6 +296,7 @@
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -269,7 +307,9 @@
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
@ -277,6 +317,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@ -284,6 +325,7 @@
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -294,7 +336,9 @@
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Amount",
"length": 0,
"no_copy": 0,
@ -304,6 +348,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@ -311,6 +356,7 @@
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -321,7 +367,9 @@
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Total",
"length": 0,
"no_copy": 0,
@ -331,6 +379,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@ -338,6 +387,7 @@
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -348,7 +398,9 @@
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Tax Amount After Discount Amount",
"length": 0,
"no_copy": 0,
@ -358,6 +410,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@ -365,6 +418,7 @@
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -375,7 +429,9 @@
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
@ -383,6 +439,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@ -390,6 +447,7 @@
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -400,7 +458,9 @@
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Amount (Company Currency)",
"length": 0,
"no_copy": 0,
@ -411,6 +471,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@ -418,6 +479,7 @@
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -428,7 +490,9 @@
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Total (Company Currency)",
"length": 0,
"no_copy": 0,
@ -439,6 +503,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@ -446,6 +511,7 @@
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -457,7 +523,9 @@
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Tax Amount After Discount Amount (Company Currency)",
"length": 0,
"no_copy": 0,
@ -466,6 +534,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@ -473,6 +542,7 @@
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -483,7 +553,9 @@
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Item Wise Tax Detail",
"length": 0,
"no_copy": 0,
@ -493,6 +565,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@ -500,6 +573,7 @@
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -510,7 +584,9 @@
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 1,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Parenttype",
"length": 0,
"no_copy": 0,
@ -520,6 +596,7 @@
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 1,
@ -527,17 +604,17 @@
"unique": 0
}
],
"has_web_view": 0,
"hide_heading": 1,
"hide_toolbar": 0,
"idx": 1,
"image_view": 0,
"in_create": 0,
"in_dialog": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 1,
"max_attachments": 0,
"modified": "2016-08-26 03:08:03.235381",
"modified": "2017-11-15 19:24:39.351600",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Sales Taxes and Charges",
@ -546,6 +623,8 @@
"quick_entry": 0,
"read_only": 0,
"read_only_onload": 0,
"show_name_in_global_search": 0,
"sort_order": "ASC",
"track_changes": 0,
"track_seen": 0
}

View File

@ -1505,11 +1505,15 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
me.make_menu_list()
}, "fa fa-plus")
if (this.frm.doc.docstatus == 1) {
if (this.frm.doc.docstatus == 1 || this.pos_profile_data["allow_print_before_pay"]) {
this.page.set_secondary_action(__("Print"), function () {
me.create_invoice();
var html = frappe.render(me.print_template_data, me.frm.doc)
me.print_document(html)
})
}
if (this.frm.doc.docstatus == 1) {
this.page.add_menu_item(__("Email"), function () {
me.email_prompt()
})

View File

@ -201,9 +201,6 @@ def get_party_account(party_type, party, company):
if (account and account_currency != existing_gle_currency) or not account:
account = get_party_gle_account(party_type, party, company)
if not account:
frappe.throw(_("Party account not specified, please setup default party account in company"))
return account
def get_party_account_currency(party_type, party, company):

View File

@ -3,8 +3,8 @@
from __future__ import unicode_literals
import frappe
from frappe.utils import flt, getdate, cstr
from frappe import _
from frappe.utils import getdate, cstr, flt
from frappe import _, _dict
from erpnext.accounts.utils import get_account_currency
def execute(filters=None):
@ -163,129 +163,89 @@ def get_data_with_opening_closing(filters, account_details, gl_entries):
data = []
gle_map = initialize_gle_map(gl_entries)
opening, total_debit, total_credit, opening_in_account_currency, total_debit_in_account_currency, \
total_credit_in_account_currency, gle_map = get_accountwise_gle(filters, gl_entries, gle_map)
totals, entries = get_accountwise_gle(filters, gl_entries, gle_map)
# Opening for filtered account
if filters.get("account") or filters.get("party"):
data += [get_balance_row(_("Opening"), opening, opening_in_account_currency), {}]
data.append(totals.opening)
if filters.get("group_by_account"):
for acc, acc_dict in gle_map.items():
if acc_dict.entries:
# Opening for individual ledger, if grouped by account
data.append(get_balance_row(_("Opening"), acc_dict.opening,
acc_dict.opening_in_account_currency))
# opening
data.append({})
data.append(acc_dict.totals.opening)
data += acc_dict.entries
# Totals and closing for individual ledger, if grouped by account
account_closing = acc_dict.opening + acc_dict.total_debit - acc_dict.total_credit
account_closing_in_account_currency = acc_dict.opening_in_account_currency \
+ acc_dict.total_debit_in_account_currency - acc_dict.total_credit_in_account_currency
# totals
data.append(acc_dict.totals.total)
data += [{"account": "'" + _("Totals") + "'", "debit": acc_dict.total_debit,
"credit": acc_dict.total_credit},
get_balance_row(_("Closing (Opening + Totals)"),
account_closing, account_closing_in_account_currency), {}]
# closing
data.append(acc_dict.totals.closing)
data.append({})
else:
for gl in gl_entries:
if gl.posting_date >= getdate(filters.from_date) and gl.posting_date <= getdate(filters.to_date) \
and gl.is_opening == "No":
data.append(gl)
data += entries
# totals
data.append(totals.total)
# Total debit and credit between from and to date
if total_debit or total_credit:
data.append({
"account": "'" + _("Totals") + "'",
"debit": total_debit,
"credit": total_credit,
"debit_in_account_currency": total_debit_in_account_currency,
"credit_in_account_currency": total_credit_in_account_currency
})
# Closing for filtered account
if filters.get("account") or filters.get("party"):
closing = opening + total_debit - total_credit
closing_in_account_currency = opening_in_account_currency + \
total_debit_in_account_currency - total_credit_in_account_currency
data.append(get_balance_row(_("Closing (Opening + Totals)"),
closing, closing_in_account_currency))
# closing
data.append(totals.closing)
return data
def get_totals_dict():
def _get_debit_credit_dict(label):
return _dict(
account = "'{0}'".format(label),
debit = 0.0,
credit = 0.0,
debit_in_account_currency = 0.0,
credit_in_account_currency = 0.0
)
return _dict(
opening = _get_debit_credit_dict(_('Opening')),
total = _get_debit_credit_dict(_('Total')),
closing = _get_debit_credit_dict(_('Closing (Opening + Total)'))
)
def initialize_gle_map(gl_entries):
gle_map = frappe._dict()
for gle in gl_entries:
gle_map.setdefault(gle.account, frappe._dict({
"opening": 0,
"opening_in_account_currency": 0,
"entries": [],
"total_debit": 0,
"total_debit_in_account_currency": 0,
"total_credit": 0,
"total_credit_in_account_currency": 0,
"closing": 0,
"closing_in_account_currency": 0
}))
gle_map.setdefault(gle.account, _dict(totals = get_totals_dict(), entries = []))
return gle_map
def get_accountwise_gle(filters, gl_entries, gle_map):
opening, total_debit, total_credit = 0, 0, 0
opening_in_account_currency, total_debit_in_account_currency, total_credit_in_account_currency = 0, 0, 0
totals = get_totals_dict()
entries = []
def update_value_in_dict(data, key, gle):
data[key].debit += flt(gle.debit)
data[key].credit += flt(gle.credit)
data[key].debit_in_account_currency += flt(gle.debit_in_account_currency)
data[key].credit_in_account_currency += flt(gle.credit_in_account_currency)
from_date, to_date = getdate(filters.from_date), getdate(filters.to_date)
for gle in gl_entries:
amount = flt(gle.debit, 3) - flt(gle.credit, 3)
amount_in_account_currency = flt(gle.debit_in_account_currency, 3) - flt(gle.credit_in_account_currency, 3)
if (filters.get("account") or filters.get("party") or filters.get("group_by_account")) \
and (gle.posting_date < from_date or cstr(gle.is_opening) == "Yes"):
gle_map[gle.account].opening += amount
if filters.get("show_in_account_currency"):
gle_map[gle.account].opening_in_account_currency += amount_in_account_currency
if filters.get("account") or filters.get("party"):
opening += amount
if filters.get("show_in_account_currency"):
opening_in_account_currency += amount_in_account_currency
if gle.posting_date < from_date or cstr(gle.is_opening) == "Yes":
update_value_in_dict(gle_map[gle.account].totals, 'opening', gle)
update_value_in_dict(totals, 'opening', gle)
elif gle.posting_date <= to_date:
gle_map[gle.account].entries.append(gle)
gle_map[gle.account].total_debit += flt(gle.debit, 3)
gle_map[gle.account].total_credit += flt(gle.credit, 3)
update_value_in_dict(gle_map[gle.account].totals, 'total', gle)
update_value_in_dict(totals, 'total', gle)
if filters.get("group_by_account"):
gle_map[gle.account].entries.append(gle)
else:
entries.append(gle)
total_debit += flt(gle.debit, 3)
total_credit += flt(gle.credit, 3)
update_value_in_dict(gle_map[gle.account].totals, 'closing', gle)
update_value_in_dict(totals, 'closing', gle)
if filters.get("show_in_account_currency"):
gle_map[gle.account].total_debit_in_account_currency += flt(gle.debit_in_account_currency, 3)
gle_map[gle.account].total_credit_in_account_currency += flt(gle.credit_in_account_currency, 3)
total_debit_in_account_currency += flt(gle.debit_in_account_currency, 3)
total_credit_in_account_currency += flt(gle.credit_in_account_currency, 3)
return opening, total_debit, total_credit, opening_in_account_currency, \
total_debit_in_account_currency, total_credit_in_account_currency, gle_map
def get_balance_row(label, balance, balance_in_account_currency=None):
balance_row = {
"account": "'" + label + "'",
"debit": balance if balance > 0 else 0,
"credit": -1*balance if balance < 0 else 0
}
if balance_in_account_currency != None:
balance_row.update({
"debit_in_account_currency": balance_in_account_currency if balance_in_account_currency > 0 else 0,
"credit_in_account_currency": -1*balance_in_account_currency if balance_in_account_currency < 0 else 0
})
return balance_row
return totals, entries
def get_result_as_list(data, filters):
result = []

View File

@ -189,7 +189,9 @@ def get_tax_accounts(item_list, columns, company_currency,
for parent, description, item_wise_tax_detail, charge_type, tax_amount in tax_details:
if description not in tax_columns and tax_amount:
tax_columns.append(description)
# as description is text editor earlier and markup can break the column convention in reports
from frappe.utils.xlsxutils import handle_html
tax_columns.append(handle_html(description))
if item_wise_tax_detail:
try:

View File

@ -34,6 +34,24 @@ frappe.query_reports["Sales Register"] = {
"label": __("Mode of Payment"),
"fieldtype": "Link",
"options": "Mode of Payment"
},
{
"fieldname":"owner",
"label": __("Owner"),
"fieldtype": "Link",
"options": "User"
},
{
"fieldname":"cost_center",
"label": __("Cost Center"),
"fieldtype": "Link",
"options": "Cost Center"
},
{
"fieldname":"warehouse",
"label": __("Warehouse"),
"fieldtype": "Link",
"options": "Warehouse"
}
]
}

View File

@ -22,7 +22,8 @@ def _execute(filters, additional_table_columns=None, additional_query_columns=No
invoice_income_map = get_invoice_income_map(invoice_list)
invoice_income_map, invoice_tax_map = get_invoice_tax_map(invoice_list,
invoice_income_map, income_accounts)
#Cost Center & Warehouse Map
invoice_cc_wh_map = get_invoice_cc_wh_map(invoice_list)
invoice_so_dn_map = get_invoice_so_dn_map(invoice_list)
customers = list(set([inv.customer for inv in invoice_list]))
customer_map = get_customer_details(customers)
@ -34,6 +35,8 @@ def _execute(filters, additional_table_columns=None, additional_query_columns=No
# invoice details
sales_order = list(set(invoice_so_dn_map.get(inv.name, {}).get("sales_order", [])))
delivery_note = list(set(invoice_so_dn_map.get(inv.name, {}).get("delivery_note", [])))
cost_center = list(set(invoice_cc_wh_map.get(inv.name, {}).get("cost_center", [])))
warehouse = list(set(invoice_cc_wh_map.get(inv.name, {}).get("warehouse", [])))
customer_details = customer_map.get(inv.customer, {})
row = [
@ -48,8 +51,9 @@ def _execute(filters, additional_table_columns=None, additional_query_columns=No
customer_details.get("customer_group"),
customer_details.get("territory"),
inv.debit_to, ", ".join(mode_of_payments.get(inv.name, [])),
inv.project, inv.remarks,
", ".join(sales_order), ", ".join(delivery_note), company_currency
inv.project, inv.owner, inv.remarks,
", ".join(sales_order), ", ".join(delivery_note),", ".join(cost_center),
", ".join(warehouse), company_currency
]
# map income values
base_net_total = 0
@ -89,8 +93,9 @@ def get_columns(invoice_list, additional_table_columns):
columns +=[
_("Customer Group") + ":Link/Customer Group:120", _("Territory") + ":Link/Territory:80",
_("Receivable Account") + ":Link/Account:120", _("Mode of Payment") + "::120",
_("Project") +":Link/Project:80", _("Remarks") + "::150",
_("Project") +":Link/Project:80", _("Owner") + "::150", _("Remarks") + "::150",
_("Sales Order") + ":Link/Sales Order:100", _("Delivery Note") + ":Link/Delivery Note:100",
_("Cost Center") + ":Link/Cost Center:100", _("Warehouse") + ":Link/Warehouse:100",
{
"fieldname": "currency",
"label": _("Currency"),
@ -133,11 +138,23 @@ def get_conditions(filters):
if filters.get("from_date"): conditions += " and posting_date >= %(from_date)s"
if filters.get("to_date"): conditions += " and posting_date <= %(to_date)s"
if filters.get("owner"): conditions += " and owner = %(owner)s"
if filters.get("mode_of_payment"):
conditions += """ and exists(select name from `tabSales Invoice Payment`
where parent=`tabSales Invoice`.name
and ifnull(`tabSales Invoice Payment`.mode_of_payment, '') = %(mode_of_payment)s)"""
if filters.get("cost_center"):
conditions += """ and exists(select name from `tabSales Invoice Item`
where parent=`tabSales Invoice`.name
and ifnull(`tabSales Invoice Item`.cost_center, '') = %(cost_center)s)"""
if filters.get("warehouse"):
conditions += """ and exists(select name from `tabSales Invoice Item`
where parent=`tabSales Invoice`.name
and ifnull(`tabSales Invoice Item`.warehouse, '') = %(warehouse)s)"""
return conditions
def get_invoices(filters, additional_query_columns):
@ -145,7 +162,7 @@ def get_invoices(filters, additional_query_columns):
additional_query_columns = ', ' + ', '.join(additional_query_columns)
conditions = get_conditions(filters)
return frappe.db.sql("""select name, posting_date, debit_to, project, customer, customer_name, remarks,
return frappe.db.sql("""select name, posting_date, debit_to, project, customer, customer_name, owner, remarks,
base_net_total, base_grand_total, base_rounded_total, outstanding_amount {0}
from `tabSales Invoice`
where docstatus = 1 %s order by posting_date desc, name desc""".format(additional_query_columns or '') %
@ -206,6 +223,24 @@ def get_invoice_so_dn_map(invoice_list):
return invoice_so_dn_map
def get_invoice_cc_wh_map(invoice_list):
si_items = frappe.db.sql("""select parent, cost_center, warehouse
from `tabSales Invoice Item` where parent in (%s)
and (ifnull(cost_center, '') != '' or ifnull(warehouse, '') != '')""" %
', '.join(['%s']*len(invoice_list)), tuple([inv.name for inv in invoice_list]), as_dict=1)
invoice_cc_wh_map = {}
for d in si_items:
if d.cost_center:
invoice_cc_wh_map.setdefault(d.parent, frappe._dict()).setdefault(
"cost_center", []).append(d.cost_center)
if d.warehouse:
invoice_cc_wh_map.setdefault(d.parent, frappe._dict()).setdefault(
"warehouse", []).append(d.warehouse)
return invoice_cc_wh_map
def get_customer_details(customers):
customer_map = {}
for cust in frappe.db.sql("""select name, territory, customer_group from `tabCustomer`
@ -225,4 +260,4 @@ def get_mode_of_payments(invoice_list):
for d in inv_mop:
mode_of_payments.setdefault(d.parent, []).append(d.mode_of_payment)
return mode_of_payments
return mode_of_payments

View File

@ -182,6 +182,38 @@
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"default": "0",
"description": "If enabled, last purchase details of items will not be fetched from previous purchase order or purchase receipt",
"fieldname": "disable_fetch_last_purchase_rate",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Disable Fetching Last Purchase Details in Purchase Order",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
}
],
"hide_heading": 0,

View File

@ -218,6 +218,7 @@
"label": "Supplier Name",
"length": 0,
"no_copy": 0,
"options": "supplier.supplier_name",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
@ -291,40 +292,40 @@
"search_index": 1,
"set_only_once": 0,
"unique": 0
},
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
"columns": 0,
"default": "",
"fieldname": "schedule_date",
"fieldtype": "Date",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Reqd By Date",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"allow_bulk_edit": 0,
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
"columns": 0,
"default": "",
"fieldname": "schedule_date",
"fieldtype": "Date",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Reqd By Date",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
},
{
"allow_bulk_edit": 0,
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -3174,7 +3175,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2017-10-24 12:52:11.272306",
"modified": "2017-11-17 01:03:44.591992",
"modified_by": "Administrator",
"module": "Buying",
"name": "Purchase Order",

View File

@ -4,7 +4,7 @@
from __future__ import unicode_literals
import frappe
import json
from frappe.utils import cstr, flt
from frappe.utils import cstr, flt, cint
from frappe import msgprint, _
from frappe.model.mapper import get_mapped_doc
from erpnext.controllers.buying_controller import BuyingController
@ -105,25 +105,26 @@ class PurchaseOrder(BuyingController):
def get_last_purchase_rate(self):
"""get last purchase rates for all items"""
conversion_rate = flt(self.get('conversion_rate')) or 1.0
if not cint(frappe.db.get_single_value("Buying Settings", "disable_fetch_last_purchase_rate")):
conversion_rate = flt(self.get('conversion_rate')) or 1.0
for d in self.get("items"):
if d.item_code:
last_purchase_details = get_last_purchase_details(d.item_code, self.name)
for d in self.get("items"):
if d.item_code:
last_purchase_details = get_last_purchase_details(d.item_code, self.name)
if last_purchase_details:
d.base_price_list_rate = (last_purchase_details['base_price_list_rate'] *
(flt(d.conversion_factor) or 1.0))
d.discount_percentage = last_purchase_details['discount_percentage']
d.base_rate = last_purchase_details['base_rate'] * (flt(d.conversion_factor) or 1.0)
d.price_list_rate = d.base_price_list_rate / conversion_rate
d.last_purchase_rate = d.base_rate / conversion_rate
else:
if last_purchase_details:
d.base_price_list_rate = (last_purchase_details['base_price_list_rate'] *
(flt(d.conversion_factor) or 1.0))
d.discount_percentage = last_purchase_details['discount_percentage']
d.base_rate = last_purchase_details['base_rate'] * (flt(d.conversion_factor) or 1.0)
d.price_list_rate = d.base_price_list_rate / conversion_rate
d.last_purchase_rate = d.base_rate / conversion_rate
else:
item_last_purchase_rate = frappe.db.get_value("Item", d.item_code, "last_purchase_rate")
if item_last_purchase_rate:
d.base_price_list_rate = d.base_rate = d.price_list_rate \
= d.last_purchase_rate = item_last_purchase_rate
item_last_purchase_rate = frappe.db.get_value("Item", d.item_code, "last_purchase_rate")
if item_last_purchase_rate:
d.base_price_list_rate = d.base_rate = d.price_list_rate \
= d.last_purchase_rate = item_last_purchase_rate
# Check for Closed status
def check_for_closed_status(self):

View File

@ -1,7 +1,7 @@
QUnit.module('Buying');
QUnit.test("test: purchase order with last purchase rate", function(assert) {
assert.expect(5);
assert.expect(9);
let done = assert.async();
frappe.run_serially([
@ -77,9 +77,11 @@ QUnit.test("test: purchase order with last purchase rate", function(assert) {
// Get the last purchase rate of items
() => {
assert.ok(cur_frm.doc.items[0].last_purchase_rate == 800, "Last purchase rate of item 1 correct");
assert.ok(cur_frm.doc.items[1].last_purchase_rate != 0);
},
() => {
assert.ok(cur_frm.doc.items[1].last_purchase_rate == 400, "Last purchase rate of item 2 correct");
assert.ok(cur_frm.doc.items[1].last_purchase_rate != 0);
},
() => frappe.tests.click_button('Submit'),
@ -94,6 +96,59 @@ QUnit.test("test: purchase order with last purchase rate", function(assert) {
assert.ok(cur_frm.doc.status == 'To Receive and Bill', "Submitted successfully");
},
// enable allow_last_purchase_rate
() => frappe.tests.make('Buying Settings', [
// values to be set
{"disable_fetch_last_purchase_rate": 1}
]),
() => {
return frappe.tests.make('Purchase Order', [
{supplier: 'Test Supplier'},
{is_subcontracted: 'No'},
{currency: 'INR'},
{items: [
[
{"item_code": 'Test Product 4'},
{"schedule_date": frappe.datetime.add_days(frappe.datetime.now_date(), 1)},
{"expected_delivery_date": frappe.datetime.add_days(frappe.datetime.now_date(), 5)},
{"qty": 1},
{"rate": 800},
{"warehouse": 'Stores - '+frappe.get_abbr(frappe.defaults.get_default("Company"))}
],
[
{"item_code": 'Test Product 1'},
{"schedule_date": frappe.datetime.add_days(frappe.datetime.now_date(), 1)},
{"expected_delivery_date": frappe.datetime.add_days(frappe.datetime.now_date(), 5)},
{"qty": 1},
{"rate": 400},
{"warehouse": 'Stores - '+frappe.get_abbr(frappe.defaults.get_default("Company"))}
]
]}
]);
},
() => {
// Get item details
assert.ok(cur_frm.doc.items[0].last_purchase_rate == 0);
assert.ok(cur_frm.doc.items[1].last_purchase_rate == 0);
},
() => frappe.timeout(1),
() => frappe.tests.click_button('Submit'),
() => frappe.tests.click_button('Yes'),
() => frappe.timeout(3),
() => frappe.tests.click_button('Close'),
() => frappe.timeout(1),
// enable allow_last_purchase_rate
() => frappe.tests.make('Buying Settings', [
// values to be set
{"disable_fetch_last_purchase_rate": 0}
]),
() => done()
]);
});

View File

@ -254,7 +254,7 @@ erpnext.buying.RequestforQuotationController = erpnext.buying.BuyingController.e
}
})
}, __("Get items from"));
// Get items from Opportunity
// Get items from Opportunity
this.frm.add_custom_button(__('Opportunity'),
function() {
erpnext.utils.map_current_doc({
@ -264,11 +264,8 @@ erpnext.buying.RequestforQuotationController = erpnext.buying.BuyingController.e
setters: {
company: me.frm.doc.company
},
get_query_filters: {
enquiry_type: "Sales"
}
})
}, __("Get items from"));
}, __("Get items from"));
// Get items from open Material Requests based on supplier
this.frm.add_custom_button(__('Possible Supplier'), function() {
// Create a dialog window for the user to pick their supplier

View File

@ -138,7 +138,7 @@ class RequestforQuotation(BuyingController):
'user_fullname': full_name
}
subject = _("Request for Quotation: {0}".format(self.name))
subject = _("Request for Quotation")
template = "templates/emails/request_for_quotation.html"
sender = frappe.session.user not in STANDARD_USERS and frappe.session.user or None
message = frappe.get_template(template).render(args)

View File

@ -27,6 +27,11 @@
"supplier_name": "_Test Supplier 1",
"supplier_type": "_Test Supplier Type"
},
{
"doctype": "Supplier",
"supplier_name": "_Test Supplier 2",
"supplier_type": "_Test Supplier Type"
},
{
"doctype": "Supplier",
"supplier_name": "_Test Supplier USD",

View File

@ -156,6 +156,7 @@
"label": "Name",
"length": 0,
"no_copy": 0,
"options": "supplier.supplier_name",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
@ -2370,7 +2371,7 @@
"istable": 0,
"max_attachments": 0,
"menu_index": 0,
"modified": "2017-09-19 11:23:25.268924",
"modified": "2017-11-15 01:01:44.094596",
"modified_by": "Administrator",
"module": "Buying",
"name": "Supplier Quotation",

View File

@ -284,6 +284,11 @@ def get_data():
"name": "Cheque Print Template",
"description": _("Setup cheque dimensions for printing")
},
{
"type": "doctype",
"name": "Opening Invoice Creation Tool",
"description": _("Make Opening Sales and Purchase Invoices")
},
]
},
{

View File

@ -9,22 +9,18 @@ def get_data():
{
"type": "doctype",
"name": "Stock Entry",
"description": _("Record item movement."),
},
{
"type": "doctype",
"name": "Delivery Note",
"description": _("Shipments to customers."),
},
{
"type": "doctype",
"name": "Purchase Receipt",
"description": _("Goods received from Suppliers."),
},
{
"type": "doctype",
"name": "Material Request",
"description": _("Requests for items."),
},
]
},
@ -69,17 +65,14 @@ def get_data():
{
"type": "doctype",
"name": "Item",
"description": _("All Products or Services."),
},
{
"type": "doctype",
"name": "Product Bundle",
"description": _("Bundle items at time of sale."),
},
{
"type": "doctype",
"name": "Price List",
"description": _("Price List master.")
},
{
"type": "doctype",
@ -87,30 +80,24 @@ def get_data():
"icon": "fa fa-sitemap",
"label": _("Item Group"),
"link": "Tree/Item Group",
"description": _("Tree of Item Groups."),
},
{
"type": "doctype",
"name": "Item Price",
"description": _("Multiple Item prices."),
"route": "Report/Item Price"
},
{
"type": "doctype",
"name": "Shipping Rule",
"description": _("Rules for adding shipping costs.")
},
{
"type": "doctype",
"name": "Pricing Rule",
"description": _("Rules for applying pricing and discount.")
},
{
"type": "doctype",
"name": "Item Variant Settings",
"description": _("Item Variant Settings."),
},
]
},
{
@ -119,17 +106,14 @@ def get_data():
{
"type": "doctype",
"name": "Serial No",
"description": _("Single unit of an Item."),
},
{
"type": "doctype",
"name": "Batch",
"description": _("Batch (lot) of an Item."),
},
{
"type": "doctype",
"name": "Installation Note",
"description": _("Installation record for a Serial No.")
},
{
"type": "report",
@ -155,22 +139,18 @@ def get_data():
{
"type": "doctype",
"name": "Stock Reconciliation",
"description": _("Upload stock balance via csv.")
},
{
"type": "doctype",
"name": "Packing Slip",
"description": _("Split Delivery Note into packages.")
},
{
"type": "doctype",
"name": "Quality Inspection",
"description": _("Incoming quality inspection.")
},
{
"type": "doctype",
"name": "Landed Cost Voucher",
"description": _("Update additional costs to calculate landed cost of items"),
}
]
},
@ -181,28 +161,27 @@ def get_data():
{
"type": "doctype",
"name": "Stock Settings",
"description": _("Default settings for stock transactions.")
},
{
"type": "doctype",
"name": "Warehouse",
"description": _("Where items are stored."),
},
{
"type": "doctype",
"name": "UOM",
"label": _("Unit of Measure") + " (UOM)",
"description": _("e.g. Kg, Unit, Nos, m")
},
{
"type": "doctype",
"name": "Item Attribute",
"description": _("Attributes for Item Variants. e.g Size, Color etc."),
},
{
"type": "doctype",
"name": "Brand",
"description": _("Brand master.")
},
{
"type": "doctype",
"name": "Item Variant Settings",
},
]
},
@ -289,6 +268,12 @@ def get_data():
"name": "Itemwise Recommended Reorder Level",
"doctype": "Item"
},
{
"type": "report",
"is_query_report": True,
"name": "Item Variant Details",
"doctype": "Item"
}
]
},
{

View File

@ -92,9 +92,9 @@ class AccountsController(TransactionBase):
if cint(is_paid) == 1:
if flt(self.paid_amount) == 0 and flt(self.outstanding_amount) > 0:
if self.cash_bank_account:
self.paid_amount = flt(flt(self.grand_total) - flt(self.write_off_amount),
self.precision("paid_amount"))
self.base_paid_amount = flt(self.paid_amount * self.conversion_rate, self.precision("base_paid_amount"))
self.paid_amount = flt(flt(self.outstanding_amount), self.precision("paid_amount"))
self.base_paid_amount = flt(self.paid_amount * self.conversion_rate,
self.precision("base_paid_amount"))
else:
# show message that the amount is not paid
self.paid_amount = 0
@ -109,9 +109,6 @@ class AccountsController(TransactionBase):
self.set(fieldname, today())
break
# set taxes table if missing from `taxes_and_charges`
self.set_taxes()
def calculate_taxes_and_totals(self):
from erpnext.controllers.taxes_and_totals import calculate_taxes_and_totals
calculate_taxes_and_totals(self)
@ -683,6 +680,11 @@ class AccountsController(TransactionBase):
if flt(total_portion, 2) != 100.00:
frappe.msgprint(_('Combined invoice portion must equal 100%'), raise_exception=1, indicator='red')
def is_rounded_total_disabled(self):
if self.meta.get_field("disable_rounded_total"):
return self.disable_rounded_total
else:
return frappe.db.get_single_value("Global Defaults", "disable_rounded_total")
@frappe.whitelist()
def get_tax_rate(account_head):

View File

@ -169,6 +169,74 @@ def create_variant(item, args):
return variant
@frappe.whitelist()
def enqueue_multiple_variant_creation(item, args):
# There can be innumerable attribute combinations, enqueue
frappe.enqueue("erpnext.controllers.item_variant.create_multiple_variants",
item=item, args=args, now=frappe.flags.in_test);
def create_multiple_variants(item, args):
if isinstance(args, basestring):
args = json.loads(args)
args_set = generate_keyed_value_combinations(args)
for attribute_values in args_set:
if not get_variant(item, args=attribute_values):
variant = create_variant(item, attribute_values)
variant.save()
def generate_keyed_value_combinations(args):
"""
From this:
args = {"attr1": ["a", "b", "c"], "attr2": ["1", "2"], "attr3": ["A"]}
To this:
[
{u'attr1': u'a', u'attr2': u'1', u'attr3': u'A'},
{u'attr1': u'b', u'attr2': u'1', u'attr3': u'A'},
{u'attr1': u'c', u'attr2': u'1', u'attr3': u'A'},
{u'attr1': u'a', u'attr2': u'2', u'attr3': u'A'},
{u'attr1': u'b', u'attr2': u'2', u'attr3': u'A'},
{u'attr1': u'c', u'attr2': u'2', u'attr3': u'A'}
]
"""
# Return empty list if empty
if not args:
return []
# Turn `args` into a list of lists of key-value tuples:
# [
# [(u'attr2', u'1'), (u'attr2', u'2')],
# [(u'attr3', u'A')],
# [(u'attr1', u'a'), (u'attr1', u'b'), (u'attr1', u'c')]
# ]
key_value_lists = [[(key, val) for val in args[key]] for key in args.keys()]
# Store the first, but as objects
# [{u'attr2': u'1'}, {u'attr2': u'2'}]
results = key_value_lists.pop(0)
results = [{d[0]: d[1]} for d in results]
# Iterate the remaining
# Take the next list to fuse with existing results
for l in key_value_lists:
new_results = []
for res in results:
for key_val in l:
# create a new clone of object in result
obj = copy.deepcopy(res)
# to be used with every incoming new value
obj[key_val[0]] = key_val[1]
# and pushed into new_results
new_results.append(obj)
results = new_results
return results
def copy_attributes_to_variant(item, variant):
from frappe.model import no_value_fields
@ -208,7 +276,7 @@ def copy_attributes_to_variant(item, variant):
attributes_description = ""
for d in variant.attributes:
attributes_description += "<div>" + d.attribute + ": " + cstr(d.attribute_value) + "</div>"
if attributes_description not in variant.description:
variant.description += attributes_description
@ -239,3 +307,20 @@ def make_variant_item_code(template_item_code, template_item_name, variant):
if abbreviations:
variant.item_code = "{0}-{1}".format(template_item_code, "-".join(abbreviations))
variant.item_name = "{0}-{1}".format(template_item_name, "-".join(abbreviations))
@frappe.whitelist()
def create_variant_doc_for_quick_entry(template, args):
variant_based_on = frappe.db.get_value("Item", template, "variant_based_on")
args = json.loads(args)
if variant_based_on == "Manufacturer":
variant = get_variant(template, **args)
else:
existing_variant = get_variant(template, args)
if existing_variant:
return existing_variant
else:
variant = create_variant(template, args=args)
variant.name = variant.item_code
validate_item_variant_attributes(variant, args)
return variant.as_dict()

View File

@ -28,8 +28,7 @@ class SellingController(StockController):
super(SellingController, self).onload()
if self.doctype in ("Sales Order", "Delivery Note", "Sales Invoice"):
for item in self.get("items"):
item.update(get_bin_details(item.item_code,
item.warehouse))
item.update(get_bin_details(item.item_code, item.warehouse))
def validate(self):
super(SellingController, self).validate()
@ -114,14 +113,15 @@ class SellingController(StockController):
def set_total_in_words(self):
from frappe.utils import money_in_words
disable_rounded_total = cint(frappe.db.get_value("Global Defaults", None, "disable_rounded_total"))
if self.meta.get_field("base_in_words"):
self.base_in_words = money_in_words(disable_rounded_total and
abs(self.base_grand_total) or abs(self.base_rounded_total), self.company_currency)
base_amount = abs(self.base_grand_total
if self.is_rounded_total_disabled() else self.base_rounded_total)
self.base_in_words = money_in_words(base_amount, self.company_currency)
if self.meta.get_field("in_words"):
self.in_words = money_in_words(disable_rounded_total and
abs(self.grand_total) or abs(self.rounded_total), self.currency)
amount = abs(self.grand_total if self.is_rounded_total_disabled() else self.rounded_total)
self.in_words = money_in_words(amount, self.currency)
def calculate_commission(self):
if self.meta.get_field("commission_rate"):

View File

@ -62,7 +62,7 @@ class calculate_taxes_and_totals(object):
(1.0 - (item.discount_percentage / 100.0)), item.precision("rate"))
if item.doctype in ['Quotation Item', 'Sales Order Item', 'Delivery Note Item', 'Sales Invoice Item']:
item.rate_with_margin = self.calculate_margin(item)
item.rate_with_margin, item.base_rate_with_margin = self.calculate_margin(item)
item.rate = flt(item.rate_with_margin * (1.0 - (item.discount_percentage / 100.0)), item.precision("rate"))\
if item.rate_with_margin > 0 else item.rate
@ -328,14 +328,18 @@ class calculate_taxes_and_totals(object):
self.set_rounded_total()
def set_rounded_total(self):
if frappe.db.get_single_value("Global Defaults", "disable_rounded_total"):
self.doc.rounded_total = self.doc.base_rounded_total = 0
return
if self.doc.meta.get_field("rounded_total"):
if self.doc.is_rounded_total_disabled():
self.doc.rounded_total = self.doc.base_rounded_total = 0
return
self.doc.rounded_total = round_based_on_smallest_currency_fraction(self.doc.grand_total,
self.doc.currency, self.doc.precision("rounded_total"))
#if print_in_rate is set, we would have already calculated rounding adjustment
self.doc.rounding_adjustment += flt(self.doc.rounded_total - self.doc.grand_total,
self.doc.precision("rounding_adjustment"))
if self.doc.meta.get_field("base_rounded_total"):
company_currency = erpnext.get_company_currency(self.doc.company)
@ -343,6 +347,9 @@ class calculate_taxes_and_totals(object):
round_based_on_smallest_currency_fraction(self.doc.base_grand_total,
company_currency, self.doc.precision("base_rounded_total"))
self.doc.base_rounding_adjustment += flt(self.doc.base_rounded_total - self.doc.base_grand_total,
self.doc.precision("base_rounding_adjustment"))
def _cleanup(self):
for tax in self.doc.get("taxes"):
tax.item_wise_tax_detail = json.dumps(tax.item_wise_tax_detail, separators=(',', ':'))
@ -404,7 +411,8 @@ class calculate_taxes_and_totals(object):
actual_tax_amount = flt(actual_taxes_dict.get(tax.row_id, 0)) * flt(tax.rate) / 100
actual_taxes_dict.setdefault(tax.idx, actual_tax_amount)
return flt(self.doc.grand_total - sum(actual_taxes_dict.values()), self.doc.precision("grand_total"))
return flt(self.doc.grand_total - sum(actual_taxes_dict.values()),
self.doc.precision("grand_total"))
def calculate_total_advance(self):
@ -442,30 +450,31 @@ class calculate_taxes_and_totals(object):
self.doc.round_floats_in(self.doc, ["grand_total", "total_advance", "write_off_amount"])
self._set_in_company_currency(self.doc, ['write_off_amount'])
if self.doc.party_account_currency == self.doc.currency:
total_amount_to_pay = flt(self.doc.grand_total - self.doc.total_advance
- flt(self.doc.write_off_amount), self.doc.precision("grand_total"))
else:
total_amount_to_pay = flt(flt(self.doc.grand_total *
self.doc.conversion_rate, self.doc.precision("grand_total")) - self.doc.total_advance
- flt(self.doc.base_write_off_amount), self.doc.precision("grand_total"))
if self.doc.doctype in ["Sales Invoice", "Purchase Invoice"]:
grand_total = self.doc.rounded_total or self.doc.grand_total
if self.doc.party_account_currency == self.doc.currency:
total_amount_to_pay = flt(grand_total - self.doc.total_advance
- flt(self.doc.write_off_amount), self.doc.precision("grand_total"))
else:
total_amount_to_pay = flt(flt(grand_total *
self.doc.conversion_rate, self.doc.precision("grand_total")) - self.doc.total_advance
- flt(self.doc.base_write_off_amount), self.doc.precision("grand_total"))
if self.doc.doctype == "Sales Invoice":
self.doc.round_floats_in(self.doc, ["paid_amount"])
self.calculate_write_off_amount()
self.calculate_change_amount()
change_amount = 0
if self.doc.doctype == "Sales Invoice":
self.calculate_write_off_amount()
self.calculate_change_amount()
change_amount = self.doc.change_amount \
if self.doc.party_account_currency == self.doc.currency else self.doc.base_change_amount
paid_amount = self.doc.paid_amount \
if self.doc.party_account_currency == self.doc.currency else self.doc.base_paid_amount
change_amount = self.doc.change_amount \
if self.doc.party_account_currency == self.doc.currency else self.doc.base_change_amount
self.doc.outstanding_amount = flt(total_amount_to_pay - flt(paid_amount) +
flt(change_amount), self.doc.precision("outstanding_amount"))
elif self.doc.doctype == "Purchase Invoice":
self.doc.outstanding_amount = flt(total_amount_to_pay, self.doc.precision("outstanding_amount"))
self.doc.outstanding_amount = flt(total_amount_to_pay - flt(paid_amount) + flt(change_amount),
self.doc.precision("outstanding_amount"))
def calculate_paid_amount(self):
paid_amount = base_paid_amount = 0.0
@ -485,7 +494,9 @@ class calculate_taxes_and_totals(object):
def calculate_change_amount(self):
self.doc.change_amount = 0.0
self.doc.base_change_amount = 0.0
if self.doc.paid_amount > self.doc.grand_total and not self.doc.is_return \
if self.doc.doctype == "Sales Invoice" \
and self.doc.paid_amount > self.doc.grand_total and not self.doc.is_return \
and any([d.type == "Cash" for d in self.doc.payments]):
self.doc.change_amount = flt(self.doc.paid_amount - self.doc.grand_total +
@ -496,13 +507,14 @@ class calculate_taxes_and_totals(object):
def calculate_write_off_amount(self):
if flt(self.doc.change_amount) > 0:
self.doc.write_off_amount = flt(self.doc.grand_total - self.doc.paid_amount + self.doc.change_amount,
self.doc.precision("write_off_amount"))
self.doc.write_off_amount = flt(self.doc.grand_total - self.doc.paid_amount
+ self.doc.change_amount, self.doc.precision("write_off_amount"))
self.doc.base_write_off_amount = flt(self.doc.write_off_amount * self.doc.conversion_rate,
self.doc.precision("base_write_off_amount"))
def calculate_margin(self, item):
rate_with_margin = 0.0
base_rate_with_margin = 0.0
if item.price_list_rate:
if item.pricing_rule and not self.doc.ignore_pricing_rule:
pricing_rule = frappe.get_doc('Pricing Rule', item.pricing_rule)
@ -512,8 +524,9 @@ class calculate_taxes_and_totals(object):
if item.margin_type and item.margin_rate_or_amount:
margin_value = item.margin_rate_or_amount if item.margin_type == 'Amount' else flt(item.price_list_rate) * flt(item.margin_rate_or_amount) / 100
rate_with_margin = flt(item.price_list_rate) + flt(margin_value)
base_rate_with_margin = flt(rate_with_margin) * flt(self.doc.conversion_rate)
return rate_with_margin
return rate_with_margin, base_rate_with_margin
def set_item_wise_tax_breakup(self):
self.doc.other_charges_calculation = get_itemised_tax_breakup_html(self.doc)

View File

@ -270,8 +270,8 @@
"collapsible": 0,
"columns": 0,
"default": "Sales",
"fieldname": "enquiry_type",
"fieldtype": "Select",
"fieldname": "opportunity_type",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
@ -284,14 +284,14 @@
"no_copy": 0,
"oldfieldname": "enquiry_type",
"oldfieldtype": "Select",
"options": "Sales\nMaintenance",
"options": "Opportunity Type",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
@ -1189,7 +1189,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2017-08-21 02:07:46.486433",
"modified": "2017-11-15 17:44:46.241548",
"modified_by": "Administrator",
"module": "CRM",
"name": "Opportunity",
@ -1239,7 +1239,7 @@
"quick_entry": 0,
"read_only": 0,
"read_only_onload": 0,
"search_fields": "status,transaction_date,customer,lead,enquiry_type,territory,company",
"search_fields": "status,transaction_date,customer,lead,opportunity_type,territory,company",
"show_name_in_global_search": 1,
"sort_field": "modified",
"sort_order": "DESC",

View File

@ -246,7 +246,7 @@ def make_quotation(source_name, target_doc=None):
"doctype": "Quotation",
"field_map": {
"enquiry_from": "quotation_to",
"enquiry_type": "order_type",
"opportunity_type": "order_type",
"name": "enq_no",
}
},
@ -267,10 +267,7 @@ def make_quotation(source_name, target_doc=None):
def make_request_for_quotation(source_name, target_doc=None):
doclist = get_mapped_doc("Opportunity", source_name, {
"Opportunity": {
"doctype": "Request for Quotation",
"validation": {
"enquiry_type": ["=", "Sales"]
}
"doctype": "Request for Quotation"
},
"Opportunity Item": {
"doctype": "Request for Quotation Item",

View File

@ -1,5 +1,5 @@
frappe.listview_settings['Opportunity'] = {
add_fields: ["customer_name", "enquiry_type", "enquiry_from", "status"],
add_fields: ["customer_name", "opportunity_type", "enquiry_from", "status"],
get_indicator: function(doc) {
var indicator = [__(doc.status), frappe.utils.guess_colour(doc.status), "status,=," + doc.status];
if(doc.status=="Quotation") {

View File

@ -30,7 +30,7 @@ class TestOpportunity(unittest.TestCase):
args = {
"doctype": "Opportunity",
"contact_email":"new.opportunity@example.com",
"enquiry_type": "Sales",
"opportunity_type": "Sales",
"with_items": 0,
"transaction_date": today()
}
@ -65,7 +65,7 @@ def make_opportunity(**args):
opp_doc = frappe.get_doc({
"doctype": "Opportunity",
"enquiry_from": args.enquiry_from or "Customer",
"enquiry_type": "Sales",
"opportunity_type": "Sales",
"with_items": args.with_items or 0,
"transaction_date": today()
})

View File

@ -0,0 +1,8 @@
// Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt
frappe.ui.form.on('Opportunity Type', {
refresh: function(frm) {
}
});

View File

@ -0,0 +1,135 @@
{
"allow_copy": 0,
"allow_guest_to_view": 0,
"allow_import": 1,
"allow_rename": 0,
"autoname": "Prompt",
"beta": 0,
"creation": "2017-10-06 12:55:43.318773",
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"document_type": "Setup",
"editable_grid": 1,
"engine": "InnoDB",
"fields": [
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "description",
"fieldtype": "Small Text",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Description",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
}
],
"has_web_view": 0,
"hide_heading": 0,
"hide_toolbar": 0,
"idx": 0,
"image_view": 0,
"in_create": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2017-11-15 17:27:12.271303",
"modified_by": "Administrator",
"module": "CRM",
"name": "Opportunity Type",
"name_case": "Title Case",
"owner": "Administrator",
"permissions": [
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "System Manager",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"write": 1
},
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Sales Manager",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"write": 1
},
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 0,
"delete": 0,
"email": 1,
"export": 1,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Sales User",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"write": 0
}
],
"quick_entry": 1,
"read_only": 0,
"read_only_onload": 0,
"search_fields": "",
"show_name_in_global_search": 0,
"sort_field": "modified",
"sort_order": "DESC",
"title_field": "",
"track_changes": 1,
"track_seen": 0
}

View File

@ -0,0 +1,10 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class OpportunityType(Document):
pass

View File

@ -0,0 +1,23 @@
/* eslint-disable */
// rename this file from _test_[name] to test_[name] to activate
// and remove above this line
QUnit.test("test: Opportunity Type", function (assert) {
let done = assert.async();
// number of asserts
assert.expect(1);
frappe.run_serially([
// insert a new Opportunity Type
() => frappe.tests.make('Opportunity Type', [
// values to be set
{key: 'value'}
]),
() => {
assert.equal(cur_frm.doc.key, 'value');
},
() => done()
]);
});

View File

@ -0,0 +1,10 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
import frappe
import unittest
class TestOpportunityType(unittest.TestCase):
pass

View File

@ -54,7 +54,7 @@ def make_opportunity():
"doctype": "Opportunity",
"enquiry_from": "Customer",
"customer": get_random("Customer"),
"enquiry_type": "Sales",
"opportunity_type": "Sales",
"with_items": 1,
"transaction_date": frappe.flags.current_date,
})

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 KiB

View File

@ -108,6 +108,11 @@ Supplier).
<img class="screenshot" alt="Chart of Accounts" src="/docs/assets/img/accounts/chart-of-accounts-2.png">
### Account Number
A standard chart of accounts is organized according to a numerical system. Each major category will begin with a certain number, and then the sub-categories within that major category will all begin with the same number. For example, if assets are classified by numbers starting with the digit 1000, then cash accounts might be labeled 1100, bank accounts might be labeled 1200, accounts receivable might be labeled 1300, and so on. A gap between account numbers is generally maintained for adding accounts in the future.
You can assign a number while creating an account from Chart of Accounts page. You can also edit a number from account record, by clicking "Update Account Number" button. On updating account number, system renames the account name automatically to embed the number in the account name.
### Other Account Types
In ERPNext, you can also specify more information when you create a new
@ -115,6 +120,19 @@ Account, this is there to help you select that particular account in a
scenario like Bank Account or a Tax Account and has no effect on the Chart
itself.
Explanation of account types:
- **Bank:** The account group under which bank account will be created.
- **Cash:** The account group under which cash account will be created.
- **Cost of Goods Sold:** The account to book the accumulated total of all costs used to manufacture / purchase a product or service, sold by a company.
- **Depreciation:** The expense account to book the depreciation of teh fixed assets.
- **Expenses Included In Valuation:** The account to book the expenses (apart from direct material costs) included in landed cost of an item/product, used in Perpetual Inventory, .
- **Fixed Asset:** The account to maintain the costs of fixed assets.
- **Payable:** The account which represents the amount owed by a company to its creditors.
- **Receivable:** The account which represents the amount owed by a company by its debtors.
- **Stock:** The account group under which the warehouse account will be created.
- **Stock Adjustment:** An expense account to book any adjustment entry of stock/inventory, and generally comes at the same level of Cost of Goods Sold.
- **Stock Received But Not Billed:** A temporary liability account which holds the value of stock received but not billed yet and used in Perpetual Inventory.
### Creating / Editing Accounts
To create new Accounts, explore your Chart of Accounts and click on an Account
@ -124,7 +142,8 @@ will see an option to “Open” or “Add Child” a new Account.
<img class="screenshot" alt="Chart of Accounts" src="/docs/assets/img/accounts/chart-of-accounts-3.png">
Option to create will only appear if you click on a Group (folder) type
Account.
Account. There you need to enter account name, account number and some more
optional details.
ERPNext creates a standard structure for you when the Company is created but
it is up to you to modify or add or remove accounts.

View File

@ -1,4 +1,4 @@
#Updating Opening Balance in Accounts
# Updating Opening Balance in Accounts
If you are a new company you can start using ERPNext accounting module by going to chart of accounts. However, if you are migrating from a legacy accounting system like Tally or a Fox Pro based software
@ -13,28 +13,28 @@ If you were using another accounting software before, firstly you should close f
> Opening entry is only for Balance Sheet accounts and not for the Accounts in the Profit and Loss statement.
* For all assets (excluding Accounts Receivables): This entry will contain all your assets except the amounts you are expecting from your Customers against outstanding Sales Invoices. You will have to update your receivables by making an individual entry for each Invoice (this is because, the system will help you track the invoices which are yet to be paid). You can credit the sum of all these debits against the **Temporary Opening** account.
* For all liabilities: Similarly you need to pass a Journal Entry for your Opening Liabilities (except for the bills you have to pay) against **Temporary Opening** account.
###Opening Entry
####Step 1: New Journal Entry
#### Step 1: New Journal Entry
To open new Journal Entry, go to:
`Explore > Accounts > Journal Entry`
####Step 2: Entry Type
#### Step 2: Entry Type
If Entry Type is selected as Opening Entry, all the Balance Sheet Accounts will be auto-fetched in the Journal Entry.
<img class="screenshot" alt="Opening Account" src="/docs/assets/img/accounts/opening-account-1.png">
####Step 3: Posting Date
#### Step 3: Posting Date
Select Posting Date on which Accounts Opening Balance will be updated.
####Step 4: Enter Debit/Credit Value
#### Step 4: Enter Debit/Credit Value
For each Account, enter opening value in the Debit or Credit column. As per the double entry valuation system, Total Debit value in a entry must be equal to Total Credit value.
@ -86,9 +86,9 @@ To update stock opening balance, create [Stock Reconciliation entry](/docs/user/
Opening balance for the fixed asset account should be updated via Journal Entry. Assets which are not fully depreciated should be added in the [Asset master](/docs/user/manual/en/accounts/managing-fixed-assets.html). For adding Assets in your possession, ensure to check **Is Existing Asset** field.
### Outstanding Invoices
### Outstanding Payables and Receivables
After opening Journal Entries are made, you will need to enter each Sales Invoice and Purchase Invoice that is yet to be paid.
After opening Journal Entries are made, you will need to enter the Sales Invoice and Purchase Invoice that is yet to be paid.
Since you have already booked the income or expense on these invoices in the previous period, select **Temporary Opening** in the “Income” and “Expense” accounts.
@ -96,4 +96,12 @@ Since you have already booked the income or expense on these invoices in the pre
If you dont care what items are in that invoice, just make a dummy item entry in the Invoice. Item code in the Invoice is not necessary, so it should not be such a problem.
You can also do this quickly using the **Opening Invoice Creation Tool**
To use this tool, just type "Opening Invoice" in the search bar and select the **Opening Invoice Creation Tool**
Here, select the company and type of invoice (sales or purchase) and add a line item for each invoice you want to create.
<img class="screenshot" alt="Opening Invoice Creation Tool" src="/docs/assets/img/accounts/opening-invoice-creation-tool.png">
{next}

View File

@ -4,3 +4,4 @@ item-variants
purchase-details
reorder
item-valuation-fifo-and-moving-average
item-settings

View File

@ -4,4 +4,12 @@ You can set default settings for your stock related transactions here.
<img class="screenshot" alt="Stock Settings" src="/docs/assets/img/stock/stock-settings.png">
### Clean HTML Description
Usually descriptions are copy-pasted from a website or Word / PDF file and they contain a lot of embedded style. This messes up the Print view of your invoices or quotes.
To fix this, you can check "Convert Item Description to Clean HTML" in Stock Settings. This will ensure that when you save your Items, their descriptions will be cleaned up.
If you want control your description views and llow any HTML to be embedded, you can uncheck this property.
{next}

View File

@ -8,12 +8,12 @@ from frappe import _
from frappe.model.document import Document
from frappe.utils import getdate
import json
from erpnext.healthcare.doctype.healthcare_settings.healthcare_settings import get_receivable_account,get_income_account
from erpnext.healthcare.doctype.healthcare_settings.healthcare_settings import get_receivable_account, get_income_account
class Consultation(Document):
def on_update(self):
if(self.appointment):
frappe.db.set_value("Patient Appointment",self.appointment,"status","Closed")
frappe.db.set_value("Patient Appointment", self.appointment, "status", "Closed")
update_consultation_to_medical_record(self)
def after_insert(self):
@ -23,9 +23,10 @@ class Consultation(Document):
if not self.diagnosis or not self.symptoms:
frappe.throw("Diagnosis and Complaints cannot be left blank")
physician = frappe.get_doc("Physician",self.physician)
if(frappe.session.user != physician.user_id):
frappe.throw(_("You don't have permission to submit"))
def on_cancel(self):
if(self.appointment):
frappe.db.set_value("Patient Appointment", self.appointment, "status", "Open")
delete_medical_record(self)
def set_sales_invoice_fields(company, patient):
sales_invoice = frappe.new_doc("Sales Invoice")
@ -91,8 +92,8 @@ def create_invoice_items(physician, invoice, company):
item_line.qty = 1
item_line.uom = "Nos"
item_line.conversion_factor = 1
item_line.income_account = get_income_account(physician,company)
op_consulting_charge = frappe.get_value("Physician",physician,"op_consulting_charge")
item_line.income_account = get_income_account(physician, company)
op_consulting_charge = frappe.get_value("Physician", physician, "op_consulting_charge")
if op_consulting_charge:
item_line.rate = op_consulting_charge
item_line.amount = op_consulting_charge
@ -111,10 +112,13 @@ def insert_consultation_to_medical_record(doc):
medical_record.save(ignore_permissions=True)
def update_consultation_to_medical_record(consultation):
medical_record_id = frappe.db.sql("select name from `tabPatient Medical Record` where reference_name=%s",(consultation.name))
medical_record_id = frappe.db.sql("select name from `tabPatient Medical Record` where reference_name=%s", (consultation.name))
if(medical_record_id[0][0]):
subject = set_subject_field(consultation)
frappe.db.set_value("Patient Medical Record",medical_record_id[0][0],"subject",subject)
frappe.db.set_value("Patient Medical Record", medical_record_id[0][0], "subject", subject)
def delete_medical_record(consultation):
frappe.db.sql("""delete from `tabPatient Medical Record` where reference_name = %s""", (consultation.name))
def set_subject_field(consultation):
subject = "No Diagnosis "

View File

@ -9,6 +9,7 @@ frappe.ui.form.on('Healthcare Settings', {
filters: {
'account_type': 'Receivable',
'company': d.company,
'is_group': 0
}
};
});
@ -18,6 +19,7 @@ frappe.ui.form.on('Healthcare Settings', {
filters: {
'root_type': 'Income',
'company': d.company,
'is_group': 0
}
};
});

View File

@ -11,8 +11,8 @@ def get_data():
'items': ['Patient Appointment', 'Consultation']
},
{
'label': _('Lab Tests'),
'items': ['Lab Test']
'label': _('Lab Tests and Vital Signs'),
'items': ['Lab Test', 'Vital Signs']
}
]
}

View File

@ -25,6 +25,14 @@ frappe.ui.form.on('Patient Appointment', {
frm.add_custom_button(__('Cancel'), function() {
btn_update_status(frm, "Cancelled");
});
frm.add_custom_button(__("Consultation"),function(){
btn_create_consultation(frm);
},"Create");
frm.add_custom_button(__('Vital Signs'), function() {
btn_create_vital_signs(frm);
},"Create");
}
if(frm.doc.status == "Scheduled" && !frm.doc.__islocal){
frm.add_custom_button(__('Cancel'), function() {

View File

@ -56,7 +56,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Patient",
"length": 0,
@ -174,7 +174,7 @@
"ignore_xss_filter": 1,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Subject",
"length": 0,
@ -236,7 +236,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Datetime",
"length": 0,
@ -266,7 +266,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Reference DocType",
"length": 0,
@ -297,7 +297,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Reference Name",
"length": 0,
@ -389,7 +389,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2017-10-04 16:09:55.597866",
"modified": "2017-11-15 12:48:59.945615",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "Patient Medical Record",
@ -425,6 +425,7 @@
"show_name_in_global_search": 1,
"sort_field": "modified",
"sort_order": "DESC",
"title_field": "patient",
"track_changes": 1,
"track_seen": 1
}

View File

@ -9,6 +9,7 @@ frappe.ui.form.on('Physician', {
filters: {
'root_type': 'Income',
'company': d.company,
'is_group': 0
}
};
});

View File

@ -33,7 +33,7 @@ frappe.ui.form.on('Physician Schedule', {
while(cur_time < end_time) {
let to_time = cur_time.clone().add(values.duration, 'minutes');
if(to_time < end_time) {
if(to_time <= end_time) {
// add a new timeslot
frm.add_child('time_slots', {

View File

@ -51,7 +51,7 @@ email_append_to = ["Job Applicant", "Lead", "Opportunity", "Issue"]
calendars = ["Task", "Production Order", "Leave Application", "Sales Order", "Holiday List"]
fixtures = ["Web Form"]
domains = {
'Distribution': 'erpnext.domains.distribution',

View File

@ -38,9 +38,8 @@ class TestEmployeeLoan(unittest.TestCase):
self.assertEquals(employee_loan.total_interest_payable, 22712)
self.assertEquals(employee_loan.total_payment, 302712)
def create_loan_type(loan_name, maximum_loan_amount, rate_of_interest):
if not frappe.db.get_value("Loan Type", loan_name):
if not frappe.db.exists("Loan Type", loan_name):
frappe.get_doc({
"doctype": "Loan Type",
"loan_name": loan_name,
@ -49,6 +48,7 @@ def create_loan_type(loan_name, maximum_loan_amount, rate_of_interest):
}).insert()
def create_employee_loan(employee, loan_type, loan_amount, repayment_method, repayment_periods):
create_loan_type(loan_type, 500000, 8.4)
if not frappe.db.get_value("Employee Loan", {"employee":employee}):
employee_loan = frappe.new_doc("Employee Loan")
employee_loan.update({

View File

@ -413,6 +413,7 @@
"no_copy": 0,
"oldfieldname": "employee_name",
"oldfieldtype": "Data",
"options": "employee.employee_name",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
@ -964,7 +965,7 @@
"istable": 0,
"max_attachments": 0,
"menu_index": 0,
"modified": "2017-07-17 15:47:23.255142",
"modified": "2017-11-15 01:05:24.323540",
"modified_by": "Administrator",
"module": "HR",
"name": "Expense Claim",

View File

@ -190,23 +190,28 @@ class ProcessPayroll(Document):
def format_as_links(self, salary_slip):
return ['<a href="#Form/Salary Slip/{0}">{0}</a>'.format(salary_slip)]
def get_total_salary_and_loan_amounts(self):
def get_loan_details(self):
"""
Get total loan principal, loan interest and salary amount from submitted salary slip based on selected criteria
Get loan details from submitted salary slip based on selected criteria
"""
cond = self.get_filter_condition()
totals = frappe.db.sql("""
select sum(principal_amount) as total_principal_amount, sum(interest_amount) as total_interest_amount,
sum(total_loan_repayment) as total_loan_repayment, sum(rounded_total) as rounded_total from `tabSalary Slip` t1
return frappe.db.sql(""" select eld.employee_loan_account,
eld.interest_income_account, eld.principal_amount, eld.interest_amount, eld.total_payment
from
`tabSalary Slip` t1, `tabSalary Slip Loan` eld
where
t1.docstatus = 1 and t1.name = eld.parent and start_date >= %s and end_date <= %s %s
""" % ('%s', '%s', cond), (self.start_date, self.end_date), as_dict=True) or []
def get_total_salary_amount(self):
"""
Get total salary amount from submitted salary slip based on selected criteria
"""
cond = self.get_filter_condition()
totals = frappe.db.sql(""" select sum(rounded_total) as rounded_total from `tabSalary Slip` t1
where t1.docstatus = 1 and start_date >= %s and end_date <= %s %s
""" % ('%s', '%s', cond), (self.start_date, self.end_date), as_dict=True)
return totals[0]
def get_loan_accounts(self):
loan_accounts = frappe.get_all("Employee Loan", fields=["employee_loan_account", "interest_income_account"],
filters = {"company": self.company, "docstatus":1})
if loan_accounts:
return loan_accounts[0]
return totals and totals[0] or None
def get_salary_component_account(self, salary_component):
account = frappe.db.get_value("Salary Component Account",
@ -257,8 +262,7 @@ class ProcessPayroll(Document):
earnings = self.get_salary_component_total(component_type = "earnings") or {}
deductions = self.get_salary_component_total(component_type = "deductions") or {}
default_payroll_payable_account = self.get_default_payroll_payable_account()
loan_amounts = self.get_total_salary_and_loan_amounts()
loan_accounts = self.get_loan_accounts()
loan_details = self.get_loan_details()
jv_name = ""
precision = frappe.get_precision("Journal Entry Account", "debit_in_account_currency")
@ -294,18 +298,18 @@ class ProcessPayroll(Document):
})
# Employee loan
if loan_amounts.total_loan_repayment:
for data in loan_details:
accounts.append({
"account": loan_accounts.employee_loan_account,
"credit_in_account_currency": loan_amounts.total_principal_amount
"account": data.employee_loan_account,
"credit_in_account_currency": data.principal_amount
})
accounts.append({
"account": loan_accounts.interest_income_account,
"credit_in_account_currency": loan_amounts.total_interest_amount,
"account": data.interest_income_account,
"credit_in_account_currency": data.interest_amount,
"cost_center": self.cost_center,
"project": self.project
})
payable_amount -= flt(loan_amounts.total_loan_repayment, precision)
payable_amount -= flt(data.total_payment, precision)
# Payable amount
accounts.append({
@ -327,11 +331,11 @@ class ProcessPayroll(Document):
def make_payment_entry(self):
self.check_permission('write')
total_salary_amount = self.get_total_salary_and_loan_amounts()
total_salary_amount = self.get_total_salary_amount()
default_payroll_payable_account = self.get_default_payroll_payable_account()
precision = frappe.get_precision("Journal Entry Account", "debit_in_account_currency")
if total_salary_amount.rounded_total:
if total_salary_amount and total_salary_amount.rounded_total:
journal_entry = frappe.new_doc('Journal Entry')
journal_entry.voucher_type = 'Bank Entry'
journal_entry.user_remark = _('Payment of salary from {0} to {1}')\

View File

@ -6,9 +6,9 @@ import unittest
import erpnext
import frappe
from frappe.utils import nowdate
from erpnext.hr.doctype.process_payroll.process_payroll import get_end_date
from dateutil.relativedelta import relativedelta
from erpnext.accounts.utils import get_fiscal_year, getdate, nowdate
from erpnext.hr.doctype.process_payroll.process_payroll import get_start_end_dates, get_end_date
class TestProcessPayroll(unittest.TestCase):
def test_process_payroll(self):
@ -19,22 +19,9 @@ class TestProcessPayroll(unittest.TestCase):
if not frappe.db.get_value('Salary Component Account',
{'parent': data.name, 'company': erpnext.get_default_company()}, 'name'):
get_salary_component_account(data.name)
payment_account = frappe.get_value('Account',
{'account_type': 'Cash', 'company': erpnext.get_default_company(),'is_group':0}, "name")
if not frappe.db.get_value("Salary Slip", {"start_date": "2016-11-01", "end_date": "2016-11-30"}):
process_payroll = frappe.get_doc("Process Payroll", "Process Payroll")
process_payroll.company = erpnext.get_default_company()
process_payroll.start_date = "2016-11-01"
process_payroll.end_date = "2016-11-30"
process_payroll.payment_account = payment_account
process_payroll.posting_date = nowdate()
process_payroll.payroll_frequency = "Monthly"
process_payroll.create_salary_slips()
process_payroll.submit_salary_slips()
if process_payroll.get_sal_slip_list(ss_status = 1):
r = process_payroll.make_payment_entry()
make_process_payroll()
def test_get_end_date(self):
self.assertEqual(get_end_date('2017-01-01', 'monthly'), {'end_date': '2017-01-31'})
@ -45,7 +32,99 @@ class TestProcessPayroll(unittest.TestCase):
self.assertEqual(get_end_date('2020-02-15', 'bimonthly'), {'end_date': ''})
self.assertEqual(get_end_date('2017-02-15', 'monthly'), {'end_date': '2017-03-14'})
self.assertEqual(get_end_date('2017-02-15', 'daily'), {'end_date': '2017-02-15'})
def test_employee_loan(self):
from erpnext.hr.doctype.salary_structure.test_salary_structure import (make_employee,
make_salary_structure)
from erpnext.hr.doctype.employee_loan.test_employee_loan import create_employee_loan
branch = "Test Employee Branch"
employee = make_employee("test_employee@loan.com")
company = erpnext.get_default_company()
holiday_list = make_holiday("test holiday for loan")
if not frappe.db.exists('Salary Component', 'Basic Salary'):
frappe.get_doc({
'doctype': 'Salary Component',
'salary_component': 'Basic Salary',
'salary_component_abbr': 'BS',
'type': 'Earning',
'accounts': [{
'company': company,
'default_account': frappe.db.get_value('Account',
{'company': company, 'root_type': 'Expense', 'account_type': ''}, 'name')
}]
}).insert()
if not frappe.db.get_value('Salary Component Account',
{'parent': 'Basic Salary', 'company': company}):
salary_component = frappe.get_doc('Salary Component', 'Basic Salary')
salary_component.append('accounts', {
'company': company,
'default_account': 'Salary - WP'
})
company_doc = frappe.get_doc('Company', company)
if not company_doc.default_payroll_payable_account:
company_doc.default_payroll_payable_account = frappe.db.get_value('Account',
{'company': company, 'root_type': 'Liability', 'account_type': ''}, 'name')
company_doc.save()
if not frappe.db.exists('Branch', branch):
frappe.get_doc({
'doctype': 'Branch',
'branch': branch
}).insert()
employee_doc = frappe.get_doc('Employee', employee)
employee_doc.branch = branch
employee_doc.holiday_list = holiday_list
employee_doc.save()
employee_loan = create_employee_loan(employee,
"Personal Loan", 280000, "Repay Over Number of Periods", 20)
employee_loan.repay_from_salary = 1
employee_loan.submit()
salary_strcture = "Test Salary Structure for Loan"
if not frappe.db.exists('Salary Structure', salary_strcture):
salary_strcture = make_salary_structure(salary_strcture, [{
'employee': employee,
'from_date': '2017-01-01',
'base': 30000
}])
salary_strcture = frappe.get_doc('Salary Structure', salary_strcture)
salary_strcture.set('earnings', [{
'salary_component': 'Basic Salary',
'abbr': 'BS',
'amount_based_on_formula':1,
'formula': 'base*.5'
}])
salary_strcture.save()
dates = get_start_end_dates('Monthly', nowdate())
make_process_payroll(start_date=dates.start_date,
end_date=dates.end_date, branch=branch)
name = frappe.db.get_value('Salary Slip',
{'posting_date': nowdate(), 'employee': employee}, 'name')
salary_slip = frappe.get_doc('Salary Slip', name)
for row in salary_slip.loans:
if row.employee_loan == employee_loan.name:
interest_amount = (280000 * 8.4)/(12*100)
principal_amount = employee_loan.monthly_repayment_amount - interest_amount
self.assertEqual(row.interest_amount, interest_amount)
self.assertEqual(row.principal_amount, principal_amount)
self.assertEqual(row.total_payment,
interest_amount + principal_amount)
if salary_slip.docstatus == 0:
frappe.delete_doc('Salary Slip', name)
employee_loan.cancel()
frappe.delete_doc('Employee Loan', employee_loan.name)
def get_salary_component_account(sal_comp):
company = erpnext.get_default_company()
@ -63,4 +142,54 @@ def create_account(company):
"parent_account": "Indirect Expenses - " + frappe.db.get_value('Company', company, 'abbr'),
"company": company
}).insert()
return salary_account
return salary_account
def make_process_payroll(**args):
args = frappe._dict(args)
process_payroll = frappe.get_doc("Process Payroll", "Process Payroll")
process_payroll.company = erpnext.get_default_company()
process_payroll.start_date = args.start_date or "2016-11-01"
process_payroll.end_date = args.end_date or "2016-11-30"
process_payroll.payment_account = get_payment_account()
process_payroll.posting_date = nowdate()
process_payroll.payroll_frequency = "Monthly"
process_payroll.branch = args.branch or None
process_payroll.create_salary_slips()
process_payroll.submit_salary_slips()
if process_payroll.get_sal_slip_list(ss_status = 1):
r = process_payroll.make_payment_entry()
return process_payroll
def get_payment_account():
return frappe.get_value('Account',
{'account_type': 'Cash', 'company': erpnext.get_default_company(),'is_group':0}, "name")
def make_holiday(holiday_list_name):
if not frappe.db.exists('Holiday List', holiday_list_name):
current_fiscal_year = get_fiscal_year(nowdate(), as_dict=True)
dt = getdate(nowdate())
new_year = dt + relativedelta(month=01, day=01, year=dt.year)
republic_day = dt + relativedelta(month=01, day=26, year=dt.year)
test_holiday = dt + relativedelta(month=02, day=02, year=dt.year)
frappe.get_doc({
'doctype': 'Holiday List',
'from_date': current_fiscal_year.year_start_date,
'to_date': current_fiscal_year.year_end_date,
'holiday_list_name': holiday_list_name,
'holidays': [{
'holiday_date': new_year,
'description': 'New Year'
}, {
'holiday_date': republic_day,
'description': 'Republic Day'
}, {
'holiday_date': test_holiday,
'description': 'Test Holiday'
}]
}).insert()
return holiday_list_name

View File

@ -1293,7 +1293,68 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "principal_amount",
"fieldname": "loans",
"fieldtype": "Table",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Employee Loan",
"length": 0,
"no_copy": 0,
"options": "Salary Slip Loan",
"permlevel": 0,
"precision": "",
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "section_break_43",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"default": "0",
"fieldname": "total_principal_amount",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
@ -1302,7 +1363,7 @@
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Principal Amount",
"label": "Total Principal Amount",
"length": 0,
"no_copy": 0,
"options": "Company:company:default_currency",
@ -1324,7 +1385,8 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "interest_amount",
"default": "0",
"fieldname": "total_interest_amount",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
@ -1333,7 +1395,7 @@
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Interest Amount",
"label": "Total Interest Amount",
"length": 0,
"no_copy": 0,
"options": "Company:company:default_currency",
@ -1355,7 +1417,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "column_break_48",
"fieldname": "column_break_45",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
@ -1384,6 +1446,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"default": "0",
"fieldname": "total_loan_repayment",
"fieldtype": "Currency",
"hidden": 0,
@ -1604,7 +1667,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2017-11-10 18:40:33.817074",
"modified": "2017-11-13 23:55:37.504856",
"modified_by": "Administrator",
"module": "HR",
"name": "Salary Slip",

View File

@ -375,15 +375,34 @@ class SalarySlip(TransactionBase):
self.precision("net_pay") if disable_rounded_total else 0)
def set_loan_repayment(self):
employee_loan = frappe.db.sql("""select sum(principal_amount) as principal_amount, sum(interest_amount) as interest_amount,
sum(total_payment) as total_loan_repayment from `tabRepayment Schedule`
where payment_date between %s and %s and parent in (select name from `tabEmployee Loan`
where employee = %s and repay_from_salary = 1 and docstatus = 1)""",
(self.start_date, self.end_date, self.employee), as_dict=True)
if employee_loan:
self.principal_amount = employee_loan[0].principal_amount
self.interest_amount = employee_loan[0].interest_amount
self.total_loan_repayment = employee_loan[0].total_loan_repayment
self.set('loans', [])
self.total_loan_repayment = 0
self.total_interest_amount = 0
self.total_principal_amount = 0
for loan in self.get_employee_loan_details():
self.append('loans', {
'employee_loan': loan.name,
'total_payment': loan.total_payment,
'interest_amount': loan.interest_amount,
'principal_amount': loan.principal_amount,
'employee_loan_account': loan.employee_loan_account,
'interest_income_account': loan.interest_income_account
})
self.total_loan_repayment += loan.total_payment
self.total_interest_amount += loan.interest_amount
self.total_principal_amount += loan.principal_amount
def get_employee_loan_details(self):
return frappe.db.sql("""select rps.principal_amount, rps.interest_amount, el.name,
rps.total_payment, el.employee_loan_account, el.interest_income_account
from
`tabRepayment Schedule` as rps, `tabEmployee Loan` as el
where
el.name = rps.parent and rps.payment_date between %s and %s and
el.repay_from_salary = 1 and el.docstatus = 1 and el.employee = %s""",
(self.start_date, self.end_date, self.employee), as_dict=True) or []
def on_submit(self):
if self.net_pay < 0:

View File

@ -0,0 +1,256 @@
{
"allow_copy": 0,
"allow_guest_to_view": 0,
"allow_import": 0,
"allow_rename": 0,
"beta": 0,
"creation": "2017-11-08 12:51:12.834479",
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"document_type": "",
"editable_grid": 1,
"engine": "InnoDB",
"fields": [
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "employee_loan",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Employee Loan",
"length": 0,
"no_copy": 0,
"options": "Employee Loan",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "employee_loan_account",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Employee Loan Account",
"length": 0,
"no_copy": 0,
"options": "Account",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "interest_income_account",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Interest Income Account",
"length": 0,
"no_copy": 0,
"options": "Account",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "column_break_4",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "principal_amount",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Principal Amount",
"length": 0,
"no_copy": 0,
"options": "",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "interest_amount",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Interest Amount",
"length": 0,
"no_copy": 0,
"options": "",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "total_payment",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Total Payment",
"length": 0,
"no_copy": 0,
"options": "",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
}
],
"has_web_view": 0,
"hide_heading": 0,
"hide_toolbar": 0,
"idx": 0,
"image_view": 0,
"in_create": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 1,
"max_attachments": 0,
"modified": "2017-11-13 23:59:47.237689",
"modified_by": "Administrator",
"module": "HR",
"name": "Salary Slip Loan",
"name_case": "",
"owner": "Administrator",
"permissions": [],
"quick_entry": 1,
"read_only": 0,
"read_only_onload": 0,
"show_name_in_global_search": 0,
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1,
"track_seen": 0
}

View File

@ -0,0 +1,10 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class SalarySlipLoan(Document):
pass

View File

@ -17,11 +17,9 @@ class TestSalaryStructure(unittest.TestCase):
def setUp(self):
self.make_holiday_list()
frappe.db.set_value("Company", erpnext.get_default_company(), "default_holiday_list", "Salary Structure Test Holiday List")
make_earning_salary_component(["Basic Salary", "Special Allowance", "HRA"])
make_deduction_salary_component(["Professional Tax", "TDS"])
make_employee("test_employee@salary.com")
make_employee("test_employee_2@salary.com")
def make_holiday_list(self):
if not frappe.db.get_value("Holiday List", "Salary Structure Test Holiday List"):
holiday_list = frappe.get_doc({
@ -33,7 +31,7 @@ class TestSalaryStructure(unittest.TestCase):
}).insert()
holiday_list.get_weekly_off_dates()
holiday_list.save()
def test_amount_totals(self):
sal_slip = frappe.get_value("Salary Slip", {"employee_name":"test_employee@salary.com"})
if not sal_slip:
@ -64,7 +62,7 @@ class TestSalaryStructure(unittest.TestCase):
for row in salary_structure.deductions:
self.assertFalse(("\n" in row.formula) or ("\n" in row.condition))
def make_employee(user):
if not frappe.db.get_value("User", user):
frappe.get_doc({
@ -74,7 +72,6 @@ def make_employee(user):
"new_password": "password",
"roles": [{"doctype": "Has Role", "role": "Employee"}]
}).insert()
if not frappe.db.get_value("Employee", {"user_id": user}):
emp = frappe.get_doc({
@ -95,7 +92,7 @@ def make_employee(user):
return emp.name
else:
return frappe.get_value("Employee", {"employee_name":user}, "name")
def make_salary_slip_from_salary_structure(employee):
sal_struct = make_salary_structure('Salary Structure Sample')
sal_slip = make_salary_slip(sal_struct, employee = employee)
@ -106,22 +103,21 @@ def make_salary_slip_from_salary_structure(employee):
sal_slip.insert()
sal_slip.submit()
return sal_slip
def make_salary_structure(sal_struct):
def make_salary_structure(sal_struct, employees=None):
if not frappe.db.exists('Salary Structure', sal_struct):
frappe.get_doc({
"doctype": "Salary Structure",
"name": sal_struct,
"company": erpnext.get_default_company(),
"employees": get_employee_details(),
"employees": employees or get_employee_details(),
"earnings": get_earnings_component(),
"deductions": get_deductions_component(),
"payroll_frequency": "Monthly",
"payment_account": frappe.get_value('Account', {'account_type': 'Cash', 'company': erpnext.get_default_company(),'is_group':0}, "name")
}).insert()
return sal_struct
return sal_struct
def get_employee_details():
return [{"employee": frappe.get_value("Employee", {"employee_name":"test_employee@salary.com"}, "name"),
"base": 25000,
@ -136,8 +132,11 @@ def get_employee_details():
"idx": 2
}
]
def get_earnings_component():
def get_earnings_component():
make_earning_salary_component(["Basic Salary", "Special Allowance", "HRA"])
make_deduction_salary_component(["Professional Tax", "TDS"])
return [
{
"salary_component": 'Basic Salary',
@ -167,7 +166,7 @@ def get_earnings_component():
"idx": 4
},
]
def get_deductions_component():
return [
{
@ -191,5 +190,4 @@ def get_deductions_component():
"formula": 'base*.1',
"idx": 3
}
]
]

Some files were not shown because too many files have changed in this diff Show More