Merge branch 'develop' into develop

This commit is contained in:
rohitwaghchaure 2018-02-01 16:54:10 +05:30 committed by GitHub
commit 441032d39c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1849 changed files with 186194 additions and 110373 deletions

View File

@ -52,6 +52,7 @@
"frappe": true, "frappe": true,
"erpnext": true, "erpnext": true,
"schools": true, "schools": true,
"education": true,
"$": true, "$": true,
"jQuery": true, "jQuery": true,
@ -132,6 +133,7 @@
"get_url_arg": true, "get_url_arg": true,
"get_server_fields": true, "get_server_fields": true,
"set_multiple": true, "set_multiple": true,
"QUnit": true "QUnit": true,
"Chart": true
} }
} }

BIN
.swp Normal file

Binary file not shown.

View File

@ -1,13 +1,6 @@
language: python language: python
dist: trusty dist: trusty
addons:
apt:
sources:
- google-chrome
packages:
- google-chrome-stable
python: python:
- "2.7" - "2.7"
@ -15,6 +8,8 @@ services:
- mysql - mysql
install: install:
# fix mongodb travis error
- sudo rm /etc/apt/sources.list.d/mongodb*.list
- pip install flake8==3.3.0 - pip install flake8==3.3.0
- flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics - flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics
- sudo rm /etc/apt/sources.list.d/docker.list - sudo rm /etc/apt/sources.list.d/docker.list
@ -29,15 +24,6 @@ install:
- cp -r $TRAVIS_BUILD_DIR/test_sites/test_site ~/frappe-bench/sites/ - cp -r $TRAVIS_BUILD_DIR/test_sites/test_site ~/frappe-bench/sites/
before_script: before_script:
- wget http://chromedriver.storage.googleapis.com/2.27/chromedriver_linux64.zip
- unzip chromedriver_linux64.zip
- sudo apt-get install libnss3
- sudo apt-get --only-upgrade install google-chrome-stable
- sudo cp chromedriver /usr/local/bin/.
- sudo chmod +x /usr/local/bin/chromedriver
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
- sleep 3
- mysql -u root -ptravis -e 'create database test_frappe' - mysql -u root -ptravis -e 'create database test_frappe'
- echo "USE mysql;\nCREATE USER 'test_frappe'@'localhost' IDENTIFIED BY 'test_frappe';\nFLUSH PRIVILEGES;\n" | mysql -u root -ptravis - echo "USE mysql;\nCREATE USER 'test_frappe'@'localhost' IDENTIFIED BY 'test_frappe';\nFLUSH PRIVILEGES;\n" | mysql -u root -ptravis
- echo "USE mysql;\nGRANT ALL PRIVILEGES ON \`test_frappe\`.* TO 'test_frappe'@'localhost';\n" | mysql -u root -ptravis - echo "USE mysql;\nGRANT ALL PRIVILEGES ON \`test_frappe\`.* TO 'test_frappe'@'localhost';\n" | mysql -u root -ptravis
@ -60,8 +46,7 @@ jobs:
env: Server Side Test env: Server Side Test
- # stage - # stage
script: script:
- bench --verbose run-setup-wizard-ui-test - wget http://build.erpnext.com/20171108_190013_955977f8_database.sql.gz
- bench execute erpnext.setup.utils.enable_all_roles_and_domains - bench --force restore ~/frappe-bench/20171108_190013_955977f8_database.sql.gz --mariadb-root-password travis
- bench run-ui-tests --app erpnext - bench migrate
env: Client Side Test env: Patch Testing

View File

@ -1,4 +1,10 @@
# ERPNext - ERP made simple <div align="center">
<img src="https://github.com/frappe/design/blob/master/logos/erpnext-logo.svg" height="128">
<h2>ERPNext</h2>
<p align="center">
<p>ERP made simple</p>
</p>
</div>
[![Build Status](https://travis-ci.org/frappe/erpnext.png)](https://travis-ci.org/frappe/erpnext) [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/frappe/erpnext?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Build Status](https://travis-ci.org/frappe/erpnext.png)](https://travis-ci.org/frappe/erpnext) [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/frappe/erpnext?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

View File

@ -3,8 +3,9 @@ from __future__ import unicode_literals
import inspect import inspect
import frappe import frappe
from erpnext.hooks import regional_overrides from erpnext.hooks import regional_overrides
from frappe.utils import getdate
__version__ = '9.1.5' __version__ = '10.0.18'
def get_default_company(user=None): def get_default_company(user=None):
'''Get default company for user''' '''Get default company for user'''
@ -108,3 +109,16 @@ def allow_regional(fn):
return caller return caller
def get_last_membership():
'''Returns last membership if exists'''
last_membership = frappe.get_all('Membership', 'name,to_date,membership_type',
dict(member=frappe.session.user, paid=1), order_by='to_date desc', limit=1)
return last_membership and last_membership[0]
def is_member():
'''Returns true if the user is still a member'''
last_membership = get_last_membership()
if last_membership and getdate(last_membership.to_date) > getdate():
return True
return False

View File

@ -47,6 +47,12 @@ frappe.ui.form.on('Account', {
// show / hide convert buttons // show / hide convert buttons
frm.trigger('add_toolbar_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) { account_type: function (frm) {
if (frm.doc.is_group == 0) { 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, "set_only_once": 0,
"unique": 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_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
@ -545,7 +575,7 @@
"issingle": 0, "issingle": 0,
"istable": 0, "istable": 0,
"max_attachments": 0, "max_attachments": 0,
"modified": "2017-08-11 15:28:35.855809", "modified": "2017-08-22 17:39:10.711343",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Account", "name": "Account",
@ -655,7 +685,7 @@
"quick_entry": 0, "quick_entry": 0,
"read_only": 0, "read_only": 0,
"read_only_onload": 0, "read_only_onload": 0,
"search_fields": "", "search_fields": "account_number",
"show_name_in_global_search": 1, "show_name_in_global_search": 1,
"sort_order": "ASC", "sort_order": "ASC",
"track_changes": 1, "track_changes": 1,

View File

@ -3,14 +3,14 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe import frappe
from frappe.utils import cint, fmt_money from frappe.utils import cint, cstr
from frappe import throw, _ from frappe import throw, _
from frappe.model.document import Document from frappe.utils.nestedset import NestedSet
class RootNotEditable(frappe.ValidationError): pass class RootNotEditable(frappe.ValidationError): pass
class BalanceMismatchError(frappe.ValidationError): pass class BalanceMismatchError(frappe.ValidationError): pass
class Account(Document): class Account(NestedSet):
nsm_parent_field = 'parent_account' nsm_parent_field = 'parent_account'
def onload(self): def onload(self):
@ -20,18 +20,14 @@ class Account(Document):
self.set_onload("can_freeze_account", True) self.set_onload("can_freeze_account", True)
def autoname(self): def autoname(self):
# first validate if company exists self.name = get_account_autoname(self.account_number, self.account_name, self.company)
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
def validate(self): def validate(self):
if frappe.local.flags.allow_unverified_charts: if frappe.local.flags.allow_unverified_charts:
return return
self.validate_parent() self.validate_parent()
self.validate_root_details() self.validate_root_details()
validate_account_number(self.name, self.account_number, self.company)
self.validate_group_or_ledger() self.validate_group_or_ledger()
self.set_root_and_report_type() self.set_root_and_report_type()
self.validate_mandatory() self.validate_mandatory()
@ -56,7 +52,8 @@ class Account(Document):
def set_root_and_report_type(self): def set_root_and_report_type(self):
if self.parent_account: 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"], as_dict=1)
if par.report_type: if par.report_type:
self.report_type = par.report_type self.report_type = par.report_type
@ -161,34 +158,21 @@ class Account(Document):
if not self.report_type: if not self.report_type:
throw(_("Report Type is mandatory")) throw(_("Report Type is mandatory"))
def on_trash(self):
def update_nsm_model(self): # checks gl entries and if child exists
"""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"""
if self.check_gle_exists(): if self.check_gle_exists():
throw(_("Account with existing transaction can not be deleted")) 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): super(Account, self).on_trash(True)
self.validate_trash()
self.update_nsm_model()
def before_rename(self, old, new, merge=False): def before_rename(self, old, new, merge=False):
# Add company abbr if not provided # Add company abbr if not provided
from erpnext.setup.doctype.company.company import get_name_with_abbr 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_abbr(new, self.company)
if not merge:
# Validate properties before merging new_account = get_name_with_number(new_account, self.account_number)
if merge: else:
# Validate properties before merging
if not frappe.db.exists("Account", new): if not frappe.db.exists("Account", new):
throw(_("Account {0} does not exist").format(new)) throw(_("Account {0} does not exist").format(new))
@ -205,12 +189,28 @@ class Account(Document):
return new_account return new_account
def after_rename(self, old, new, merge=False): def after_rename(self, old, new, merge=False):
super(Account, self).after_rename(old, new, merge)
if not merge: if not merge:
frappe.db.set_value("Account", new, "account_name", new_acc = frappe.db.get_value("Account", new, ["account_name", "account_number"], as_dict=1)
" - ".join(new.split(" - ")[:-1]))
else: # exclude company abbr
from frappe.utils.nestedset import rebuild_tree new_parts = new.split(" - ")[:-1]
rebuild_tree("Account", "parent_account") # 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): def get_parent_account(doctype, txt, searchfield, start, page_len, filters):
return frappe.db.sql("""select name from tabAccount return frappe.db.sql("""select name from tabAccount
@ -231,3 +231,46 @@ def get_account_currency(account):
return account_currency return account_currency
return frappe.local_cache("account_currency", account, generator) 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: [ fields: [
{fieldtype:'Data', fieldname:'account_name', label:__('New Account Name'), reqd:true, {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")}, 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'), {fieldtype:'Check', fieldname:'is_group', label:__('Is Group'),
description: __('Further accounts can be made under Groups, but entries can be made against non-Groups')}, description: __('Further accounts can be made under Groups, but entries can be made against non-Groups')},
{fieldtype:'Select', fieldname:'root_type', label:__('Root Type'), {fieldtype:'Select', fieldname:'root_type', label:__('Root Type'),
@ -41,16 +43,53 @@ frappe.treeview_settings["Account"] = {
description: __("Optional. Sets company's default currency, if not specified.")} description: __("Optional. Sets company's default currency, if not specified.")}
], ],
ignore_fields:["parent_account"], 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) { onrender: function(node) {
var dr_or_cr = node.data.balance < 0 ? "Cr" : "Dr"; if(frappe.boot.user.can_read.indexOf("GL Entry") !== -1){
if (node.data && node.data.balance!==undefined) { var dr_or_cr = node.data.balance < 0 ? "Cr" : "Dr";
$('<span class="balance-area pull-right text-muted small">' if (node.data && node.data.balance!==undefined) {
+ (node.data.balance_in_account_currency ? $('<span class="balance-area pull-right text-muted small">'
(format_currency(Math.abs(node.data.balance_in_account_currency), + (node.data.balance_in_account_currency ?
node.data.account_currency) + " / ") : "") (format_currency(Math.abs(node.data.balance_in_account_currency),
+ format_currency(Math.abs(node.data.balance), node.data.company_currency) node.data.account_currency) + " / ") : "")
+ " " + dr_or_cr + format_currency(Math.abs(node.data.balance), node.data.company_currency)
+ '</span>').insertBefore(node.$ul); + " " + dr_or_cr
+ '</span>').insertBefore(node.$ul);
}
} }
}, },
toolbar: [ toolbar: [

View File

@ -16,12 +16,12 @@ def create_charts(company, chart_template=None, existing_company=None):
if root_account: if root_account:
root_type = child.get("root_type") 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()) account_number = cstr(child.get("account_number")).strip()
if account_name_in_db in accounts: account_name, account_name_in_db = add_suffix_if_duplicate(account_name,
count = accounts.count(account_name_in_db) account_number, accounts)
account_name = account_name + " " + cstr(count)
is_group = identify_is_group(child) is_group = identify_is_group(child)
report_type = "Balance Sheet" if root_type in ["Asset", "Liability", "Equity"] \ 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, "is_group": is_group,
"root_type": root_type, "root_type": root_type,
"report_type": report_type, "report_type": report_type,
"account_number": account_number,
"account_type": child.get("account_type"), "account_type": child.get("account_type"),
"account_currency": frappe.db.get_value("Company", company, "default_currency"), "account_currency": frappe.db.get_value("Company", company, "default_currency"),
"tax_rate": child.get("tax_rate") "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) _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): def identify_is_group(child):
if child.get("is_group"): if child.get("is_group"):
is_group = 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 is_group = 1
else: else:
is_group = 0 is_group = 0
@ -71,6 +85,10 @@ def get_chart(chart_template, existing_company=None):
elif chart_template == "Standard": elif chart_template == "Standard":
from erpnext.accounts.doctype.account.chart_of_accounts.verified import standard_chart_of_accounts from erpnext.accounts.doctype.account.chart_of_accounts.verified import standard_chart_of_accounts
return standard_chart_of_accounts.get() 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: else:
folders = ("verified",) folders = ("verified",)
if frappe.local.flags.allow_unverified_charts: 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") return json.loads(chart).get("tree")
@frappe.whitelist() @frappe.whitelist()
def get_charts_for_country(country): def get_charts_for_country(country, with_standard=False):
charts = [] charts = []
def _get_chart_name(content): 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: with open(os.path.join(path, fname), "r") as f:
_get_chart_name(f.read()) _get_chart_name(f.read())
if len(charts) != 1: if len(charts) != 1 or with_standard:
charts.append("Standard") charts += ["Standard", "Standard with Numbers"]
return charts return charts
def get_account_tree_from_existing_company(existing_company): def get_account_tree_from_existing_company(existing_company):
all_accounts = frappe.get_all('Account', all_accounts = frappe.get_all('Account',
filters={'company': existing_company}, filters={'company': existing_company},
fields = ["name", "account_name", "parent_account", "account_type", fields = ["name", "account_name", "parent_account", "account_type",
"is_group", "root_type", "tax_rate"], "is_group", "root_type", "tax_rate", "account_number"],
order_by="lft, rgt") order_by="lft, rgt")
account_tree = {} account_tree = {}
# fill in tree starting with root accounts (those with no parent) # fill in tree starting with root accounts (those with no parent)
if all_accounts: if all_accounts:
build_account_tree(account_tree, None, all_accounts) build_account_tree(account_tree, None, all_accounts)
return account_tree return account_tree
def build_account_tree(tree, parent, all_accounts): def build_account_tree(tree, parent, all_accounts):
# find children # find children
parent_account = parent.name if parent else "" 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 no children, but a group account
if not children and parent.is_group: if not children and parent.is_group:
tree["is_group"] = 1 tree["is_group"] = 1
tree["account_number"] = parent.account_number
# build a subtree for each child # build a subtree for each child
for child in children: for child in children:
if child.account_type == "Stock" and not child.is_group:
tree["is_group"] = 1
continue
# start new subtree # start new subtree
tree[child.account_name] = {} tree[child.account_name] = {}
# assign account_type and root_type # assign account_type and root_type
if child.account_type:
tree[child.account_name]["account_number"] = child.account_number
if child.account_type: if child.account_type:
tree[child.account_name]["account_type"] = child.account_type tree[child.account_name]["account_type"] = child.account_type
if child.tax_rate: 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", "country_code": "fr",
"name": "France - Plan Comptable G\u00e9n\u00e9ral", "name": "France - Plan Comptable General",
"tree": { "tree": {
"1-Comptes de Capitaux": { "1-Comptes de Capitaux": {
"10-Capital et R\u00e9serves": { "10-Capital et R\u00e9serves": {
@ -851,7 +851,7 @@
"4457-Taxes sur le chiffre d'affaires collect\u00e9es par l'entreprise": { "4457-Taxes sur le chiffre d'affaires collect\u00e9es par l'entreprise": {
"44571-TVA collect\u00e9e": { "44571-TVA collect\u00e9e": {
"account_type": "Tax", "account_type": "Tax",
"tax_rate": 20.0 "is_group": 1
}, },
"44578-Taxes assimil\u00e9es \u00e0 la TVA": {} "44578-Taxes assimil\u00e9es \u00e0 la TVA": {}
}, },

View File

@ -2,7 +2,394 @@
"country_code": "gt", "country_code": "gt",
"name": "Guatemala - Cuentas", "name": "Guatemala - Cuentas",
"tree": { "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": { "Pasivo Corriente": {
"Acreedores 1": { "Acreedores 1": {
"account_type": "Payable" "account_type": "Payable"
@ -22,329 +409,14 @@
"Acreedores": {}, "Acreedores": {},
"Provisi\u00f3n para Indemnizaciones": {} "Provisi\u00f3n para Indemnizaciones": {}
}, },
"account_number": "2",
"root_type": "Liability" "root_type": "Liability"
}, },
"03 - Patrimonio": { "Patrimonio": {
"Capital": {}, "Capital": {},
"Resultados del Ejercicio": {}, "Resultados del Ejercicio": {},
"Utilidades Retenidas": {}, "Utilidades Retenidas": {},
"root_type": "Asset" "account_number": "3",
},
"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": {}
},
"root_type": "Asset" "root_type": "Asset"
} }
} }

View File

@ -527,7 +527,7 @@
"root_type": "Liability" "root_type": "Liability"
}, },
"5. SZ\u00c1MLAOSZT\u00c1LY K\u00d6LTS\u00c9GNEMEK": { "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": { "51. ANYAGK\u00d6LTS\u00c9G": {
"511. V\u00e1s\u00e1rolt anyagok k\u00f6lts\u00e9gei ": { "511. V\u00e1s\u00e1rolt anyagok k\u00f6lts\u00e9gei ": {
"5111. Alapanyag k\u00f6lts\u00e9gek": {}, "5111. Alapanyag k\u00f6lts\u00e9gek": {},
@ -618,23 +618,8 @@
"581. Saj\u00e1t termel\u00e9s\u0171 k\u00e9szletek \u00e1llom\u00e1nyv\u00e1ltoz\u00e1sa ": {}, "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": {}, "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": {} "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) ": { "59. K\u00d6LTS\u00c9GNEM \u00c1TVEZET\u00c9SI SZ\u00c1MLA": {
"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)": {
"is_group": 1 "is_group": 1
}, },
"root_type": "Expense" "root_type": "Expense"

View File

@ -2,160 +2,161 @@
"country_code": "in", "country_code": "in",
"name": "India - Chart of Accounts", "name": "India - Chart of Accounts",
"tree": { "tree": {
"Application of Funds (Assets)": { "Application of Funds (Assets)": {
"Current Assets": { "Current Assets": {
"Accounts Receivable": { "Accounts Receivable": {
"Debtors": { "Debtors": {
"account_type": "Receivable" "account_type": "Receivable"
} }
}, },
"Bank Accounts": { "Bank Accounts": {
"account_type": "Bank", "account_type": "Bank",
"is_group": 1 "is_group": 1
}, },
"Cash In Hand": { "Cash In Hand": {
"Cash": { "Cash": {
"account_type": "Cash" "account_type": "Cash"
}, },
"account_type": "Cash" "account_type": "Cash"
}, },
"Loans and Advances (Assets)": { "Loans and Advances (Assets)": {
"is_group": 1 "is_group": 1
}, },
"Securities and Deposits": { "Securities and Deposits": {
"Earnest Money": {} "Earnest Money": {}
}, },
"Stock Assets": { "Stock Assets": {
"Stock in Hand": { "Stock In Hand": {
"account_type": "Stock" "account_type": "Stock"
} },
}, "account_type": "Stock"
"Tax Assets": { },
"is_group": 1 "Tax Assets": {
} "is_group": 1
}, }
"Fixed Assets": { },
"Capital Equipments": { "Fixed Assets": {
"account_type": "Fixed Asset" "Capital Equipments": {
}, "account_type": "Fixed Asset"
"Electronic Equipments": { },
"account_type": "Fixed Asset" "Electronic Equipments": {
}, "account_type": "Fixed Asset"
"Furnitures and Fixtures": { },
"account_type": "Fixed Asset" "Furnitures and Fixtures": {
}, "account_type": "Fixed Asset"
"Office Equipments": { },
"account_type": "Fixed Asset" "Office Equipments": {
}, "account_type": "Fixed Asset"
"Plants and Machineries": { },
"account_type": "Fixed Asset" "Plants and Machineries": {
}, "account_type": "Fixed Asset"
"Buildings": { },
"account_type": "Fixed Asset" "Buildings": {
}, "account_type": "Fixed Asset"
"Accumulated Depreciations": { },
"account_type": "Accumulated Depreciation" "Accumulated Depreciations": {
} "account_type": "Accumulated Depreciation"
}, }
"Investments": { },
"is_group": 1 "Investments": {
}, "is_group": 1
"Temporary Accounts": { },
"Temporary Opening": { "Temporary Accounts": {
"account_type": "Temporary" "Temporary Opening": {
} "account_type": "Temporary"
}, }
"root_type": "Asset" },
}, "root_type": "Asset"
"Expenses": { },
"Direct Expenses": { "Expenses": {
"Stock Expenses": { "Direct Expenses": {
"Cost of Goods Sold": { "Stock Expenses": {
"account_type": "Cost of Goods Sold" "Cost of Goods Sold": {
}, "account_type": "Cost of Goods Sold"
"Expenses Included In Valuation": { },
"account_type": "Expenses Included In Valuation" "Expenses Included In Valuation": {
}, "account_type": "Expenses Included In Valuation"
"Stock Adjustment": { },
"account_type": "Stock Adjustment" "Stock Adjustment": {
} "account_type": "Stock Adjustment"
} }
}, }
"Indirect Expenses": { },
"Administrative Expenses": {}, "Indirect Expenses": {
"Commission on Sales": {}, "Administrative Expenses": {},
"Depreciation": { "Commission on Sales": {},
"account_type": "Depreciation" "Depreciation": {
}, "account_type": "Depreciation"
"Entertainment Expenses": {}, },
"Freight and Forwarding Charges": { "Entertainment Expenses": {},
"account_type": "Chargeable" "Freight and Forwarding Charges": {
}, "account_type": "Chargeable"
"Legal Expenses": {}, },
"Marketing Expenses": {}, "Legal Expenses": {},
"Miscellaneous Expenses": {}, "Marketing Expenses": {},
"Office Maintenance Expenses": {}, "Miscellaneous Expenses": {},
"Office Rent": {}, "Office Maintenance Expenses": {},
"Postal Expenses": {}, "Office Rent": {},
"Print and Stationary": {}, "Postal Expenses": {},
"Rounded Off": { "Print and Stationary": {},
"account_type": "Round Off" "Rounded Off": {
}, "account_type": "Round Off"
"Salary": {}, },
"Sales Expenses": {}, "Salary": {},
"Telephone Expenses": {}, "Sales Expenses": {},
"Travel Expenses": {}, "Telephone Expenses": {},
"Utility Expenses": {}, "Travel Expenses": {},
"Write Off": {}, "Utility Expenses": {},
"Exchange Gain/Loss": {}, "Write Off": {},
"Gain/Loss on Asset Disposal": {} "Exchange Gain/Loss": {},
}, "Gain/Loss on Asset Disposal": {}
"root_type": "Expense" },
}, "root_type": "Expense"
"Income": { },
"Direct Income": { "Income": {
"Sales": { "Direct Income": {
"account_type": "Income Account" "Sales": {
}, "account_type": "Income Account"
"Service": { },
"account_type": "Income Account" "Service": {
}, "account_type": "Income Account"
"account_type": "Income Account" },
}, "account_type": "Income Account"
"Indirect Income": { },
"account_type": "Income Account", "Indirect Income": {
"is_group": 1 "account_type": "Income Account",
}, "is_group": 1
"root_type": "Income" },
}, "root_type": "Income"
"Source of Funds (Liabilities)": { },
"Capital Account": { "Source of Funds (Liabilities)": {
"Reserves and Surplus": {}, "Capital Account": {
"Shareholders Funds": {} "Reserves and Surplus": {},
}, "Shareholders Funds": {}
"Current Liabilities": { },
"Accounts Payable": { "Current Liabilities": {
"Creditors": { "Accounts Payable": {
"account_type": "Payable" "Creditors": {
}, "account_type": "Payable"
"Payroll Payable": {} },
}, "Payroll Payable": {}
"Stock Liabilities": { },
"Stock Received But Not Billed": { "Stock Liabilities": {
"account_type": "Stock Received But Not Billed" "Stock Received But Not Billed": {
} "account_type": "Stock Received But Not Billed"
}, }
"Duties and Taxes": { },
"account_type": "Tax", "Duties and Taxes": {
"is_group": 1 "account_type": "Tax",
}, "is_group": 1
"Loans (Liabilities)": { },
"Secured Loans": {}, "Loans (Liabilities)": {
"Unsecured Loans": {}, "Secured Loans": {},
"Bank Overdraft Account": {} "Unsecured Loans": {},
} "Bank Overdraft Account": {}
}, }
"root_type": "Liability" },
} "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 # License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import unittest
import frappe import frappe
from erpnext.stock import get_warehouse_account, get_company_default_inventory_account 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): def _make_test_records(verbose):
from frappe.test_runner import make_test_objects from frappe.test_runner import make_test_objects
@ -21,6 +52,7 @@ def _make_test_records(verbose):
["_Test Account Customs Duty", "_Test Account Stock Expenses", 0, "Tax", None], ["_Test Account Customs Duty", "_Test Account Stock Expenses", 0, "Tax", None],
["_Test Account Insurance Charges", "_Test Account Stock Expenses", 0, "Chargeable", None], ["_Test Account Insurance Charges", "_Test Account Stock Expenses", 0, "Chargeable", None],
["_Test Account Stock Adjustment", "_Test Account Stock Expenses", 0, "Stock Adjustment", None], ["_Test Account Stock Adjustment", "_Test Account Stock Expenses", 0, "Stock Adjustment", None],
["_Test Employee Advance", "Current Liabilities", 0, None, None],
["_Test Account Tax Assets", "Current Assets", 1, None, None], ["_Test Account Tax Assets", "Current Assets", 1, None, None],
["_Test Account VAT", "_Test Account Tax Assets", 0, "Tax", None], ["_Test Account VAT", "_Test Account Tax Assets", 0, "Tax", None],

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(2),
() => {
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

@ -287,6 +287,125 @@
"set_only_once": 0, "set_only_once": 0,
"unique": 0 "unique": 0
}, },
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "print_settings",
"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": "Print Settings",
"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": "show_inclusive_tax_in_print",
"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": "Show Inclusive Tax In Print",
"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": "column_break_12",
"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": "show_payment_schedule_in_print",
"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": "Show Payment Schedule in Print",
"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, "allow_on_submit": 0,
@ -392,7 +511,7 @@
"issingle": 1, "issingle": 1,
"istable": 0, "istable": 0,
"max_attachments": 0, "max_attachments": 0,
"modified": "2017-09-05 10:10:03.117505", "modified": "2018-01-05 15:26:10.357085",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Accounts Settings", "name": "Accounts Settings",
@ -417,7 +536,7 @@
"share": 1, "share": 1,
"submit": 0, "submit": 0,
"write": 1 "write": 1
}, },
{ {
"amend": 0, "amend": 0,
"apply_user_permissions": 0, "apply_user_permissions": 0,
@ -437,7 +556,7 @@
"share": 0, "share": 0,
"submit": 0, "submit": 0,
"write": 0 "write": 0
}, },
{ {
"amend": 0, "amend": 0,
"apply_user_permissions": 0, "apply_user_permissions": 0,
@ -466,4 +585,4 @@
"sort_order": "ASC", "sort_order": "ASC",
"track_changes": 1, "track_changes": 1,
"track_seen": 0 "track_seen": 0
} }

View File

@ -7,6 +7,7 @@ from __future__ import unicode_literals
import frappe import frappe
from frappe.utils import cint from frappe.utils import cint
from frappe.model.document import Document from frappe.model.document import Document
from frappe.custom.doctype.property_setter.property_setter import make_property_setter
class AccountsSettings(Document): class AccountsSettings(Document):
@ -15,6 +16,7 @@ class AccountsSettings(Document):
def validate(self): def validate(self):
self.validate_stale_days() self.validate_stale_days()
self.enable_payment_schedule_in_print()
def validate_stale_days(self): def validate_stale_days(self):
if not self.allow_stale and cint(self.stale_days) <= 0: if not self.allow_stale and cint(self.stale_days) <= 0:
@ -22,3 +24,8 @@ class AccountsSettings(Document):
"Stale Days should start from 1.", title='Error', indicator='red', "Stale Days should start from 1.", title='Error', indicator='red',
raise_exception=1) raise_exception=1)
def enable_payment_schedule_in_print(self):
show_in_print = cint(self.show_payment_schedule_in_print)
for doctype in ("Sales Order", "Sales Invoice", "Purchase Order", "Purchase Invoice"):
make_property_setter(doctype, "due_date", "print_hide", show_in_print, "Check")
make_property_setter(doctype, "payment_schedule", "print_hide", 0 if show_in_print else 1, "Check")

View File

@ -11,36 +11,6 @@
"doctype": "DocType", "doctype": "DocType",
"editable_grid": 0, "editable_grid": 0,
"fields": [ "fields": [
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "column_break0",
"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,
"print_hide": 0,
"print_hide_if_no_value": 0,
"print_width": "50%",
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0,
"width": "50%"
},
{ {
"allow_bulk_edit": 0, "allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
@ -438,7 +408,7 @@
"issingle": 0, "issingle": 0,
"istable": 0, "istable": 0,
"max_attachments": 3, "max_attachments": 3,
"modified": "2017-06-13 14:28:56.667292", "modified": "2017-11-10 18:44:44.081464",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "C-Form", "name": "C-Form",

View File

@ -59,9 +59,8 @@ class CostCenter(NestedSet):
return new_cost_center return new_cost_center
def after_rename(self, olddn, newdn, merge=False): def after_rename(self, olddn, newdn, merge=False):
super(CostCenter, self).after_rename(olddn, newdn, merge)
if not merge: if not merge:
frappe.db.set_value("Cost Center", newdn, "cost_center_name", frappe.db.set_value("Cost Center", newdn, "cost_center_name",
" - ".join(newdn.split(" - ")[:-1])) " - ".join(newdn.split(" - ")[:-1]))
else:
super(CostCenter, self).after_rename(olddn, newdn, merge)

View File

@ -23,5 +23,30 @@ frappe.treeview_settings["Cost Center"] = {
{fieldtype:'Check', fieldname:'is_group', label:__('Is Group'), {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')} 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

@ -718,7 +718,7 @@
"issingle": 0, "issingle": 0,
"istable": 0, "istable": 0,
"max_attachments": 0, "max_attachments": 0,
"modified": "2017-08-03 12:40:09.611951", "modified": "2017-12-20 12:40:09.611951",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "GL Entry", "name": "GL Entry",
@ -794,4 +794,4 @@
"sort_order": "DESC", "sort_order": "DESC",
"track_changes": 0, "track_changes": 0,
"track_seen": 0 "track_seen": 0
} }

View File

@ -0,0 +1,196 @@
{
"allow_copy": 0,
"allow_guest_to_view": 0,
"allow_import": 0,
"allow_rename": 0,
"beta": 0,
"creation": "2018-01-02 15:48:58.768352",
"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": "cgst_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": "CGST 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": 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": "sgst_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": "SGST 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": 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": "igst_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": "IGST 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": 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": "cess_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": "CESS 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
}
],
"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": "2018-01-02 15:52:22.335988",
"modified_by": "Administrator",
"module": "Accounts",
"name": "GST Account",
"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

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

View File

@ -82,8 +82,8 @@ erpnext.accounts.JournalEntry = frappe.ui.form.Controller.extend({
$.each(this.frm.doc.accounts || [], function(i, jvd) { $.each(this.frm.doc.accounts || [], function(i, jvd) {
frappe.model.set_default_values(jvd); frappe.model.set_default_values(jvd);
}); });
var posting_date = this.frm.posting_date;
if(!this.frm.doc.amended_from) this.frm.doc.posting_date = this.frm.posting_date || frappe.datetime.get_today(); if(!this.frm.doc.amended_from) this.frm.set_value('posting_date', posting_date || frappe.datetime.get_today());
} }
}, },
@ -124,6 +124,15 @@ erpnext.accounts.JournalEntry = frappe.ui.form.Controller.extend({
}; };
} }
if(jvd.reference_type==="Employee Advance") {
return {
filters: {
'status': ['=', 'Unpaid'],
'docstatus': 1
}
};
}
// journal entry // journal entry
if(jvd.reference_type==="Journal Entry") { if(jvd.reference_type==="Journal Entry") {
frappe.model.validate_missing(jvd, "account"); frappe.model.validate_missing(jvd, "account");
@ -187,20 +196,19 @@ erpnext.accounts.JournalEntry = frappe.ui.form.Controller.extend({
reference_name: function(doc, cdt, cdn) { reference_name: function(doc, cdt, cdn) {
var d = frappe.get_doc(cdt, cdn); var d = frappe.get_doc(cdt, cdn);
if(d.reference_name) { if(d.reference_name) {
if (d.reference_type==="Purchase Invoice" && !flt(d.debit)) { if (d.reference_type==="Purchase Invoice" && !flt(d.debit)) {
this.get_outstanding('Purchase Invoice', d.reference_name, doc.company, d); this.get_outstanding('Purchase Invoice', d.reference_name, doc.company, d);
} } else if (d.reference_type==="Sales Invoice" && !flt(d.credit)) {
if (d.reference_type==="Sales Invoice" && !flt(d.credit)) {
this.get_outstanding('Sales Invoice', d.reference_name, doc.company, d); this.get_outstanding('Sales Invoice', d.reference_name, doc.company, d);
} } else if (d.reference_type==="Journal Entry" && !flt(d.credit) && !flt(d.debit)) {
if (d.reference_type==="Journal Entry" && !flt(d.credit) && !flt(d.debit)) {
this.get_outstanding('Journal Entry', d.reference_name, doc.company, d); this.get_outstanding('Journal Entry', d.reference_name, doc.company, d);
} }
} }
}, },
get_outstanding: function(doctype, docname, company, child) { get_outstanding: function(doctype, docname, company, child, due_date) {
var me = this; var me = this;
var args = { var args = {
"doctype": doctype, "doctype": doctype,

View File

@ -3,7 +3,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe, erpnext, json import frappe, erpnext, json
from frappe.utils import cstr, flt, fmt_money, formatdate from frappe.utils import cstr, flt, fmt_money, formatdate, getdate
from frappe import msgprint, _, scrub from frappe import msgprint, _, scrub
from erpnext.controllers.accounts_controller import AccountsController from erpnext.controllers.accounts_controller import AccountsController
from erpnext.accounts.utils import get_balance_on, get_account_currency from erpnext.accounts.utils import get_balance_on, get_account_currency
@ -55,7 +55,7 @@ class JournalEntry(AccountsController):
advance_paid = frappe._dict() advance_paid = frappe._dict()
for d in self.get("accounts"): for d in self.get("accounts"):
if d.is_advance: if d.is_advance:
if d.reference_type in ("Sales Order", "Purchase Order"): if d.reference_type in ("Sales Order", "Purchase Order", "Employee Advance"):
advance_paid.setdefault(d.reference_type, []).append(d.reference_name) advance_paid.setdefault(d.reference_type, []).append(d.reference_name)
for voucher_type, order_list in advance_paid.items(): for voucher_type, order_list in advance_paid.items():
@ -76,7 +76,7 @@ class JournalEntry(AccountsController):
def unlink_advance_entry_reference(self): def unlink_advance_entry_reference(self):
for d in self.get("accounts"): for d in self.get("accounts"):
if d.is_advance and d.reference_type in ("Sales Invoice", "Purchase Invoice"): if d.is_advance == "Yes" and d.reference_type in ("Sales Invoice", "Purchase Invoice"):
doc = frappe.get_doc(d.reference_type, d.reference_name) doc = frappe.get_doc(d.reference_type, d.reference_name)
doc.delink_advance_entries(self.name) doc.delink_advance_entries(self.name)
d.reference_type = '' d.reference_type = ''
@ -101,8 +101,6 @@ class JournalEntry(AccountsController):
if account_type in ["Receivable", "Payable"]: if account_type in ["Receivable", "Payable"]:
if not (d.party_type and d.party): if not (d.party_type and d.party):
frappe.throw(_("Row {0}: Party Type and Party is required for Receivable / Payable account {1}").format(d.idx, d.account)) frappe.throw(_("Row {0}: Party Type and Party is required for Receivable / Payable account {1}").format(d.idx, d.account))
elif d.party_type and d.party:
frappe.throw(_("Row {0}: Party Type and Party is only applicable against Receivable / Payable account").format(d.idx))
def check_credit_limit(self): def check_credit_limit(self):
customers = list(set([d.party for d in self.get("accounts") customers = list(set([d.party for d in self.get("accounts")
@ -566,17 +564,26 @@ def get_default_bank_cash_account(company, account_type=None, mode_of_payment=No
account = get_bank_cash_account(mode_of_payment, company).get("account") account = get_bank_cash_account(mode_of_payment, company).get("account")
if not account: if not account:
'''
Set the default account first. If the user hasn't set any default account then, he doesn't
want us to set any random account. In this case set the account only if there is single
account (of that type), otherwise return empty dict.
'''
if account_type=="Bank": if account_type=="Bank":
account = frappe.db.get_value("Company", company, "default_bank_account") account = frappe.db.get_value("Company", company, "default_bank_account")
if not account: if not account:
account = frappe.db.get_value("Account", account_list = frappe.get_all("Account", filters = {"company": company,
{"company": company, "account_type": "Bank", "is_group": 0}) "account_type": "Bank", "is_group": 0})
if len(account_list) == 1:
account = account_list[0].name
elif account_type=="Cash": elif account_type=="Cash":
account = frappe.db.get_value("Company", company, "default_cash_account") account = frappe.db.get_value("Company", company, "default_cash_account")
if not account: if not account:
account = frappe.db.get_value("Account", account_list = frappe.get_all("Account", filters = {"company": company,
{"company": company, "account_type": "Cash", "is_group": 0}) "account_type": "Cash", "is_group": 0})
if len(account_list) == 1:
account = account_list[0].name
if account: if account:
account_details = frappe.db.get_value("Account", account, account_details = frappe.db.get_value("Account", account,
@ -639,9 +646,8 @@ def get_payment_entry_against_invoice(dt, dn, amount=None, debit_in_account_cur
party_type = "Supplier" party_type = "Supplier"
party_account = ref_doc.credit_to party_account = ref_doc.credit_to
if (dt == "Sales Invoice" and ref_doc.outstanding_amount > 0) \
if (dt=="Sales Invoice" and ref_doc.outstanding_amount > 0) \ or (dt == "Purchase Invoice" and ref_doc.outstanding_amount < 0):
or (dt=="Purchase Invoice" and ref_doc.outstanding_amount < 0):
amount_field_party = "credit_in_account_currency" amount_field_party = "credit_in_account_currency"
amount_field_bank = "debit_in_account_currency" amount_field_bank = "debit_in_account_currency"
else: else:
@ -662,6 +668,7 @@ def get_payment_entry_against_invoice(dt, dn, amount=None, debit_in_account_cur
"journal_entry": journal_entry "journal_entry": journal_entry
}) })
def get_payment_entry(ref_doc, args): def get_payment_entry(ref_doc, args):
cost_center = frappe.db.get_value("Company", ref_doc.company, "cost_center") cost_center = frappe.db.get_value("Company", ref_doc.company, "cost_center")
exchange_rate = 1 exchange_rate = 1
@ -686,7 +693,7 @@ def get_payment_entry(ref_doc, args):
"cost_center": cost_center, "cost_center": cost_center,
"account_type": frappe.db.get_value("Account", args.get("party_account"), "account_type"), "account_type": frappe.db.get_value("Account", args.get("party_account"), "account_type"),
"account_currency": args.get("party_account_currency") or \ "account_currency": args.get("party_account_currency") or \
get_account_currency(args.get("party_account")), get_account_currency(args.get("party_account")),
"balance": get_balance_on(args.get("party_account")), "balance": get_balance_on(args.get("party_account")),
"party_balance": get_balance_on(party=args.get("party"), party_type=args.get("party_type")), "party_balance": get_balance_on(party=args.get("party"), party_type=args.get("party_type")),
"exchange_rate": exchange_rate, "exchange_rate": exchange_rate,
@ -698,7 +705,7 @@ def get_payment_entry(ref_doc, args):
bank_row = je.append("accounts") bank_row = je.append("accounts")
#make it bank_details # Make it bank_details
bank_account = get_default_bank_cash_account(ref_doc.company, "Bank", account=args.get("bank_account")) bank_account = get_default_bank_cash_account(ref_doc.company, "Bank", account=args.get("bank_account"))
if bank_account: if bank_account:
bank_row.update(bank_account) bank_row.update(bank_account)
@ -717,7 +724,7 @@ def get_payment_entry(ref_doc, args):
else: else:
bank_row.set(args.get("amount_field_bank"), amount * exchange_rate) bank_row.set(args.get("amount_field_bank"), amount * exchange_rate)
# set multi currency check # Multi currency check again
if party_row.account_currency != ref_doc.company_currency \ if party_row.account_currency != ref_doc.company_currency \
or (bank_row.account_currency and bank_row.account_currency != ref_doc.company_currency): or (bank_row.account_currency and bank_row.account_currency != ref_doc.company_currency):
je.multi_currency = 1 je.multi_currency = 1
@ -727,6 +734,7 @@ def get_payment_entry(ref_doc, args):
return je if args.get("journal_entry") else je.as_dict() return je if args.get("journal_entry") else je.as_dict()
@frappe.whitelist() @frappe.whitelist()
def get_opening_accounts(company): def get_opening_accounts(company):
"""get all balance sheet accounts for opening entry""" """get all balance sheet accounts for opening entry"""
@ -749,6 +757,7 @@ def get_against_jv(doctype, txt, searchfield, start, page_len, filters):
and jv.docstatus = 1 and jv.`{0}` like %s order by jv.name desc limit %s, %s""".format(frappe.db.escape(searchfield)), and jv.docstatus = 1 and jv.`{0}` like %s order by jv.name desc limit %s, %s""".format(frappe.db.escape(searchfield)),
(filters.get("account"), cstr(filters.get("party")), "%{0}%".format(txt), start, page_len)) (filters.get("account"), cstr(filters.get("party")), "%{0}%".format(txt), start, page_len))
@frappe.whitelist() @frappe.whitelist()
def get_outstanding(args): def get_outstanding(args):
if not frappe.has_permission("Account"): if not frappe.has_permission("Account"):
@ -810,6 +819,7 @@ def get_party_account_and_balance(company, party_type, party):
"account_currency": frappe.db.get_value("Account", account, "account_currency") "account_currency": frappe.db.get_value("Account", account, "account_currency")
} }
@frappe.whitelist() @frappe.whitelist()
def get_account_balance_and_party_type(account, date, company, debit=None, credit=None, exchange_rate=None): def get_account_balance_and_party_type(account, date, company, debit=None, credit=None, exchange_rate=None):
"""Returns dict of account balance and party type to be set in Journal Entry on selection of account.""" """Returns dict of account balance and party type to be set in Journal Entry on selection of account."""
@ -847,7 +857,7 @@ def get_account_balance_and_party_type(account, date, company, debit=None, credi
return grid_values return grid_values
# Added posting_date as one of the parameters of get_exchange_rate
@frappe.whitelist() @frappe.whitelist()
def get_exchange_rate(posting_date, account=None, account_currency=None, company=None, def get_exchange_rate(posting_date, account=None, account_currency=None, company=None,
reference_type=None, reference_name=None, debit=None, credit=None, exchange_rate=None): reference_type=None, reference_name=None, debit=None, credit=None, exchange_rate=None):
@ -880,6 +890,7 @@ def get_exchange_rate(posting_date, account=None, account_currency=None, company
# don't return None or 0 as it is multipled with a value and that value could be lost # don't return None or 0 as it is multipled with a value and that value could be lost
return exchange_rate or 1 return exchange_rate or 1
@frappe.whitelist() @frappe.whitelist()
def get_average_exchange_rate(account): def get_average_exchange_rate(account):
exchange_rate = 0 exchange_rate = 0
@ -888,4 +899,4 @@ def get_average_exchange_rate(account):
bank_balance_in_company_currency = get_balance_on(account, in_account_currency=False) bank_balance_in_company_currency = get_balance_on(account, in_account_currency=False)
exchange_rate = bank_balance_in_company_currency / bank_balance_in_account_currency exchange_rate = bank_balance_in_company_currency / bank_balance_in_account_currency
return exchange_rate return exchange_rate

View File

@ -1,5 +1,6 @@
{ {
"allow_copy": 0, "allow_copy": 0,
"allow_guest_to_view": 0,
"allow_import": 0, "allow_import": 0,
"allow_rename": 0, "allow_rename": 0,
"autoname": "hash", "autoname": "hash",
@ -13,6 +14,7 @@
"engine": "InnoDB", "engine": "InnoDB",
"fields": [ "fields": [
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 1, "bold": 1,
"collapsible": 0, "collapsible": 0,
@ -46,6 +48,7 @@
"width": "250px" "width": "250px"
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -75,6 +78,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -106,6 +110,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -141,6 +146,7 @@
"width": "180px" "width": "180px"
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -168,6 +174,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -197,6 +204,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -226,6 +234,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -256,6 +265,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -287,6 +297,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -317,6 +328,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -345,6 +357,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -374,6 +387,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -402,6 +416,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 1, "bold": 1,
"collapsible": 0, "collapsible": 0,
@ -432,6 +447,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 1, "bold": 1,
"collapsible": 0, "collapsible": 0,
@ -464,6 +480,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -491,6 +508,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 1, "bold": 1,
"collapsible": 0, "collapsible": 0,
@ -521,6 +539,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 1, "bold": 1,
"collapsible": 0, "collapsible": 0,
@ -553,6 +572,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -581,6 +601,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -597,7 +618,7 @@
"label": "Reference Type", "label": "Reference Type",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
"options": "\nSales Invoice\nPurchase Invoice\nJournal Entry\nSales Order\nPurchase Order\nExpense Claim\nAsset\nEmployee Loan", "options": "\nSales Invoice\nPurchase Invoice\nJournal Entry\nSales Order\nPurchase Order\nExpense Claim\nAsset\nEmployee Loan\nPayroll Entry\nEmployee Advance",
"permlevel": 0, "permlevel": 0,
"precision": "", "precision": "",
"print_hide": 0, "print_hide": 0,
@ -611,6 +632,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -639,8 +661,9 @@
"search_index": 0, "search_index": 0,
"set_only_once": 0, "set_only_once": 0,
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -671,6 +694,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -698,6 +722,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -729,6 +754,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -759,17 +785,17 @@
"unique": 0 "unique": 0
} }
], ],
"has_web_view": 0,
"hide_heading": 0, "hide_heading": 0,
"hide_toolbar": 0, "hide_toolbar": 0,
"idx": 1, "idx": 1,
"image_view": 0, "image_view": 0,
"in_create": 0, "in_create": 0,
"in_dialog": 0,
"is_submittable": 0, "is_submittable": 0,
"issingle": 0, "issingle": 0,
"istable": 1, "istable": 1,
"max_attachments": 0, "max_attachments": 0,
"modified": "2017-03-02 05:02:10.102039", "modified": "2017-12-07 19:54:19.851534",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Journal Entry Account", "name": "Journal Entry Account",

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,165 @@
# -*- 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 _, scrub
from frappe.utils import flt, nowdate
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
# always mandatory fields for the invoices
if not row.temporary_opening_account:
row.temporary_opening_account = get_temporary_opening_account(self.company)
row.party_type = "Customer" if self.invoice_type == "Sales" else "Supplier"
if not row.item_name:
row.item_name = _("Opening Invoice Item")
if not row.posting_date:
row.posting_date = nowdate()
if not row.due_date:
row.due_date = nowdate()
for d in ("Party", "Outstanding Amount", "Temporary Opening Account"):
if not row.get(scrub(d)):
frappe.throw(mandatory_error_msg.format(
idx=row.idx,
field=_(d),
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) / flt(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,378 @@
{
"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": 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": "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": 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_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": 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": "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,
"default": "1",
"fieldname": "qty",
"fieldtype": "Data",
"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": "Quantity",
"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-12-19 05:07:01.549918",
"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

@ -252,22 +252,26 @@ frappe.ui.form.on('Payment Entry', {
date: frm.doc.posting_date date: frm.doc.posting_date
}, },
callback: function(r, rt) { callback: function(r, rt) {
console.log(r, rt);
if(r.message) { if(r.message) {
if(frm.doc.payment_type == "Receive") { frappe.run_serially([
frm.set_value("paid_from", r.message.party_account); () => {
frm.set_value("paid_from_account_currency", r.message.party_account_currency); if(frm.doc.payment_type == "Receive") {
frm.set_value("paid_from_account_balance", r.message.account_balance); frm.set_value("paid_from", r.message.party_account);
} else if (frm.doc.payment_type == "Pay"){ frm.set_value("paid_from_account_currency", r.message.party_account_currency);
frm.set_value("paid_to", r.message.party_account); frm.set_value("paid_from_account_balance", r.message.account_balance);
frm.set_value("paid_to_account_currency", r.message.party_account_currency); } else if (frm.doc.payment_type == "Pay"){
frm.set_value("paid_to_account_balance", r.message.account_balance); frm.set_value("paid_to", r.message.party_account);
} frm.set_value("paid_to_account_currency", r.message.party_account_currency);
frm.set_value("party_balance", r.message.party_balance); frm.set_value("paid_to_account_balance", r.message.account_balance);
frm.events.get_outstanding_documents(frm); }
frm.events.hide_unhide_fields(frm); },
frm.events.set_dynamic_labels(frm); () => frm.set_value("party_balance", r.message.party_balance),
frm.set_party_account_based_on_party = false; () => frm.set_value("party_name", r.message.party_name),
() => frm.events.get_outstanding_documents(frm),
() => frm.events.hide_unhide_fields(frm),
() => frm.events.set_dynamic_labels(frm),
() => { frm.set_party_account_based_on_party = false; }
]);
} }
} }
}); });
@ -405,11 +409,7 @@ frappe.ui.form.on('Payment Entry', {
} }
// Make read only if Accounts Settings doesn't allow stale rates // Make read only if Accounts Settings doesn't allow stale rates
frappe.model.get_value("Accounts Settings", null, "allow_stale", frm.set_df_property("source_exchange_rate", "read_only", erpnext.stale_rate_allowed() ? 0 : 1);
function(d){
frm.set_df_property("source_exchange_rate", "read_only", cint(d.allow_stale) ? 0 : 1);
}
);
}, },
target_exchange_rate: function(frm) { target_exchange_rate: function(frm) {
@ -430,11 +430,7 @@ frappe.ui.form.on('Payment Entry', {
frm.set_paid_amount_based_on_received_amount = false; frm.set_paid_amount_based_on_received_amount = false;
// Make read only if Accounts Settings doesn't allow stale rates // Make read only if Accounts Settings doesn't allow stale rates
frappe.model.get_value("Accounts Settings", null, "allow_stale", frm.set_df_property("target_exchange_rate", "read_only", erpnext.stale_rate_allowed() ? 0 : 1);
function(d){
frm.set_df_property("target_exchange_rate", "read_only", cint(d.allow_stale) ? 0 : 1);
}
);
}, },
paid_amount: function(frm) { paid_amount: function(frm) {
@ -517,7 +513,7 @@ frappe.ui.form.on('Payment Entry', {
c.outstanding_amount = d.outstanding_amount; c.outstanding_amount = d.outstanding_amount;
c.bill_no = d.bill_no; c.bill_no = d.bill_no;
if(!in_list(["Sales Order", "Purchase Order", "Expense Claim"], d.voucher_type)) { if(!in_list(["Sales Order", "Purchase Order", "Expense Claim", "Fees"], d.voucher_type)) {
if(flt(d.outstanding_amount) > 0) if(flt(d.outstanding_amount) > 0)
total_positive_outstanding += flt(d.outstanding_amount); total_positive_outstanding += flt(d.outstanding_amount);
else else
@ -532,7 +528,7 @@ frappe.ui.form.on('Payment Entry', {
} else { } else {
c.exchange_rate = 1; c.exchange_rate = 1;
} }
if (in_list(['Sales Invoice', 'Purchase Invoice', "Expense Claim"], d.reference_doctype)){ if (in_list(['Sales Invoice', 'Purchase Invoice', "Expense Claim", "Fees"], d.reference_doctype)){
c.due_date = d.due_date; c.due_date = d.due_date;
} }
}); });
@ -540,7 +536,8 @@ frappe.ui.form.on('Payment Entry', {
if( if(
(frm.doc.payment_type=="Receive" && frm.doc.party_type=="Customer") || (frm.doc.payment_type=="Receive" && frm.doc.party_type=="Customer") ||
(frm.doc.payment_type=="Pay" && frm.doc.party_type=="Supplier") || (frm.doc.payment_type=="Pay" && frm.doc.party_type=="Supplier") ||
(frm.doc.payment_type=="Pay" && frm.doc.party_type=="Employee") (frm.doc.payment_type=="Pay" && frm.doc.party_type=="Employee") ||
(frm.doc.payment_type=="Receive" && frm.doc.party_type=="Student")
) { ) {
if(total_positive_outstanding > total_negative_outstanding) if(total_positive_outstanding > total_negative_outstanding)
frm.set_value("paid_amount", frm.set_value("paid_amount",
@ -584,13 +581,16 @@ frappe.ui.form.on('Payment Entry', {
}) })
var allocated_negative_outstanding = 0; var allocated_negative_outstanding = 0;
if ((frm.doc.payment_type=="Receive" && frm.doc.party_type=="Customer") || if (
(frm.doc.payment_type=="Receive" && frm.doc.party_type=="Customer") ||
(frm.doc.payment_type=="Pay" && frm.doc.party_type=="Supplier") || (frm.doc.payment_type=="Pay" && frm.doc.party_type=="Supplier") ||
(frm.doc.payment_type=="Pay" && frm.doc.party_type=="Employee")) { (frm.doc.payment_type=="Pay" && frm.doc.party_type=="Employee") ||
if(total_positive_outstanding_including_order > paid_amount) { (frm.doc.payment_type=="Receive" && frm.doc.party_type=="Student")
var remaining_outstanding = total_positive_outstanding_including_order - paid_amount; ) {
allocated_negative_outstanding = total_negative_outstanding < remaining_outstanding ? if(total_positive_outstanding_including_order > paid_amount) {
total_negative_outstanding : remaining_outstanding; var remaining_outstanding = total_positive_outstanding_including_order - paid_amount;
allocated_negative_outstanding = total_negative_outstanding < remaining_outstanding ?
total_negative_outstanding : remaining_outstanding;
} }
var allocated_positive_outstanding = paid_amount + allocated_negative_outstanding; var allocated_positive_outstanding = paid_amount + allocated_negative_outstanding;
@ -656,12 +656,19 @@ frappe.ui.form.on('Payment Entry', {
set_difference_amount: function(frm) { set_difference_amount: function(frm) {
var unallocated_amount = 0; var unallocated_amount = 0;
var total_deductions = frappe.utils.sum($.map(frm.doc.deductions || [],
function(d) { return flt(d.amount) }));
if(frm.doc.party) { if(frm.doc.party) {
var party_amount = frm.doc.payment_type=="Receive" ? var party_amount = frm.doc.payment_type=="Receive" ?
frm.doc.paid_amount : frm.doc.received_amount; frm.doc.paid_amount : frm.doc.received_amount;
if(frm.doc.total_allocated_amount < party_amount) { if(frm.doc.total_allocated_amount < party_amount) {
unallocated_amount = party_amount - frm.doc.total_allocated_amount; if(frm.doc.payment_type == "Receive") {
unallocated_amount = party_amount - (frm.doc.total_allocated_amount - total_deductions);
} else {
unallocated_amount = party_amount - (frm.doc.total_allocated_amount + total_deductions);
}
} }
} }
frm.set_value("unallocated_amount", unallocated_amount); frm.set_value("unallocated_amount", unallocated_amount);
@ -680,9 +687,6 @@ frappe.ui.form.on('Payment Entry', {
difference_amount = flt(frm.doc.base_paid_amount) - flt(frm.doc.base_received_amount); difference_amount = flt(frm.doc.base_paid_amount) - flt(frm.doc.base_received_amount);
} }
var total_deductions = frappe.utils.sum($.map(frm.doc.deductions || [],
function(d) { return flt(d.amount) }));
frm.set_value("difference_amount", difference_amount - total_deductions); frm.set_value("difference_amount", difference_amount - total_deductions);
frm.events.hide_unhide_fields(frm); frm.events.hide_unhide_fields(frm);

View File

@ -147,7 +147,7 @@
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_global_search": 0, "in_global_search": 0,
"in_list_view": 0, "in_list_view": 1,
"in_standard_filter": 0, "in_standard_filter": 0,
"label": "Posting Date", "label": "Posting Date",
"length": 0, "length": 0,
@ -1791,7 +1791,7 @@
"issingle": 0, "issingle": 0,
"istable": 0, "istable": 0,
"max_attachments": 0, "max_attachments": 0,
"modified": "2017-08-31 11:20:37.578469", "modified": "2018-01-11 14:43:03.336327",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Payment Entry", "name": "Payment Entry",

View File

@ -3,19 +3,21 @@
# For license information, please see license.txt # For license information, please see license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe, json import frappe, erpnext, json
from frappe import _, scrub, ValidationError from frappe import _, scrub, ValidationError
from frappe.utils import flt, comma_or, nowdate from frappe.utils import flt, comma_or, nowdate
from erpnext.accounts.utils import get_outstanding_invoices, get_account_currency, get_balance_on from erpnext.accounts.utils import get_outstanding_invoices, get_account_currency, get_balance_on
from erpnext.accounts.party import get_party_account from erpnext.accounts.party import get_party_account
from erpnext.accounts.doctype.journal_entry.journal_entry \ from erpnext.accounts.doctype.journal_entry.journal_entry import get_default_bank_cash_account
import get_average_exchange_rate, get_default_bank_cash_account
from erpnext.setup.utils import get_exchange_rate from erpnext.setup.utils import get_exchange_rate
from erpnext.accounts.general_ledger import make_gl_entries from erpnext.accounts.general_ledger import make_gl_entries
from erpnext.hr.doctype.expense_claim.expense_claim import update_reimbursed_amount from erpnext.hr.doctype.expense_claim.expense_claim import update_reimbursed_amount
from erpnext.controllers.accounts_controller import AccountsController from erpnext.controllers.accounts_controller import AccountsController
class InvalidPaymentEntry(ValidationError): pass
class InvalidPaymentEntry(ValidationError):
pass
class PaymentEntry(AccountsController): class PaymentEntry(AccountsController):
def setup_party_account_field(self): def setup_party_account_field(self):
@ -70,17 +72,16 @@ class PaymentEntry(AccountsController):
reference_names = [] reference_names = []
for d in self.get("references"): for d in self.get("references"):
if (d.reference_doctype, d.reference_name) in reference_names: if (d.reference_doctype, d.reference_name) in reference_names:
frappe.throw(_("Row #{0}: Duplicate entry in References {1} {2}").format(d.idx, d.reference_doctype, d.reference_name)) frappe.throw(_("Row #{0}: Duplicate entry in References {1} {2}")
.format(d.idx, d.reference_doctype, d.reference_name))
reference_names.append((d.reference_doctype, d.reference_name)) reference_names.append((d.reference_doctype, d.reference_name))
def validate_allocated_amount(self): def validate_allocated_amount(self):
for d in self.get("references"): for d in self.get("references"):
if (flt(d.allocated_amount))> 0: if (flt(d.allocated_amount))> 0:
if flt(d.allocated_amount) > flt(d.outstanding_amount): if flt(d.allocated_amount) > flt(d.outstanding_amount):
frappe.throw(_("Row #{0}: Allocated Amount cannot be greater than outstanding amount.").format(d.idx)) frappe.throw(_("Row #{0}: Allocated Amount cannot be greater than outstanding amount.").format(d.idx))
def delink_advance_entry_references(self): def delink_advance_entry_references(self):
for reference in self.references: for reference in self.references:
if reference.reference_doctype in ("Sales Invoice", "Purchase Invoice"): if reference.reference_doctype in ("Sales Invoice", "Purchase Invoice"):
@ -128,7 +129,6 @@ class PaymentEntry(AccountsController):
self.set_missing_ref_details() self.set_missing_ref_details()
def set_missing_ref_details(self): def set_missing_ref_details(self):
for d in self.get("references"): for d in self.get("references"):
if d.allocated_amount: if d.allocated_amount:
@ -148,7 +148,7 @@ class PaymentEntry(AccountsController):
if not frappe.db.exists(self.party_type, self.party): if not frappe.db.exists(self.party_type, self.party):
frappe.throw(_("Invalid {0}: {1}").format(self.party_type, self.party)) frappe.throw(_("Invalid {0}: {1}").format(self.party_type, self.party))
if self.party_account: if self.party_account and self.party_type != "Employee":
party_account_type = "Receivable" if self.party_type in ("Customer", "Student") else "Payable" party_account_type = "Receivable" if self.party_type in ("Customer", "Student") else "Payable"
self.validate_account_type(self.party_account, [party_account_type]) self.validate_account_type(self.party_account, [party_account_type])
@ -189,7 +189,7 @@ class PaymentEntry(AccountsController):
elif self.party_type == "Supplier": elif self.party_type == "Supplier":
valid_reference_doctypes = ("Purchase Order", "Purchase Invoice", "Journal Entry") valid_reference_doctypes = ("Purchase Order", "Purchase Invoice", "Journal Entry")
elif self.party_type == "Employee": elif self.party_type == "Employee":
valid_reference_doctypes = ("Expense Claim", "Journal Entry") valid_reference_doctypes = ("Expense Claim", "Journal Entry", "Employee Advance")
for d in self.get("references"): for d in self.get("references"):
if not d.allocated_amount: if not d.allocated_amount:
@ -206,7 +206,7 @@ class PaymentEntry(AccountsController):
if d.reference_doctype != "Journal Entry": if d.reference_doctype != "Journal Entry":
if self.party != ref_doc.get(scrub(self.party_type)): if self.party != ref_doc.get(scrub(self.party_type)):
frappe.throw(_("{0} {1} does not associated with {2} {3}") frappe.throw(_("{0} {1} is not associated with {2} {3}")
.format(d.reference_doctype, d.reference_name, self.party_type, self.party)) .format(d.reference_doctype, d.reference_name, self.party_type, self.party))
else: else:
self.validate_journal_entry() self.validate_journal_entry()
@ -285,12 +285,17 @@ class PaymentEntry(AccountsController):
if self.party: if self.party:
party_amount = self.paid_amount if self.payment_type=="Receive" else self.received_amount party_amount = self.paid_amount if self.payment_type=="Receive" else self.received_amount
total_deductions = sum([flt(d.amount) for d in self.get("deductions")])
if self.total_allocated_amount < party_amount: if self.total_allocated_amount < party_amount:
self.unallocated_amount = party_amount - self.total_allocated_amount if self.payment_type == "Receive":
self.unallocated_amount = party_amount - (self.total_allocated_amount - total_deductions)
else:
self.unallocated_amount = party_amount - (self.total_allocated_amount + total_deductions)
def set_difference_amount(self): def set_difference_amount(self):
base_unallocated_amount = flt(self.unallocated_amount) * (flt(self.source_exchange_rate) base_unallocated_amount = flt(self.unallocated_amount) * (flt(self.source_exchange_rate)
if self.payment_type=="Receive" else flt(self.target_exchange_rate)) if self.payment_type == "Receive" else flt(self.target_exchange_rate))
base_party_amount = flt(self.base_total_allocated_amount) + flt(base_unallocated_amount) base_party_amount = flt(self.base_total_allocated_amount) + flt(base_unallocated_amount)
@ -306,9 +311,10 @@ class PaymentEntry(AccountsController):
self.difference_amount = flt(self.difference_amount - total_deductions, self.difference_amount = flt(self.difference_amount - total_deductions,
self.precision("difference_amount")) self.precision("difference_amount"))
# Paid amount is auto allocated in the reference document by default.
# Clear the reference document which doesn't have allocated amount on validate so that form can be loaded fast
def clear_unallocated_reference_document_rows(self): def clear_unallocated_reference_document_rows(self):
self.set("references", self.get("references", {"allocated_amount": ["not in", [0, None, ""]]})) self.set("references", self.get("references", {"allocated_amount": ["not in", [0, None, ""]]}))
frappe.db.sql("""delete from `tabPayment Entry Reference` frappe.db.sql("""delete from `tabPayment Entry Reference`
where parent = %s and allocated_amount = 0""", self.name) where parent = %s and allocated_amount = 0""", self.name)
@ -477,8 +483,9 @@ class PaymentEntry(AccountsController):
def update_advance_paid(self): def update_advance_paid(self):
if self.payment_type in ("Receive", "Pay") and self.party: if self.payment_type in ("Receive", "Pay") and self.party:
for d in self.get("references"): for d in self.get("references"):
if d.allocated_amount and d.reference_doctype in ("Sales Order", "Purchase Order"): if d.allocated_amount \
frappe.get_doc(d.reference_doctype, d.reference_name).set_total_advance_paid() and d.reference_doctype in ("Sales Order", "Purchase Order", "Employee Advance"):
frappe.get_doc(d.reference_doctype, d.reference_name).set_total_advance_paid()
def update_expense_claim(self): def update_expense_claim(self):
if self.payment_type in ("Pay") and self.party: if self.payment_type in ("Pay") and self.party:
@ -500,16 +507,19 @@ def get_outstanding_reference_documents(args):
company_currency = frappe.db.get_value("Company", args.get("company"), "default_currency") company_currency = frappe.db.get_value("Company", args.get("company"), "default_currency")
# Get negative outstanding sales /purchase invoices # Get negative outstanding sales /purchase invoices
total_field = "base_grand_total" if party_account_currency == company_currency else "grand_total"
negative_outstanding_invoices = [] negative_outstanding_invoices = []
if (args.get("party_type") != "Student"): if args.get("party_type") not in ["Student", "Employee"] and not args.get("voucher_no"):
negative_outstanding_invoices = get_negative_outstanding_invoices(args.get("party_type"), negative_outstanding_invoices = get_negative_outstanding_invoices(args.get("party_type"),
args.get("party"), args.get("party_account"), total_field) args.get("party"), args.get("party_account"), party_account_currency, company_currency)
# Get positive outstanding sales /purchase invoices/ Fees # Get positive outstanding sales /purchase invoices/ Fees
condition = ""
if args.get("voucher_type") and args.get("voucher_no"):
condition = " and voucher_type='{0}' and voucher_no='{1}'"\
.format(frappe.db.escape(args["voucher_type"]), frappe.db.escape(args["voucher_no"]))
outstanding_invoices = get_outstanding_invoices(args.get("party_type"), args.get("party"), outstanding_invoices = get_outstanding_invoices(args.get("party_type"), args.get("party"),
args.get("party_account")) args.get("party_account"), condition=condition)
for d in outstanding_invoices: for d in outstanding_invoices:
d["exchange_rate"] = 1 d["exchange_rate"] = 1
@ -531,6 +541,7 @@ def get_outstanding_reference_documents(args):
return negative_outstanding_invoices + outstanding_invoices + orders_to_be_billed return negative_outstanding_invoices + outstanding_invoices + orders_to_be_billed
def get_orders_to_be_billed(posting_date, party_type, party, party_account_currency, company_currency): def get_orders_to_be_billed(posting_date, party_type, party, party_account_currency, company_currency):
if party_type == "Customer": if party_type == "Customer":
voucher_type = 'Sales Order' voucher_type = 'Sales Order'
@ -559,44 +570,50 @@ def get_orders_to_be_billed(posting_date, party_type, party, party_account_curre
and abs(100 - per_billed) > 0.01 and abs(100 - per_billed) > 0.01
order by order by
transaction_date, name transaction_date, name
""".format(**{ """.format(**{
"ref_field": ref_field, "ref_field": ref_field,
"voucher_type": voucher_type, "voucher_type": voucher_type,
"party_type": scrub(party_type) "party_type": scrub(party_type)
}), party, as_dict = True) }), party, as_dict=True)
order_list = [] order_list = []
for d in orders: for d in orders:
d["voucher_type"] = voucher_type d["voucher_type"] = voucher_type
# This assumes that the exchange rate required is the one in the SO # This assumes that the exchange rate required is the one in the SO
d["exchange_rate"] = get_exchange_rate(party_account_currency, d["exchange_rate"] = get_exchange_rate(party_account_currency, company_currency, posting_date)
company_currency, posting_date)
order_list.append(d) order_list.append(d)
return order_list return order_list
def get_negative_outstanding_invoices(party_type, party, party_account, total_field): def get_negative_outstanding_invoices(party_type, party, party_account, party_account_currency, company_currency):
if party_type != "Employee": voucher_type = "Sales Invoice" if party_type == "Customer" else "Purchase Invoice"
voucher_type = "Sales Invoice" if party_type == "Customer" else "Purchase Invoice" if party_account_currency == company_currency:
return frappe.db.sql(""" grand_total_field = "base_grand_total"
select rounded_total_field = "base_rounded_total"
"{voucher_type}" as voucher_type, name as voucher_no,
{total_field} as invoice_amount, outstanding_amount, posting_date,
due_date, conversion_rate as exchange_rate
from
`tab{voucher_type}`
where
{party_type} = %s and {party_account} = %s and docstatus = 1 and outstanding_amount < 0
order by
posting_date, name
""".format(**{
"total_field": total_field,
"voucher_type": voucher_type,
"party_type": scrub(party_type),
"party_account": "debit_to" if party_type=="Customer" else "credit_to"
}), (party, party_account), as_dict = True)
else: else:
return [] grand_total_field = "grand_total"
rounded_total_field = "rounded_total"
return frappe.db.sql("""
select
"{voucher_type}" as voucher_type, name as voucher_no,
if({rounded_total_field}, {rounded_total_field}, {grand_total_field}) as invoice_amount,
outstanding_amount, posting_date,
due_date, conversion_rate as exchange_rate
from
`tab{voucher_type}`
where
{party_type} = %s and {party_account} = %s and docstatus = 1 and outstanding_amount < 0
order by
posting_date, name
""".format(**{
"rounded_total_field": rounded_total_field,
"grand_total_field": grand_total_field,
"voucher_type": voucher_type,
"party_type": scrub(party_type),
"party_account": "debit_to" if party_type == "Customer" else "credit_to"
}), (party, party_account), as_dict=True)
@frappe.whitelist() @frappe.whitelist()
def get_party_details(company, party_type, party, date): def get_party_details(company, party_type, party, date):
@ -607,15 +624,19 @@ def get_party_details(company, party_type, party, date):
account_currency = get_account_currency(party_account) account_currency = get_account_currency(party_account)
account_balance = get_balance_on(party_account, date) account_balance = get_balance_on(party_account, date)
_party_name = "title" if party_type == "Student" else party_type.lower() + "_name"
party_name = frappe.db.get_value(party_type, party, _party_name)
party_balance = get_balance_on(party_type=party_type, party=party) party_balance = get_balance_on(party_type=party_type, party=party)
return { return {
"party_account": party_account, "party_account": party_account,
"party_name": party_name,
"party_account_currency": account_currency, "party_account_currency": account_currency,
"party_balance": party_balance, "party_balance": party_balance,
"account_balance": account_balance "account_balance": account_balance
} }
@frappe.whitelist() @frappe.whitelist()
def get_account_details(account, date): def get_account_details(account, date):
frappe.has_permission('Payment Entry', throw=True) frappe.has_permission('Payment Entry', throw=True)
@ -625,6 +646,7 @@ def get_account_details(account, date):
"account_type": frappe.db.get_value("Account", account, "account_type") "account_type": frappe.db.get_value("Account", account, "account_type")
}) })
@frappe.whitelist() @frappe.whitelist()
def get_company_defaults(company): def get_company_defaults(company):
fields = ["write_off_account", "exchange_gain_loss_account", "cost_center"] fields = ["write_off_account", "exchange_gain_loss_account", "cost_center"]
@ -637,19 +659,23 @@ def get_company_defaults(company):
return ret return ret
@frappe.whitelist() @frappe.whitelist()
def get_reference_details(reference_doctype, reference_name, party_account_currency): def get_reference_details(reference_doctype, reference_name, party_account_currency):
total_amount = outstanding_amount = exchange_rate = None total_amount = outstanding_amount = exchange_rate = None
ref_doc = frappe.get_doc(reference_doctype, reference_name) ref_doc = frappe.get_doc(reference_doctype, reference_name)
company_currency = ref_doc.get("company_currency") or erpnext.get_company_currency(ref_doc.company)
if reference_doctype == "Fees": if reference_doctype == "Fees":
total_amount = ref_doc.get("grand_total") total_amount = ref_doc.get("grand_total")
exchange_rate = 1 exchange_rate = 1
outstanding_amount = ref_doc.get("outstanding_amount") outstanding_amount = ref_doc.get("outstanding_amount")
elif reference_doctype != "Journal Entry": elif reference_doctype != "Journal Entry":
if party_account_currency == ref_doc.company_currency: if party_account_currency == company_currency:
if ref_doc.doctype == "Expense Claim": if ref_doc.doctype == "Expense Claim":
total_amount = ref_doc.total_sanctioned_amount total_amount = ref_doc.total_sanctioned_amount
elif ref_doc.doctype == "Employee Advance":
total_amount = ref_doc.advance_amount
else: else:
total_amount = ref_doc.base_grand_total total_amount = ref_doc.base_grand_total
exchange_rate = 1 exchange_rate = 1
@ -659,15 +685,18 @@ def get_reference_details(reference_doctype, reference_name, party_account_curre
# Get the exchange rate from the original ref doc # Get the exchange rate from the original ref doc
# or get it based on the posting date of the ref doc # or get it based on the posting date of the ref doc
exchange_rate = ref_doc.get("conversion_rate") or \ exchange_rate = ref_doc.get("conversion_rate") or \
get_exchange_rate(party_account_currency, ref_doc.company_currency, ref_doc.posting_date) get_exchange_rate(party_account_currency, company_currency, ref_doc.posting_date)
outstanding_amount = ref_doc.get("outstanding_amount") \ if reference_doctype in ("Sales Invoice", "Purchase Invoice", "Expense Claim"):
if reference_doctype in ("Sales Invoice", "Purchase Invoice", "Expense Claim") \ outstanding_amount = ref_doc.get("outstanding_amount")
else flt(total_amount) - flt(ref_doc.advance_paid) elif reference_doctype == "Employee Advance":
outstanding_amount = ref_doc.advance_amount - flt(ref_doc.paid_amount)
else:
outstanding_amount = flt(total_amount) - flt(ref_doc.advance_paid)
else: else:
# Get the exchange rate based on the posting date of the ref doc # Get the exchange rate based on the posting date of the ref doc
exchange_rate = get_exchange_rate(party_account_currency, exchange_rate = get_exchange_rate(party_account_currency,
ref_doc.company_currency, ref_doc.posting_date) company_currency, ref_doc.posting_date)
return frappe._dict({ return frappe._dict({
"due_date": ref_doc.get("due_date"), "due_date": ref_doc.get("due_date"),
@ -676,6 +705,7 @@ def get_reference_details(reference_doctype, reference_name, party_account_curre
"exchange_rate": exchange_rate "exchange_rate": exchange_rate
}) })
@frappe.whitelist() @frappe.whitelist()
def get_payment_entry(dt, dn, party_amount=None, bank_account=None, bank_amount=None): def get_payment_entry(dt, dn, party_amount=None, bank_account=None, bank_amount=None):
doc = frappe.get_doc(dt, dn) doc = frappe.get_doc(dt, dn)
@ -687,7 +717,7 @@ def get_payment_entry(dt, dn, party_amount=None, bank_account=None, bank_amount=
party_type = "Customer" party_type = "Customer"
elif dt in ("Purchase Invoice", "Purchase Order"): elif dt in ("Purchase Invoice", "Purchase Order"):
party_type = "Supplier" party_type = "Supplier"
elif dt in ("Expense Claim"): elif dt in ("Expense Claim", "Employee Advance"):
party_type = "Employee" party_type = "Employee"
elif dt in ("Fees"): elif dt in ("Fees"):
party_type = "Student" party_type = "Student"
@ -699,6 +729,8 @@ def get_payment_entry(dt, dn, party_amount=None, bank_account=None, bank_amount=
party_account = doc.credit_to party_account = doc.credit_to
elif dt == "Fees": elif dt == "Fees":
party_account = doc.receivable_account party_account = doc.receivable_account
elif dt == "Employee Advance":
party_account = doc.advance_account
else: else:
party_account = get_party_account(party_type, doc.get(party_type.lower()), doc.company) party_account = get_party_account(party_type, doc.get(party_type.lower()), doc.company)
@ -716,17 +748,26 @@ def get_payment_entry(dt, dn, party_amount=None, bank_account=None, bank_amount=
if party_amount: if party_amount:
grand_total = outstanding_amount = party_amount grand_total = outstanding_amount = party_amount
elif dt in ("Sales Invoice", "Purchase Invoice"): elif dt in ("Sales Invoice", "Purchase Invoice"):
grand_total = doc.base_grand_total if party_account_currency == doc.company_currency else doc.grand_total if party_account_currency == doc.company_currency:
grand_total = doc.base_rounded_total or doc.base_grand_total
else:
grand_total = doc.rounded_total or doc.grand_total
outstanding_amount = doc.outstanding_amount outstanding_amount = doc.outstanding_amount
elif dt in ("Expense Claim"): elif dt in ("Expense Claim"):
grand_total = doc.total_sanctioned_amount grand_total = doc.total_sanctioned_amount
outstanding_amount = doc.total_sanctioned_amount - doc.total_amount_reimbursed outstanding_amount = doc.total_sanctioned_amount \
- doc.total_amount_reimbursed - flt(doc.total_advance_amount)
elif dt == "Employee Advance":
grand_total = doc.advance_amount
outstanding_amount = flt(doc.advance_amount) - flt(doc.paid_amount)
elif dt == "Fees": elif dt == "Fees":
grand_total = doc.grand_total grand_total = doc.grand_total
outstanding_amount = doc.outstanding_amount outstanding_amount = doc.outstanding_amount
else: else:
total_field = "base_grand_total" if party_account_currency == doc.company_currency else "grand_total" if party_account_currency == doc.company_currency:
grand_total = flt(doc.get(total_field)) grand_total = flt(doc.get("base_rounded_total") or doc.base_grand_total)
else:
grand_total = flt(doc.get("rounded_total") or doc.grand_total)
outstanding_amount = grand_total - flt(doc.advance_paid) outstanding_amount = grand_total - flt(doc.advance_paid)
# bank or cash # bank or cash
@ -763,13 +804,13 @@ def get_payment_entry(dt, dn, party_amount=None, bank_account=None, bank_amount=
pe.letter_head = doc.get("letter_head") pe.letter_head = doc.get("letter_head")
pe.append("references", { pe.append("references", {
"reference_doctype": dt, 'reference_doctype': dt,
"reference_name": dn, 'reference_name': dn,
"bill_no": doc.get("bill_no"), "bill_no": doc.get("bill_no"),
"due_date": doc.get("due_date"), "due_date": doc.get("due_date"),
"total_amount": grand_total, 'total_amount': grand_total,
"outstanding_amount": outstanding_amount, 'outstanding_amount': outstanding_amount,
"allocated_amount": outstanding_amount 'allocated_amount': outstanding_amount
}) })
pe.setup_party_account_field() pe.setup_party_account_field()
@ -777,4 +818,25 @@ def get_payment_entry(dt, dn, party_amount=None, bank_account=None, bank_amount=
if party_account and bank: if party_account and bank:
pe.set_exchange_rate() pe.set_exchange_rate()
pe.set_amounts() pe.set_amounts()
return pe return pe
def get_paid_amount(dt, dn, party_type, party, account, due_date):
if party_type=="Customer":
dr_or_cr = "credit_in_account_currency - debit_in_account_currency"
else:
dr_or_cr = "debit_in_account_currency - credit_in_account_currency"
paid_amount = frappe.db.sql("""
select ifnull(sum({dr_or_cr}), 0) as paid_amount
from `tabGL Entry`
where against_voucher_type = %s
and against_voucher = %s
and party_type = %s
and party = %s
and account = %s
and due_date = %s
and {dr_or_cr} > 0
""".format(dr_or_cr=dr_or_cr), (dt, dn, party_type, party, account, due_date))
return paid_amount[0][0] if paid_amount else 0

View File

@ -14,6 +14,7 @@ from erpnext.hr.doctype.expense_claim.test_expense_claim import make_expense_cla
test_dependencies = ["Item"] test_dependencies = ["Item"]
class TestPaymentEntry(unittest.TestCase): class TestPaymentEntry(unittest.TestCase):
def test_payment_entry_against_order(self): def test_payment_entry_against_order(self):
so = make_sales_order() so = make_sales_order()
@ -40,7 +41,7 @@ class TestPaymentEntry(unittest.TestCase):
self.assertEqual(so_advance_paid, 0) self.assertEqual(so_advance_paid, 0)
def test_payment_entry_against_si_usd_to_usd(self): def test_payment_entry_against_si_usd_to_usd(self):
si = create_sales_invoice(customer="_Test Customer USD", debit_to="_Test Receivable USD - _TC", si = create_sales_invoice(customer="_Test Customer USD", debit_to="_Test Receivable USD - _TC",
currency="USD", conversion_rate=50) currency="USD", conversion_rate=50)
pe = get_payment_entry("Sales Invoice", si.name, bank_account="_Test Bank USD - _TC") pe = get_payment_entry("Sales Invoice", si.name, bank_account="_Test Bank USD - _TC")
pe.reference_no = "1" pe.reference_no = "1"
@ -66,7 +67,7 @@ class TestPaymentEntry(unittest.TestCase):
self.assertEqual(outstanding_amount, 100) self.assertEqual(outstanding_amount, 100)
def test_payment_entry_against_pi(self): def test_payment_entry_against_pi(self):
pi = make_purchase_invoice(supplier="_Test Supplier USD", debit_to="_Test Payable USD - _TC", pi = make_purchase_invoice(supplier="_Test Supplier USD", debit_to="_Test Payable USD - _TC",
currency="USD", conversion_rate=50) currency="USD", conversion_rate=50)
pe = get_payment_entry("Purchase Invoice", pi.name, bank_account="_Test Bank USD - _TC") pe = get_payment_entry("Purchase Invoice", pi.name, bank_account="_Test Bank USD - _TC")
pe.reference_no = "1" pe.reference_no = "1"
@ -88,11 +89,12 @@ class TestPaymentEntry(unittest.TestCase):
def test_payment_entry_against_ec(self): def test_payment_entry_against_ec(self):
payable = frappe.db.get_value('Company', "_Test Company", 'default_payable_account') payable = frappe.db.get_value('Company', "_Test Company", 'default_payable_account')
ec = make_expense_claim(payable, 300, 300, "_Test Company","Travel Expenses - _TC") ec = make_expense_claim(payable, 300, 300, "_Test Company", "Travel Expenses - _TC")
pe = get_payment_entry("Expense Claim", ec.name, bank_account="_Test Bank USD - _TC", bank_amount=300) pe = get_payment_entry("Expense Claim", ec.name, bank_account="_Test Bank USD - _TC", bank_amount=300)
pe.reference_no = "1" pe.reference_no = "1"
pe.reference_date = "2016-01-01" pe.reference_date = "2016-01-01"
pe.source_exchange_rate = 1 pe.source_exchange_rate = 1
pe.paid_to = payable
pe.insert() pe.insert()
pe.submit() pe.submit()
@ -108,7 +110,7 @@ class TestPaymentEntry(unittest.TestCase):
self.assertEqual(outstanding_amount, 0) self.assertEqual(outstanding_amount, 0)
def test_payment_entry_against_si_usd_to_inr(self): def test_payment_entry_against_si_usd_to_inr(self):
si = create_sales_invoice(customer="_Test Customer USD", debit_to="_Test Receivable USD - _TC", si = create_sales_invoice(customer="_Test Customer USD", debit_to="_Test Receivable USD - _TC",
currency="USD", conversion_rate=50) currency="USD", conversion_rate=50)
pe = get_payment_entry("Sales Invoice", si.name, party_amount=20, pe = get_payment_entry("Sales Invoice", si.name, party_amount=20,
bank_account="_Test Bank - _TC", bank_amount=900) bank_account="_Test Bank - _TC", bank_amount=900)
@ -212,7 +214,7 @@ class TestPaymentEntry(unittest.TestCase):
self.assertRaises(InvalidPaymentEntry, pe1.validate) self.assertRaises(InvalidPaymentEntry, pe1.validate)
si1 = create_sales_invoice() si1 = create_sales_invoice()
# create full payment entry against si1 # create full payment entry against si1
pe2 = get_payment_entry("Sales Invoice", si1.name, bank_account="_Test Cash - _TC") pe2 = get_payment_entry("Sales Invoice", si1.name, bank_account="_Test Cash - _TC")

View File

@ -26,7 +26,7 @@
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_global_search": 0, "in_global_search": 0,
"in_list_view": 0, "in_list_view": 1,
"in_standard_filter": 0, "in_standard_filter": 0,
"label": "Series", "label": "Series",
"length": 0, "length": 0,
@ -432,7 +432,7 @@
"options": "<pre><h5>Message Example</h5>\n\n&lt;p&gt;Dear {{ doc.contact_person }},&lt;/p&gt;\n\n&lt;p&gt;Requesting payment for {{ doc.doctype }}, {{ doc.name }} for {{ doc.grand_total }}.&lt;/p&gt;\n\n&lt;a href=\"{{ payment_url }}\"&gt; click here to pay &lt;/a&gt;\n\n</pre>\n", "options": "<pre><h5>Message Example</h5>\n\n&lt;p&gt;Dear {{ doc.contact_person }},&lt;/p&gt;\n\n&lt;p&gt;Requesting payment for {{ doc.doctype }}, {{ doc.name }} for {{ doc.grand_total }}.&lt;/p&gt;\n\n&lt;a href=\"{{ payment_url }}\"&gt; click here to pay &lt;/a&gt;\n\n</pre>\n",
"permlevel": 0, "permlevel": 0,
"precision": "", "precision": "",
"print_hide": 0, "print_hide": 1,
"print_hide_if_no_value": 0, "print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"remember_last_selected_value": 0, "remember_last_selected_value": 0,
@ -728,7 +728,7 @@
"issingle": 0, "issingle": 0,
"istable": 0, "istable": 0,
"max_attachments": 0, "max_attachments": 0,
"modified": "2017-06-13 14:29:20.388372", "modified": "2017-12-02 15:50:41.775006",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Payment Request", "name": "Payment Request",

View File

@ -246,7 +246,7 @@ def make_payment_request(**args):
"currency": ref_doc.currency, "currency": ref_doc.currency,
"grand_total": grand_total, "grand_total": grand_total,
"email_to": args.recipient_id or "", "email_to": args.recipient_id or "",
"subject": "Payment Request for %s"%args.dn, "subject": _("Payment Request for {0}").format(args.dn),
"message": gateway_account.get("message") or get_dummy_message(ref_doc), "message": gateway_account.get("message") or get_dummy_message(ref_doc),
"reference_doctype": args.dt, "reference_doctype": args.dt,
"reference_name": args.dn "reference_name": args.dn
@ -294,7 +294,7 @@ def get_gateway_details(args):
if args.get("payment_gateway"): if args.get("payment_gateway"):
return get_payment_gateway_account(args.get("payment_gateway")) return get_payment_gateway_account(args.get("payment_gateway"))
if args.cart: if args.order_type == "Shopping Cart":
payment_gateway_account = frappe.get_doc("Shopping Cart Settings").payment_gateway_account payment_gateway_account = frappe.get_doc("Shopping Cart Settings").payment_gateway_account
return get_payment_gateway_account(payment_gateway_account) return get_payment_gateway_account(payment_gateway_account)

View File

@ -0,0 +1,197 @@
{
"allow_copy": 0,
"allow_guest_to_view": 0,
"allow_import": 0,
"allow_rename": 0,
"autoname": "",
"beta": 0,
"creation": "2017-08-10 15:38:00.080575",
"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": 2,
"fieldname": "payment_term",
"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": "Payment Term",
"length": 0,
"no_copy": 0,
"options": "Payment Term",
"permlevel": 0,
"precision": "",
"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,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 2,
"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,
"options": "payment_term.description",
"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": 2,
"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,
"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": 2,
"fieldname": "invoice_portion",
"fieldtype": "Percent",
"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 Portion",
"length": 0,
"no_copy": 0,
"options": "payment_term.invoice_portion",
"permlevel": 0,
"precision": "",
"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,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 2,
"fieldname": "payment_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": "Payment Amount",
"length": 0,
"no_copy": 0,
"options": "currency",
"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": 0,
"idx": 0,
"image_view": 0,
"in_create": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 1,
"max_attachments": 0,
"modified": "2017-12-19 16:20:33.546984",
"modified_by": "nabinhait@gmail.com",
"module": "Accounts",
"name": "Payment Schedule",
"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
from frappe.model.document import Document
class PaymentSchedule(Document):
pass

View File

@ -0,0 +1,2 @@
// Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt

View File

@ -0,0 +1,344 @@
{
"allow_copy": 0,
"allow_guest_to_view": 0,
"allow_import": 1,
"allow_rename": 1,
"autoname": "field:payment_term_name",
"beta": 0,
"creation": "2017-08-10 15:24:54.876365",
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"document_type": "",
"editable_grid": 1,
"engine": "InnoDB",
"fields": [
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 1,
"collapsible": 0,
"columns": 0,
"fieldname": "payment_term_name",
"fieldtype": "Data",
"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": "Payment Term Name",
"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": 1,
"collapsible": 0,
"columns": 0,
"fieldname": "invoice_portion",
"fieldtype": "Float",
"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": "Invoice Portion",
"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": "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": 1,
"collapsible": 0,
"columns": 0,
"fieldname": "due_date_based_on",
"fieldtype": "Select",
"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": "Due Date Based On",
"length": 0,
"no_copy": 0,
"options": "Day(s) after invoice date\nDay(s) after the end of the invoice month\nMonth(s) after the end of the invoice month",
"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": 1,
"collapsible": 0,
"columns": 0,
"depends_on": "eval:in_list(['Day(s) after invoice date', 'Day(s) after the end of the invoice month'], doc.due_date_based_on)",
"fieldname": "credit_days",
"fieldtype": "Int",
"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": "Credit Days",
"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,
"depends_on": "eval:doc.due_date_based_on=='Month(s) after the end of the invoice month'",
"fieldname": "credit_months",
"fieldtype": "Int",
"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": "Credit Months",
"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": "section_break_6",
"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": 1,
"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": 0,
"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": "2018-01-24 11:13:42.800048",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Payment Term",
"name_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": "Accounts 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": "Accounts User",
"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,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
from frappe.model.document import Document
class PaymentTerm(Document):
pass

View File

@ -2,15 +2,15 @@
// rename this file from _test_[name] to test_[name] to activate // rename this file from _test_[name] to test_[name] to activate
// and remove above this line // and remove above this line
QUnit.test("test: Supplier Quotation", function (assert) { QUnit.test("test: Payment Term", function (assert) {
let done = assert.async(); let done = assert.async();
// number of asserts // number of asserts
assert.expect(1); assert.expect(1);
frappe.run_serially('Supplier Quotation', [ frappe.run_serially([
// insert a new Supplier Quotation // insert a new Payment Term
() => frappe.tests.make([ () => frappe.tests.make('Payment Term', [
// values to be set // values to be set
{key: 'value'} {key: 'value'}
]), ]),

View File

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

View File

@ -0,0 +1,34 @@
[
{
"doctype":"Payment Term",
"due_date_based_on":"Day(s) after invoice date",
"payment_term_name":"_Test N30",
"description":"_Test Net 30 Days",
"invoice_portion":50,
"credit_days":30
},
{
"doctype":"Payment Term",
"due_date_based_on":"Day(s) after invoice date",
"payment_term_name":"_Test COD",
"description":"_Test Cash on Delivery",
"invoice_portion":50,
"credit_days":0
},
{
"doctype":"Payment Term",
"due_date_based_on":"Month(s) after the end of the invoice month",
"payment_term_name":"_Test EONM",
"description":"_Test End of Next Month",
"invoice_portion":100,
"credit_months":1
},
{
"doctype":"Payment Term",
"due_date_based_on":"Day(s) after invoice date",
"payment_term_name":"_Test N30 1",
"description":"_Test Net 30 Days",
"invoice_portion":100,
"credit_days":30
}
]

View File

@ -0,0 +1,12 @@
// Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt
frappe.ui.form.on('Payment Terms Template', {
setup: function(frm) {
frm.add_fetch("payment_term", "description", "description");
frm.add_fetch("payment_term", "invoice_portion", "invoice_portion");
frm.add_fetch("payment_term", "due_date_based_on", "due_date_based_on");
frm.add_fetch("payment_term", "credit_days", "credit_days");
frm.add_fetch("payment_term", "credit_months", "credit_months");
}
});

View File

@ -0,0 +1,164 @@
{
"allow_copy": 0,
"allow_guest_to_view": 0,
"allow_import": 1,
"allow_rename": 1,
"autoname": "field:template_name",
"beta": 0,
"creation": "2017-08-10 15:34:28.058054",
"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": "template_name",
"fieldtype": "Data",
"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": "Template Name",
"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": "terms",
"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": "Payment Terms",
"length": 0,
"no_copy": 0,
"options": "Payment Terms Template Detail",
"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": 0,
"idx": 0,
"image_view": 0,
"in_create": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2018-01-24 11:13:31.158613",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Payment Terms Template",
"name_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": "Accounts User",
"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": "Accounts Manager",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"write": 1
}
],
"quick_entry": 0,
"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,42 @@
# -*- 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
from frappe.utils import flt, cint
from frappe import _
class PaymentTermsTemplate(Document):
def validate(self):
self.validate_invoice_portion()
self.validate_credit_days()
self.check_duplicate_terms()
def validate_invoice_portion(self):
total_portion = 0
for term in self.terms:
total_portion += flt(term.get('invoice_portion', 0))
if flt(total_portion, 2) != 100.00:
frappe.msgprint(_('Combined invoice portion must equal 100%'), raise_exception=1, indicator='red')
def validate_credit_days(self):
for term in self.terms:
if cint(term.credit_days) < 0:
frappe.msgprint(_('Credit Days cannot be a negative number'), raise_exception=1, indicator='red')
def check_duplicate_terms(self):
terms = []
for term in self.terms:
term_info = (term.credit_days, term.due_date_based_on)
if term_info in terms:
frappe.msgprint(
_('The Payment Term at row {0} is possibly a duplicate.').format(term.idx),
raise_exception=1, indicator='red'
)
else:
terms.append(term_info)

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: Payment Terms Template", function (assert) {
let done = assert.async();
// number of asserts
assert.expect(1);
frappe.run_serially([
// insert a new Payment Terms Template
() => frappe.tests.make('Payment Terms Template', [
// values to be set
{key: 'value'}
]),
() => {
assert.equal(cur_frm.doc.key, 'value');
},
() => done()
]);
});

View File

@ -0,0 +1,72 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
import unittest
import frappe
class TestPaymentTermsTemplate(unittest.TestCase):
def tearDown(self):
frappe.delete_doc('Payment Terms Template', '_Test Payment Terms Template For Test', force=1)
def test_create_template(self):
template = frappe.get_doc({
'doctype': 'Payment Terms Template',
'template_name': '_Test Payment Terms Template For Test',
'terms': [{
'doctype': 'Payment Terms Template Detail',
'invoice_portion': 50.00,
'credit_days_based_on': 'Day(s) after invoice date',
'credit_days': 30
}]
})
self.assertRaises(frappe.ValidationError, template.insert)
template.append('terms', {
'doctype': 'Payment Terms Template Detail',
'invoice_portion': 50.00,
'credit_days_based_on': 'Day(s) after invoice date',
'credit_days': 0
})
template.insert()
def test_credit_days(self):
template = frappe.get_doc({
'doctype': 'Payment Terms Template',
'template_name': '_Test Payment Terms Template For Test',
'terms': [{
'doctype': 'Payment Terms Template Detail',
'invoice_portion': 100.00,
'credit_days_based_on': 'Day(s) after invoice date',
'credit_days': -30
}]
})
self.assertRaises(frappe.ValidationError, template.insert)
def test_duplicate_terms(self):
template = frappe.get_doc({
'doctype': 'Payment Terms Template',
'template_name': '_Test Payment Terms Template For Test',
'terms': [
{
'doctype': 'Payment Terms Template Detail',
'invoice_portion': 50.00,
'credit_days_based_on': 'Day(s) after invoice date',
'credit_days': 30
},
{
'doctype': 'Payment Terms Template Detail',
'invoice_portion': 50.00,
'credit_days_based_on': 'Day(s) after invoice date',
'credit_days': 30
}
]
})
self.assertRaises(frappe.ValidationError, template.insert)

View File

@ -0,0 +1,60 @@
[
{
"doctype":"Payment Terms Template",
"terms":[
{
"doctype":"Payment Terms Template Detail",
"due_date_based_on":"Day(s) after invoice date",
"idx":1,
"description":"Cash on Delivery",
"invoice_portion":50,
"credit_days":0,
"credit_months":0,
"payment_term":"_Test COD"
},
{
"doctype":"Payment Terms Template Detail",
"due_date_based_on":"Day(s) after invoice date",
"idx":2,
"description":"Net 30 Days ",
"invoice_portion":50,
"credit_days":30,
"credit_months":0,
"payment_term":"_Test N30"
}
],
"template_name":"_Test Payment Term Template"
},
{
"doctype":"Payment Terms Template",
"terms":[
{
"doctype":"Payment Terms Template Detail",
"due_date_based_on":"Month(s) after the end of the invoice month",
"idx":1,
"description":"_Test End of Next Months",
"invoice_portion":100,
"credit_days":0,
"credit_months":1,
"payment_term":"_Test EONM"
}
],
"template_name":"_Test Payment Term Template 1"
},
{
"doctype":"Payment Terms Template",
"terms":[
{
"doctype":"Payment Terms Template Detail",
"due_date_based_on":"Day(s) after invoice date",
"idx":1,
"description":"_Test Net Within 30 days",
"invoice_portion":100,
"credit_days":30,
"credit_months":0,
"payment_term":"_Test N30 1"
}
],
"template_name":"_Test Payment Term Template 3"
}
]

View File

@ -0,0 +1,232 @@
{
"allow_copy": 0,
"allow_guest_to_view": 0,
"allow_import": 0,
"allow_rename": 0,
"autoname": "PTTD.#####",
"beta": 0,
"creation": "2017-08-10 15:34:09.409562",
"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": 2,
"fieldname": "payment_term",
"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": "Payment Term",
"length": 0,
"no_copy": 0,
"options": "Payment Term",
"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": 2,
"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,
"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": 2,
"default": "0",
"fieldname": "invoice_portion",
"fieldtype": "Percent",
"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 Portion",
"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": 2,
"fieldname": "due_date_based_on",
"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": "Due Date Based On",
"length": 0,
"no_copy": 0,
"options": "Day(s) after invoice date\nDay(s) after the end of the invoice month\nMonth(s) after the end of the invoice month",
"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": 2,
"default": "0",
"depends_on": "eval:in_list(['Day(s) after invoice date', 'Day(s) after the end of the invoice month'], doc.due_date_based_on)",
"fieldname": "credit_days",
"fieldtype": "Int",
"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": "Credit Days",
"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",
"depends_on": "eval:doc.due_date_based_on=='Month(s) after the end of the invoice month'",
"fieldname": "credit_months",
"fieldtype": "Int",
"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": "Credit Months",
"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-09-26 05:21:51.738319",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Payment Terms Template Detail",
"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
from frappe.model.document import Document
class PaymentTermsTemplateDetail(Document):
pass

View File

@ -1,5 +1,6 @@
{ {
"allow_copy": 0, "allow_copy": 0,
"allow_guest_to_view": 0,
"allow_import": 0, "allow_import": 0,
"allow_rename": 0, "allow_rename": 0,
"autoname": "PCE/.###", "autoname": "PCE/.###",
@ -12,34 +13,7 @@
"engine": "InnoDB", "engine": "InnoDB",
"fields": [ "fields": [
{ {
"allow_on_submit": 0, "allow_bulk_edit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "column_break0",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"oldfieldtype": "Column Break",
"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,
"set_only_once": 0,
"unique": 0,
"width": "50%"
},
{
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -50,6 +24,7 @@
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_global_search": 0,
"in_list_view": 0, "in_list_view": 0,
"in_standard_filter": 0, "in_standard_filter": 0,
"label": "Transaction Date", "label": "Transaction Date",
@ -69,6 +44,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -79,6 +55,7 @@
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_global_search": 0,
"in_list_view": 0, "in_list_view": 0,
"in_standard_filter": 0, "in_standard_filter": 0,
"label": "Posting Date", "label": "Posting Date",
@ -98,6 +75,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -108,6 +86,7 @@
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_global_search": 0,
"in_list_view": 1, "in_list_view": 1,
"in_standard_filter": 1, "in_standard_filter": 1,
"label": "Closing Fiscal Year", "label": "Closing Fiscal Year",
@ -128,6 +107,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -138,6 +118,7 @@
"ignore_user_permissions": 1, "ignore_user_permissions": 1,
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_global_search": 0,
"in_list_view": 0, "in_list_view": 0,
"in_standard_filter": 0, "in_standard_filter": 0,
"label": "Amended From", "label": "Amended From",
@ -158,6 +139,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -168,6 +150,7 @@
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_global_search": 0,
"in_list_view": 0, "in_list_view": 0,
"in_standard_filter": 0, "in_standard_filter": 0,
"label": "Company", "label": "Company",
@ -188,6 +171,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -198,6 +182,7 @@
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_global_search": 0,
"in_list_view": 0, "in_list_view": 0,
"in_standard_filter": 0, "in_standard_filter": 0,
"length": 0, "length": 0,
@ -215,6 +200,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -226,6 +212,7 @@
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_global_search": 0,
"in_list_view": 0, "in_list_view": 0,
"in_standard_filter": 0, "in_standard_filter": 0,
"label": "Closing Account Head", "label": "Closing Account Head",
@ -246,6 +233,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -256,6 +244,7 @@
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_global_search": 0,
"in_list_view": 0, "in_list_view": 0,
"in_standard_filter": 0, "in_standard_filter": 0,
"label": "Remarks", "label": "Remarks",
@ -275,18 +264,18 @@
"unique": 0 "unique": 0
} }
], ],
"has_web_view": 0,
"hide_heading": 0, "hide_heading": 0,
"hide_toolbar": 0, "hide_toolbar": 0,
"icon": "fa fa-file-text", "icon": "fa fa-file-text",
"idx": 1, "idx": 1,
"image_view": 0, "image_view": 0,
"in_create": 0, "in_create": 0,
"in_dialog": 0,
"is_submittable": 1, "is_submittable": 1,
"issingle": 0, "issingle": 0,
"istable": 0, "istable": 0,
"max_attachments": 0, "max_attachments": 0,
"modified": "2016-11-07 05:32:15.691681", "modified": "2017-11-10 18:41:10.881530",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Period Closing Voucher", "name": "Period Closing Voucher",
@ -302,7 +291,6 @@
"export": 0, "export": 0,
"if_owner": 0, "if_owner": 0,
"import": 0, "import": 0,
"is_custom": 0,
"permlevel": 0, "permlevel": 0,
"print": 1, "print": 1,
"read": 1, "read": 1,
@ -323,7 +311,6 @@
"export": 0, "export": 0,
"if_owner": 0, "if_owner": 0,
"import": 0, "import": 0,
"is_custom": 0,
"permlevel": 0, "permlevel": 0,
"print": 1, "print": 1,
"read": 1, "read": 1,
@ -339,8 +326,10 @@
"read_only": 0, "read_only": 0,
"read_only_onload": 0, "read_only_onload": 0,
"search_fields": "posting_date, fiscal_year", "search_fields": "posting_date, fiscal_year",
"show_name_in_global_search": 0,
"sort_field": "modified", "sort_field": "modified",
"sort_order": "DESC", "sort_order": "DESC",
"title_field": "closing_account_head", "title_field": "closing_account_head",
"track_changes": 0,
"track_seen": 0 "track_seen": 0
} }

View File

@ -24,11 +24,11 @@ frappe.ui.form.on("POS Profile", "onload", function(frm) {
frappe.ui.form.on('POS Profile', { frappe.ui.form.on('POS Profile', {
setup: function(frm) { setup: function(frm) {
frm.set_query("online_print_format", function() { frm.set_query("print_format_for_online", function() {
return { return {
filters: [ filters: [
['Print Format', 'doc_type', '=', 'Sales Invoice'], ['Print Format', 'doc_type', '=', 'Sales Invoice'],
['Print Format', 'print_format_type', '!=', 'Js'], ['Print Format', 'print_format_type', '=', 'Server'],
] ]
}; };
}); });
@ -106,11 +106,6 @@ cur_frm.fields_dict['select_print_heading'].get_query = function(doc, cdt, cdn)
}; };
}; };
cur_frm.fields_dict.user.get_query = function(doc,cdt,cdn) {
return{ query:"frappe.core.doctype.user.user.user_query"};
};
cur_frm.fields_dict.write_off_account.get_query = function(doc) { cur_frm.fields_dict.write_off_account.get_query = function(doc) {
return{ return{
filters:{ filters:{

View File

@ -2,8 +2,8 @@
"allow_copy": 0, "allow_copy": 0,
"allow_guest_to_view": 0, "allow_guest_to_view": 0,
"allow_import": 0, "allow_import": 0,
"allow_rename": 0, "allow_rename": 1,
"autoname": "hash", "autoname": "field:pos_profile_name",
"beta": 0, "beta": 0,
"creation": "2013-05-24 12:15:51", "creation": "2013-05-24 12:15:51",
"custom": 0, "custom": 0,
@ -17,22 +17,21 @@
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0, "columns": 0,
"fieldname": "user", "default": "0",
"fieldtype": "Link", "fieldname": "disabled",
"fieldtype": "Check",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_global_search": 0, "in_global_search": 0,
"in_list_view": 1, "in_list_view": 0,
"in_standard_filter": 0, "in_standard_filter": 0,
"label": "Applicable for User", "label": "Disabled",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
"oldfieldname": "user",
"oldfieldtype": "Link",
"options": "User",
"permlevel": 0, "permlevel": 0,
"precision": "",
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0, "print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
@ -40,7 +39,66 @@
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
"search_index": 0, "search_index": 0,
"set_only_once": 1, "set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "section_break_2",
"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,
"fieldname": "pos_profile_name",
"fieldtype": "Data",
"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": "POS Profile Name",
"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 "unique": 0
}, },
{ {
@ -72,7 +130,7 @@
"report_hide": 0, "report_hide": 0,
"reqd": 1, "reqd": 1,
"search_index": 0, "search_index": 0,
"set_only_once": 1, "set_only_once": 0,
"unique": 0 "unique": 0
}, },
{ {
@ -112,9 +170,8 @@
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0, "columns": 0,
"depends_on": "update_stock", "fieldname": "ignore_pricing_rule",
"fieldname": "warehouse", "fieldtype": "Check",
"fieldtype": "Link",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
@ -122,13 +179,11 @@
"in_global_search": 0, "in_global_search": 0,
"in_list_view": 0, "in_list_view": 0,
"in_standard_filter": 0, "in_standard_filter": 0,
"label": "Warehouse", "label": "Ignore Pricing Rule",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
"oldfieldname": "warehouse",
"oldfieldtype": "Link",
"options": "Warehouse",
"permlevel": 0, "permlevel": 0,
"precision": "",
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0, "print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
@ -145,8 +200,8 @@
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0, "columns": 0,
"fieldname": "campaign", "fieldname": "allow_delete",
"fieldtype": "Link", "fieldtype": "Check",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
@ -154,10 +209,69 @@
"in_global_search": 0, "in_global_search": 0,
"in_list_view": 0, "in_list_view": 0,
"in_standard_filter": 0, "in_standard_filter": 0,
"label": "Campaign", "label": "Allow Delete",
"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": "allow_user_to_edit_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": "Allow user to edit Rate",
"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": "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, "length": 0,
"no_copy": 0, "no_copy": 0,
"options": "Campaign",
"permlevel": 0, "permlevel": 0,
"precision": "", "precision": "",
"print_hide": 0, "print_hide": 0,
@ -300,7 +414,8 @@
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0, "columns": 0,
"fieldname": "currency", "depends_on": "update_stock",
"fieldname": "warehouse",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
@ -309,19 +424,19 @@
"in_global_search": 0, "in_global_search": 0,
"in_list_view": 0, "in_list_view": 0,
"in_standard_filter": 0, "in_standard_filter": 0,
"label": "Currency", "label": "Warehouse",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
"oldfieldname": "currency", "oldfieldname": "warehouse",
"oldfieldtype": "Select", "oldfieldtype": "Link",
"options": "Currency", "options": "Warehouse",
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0, "print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"remember_last_selected_value": 0, "remember_last_selected_value": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 1, "reqd": 0,
"search_index": 0, "search_index": 0,
"set_only_once": 0, "set_only_once": 0,
"unique": 0 "unique": 0
@ -332,8 +447,8 @@
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0, "columns": 0,
"fieldname": "ignore_pricing_rule", "fieldname": "campaign",
"fieldtype": "Check", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
@ -341,7 +456,38 @@
"in_global_search": 0, "in_global_search": 0,
"in_list_view": 0, "in_list_view": 0,
"in_standard_filter": 0, "in_standard_filter": 0,
"label": "Ignore Pricing Rule", "label": "Campaign",
"length": 0,
"no_copy": 0,
"options": "Campaign",
"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": "section_break_15",
"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": "Applicable for Users",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
"permlevel": 0, "permlevel": 0,
@ -362,8 +508,8 @@
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0, "columns": 0,
"fieldname": "allow_delete", "fieldname": "applicable_for_users",
"fieldtype": "Check", "fieldtype": "Table",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
@ -371,39 +517,10 @@
"in_global_search": 0, "in_global_search": 0,
"in_list_view": 0, "in_list_view": 0,
"in_standard_filter": 0, "in_standard_filter": 0,
"label": "Allow Delete", "label": "Applicable for Users",
"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": "allow_user_to_edit_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": "Allow user to edit Rate",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
"options": "POS Profile User",
"permlevel": 0, "permlevel": 0,
"precision": "", "precision": "",
"print_hide": 0, "print_hide": 0,
@ -482,6 +599,7 @@
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0, "columns": 0,
"depends_on": "",
"fieldname": "section_break_14", "fieldname": "section_break_14",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -602,6 +720,7 @@
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0, "columns": 0,
"depends_on": "",
"fieldname": "section_break_16", "fieldname": "section_break_16",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -882,6 +1001,7 @@
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0, "columns": 0,
"depends_on": "",
"fieldname": "offline_pos_section", "fieldname": "offline_pos_section",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -1037,6 +1157,7 @@
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0, "columns": 0,
"depends_on": "",
"fieldname": "section_break_19", "fieldname": "section_break_19",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -1046,6 +1167,7 @@
"in_global_search": 0, "in_global_search": 0,
"in_list_view": 0, "in_list_view": 0,
"in_standard_filter": 0, "in_standard_filter": 0,
"label": "Accounting",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
"permlevel": 0, "permlevel": 0,
@ -1060,6 +1182,38 @@
"set_only_once": 0, "set_only_once": 0,
"unique": 0 "unique": 0
}, },
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "currency",
"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": "Currency",
"length": 0,
"no_copy": 0,
"oldfieldname": "currency",
"oldfieldtype": "Select",
"options": "Currency",
"permlevel": 0,
"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_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
@ -1154,38 +1308,6 @@
"set_only_once": 0, "set_only_once": 0,
"unique": 0 "unique": 0
}, },
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "taxes_and_charges",
"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": "Taxes and Charges",
"length": 0,
"no_copy": 0,
"oldfieldname": "charge",
"oldfieldtype": "Link",
"options": "Sales Taxes and Charges Template",
"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,
"set_only_once": 0,
"unique": 0
},
{ {
"allow_bulk_edit": 0, "allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
@ -1309,6 +1431,38 @@
"search_index": 0, "search_index": 0,
"set_only_once": 0, "set_only_once": 0,
"unique": 0 "unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "taxes_and_charges",
"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": "Taxes and Charges",
"length": 0,
"no_copy": 0,
"oldfieldname": "charge",
"oldfieldtype": "Link",
"options": "Sales Taxes and Charges Template",
"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,
"set_only_once": 0,
"unique": 0
} }
], ],
"has_web_view": 0, "has_web_view": 0,
@ -1322,7 +1476,7 @@
"issingle": 0, "issingle": 0,
"istable": 0, "istable": 0,
"max_attachments": 0, "max_attachments": 0,
"modified": "2017-09-01 15:55:14.890452", "modified": "2018-01-03 17:30:45.198147",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "POS Profile", "name": "POS Profile",
@ -1372,10 +1526,11 @@
"quick_entry": 0, "quick_entry": 0,
"read_only": 0, "read_only": 0,
"read_only_onload": 0, "read_only_onload": 0,
"search_fields": "pos_profile_name",
"show_name_in_global_search": 0, "show_name_in_global_search": 0,
"sort_field": "modified", "sort_field": "modified",
"sort_order": "DESC", "sort_order": "DESC",
"title_field": "user", "title_field": "pos_profile_name",
"track_changes": 0, "track_changes": 0,
"track_seen": 0 "track_seen": 0
} }

View File

@ -4,30 +4,35 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe import frappe
from frappe import msgprint, _ from frappe import msgprint, _
from frappe.utils import cint from frappe.utils import cint, now
from erpnext.accounts.doctype.sales_invoice.pos import get_child_nodes
from erpnext.accounts.doctype.sales_invoice.sales_invoice import set_account_for_mode_of_payment from erpnext.accounts.doctype.sales_invoice.sales_invoice import set_account_for_mode_of_payment
from frappe.model.document import Document from frappe.model.document import Document
class POSProfile(Document): class POSProfile(Document):
def validate(self): def validate(self):
self.check_for_duplicate() self.validate_default_profile()
self.validate_all_link_fields() self.validate_all_link_fields()
self.validate_duplicate_groups() self.validate_duplicate_groups()
self.check_default_payment() self.check_default_payment()
self.validate_customer_territory_group() self.validate_customer_territory_group()
def check_for_duplicate(self): def validate_default_profile(self):
res = frappe.db.sql("""select name, user from `tabPOS Profile` for row in self.applicable_for_users:
where ifnull(user, '') = %s and name != %s and company = %s""", res = frappe.db.sql("""select pf.name
(self.user, self.name, self.company)) from
if res: `tabPOS Profile User` pfu, `tabPOS Profile` pf
if res[0][1]: where
msgprint(_("POS Profile {0} already created for user: {1} and company {2}").format(res[0][0], pf.name = pfu.parent and pfu.user = %s and pf.name != %s and pf.company = %s
res[0][1], self.company), raise_exception=1) and pfu.default=1 and pf.disabled = 0""", (row.user, self.name, self.company))
else:
msgprint(_("Global POS Profile {0} already created for company {1}").format(res[0][0], if row.default and res:
self.company), raise_exception=1) msgprint(_("Already set default in pos profile {0} for user {1}, kindly disabled default")
.format(res[0][0], row.user), raise_exception=1)
elif not row.default and not res:
msgprint(_("User {0} doesn't have any default POS Profile. Check Default at Row {1} for this User.")
.format(row.user, row.idx), raise_exception=1)
def validate_all_link_fields(self): def validate_all_link_fields(self):
accounts = {"Account": [self.income_account, accounts = {"Account": [self.income_account,
@ -58,7 +63,11 @@ class POSProfile(Document):
if len(default_mode_of_payment) > 1: if len(default_mode_of_payment) > 1:
frappe.throw(_("Multiple default mode of payment is not allowed")) frappe.throw(_("Multiple default mode of payment is not allowed"))
def validate_customer_territory_group(self): def validate_customer_territory_group(self):
if not frappe.db.get_single_value('POS Settings', 'use_pos_in_offline_mode'):
return
if not self.territory: if not self.territory:
frappe.throw(_("Territory is Required in POS Profile"), title="Mandatory Field") frappe.throw(_("Territory is Required in POS Profile"), title="Mandatory Field")
@ -78,12 +87,12 @@ class POSProfile(Document):
frappe.defaults.clear_default("is_pos") frappe.defaults.clear_default("is_pos")
if not include_current_pos: if not include_current_pos:
condition = " where name != '%s'" % self.name.replace("'", "\'") condition = " where pfu.name != '%s' and pfu.default = 1 " % self.name.replace("'", "\'")
else: else:
condition = "" condition = " where pfu.default = 1 "
pos_view_users = frappe.db.sql_list("""select user pos_view_users = frappe.db.sql_list("""select pfu.user
from `tabPOS Profile` {0}""".format(condition)) from `tabPOS Profile User` as pfu {0}""".format(condition))
for user in pos_view_users: for user in pos_view_users:
if user: if user:
@ -91,6 +100,73 @@ class POSProfile(Document):
else: else:
frappe.defaults.set_global_default("is_pos", 1) frappe.defaults.set_global_default("is_pos", 1)
def get_item_groups(pos_profile):
item_groups = []
pos_profile = frappe.get_doc('POS Profile', pos_profile)
if pos_profile.get('item_groups'):
# Get items based on the item groups defined in the POS profile
for data in pos_profile.get('item_groups'):
item_groups.extend(["'%s'" % frappe.db.escape(d.name) for d in get_child_nodes('Item Group', data.item_group)])
return list(set(item_groups))
@frappe.whitelist() @frappe.whitelist()
def get_series(): def get_series():
return frappe.get_meta("Sales Invoice").get_field("naming_series").options or "" return frappe.get_meta("Sales Invoice").get_field("naming_series").options or ""
def pos_profile_query(doctype, txt, searchfield, start, page_len, filters):
user = frappe.session['user']
company = filters.get('company') or frappe.defaults.get_user_default('company')
args = {
'user': user,
'start': start,
'company': company,
'page_len': page_len,
'txt': '%%%s%%' % txt
}
pos_profile = frappe.db.sql("""select pf.name, pf.pos_profile_name
from
`tabPOS Profile` pf, `tabPOS Profile User` pfu
where
pfu.parent = pf.name and pfu.user = %(user)s and pf.company = %(company)s
and (pf.name like %(txt)s or pf.pos_profile_name like %(txt)s)
and pf.disabled = 0 limit %(start)s, %(page_len)s""", args)
if not pos_profile:
del args['user']
pos_profile = frappe.db.sql("""select pf.name, pf.pos_profile_name
from
`tabPOS Profile` pf left join `tabPOS Profile User` pfu
on
pf.name = pfu.parent
where
ifnull(pfu.user, '') = '' and pf.company = %(company)s and
(pf.name like %(txt)s or pf.pos_profile_name like %(txt)s)
and pf.disabled = 0""", args)
return pos_profile
@frappe.whitelist()
def set_default_profile(pos_profile, company):
modified = now()
user = frappe.session.user
company = frappe.db.escape(company)
if pos_profile and company:
frappe.db.sql(""" update `tabPOS Profile User` pfu, `tabPOS Profile` pf
set
pfu.default = 0, pf.modified = %s, pf.modified_by = %s
where
pfu.user = %s and pf.name = pfu.parent and pf.company = %s
and pfu.default = 1""", (modified, user, user, company), auto_commit=1)
frappe.db.sql(""" update `tabPOS Profile User` pfu, `tabPOS Profile` pf
set
pfu.default = 1, pf.modified = %s, pf.modified_by = %s
where
pfu.user = %s and pf.name = pfu.parent and pf.company = %s and pf.name = %s
""", (modified, user, user, company, pos_profile), auto_commit=1)

View File

@ -41,6 +41,7 @@ def make_pos_profile():
"expense_account": "_Test Account Cost for Goods Sold - _TC", "expense_account": "_Test Account Cost for Goods Sold - _TC",
"income_account": "Sales - _TC", "income_account": "Sales - _TC",
"name": "_Test POS Profile", "name": "_Test POS Profile",
"pos_profile_name": "_Test POS Profile",
"naming_series": "_T-POS Profile-", "naming_series": "_T-POS Profile-",
"selling_price_list": "_Test Price List", "selling_price_list": "_Test Price List",
"territory": "_Test Territory", "territory": "_Test Territory",

View File

@ -0,0 +1,6 @@
// Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt
frappe.ui.form.on('POS Profile User', {
});

View File

@ -0,0 +1,123 @@
{
"allow_copy": 0,
"allow_guest_to_view": 0,
"allow_import": 0,
"allow_rename": 0,
"beta": 0,
"creation": "2017-10-27 16:46:06.060930",
"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": "default",
"fieldtype": "Check",
"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": "Default",
"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": "user",
"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": "User",
"length": 0,
"no_copy": 0,
"options": "User",
"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-23 17:13:16.005475",
"modified_by": "Administrator",
"module": "Accounts",
"name": "POS Profile User",
"name_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
}
],
"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,9 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
from frappe.model.document import Document
class POSProfileUser(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: POS Profile User", function (assert) {
let done = assert.async();
// number of asserts
assert.expect(1);
frappe.run_serially([
// insert a new POS Profile User
() => frappe.tests.make('POS Profile User', [
// values to be set
{key: 'value'}
]),
() => {
assert.equal(cur_frm.doc.key, 'value');
},
() => done()
]);
});

View File

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

View File

@ -12,8 +12,5 @@ class POSSettings(Document):
def set_link_for_pos(self): def set_link_for_pos(self):
link = 'pos' if self.use_pos_in_offline_mode else 'point-of-sale' link = 'pos' if self.use_pos_in_offline_mode else 'point-of-sale'
desktop_icon = frappe.db.get_value('Desktop Icon', frappe.db.sql(""" update `tabDesktop Icon` set link = '{0}'
{'standard': 1, 'module_name': 'POS'}, 'name') where module_name like '%pos%'""".format(link))
if desktop_icon:
frappe.db.set_value('Desktop Icon', desktop_icon, 'link', link)

View File

@ -252,9 +252,11 @@ class TestPricingRule(unittest.TestCase):
self.assertEquals(so.items[0].rate, 100) self.assertEquals(so.items[0].rate, 100)
def test_pricing_rule_with_margin_and_discount(self): def test_pricing_rule_with_margin_and_discount(self):
frappe.delete_doc_if_exists('Pricing Rule', '_Test Pricing Rule')
make_pricing_rule(selling=1, margin_type="Percentage", margin_rate_or_amount=10) make_pricing_rule(selling=1, margin_type="Percentage", margin_rate_or_amount=10)
si = create_sales_invoice(do_not_save=True) si = create_sales_invoice(do_not_save=True)
si.items[0].price_list_rate = 1000 si.items[0].price_list_rate = 1000
si.payment_schedule = []
si.insert(ignore_permissions=True) si.insert(ignore_permissions=True)
item = si.items[0] item = si.items[0]
@ -263,6 +265,7 @@ class TestPricingRule(unittest.TestCase):
# With discount # With discount
item.discount_percentage = 10 item.discount_percentage = 10
si.payment_schedule = []
si.save() si.save()
item = si.items[0] item = si.items[0]
self.assertEquals(item.rate, 990) self.assertEquals(item.rate, 990)

View File

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

View File

@ -128,6 +128,7 @@
"no_copy": 0, "no_copy": 0,
"oldfieldname": "supplier_name", "oldfieldname": "supplier_name",
"oldfieldtype": "Data", "oldfieldtype": "Data",
"options": "supplier.supplier_name",
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0, "print_hide_if_no_value": 0,
@ -139,6 +140,37 @@
"set_only_once": 0, "set_only_once": 0,
"unique": 0 "unique": 0
}, },
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "tax_id",
"fieldtype": "Read Only",
"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": "Tax Id",
"length": 0,
"no_copy": 0,
"options": "supplier.tax_id",
"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_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
@ -160,7 +192,7 @@
"oldfieldname": "due_date", "oldfieldname": "due_date",
"oldfieldtype": "Date", "oldfieldtype": "Date",
"permlevel": 0, "permlevel": 0,
"print_hide": 1, "print_hide": 0,
"print_hide_if_no_value": 0, "print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"remember_last_selected_value": 0, "remember_last_selected_value": 0,
@ -274,7 +306,7 @@
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_global_search": 0, "in_global_search": 0,
"in_list_view": 0, "in_list_view": 1,
"in_standard_filter": 0, "in_standard_filter": 0,
"label": "Date", "label": "Date",
"length": 0, "length": 0,
@ -1421,6 +1453,36 @@
"set_only_once": 0, "set_only_once": 0,
"unique": 0 "unique": 0
}, },
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "total_net_weight",
"fieldtype": "Float",
"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 Net Weight",
"length": 0,
"no_copy": 0,
"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_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
@ -1484,6 +1546,95 @@
"set_only_once": 0, "set_only_once": 0,
"unique": 0 "unique": 0
}, },
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "column_break_49",
"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": "shipping_rule",
"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": "Shipping Rule",
"length": 0,
"no_copy": 0,
"options": "Shipping Rule",
"permlevel": 0,
"precision": "",
"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,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "section_break_51",
"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_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
@ -2103,6 +2254,38 @@
"set_only_once": 0, "set_only_once": 0,
"unique": 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_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
@ -2228,6 +2411,38 @@
"set_only_once": 0, "set_only_once": 0,
"unique": 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_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
@ -2323,6 +2538,37 @@
"set_only_once": 0, "set_only_once": 0,
"unique": 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_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
@ -2788,6 +3034,99 @@
"set_only_once": 0, "set_only_once": 0,
"unique": 0 "unique": 0
}, },
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 1,
"collapsible_depends_on": "eval:(!doc.is_return)",
"columns": 0,
"fieldname": "payment_schedule_section",
"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": "Payment Terms",
"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": "payment_terms_template",
"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": "Payment Terms Template",
"length": 0,
"no_copy": 0,
"options": "Payment Terms Template",
"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": "payment_schedule",
"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": "Payment Schedule",
"length": 0,
"no_copy": 1,
"options": "Payment Schedule",
"permlevel": 0,
"precision": "",
"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,
"set_only_once": 0,
"unique": 0
},
{ {
"allow_bulk_edit": 0, "allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
@ -3430,6 +3769,97 @@
"no_copy": 0, "no_copy": 0,
"permlevel": 0, "permlevel": 0,
"precision": "", "precision": "",
"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,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "",
"description": "Start date of current invoice's period",
"fieldname": "from_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": "From Date",
"length": 0,
"no_copy": 1,
"permlevel": 0,
"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,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "",
"description": "End date of current invoice's period",
"fieldname": "to_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": "To Date",
"length": 0,
"no_copy": 1,
"permlevel": 0,
"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,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "column_break_114",
"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": 0,
"print_hide_if_no_value": 0, "print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
@ -3470,442 +3900,6 @@
"search_index": 0, "search_index": 0,
"set_only_once": 0, "set_only_once": 0,
"unique": 0 "unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 1,
"collapsible_depends_on": "is_recurring",
"columns": 0,
"depends_on": "eval:doc.docstatus<2 && !doc.__islocal",
"fieldname": "recurring_invoice",
"fieldtype": "Section Break",
"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": "Recurring Invoice",
"length": 0,
"no_copy": 0,
"options": "fa fa-time",
"permlevel": 0,
"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,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.docstatus<2",
"description": "",
"fieldname": "is_recurring",
"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": "Is Recurring",
"length": 0,
"no_copy": 1,
"permlevel": 0,
"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,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.is_recurring==1",
"description": "Select the period when the invoice will be generated automatically",
"fieldname": "recurring_type",
"fieldtype": "Select",
"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": "Recurring Type",
"length": 0,
"no_copy": 1,
"options": "Monthly\nQuarterly\nHalf-yearly\nYearly",
"permlevel": 0,
"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,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.is_recurring==1",
"description": "Start date of current invoice's period",
"fieldname": "from_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": "From Date",
"length": 0,
"no_copy": 1,
"permlevel": 0,
"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,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.is_recurring==1",
"description": "End date of current invoice's period",
"fieldname": "to_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": "To Date",
"length": 0,
"no_copy": 1,
"permlevel": 0,
"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,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.is_recurring && doc.recurring_id === doc.name",
"fieldname": "submit_on_creation",
"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": "Submit on creation",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"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,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.is_recurring && doc.recurring_id === doc.name",
"description": "",
"fieldname": "notify_by_email",
"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": "Notify by email",
"length": 0,
"no_copy": 1,
"permlevel": 0,
"precision": "",
"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,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.is_recurring==1",
"description": "The day of the month on which auto invoice will be generated e.g. 05, 28 etc",
"fieldname": "repeat_on_day_of_month",
"fieldtype": "Int",
"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": "Repeat on Day of Month",
"length": 0,
"no_copy": 1,
"permlevel": 0,
"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,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.is_recurring==1",
"description": "The date on which recurring invoice will be stop",
"fieldname": "end_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": "End Date",
"length": 0,
"no_copy": 1,
"permlevel": 0,
"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,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "column_break_82",
"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,
"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,
"set_only_once": 0,
"unique": 0,
"width": "50%"
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.is_recurring==1",
"description": "The date on which next invoice will be generated. It is generated on submit.",
"fieldname": "next_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": "Next Date",
"length": 0,
"no_copy": 1,
"permlevel": 0,
"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,
"depends_on": "eval:doc.is_recurring==1",
"description": "The unique id for tracking all recurring invoices. It is generated on submit.",
"fieldname": "recurring_id",
"fieldtype": "Data",
"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": "Recurring Id",
"length": 0,
"no_copy": 1,
"permlevel": 0,
"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": 1,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.is_recurring==1",
"description": "Enter Email Address separated by commas, invoice will be mailed automatically on particular date",
"fieldname": "notification_email_address",
"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": "Notification Email Address",
"length": 0,
"no_copy": 1,
"permlevel": 0,
"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,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.is_recurring==1",
"fieldname": "recurring_print_format",
"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": "Recurring Print Format",
"length": 0,
"no_copy": 0,
"options": "Print Format",
"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, "has_web_view": 0,
@ -3920,7 +3914,7 @@
"istable": 0, "istable": 0,
"max_attachments": 0, "max_attachments": 0,
"menu_index": 0, "menu_index": 0,
"modified": "2017-09-19 11:22:47.074420", "modified": "2018-01-11 14:44:22.982512",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Purchase Invoice", "name": "Purchase Invoice",

View File

@ -16,6 +16,7 @@ from erpnext.accounts.general_ledger import make_gl_entries, merge_similar_entri
from erpnext.accounts.doctype.gl_entry.gl_entry import update_outstanding_amt from erpnext.accounts.doctype.gl_entry.gl_entry import update_outstanding_amt
from erpnext.buying.utils import check_for_closed_status from erpnext.buying.utils import check_for_closed_status
from erpnext.accounts.general_ledger import get_round_off_account_and_cost_center from erpnext.accounts.general_ledger import get_round_off_account_and_cost_center
from frappe.model.mapper import get_mapped_doc
form_grid_templates = { form_grid_templates = {
"items": "templates/form_grid/item_grid.html" "items": "templates/form_grid/item_grid.html"
@ -77,8 +78,10 @@ class PurchaseInvoice(BuyingController):
if not self.cash_bank_account and flt(self.paid_amount): if not self.cash_bank_account and flt(self.paid_amount):
frappe.throw(_("Cash or Bank Account is mandatory for making payment entry")) frappe.throw(_("Cash or Bank Account is mandatory for making payment entry"))
if flt(self.paid_amount) + flt(self.write_off_amount) \ if (flt(self.paid_amount) + flt(self.write_off_amount)
- flt(self.grand_total) > 1/(10**(self.precision("base_grand_total") + 1)): - 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""")) frappe.throw(_("""Paid amount + Write Off Amount can not be greater than Grand Total"""))
def create_remarks(self): def create_remarks(self):
@ -274,6 +277,8 @@ class PurchaseInvoice(BuyingController):
.format(item.purchase_receipt)) .format(item.purchase_receipt))
def on_submit(self): def on_submit(self):
super(PurchaseInvoice, self).on_submit()
self.check_prev_docstatus() self.check_prev_docstatus()
self.update_status_updater_args() self.update_status_updater_args()
@ -345,7 +350,6 @@ class PurchaseInvoice(BuyingController):
self.negative_expense_to_be_booked = 0.0 self.negative_expense_to_be_booked = 0.0
gl_entries = [] gl_entries = []
self.make_supplier_gl_entry(gl_entries) self.make_supplier_gl_entry(gl_entries)
self.make_item_gl_entries(gl_entries) self.make_item_gl_entries(gl_entries)
self.make_tax_gl_entries(gl_entries) self.make_tax_gl_entries(gl_entries)
@ -359,9 +363,10 @@ class PurchaseInvoice(BuyingController):
return gl_entries return gl_entries
def make_supplier_gl_entry(self, gl_entries): def make_supplier_gl_entry(self, gl_entries):
if self.grand_total: grand_total = self.rounded_total or self.grand_total
if grand_total:
# Didnot use base_grand_total to book rounding loss gle # 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")) self.precision("grand_total"))
gl_entries.append( gl_entries.append(
self.get_gl_dict({ self.get_gl_dict({
@ -371,7 +376,7 @@ class PurchaseInvoice(BuyingController):
"against": self.against_expense_account, "against": self.against_expense_account,
"credit": grand_total_in_company_currency, "credit": grand_total_in_company_currency,
"credit_in_account_currency": 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": self.return_against if cint(self.is_return) else self.name,
"against_voucher_type": self.doctype, "against_voucher_type": self.doctype,
}, self.party_account_currency) }, self.party_account_currency)
@ -418,7 +423,10 @@ class PurchaseInvoice(BuyingController):
# sub-contracting warehouse # sub-contracting warehouse
if flt(item.rm_supp_cost): if flt(item.rm_supp_cost):
supplier_warehouse_account = warehouse_account[self.supplier_warehouse]["name"] supplier_warehouse_account = warehouse_account[self.supplier_warehouse]["account"]
if not supplier_warehouse_account:
frappe.throw(_("Please set account in Warehouse {0}")
.format(self.supplier_warehouse))
gl_entries.append(self.get_gl_dict({ gl_entries.append(self.get_gl_dict({
"account": supplier_warehouse_account, "account": supplier_warehouse_account,
"against": item.expense_account, "against": item.expense_account,
@ -602,6 +610,8 @@ class PurchaseInvoice(BuyingController):
)) ))
def on_cancel(self): def on_cancel(self):
super(PurchaseInvoice, self).on_cancel()
self.check_for_closed_status() self.check_for_closed_status()
self.update_status_updater_args() self.update_status_updater_args()
@ -705,3 +715,22 @@ def get_fixed_asset_account(asset, account=None):
filters={"parent": asset_category, "company_name": company}, fieldname="fixed_asset_account") filters={"parent": asset_category, "company_name": company}, fieldname="fixed_asset_account")
return account return account
@frappe.whitelist()
def make_stock_entry(source_name, target_doc=None):
doc = get_mapped_doc("Purchase Invoice", source_name, {
"Purchase Invoice": {
"doctype": "Stock Entry",
"validation": {
"docstatus": ["=", 1]
}
},
"Purchase Invoice Item": {
"doctype": "Stock Entry Detail",
"field_map": {
"stock_qty": "transfer_qty"
},
}
}, target_doc)
return doc

View File

@ -1,7 +1,7 @@
QUnit.module('Purchaes Invoice'); QUnit.module('Purchase Invoice');
QUnit.test("test purchase invoice", function(assert) { QUnit.test("test purchase invoice", function(assert) {
assert.expect(4); assert.expect(9);
let done = assert.async(); let done = assert.async();
frappe.run_serially([ frappe.run_serially([
() => { () => {
@ -18,9 +18,10 @@ QUnit.test("test purchase invoice", function(assert) {
{update_stock:1}, {update_stock:1},
{supplier_address: 'Test1-Billing'}, {supplier_address: 'Test1-Billing'},
{contact_person: 'Contact 3-Test Supplier'}, {contact_person: 'Contact 3-Test Supplier'},
{taxes_and_charges: 'TEST In State GST'}, {taxes_and_charges: 'TEST In State GST - FT'},
{tc_name: 'Test Term 1'}, {tc_name: 'Test Term 1'},
{terms: 'This is Test'} {terms: 'This is Test'},
{payment_terms_template: '_Test Payment Term Template UI'}
]); ]);
}, },
() => cur_frm.save(), () => cur_frm.save(),
@ -28,13 +29,43 @@ QUnit.test("test purchase invoice", function(assert) {
// get_item_details // get_item_details
assert.ok(cur_frm.doc.items[0].item_name=='Test Product 1', "Item name correct"); assert.ok(cur_frm.doc.items[0].item_name=='Test Product 1', "Item name correct");
// get tax details // get tax details
assert.ok(cur_frm.doc.taxes_and_charges=='TEST In State GST', "Tax details correct"); assert.ok(cur_frm.doc.taxes_and_charges=='TEST In State GST - FT', "Tax details correct");
// get tax account head details // get tax account head details
assert.ok(cur_frm.doc.taxes[0].account_head=='CGST - '+frappe.get_abbr(frappe.defaults.get_default('Company')), " Account Head abbr correct"); assert.ok(cur_frm.doc.taxes[0].account_head=='CGST - '+frappe.get_abbr(frappe.defaults.get_default('Company')), " Account Head abbr correct");
// grand_total Calculated // grand_total Calculated
assert.ok(cur_frm.doc.grand_total==590, "Grad Total correct"); assert.ok(cur_frm.doc.grand_total==590, "Grad Total correct");
assert.ok(cur_frm.doc.payment_terms_template, "Payment Terms Template is correct");
assert.ok(cur_frm.doc.payment_schedule.length > 0, "Payment Term Schedule is not empty");
}, },
() => {
let date = cur_frm.doc.due_date;
frappe.tests.set_control('due_date', frappe.datetime.add_days(date, 1));
frappe.timeout(0.5);
assert.ok(cur_dialog && cur_dialog.is_visible, 'Message is displayed to user');
},
() => frappe.timeout(1),
() => frappe.tests.click_button('Close'),
() => frappe.timeout(0.5),
() => frappe.tests.set_form_values(cur_frm, [{'payment_terms_schedule': ''}]),
() => {
let date = cur_frm.doc.due_date;
frappe.tests.set_control('due_date', frappe.datetime.add_days(date, 1));
frappe.timeout(0.5);
assert.ok(cur_dialog && cur_dialog.is_visible, 'Message is displayed to user');
},
() => frappe.timeout(1),
() => frappe.tests.click_button('Close'),
() => frappe.timeout(0.5),
() => frappe.tests.set_form_values(cur_frm, [{'payment_schedule': []}]),
() => {
let date = cur_frm.doc.due_date;
frappe.tests.set_control('due_date', frappe.datetime.add_days(date, 1));
frappe.timeout(0.5);
assert.ok(!cur_dialog, 'Message is not shown');
},
() => cur_frm.save(),
() => frappe.tests.click_button('Submit'), () => frappe.tests.click_button('Submit'),
() => frappe.tests.click_button('Yes'), () => frappe.tests.click_button('Yes'),
() => frappe.timeout(1), () => frappe.timeout(1),

View File

@ -6,15 +6,16 @@ from __future__ import unicode_literals
import unittest import unittest
import frappe, erpnext import frappe, erpnext
import frappe.model import frappe.model
from frappe.utils import cint, flt, today, nowdate from frappe.utils import cint, flt, today, nowdate, add_days
import frappe.defaults import frappe.defaults
from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import set_perpetual_inventory, \ from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import set_perpetual_inventory, \
test_records as pr_test_records test_records as pr_test_records
from erpnext.controllers.accounts_controller import get_payment_terms
from erpnext.exceptions import InvalidCurrency from erpnext.exceptions import InvalidCurrency
from erpnext.stock.doctype.stock_entry.test_stock_entry import get_qty_after_transaction from erpnext.stock.doctype.stock_entry.test_stock_entry import get_qty_after_transaction
from erpnext.accounts.doctype.account.test_account import get_inventory_account from erpnext.accounts.doctype.account.test_account import get_inventory_account
test_dependencies = ["Item", "Cost Center"] test_dependencies = ["Item", "Cost Center", "Payment Term", "Payment Terms Template"]
test_ignore = ["Serial No"] test_ignore = ["Serial No"]
class TestPurchaseInvoice(unittest.TestCase): class TestPurchaseInvoice(unittest.TestCase):
@ -26,6 +27,7 @@ class TestPurchaseInvoice(unittest.TestCase):
unlink_payment_on_cancel_of_invoice(0) unlink_payment_on_cancel_of_invoice(0)
def test_gl_entries_without_perpetual_inventory(self): def test_gl_entries_without_perpetual_inventory(self):
frappe.db.set_value("Company", "_Test Company", "round_off_account", "Round Off - _TC")
wrapper = frappe.copy_doc(test_records[0]) wrapper = frappe.copy_doc(test_records[0])
set_perpetual_inventory(0, wrapper.company) set_perpetual_inventory(0, wrapper.company)
self.assertTrue(not cint(erpnext.is_perpetual_inventory_enabled(wrapper.company))) self.assertTrue(not cint(erpnext.is_perpetual_inventory_enabled(wrapper.company)))
@ -35,7 +37,7 @@ class TestPurchaseInvoice(unittest.TestCase):
dl = wrapper dl = wrapper
expected_gl_entries = { 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 Cost for Goods Sold - _TC": [1250, 0],
"_Test Account Shipping Charges - _TC": [100, 0], "_Test Account Shipping Charges - _TC": [100, 0],
"_Test Account Excise Duty - _TC": [140, 0], "_Test Account Excise Duty - _TC": [140, 0],
@ -44,6 +46,7 @@ class TestPurchaseInvoice(unittest.TestCase):
"_Test Account CST - _TC": [29.88, 0], "_Test Account CST - _TC": [29.88, 0],
"_Test Account VAT - _TC": [156.25, 0], "_Test Account VAT - _TC": [156.25, 0],
"_Test Account Discount - _TC": [0, 168.03], "_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` 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) where voucher_type = 'Purchase Invoice' and voucher_no = %s""", dl.name, as_dict=1)
@ -61,6 +64,12 @@ class TestPurchaseInvoice(unittest.TestCase):
set_perpetual_inventory(0, pi.company) set_perpetual_inventory(0, pi.company)
def test_terms_added_after_save(self):
pi = frappe.copy_doc(test_records[1])
pi.insert()
self.assertTrue(pi.payment_schedule)
self.assertEqual(pi.payment_schedule[0].due_date, pi.due_date)
def test_payment_entry_unlink_against_purchase_invoice(self): def test_payment_entry_unlink_against_purchase_invoice(self):
from erpnext.accounts.doctype.payment_entry.test_payment_entry import get_payment_entry from erpnext.accounts.doctype.payment_entry.test_payment_entry import get_payment_entry
unlink_payment_on_cancel_of_invoice(0) unlink_payment_on_cancel_of_invoice(0)
@ -233,6 +242,7 @@ class TestPurchaseInvoice(unittest.TestCase):
jv.submit() jv.submit()
pi = frappe.copy_doc(test_records[0]) pi = frappe.copy_doc(test_records[0])
pi.disable_rounded_total = 1
pi.append("advances", { pi.append("advances", {
"reference_type": "Journal Entry", "reference_type": "Journal Entry",
"reference_name": jv.name, "reference_name": jv.name,
@ -242,6 +252,14 @@ class TestPurchaseInvoice(unittest.TestCase):
"remarks": jv.remark "remarks": jv.remark
}) })
pi.insert() pi.insert()
self.assertEqual(pi.outstanding_amount, 1212.30)
pi.disable_rounded_total = 0
pi.get("payment_schedule")[0].payment_amount = 1512.0
pi.save()
self.assertEqual(pi.outstanding_amount, 1212.0)
pi.submit() pi.submit()
pi.load_from_db() pi.load_from_db()
@ -249,13 +267,61 @@ class TestPurchaseInvoice(unittest.TestCase):
where reference_type='Purchase Invoice' where reference_type='Purchase Invoice'
and reference_name=%s and debit_in_account_currency=300""", pi.name)) and reference_name=%s and debit_in_account_currency=300""", pi.name))
self.assertEqual(pi.outstanding_amount, 1212.30)
pi.cancel() pi.cancel()
self.assertFalse(frappe.db.sql("""select name from `tabJournal Entry Account` self.assertFalse(frappe.db.sql("""select name from `tabJournal Entry Account`
where reference_type='Purchase Invoice' and reference_name=%s""", pi.name)) where reference_type='Purchase Invoice' and reference_name=%s""", pi.name))
def test_invoice_with_advance_and_multi_payment_terms(self):
from erpnext.accounts.doctype.journal_entry.test_journal_entry \
import test_records as jv_test_records
jv = frappe.copy_doc(jv_test_records[1])
jv.insert()
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,
"reference_row": jv.get("accounts")[0].name,
"advance_amount": 400,
"allocated_amount": 300,
"remarks": jv.remark
})
pi.insert()
pi.update({
"payment_schedule": get_payment_terms("_Test Payment Term Template",
pi.posting_date, pi.grand_total)
})
pi.save()
pi.submit()
self.assertEqual(pi.payment_schedule[0].payment_amount, 756.15)
self.assertEqual(pi.payment_schedule[0].due_date, pi.posting_date)
self.assertEqual(pi.payment_schedule[1].payment_amount, 756.15)
self.assertEqual(pi.payment_schedule[1].due_date, add_days(pi.posting_date, 30))
pi.load_from_db()
self.assertTrue(
frappe.db.sql(
"select name from `tabJournal Entry Account` 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` where reference_type='Purchase Invoice' and "
"reference_name=%s", pi.name)
)
def test_total_purchase_cost_for_project(self): def test_total_purchase_cost_for_project(self):
existing_purchase_cost = frappe.db.sql("""select sum(base_net_amount) existing_purchase_cost = frappe.db.sql("""select sum(base_net_amount)
from `tabPurchase Invoice Item` where project = '_Test Project' and docstatus=1""") from `tabPurchase Invoice Item` where project = '_Test Project' and docstatus=1""")
@ -473,6 +539,7 @@ class TestPurchaseInvoice(unittest.TestCase):
import test_records as jv_test_records import test_records as jv_test_records
jv = frappe.copy_doc(jv_test_records[1]) jv = frappe.copy_doc(jv_test_records[1])
jv.accounts[0].is_advance = 'Yes'
jv.insert() jv.insert()
jv.submit() jv.submit()
@ -490,7 +557,7 @@ class TestPurchaseInvoice(unittest.TestCase):
pi.load_from_db() pi.load_from_db()
#check outstanding after advance allocation #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 #added to avoid Document has been modified exception
jv = frappe.get_doc("Journal Entry", jv.name) jv = frappe.get_doc("Journal Entry", jv.name)
@ -498,7 +565,7 @@ class TestPurchaseInvoice(unittest.TestCase):
pi.load_from_db() pi.load_from_db()
#check outstanding after advance cancellation #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): def test_outstanding_amount_after_advance_payment_entry_cancelation(self):
pe = frappe.get_doc({ pe = frappe.get_doc({
@ -520,7 +587,7 @@ class TestPurchaseInvoice(unittest.TestCase):
}) })
pe.insert() pe.insert()
pe.submit() pe.submit()
pi = frappe.copy_doc(test_records[0]) pi = frappe.copy_doc(test_records[0])
pi.is_pos = 0 pi.is_pos = 0
pi.append("advances", { pi.append("advances", {
@ -533,19 +600,69 @@ class TestPurchaseInvoice(unittest.TestCase):
}) })
pi.insert() pi.insert()
pi.submit() pi.submit()
pi.load_from_db() pi.load_from_db()
#check outstanding after advance allocation #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 #added to avoid Document has been modified exception
pe = frappe.get_doc("Payment Entry", pe.name) pe = frappe.get_doc("Payment Entry", pe.name)
pe.cancel() pe.cancel()
pi.load_from_db() pi.load_from_db()
#check outstanding after advance cancellation #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_purchase_invoice_with_shipping_rule(self):
from erpnext.accounts.doctype.shipping_rule.test_shipping_rule \
import create_shipping_rule
shipping_rule = create_shipping_rule(shipping_rule_type = "Buying", shipping_rule_name = "Shipping Rule - Purchase Invoice Test")
pi = frappe.copy_doc(test_records[0])
pi.shipping_rule = shipping_rule.name
pi.insert()
shipping_amount = 0.0
for condition in shipping_rule.get("conditions"):
if not condition.to_value or (flt(condition.from_value) <= pi.net_total <= flt(condition.to_value)):
shipping_amount = condition.shipping_amount
shipping_charge = {
"doctype": "Purchase Taxes and Charges",
"category": "Valuation and Total",
"charge_type": "Actual",
"account_head": shipping_rule.account,
"cost_center": shipping_rule.cost_center,
"tax_amount": shipping_amount,
"description": shipping_rule.name,
"add_deduct_tax": "Add"
}
pi.append("taxes", shipping_charge)
pi.save()
self.assertEquals(pi.net_total, 1250)
self.assertEquals(pi.total_taxes_and_charges, 462.3)
self.assertEquals(pi.grand_total, 1712.3)
def test_make_pi_without_terms(self):
pi = make_purchase_invoice(do_not_save=1)
self.assertFalse(pi.get('payment_schedule'))
pi.insert()
self.assertTrue(pi.get('payment_schedule'))
def test_duplicate_due_date_in_terms(self):
pi = make_purchase_invoice(do_not_save=1)
pi.append('payment_schedule', dict(due_date='2017-01-01', invoice_portion=50.00, payment_amount=50))
pi.append('payment_schedule', dict(due_date='2017-01-01', invoice_portion=50.00, payment_amount=50))
self.assertRaises(frappe.ValidationError, pi.insert)
def unlink_payment_on_cancel_of_invoice(enable=1): def unlink_payment_on_cancel_of_invoice(enable=1):
accounts_settings = frappe.get_doc("Accounts Settings") accounts_settings = frappe.get_doc("Accounts Settings")

View File

@ -13,6 +13,7 @@
"editable_grid": 1, "editable_grid": 1,
"fields": [ "fields": [
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 1, "bold": 1,
"collapsible": 0, "collapsible": 0,
@ -44,6 +45,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -71,6 +73,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -101,6 +104,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 1, "collapsible": 1,
@ -130,6 +134,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -162,6 +167,7 @@
"width": "300px" "width": "300px"
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -191,6 +197,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -221,6 +228,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -249,6 +257,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -278,6 +287,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 1, "bold": 1,
"collapsible": 0, "collapsible": 0,
@ -308,6 +318,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -337,6 +348,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -367,6 +379,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -394,6 +407,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -412,17 +426,19 @@
"no_copy": 0, "no_copy": 0,
"options": "UOM", "options": "UOM",
"permlevel": 0, "permlevel": 0,
"precision": "",
"print_hide": 1, "print_hide": 1,
"print_hide_if_no_value": 0, "print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"remember_last_selected_value": 0, "remember_last_selected_value": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 1,
"search_index": 0, "search_index": 0,
"set_only_once": 0, "set_only_once": 0,
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -436,21 +452,23 @@
"in_global_search": 0, "in_global_search": 0,
"in_list_view": 0, "in_list_view": 0,
"in_standard_filter": 0, "in_standard_filter": 0,
"label": "Conversion Factor", "label": "UOM Conversion Factor",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
"permlevel": 0, "permlevel": 0,
"precision": "",
"print_hide": 1, "print_hide": 1,
"print_hide_if_no_value": 0, "print_hide_if_no_value": 0,
"read_only": 0, "read_only": 1,
"remember_last_selected_value": 0, "remember_last_selected_value": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 1,
"search_index": 0, "search_index": 0,
"set_only_once": 0, "set_only_once": 0,
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -474,12 +492,13 @@
"read_only": 1, "read_only": 1,
"remember_last_selected_value": 0, "remember_last_selected_value": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 1,
"search_index": 0, "search_index": 0,
"set_only_once": 0, "set_only_once": 0,
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -507,6 +526,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -536,6 +556,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -565,6 +586,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -592,6 +614,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -621,6 +644,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -648,6 +672,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 1, "bold": 1,
"collapsible": 0, "collapsible": 0,
@ -679,6 +704,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -710,6 +736,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -737,6 +764,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -768,6 +796,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -799,6 +828,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -828,6 +858,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -856,6 +887,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -886,6 +918,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -916,6 +949,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -944,6 +978,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -974,6 +1009,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -1004,6 +1040,157 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 1,
"columns": 0,
"fieldname": "item_weight_details",
"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": "Item Weight Details",
"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": "weight_per_unit",
"fieldtype": "Float",
"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": "Weight Per Unit",
"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": "total_weight",
"fieldtype": "Float",
"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 Weight",
"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,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "column_break_38",
"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": "weight_uom",
"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": "Weight UOM",
"length": 0,
"no_copy": 0,
"options": "UOM",
"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, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -1033,6 +1220,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -1064,6 +1252,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -1094,6 +1283,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -1125,6 +1315,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -1155,6 +1346,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -1184,6 +1376,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -1213,6 +1406,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -1242,6 +1436,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -1270,6 +1465,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -1303,6 +1499,7 @@
"width": "120px" "width": "120px"
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -1330,6 +1527,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -1359,6 +1557,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -1394,6 +1593,7 @@
"width": "120px" "width": "120px"
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -1422,6 +1622,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -1451,6 +1652,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -1481,6 +1683,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -1513,6 +1716,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -1544,6 +1748,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -1575,6 +1780,7 @@
"width": "150px" "width": "150px"
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -1606,6 +1812,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -1636,6 +1843,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -1663,6 +1871,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -1692,6 +1901,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -1723,6 +1933,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -1753,6 +1964,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -1784,6 +1996,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 1, "allow_on_submit": 1,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -1812,6 +2025,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -1842,6 +2056,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 1, "allow_on_submit": 1,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -1871,6 +2086,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -1900,6 +2116,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_on_submit": 1, "allow_on_submit": 1,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@ -1939,7 +2156,7 @@
"issingle": 0, "issingle": 0,
"istable": 1, "istable": 1,
"max_attachments": 0, "max_attachments": 0,
"modified": "2017-04-19 11:54:16.112134", "modified": "2017-11-30 14:21:00.962126",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Purchase Invoice Item", "name": "Purchase Invoice Item",
@ -1953,4 +2170,4 @@
"sort_order": "DESC", "sort_order": "DESC",
"track_changes": 0, "track_changes": 0,
"track_seen": 0 "track_seen": 0
} }

View File

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

View File

@ -3,6 +3,7 @@
# License: GNU General Public License v3. See license.txt # License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe
from frappe.model.document import Document from frappe.model.document import Document
from erpnext.accounts.doctype.sales_taxes_and_charges_template.sales_taxes_and_charges_template \ from erpnext.accounts.doctype.sales_taxes_and_charges_template.sales_taxes_and_charges_template \
import valdiate_taxes_and_charges_template import valdiate_taxes_and_charges_template
@ -10,3 +11,8 @@ from erpnext.accounts.doctype.sales_taxes_and_charges_template.sales_taxes_and_c
class PurchaseTaxesandChargesTemplate(Document): class PurchaseTaxesandChargesTemplate(Document):
def validate(self): def validate(self):
valdiate_taxes_and_charges_template(self) valdiate_taxes_and_charges_template(self)
def autoname(self):
if self.company and self.title:
abbr = frappe.db.get_value('Company', self.company, 'abbr')
self.name = '{0} - {1}'.format(self.title, abbr)

View File

@ -1,7 +1,7 @@
QUnit.module('Sales Taxes and Charges Template'); QUnit.module('Sales Taxes and Charges Template');
QUnit.test("test sales taxes and charges template", function(assert) { QUnit.test("test sales taxes and charges template", function(assert) {
assert.expect(1); assert.expect(2);
let done = assert.async(); let done = assert.async();
frappe.run_serially([ frappe.run_serially([
() => { () => {
@ -19,7 +19,10 @@ QUnit.test("test sales taxes and charges template", function(assert) {
]} ]}
]); ]);
}, },
() => {assert.ok(cur_frm.doc.title=='TEST In State GST');}, () => {
assert.ok(cur_frm.doc.title=='TEST In State GST');
assert.ok(cur_frm.doc.name=='TEST In State GST - FT');
},
() => done() () => done()
]); ]);
}); });

View File

@ -16,6 +16,8 @@ def get_pos_data():
doc = frappe.new_doc('Sales Invoice') doc = frappe.new_doc('Sales Invoice')
doc.is_pos = 1; doc.is_pos = 1;
pos_profile = get_pos_profile(doc.company) or {} pos_profile = get_pos_profile(doc.company) or {}
if not pos_profile:
frappe.throw(_("POS Profile is required to use Point-of-Sale"))
if not doc.company: doc.company = pos_profile.get('company') if not doc.company: doc.company = pos_profile.get('company')
doc.update_stock = pos_profile.get('update_stock') doc.update_stock = pos_profile.get('update_stock')
@ -88,10 +90,11 @@ def update_pos_profile_data(doc, pos_profile, company_data):
doc.naming_series = pos_profile.get('naming_series') or 'SINV-' doc.naming_series = pos_profile.get('naming_series') or 'SINV-'
doc.letter_head = pos_profile.get('letter_head') or company_data.default_letter_head doc.letter_head = pos_profile.get('letter_head') or company_data.default_letter_head
doc.ignore_pricing_rule = pos_profile.get('ignore_pricing_rule') or 0 doc.ignore_pricing_rule = pos_profile.get('ignore_pricing_rule') or 0
doc.apply_discount_on = pos_profile.get('apply_discount_on') or '' doc.apply_discount_on = pos_profile.get('apply_discount_on') or 'Grand Total'
doc.customer_group = pos_profile.get('customer_group') or get_root('Customer Group') doc.customer_group = pos_profile.get('customer_group') or get_root('Customer Group')
doc.territory = pos_profile.get('territory') or get_root('Territory') doc.territory = pos_profile.get('territory') or get_root('Territory')
doc.terms = frappe.db.get_value('Terms and Conditions', pos_profile.get('tc_name'), 'terms') or doc.terms or '' doc.terms = frappe.db.get_value('Terms and Conditions', pos_profile.get('tc_name'), 'terms') or doc.terms or ''
doc.offline_pos_name = ''
def get_root(table): def get_root(table):
root = frappe.db.sql(""" select name from `tab%(table)s` having root = frappe.db.sql(""" select name from `tab%(table)s` having
@ -486,17 +489,21 @@ def submit_invoice(si_doc, name, doc, name_list):
if frappe.message_log: frappe.message_log.pop() if frappe.message_log: frappe.message_log.pop()
frappe.db.rollback() frappe.db.rollback()
frappe.log_error(frappe.get_traceback()) frappe.log_error(frappe.get_traceback())
name_list = save_invoice(e, si_doc, name, name_list) name_list = save_invoice(doc, name, name_list)
return name_list return name_list
def save_invoice(e, si_doc, name, name_list): def save_invoice(doc, name, name_list):
try: try:
if not frappe.db.exists('Sales Invoice', {'offline_pos_name': name}): if not frappe.db.exists('Sales Invoice', {'offline_pos_name': name}):
si_doc.docstatus = 0 si = frappe.new_doc('Sales Invoice')
si_doc.flags.ignore_mandatory = True si.update(doc)
si_doc.due_date = si_doc.posting_date si.set_posting_time = 1
si_doc.insert() si.customer = get_customer_id(doc)
si.due_date = doc.get('posting_date')
si.flags.ignore_mandatory = True
si.insert(ignore_permissions=True)
frappe.db.commit()
name_list.append(name) name_list.append(name)
except Exception: except Exception:
frappe.log_error(frappe.get_traceback()) frappe.log_error(frappe.get_traceback())

View File

@ -95,8 +95,9 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
// Show buttons only when pos view is active // Show buttons only when pos view is active
if (cint(doc.docstatus==0) && cur_frm.page.current_view_name!=="pos" && !doc.is_return) { if (cint(doc.docstatus==0) && cur_frm.page.current_view_name!=="pos" && !doc.is_return) {
cur_frm.cscript.sales_order_btn(); this.frm.cscript.sales_order_btn();
cur_frm.cscript.delivery_note_btn(); this.frm.cscript.delivery_note_btn();
this.frm.cscript.quotation_btn();
} }
this.set_default_print_format(); this.set_default_print_format();
@ -158,6 +159,26 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
}, __("Get items from")); }, __("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() { delivery_note_btn: function() {
var me = this; var me = this;
this.$delivery_note_btn = this.frm.add_custom_button(__('Delivery Note'), this.$delivery_note_btn = this.frm.add_custom_button(__('Delivery Note'),
@ -277,7 +298,7 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
var row = locals[cdt][cdn]; var row = locals[cdt][cdn];
if(row.asset) { if(row.asset) {
frappe.call({ frappe.call({
method: erpnext.accounts.doctype.asset.depreciation.get_disposal_account_and_cost_center, method: erpnext.assets.doctype.asset.depreciation.get_disposal_account_and_cost_center,
args: { args: {
"company": frm.doc.company "company": frm.doc.company
}, },
@ -290,6 +311,14 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
}, },
is_pos: function(frm){ is_pos: function(frm){
this.set_pos_data();
},
pos_profile: function() {
this.set_pos_data();
},
set_pos_data: function() {
if(this.frm.doc.is_pos) { if(this.frm.doc.is_pos) {
if(!this.frm.doc.company) { if(!this.frm.doc.company) {
this.frm.set_value("is_pos", 0); this.frm.set_value("is_pos", 0);
@ -302,7 +331,7 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
callback: function(r) { callback: function(r) {
if(!r.exc) { if(!r.exc) {
if(r.message && r.message.print_format) { if(r.message && r.message.print_format) {
frm.pos_print_format = r.message.print_format; me.frm.pos_print_format = r.message.print_format;
} }
me.frm.script_manager.trigger("update_stock"); me.frm.script_manager.trigger("update_stock");
frappe.model.set_default_values(me.frm.doc); frappe.model.set_default_values(me.frm.doc);
@ -519,6 +548,19 @@ frappe.ui.form.on('Sales Invoice', {
} }
}; };
}); });
frm.set_query('pos_profile', function(doc) {
if(!doc.company) {
frappe.throw(_('Please set Company'));
}
return {
query: 'erpnext.accounts.doctype.pos_profile.pos_profile.pos_profile_query',
filters: {
company: doc.company
}
};
});
}, },
//When multiple companies are set up. in case company name is changed set default company address //When multiple companies are set up. in case company name is changed set default company address
company:function(frm){ company:function(frm){
@ -586,3 +628,4 @@ var calculate_total_billing_amount = function(frm) {
refresh_field('total_billing_amount') refresh_field('total_billing_amount')
} }

View File

@ -160,6 +160,7 @@
"no_copy": 0, "no_copy": 0,
"oldfieldname": "customer_name", "oldfieldname": "customer_name",
"oldfieldtype": "Data", "oldfieldtype": "Data",
"options": "customer.customer_name",
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0, "print_hide_if_no_value": 0,
@ -270,8 +271,40 @@
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0, "columns": 0,
"fieldname": "offline_pos_name", "depends_on": "is_pos",
"fieldtype": "Data", "fieldname": "pos_profile",
"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": "POS Profile",
"length": 0,
"no_copy": 0,
"options": "POS Profile",
"permlevel": 0,
"precision": "",
"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,
"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": 1, "hidden": 1,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
@ -279,7 +312,7 @@
"in_global_search": 0, "in_global_search": 0,
"in_list_view": 0, "in_list_view": 0,
"in_standard_filter": 0, "in_standard_filter": 0,
"label": "Offline POS Name", "label": "Allow Print Before Pay ",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
"permlevel": 0, "permlevel": 0,
@ -300,8 +333,8 @@
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0, "columns": 0,
"fieldname": "pos_profile", "fieldname": "offline_pos_name",
"fieldtype": "Link", "fieldtype": "Data",
"hidden": 1, "hidden": 1,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
@ -309,15 +342,14 @@
"in_global_search": 0, "in_global_search": 0,
"in_list_view": 0, "in_list_view": 0,
"in_standard_filter": 0, "in_standard_filter": 0,
"label": "POS Profile", "label": "Offline POS Name",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
"options": "POS Profile",
"permlevel": 0, "permlevel": 0,
"precision": "", "precision": "",
"print_hide": 1, "print_hide": 1,
"print_hide_if_no_value": 0, "print_hide_if_no_value": 0,
"read_only": 0, "read_only": 1,
"remember_last_selected_value": 0, "remember_last_selected_value": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
@ -368,7 +400,7 @@
"in_filter": 0, "in_filter": 0,
"in_global_search": 0, "in_global_search": 0,
"in_list_view": 0, "in_list_view": 0,
"in_standard_filter": 0, "in_standard_filter": 1,
"label": "Company", "label": "Company",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
@ -400,7 +432,7 @@
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_global_search": 0, "in_global_search": 0,
"in_list_view": 0, "in_list_view": 1,
"in_standard_filter": 0, "in_standard_filter": 0,
"label": "Date", "label": "Date",
"length": 0, "length": 0,
@ -501,7 +533,7 @@
"oldfieldname": "due_date", "oldfieldname": "due_date",
"oldfieldtype": "Date", "oldfieldtype": "Date",
"permlevel": 0, "permlevel": 0,
"print_hide": 1, "print_hide": 0,
"print_hide_if_no_value": 0, "print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"remember_last_selected_value": 0, "remember_last_selected_value": 0,
@ -1731,6 +1763,36 @@
"set_only_once": 0, "set_only_once": 0,
"unique": 0 "unique": 0
}, },
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "total_net_weight",
"fieldtype": "Float",
"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 Net Weight",
"length": 0,
"no_copy": 0,
"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_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
@ -2747,6 +2809,101 @@
"set_only_once": 0, "set_only_once": 0,
"unique": 0 "unique": 0
}, },
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 1,
"collapsible_depends_on": "eval:(!doc.is_pos && !doc.is_return)",
"columns": 0,
"fieldname": "payment_schedule_section",
"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": "Payment Terms",
"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,
"depends_on": "eval:(!doc.is_pos && !doc.is_return)",
"fieldname": "payment_terms_template",
"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": "Payment Terms Template",
"length": 0,
"no_copy": 0,
"options": "Payment Terms Template",
"permlevel": 0,
"precision": "",
"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,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "eval:(!doc.is_pos && !doc.is_return)",
"fieldname": "payment_schedule",
"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": "Payment Schedule",
"length": 0,
"no_copy": 1,
"options": "Payment Schedule",
"permlevel": 0,
"precision": "",
"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,
"set_only_once": 0,
"unique": 0
},
{ {
"allow_bulk_edit": 0, "allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
@ -3001,6 +3158,7 @@
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0, "columns": 0,
"depends_on": "is_pos",
"fieldname": "base_change_amount", "fieldname": "base_change_amount",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -3061,6 +3219,7 @@
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0, "columns": 0,
"depends_on": "is_pos",
"fieldname": "change_amount", "fieldname": "change_amount",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@ -3092,6 +3251,7 @@
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0, "columns": 0,
"depends_on": "is_pos",
"fieldname": "account_for_change_amount", "fieldname": "account_for_change_amount",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -4273,414 +4433,7 @@
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0, "columns": 0,
"fieldname": "subscription", "depends_on": "",
"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": "Subscription",
"length": 0,
"no_copy": 1,
"options": "Subscription",
"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": 1,
"collapsible_depends_on": "is_recurring",
"columns": 0,
"depends_on": "eval:doc.docstatus<2 && !doc.__islocal",
"fieldname": "recurring_invoice",
"fieldtype": "Section Break",
"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": "Recurring Invoice",
"length": 0,
"no_copy": 0,
"options": "fa fa-time",
"permlevel": 0,
"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,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "column_break11",
"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,
"label": "Settings",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"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,
"set_only_once": 0,
"unique": 0,
"width": "50%"
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.docstatus<2",
"description": "",
"fieldname": "is_recurring",
"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": "Is Recurring",
"length": 0,
"no_copy": 1,
"permlevel": 0,
"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,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "is_recurring",
"description": "",
"fieldname": "recurring_id",
"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": "Reference Document",
"length": 0,
"no_copy": 1,
"options": "Sales Invoice",
"permlevel": 0,
"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": 1,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.is_recurring && doc.recurring_id === doc.name",
"description": "",
"fieldname": "recurring_type",
"fieldtype": "Select",
"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": "Frequency",
"length": 0,
"no_copy": 1,
"options": "\nMonthly\nQuarterly\nHalf-yearly\nYearly",
"permlevel": 0,
"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,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.is_recurring && doc.recurring_id === doc.name",
"description": "",
"fieldname": "repeat_on_day_of_month",
"fieldtype": "Int",
"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": "Repeat on Day of Month",
"length": 0,
"no_copy": 1,
"permlevel": 0,
"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,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.is_recurring && doc.recurring_id === doc.name",
"description": "",
"fieldname": "end_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": "End Date",
"length": 0,
"no_copy": 1,
"permlevel": 0,
"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,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.is_recurring && doc.recurring_id === doc.name",
"fieldname": "submit_on_creation",
"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": "Submit on creation",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"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,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.is_recurring && doc.recurring_id === doc.name",
"description": "",
"fieldname": "notify_by_email",
"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": "Notify by email",
"length": 0,
"no_copy": 1,
"permlevel": 0,
"precision": "",
"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,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.is_recurring && doc.notify_by_email && doc.recurring_id === doc.name",
"description": "",
"fieldname": "notification_email_address",
"fieldtype": "Code",
"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": "Notification Email Address",
"length": 0,
"no_copy": 1,
"options": "Email",
"permlevel": 0,
"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,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.is_recurring && doc.notify_by_email && doc.recurring_id === doc.name",
"fieldname": "recurring_print_format",
"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": "Recurring Print Format",
"length": 0,
"no_copy": 0,
"options": "Print Format",
"permlevel": 0,
"precision": "",
"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,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "column_break12",
"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,
"label": "This Document",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"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,
"set_only_once": 0,
"unique": 0,
"width": "50%"
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "is_recurring",
"description": "", "description": "",
"fieldname": "from_date", "fieldname": "from_date",
"fieldtype": "Date", "fieldtype": "Date",
@ -4711,7 +4464,7 @@
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0, "columns": 0,
"depends_on": "is_recurring", "depends_on": "",
"description": "", "description": "",
"fieldname": "to_date", "fieldname": "to_date",
"fieldtype": "Date", "fieldtype": "Date",
@ -4742,10 +4495,8 @@
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0, "columns": 0,
"depends_on": "is_recurring", "fieldname": "column_break_140",
"description": "", "fieldtype": "Column Break",
"fieldname": "next_date",
"fieldtype": "Date",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
@ -4753,11 +4504,11 @@
"in_global_search": 0, "in_global_search": 0,
"in_list_view": 0, "in_list_view": 0,
"in_standard_filter": 0, "in_standard_filter": 0,
"label": "Next Date",
"length": 0, "length": 0,
"no_copy": 1, "no_copy": 0,
"permlevel": 0, "permlevel": 0,
"print_hide": 1, "precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0, "print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"remember_last_selected_value": 0, "remember_last_selected_value": 0,
@ -4767,6 +4518,37 @@
"set_only_once": 0, "set_only_once": 0,
"unique": 0 "unique": 0
}, },
{
"allow_bulk_edit": 0,
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "subscription",
"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": "Subscription",
"length": 0,
"no_copy": 1,
"options": "Subscription",
"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_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
@ -4811,7 +4593,7 @@
"istable": 0, "istable": 0,
"max_attachments": 0, "max_attachments": 0,
"menu_index": 0, "menu_index": 0,
"modified": "2017-09-19 11:23:08.675028", "modified": "2018-01-09 09:48:00.152026",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Sales Invoice", "name": "Sales Invoice",
@ -4909,5 +4691,5 @@
"timeline_field": "customer", "timeline_field": "customer",
"title_field": "title", "title_field": "title",
"track_changes": 1, "track_changes": 1,
"track_seen": 0 "track_seen": 1
} }

View File

@ -15,7 +15,7 @@ from erpnext.controllers.selling_controller import SellingController
from erpnext.accounts.utils import get_account_currency from erpnext.accounts.utils import get_account_currency
from erpnext.stock.doctype.delivery_note.delivery_note import update_billed_amount_based_on_so from erpnext.stock.doctype.delivery_note.delivery_note import update_billed_amount_based_on_so
from erpnext.projects.doctype.timesheet.timesheet import get_projectwise_timesheet_data from erpnext.projects.doctype.timesheet.timesheet import get_projectwise_timesheet_data
from erpnext.accounts.doctype.asset.depreciation \ from erpnext.assets.doctype.asset.depreciation \
import get_disposal_account_and_cost_center, get_gl_entries_on_asset_disposal import get_disposal_account_and_cost_center, get_gl_entries_on_asset_disposal
from erpnext.stock.doctype.batch.batch import set_batch_nos from erpnext.stock.doctype.batch.batch import set_batch_nos
from erpnext.stock.doctype.serial_no.serial_no import get_serial_nos, get_delivery_note_serial_no from erpnext.stock.doctype.serial_no.serial_no import get_serial_nos, get_delivery_note_serial_no
@ -142,7 +142,8 @@ class SalesInvoice(SellingController):
self.update_time_sheet(self.name) self.update_time_sheet(self.name)
self.update_current_month_sales() update_company_current_month_sales(self.company)
self.update_project()
def validate_pos_paid_amount(self): def validate_pos_paid_amount(self):
if len(self.payments) == 0 and self.is_pos: if len(self.payments) == 0 and self.is_pos:
@ -180,14 +181,8 @@ class SalesInvoice(SellingController):
self.make_gl_entries_on_cancel() self.make_gl_entries_on_cancel()
frappe.db.set(self, 'status', 'Cancelled') frappe.db.set(self, 'status', 'Cancelled')
self.update_current_month_sales() update_company_current_month_sales(self.company)
self.update_project()
def update_current_month_sales(self):
if frappe.flags.in_test:
update_company_current_month_sales(self.company)
else:
frappe.enqueue('erpnext.setup.doctype.company.company.update_company_current_month_sales',
company=self.company)
def update_status_updater_args(self): def update_status_updater_args(self):
if cint(self.update_stock): if cint(self.update_stock):
@ -229,12 +224,17 @@ class SalesInvoice(SellingController):
from erpnext.selling.doctype.customer.customer import check_credit_limit from erpnext.selling.doctype.customer.customer import check_credit_limit
validate_against_credit_limit = False validate_against_credit_limit = False
bypass_credit_limit_check_at_sales_order = cint(frappe.db.get_value("Customer", self.customer,
"bypass_credit_limit_check_at_sales_order"))
if bypass_credit_limit_check_at_sales_order:
validate_against_credit_limit = True
for d in self.get("items"): for d in self.get("items"):
if not (d.sales_order or d.delivery_note): if not (d.sales_order or d.delivery_note):
validate_against_credit_limit = True validate_against_credit_limit = True
break break
if validate_against_credit_limit: if validate_against_credit_limit:
check_credit_limit(self.customer, self.company) check_credit_limit(self.customer, self.company, bypass_credit_limit_check_at_sales_order)
def set_missing_values(self, for_validate=False): def set_missing_values(self, for_validate=False):
pos = self.set_pos_fields(for_validate) pos = self.set_pos_fields(for_validate)
@ -247,7 +247,10 @@ class SalesInvoice(SellingController):
super(SalesInvoice, self).set_missing_values(for_validate) super(SalesInvoice, self).set_missing_values(for_validate)
if pos: if pos:
return {"print_format": pos.get("print_format") } return {
"print_format": pos.get("print_format_for_online"),
"allow_edit_rate": pos.get("allow_user_to_edit_rate")
}
def update_time_sheet(self, sales_invoice): def update_time_sheet(self, sales_invoice):
for d in self.timesheets: for d in self.timesheets:
@ -294,20 +297,25 @@ class SalesInvoice(SellingController):
return return
from erpnext.stock.get_item_details import get_pos_profile_item_details, get_pos_profile from erpnext.stock.get_item_details import get_pos_profile_item_details, get_pos_profile
pos = get_pos_profile(self.company) if not self.pos_profile:
pos_profile = get_pos_profile(self.company) or {}
self.pos_profile = pos_profile.get('name')
pos = {}
if self.pos_profile:
pos = frappe.get_doc('POS Profile', self.pos_profile)
if not self.get('payments') and not for_validate: if not self.get('payments') and not for_validate:
pos_profile = frappe.get_doc('POS Profile', pos.name) if pos else None update_multi_mode_option(self, pos)
update_multi_mode_option(self, pos_profile)
if not self.account_for_change_amount: if not self.account_for_change_amount:
self.account_for_change_amount = frappe.db.get_value('Company', self.company, 'default_cash_account') self.account_for_change_amount = frappe.db.get_value('Company', self.company, 'default_cash_account')
if pos: if pos:
self.allow_print_before_pay = pos.allow_print_before_pay
if not for_validate and not self.customer: if not for_validate and not self.customer:
self.customer = pos.customer self.customer = pos.customer
self.mode_of_payment = pos.mode_of_payment
# self.set_customer_defaults()
if pos.get('account_for_change_amount'): if pos.get('account_for_change_amount'):
self.account_for_change_amount = pos.get('account_for_change_amount') self.account_for_change_amount = pos.get('account_for_change_amount')
@ -631,9 +639,10 @@ class SalesInvoice(SellingController):
return gl_entries return gl_entries
def make_customer_gl_entry(self, gl_entries): def make_customer_gl_entry(self, gl_entries):
if self.grand_total: grand_total = self.rounded_total or self.grand_total
if grand_total:
# Didnot use base_grand_total to book rounding loss gle # 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")) self.precision("grand_total"))
gl_entries.append( gl_entries.append(
@ -644,7 +653,7 @@ class SalesInvoice(SellingController):
"against": self.against_income_account, "against": self.against_income_account,
"debit": grand_total_in_company_currency, "debit": grand_total_in_company_currency,
"debit_in_account_currency": 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": self.return_against if cint(self.is_return) else self.name,
"against_voucher_type": self.doctype "against_voucher_type": self.doctype
}, self.party_account_currency) }, self.party_account_currency)
@ -888,6 +897,13 @@ class SalesInvoice(SellingController):
serial_no, sales_invoice serial_no, sales_invoice
))) )))
def update_project(self):
if self.project:
project = frappe.get_doc("Project", self.project)
project.flags.dont_sync_tasks = True
project.update_billed_amount()
project.save()
def get_list_context(context=None): def get_list_context(context=None):
from erpnext.controllers.website_list_for_contact import get_list_context from erpnext.controllers.website_list_for_contact import get_list_context
list_context = get_list_context(context) list_context = get_list_context(context)

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