Compare commits

..

4 Commits

Author SHA1 Message Date
Nabin Hait
6060499ef2 Merge pull request #5907 from nabinhait/opportunity_status_fix
Added status converted in Opportunity
2016-07-28 16:29:04 +05:30
Nabin Hait
27ba588e63 Added status converted in Opportunity 2016-07-28 16:25:46 +05:30
Nabin Hait
ece5077b71 Merge pull request #5890 from nabinhait/sle_fix101
minor fix
2016-07-27 16:33:37 +05:30
Nabin Hait
c85db1cbb2 minor fix 2016-07-27 16:04:18 +05:30
8228 changed files with 367653 additions and 1200804 deletions

View File

@@ -1,14 +0,0 @@
# Root editor config file
root = true
# Common settings
[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8
# python, js indentation settings
[{*.py,*.js}]
indent_style = tab
indent_size = 4

161
.eslintrc
View File

@@ -1,161 +0,0 @@
{
"env": {
"browser": true,
"node": true,
"es6": true
},
"parserOptions": {
"ecmaVersion": 9,
"sourceType": "module"
},
"extends": "eslint:recommended",
"rules": {
"indent": [
"error",
"tab",
{ "SwitchCase": 1 }
],
"brace-style": [
"error",
"1tbs"
],
"space-unary-ops": [
"error",
{ "words": true }
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"off"
],
"semi": [
"warn",
"always"
],
"camelcase": [
"off"
],
"no-unused-vars": [
"warn"
],
"no-redeclare": [
"warn"
],
"no-console": [
"warn"
],
"no-extra-boolean-cast": [
"off"
],
"no-control-regex": [
"off"
],
"space-before-blocks": "warn",
"keyword-spacing": "warn",
"comma-spacing": "warn",
"key-spacing": "warn"
},
"root": true,
"globals": {
"frappe": true,
"Vue": true,
"erpnext": true,
"hub": true,
"$": true,
"jQuery": true,
"moment": true,
"hljs": true,
"Awesomplete": true,
"CalHeatMap": true,
"Sortable": true,
"Showdown": true,
"Taggle": true,
"Gantt": true,
"Slick": true,
"PhotoSwipe": true,
"PhotoSwipeUI_Default": true,
"fluxify": true,
"io": true,
"c3": true,
"__": true,
"_p": true,
"_f": true,
"repl": true,
"Class": true,
"locals": true,
"cint": true,
"cstr": true,
"cur_frm": true,
"cur_dialog": true,
"cur_page": true,
"cur_list": true,
"cur_tree": true,
"cur_pos": true,
"msg_dialog": true,
"is_null": true,
"in_list": true,
"has_common": true,
"has_words": true,
"validate_email": true,
"get_number_format": true,
"format_number": true,
"format_currency": true,
"round_based_on_smallest_currency_fraction": true,
"roundNumber": true,
"comment_when": true,
"replace_newlines": true,
"open_url_post": true,
"toTitle": true,
"lstrip": true,
"strip": true,
"strip_html": true,
"replace_all": true,
"flt": true,
"precision": true,
"md5": true,
"CREATE": true,
"AMEND": true,
"CANCEL": true,
"copy_dict": true,
"get_number_format_info": true,
"print_table": true,
"Layout": true,
"web_form_settings": true,
"$c": true,
"$a": true,
"$i": true,
"$bg": true,
"$y": true,
"$c_obj": true,
"$c_obj_csv": true,
"refresh_many": true,
"refresh_field": true,
"toggle_field": true,
"get_field_obj": true,
"get_query_params": true,
"unhide_field": true,
"hide_field": true,
"set_field_options": true,
"getCookie": true,
"getCookies": true,
"get_url_arg": true,
"get_server_fields": true,
"set_multiple": true,
"QUnit": true,
"Chart": true,
"Cypress": true,
"cy": true,
"describe": true,
"expect": true,
"it": true,
"context": true,
"before": true,
"beforeEach": true,
"onScan": true,
"html2canvas": true,
"extend_cscript": true,
"localforage": true
}
}

33
.flake8
View File

@@ -1,33 +0,0 @@
[flake8]
ignore =
E121,
E126,
E127,
E128,
E203,
E225,
E226,
E231,
E241,
E251,
E261,
E265,
E302,
E303,
E305,
E402,
E501,
E741,
W291,
W292,
W293,
W391,
W503,
W504,
F403,
B007,
B950,
W191,
max-line-length = 200
exclude=.github/helper/semgrep_rules

View File

@@ -1,19 +0,0 @@
# Since version 2.23 (released in August 2019), git-blame has a feature
# to ignore or bypass certain commits.
#
# This file contains a list of commits that are not likely what you
# are looking for in a blame, such as mass reformatting or renaming.
# You can set this file as a default ignore file for blame by running
# the following command.
#
# $ git config blame.ignoreRevsFile .git-blame-ignore-revs
# This commit just changes spaces to tabs for indentation in some files
5f473611bd6ed57703716244a054d3fb5ba9cd23
# Whitespace trimming throughout codebase
9bb69e711a5da43aaf8c8ecb5601aeffd89dbe5a
f0bcb753fb7ebbb64bb0d6906d431d002f0f7d8f
# imports cleanup
4b2be2999f2203493b49bf74c5b440d49e38b5e3

View File

@@ -1,36 +0,0 @@
### Introduction (first timers)
Thank you for your interest in raising an Issue with ERPNext. An Issue could mean a bug report or a request for a missing feature. By raising a bug report, you are contributing to the development of ERPNext and this is the first step of participating in the community. Bug reports are very helpful for developers as they quickly fix the issue before other users start facing it.
Feature requests are also a great way to take the product forward. New ideas can come in any user scenario and the issue list also acts a roadmap of future features.
When you are raising an Issue, you should keep a few things in mind. Remember that the developer does not have access to your machine so you must give all the information you can while raising an Issue. If you are suggesting a feature, you should be very clear about what you want.
The Issue list is not the right place to ask a question or start a general discussion. If you want to do that , then the right place is the forum [https://discuss.erpnext.com](https://discuss.erpnext.com).
### Reply and Closing Policy
If your issue is not clear or does not meet the guidelines, then it will be closed. If it is closed, please supply the information asked and re-open it.
### General Issue Guidelines
1. **Search existing Issues:** Before raising a Issue, search if it has been raised before. Maybe add a 👍 or give additional help by creating a mockup if it is not already created.
1. **Report each issue separately:** Don't club multiple, unreleated issues in one note.
1. **Brief:** Please don't include long explanations. Use screenshots and bullet points instead of descriptive paragraphs.
### Bug Report Guidelines
1. **Steps to Reproduce:** The bug report must have a list of steps needed to reproduce a bug. If we cannot reproduce it, then we cannot solve it.
1. **Version Number:** Please add the version number in your report. Often a bug is fixed in the latest version
1. **Clear Title:** Add a clear subject to your bug report like "Unable to submit Purchase Order without Basic Rate" instead of just "Cannot Submit"
1. **Screenshots:** Screenshots are a great way of communicating the issues. Try adding annotations or using LiceCAP to take a screencast in `gif`.
### Feature Request Guidelines
1. **Clarity:** Clearly specify how do you want the feature to behave. Don't just say "I would like multiple PDF formats", say that "Ability to add multiple print formats for customers with different languages".
1. **Solution:** Try and identify how the feature should look like.
1. **Mockups:** Mockups are a great way to explain your requirement.
### What if my Issue is closed
Don't worry, take the feedback, supply the correct information and re-open it!

View File

@@ -1,47 +0,0 @@
---
name: Bug report
about: Report a bug encountered while using ERPNext
labels: bug
---
<!--
Welcome to ERPNext issue tracker! Before creating an issue, please heed the following:
1. This tracker should only be used to report bugs and request features / enhancements to ERPNext
- For questions and general support, checkout the manual https://erpnext.com/docs/user/manual/en or use https://discuss.erpnext.com
- For documentation issues, refer to https://github.com/frappe/erpnext_com
2. Use the search function before creating a new issue. Duplicates will be closed and directed to
the original discussion.
3. When making a bug report, make sure you provide all required information. The easier it is for
maintainers to reproduce, the faster it'll be fixed.
4. If you think you know what the reason for the bug is, share it with us. Maybe put in a PR 😉
-->
## Description of the issue
## Context information (for bug reports)
**Output of `bench version`**
```
(paste here)
```
## Steps to reproduce the issue
1.
2.
3.
### Observed result
### Expected result
### Stacktrace / full error message
```
(paste here)
```
## Additional information
OS version / distribution, `ERPNext` install method, etc.

View File

@@ -1,5 +0,0 @@
blank_issues_enabled: false
contact_links:
- name: Community Forum
url: https://discuss.erpnext.com/
about: For general QnA, discussions and community help.

View File

@@ -1,28 +0,0 @@
---
name: Feature request
about: Suggest an idea to improve ERPNext
labels: feature-request
---
<!--
Welcome to ERPNext issue tracker! Before creating an issue, please heed the following:
1. This tracker should only be used to report bugs and request features / enhancements to ERPNext
- For questions and general support, checkout the manual https://erpnext.com/docs/user/manual/en or use https://discuss.erpnext.com
- For documentation issues, refer to https://github.com/frappe/erpnext_com
2. Use the search function before creating a new issue. Duplicates will be closed and directed to
the original discussion.
3. When making a feature request, make sure to be as verbose as possible. The better you convey your message, the greater the drive to make it happen.
-->
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

View File

@@ -1,17 +0,0 @@
---
name: Question about using ERPNext
about: This is not the appropriate channel
labels: invalid
---
Please post on our forums:
for questions about using `ERPNext`: https://discuss.erpnext.com
for questions about using the `Frappe Framework`: ~~https://discuss.frappe.io~~ => [stackoverflow](https://stackoverflow.com/questions/tagged/frappe) tagged under `frappe`
for questions about using `bench`, probably the best place to start is the [bench repo](https://github.com/frappe/bench)
For documentation issues, use the [ERPNext Documentation](https://erpnext.com/docs/) or [Frappe Framework Documentation](https://frappe.io/docs/user/en) or the [developer cheetsheet](https://github.com/frappe/frappe/wiki/Developer-Cheatsheet)
> **Posts that are not bug reports or feature requests will not be addressed on this issue tracker.**

View File

@@ -1,33 +0,0 @@
<!--
Some key notes before you open a PR:
1. Select which branch should this PR be merged in?
2. PR name follows [convention](http://karma-runner.github.io/4.0/dev/git-commit-msg.html)
3. All tests pass locally, UI and Unit tests
4. All business logic and validations must be on the server-side
5. Update necessary Documentation
6. Put `closes #XXXX` in your comment to auto-close the issue that your PR fixes
Also, if you're new here
- Documentation Guidelines => https://github.com/frappe/erpnext/wiki/Updating-Documentation
- Contribution Guide => https://github.com/frappe/erpnext/blob/develop/.github/CONTRIBUTING.md
- Pull Request Checklist => https://github.com/frappe/erpnext/wiki/Pull-Request-Checklist
-->
> Please provide enough information so that others can review your pull request:
<!-- You can skip this if you're fixing a typo or updating existing documentation -->
> Explain the **details** for making this change. What existing problem does the pull request solve?
<!-- Example: When "Adding a function to do X", explain why it is necessary to have a way to do X. -->
> Screenshots/GIFs
<!-- Add images/recordings to better visualize the change: expected/current behviour -->

View File

@@ -1,72 +0,0 @@
[flake8]
ignore =
B007,
B009,
B010,
B950,
E101,
E111,
E114,
E116,
E117,
E121,
E122,
E123,
E124,
E125,
E126,
E127,
E128,
E131,
E201,
E202,
E203,
E211,
E221,
E222,
E223,
E224,
E225,
E226,
E228,
E231,
E241,
E242,
E251,
E261,
E262,
E265,
E266,
E271,
E272,
E273,
E274,
E301,
E302,
E303,
E305,
E306,
E402,
E501,
E502,
E701,
E702,
E703,
E741,
F403,
W191,
W291,
W292,
W293,
W391,
W503,
W504,
E711,
E129,
F841,
E713,
E712,
max-line-length = 200
exclude=.github/helper/semgrep_rules,test_*.py

View File

@@ -1,54 +0,0 @@
import sys
from urllib.parse import urlparse
import requests
docs_repos = [
"frappe_docs",
"erpnext_documentation",
"erpnext_com",
"frappe_io",
]
def uri_validator(x):
result = urlparse(x)
return all([result.scheme, result.netloc, result.path])
def docs_link_exists(body):
for line in body.splitlines():
for word in line.split():
if word.startswith('http') and uri_validator(word):
parsed_url = urlparse(word)
if parsed_url.netloc == "github.com":
parts = parsed_url.path.split('/')
if len(parts) == 5 and parts[1] == "frappe" and parts[2] in docs_repos:
return True
elif parsed_url.netloc == "docs.erpnext.com":
return True
if __name__ == "__main__":
pr = sys.argv[1]
response = requests.get("https://api.github.com/repos/frappe/erpnext/pulls/{}".format(pr))
if response.ok:
payload = response.json()
title = (payload.get("title") or "").lower().strip()
head_sha = (payload.get("head") or {}).get("sha")
body = (payload.get("body") or "").lower()
if (title.startswith("feat")
and head_sha
and "no-docs" not in body
and "backport" not in body
):
if docs_link_exists(body):
print("Documentation Link Found. You're Awesome! 🎉")
else:
print("Documentation Link Not Found! ⚠️")
sys.exit(1)
else:
print("Skipping documentation checks... 🏃")

View File

@@ -1,41 +0,0 @@
#!/bin/bash
set -e
cd ~ || exit
sudo apt-get install redis-server libcups2-dev
pip install frappe-bench
git clone https://github.com/frappe/frappe --branch "${GITHUB_BASE_REF:-${GITHUB_REF##*/}}" --depth 1
bench init --skip-assets --frappe-path ~/frappe --python "$(which python)" frappe-bench
mkdir ~/frappe-bench/sites/test_site
cp -r "${GITHUB_WORKSPACE}/.github/helper/site_config.json" ~/frappe-bench/sites/test_site/
mysql --host 127.0.0.1 --port 3306 -u root -e "SET GLOBAL character_set_server = 'utf8mb4'"
mysql --host 127.0.0.1 --port 3306 -u root -e "SET GLOBAL collation_server = 'utf8mb4_unicode_ci'"
mysql --host 127.0.0.1 --port 3306 -u root -e "CREATE USER 'test_frappe'@'localhost' IDENTIFIED BY 'test_frappe'"
mysql --host 127.0.0.1 --port 3306 -u root -e "CREATE DATABASE test_frappe"
mysql --host 127.0.0.1 --port 3306 -u root -e "GRANT ALL PRIVILEGES ON \`test_frappe\`.* TO 'test_frappe'@'localhost'"
mysql --host 127.0.0.1 --port 3306 -u root -e "UPDATE mysql.user SET Password=PASSWORD('travis') WHERE User='root'"
mysql --host 127.0.0.1 --port 3306 -u root -e "FLUSH PRIVILEGES"
wget -O /tmp/wkhtmltox.tar.xz https://github.com/frappe/wkhtmltopdf/raw/master/wkhtmltox-0.12.3_linux-generic-amd64.tar.xz
tar -xf /tmp/wkhtmltox.tar.xz -C /tmp
sudo mv /tmp/wkhtmltox/bin/wkhtmltopdf /usr/local/bin/wkhtmltopdf
sudo chmod o+x /usr/local/bin/wkhtmltopdf
cd ~/frappe-bench || exit
sed -i 's/watch:/# watch:/g' Procfile
sed -i 's/schedule:/# schedule:/g' Procfile
sed -i 's/socketio:/# socketio:/g' Procfile
sed -i 's/redis_socketio:/# redis_socketio:/g' Procfile
bench get-app erpnext "${GITHUB_WORKSPACE}"
bench start &> bench_run_logs.txt &
bench --site test_site reinstall --yes

View File

@@ -1,38 +0,0 @@
# Semgrep linting
## What is semgrep?
Semgrep or "semantic grep" is language agnostic static analysis tool. In simple terms semgrep is syntax-aware `grep`, so unlike regex it doesn't get confused by different ways of writing same thing or whitespaces or code split in multiple lines etc.
Example:
To check if a translate function is using f-string or not the regex would be `r"_\(\s*f[\"']"` while equivalent rule in semgrep would be `_(f"...")`. As semgrep knows grammer of language it takes care of unnecessary whitespace, type of quotation marks etc.
You can read more such examples in `.github/helper/semgrep_rules` directory.
# Why/when to use this?
We want to maintain quality of contributions, at the same time remembering all the good practices can be pain to deal with while evaluating contributions. Using semgrep if you can translate "best practice" into a rule then it can automate the task for us.
## Running locally
Install semgrep using homebrew `brew install semgrep` or pip `pip install semgrep`.
To run locally use following command:
`semgrep --config=.github/helper/semgrep_rules [file/folder names]`
## Testing
semgrep allows testing the tests. Refer to this page: https://semgrep.dev/docs/writing-rules/testing-rules/
When writing new rules you should write few positive and few negative cases as shown in the guide and current tests.
To run current tests: `semgrep --test --test-ignore-todo .github/helper/semgrep_rules`
## Reference
If you are new to Semgrep read following pages to get started on writing/modifying rules:
- https://semgrep.dev/docs/getting-started/
- https://semgrep.dev/docs/writing-rules/rule-syntax
- https://semgrep.dev/docs/writing-rules/pattern-examples/
- https://semgrep.dev/docs/writing-rules/rule-ideas/#common-use-cases

View File

@@ -1,63 +0,0 @@
import frappe
from frappe import _
from frappe.model.document import Document
# ruleid: frappe-modifying-but-not-comitting
def on_submit(self):
if self.value_of_goods == 0:
frappe.throw(_('Value of goods cannot be 0'))
self.status = 'Submitted'
# ok: frappe-modifying-but-not-comitting
def on_submit(self):
if self.value_of_goods == 0:
frappe.throw(_('Value of goods cannot be 0'))
self.status = 'Submitted'
self.db_set('status', 'Submitted')
# ok: frappe-modifying-but-not-comitting
def on_submit(self):
if self.value_of_goods == 0:
frappe.throw(_('Value of goods cannot be 0'))
x = "y"
self.status = x
self.db_set('status', x)
# ok: frappe-modifying-but-not-comitting
def on_submit(self):
x = "y"
self.status = x
self.save()
# ruleid: frappe-modifying-but-not-comitting-other-method
class DoctypeClass(Document):
def on_submit(self):
self.good_method()
self.tainted_method()
def tainted_method(self):
self.status = "uptate"
# ok: frappe-modifying-but-not-comitting-other-method
class DoctypeClass(Document):
def on_submit(self):
self.good_method()
self.tainted_method()
def tainted_method(self):
self.status = "update"
self.db_set("status", "update")
# ok: frappe-modifying-but-not-comitting-other-method
class DoctypeClass(Document):
def on_submit(self):
self.good_method()
self.tainted_method()
self.save()
def tainted_method(self):
self.status = "uptate"

View File

@@ -1,151 +0,0 @@
# This file specifies rules for correctness according to how frappe doctype data model works.
rules:
- id: frappe-modifying-but-not-comitting
patterns:
- pattern: |
def $METHOD(self, ...):
...
self.$ATTR = ...
- pattern-not: |
def $METHOD(self, ...):
...
self.$ATTR = ...
...
self.db_set(..., self.$ATTR, ...)
- pattern-not: |
def $METHOD(self, ...):
...
self.$ATTR = $SOME_VAR
...
self.db_set(..., $SOME_VAR, ...)
- pattern-not: |
def $METHOD(self, ...):
...
self.$ATTR = $SOME_VAR
...
self.save()
- metavariable-regex:
metavariable: '$ATTR'
# this is negative look-ahead, add more attrs to ignore like (ignore|ignore_this_too|ignore_me)
regex: '^(?!ignore_linked_doctypes|status_updater)(.*)$'
- metavariable-regex:
metavariable: "$METHOD"
regex: "(on_submit|on_cancel)"
message: |
DocType modified in self.$METHOD. Please check if modification of self.$ATTR is commited to database.
languages: [python]
severity: ERROR
- id: frappe-modifying-but-not-comitting-other-method
patterns:
- pattern: |
class $DOCTYPE(...):
def $METHOD(self, ...):
...
self.$ANOTHER_METHOD()
...
def $ANOTHER_METHOD(self, ...):
...
self.$ATTR = ...
- pattern-not: |
class $DOCTYPE(...):
def $METHOD(self, ...):
...
self.$ANOTHER_METHOD()
...
def $ANOTHER_METHOD(self, ...):
...
self.$ATTR = ...
...
self.db_set(..., self.$ATTR, ...)
- pattern-not: |
class $DOCTYPE(...):
def $METHOD(self, ...):
...
self.$ANOTHER_METHOD()
...
def $ANOTHER_METHOD(self, ...):
...
self.$ATTR = $SOME_VAR
...
self.db_set(..., $SOME_VAR, ...)
- pattern-not: |
class $DOCTYPE(...):
def $METHOD(self, ...):
...
self.$ANOTHER_METHOD()
...
self.save()
def $ANOTHER_METHOD(self, ...):
...
self.$ATTR = ...
- metavariable-regex:
metavariable: "$METHOD"
regex: "(on_submit|on_cancel)"
message: |
self.$ANOTHER_METHOD is called from self.$METHOD, check if changes to self.$ATTR are commited to database.
languages: [python]
severity: ERROR
- id: frappe-print-function-in-doctypes
pattern: print(...)
message: |
Did you mean to leave this print statement in? Consider using msgprint or logger instead of print statement.
languages: [python]
severity: WARNING
paths:
include:
- "*/**/doctype/*"
- id: frappe-modifying-child-tables-while-iterating
pattern-either:
- pattern: |
for $ROW in self.$TABLE:
...
self.remove(...)
- pattern: |
for $ROW in self.$TABLE:
...
self.append(...)
message: |
Child table being modified while iterating on it.
languages: [python]
severity: ERROR
paths:
include:
- "*/**/doctype/*"
- id: frappe-same-key-assigned-twice
pattern-either:
- pattern: |
{..., $X: $A, ..., $X: $B, ...}
- pattern: |
dict(..., ($X, $A), ..., ($X, $B), ...)
- pattern: |
_dict(..., ($X, $A), ..., ($X, $B), ...)
message: |
key `$X` is uselessly assigned twice. This could be a potential bug.
languages: [python]
severity: ERROR
- id: frappe-manual-commit
patterns:
- pattern: frappe.db.commit()
- pattern-not-inside: |
try:
...
except ...:
...
message: |
Manually commiting a transaction is highly discouraged. Read about the transaction model implemented by Frappe Framework before adding manual commits: https://frappeframework.com/docs/user/en/api/database#database-transaction-model If you think manual commit is required then add a comment explaining why and `// nosemgrep` on the same line.
paths:
exclude:
- "**/patches/**"
- "**/demo/**"
languages: [python]
severity: ERROR

View File

@@ -1,14 +0,0 @@
from frappe import _
# ruleid: frappe-missing-translate-function-in-report-python
{"label": "Field Label"}
# ruleid: frappe-missing-translate-function-in-report-python
dict(label="Field Label")
# ok: frappe-missing-translate-function-in-report-python
{"label": _("Field Label")}
# ok: frappe-missing-translate-function-in-report-python
dict(label=_("Field Label"))

View File

@@ -1,34 +0,0 @@
rules:
- id: frappe-missing-translate-function-in-report-python
paths:
include:
- "**/report"
exclude:
- "**/regional"
pattern-either:
- patterns:
- pattern: |
{..., "label": "...", ...}
- pattern-not: |
{..., "label": _("..."), ...}
- patterns:
- pattern: dict(..., label="...", ...)
- pattern-not: dict(..., label=_("..."), ...)
message: |
All user facing text must be wrapped in translate function. Please refer to translation documentation. https://frappeframework.com/docs/user/en/guides/basics/translations
languages: [python]
severity: ERROR
- id: frappe-translated-values-in-business-logic
paths:
include:
- "**/report"
patterns:
- pattern-inside: |
{..., filters: [...], ...}
- pattern: |
{..., options: [..., __("..."), ...], ...}
message: |
Using translated values in options field will require you to translate the values while comparing in business logic. Instead of passing translated labels provide objects that contain both label and value. e.g. { label: __("Option value"), value: "Option value"}
languages: [javascript]
severity: ERROR

View File

@@ -1,6 +0,0 @@
def function_name(input):
# ruleid: frappe-codeinjection-eval
eval(input)
# ok: frappe-codeinjection-eval
eval("1 + 1")

View File

@@ -1,10 +0,0 @@
rules:
- id: frappe-codeinjection-eval
patterns:
- pattern-not: eval("...")
- pattern: eval(...)
message: |
Detected the use of eval(). eval() can be dangerous if used to evaluate
dynamic content. Avoid it or use safe_eval().
languages: [python]
severity: ERROR

View File

@@ -1,44 +0,0 @@
// ruleid: frappe-translation-empty-string
__("")
// ruleid: frappe-translation-empty-string
__('')
// ok: frappe-translation-js-formatting
__('Welcome {0}, get started with ERPNext in just a few clicks.', [full_name]);
// ruleid: frappe-translation-js-formatting
__(`Welcome ${full_name}, get started with ERPNext in just a few clicks.`);
// ok: frappe-translation-js-formatting
__('This is fine');
// ok: frappe-translation-trailing-spaces
__('This is fine');
// ruleid: frappe-translation-trailing-spaces
__(' this is not ok ');
// ruleid: frappe-translation-trailing-spaces
__('this is not ok ');
// ruleid: frappe-translation-trailing-spaces
__(' this is not ok');
// ok: frappe-translation-js-splitting
__('You have {0} subscribers in your mailing list.', [subscribers.length])
// todoruleid: frappe-translation-js-splitting
__('You have') + subscribers.length + __('subscribers in your mailing list.')
// ruleid: frappe-translation-js-splitting
__('You have' + 'subscribers in your mailing list.')
// ruleid: frappe-translation-js-splitting
__('You have {0} subscribers' +
'in your mailing list', [subscribers.length])
// ok: frappe-translation-js-splitting
__("Ctrl+Enter to add comment")
// ruleid: frappe-translation-js-splitting
__('You have {0} subscribers \
in your mailing list', [subscribers.length])

View File

@@ -1,61 +0,0 @@
# Examples taken from https://frappeframework.com/docs/user/en/translations
# This file is used for testing the tests.
from frappe import _
full_name = "Jon Doe"
# ok: frappe-translation-python-formatting
_('Welcome {0}, get started with ERPNext in just a few clicks.').format(full_name)
# ruleid: frappe-translation-python-formatting
_('Welcome %s, get started with ERPNext in just a few clicks.' % full_name)
# ruleid: frappe-translation-python-formatting
_('Welcome %(name)s, get started with ERPNext in just a few clicks.' % {'name': full_name})
# ruleid: frappe-translation-python-formatting
_('Welcome {0}, get started with ERPNext in just a few clicks.'.format(full_name))
subscribers = ["Jon", "Doe"]
# ok: frappe-translation-python-formatting
_('You have {0} subscribers in your mailing list.').format(len(subscribers))
# ruleid: frappe-translation-python-splitting
_('You have') + len(subscribers) + _('subscribers in your mailing list.')
# ruleid: frappe-translation-python-splitting
_('You have {0} subscribers \
in your mailing list').format(len(subscribers))
# ok: frappe-translation-python-splitting
_('You have {0} subscribers') \
+ 'in your mailing list'
# ruleid: frappe-translation-trailing-spaces
msg = _(" You have {0} pending invoice ")
# ruleid: frappe-translation-trailing-spaces
msg = _("You have {0} pending invoice ")
# ruleid: frappe-translation-trailing-spaces
msg = _(" You have {0} pending invoice")
# ok: frappe-translation-trailing-spaces
msg = ' ' + _("You have {0} pending invoices") + ' '
# ruleid: frappe-translation-python-formatting
_(f"can not format like this - {subscribers}")
# ruleid: frappe-translation-python-splitting
_(f"what" + f"this is also not cool")
# ruleid: frappe-translation-empty-string
_("")
# ruleid: frappe-translation-empty-string
_('')
class Test:
# ok: frappe-translation-python-splitting
def __init__(
args
):
pass

View File

@@ -1,64 +0,0 @@
rules:
- id: frappe-translation-empty-string
pattern-either:
- pattern: _("")
- pattern: __("")
message: |
Empty string is useless for translation.
Please refer: https://frappeframework.com/docs/user/en/translations
languages: [python, javascript, json]
severity: ERROR
- id: frappe-translation-trailing-spaces
pattern-either:
- pattern: _("=~/(^[ \t]+|[ \t]+$)/")
- pattern: __("=~/(^[ \t]+|[ \t]+$)/")
message: |
Trailing or leading whitespace not allowed in translate strings.
Please refer: https://frappeframework.com/docs/user/en/translations
languages: [python, javascript, json]
severity: ERROR
- id: frappe-translation-python-formatting
pattern-either:
- pattern: _("..." % ...)
- pattern: _("...".format(...))
- pattern: _(f"...")
message: |
Only positional formatters are allowed and formatting should not be done before translating.
Please refer: https://frappeframework.com/docs/user/en/translations
languages: [python]
severity: ERROR
- id: frappe-translation-js-formatting
patterns:
- pattern: __(`...`)
- pattern-not: __("...")
message: |
Template strings are not allowed for text formatting.
Please refer: https://frappeframework.com/docs/user/en/translations
languages: [javascript, json]
severity: ERROR
- id: frappe-translation-python-splitting
pattern-either:
- pattern: _(...) + _(...)
- pattern: _("..." + "...")
- pattern-regex: '[\s\.]_\([^\)]*\\\s*' # lines broken by `\`
- pattern-regex: '[\s\.]_\(\s*\n' # line breaks allowed by python for using ( )
message: |
Do not split strings inside translate function. Do not concatenate using translate functions.
Please refer: https://frappeframework.com/docs/user/en/translations
languages: [python]
severity: ERROR
- id: frappe-translation-js-splitting
pattern-either:
- pattern-regex: '__\([^\)]*[\\]\s+'
- pattern: __('...' + '...', ...)
- pattern: __('...') + __('...')
message: |
Do not split strings inside translate function. Do not concatenate using translate functions.
Please refer: https://frappeframework.com/docs/user/en/translations
languages: [javascript, json]
severity: ERROR

View File

@@ -1,9 +0,0 @@
// ok: frappe-missing-translate-function-js
frappe.msgprint('{{ _("Both login and password required") }}');
// ruleid: frappe-missing-translate-function-js
frappe.msgprint('What');
// ok: frappe-missing-translate-function-js
frappe.throw(' {{ _("Both login and password required") }}. ');

View File

@@ -1,30 +0,0 @@
import frappe
from frappe import _, msgprint, throw
# ruleid: frappe-missing-translate-function-python
throw("Error Occured")
# ruleid: frappe-missing-translate-function-python
frappe.throw("Error Occured")
# ruleid: frappe-missing-translate-function-python
frappe.msgprint("Useful message")
# ruleid: frappe-missing-translate-function-python
msgprint("Useful message")
# ok: frappe-missing-translate-function-python
translatedmessage = _("Hello")
# ok: frappe-missing-translate-function-python
throw(translatedmessage)
# ok: frappe-missing-translate-function-python
msgprint(translatedmessage)
# ok: frappe-missing-translate-function-python
msgprint(_("Helpful message"))
# ok: frappe-missing-translate-function-python
frappe.throw(_("Error occured"))

View File

@@ -1,30 +0,0 @@
rules:
- id: frappe-missing-translate-function-python
pattern-either:
- patterns:
- pattern: frappe.msgprint("...", ...)
- pattern-not: frappe.msgprint(_("..."), ...)
- patterns:
- pattern: frappe.throw("...", ...)
- pattern-not: frappe.throw(_("..."), ...)
message: |
All user facing text must be wrapped in translate function. Please refer to translation documentation. https://frappeframework.com/docs/user/en/guides/basics/translations
languages: [python]
severity: ERROR
- id: frappe-missing-translate-function-js
pattern-either:
- patterns:
- pattern: frappe.msgprint("...", ...)
- pattern-not: frappe.msgprint(__("..."), ...)
# ignore microtemplating e.g. msgprint("{{ _("server side translation") }}")
- pattern-not: frappe.msgprint("=~/\{\{.*\_.*\}\}/i", ...)
- patterns:
- pattern: frappe.throw("...", ...)
- pattern-not: frappe.throw(__("..."), ...)
# ignore microtemplating
- pattern-not: frappe.throw("=~/\{\{.*\_.*\}\}/i", ...)
message: |
All user facing text must be wrapped in translate function. Please refer to translation documentation. https://frappeframework.com/docs/user/en/guides/basics/translations
languages: [javascript]
severity: ERROR

View File

@@ -1,16 +0,0 @@
{
"db_host": "127.0.0.1",
"db_port": 3306,
"db_name": "test_frappe",
"db_password": "test_frappe",
"auto_email_id": "test@example.com",
"mail_server": "smtp.example.com",
"mail_login": "test@example.com",
"mail_password": "test",
"admin_password": "admin",
"root_login": "root",
"root_password": "travis",
"host_name": "http://test_site:8000",
"install_apps": ["erpnext"],
"throttle_user_limit": 100
}

View File

@@ -1,60 +0,0 @@
import re
import sys
errors_encounter = 0
pattern = re.compile(r"_\(([\"']{,3})(?P<message>((?!\1).)*)\1(\s*,\s*context\s*=\s*([\"'])(?P<py_context>((?!\5).)*)\5)*(\s*,(\s*?.*?\n*?)*(,\s*([\"'])(?P<js_context>((?!\11).)*)\11)*)*\)")
words_pattern = re.compile(r"_{1,2}\([\"'`]{1,3}.*?[a-zA-Z]")
start_pattern = re.compile(r"_{1,2}\([f\"'`]{1,3}")
f_string_pattern = re.compile(r"_\(f[\"']")
starts_with_f_pattern = re.compile(r"_\(f")
# skip first argument
files = sys.argv[1:]
files_to_scan = [_file for _file in files if _file.endswith(('.py', '.js'))]
for _file in files_to_scan:
with open(_file, 'r') as f:
print(f'Checking: {_file}')
file_lines = f.readlines()
for line_number, line in enumerate(file_lines, 1):
if 'frappe-lint: disable-translate' in line:
continue
start_matches = start_pattern.search(line)
if start_matches:
starts_with_f = starts_with_f_pattern.search(line)
if starts_with_f:
has_f_string = f_string_pattern.search(line)
if has_f_string:
errors_encounter += 1
print(f'\nF-strings are not supported for translations at line number {line_number}\n{line.strip()[:100]}')
continue
else:
continue
match = pattern.search(line)
error_found = False
if not match and line.endswith((',\n', '[\n')):
# concat remaining text to validate multiline pattern
line = "".join(file_lines[line_number - 1:])
line = line[start_matches.start() + 1:]
match = pattern.match(line)
if not match:
error_found = True
print(f'\nTranslation syntax error at line number {line_number}\n{line.strip()[:100]}')
if not error_found and not words_pattern.search(line):
error_found = True
print(f'\nTranslation is useless because it has no words at line number {line_number}\n{line.strip()[:100]}')
if error_found:
errors_encounter += 1
if errors_encounter > 0:
print('\nVisit "https://frappeframework.com/docs/user/en/translations" to learn about valid translation strings.')
sys.exit(1)
else:
print('\nGood To Go!')

34
.github/stale.yml vendored
View File

@@ -1,34 +0,0 @@
# Configuration for probot-stale - https://github.com/probot/stale
# Number of days of inactivity before an Issue or Pull Request becomes stale
daysUntilStale: 30
# Number of days of inactivity before a stale Issue or Pull Request is closed.
# Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale.
daysUntilClose: 7
# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable
exemptLabels:
- hotfix
# Set to true to ignore issues in a project (defaults to false)
exemptProjects: false
# Set to true to ignore issues in a milestone (defaults to false)
exemptMilestones: true
# Label to use when marking as stale
staleLabel: inactive
# Comment to post when marking as stale. Set to `false` to disable
markComment: >
This pull request has been automatically marked as stale because it has not had
recent activity. It will be closed within a week if no further activity occurs, but it
only takes a comment to keep a contribution alive :) Also, even if it is closed,
you can always reopen the PR when you're ready. Thank you for contributing.
# Limit the number of actions per hour, from 1-30. Default is 30
limitPerRun: 30
# Limit to only `issues` or `pulls`
only: pulls

View File

@@ -1,25 +0,0 @@
name: Backport
on:
pull_request_target:
types:
- closed
- labeled
jobs:
main:
runs-on: ubuntu-latest
steps:
- name: Checkout Actions
uses: actions/checkout@v2
with:
repository: "frappe/backport"
path: ./actions
ref: develop
- name: Install Actions
run: npm install --production --prefix ./actions
- name: Run backport
uses: ./actions/backport
with:
token: ${{secrets.BACKPORT_BOT_TOKEN}}
labelsToAdd: "backport"
title: "{{originalTitle}}"

View File

@@ -1,14 +0,0 @@
name: Trigger Docker build on release
on:
release:
types: [released]
jobs:
curl:
runs-on: ubuntu-latest
container:
image: alpine:latest
steps:
- name: curl
run: |
apk add curl bash
curl -s -X POST -H "Content-Type: application/json" -H "Accept: application/json" -H "Travis-API-Version: 3" -H "Authorization: token ${{ secrets.TRAVIS_CI_TOKEN }}" -d '{"request":{"branch":"master"}}' https://api.travis-ci.com/repo/frappe%2Ffrappe_docker/requests

View File

@@ -1,24 +0,0 @@
name: 'Documentation Required'
on:
pull_request:
types: [ opened, synchronize, reopened, edited ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: 'Setup Environment'
uses: actions/setup-python@v2
with:
python-version: 3.6
- name: 'Clone repo'
uses: actions/checkout@v2
- name: Validate Docs
env:
PR_NUMBER: ${{ github.event.number }}
run: |
pip install requests --quiet
python $GITHUB_WORKSPACE/.github/helper/documentation.py $PR_NUMBER

View File

@@ -1,27 +0,0 @@
name: Linters
on:
pull_request: { }
jobs:
linters:
name: linters
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: returntocorp/semgrep-action@v1
env:
SEMGREP_TIMEOUT: 120
with:
config: >-
r/python.lang.correctness
.github/helper/semgrep_rules
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install and Run Pre-commit
uses: pre-commit/action@v2.0.0

View File

@@ -1,85 +0,0 @@
name: Patch
on:
pull_request:
paths-ignore:
- '**.js'
- '**.md'
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-18.04
name: Patch Test
services:
mysql:
image: mariadb:10.3
env:
MYSQL_ALLOW_EMPTY_PASSWORD: YES
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3
steps:
- name: Clone
uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.6
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: 12
check-latest: true
- name: Add to Hosts
run: echo "127.0.0.1 test_site" | sudo tee -a /etc/hosts
- name: Cache pip
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install
run: bash ${GITHUB_WORKSPACE}/.github/helper/install.sh
- name: Run Patch Tests
run: |
cd ~/frappe-bench/
wget https://erpnext.com/files/v10-erpnext.sql.gz
bench --site test_site --force restore ~/frappe-bench/v10-erpnext.sql.gz
bench --site test_site migrate

View File

@@ -1,126 +0,0 @@
name: Server
on:
pull_request:
paths-ignore:
- '**.js'
- '**.md'
workflow_dispatch:
push:
branches: [ develop ]
paths-ignore:
- '**.js'
- '**.md'
jobs:
test:
runs-on: ubuntu-18.04
strategy:
fail-fast: false
matrix:
container: [1, 2, 3]
name: Python Unit Tests
services:
mysql:
image: mariadb:10.3
env:
MYSQL_ALLOW_EMPTY_PASSWORD: YES
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3
steps:
- name: Clone
uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: 12
check-latest: true
- name: Add to Hosts
run: echo "127.0.0.1 test_site" | sudo tee -a /etc/hosts
- name: Cache pip
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install
run: bash ${GITHUB_WORKSPACE}/.github/helper/install.sh
- name: Run Tests
run: cd ~/frappe-bench/ && bench --site test_site run-parallel-tests --app erpnext --use-orchestrator --with-coverage
env:
TYPE: server
CI_BUILD_ID: ${{ github.run_id }}
ORCHESTRATOR_URL: http://test-orchestrator.frappe.io
- name: Upload Coverage Data
run: |
cp ~/frappe-bench/sites/.coverage ${GITHUB_WORKSPACE}
cd ${GITHUB_WORKSPACE}
pip3 install coverage==5.5
pip3 install coveralls==3.0.1
coveralls
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_FLAG_NAME: run-${{ matrix.container }}
COVERALLS_SERVICE_NAME: ${{ github.event_name == 'pull_request' && 'github' || 'github-actions' }}
COVERALLS_PARALLEL: true
coveralls:
name: Coverage Wrap Up
needs: test
container: python:3-slim
runs-on: ubuntu-18.04
steps:
- name: Clone
uses: actions/checkout@v2
- name: Coveralls Finished
run: |
cd ${GITHUB_WORKSPACE}
pip3 install coverage==5.5
pip3 install coveralls==3.0.1
coveralls --finish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -1,22 +0,0 @@
name: Frappe Linter
on:
pull_request:
branches:
- develop
- version-12-hotfix
- version-11-hotfix
jobs:
check_translation:
name: Translation Syntax Check
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Setup python3
uses: actions/setup-python@v1
with:
python-version: 3.6
- name: Validating Translation Syntax
run: |
git fetch origin $GITHUB_BASE_REF:$GITHUB_BASE_REF -q
files=$(git diff --name-only --diff-filter=d $GITHUB_BASE_REF)
python $GITHUB_WORKSPACE/.github/helper/translation.py $files

View File

@@ -1,112 +0,0 @@
name: UI
on:
pull_request:
paths-ignore:
- '**.md'
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-18.04
strategy:
fail-fast: false
name: UI Tests (Cypress)
services:
mysql:
image: mariadb:10.3
env:
MYSQL_ALLOW_EMPTY_PASSWORD: YES
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3
steps:
- name: Clone
uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.7
- uses: actions/setup-node@v2
with:
node-version: 14
check-latest: true
- name: Add to Hosts
run: |
echo "127.0.0.1 test_site" | sudo tee -a /etc/hosts
- name: Cache pip
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Cache cypress binary
uses: actions/cache@v2
with:
path: ~/.cache
key: ${{ runner.os }}-cypress-
restore-keys: |
${{ runner.os }}-cypress-
${{ runner.os }}-
- name: Install
run: bash ${GITHUB_WORKSPACE}/.github/helper/install.sh
env:
DB: mariadb
TYPE: ui
- name: Site Setup
run: cd ~/frappe-bench/ && bench --site test_site execute erpnext.setup.utils.before_tests
- name: cypress pre-requisites
run: cd ~/frappe-bench/apps/frappe && yarn add cypress-file-upload@^5 @testing-library/cypress@^8 --no-lockfile
- name: Build Assets
run: cd ~/frappe-bench/ && bench build
env:
CI: Yes
- name: UI Tests
run: cd ~/frappe-bench/ && bench --site test_site run-ui-tests erpnext --headless
env:
CYPRESS_RECORD_KEY: 60a8e3bf-08f5-45b1-9269-2b207d7d30cd
- name: Show bench console if tests failed
if: ${{ failure() }}
run: cat ~/frappe-bench/bench_run_logs.txt

7
.gitignore vendored
View File

@@ -8,10 +8,3 @@ latest_updates.json
*.egg-info
dist/
erpnext/docs/current
*.swp
*.swo
__pycache__
*~
.idea/
.vscode/
node_modules/

View File

@@ -1,58 +0,0 @@
pull_request_rules:
- name: Auto-close PRs on stable branch
conditions:
- and:
- and:
- author!=surajshetty3416
- author!=gavindsouza
- author!=rohitwaghchaure
- author!=nabinhait
- or:
- base=version-13
- base=version-12
actions:
close:
comment:
message: |
@{{author}}, thanks for the contribution, but we do not accept pull requests on a stable branch. Please raise PR on an appropriate hotfix branch.
https://github.com/frappe/erpnext/wiki/Pull-Request-Checklist#which-branch
- name: backport to version-13-hotfix
conditions:
- label="backport version-13-hotfix"
actions:
backport:
branches:
- version-13-hotfix
assignees:
- "{{ author }}"
- name: backport to version-13-pre-release
conditions:
- label="backport version-13-pre-release"
actions:
backport:
branches:
- version-13-pre-release
assignees:
- "{{ author }}"
- name: backport to version-12-hotfix
conditions:
- label="backport version-12-hotfix"
actions:
backport:
branches:
- version-12-hotfix
assignees:
- "{{ author }}"
- name: backport to version-12-pre-release
conditions:
- label="backport version-12-pre-release"
actions:
backport:
branches:
- version-12-pre-release
assignees:
- "{{ author }}"

View File

@@ -1,38 +0,0 @@
exclude: 'node_modules|.git'
default_stages: [commit]
fail_fast: false
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
hooks:
- id: trailing-whitespace
files: "erpnext.*"
exclude: ".*json$|.*txt$|.*csv|.*md"
- id: check-yaml
- id: no-commit-to-branch
args: ['--branch', 'develop']
- id: check-merge-conflict
- id: check-ast
- repo: https://gitlab.com/pycqa/flake8
rev: 3.9.2
hooks:
- id: flake8
additional_dependencies: [
'flake8-bugbear',
]
args: ['--config', '.github/helper/.flake8_strict']
exclude: ".*setup.py$"
- repo: https://github.com/timothycrosley/isort
rev: 5.9.1
hooks:
- id: isort
exclude: ".*setup.py$"
ci:
autoupdate_schedule: weekly
skip: []
submodules: false

44
.travis.yml Normal file
View File

@@ -0,0 +1,44 @@
language: python
python:
- "2.7"
services:
- mysql
before_install:
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
install:
- sudo apt-get purge -y mysql-common
- wget https://raw.githubusercontent.com/frappe/bench/master/install_scripts/setup_frappe.sh
- sudo bash setup_frappe.sh --skip-setup-bench --mysql-root-password travis
- sudo pip install --upgrade pip
- rm $TRAVIS_BUILD_DIR/.git/shallow
- bash $TRAVIS_BUILD_DIR/travis/bench_init.sh
- cp -r $TRAVIS_BUILD_DIR/test_sites/test_site ~/frappe-bench/sites/
script:
- cd ~/frappe-bench
- bench get-app erpnext $TRAVIS_BUILD_DIR
- bench use test_site
- bench reinstall
- bench build
- bench build-website
- bench start &
- sleep 10
- bench --verbose run-tests --driver Firefox
before_script:
- mysql -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;\nGRANT ALL PRIVILEGES ON \`test_frappe\`.* TO 'test_frappe'@'localhost';\n" | mysql -u root -ptravis
notifications:
webhooks:
urls:
- https://webhooks.gitter.im/e/92b3bea86d8c5397beef
on_success: always
on_failure: always
on_start: never

View File

@@ -1,35 +0,0 @@
# Each line is a file pattern followed by one or more owners.
# These owners will be the default owners for everything in
# the repo. Unless a later match takes precedence,
erpnext/accounts/ @nextchamp-saqib @deepeshgarg007
erpnext/assets/ @nextchamp-saqib @deepeshgarg007
erpnext/erpnext_integrations/ @nextchamp-saqib
erpnext/loan_management/ @nextchamp-saqib @deepeshgarg007
erpnext/regional @nextchamp-saqib @deepeshgarg007
erpnext/selling @nextchamp-saqib @deepeshgarg007
erpnext/support/ @nextchamp-saqib @deepeshgarg007
pos* @nextchamp-saqib
erpnext/buying/ @marination @rohitwaghchaure @ankush
erpnext/e_commerce/ @marination
erpnext/maintenance/ @marination @rohitwaghchaure
erpnext/manufacturing/ @marination @rohitwaghchaure @ankush
erpnext/portal/ @marination
erpnext/quality_management/ @marination @rohitwaghchaure
erpnext/shopping_cart/ @marination
erpnext/stock/ @marination @rohitwaghchaure @ankush
erpnext/crm/ @ruchamahabal @pateljannat
erpnext/education/ @ruchamahabal @pateljannat
erpnext/healthcare/ @ruchamahabal @pateljannat @chillaranand
erpnext/hr/ @ruchamahabal @pateljannat
erpnext/non_profit/ @ruchamahabal
erpnext/payroll @ruchamahabal @pateljannat
erpnext/projects/ @ruchamahabal @pateljannat
erpnext/controllers @deepeshgarg007 @nextchamp-saqib @rohitwaghchaure @marination
.github/ @surajshetty3416 @ankush
requirements.txt @gavindsouza

View File

@@ -1,46 +0,0 @@
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at hello@frappe.io. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/

68
CONTRIBUTING.md Normal file
View File

@@ -0,0 +1,68 @@
# Contributing to Frappe / ERPNext
## Questions
If you have questions on how to use ERPNext or want help in customization or debugging of your scripts, please post on https://discuss.erpnext.com. This is only for bug reports and feature requests.
## Reporting issues
We only accept issues that are bug reports or feature requests. Bugs must be isolated and reproducible problems. Please read the following guidelines before opening any issue.
1. **Search for existing issues:** We want to avoid duplication, and you'd help us out a lot by first checking if someone else has reported the same issue. The issue may have already been resolved with a fix available.
1. **Report each issue separately:** Don't club multiple, unreleated issues in one note.
1. **Mention the version number:** Please mention the application, browser and platform version numbers.
### Issues
1. **Share as much information as possible:** Include operating system and version, browser and version, when did you last update ERPNext, how is it customized, etc. where appropriate. Also include steps to reproduce the bug.
1. **Include Screenshots if possible:** Consider adding screenshots annotated with what goes wrong.
1. **Find and post the trace for bugs:** If you are reporting an issue from the browser, Open the Javascript Console and paste us any error messages you see.
1. **Security Issues:** If you are reporting a security issue, please send a private email to <info@frappe.io>.
### Feature Requests
1. We need as much information you can to consider a feature request.
1. Think about **how** you want us to build the feature. Consider including:
1. Mockups (wireframes of features)
1. Screenshots (annotated with what should change)
1. Screenshots from other products if you want us to implement features present in other products.
1. Basically, the more you help us, the faster your request is likely to be completed.
1. A one line feature request like **Implement Capacity Planning** will be closed.
## Pull Requests
General guidelines for sending pull requests:
#### Don't Repeat Yourself (DRY)
We believe that the most effective way to manage a product like this is to ensure that
there is minimum repetition of code. So before contributing a function, please make sure
that such a feature or function does not exist else where. If it does, the try and extend
that function to accommodate your use case.
#### Don't create new DocTypes Unless Absolutely Necessary
DocTypes are easy to create but hard to maintain. If you find that there is a another DocType with a similar functionality, then please try and extend that functionality. For example, by adding a "type" field to classify the new type of record.
#### Tabs or spaces?
Tabs!
#### Release Checklist
- Describe, in detail, what is in the pull request
- How to use the new feature?
- Test cases
- Change log
- Manual Pull Request Link
- Screencast. Should include:
- New Forms
- Linked Forms
- Linked Reports
- Print Views
### Copyright
Please see README.md

20
MANIFEST.in Normal file
View File

@@ -0,0 +1,20 @@
include MANIFEST.in
include requirements.txt
include *.json
include *.md
include *.py
include *.txt
include .travis.yml
recursive-include erpnext *.txt
recursive-include erpnext *.css
recursive-include erpnext *.csv
recursive-include erpnext *.html
recursive-include erpnext *.ico
recursive-include erpnext *.js
recursive-include erpnext *.json
recursive-include erpnext *.md
recursive-include erpnext *.png
recursive-include erpnext *.py
recursive-include erpnext *.svg
recursive-include erpnext/public *
recursive-exclude * *.pyc

View File

@@ -1,48 +1,19 @@
<div align="center">
<img src="https://raw.githubusercontent.com/frappe/erpnext/develop/erpnext/public/images/erpnext-logo.png" height="128">
<h2>ERPNext</h2>
<p align="center">
<p>ERP made simple</p>
</p>
# ERPNext - ERP made simple
[![CI](https://github.com/frappe/erpnext/actions/workflows/ci-tests.yml/badge.svg?branch=develop)](https://github.com/frappe/erpnext/actions/workflows/ci-tests.yml)
[![Open Source Helpers](https://www.codetriage.com/frappe/erpnext/badges/users.svg)](https://www.codetriage.com/frappe/erpnext)
[![Coverage Status](https://coveralls.io/repos/github/frappe/erpnext/badge.svg?branch=develop)](https://coveralls.io/github/frappe/erpnext?branch=develop)
[![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)
[https://erpnext.com](https://erpnext.com)
</div>
Includes: Accounting, Inventory, CRM, Sales, Purchase, Projects, HRMS. Requires MariaDB.
ERPNext as a monolith includes the following areas for managing businesses:
ERPNext is built on the [Frappe](https://github.com/frappe/frappe) Framework, a full-stack web app framework in Python & JavaScript.
1. [Accounting](https://erpnext.com/open-source-accounting)
1. [Warehouse Management](https://erpnext.com/distribution/warehouse-management-system)
1. [CRM](https://erpnext.com/open-source-crm)
1. [Sales](https://erpnext.com/open-source-sales-purchase)
1. [Purchase](https://erpnext.com/open-source-sales-purchase)
1. [HRMS](https://erpnext.com/open-source-hrms)
1. [Project Management](https://erpnext.com/open-source-projects)
1. [Support](https://erpnext.com/open-source-help-desk-software)
1. [Asset Management](https://erpnext.com/open-source-asset-management-software)
1. [Quality Management](https://erpnext.com/docs/user/manual/en/quality-management)
1. [Manufacturing](https://erpnext.com/open-source-manufacturing-erp-software)
1. [Website Management](https://erpnext.com/open-source-website-builder-software)
1. [Customize ERPNext](https://erpnext.com/docs/user/manual/en/customize-erpnext)
1. [And More](https://erpnext.com/docs/user/manual/en/)
ERPNext requires MariaDB.
ERPNext is built on the [Frappe Framework](https://github.com/frappe/frappe), a full-stack web app framework built with Python & JavaScript.
- [User Guide](https://erpnext.com/docs/user)
- [User Guide](https://manual.erpnext.com)
- [Getting Help](http://erpnext.org/getting-help.html)
- [Discussion Forum](https://discuss.erpnext.com/)
---
### Containerized Installation
Use docker to deploy ERPNext in production or for development of [Frappe](https://github.com/frappe/frappe) apps. See https://github.com/frappe/frappe_docker for more details.
### Full Install
The Easy Way: our install script for bench will install all dependencies (e.g. MariaDB). See https://github.com/frappe/bench for more details.
@@ -61,22 +32,12 @@ System and user credentials are listed on the download page.
## License
GNU/General Public License (see [license.txt](license.txt))
GNU/General Public License (see LICENSE.txt)
The ERPNext code is licensed as GNU General Public License (v3) and the Documentation is licensed as Creative Commons (CC-BY-SA-3.0) and the copyright is owned by Frappe Technologies Pvt Ltd (Frappe) and Contributors.
---
## Contributing
1. [Issue Guidelines](https://github.com/frappe/erpnext/wiki/Issue-Guidelines)
1. [Report Security Vulnerabilities](https://erpnext.com/security)
1. [Pull Request Requirements](https://github.com/frappe/erpnext/wiki/Contribution-Guidelines)
1. [Translations](https://translate.erpnext.com)
1. [Chart of Accounts](https://charts.erpnext.com)
---
## Logo and Trademark
The brand name ERPNext and the logo are trademarks of Frappe Technologies Pvt. Ltd.

View File

@@ -1,7 +0,0 @@
# Security Policy
The ERPNext team and community take security issues seriously. To report a security issue, fill out the form at [https://erpnext.com/security/report](https://erpnext.com/security/report).
You can help us make ERPNext and all it's users more secure by following the [Reporting guidelines](https://erpnext.com/security).
We appreciate your efforts to responsibly disclose your findings. We'll endeavor to respond quickly, and will keep you updated throughout the process.

View File

@@ -1,11 +0,0 @@
{
"baseUrl": "http://test_site:8000",
"projectId": "da59y9",
"adminPassword": "admin",
"defaultCommandTimeout": 20000,
"pageLoadTimeout": 15000,
"retries": {
"runMode": 2,
"openMode": 2
}
}

View File

@@ -1,5 +0,0 @@
{
"name": "Using fixtures to represent data",
"email": "hello@cypress.io",
"body": "Fixtures are a great way to mock data for responses to routes"
}

View File

@@ -1,13 +0,0 @@
context('Customer', () => {
before(() => {
cy.login();
});
it('Check Customer Group', () => {
cy.visit(`app/customer/`);
cy.get('.primary-action').click();
cy.wait(500);
cy.get('.custom-actions > .btn').click();
cy.get_field('customer_group', 'Link').should('have.value', 'All Customer Groups');
});
});

View File

@@ -1,116 +0,0 @@
context('Organizational Chart', () => {
before(() => {
cy.login();
cy.visit('/app/website');
});
it('navigates to org chart', () => {
cy.visit('/app');
cy.visit('/app/organizational-chart');
cy.url().should('include', '/organizational-chart');
cy.window().its('frappe.csrf_token').then(csrf_token => {
return cy.request({
url: `/api/method/erpnext.tests.ui_test_helpers.create_employee_records`,
method: 'POST',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
'X-Frappe-CSRF-Token': csrf_token
},
timeout: 60000
}).then(res => {
expect(res.status).eq(200);
cy.get('.frappe-control[data-fieldname=company] input').focus().as('input');
cy.get('@input')
.clear({ force: true })
.type('Test Org Chart{downarrow}{enter}', { force: true })
.blur({ force: true });
});
});
});
it('renders root nodes and loads children for the first expandable node', () => {
// check rendered root nodes and the node name, title, connections
cy.get('.hierarchy').find('.root-level ul.node-children').children()
.should('have.length', 2)
.first()
.as('first-child');
cy.get('@first-child').get('.node-name').contains('Test Employee 1');
cy.get('@first-child').get('.node-info').find('.node-title').contains('CEO');
cy.get('@first-child').get('.node-info').find('.node-connections').contains('· 2 Connections');
cy.call('erpnext.tests.ui_test_helpers.get_employee_records').then(employee_records => {
// children of 1st root visible
cy.get(`div[data-parent="${employee_records.message[0]}"]`).as('child-node');
cy.get('@child-node')
.should('have.length', 1)
.should('be.visible');
cy.get('@child-node').get('.node-name').contains('Test Employee 3');
// connectors between first root node and immediate child
cy.get(`path[data-parent="${employee_records.message[0]}"]`)
.should('be.visible')
.invoke('attr', 'data-child')
.should('equal', employee_records.message[2]);
});
});
it('hides active nodes children and connectors on expanding sibling node', () => {
cy.call('erpnext.tests.ui_test_helpers.get_employee_records').then(employee_records => {
// click sibling
cy.get(`#${employee_records.message[1]}`)
.click()
.should('have.class', 'active');
// child nodes and connectors hidden
cy.get(`[data-parent="${employee_records.message[0]}"]`).should('not.be.visible');
cy.get(`path[data-parent="${employee_records.message[0]}"]`).should('not.be.visible');
});
});
it('collapses previous level nodes and refreshes connectors on expanding child node', () => {
cy.call('erpnext.tests.ui_test_helpers.get_employee_records').then(employee_records => {
// click child node
cy.get(`#${employee_records.message[3]}`)
.click()
.should('have.class', 'active');
// previous level nodes: parent should be on active-path; other nodes should be collapsed
cy.get(`#${employee_records.message[0]}`).should('have.class', 'collapsed');
cy.get(`#${employee_records.message[1]}`).should('have.class', 'active-path');
// previous level connectors refreshed
cy.get(`path[data-parent="${employee_records.message[1]}"]`)
.should('have.class', 'collapsed-connector');
// child node's children and connectors rendered
cy.get(`[data-parent="${employee_records.message[3]}"]`).should('be.visible');
cy.get(`path[data-parent="${employee_records.message[3]}"]`).should('be.visible');
});
});
it('expands previous level nodes', () => {
cy.call('erpnext.tests.ui_test_helpers.get_employee_records').then(employee_records => {
cy.get(`#${employee_records.message[0]}`)
.click()
.should('have.class', 'active');
cy.get(`[data-parent="${employee_records.message[0]}"]`)
.should('be.visible');
cy.get('ul.hierarchy').children().should('have.length', 2);
cy.get(`#connectors`).children().should('have.length', 1);
});
});
it('edit node navigates to employee master', () => {
cy.call('erpnext.tests.ui_test_helpers.get_employee_records').then(employee_records => {
cy.get(`#${employee_records.message[0]}`).find('.btn-edit-node')
.click();
cy.url().should('include', `/employee/${employee_records.message[0]}`);
});
});
});

View File

@@ -1,195 +0,0 @@
context('Organizational Chart Mobile', () => {
before(() => {
cy.login();
cy.visit('/app/website');
});
it('navigates to org chart', () => {
cy.viewport(375, 667);
cy.visit('/app');
cy.visit('/app/organizational-chart');
cy.url().should('include', '/organizational-chart');
cy.window().its('frappe.csrf_token').then(csrf_token => {
return cy.request({
url: `/api/method/erpnext.tests.ui_test_helpers.create_employee_records`,
method: 'POST',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
'X-Frappe-CSRF-Token': csrf_token
},
timeout: 60000
}).then(res => {
expect(res.status).eq(200);
cy.get('.frappe-control[data-fieldname=company] input').focus().as('input');
cy.get('@input')
.clear({ force: true })
.type('Test Org Chart{downarrow}{enter}', { force: true })
.blur({ force: true });
});
});
});
it('renders root nodes', () => {
// check rendered root nodes and the node name, title, connections
cy.get('.hierarchy-mobile').find('.root-level').children()
.should('have.length', 2)
.first()
.as('first-child');
cy.get('@first-child').get('.node-name').contains('Test Employee 1');
cy.get('@first-child').get('.node-info').find('.node-title').contains('CEO');
cy.get('@first-child').get('.node-info').find('.node-connections').contains('· 2');
});
it('expands root node', () => {
cy.call('erpnext.tests.ui_test_helpers.get_employee_records').then(employee_records => {
cy.get(`#${employee_records.message[1]}`)
.click()
.should('have.class', 'active');
// other root node removed
cy.get(`#${employee_records.message[0]}`).should('not.exist');
// children of active root node
cy.get('.hierarchy-mobile').find('.level').first().find('ul.node-children').children()
.should('have.length', 2);
cy.get(`div[data-parent="${employee_records.message[1]}"]`).first().as('child-node');
cy.get('@child-node').should('be.visible');
cy.get('@child-node')
.get('.node-name')
.contains('Test Employee 4');
// connectors between root node and immediate children
cy.get(`path[data-parent="${employee_records.message[1]}"]`).as('connectors');
cy.get('@connectors')
.should('have.length', 2)
.should('be.visible');
cy.get('@connectors')
.first()
.invoke('attr', 'data-child')
.should('eq', employee_records.message[3]);
});
});
it('expands child node', () => {
cy.call('erpnext.tests.ui_test_helpers.get_employee_records').then(employee_records => {
cy.get(`#${employee_records.message[3]}`)
.click()
.should('have.class', 'active')
.as('expanded_node');
// 2 levels on screen; 1 on active path; 1 collapsed
cy.get('.hierarchy-mobile').children().should('have.length', 2);
cy.get(`#${employee_records.message[1]}`).should('have.class', 'active-path');
// children of expanded node visible
cy.get('@expanded_node')
.next()
.should('have.class', 'node-children')
.as('node-children');
cy.get('@node-children').children().should('have.length', 1);
cy.get('@node-children')
.first()
.get('.node-card')
.should('have.class', 'active-child')
.contains('Test Employee 7');
// orphan connectors removed
cy.get(`#connectors`).children().should('have.length', 2);
});
});
it('renders sibling group', () => {
cy.call('erpnext.tests.ui_test_helpers.get_employee_records').then(employee_records => {
// sibling group visible for parent
cy.get(`#${employee_records.message[1]}`)
.next()
.as('sibling_group');
cy.get('@sibling_group')
.should('have.attr', 'data-parent', 'undefined')
.should('have.class', 'node-group')
.and('have.class', 'collapsed');
cy.get('@sibling_group').get('.avatar-group').children().as('siblings');
cy.get('@siblings').should('have.length', 1);
cy.get('@siblings')
.first()
.should('have.attr', 'title', 'Test Employee 1');
});
});
it('expands previous level nodes', () => {
cy.call('erpnext.tests.ui_test_helpers.get_employee_records').then(employee_records => {
cy.get(`#${employee_records.message[6]}`)
.click()
.should('have.class', 'active');
// clicking on previous level node should remove all the nodes ahead
// and expand that node
cy.get(`#${employee_records.message[3]}`).click();
cy.get(`#${employee_records.message[3]}`)
.should('have.class', 'active')
.should('not.have.class', 'active-path');
cy.get(`#${employee_records.message[6]}`).should('have.class', 'active-child');
cy.get('.hierarchy-mobile').children().should('have.length', 2);
cy.get(`#connectors`).children().should('have.length', 2);
});
});
it('expands sibling group', () => {
cy.call('erpnext.tests.ui_test_helpers.get_employee_records').then(employee_records => {
// sibling group visible for parent
cy.get(`#${employee_records.message[6]}`).click();
cy.get(`#${employee_records.message[3]}`)
.next()
.click();
// siblings of parent should be visible
cy.get('.hierarchy-mobile').prev().as('sibling_group');
cy.get('@sibling_group')
.should('exist')
.should('have.class', 'sibling-group')
.should('not.have.class', 'collapsed');
cy.get(`#${employee_records.message[1]}`)
.should('be.visible')
.should('have.class', 'active');
cy.get(`[data-parent="${employee_records.message[1]}"]`)
.should('be.visible')
.should('have.length', 2)
.should('have.class', 'active-child');
});
});
it('goes to the respective level after clicking on non-collapsed sibling group', () => {
cy.call('erpnext.tests.ui_test_helpers.get_employee_records').then(() => {
// click on non-collapsed sibling group
cy.get('.hierarchy-mobile')
.prev()
.click();
// should take you to that level
cy.get('.hierarchy-mobile').find('li.level .node-card').should('have.length', 2);
});
});
it('edit node navigates to employee master', () => {
cy.call('erpnext.tests.ui_test_helpers.get_employee_records').then(employee_records => {
cy.get(`#${employee_records.message[0]}`).find('.btn-edit-node')
.click();
cy.url().should('include', `/employee/${employee_records.message[0]}`);
});
});
});

View File

@@ -1,17 +0,0 @@
// ***********************************************************
// This example plugins/index.js can be used to load plugins
//
// You can change the location of this file or turn off loading
// the plugins file with the 'pluginsFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/plugins-guide
// ***********************************************************
// This function is called when a project is opened or re-opened (e.g. due to
// the project's config changing)
module.exports = () => {
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config
};

View File

@@ -1,31 +0,0 @@
// ***********************************************
// This example commands.js shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***********************************************
//
//
// -- This is a parent command --
// Cypress.Commands.add("login", (email, password) => { ... });
//
//
// -- This is a child command --
// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... });
//
//
// -- This is a dual command --
// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... });
//
//
// -- This is will overwrite an existing command --
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... });
const slug = (name) => name.toLowerCase().replace(" ", "-");
Cypress.Commands.add("go_to_doc", (doctype, name) => {
cy.visit(`/app/${slug(doctype)}/${encodeURIComponent(name)}`);
});

View File

@@ -1,26 +0,0 @@
// ***********************************************************
// This example support/index.js is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************
// Import commands.js using ES2015 syntax:
import './commands';
import '../../../frappe/cypress/support/commands' // eslint-disable-line
// Alternatively you can use CommonJS syntax:
// require('./commands')
Cypress.Cookies.defaults({
preserve: 'sid'
});

View File

@@ -1,12 +0,0 @@
{
"compilerOptions": {
"allowJs": true,
"baseUrl": "../node_modules",
"types": [
"cypress"
]
},
"include": [
"**/*.*"
]
}

View File

@@ -1,9 +0,0 @@
{
"extends": ["stylelint-config-recommended"],
"plugins": ["stylelint-scss"],
"rules": {
"at-rule-no-unknown": null,
"scss/at-rule-no-unknown": true,
"no-descending-specificity": null
}
}

View File

@@ -1,143 +1,4 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import inspect
import frappe
from erpnext.hooks import regional_overrides
__version__ = '13.13.0'
def get_default_company(user=None):
'''Get default company for user'''
from frappe.defaults import get_user_default_as_list
if not user:
user = frappe.session.user
companies = get_user_default_as_list(user, 'company')
if companies:
default_company = companies[0]
else:
default_company = frappe.db.get_single_value('Global Defaults', 'default_company')
return default_company
def get_default_currency():
'''Returns the currency of the default company'''
company = get_default_company()
if company:
return frappe.get_cached_value('Company', company, 'default_currency')
def get_default_cost_center(company):
'''Returns the default cost center of the company'''
if not company:
return None
if not frappe.flags.company_cost_center:
frappe.flags.company_cost_center = {}
if not company in frappe.flags.company_cost_center:
frappe.flags.company_cost_center[company] = frappe.get_cached_value('Company', company, 'cost_center')
return frappe.flags.company_cost_center[company]
def get_company_currency(company):
'''Returns the default company currency'''
if not frappe.flags.company_currency:
frappe.flags.company_currency = {}
if not company in frappe.flags.company_currency:
frappe.flags.company_currency[company] = frappe.db.get_value('Company', company, 'default_currency', cache=True)
return frappe.flags.company_currency[company]
def set_perpetual_inventory(enable=1, company=None):
if not company:
company = "_Test Company" if frappe.flags.in_test else get_default_company()
company = frappe.get_doc("Company", company)
company.enable_perpetual_inventory = enable
company.save()
def encode_company_abbr(name, company):
'''Returns name encoded with company abbreviation'''
company_abbr = frappe.get_cached_value('Company', company, "abbr")
parts = name.rsplit(" - ", 1)
if parts[-1].lower() != company_abbr.lower():
parts.append(company_abbr)
return " - ".join(parts)
def is_perpetual_inventory_enabled(company):
if not company:
company = "_Test Company" if frappe.flags.in_test else get_default_company()
if not hasattr(frappe.local, 'enable_perpetual_inventory'):
frappe.local.enable_perpetual_inventory = {}
if not company in frappe.local.enable_perpetual_inventory:
frappe.local.enable_perpetual_inventory[company] = frappe.get_cached_value('Company',
company, "enable_perpetual_inventory") or 0
return frappe.local.enable_perpetual_inventory[company]
def get_default_finance_book(company=None):
if not company:
company = get_default_company()
if not hasattr(frappe.local, 'default_finance_book'):
frappe.local.default_finance_book = {}
if not company in frappe.local.default_finance_book:
frappe.local.default_finance_book[company] = frappe.get_cached_value('Company',
company, "default_finance_book")
return frappe.local.default_finance_book[company]
def get_party_account_type(party_type):
if not hasattr(frappe.local, 'party_account_types'):
frappe.local.party_account_types = {}
if not party_type in frappe.local.party_account_types:
frappe.local.party_account_types[party_type] = frappe.db.get_value("Party Type",
party_type, "account_type") or ''
return frappe.local.party_account_types[party_type]
def get_region(company=None):
'''Return the default country based on flag, company or global settings
You can also set global company flag in `frappe.flags.company`
'''
if company or frappe.flags.company:
return frappe.get_cached_value('Company',
company or frappe.flags.company, 'country')
elif frappe.flags.country:
return frappe.flags.country
else:
return frappe.get_system_settings('country')
def allow_regional(fn):
'''Decorator to make a function regionally overridable
Example:
@erpnext.allow_regional
def myfunction():
pass'''
def caller(*args, **kwargs):
region = get_region()
fn_name = inspect.getmodule(fn).__name__ + '.' + fn.__name__
if region in regional_overrides and fn_name in regional_overrides[region]:
return frappe.get_attr(regional_overrides[region][fn_name])(*args, **kwargs)
else:
return fn(*args, **kwargs)
return caller
def get_last_membership(member):
'''Returns last membership if exists'''
last_membership = frappe.get_all('Membership', 'name,to_date,membership_type',
dict(member=member, paid=1), order_by='to_date desc', limit=1)
if last_membership:
return last_membership[0]
__version__ = '6.27.26'

View File

@@ -1,58 +0,0 @@
{
"cards": [
{
"card": "Total Outgoing Bills"
},
{
"card": "Total Incoming Bills"
},
{
"card": "Total Incoming Payment"
},
{
"card": "Total Outgoing Payment"
}
],
"charts": [
{
"chart": "Profit and Loss",
"width": "Full"
},
{
"chart": "Incoming Bills (Purchase Invoice)",
"width": "Half"
},
{
"chart": "Outgoing Bills (Sales Invoice)",
"width": "Half"
},
{
"chart": "Accounts Receivable Ageing",
"width": "Half"
},
{
"chart": "Accounts Payable Ageing",
"width": "Half"
},
{
"chart": "Budget Variance",
"width": "Full"
},
{
"chart": "Bank Balance",
"width": "Full"
}
],
"creation": "2020-07-17 11:25:34.796608",
"dashboard_name": "Accounts",
"docstatus": 0,
"doctype": "Dashboard",
"idx": 0,
"is_default": 0,
"is_standard": 1,
"modified": "2020-07-22 13:07:34.540574",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Accounts",
"owner": "Administrator"
}

View File

@@ -1,126 +0,0 @@
{
"custom_fields": [
{
"_assign": null,
"_comments": null,
"_liked_by": null,
"_user_tags": null,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"collapsible_depends_on": null,
"columns": 0,
"creation": "2018-12-28 22:29:21.828090",
"default": null,
"depends_on": null,
"description": null,
"docstatus": 0,
"dt": "Address",
"fetch_from": null,
"fetch_if_empty": 0,
"fieldname": "tax_category",
"fieldtype": "Link",
"hidden": 0,
"hide_border": 0,
"hide_days": 0,
"hide_seconds": 0,
"idx": 15,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_preview": 0,
"in_standard_filter": 0,
"insert_after": "fax",
"label": "Tax Category",
"length": 0,
"mandatory_depends_on": null,
"modified": "2018-12-28 22:29:21.828090",
"modified_by": "Administrator",
"name": "Address-tax_category",
"no_copy": 0,
"options": "Tax Category",
"owner": "Administrator",
"parent": null,
"parentfield": null,
"parenttype": null,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"print_width": null,
"read_only": 0,
"read_only_depends_on": null,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"translatable": 0,
"unique": 0,
"width": null
},
{
"_assign": null,
"_comments": null,
"_liked_by": null,
"_user_tags": null,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"collapsible_depends_on": null,
"columns": 0,
"creation": "2020-10-14 17:41:40.878179",
"default": "0",
"depends_on": null,
"description": null,
"docstatus": 0,
"dt": "Address",
"fetch_from": null,
"fetch_if_empty": 0,
"fieldname": "is_your_company_address",
"fieldtype": "Check",
"hidden": 0,
"hide_border": 0,
"hide_days": 0,
"hide_seconds": 0,
"idx": 20,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_preview": 0,
"in_standard_filter": 0,
"insert_after": "linked_with",
"label": "Is Your Company Address",
"length": 0,
"mandatory_depends_on": null,
"modified": "2020-10-14 17:41:40.878179",
"modified_by": "Administrator",
"name": "Address-is_your_company_address",
"no_copy": 0,
"options": null,
"owner": "Administrator",
"parent": null,
"parentfield": null,
"parenttype": null,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"print_width": null,
"read_only": 0,
"read_only_depends_on": null,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"translatable": 0,
"unique": 0,
"width": null
}
],
"custom_perms": [],
"doctype": "Address",
"property_setters": [],
"sync_on_migrate": 1
}

View File

@@ -1,61 +0,0 @@
import frappe
from frappe import _
from frappe.contacts.doctype.address.address import (
Address,
get_address_display,
get_address_templates,
)
class ERPNextAddress(Address):
def validate(self):
self.validate_reference()
super(ERPNextAddress, self).validate()
def link_address(self):
"""Link address based on owner"""
if self.is_your_company_address:
return
return super(ERPNextAddress, self).link_address()
def validate_reference(self):
if self.is_your_company_address and not [
row for row in self.links if row.link_doctype == "Company"
]:
frappe.throw(_("Address needs to be linked to a Company. Please add a row for Company in the Links table."),
title=_("Company Not Linked"))
def on_update(self):
"""
After Address is updated, update the related 'Primary Address' on Customer.
"""
address_display = get_address_display(self.as_dict())
filters = {
"customer_primary_address": self.name
}
customers = frappe.db.get_all("Customer", filters=filters, as_list=True)
for customer_name in customers:
frappe.db.set_value("Customer", customer_name[0], "primary_address", address_display)
@frappe.whitelist()
def get_shipping_address(company, address = None):
filters = [
["Dynamic Link", "link_doctype", "=", "Company"],
["Dynamic Link", "link_name", "=", company],
["Address", "is_your_company_address", "=", 1]
]
fields = ["*"]
if address and frappe.db.get_value('Dynamic Link',
{'parent': address, 'link_name': company}):
filters.append(["Address", "name", "=", address])
if not address:
filters.append(["Address", "is_shipping_address", "=", 1])
address = frappe.get_all("Address", filters=filters, fields=fields) or {}
if address:
address_as_dict = address[0]
name, address_template = get_address_templates(address_as_dict)
return address_as_dict.get("name"), frappe.render_template(address_template, address_as_dict)

View File

@@ -1,23 +0,0 @@
{
"chart_name": "Accounts Payable Ageing",
"chart_type": "Report",
"creation": "2020-07-17 11:25:34.564015",
"docstatus": 0,
"doctype": "Dashboard Chart",
"dynamic_filters_json": "{\"company\":\"frappe.defaults.get_user_default(\\\"Company\\\")\",\"report_date\":\"frappe.datetime.now_date()\"}",
"filters_json": "{\"ageing_based_on\":\"Due Date\",\"range1\":30,\"range2\":60,\"range3\":90,\"range4\":120,\"group_by_party\":0,\"based_on_payment_terms\":0}",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"modified": "2020-07-22 12:29:33.584419",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Accounts Payable Ageing",
"number_of_groups": 0,
"owner": "Administrator",
"report_name": "Accounts Payable",
"timeseries": 0,
"type": "Donut",
"use_report_chart": 1,
"y_axis": []
}

View File

@@ -1,23 +0,0 @@
{
"chart_name": "Accounts Receivable Ageing",
"chart_type": "Report",
"creation": "2020-07-17 11:25:34.535388",
"docstatus": 0,
"doctype": "Dashboard Chart",
"dynamic_filters_json": "{\"company\":\"frappe.defaults.get_user_default(\\\"Company\\\")\",\"report_date\":\"frappe.datetime.now_date()\"}",
"filters_json": "{\"ageing_based_on\":\"Due Date\",\"range1\":30,\"range2\":60,\"range3\":90,\"range4\":120,\"group_by_party\":0,\"based_on_payment_terms\":0,\"show_future_payments\":0,\"show_delivery_notes\":0,\"show_sales_person\":0}",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"modified": "2020-07-22 12:28:42.743551",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Accounts Receivable Ageing",
"number_of_groups": 0,
"owner": "Administrator",
"report_name": "Accounts Receivable",
"timeseries": 0,
"type": "Donut",
"use_report_chart": 1,
"y_axis": []
}

View File

@@ -1,26 +0,0 @@
{
"chart_name": "Bank Balance",
"chart_type": "Custom",
"creation": "2020-07-17 11:25:34.620221",
"docstatus": 0,
"doctype": "Dashboard Chart",
"dynamic_filters_json": "{\"company\":\"frappe.defaults.get_user_default(\\\"Company\\\")\",\"account\":\"locals[\\\":Company\\\"][frappe.defaults.get_user_default(\\\"Company\\\")][\\\"default_bank_account\\\"]\"}",
"filters_json": "{}",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"last_synced_on": "2020-07-22 12:19:59.879476",
"modified": "2020-07-22 12:21:48.780513",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Bank Balance",
"number_of_groups": 0,
"owner": "Administrator",
"source": "Account Balance Timeline",
"time_interval": "Quarterly",
"timeseries": 0,
"timespan": "Last Year",
"type": "Line",
"use_report_chart": 0,
"y_axis": []
}

View File

@@ -1,23 +0,0 @@
{
"chart_name": "Budget Variance",
"chart_type": "Report",
"creation": "2020-07-17 11:25:34.593061",
"docstatus": 0,
"doctype": "Dashboard Chart",
"dynamic_filters_json": "{\"company\":\"frappe.defaults.get_user_default(\\\"Company\\\")\",\"from_fiscal_year\":\"frappe.sys_defaults.fiscal_year\",\"to_fiscal_year\":\"frappe.sys_defaults.fiscal_year\"}",
"filters_json": "{\"period\":\"Monthly\",\"budget_against\":\"Cost Center\",\"show_cumulative\":0}",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"modified": "2020-07-22 12:24:49.144210",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Budget Variance",
"number_of_groups": 0,
"owner": "Administrator",
"report_name": "Budget Variance Report",
"timeseries": 0,
"type": "Bar",
"use_report_chart": 1,
"y_axis": []
}

View File

@@ -1,29 +0,0 @@
{
"based_on": "posting_date",
"chart_name": "Incoming Bills (Purchase Invoice)",
"chart_type": "Sum",
"color": "#a83333",
"creation": "2020-07-17 11:25:34.479703",
"docstatus": 0,
"doctype": "Dashboard Chart",
"document_type": "Purchase Invoice",
"dynamic_filters_json": "",
"filters_json": "[[\"Purchase Invoice\",\"docstatus\",\"=\",1]]",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"last_synced_on": "2020-07-21 17:37:30.727306",
"modified": "2020-07-21 17:51:07.374917",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Incoming Bills (Purchase Invoice)",
"number_of_groups": 0,
"owner": "Administrator",
"time_interval": "Monthly",
"timeseries": 1,
"timespan": "Last Year",
"type": "Bar",
"use_report_chart": 0,
"value_based_on": "base_net_total",
"y_axis": []
}

View File

@@ -1,28 +0,0 @@
{
"based_on": "posting_date",
"chart_name": "Outgoing Bills (Sales Invoice)",
"chart_type": "Sum",
"color": "#7b933d",
"creation": "2020-07-17 11:25:34.507547",
"docstatus": 0,
"doctype": "Dashboard Chart",
"document_type": "Sales Invoice",
"filters_json": "[[\"Sales Invoice\",\"docstatus\",\"=\",1]]",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"last_synced_on": "2020-07-21 17:37:31.574666",
"modified": "2020-07-21 17:52:03.970530",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Outgoing Bills (Sales Invoice)",
"number_of_groups": 0,
"owner": "Administrator",
"time_interval": "Monthly",
"timeseries": 1,
"timespan": "Last Year",
"type": "Bar",
"use_report_chart": 0,
"value_based_on": "base_net_total",
"y_axis": []
}

View File

@@ -1,23 +0,0 @@
{
"chart_name": "Profit and Loss",
"chart_type": "Report",
"creation": "2020-07-17 11:25:34.448572",
"docstatus": 0,
"doctype": "Dashboard Chart",
"dynamic_filters_json": "{\"company\":\"frappe.defaults.get_user_default(\\\"Company\\\")\",\"from_fiscal_year\":\"frappe.sys_defaults.fiscal_year\",\"to_fiscal_year\":\"frappe.sys_defaults.fiscal_year\"}",
"filters_json": "{\"filter_based_on\":\"Fiscal Year\",\"period_start_date\":\"2020-04-01\",\"period_end_date\":\"2021-03-31\",\"periodicity\":\"Yearly\",\"include_default_book_entries\":1}",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"modified": "2020-07-22 12:33:48.888943",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Profit and Loss",
"number_of_groups": 0,
"owner": "Administrator",
"report_name": "Profit and Loss Statement",
"timeseries": 0,
"type": "Bar",
"use_report_chart": 1,
"y_axis": []
}

View File

@@ -1,22 +0,0 @@
frappe.provide('frappe.dashboards.chart_sources');
frappe.dashboards.chart_sources["Account Balance Timeline"] = {
method: "erpnext.accounts.dashboard_chart_source.account_balance_timeline.account_balance_timeline.get",
filters: [
{
fieldname: "company",
label: __("Company"),
fieldtype: "Link",
options: "Company",
default: frappe.defaults.get_user_default("Company"),
reqd: 1
},
{
fieldname: "account",
label: __("Account"),
fieldtype: "Link",
options: "Account",
reqd: 1
},
]
};

View File

@@ -1,13 +0,0 @@
{
"creation": "2019-02-06 07:57:10.377718",
"docstatus": 0,
"doctype": "Dashboard Chart Source",
"idx": 0,
"modified": "2019-04-09 18:30:49.943174",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Account Balance Timeline",
"owner": "Administrator",
"source_name": "Account Balance Timeline",
"timeseries": 1
}

View File

@@ -1,122 +0,0 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.utils import add_to_date, formatdate, get_link_to_form, getdate, nowdate
from frappe.utils.dashboard import cache_source
from frappe.utils.dateutils import get_from_date_from_timespan, get_period_ending
from frappe.utils.nestedset import get_descendants_of
@frappe.whitelist()
@cache_source
def get(chart_name = None, chart = None, no_cache = None, filters = None, from_date = None,
to_date = None, timespan = None, time_interval = None, heatmap_year = None):
if chart_name:
chart = frappe.get_doc('Dashboard Chart', chart_name)
else:
chart = frappe._dict(frappe.parse_json(chart))
timespan = chart.timespan
if chart.timespan == 'Select Date Range':
from_date = chart.from_date
to_date = chart.to_date
timegrain = chart.time_interval
filters = frappe.parse_json(filters) or frappe.parse_json(chart.filters_json)
account = filters.get("account")
company = filters.get("company")
if not account and chart_name:
frappe.throw(_("Account is not set for the dashboard chart {0}")
.format(get_link_to_form("Dashboard Chart", chart_name)))
if not frappe.db.exists("Account", account) and chart_name:
frappe.throw(_("Account {0} does not exists in the dashboard chart {1}")
.format(account, get_link_to_form("Dashboard Chart", chart_name)))
if not to_date:
to_date = nowdate()
if not from_date:
if timegrain in ('Monthly', 'Quarterly'):
from_date = get_from_date_from_timespan(to_date, timespan)
# fetch dates to plot
dates = get_dates_from_timegrain(from_date, to_date, timegrain)
# get all the entries for this account and its descendants
gl_entries = get_gl_entries(account, get_period_ending(to_date, timegrain))
# compile balance values
result = build_result(account, dates, gl_entries)
return {
"labels": [formatdate(r[0].strftime('%Y-%m-%d')) for r in result],
"datasets": [{
"name": account,
"values": [r[1] for r in result]
}]
}
def build_result(account, dates, gl_entries):
result = [[getdate(date), 0.0] for date in dates]
root_type = frappe.db.get_value('Account', account, 'root_type')
# start with the first date
date_index = 0
# get balances in debit
for entry in gl_entries:
# entry date is after the current pointer, so move the pointer forward
while getdate(entry.posting_date) > result[date_index][0]:
date_index += 1
result[date_index][1] += entry.debit - entry.credit
# if account type is credit, switch balances
if root_type not in ('Asset', 'Expense'):
for r in result:
r[1] = -1 * r[1]
# for balance sheet accounts, the totals are cumulative
if root_type in ('Asset', 'Liability', 'Equity'):
for i, r in enumerate(result):
if i > 0:
r[1] = r[1] + result[i-1][1]
return result
def get_gl_entries(account, to_date):
child_accounts = get_descendants_of('Account', account, ignore_permissions=True)
child_accounts.append(account)
return frappe.db.get_all('GL Entry',
fields = ['posting_date', 'debit', 'credit'],
filters = [
dict(posting_date = ('<', to_date)),
dict(account = ('in', child_accounts)),
dict(voucher_type = ('!=', 'Period Closing Voucher'))
],
order_by = 'posting_date asc')
def get_dates_from_timegrain(from_date, to_date, timegrain):
days = months = years = 0
if "Daily" == timegrain:
days = 1
elif "Weekly" == timegrain:
days = 7
elif "Monthly" == timegrain:
months = 1
elif "Quarterly" == timegrain:
months = 3
dates = [get_period_ending(from_date, timegrain)]
while getdate(dates[-1]) < getdate(to_date):
date = get_period_ending(add_to_date(dates[-1], years=years, months=months, days=days), timegrain)
dates.append(date)
return dates

View File

@@ -1,470 +0,0 @@
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.email import sendmail_to_system_managers
from frappe.utils import (
add_days,
add_months,
cint,
date_diff,
flt,
get_first_day,
get_last_day,
get_link_to_form,
getdate,
rounded,
today,
)
from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import (
get_accounting_dimensions,
)
from erpnext.accounts.utils import get_account_currency
def validate_service_stop_date(doc):
''' Validates service_stop_date for Purchase Invoice and Sales Invoice '''
enable_check = "enable_deferred_revenue" \
if doc.doctype=="Sales Invoice" else "enable_deferred_expense"
old_stop_dates = {}
old_doc = frappe.db.get_all("{0} Item".format(doc.doctype),
{"parent": doc.name}, ["name", "service_stop_date"])
for d in old_doc:
old_stop_dates[d.name] = d.service_stop_date or ""
for item in doc.items:
if not item.get(enable_check): continue
if item.service_stop_date:
if date_diff(item.service_stop_date, item.service_start_date) < 0:
frappe.throw(_("Service Stop Date cannot be before Service Start Date"))
if date_diff(item.service_stop_date, item.service_end_date) > 0:
frappe.throw(_("Service Stop Date cannot be after Service End Date"))
if old_stop_dates and old_stop_dates.get(item.name) and item.service_stop_date!=old_stop_dates.get(item.name):
frappe.throw(_("Cannot change Service Stop Date for item in row {0}").format(item.idx))
def build_conditions(process_type, account, company):
conditions=''
deferred_account = "item.deferred_revenue_account" if process_type=="Income" else "item.deferred_expense_account"
if account:
conditions += "AND %s='%s'"%(deferred_account, account)
elif company:
conditions += f"AND p.company = {frappe.db.escape(company)}"
return conditions
def convert_deferred_expense_to_expense(deferred_process, start_date=None, end_date=None, conditions=''):
# book the expense/income on the last day, but it will be trigger on the 1st of month at 12:00 AM
if not start_date:
start_date = add_months(today(), -1)
if not end_date:
end_date = add_days(today(), -1)
# check for the purchase invoice for which GL entries has to be done
invoices = frappe.db.sql_list('''
select distinct item.parent
from `tabPurchase Invoice Item` item, `tabPurchase Invoice` p
where item.service_start_date<=%s and item.service_end_date>=%s
and item.enable_deferred_expense = 1 and item.parent=p.name
and item.docstatus = 1 and ifnull(item.amount, 0) > 0
{0}
'''.format(conditions), (end_date, start_date)) #nosec
# For each invoice, book deferred expense
for invoice in invoices:
doc = frappe.get_doc("Purchase Invoice", invoice)
book_deferred_income_or_expense(doc, deferred_process, end_date)
if frappe.flags.deferred_accounting_error:
send_mail(deferred_process)
def convert_deferred_revenue_to_income(deferred_process, start_date=None, end_date=None, conditions=''):
# book the expense/income on the last day, but it will be trigger on the 1st of month at 12:00 AM
if not start_date:
start_date = add_months(today(), -1)
if not end_date:
end_date = add_days(today(), -1)
# check for the sales invoice for which GL entries has to be done
invoices = frappe.db.sql_list('''
select distinct item.parent
from `tabSales Invoice Item` item, `tabSales Invoice` p
where item.service_start_date<=%s and item.service_end_date>=%s
and item.enable_deferred_revenue = 1 and item.parent=p.name
and item.docstatus = 1 and ifnull(item.amount, 0) > 0
{0}
'''.format(conditions), (end_date, start_date)) #nosec
for invoice in invoices:
doc = frappe.get_doc("Sales Invoice", invoice)
book_deferred_income_or_expense(doc, deferred_process, end_date)
if frappe.flags.deferred_accounting_error:
send_mail(deferred_process)
def get_booking_dates(doc, item, posting_date=None):
if not posting_date:
posting_date = add_days(today(), -1)
last_gl_entry = False
deferred_account = "deferred_revenue_account" if doc.doctype=="Sales Invoice" else "deferred_expense_account"
prev_gl_entry = frappe.db.sql('''
select name, posting_date from `tabGL Entry` where company=%s and account=%s and
voucher_type=%s and voucher_no=%s and voucher_detail_no=%s
order by posting_date desc limit 1
''', (doc.company, item.get(deferred_account), doc.doctype, doc.name, item.name), as_dict=True)
prev_gl_via_je = frappe.db.sql('''
SELECT p.name, p.posting_date FROM `tabJournal Entry` p, `tabJournal Entry Account` c
WHERE p.name = c.parent and p.company=%s and c.account=%s
and c.reference_type=%s and c.reference_name=%s
and c.reference_detail_no=%s and c.docstatus < 2 order by posting_date desc limit 1
''', (doc.company, item.get(deferred_account), doc.doctype, doc.name, item.name), as_dict=True)
if prev_gl_via_je:
if (not prev_gl_entry) or (prev_gl_entry and
prev_gl_entry[0].posting_date < prev_gl_via_je[0].posting_date):
prev_gl_entry = prev_gl_via_je
if prev_gl_entry:
start_date = getdate(add_days(prev_gl_entry[0].posting_date, 1))
else:
start_date = item.service_start_date
end_date = get_last_day(start_date)
if end_date >= item.service_end_date:
end_date = item.service_end_date
last_gl_entry = True
elif item.service_stop_date and end_date >= item.service_stop_date:
end_date = item.service_stop_date
last_gl_entry = True
if end_date > getdate(posting_date):
end_date = posting_date
if getdate(start_date) <= getdate(end_date):
return start_date, end_date, last_gl_entry
else:
return None, None, None
def calculate_monthly_amount(doc, item, last_gl_entry, start_date, end_date, total_days, total_booking_days, account_currency):
amount, base_amount = 0, 0
if not last_gl_entry:
total_months = (item.service_end_date.year - item.service_start_date.year) * 12 + \
(item.service_end_date.month - item.service_start_date.month) + 1
prorate_factor = flt(date_diff(item.service_end_date, item.service_start_date)) \
/ flt(date_diff(get_last_day(item.service_end_date), get_first_day(item.service_start_date)))
actual_months = rounded(total_months * prorate_factor, 1)
already_booked_amount, already_booked_amount_in_account_currency = get_already_booked_amount(doc, item)
base_amount = flt(item.base_net_amount / actual_months, item.precision("base_net_amount"))
if base_amount + already_booked_amount > item.base_net_amount:
base_amount = item.base_net_amount - already_booked_amount
if account_currency==doc.company_currency:
amount = base_amount
else:
amount = flt(item.net_amount/actual_months, item.precision("net_amount"))
if amount + already_booked_amount_in_account_currency > item.net_amount:
amount = item.net_amount - already_booked_amount_in_account_currency
if not (get_first_day(start_date) == start_date and get_last_day(end_date) == end_date):
partial_month = flt(date_diff(end_date, start_date)) \
/ flt(date_diff(get_last_day(end_date), get_first_day(start_date)))
base_amount = rounded(partial_month, 1) * base_amount
amount = rounded(partial_month, 1) * amount
else:
already_booked_amount, already_booked_amount_in_account_currency = get_already_booked_amount(doc, item)
base_amount = flt(item.base_net_amount - already_booked_amount, item.precision("base_net_amount"))
if account_currency==doc.company_currency:
amount = base_amount
else:
amount = flt(item.net_amount - already_booked_amount_in_account_currency, item.precision("net_amount"))
return amount, base_amount
def calculate_amount(doc, item, last_gl_entry, total_days, total_booking_days, account_currency):
amount, base_amount = 0, 0
if not last_gl_entry:
base_amount = flt(item.base_net_amount*total_booking_days/flt(total_days), item.precision("base_net_amount"))
if account_currency==doc.company_currency:
amount = base_amount
else:
amount = flt(item.net_amount*total_booking_days/flt(total_days), item.precision("net_amount"))
else:
already_booked_amount, already_booked_amount_in_account_currency = get_already_booked_amount(doc, item)
base_amount = flt(item.base_net_amount - already_booked_amount, item.precision("base_net_amount"))
if account_currency==doc.company_currency:
amount = base_amount
else:
amount = flt(item.net_amount - already_booked_amount_in_account_currency, item.precision("net_amount"))
return amount, base_amount
def get_already_booked_amount(doc, item):
if doc.doctype == "Sales Invoice":
total_credit_debit, total_credit_debit_currency = "debit", "debit_in_account_currency"
deferred_account = "deferred_revenue_account"
else:
total_credit_debit, total_credit_debit_currency = "credit", "credit_in_account_currency"
deferred_account = "deferred_expense_account"
gl_entries_details = frappe.db.sql('''
select sum({0}) as total_credit, sum({1}) as total_credit_in_account_currency, voucher_detail_no
from `tabGL Entry` where company=%s and account=%s and voucher_type=%s and voucher_no=%s and voucher_detail_no=%s
group by voucher_detail_no
'''.format(total_credit_debit, total_credit_debit_currency),
(doc.company, item.get(deferred_account), doc.doctype, doc.name, item.name), as_dict=True)
journal_entry_details = frappe.db.sql('''
SELECT sum(c.{0}) as total_credit, sum(c.{1}) as total_credit_in_account_currency, reference_detail_no
FROM `tabJournal Entry` p , `tabJournal Entry Account` c WHERE p.name = c.parent and
p.company = %s and c.account=%s and c.reference_type=%s and c.reference_name=%s and c.reference_detail_no=%s
and p.docstatus < 2 group by reference_detail_no
'''.format(total_credit_debit, total_credit_debit_currency),
(doc.company, item.get(deferred_account), doc.doctype, doc.name, item.name), as_dict=True)
already_booked_amount = gl_entries_details[0].total_credit if gl_entries_details else 0
already_booked_amount += journal_entry_details[0].total_credit if journal_entry_details else 0
if doc.currency == doc.company_currency:
already_booked_amount_in_account_currency = already_booked_amount
else:
already_booked_amount_in_account_currency = gl_entries_details[0].total_credit_in_account_currency if gl_entries_details else 0
already_booked_amount_in_account_currency += journal_entry_details[0].total_credit_in_account_currency if journal_entry_details else 0
return already_booked_amount, already_booked_amount_in_account_currency
def book_deferred_income_or_expense(doc, deferred_process, posting_date=None):
enable_check = "enable_deferred_revenue" \
if doc.doctype=="Sales Invoice" else "enable_deferred_expense"
def _book_deferred_revenue_or_expense(item, via_journal_entry, submit_journal_entry, book_deferred_entries_based_on):
start_date, end_date, last_gl_entry = get_booking_dates(doc, item, posting_date=posting_date)
if not (start_date and end_date): return
account_currency = get_account_currency(item.expense_account)
if doc.doctype == "Sales Invoice":
against, project = doc.customer, doc.project
credit_account, debit_account = item.income_account, item.deferred_revenue_account
else:
against, project = doc.supplier, item.project
credit_account, debit_account = item.deferred_expense_account, item.expense_account
total_days = date_diff(item.service_end_date, item.service_start_date) + 1
total_booking_days = date_diff(end_date, start_date) + 1
if book_deferred_entries_based_on == 'Months':
amount, base_amount = calculate_monthly_amount(doc, item, last_gl_entry,
start_date, end_date, total_days, total_booking_days, account_currency)
else:
amount, base_amount = calculate_amount(doc, item, last_gl_entry,
total_days, total_booking_days, account_currency)
if not amount:
return
if via_journal_entry:
book_revenue_via_journal_entry(doc, credit_account, debit_account, against, amount,
base_amount, end_date, project, account_currency, item.cost_center, item, deferred_process, submit_journal_entry)
else:
make_gl_entries(doc, credit_account, debit_account, against,
amount, base_amount, end_date, project, account_currency, item.cost_center, item, deferred_process)
# Returned in case of any errors because it tries to submit the same record again and again in case of errors
if frappe.flags.deferred_accounting_error:
return
if getdate(end_date) < getdate(posting_date) and not last_gl_entry:
_book_deferred_revenue_or_expense(item, via_journal_entry, submit_journal_entry, book_deferred_entries_based_on)
via_journal_entry = cint(frappe.db.get_singles_value('Accounts Settings', 'book_deferred_entries_via_journal_entry'))
submit_journal_entry = cint(frappe.db.get_singles_value('Accounts Settings', 'submit_journal_entries'))
book_deferred_entries_based_on = frappe.db.get_singles_value('Accounts Settings', 'book_deferred_entries_based_on')
for item in doc.get('items'):
if item.get(enable_check):
_book_deferred_revenue_or_expense(item, via_journal_entry, submit_journal_entry, book_deferred_entries_based_on)
def process_deferred_accounting(posting_date=None):
''' Converts deferred income/expense into income/expense
Executed via background jobs on every month end '''
if not posting_date:
posting_date = today()
if not cint(frappe.db.get_singles_value('Accounts Settings', 'automatically_process_deferred_accounting_entry')):
return
start_date = add_months(today(), -1)
end_date = add_days(today(), -1)
companies = frappe.get_all('Company')
for company in companies:
for record_type in ('Income', 'Expense'):
doc = frappe.get_doc(dict(
doctype='Process Deferred Accounting',
company=company.name,
posting_date=posting_date,
start_date=start_date,
end_date=end_date,
type=record_type
))
doc.insert()
doc.submit()
def make_gl_entries(doc, credit_account, debit_account, against,
amount, base_amount, posting_date, project, account_currency, cost_center, item, deferred_process=None):
# GL Entry for crediting the amount in the deferred expense
from erpnext.accounts.general_ledger import make_gl_entries
if amount == 0: return
gl_entries = []
gl_entries.append(
doc.get_gl_dict({
"account": credit_account,
"against": against,
"credit": base_amount,
"credit_in_account_currency": amount,
"cost_center": cost_center,
"voucher_detail_no": item.name,
'posting_date': posting_date,
'project': project,
'against_voucher_type': 'Process Deferred Accounting',
'against_voucher': deferred_process
}, account_currency, item=item)
)
# GL Entry to debit the amount from the expense
gl_entries.append(
doc.get_gl_dict({
"account": debit_account,
"against": against,
"debit": base_amount,
"debit_in_account_currency": amount,
"cost_center": cost_center,
"voucher_detail_no": item.name,
'posting_date': posting_date,
'project': project,
'against_voucher_type': 'Process Deferred Accounting',
'against_voucher': deferred_process
}, account_currency, item=item)
)
if gl_entries:
try:
make_gl_entries(gl_entries, cancel=(doc.docstatus == 2), merge_entries=True)
frappe.db.commit()
except Exception as e:
if frappe.flags.in_test:
raise e
else:
frappe.db.rollback()
traceback = frappe.get_traceback()
frappe.log_error(message=traceback)
frappe.flags.deferred_accounting_error = True
def send_mail(deferred_process):
title = _("Error while processing deferred accounting for {0}").format(deferred_process)
link = get_link_to_form('Process Deferred Accounting', deferred_process)
content = _("Deferred accounting failed for some invoices:") + "\n"
content += _("Please check Process Deferred Accounting {0} and submit manually after resolving errors.").format(link)
sendmail_to_system_managers(title, content)
def book_revenue_via_journal_entry(doc, credit_account, debit_account, against,
amount, base_amount, posting_date, project, account_currency, cost_center, item,
deferred_process=None, submit='No'):
if amount == 0: return
journal_entry = frappe.new_doc('Journal Entry')
journal_entry.posting_date = posting_date
journal_entry.company = doc.company
journal_entry.voucher_type = 'Deferred Revenue' if doc.doctype == 'Sales Invoice' \
else 'Deferred Expense'
debit_entry = {
'account': credit_account,
'credit': base_amount,
'credit_in_account_currency': amount,
'party_type': 'Customer' if doc.doctype == 'Sales Invoice' else 'Supplier',
'party': against,
'account_currency': account_currency,
'reference_name': doc.name,
'reference_type': doc.doctype,
'reference_detail_no': item.name,
'cost_center': cost_center,
'project': project,
}
credit_entry = {
'account': debit_account,
'debit': base_amount,
'debit_in_account_currency': amount,
'party_type': 'Customer' if doc.doctype == 'Sales Invoice' else 'Supplier',
'party': against,
'account_currency': account_currency,
'reference_name': doc.name,
'reference_type': doc.doctype,
'reference_detail_no': item.name,
'cost_center': cost_center,
'project': project,
}
for dimension in get_accounting_dimensions():
debit_entry.update({
dimension: item.get(dimension)
})
credit_entry.update({
dimension: item.get(dimension)
})
journal_entry.append('accounts', debit_entry)
journal_entry.append('accounts', credit_entry)
try:
journal_entry.save()
if submit:
journal_entry.submit()
except Exception:
frappe.db.rollback()
traceback = frappe.get_traceback()
frappe.log_error(message=traceback)
frappe.flags.deferred_accounting_error = True
def get_deferred_booking_accounts(doctype, voucher_detail_no, dr_or_cr):
if doctype == 'Sales Invoice':
credit_account, debit_account = frappe.db.get_value('Sales Invoice Item', {'name': voucher_detail_no},
['income_account', 'deferred_revenue_account'])
else:
credit_account, debit_account = frappe.db.get_value('Purchase Invoice Item', {'name': voucher_detail_no},
['deferred_expense_account', 'expense_account'])
if dr_or_cr == 'Debit':
return debit_account
else:
return credit_account

View File

@@ -1,186 +1,95 @@
// Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt
frappe.ui.form.on('Account', {
setup: function(frm) {
frm.add_fetch('parent_account', 'report_type', 'report_type');
frm.add_fetch('parent_account', 'root_type', 'root_type');
},
onload: function(frm) {
frm.set_query('parent_account', function(doc) {
return {
filters: {
"is_group": 1,
"company": doc.company
}
};
});
},
refresh: function(frm) {
frm.toggle_display('account_name', frm.is_new());
cur_frm.list_route = "Accounts Browser/Account";
// hide fields if group
frm.toggle_display(['account_type', 'tax_rate'], cint(frm.doc.is_group) == 0);
// disable fields
frm.toggle_enable(['is_group', 'company'], false);
if (cint(frm.doc.is_group) == 0) {
frm.toggle_display('freeze_account', frm.doc.__onload
&& frm.doc.__onload.can_freeze_account);
}
// read-only for root accounts
if (!frm.is_new()) {
if (!frm.doc.parent_account) {
frm.set_read_only();
frm.set_intro(__("This is a root account and cannot be edited."));
} else {
// credit days and type if customer or supplier
frm.set_intro(null);
frm.trigger('account_type');
// show / hide convert buttons
frm.trigger('add_toolbar_buttons');
}
if (frm.has_perm('write')) {
frm.add_custom_button(__('Update Account Name / Number'), function () {
frm.trigger("update_account_number");
});
frm.add_custom_button(__('Merge Account'), function () {
frm.trigger("merge_account");
});
}
}
},
account_type: function (frm) {
if (frm.doc.is_group == 0) {
frm.toggle_display(['tax_rate'], frm.doc.account_type == 'Tax');
frm.toggle_display('warehouse', frm.doc.account_type == 'Stock');
}
},
add_toolbar_buttons: function(frm) {
frm.add_custom_button(__('Chart of Accounts'),
function () { frappe.set_route("Tree", "Account"); });
if (frm.doc.is_group == 1) {
frm.add_custom_button(__('Group to Non-Group'), function () {
return frappe.call({
doc: frm.doc,
method: 'convert_group_to_ledger',
callback: function() {
frm.refresh();
}
});
});
} else if (cint(frm.doc.is_group) == 0
&& frappe.boot.user.can_read.indexOf("GL Entry") !== -1) {
frm.add_custom_button(__('Ledger'), function () {
frappe.route_options = {
"account": frm.doc.name,
"from_date": frappe.sys_defaults.year_start_date,
"to_date": frappe.sys_defaults.year_end_date,
"company": frm.doc.company
};
frappe.set_route("query-report", "General Ledger");
});
frm.add_custom_button(__('Non-Group to Group'), function () {
return frappe.call({
doc: frm.doc,
method: 'convert_ledger_to_group',
callback: function() {
frm.refresh();
}
});
});
}
},
merge_account: function(frm) {
var d = new frappe.ui.Dialog({
title: __('Merge with Existing Account'),
fields: [
{
"label" : "Name",
"fieldname": "name",
"fieldtype": "Data",
"reqd": 1,
"default": frm.doc.name
}
],
primary_action: function() {
var data = d.get_values();
frappe.call({
method: "erpnext.accounts.doctype.account.account.merge_account",
args: {
old: frm.doc.name,
new: data.name,
is_group: frm.doc.is_group,
root_type: frm.doc.root_type,
company: frm.doc.company
},
callback: function(r) {
if(!r.exc) {
if(r.message) {
frappe.set_route("Form", "Account", r.message);
}
d.hide();
}
}
});
},
primary_action_label: __('Merge')
});
d.show();
},
update_account_number: function(frm) {
var d = new frappe.ui.Dialog({
title: __('Update Account Number / Name'),
fields: [
{
"label": "Account Name",
"fieldname": "account_name",
"fieldtype": "Data",
"reqd": 1,
"default": frm.doc.account_name
},
{
"label": "Account Number",
"fieldname": "account_number",
"fieldtype": "Data",
"default": frm.doc.account_number
}
],
primary_action: function() {
var data = d.get_values();
if(data.account_number === frm.doc.account_number && data.account_name === frm.doc.account_name) {
d.hide();
return;
}
frappe.call({
method: "erpnext.accounts.doctype.account.account.update_account_number",
args: {
account_number: data.account_number,
account_name: data.account_name,
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);
frm.set_value("account_name", data.account_name);
}
d.hide();
}
}
});
},
primary_action_label: __('Update')
});
d.show();
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
if(doc.__islocal) {
msgprint(__("Please create new account from Chart of Accounts."));
throw "cannot create";
}
});
cur_frm.toggle_display('account_name', doc.__islocal);
// hide fields if group
cur_frm.toggle_display(['account_type', 'tax_rate'], cint(doc.is_group)==0)
// disable fields
cur_frm.toggle_enable(['account_name', 'is_group', 'company'], false);
if(cint(doc.is_group)==0) {
cur_frm.toggle_display('freeze_account', doc.__onload && doc.__onload.can_freeze_account);
}
// read-only for root accounts
if(!doc.parent_account) {
cur_frm.set_read_only();
cur_frm.set_intro(__("This is a root account and cannot be edited."));
} else {
// credit days and type if customer or supplier
cur_frm.set_intro(null);
cur_frm.cscript.account_type(doc, cdt, cdn);
// show / hide convert buttons
cur_frm.cscript.add_toolbar_buttons(doc);
}
}
cur_frm.add_fetch('parent_account', 'report_type', 'report_type');
cur_frm.add_fetch('parent_account', 'root_type', 'root_type');
cur_frm.cscript.account_type = function(doc, cdt, cdn) {
if(doc.is_group==0) {
cur_frm.toggle_display(['tax_rate'], doc.account_type == 'Tax');
cur_frm.toggle_display('warehouse', doc.account_type=='Warehouse');
}
}
cur_frm.cscript.add_toolbar_buttons = function(doc) {
cur_frm.add_custom_button(__('Chart of Accounts'),
function() { frappe.set_route("Accounts Browser", "Account"); }, __("View"))
if (doc.is_group == 1) {
cur_frm.add_custom_button(__('Group to Non-Group'),
function() { cur_frm.cscript.convert_to_ledger(); }, 'icon-retweet', 'btn-default');
} else if (cint(doc.is_group) == 0) {
cur_frm.add_custom_button(__('Ledger'), function() {
frappe.route_options = {
"account": doc.name,
"from_date": sys_defaults.year_start_date,
"to_date": sys_defaults.year_end_date,
"company": doc.company
};
frappe.set_route("query-report", "General Ledger");
}, __("View"));
cur_frm.add_custom_button(__('Group to Group'),
function() { cur_frm.cscript.convert_to_group(); }, 'icon-retweet', 'btn-default')
}
}
cur_frm.cscript.convert_to_ledger = function(doc, cdt, cdn) {
return $c_obj(cur_frm.doc,'convert_group_to_ledger','',function(r,rt) {
if(r.message == 1) {
cur_frm.refresh();
}
});
}
cur_frm.cscript.convert_to_group = function(doc, cdt, cdn) {
return $c_obj(cur_frm.doc,'convert_ledger_to_group','',function(r,rt) {
if(r.message == 1) {
cur_frm.refresh();
}
});
}
cur_frm.fields_dict['parent_account'].get_query = function(doc) {
return {
filters: {
"is_group": 1,
"company": doc.company
}
}
}

View File

@@ -1,305 +1,576 @@
{
"actions": [],
"allow_copy": 1,
"allow_import": 1,
"creation": "2013-01-30 12:49:46",
"description": "Heads (or groups) against which Accounting Entries are made and balances are maintained.",
"doctype": "DocType",
"document_type": "Setup",
"engine": "InnoDB",
"field_order": [
"properties",
"column_break0",
"disabled",
"account_name",
"account_number",
"is_group",
"company",
"root_type",
"report_type",
"account_currency",
"inter_company_account",
"column_break1",
"parent_account",
"account_type",
"tax_rate",
"freeze_account",
"balance_must_be",
"lft",
"rgt",
"old_parent",
"include_in_gross"
],
"allow_copy": 1,
"allow_import": 1,
"allow_rename": 1,
"creation": "2013-01-30 12:49:46",
"custom": 0,
"description": "Heads (or groups) against which Accounting Entries are made and balances are maintained.",
"docstatus": 0,
"doctype": "DocType",
"document_type": "Setup",
"fields": [
{
"fieldname": "properties",
"fieldtype": "Section Break",
"oldfieldtype": "Section Break",
"show_days": 1,
"show_seconds": 1
},
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "properties",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "",
"length": 0,
"no_copy": 0,
"oldfieldtype": "Section Break",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"fieldname": "column_break0",
"fieldtype": "Column Break",
"show_days": 1,
"show_seconds": 1,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "column_break0",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0,
"width": "50%"
},
},
{
"fieldname": "account_name",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Account Name",
"no_copy": 1,
"oldfieldname": "account_name",
"oldfieldtype": "Data",
"reqd": 1,
"show_days": 1,
"show_seconds": 1
},
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "account_name",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 1,
"in_list_view": 1,
"label": "Account Name",
"length": 0,
"no_copy": 1,
"oldfieldname": "account_name",
"oldfieldtype": "Data",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"fieldname": "account_number",
"fieldtype": "Data",
"in_list_view": 1,
"in_standard_filter": 1,
"label": "Account Number",
"read_only": 1,
"show_days": 1,
"show_seconds": 1
},
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"default": "0",
"fieldname": "is_group",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Is Group",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"default": "0",
"fieldname": "is_group",
"fieldtype": "Check",
"label": "Is Group",
"show_days": 1,
"show_seconds": 1
},
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "company",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 1,
"in_list_view": 0,
"label": "Company",
"length": 0,
"no_copy": 0,
"oldfieldname": "company",
"oldfieldtype": "Link",
"options": "Company",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"fieldname": "company",
"fieldtype": "Link",
"in_standard_filter": 1,
"label": "Company",
"oldfieldname": "company",
"oldfieldtype": "Link",
"options": "Company",
"read_only": 1,
"remember_last_selected_value": 1,
"reqd": 1,
"show_days": 1,
"show_seconds": 1
},
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "root_type",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Root Type",
"length": 0,
"no_copy": 0,
"options": "\nAsset\nLiability\nIncome\nExpense\nEquity",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"fieldname": "root_type",
"fieldtype": "Select",
"in_standard_filter": 1,
"label": "Root Type",
"options": "\nAsset\nLiability\nIncome\nExpense\nEquity",
"read_only": 1,
"show_days": 1,
"show_seconds": 1
},
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "report_type",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Report Type",
"length": 0,
"no_copy": 0,
"options": "\nBalance Sheet\nProfit and Loss",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"fieldname": "report_type",
"fieldtype": "Select",
"in_standard_filter": 1,
"label": "Report Type",
"options": "\nBalance Sheet\nProfit and Loss",
"read_only": 1,
"show_days": 1,
"show_seconds": 1
},
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "eval:doc.is_group==0",
"fieldname": "account_currency",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Currency",
"length": 0,
"no_copy": 0,
"options": "Currency",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"depends_on": "eval:doc.is_group==0",
"fieldname": "account_currency",
"fieldtype": "Link",
"label": "Currency",
"options": "Currency",
"show_days": 1,
"show_seconds": 1
},
{
"default": "0",
"fieldname": "inter_company_account",
"fieldtype": "Check",
"label": "Inter Company Account",
"show_days": 1,
"show_seconds": 1
},
{
"fieldname": "column_break1",
"fieldtype": "Column Break",
"show_days": 1,
"show_seconds": 1,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "column_break1",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0,
"width": "50%"
},
},
{
"fieldname": "parent_account",
"fieldtype": "Link",
"ignore_user_permissions": 1,
"label": "Parent Account",
"oldfieldname": "parent_account",
"oldfieldtype": "Link",
"options": "Account",
"reqd": 1,
"search_index": 1,
"show_days": 1,
"show_seconds": 1
},
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "parent_account",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 1,
"in_filter": 0,
"in_list_view": 0,
"label": "Parent Account",
"length": 0,
"no_copy": 0,
"oldfieldname": "parent_account",
"oldfieldtype": "Link",
"options": "Account",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 1,
"set_only_once": 0,
"unique": 0
},
{
"description": "Setting Account Type helps in selecting this Account in transactions.",
"fieldname": "account_type",
"fieldtype": "Select",
"in_standard_filter": 1,
"label": "Account Type",
"oldfieldname": "account_type",
"oldfieldtype": "Select",
"options": "\nAccumulated Depreciation\nAsset Received But Not Billed\nBank\nCash\nChargeable\nCapital Work in Progress\nCost of Goods Sold\nDepreciation\nEquity\nExpense Account\nExpenses Included In Asset Valuation\nExpenses Included In Valuation\nFixed Asset\nIncome Account\nPayable\nReceivable\nRound Off\nStock\nStock Adjustment\nStock Received But Not Billed\nService Received But Not Billed\nTax\nTemporary",
"show_days": 1,
"show_seconds": 1
},
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "Setting Account Type helps in selecting this Account in transactions.",
"fieldname": "account_type",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 1,
"in_list_view": 0,
"label": "Account Type",
"length": 0,
"no_copy": 0,
"oldfieldname": "account_type",
"oldfieldtype": "Select",
"options": "\nBank\nCash\nDepreciation\nTax\nChargeable\nWarehouse\nReceivable\nPayable\nEquity\nFixed Asset\nCost of Goods Sold\nExpense Account\nRound Off\nIncome Account\nStock Received But Not Billed\nExpenses Included In Valuation\nStock Adjustment\nStock\nTemporary",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"description": "Rate at which this tax is applied",
"fieldname": "tax_rate",
"fieldtype": "Float",
"label": "Rate",
"oldfieldname": "tax_rate",
"oldfieldtype": "Currency",
"show_days": 1,
"show_seconds": 1
},
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "Rate at which this tax is applied",
"fieldname": "tax_rate",
"fieldtype": "Float",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Rate",
"length": 0,
"no_copy": 0,
"oldfieldname": "tax_rate",
"oldfieldtype": "Currency",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"description": "If the account is frozen, entries are allowed to restricted users.",
"fieldname": "freeze_account",
"fieldtype": "Select",
"label": "Frozen",
"oldfieldname": "freeze_account",
"oldfieldtype": "Select",
"options": "No\nYes",
"show_days": 1,
"show_seconds": 1
},
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "If the account is frozen, entries are allowed to restricted users.",
"fieldname": "freeze_account",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Frozen",
"length": 0,
"no_copy": 0,
"oldfieldname": "freeze_account",
"oldfieldtype": "Select",
"options": "No\nYes",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"fieldname": "balance_must_be",
"fieldtype": "Select",
"label": "Balance must be",
"options": "\nDebit\nCredit",
"show_days": 1,
"show_seconds": 1
},
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "warehouse",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Warehouse",
"length": 0,
"no_copy": 0,
"options": "Warehouse",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"fieldname": "lft",
"fieldtype": "Int",
"hidden": 1,
"label": "Lft",
"print_hide": 1,
"read_only": 1,
"search_index": 1,
"show_days": 1,
"show_seconds": 1
},
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "balance_must_be",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Balance must be",
"length": 0,
"no_copy": 0,
"options": "\nDebit\nCredit",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"fieldname": "rgt",
"fieldtype": "Int",
"hidden": 1,
"label": "Rgt",
"print_hide": 1,
"read_only": 1,
"search_index": 1,
"show_days": 1,
"show_seconds": 1
},
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "lft",
"fieldtype": "Int",
"hidden": 1,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Lft",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 1,
"set_only_once": 0,
"unique": 0
},
{
"fieldname": "old_parent",
"fieldtype": "Data",
"hidden": 1,
"label": "Old Parent",
"print_hide": 1,
"read_only": 1,
"show_days": 1,
"show_seconds": 1
},
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "rgt",
"fieldtype": "Int",
"hidden": 1,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Rgt",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 1,
"set_only_once": 0,
"unique": 0
},
{
"default": "0",
"depends_on": "eval:(doc.report_type == 'Profit and Loss' && !doc.is_group)",
"fieldname": "include_in_gross",
"fieldtype": "Check",
"label": "Include in gross",
"show_days": 1,
"show_seconds": 1
},
{
"default": "0",
"fieldname": "disabled",
"fieldtype": "Check",
"label": "Disable",
"show_days": 1,
"show_seconds": 1
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "old_parent",
"fieldtype": "Data",
"hidden": 1,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Old Parent",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
}
],
"icon": "fa fa-money",
"idx": 1,
"is_tree": 1,
"links": [],
"modified": "2020-06-11 15:15:54.338622",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Account",
"nsm_parent_field": "parent_account",
"owner": "Administrator",
],
"hide_heading": 0,
"hide_toolbar": 0,
"icon": "icon-money",
"idx": 1,
"in_create": 0,
"in_dialog": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2015-12-12 10:19:54.365839",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Account",
"owner": "Administrator",
"permissions": [
{
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"import": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "Accounts User",
"share": 1,
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"if_owner": 0,
"import": 1,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Accounts User",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"write": 1
},
},
{
"email": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "Auditor"
},
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 0,
"delete": 0,
"email": 1,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Auditor",
"set_user_permissions": 0,
"share": 0,
"submit": 0,
"write": 0
},
{
"email": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "Sales User"
},
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 0,
"delete": 0,
"email": 1,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Sales User",
"set_user_permissions": 0,
"share": 0,
"submit": 0,
"write": 0
},
{
"email": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "Purchase User"
},
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 0,
"delete": 0,
"email": 1,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Purchase User",
"set_user_permissions": 0,
"share": 0,
"submit": 0,
"write": 0
},
{
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"import": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "Accounts Manager",
"set_user_permissions": 1,
"share": 1,
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"if_owner": 0,
"import": 1,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Accounts Manager",
"set_user_permissions": 1,
"share": 1,
"submit": 0,
"write": 1
}
],
"search_fields": "account_number",
"show_name_in_global_search": 1,
"sort_field": "modified",
"sort_order": "ASC",
"track_changes": 1
],
"read_only": 0,
"read_only_onload": 0,
"search_fields": ""
}

View File

@@ -2,50 +2,42 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe import _, throw
from frappe.utils import cint, cstr
from frappe.utils.nestedset import NestedSet, get_ancestors_of, get_descendants_of
import erpnext
from frappe.utils import cstr, cint
from frappe import throw, _
from frappe.model.document import Document
class RootNotEditable(frappe.ValidationError): pass
class BalanceMismatchError(frappe.ValidationError): pass
class Account(NestedSet):
class Account(Document):
nsm_parent_field = 'parent_account'
def on_update(self):
if frappe.local.flags.ignore_update_nsm:
return
else:
super(Account, self).on_update()
def onload(self):
frozen_accounts_modifier = frappe.db.get_value("Accounts Settings", "Accounts Settings",
"frozen_accounts_modifier")
if not frozen_accounts_modifier or frozen_accounts_modifier in frappe.get_roles():
self.set_onload("can_freeze_account", True)
self.get("__onload").can_freeze_account = True
def autoname(self):
from erpnext.accounts.utils import get_autoname_with_number
self.name = get_autoname_with_number(self.account_number, self.account_name, None, self.company)
# first validate if company exists
company = frappe.db.get_value("Company", self.company, ["abbr", "name"], as_dict=True)
if not company:
frappe.throw(_('Company {0} does not exist').format(self.company))
self.name = self.account_name.strip() + ' - ' + company.abbr
def validate(self):
from erpnext.accounts.utils import validate_field_number
if frappe.local.flags.allow_unverified_charts:
return
self.validate_parent()
self.validate_root_details()
validate_field_number("Account", self.name, self.account_number, self.company, "account_number")
self.validate_group_or_ledger()
self.set_root_and_report_type()
self.validate_mandatory()
self.validate_warehouse_account()
self.validate_frozen_accounts_modifier()
self.validate_balance_must_be_debit_or_credit()
self.validate_account_currency()
self.validate_root_company_and_sync_account_to_children()
def validate_parent(self):
"""Fetch Parent Details and validate parent account"""
@@ -64,8 +56,7 @@ class Account(NestedSet):
def set_root_and_report_type(self):
if self.parent_account:
par = frappe.db.get_value("Account", self.parent_account,
["report_type", "root_type"], as_dict=1)
par = frappe.db.get_value("Account", self.parent_account, ["report_type", "root_type"], as_dict=1)
if par.report_type:
self.report_type = par.report_type
@@ -93,49 +84,18 @@ class Account(NestedSet):
throw(_("Root cannot be edited."), RootNotEditable)
if not self.parent_account and not self.is_group:
frappe.throw(_("The root account {0} must be a group").format(frappe.bold(self.name)))
def validate_root_company_and_sync_account_to_children(self):
# ignore validation while creating new compnay or while syncing to child companies
if frappe.local.flags.ignore_root_company_validation or self.flags.ignore_root_company_validation:
return
ancestors = get_root_company(self.company)
if ancestors:
if frappe.get_value("Company", self.company, "allow_account_creation_against_child_company"):
return
if not frappe.db.get_value("Account",
{'account_name': self.account_name, 'company': ancestors[0]}, 'name'):
frappe.throw(_("Please add the account to root level Company - {}").format(ancestors[0]))
elif self.parent_account:
descendants = get_descendants_of('Company', self.company)
if not descendants: return
parent_acc_name_map = {}
parent_acc_name, parent_acc_number = frappe.db.get_value('Account', self.parent_account, \
["account_name", "account_number"])
filters = {
"company": ["in", descendants],
"account_name": parent_acc_name,
}
if parent_acc_number:
filters["account_number"] = parent_acc_number
for d in frappe.db.get_values('Account', filters=filters, fieldname=["company", "name"], as_dict=True):
parent_acc_name_map[d["company"]] = d["name"]
if not parent_acc_name_map: return
self.create_account_for_child_company(parent_acc_name_map, descendants, parent_acc_name)
frappe.throw(_("Root Account must be a group"))
def validate_group_or_ledger(self):
if self.get("__islocal"):
return
existing_is_group = frappe.db.get_value("Account", self.name, "is_group")
if cint(self.is_group) != cint(existing_is_group):
if self.is_group != existing_is_group:
if self.check_gle_exists():
throw(_("Account with existing transaction cannot be converted to ledger"))
elif self.is_group:
if self.account_type and not self.flags.exclude_account_type_check:
if self.account_type:
throw(_("Cannot covert to Group because Account Type is selected."))
elif self.check_if_child_exists():
throw(_("Account with child nodes cannot be set as ledger"))
@@ -160,64 +120,12 @@ class Account(NestedSet):
def validate_account_currency(self):
if not self.account_currency:
self.account_currency = frappe.get_cached_value('Company', self.company, "default_currency")
self.account_currency = frappe.db.get_value("Company", self.company, "default_currency")
elif self.account_currency != frappe.db.get_value("Account", self.name, "account_currency"):
if frappe.db.get_value("GL Entry", {"account": self.name}):
frappe.throw(_("Currency can not be changed after making entries using some other currency"))
def create_account_for_child_company(self, parent_acc_name_map, descendants, parent_acc_name):
for company in descendants:
company_bold = frappe.bold(company)
parent_acc_name_bold = frappe.bold(parent_acc_name)
if not parent_acc_name_map.get(company):
frappe.throw(_("While creating account for Child Company {0}, parent account {1} not found. Please create the parent account in corresponding COA")
.format(company_bold, parent_acc_name_bold), title=_("Account Not Found"))
# validate if parent of child company account to be added is a group
if (frappe.db.get_value("Account", self.parent_account, "is_group")
and not frappe.db.get_value("Account", parent_acc_name_map[company], "is_group")):
msg = _("While creating account for Child Company {0}, parent account {1} found as a ledger account.").format(company_bold, parent_acc_name_bold)
msg += "<br><br>"
msg += _("Please convert the parent account in corresponding child company to a group account.")
frappe.throw(msg, title=_("Invalid Parent Account"))
filters = {
"account_name": self.account_name,
"company": company
}
if self.account_number:
filters["account_number"] = self.account_number
child_account = frappe.db.get_value("Account", filters, 'name')
if not child_account:
doc = frappe.copy_doc(self)
doc.flags.ignore_root_company_validation = True
doc.update({
"company": company,
# parent account's currency should be passed down to child account's curreny
# if it is None, it picks it up from default company currency, which might be unintended
"account_currency": erpnext.get_company_currency(company),
"parent_account": parent_acc_name_map[company]
})
doc.save()
frappe.msgprint(_("Account {0} is added in the child company {1}")
.format(doc.name, company))
elif child_account:
# update the parent company's value in child companies
doc = frappe.get_doc("Account", child_account)
parent_value_changed = False
for field in ['account_type', 'freeze_account', 'balance_must_be']:
if doc.get(field) != self.get(field):
parent_value_changed = True
doc.set(field, self.get(field))
if parent_value_changed:
doc.save()
@frappe.whitelist()
def convert_group_to_ledger(self):
if self.check_if_child_exists():
throw(_("Account with child nodes cannot be converted to ledger"))
@@ -228,12 +136,11 @@ class Account(NestedSet):
self.save()
return 1
@frappe.whitelist()
def convert_ledger_to_group(self):
if self.check_gle_exists():
throw(_("Account with existing transaction can not be converted to group."))
elif self.account_type and not self.flags.exclude_account_type_check:
throw(_("Cannot convert to Group because Account Type is selected."))
elif self.account_type:
throw(_("Cannot covert to Group because Account Type is selected."))
else:
self.is_group = 1
self.save()
@@ -254,15 +161,77 @@ class Account(NestedSet):
if not self.report_type:
throw(_("Report Type is mandatory"))
def on_trash(self):
# checks gl entries and if child exists
def validate_warehouse_account(self):
if not cint(frappe.defaults.get_global_default("auto_accounting_for_stock")):
return
if self.account_type == "Warehouse":
if not self.warehouse:
throw(_("Warehouse is mandatory if account type is Warehouse"))
old_warehouse = cstr(frappe.db.get_value("Account", self.name, "warehouse"))
if old_warehouse != cstr(self.warehouse):
if old_warehouse:
self.validate_warehouse(old_warehouse)
if self.warehouse:
self.validate_warehouse(self.warehouse)
elif self.warehouse:
self.warehouse = None
def validate_warehouse(self, warehouse):
if frappe.db.get_value("Stock Ledger Entry", {"warehouse": warehouse}):
throw(_("Stock entries exist against warehouse {0}, hence you cannot re-assign or modify Warehouse").format(warehouse))
def update_nsm_model(self):
"""update lft, rgt indices for nested set model"""
import frappe
import frappe.utils.nestedset
frappe.utils.nestedset.update_nsm(self)
def on_update(self):
self.update_nsm_model()
def validate_trash(self):
"""checks gl entries and if child exists"""
if self.check_gle_exists():
throw(_("Account with existing transaction can not be deleted"))
if self.check_if_child_exists():
throw(_("Child account exists for this account. You can not delete this account."))
super(Account, self).on_trash(True)
def on_trash(self):
self.validate_trash()
self.update_nsm_model()
def before_rename(self, old, new, merge=False):
# Add company abbr if not provided
from erpnext.setup.doctype.company.company import get_name_with_abbr
new_account = get_name_with_abbr(new, self.company)
# Validate properties before merging
if merge:
if not frappe.db.exists("Account", new):
throw(_("Account {0} does not exist").format(new))
val = list(frappe.db.get_value("Account", new_account,
["is_group", "root_type", "company"]))
if val != [self.is_group, self.root_type, self.company]:
throw(_("""Merging is only possible if following properties are same in both records. Is Group, Root Type, Company"""))
if self.is_group and frappe.db.get_value("Account", new, "parent_account") == old:
frappe.db.set_value("Account", new, "parent_account",
frappe.db.get_value("Account", old, "parent_account"))
return new_account
def after_rename(self, old, new, merge=False):
if not merge:
frappe.db.set_value("Account", new, "account_name",
" - ".join(new.split(" - ")[:-1]))
else:
from frappe.utils.nestedset import rebuild_tree
rebuild_tree("Account", "parent_account")
@frappe.whitelist()
@frappe.validate_and_sanitize_search_inputs
def get_parent_account(doctype, txt, searchfield, start, page_len, filters):
return frappe.db.sql("""select name from tabAccount
where is_group = 1 and docstatus != 2 and company = %s
@@ -275,113 +244,10 @@ def get_account_currency(account):
if not account:
return
def generator():
account_currency, company = frappe.get_cached_value("Account", account, ["account_currency", "company"])
account_currency, company = frappe.db.get_value("Account", account, ["account_currency", "company"])
if not account_currency:
account_currency = frappe.get_cached_value('Company', company, "default_currency")
account_currency = frappe.db.get_value("Company", company, "default_currency")
return account_currency
return frappe.local_cache("account_currency", account, generator)
def on_doctype_update():
frappe.db.add_index("Account", ["lft", "rgt"])
def get_account_autoname(account_number, account_name, company):
# first validate if company exists
company = frappe.get_cached_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_name, account_number=None, from_descendant=False):
account = frappe.db.get_value("Account", name, "company", as_dict=True)
if not account: return
old_acc_name, old_acc_number = frappe.db.get_value('Account', name, \
["account_name", "account_number"])
# check if account exists in parent company
ancestors = get_ancestors_of("Company", account.company)
allow_independent_account_creation = frappe.get_value("Company", account.company, "allow_account_creation_against_child_company")
if ancestors and not allow_independent_account_creation:
for ancestor in ancestors:
if frappe.db.get_value("Account", {'account_name': old_acc_name, 'company': ancestor}, 'name'):
# same account in parent company exists
allow_child_account_creation = _("Allow Account Creation Against Child Company")
message = _("Account {0} exists in parent company {1}.").format(frappe.bold(old_acc_name), frappe.bold(ancestor))
message += "<br>"
message += _("Renaming it is only allowed via parent company {0}, to avoid mismatch.").format(frappe.bold(ancestor))
message += "<br><br>"
message += _("To overrule this, enable '{0}' in company {1}").format(allow_child_account_creation, frappe.bold(account.company))
frappe.throw(message, title=_("Rename Not Allowed"))
validate_account_number(name, account_number, account.company)
if account_number:
frappe.db.set_value("Account", name, "account_number", account_number.strip())
else:
frappe.db.set_value("Account", name, "account_number", "")
frappe.db.set_value("Account", name, "account_name", account_name.strip())
if not from_descendant:
# Update and rename in child company accounts as well
descendants = get_descendants_of('Company', account.company)
if descendants:
sync_update_account_number_in_child(descendants, old_acc_name, account_name, account_number, old_acc_number)
new_name = get_account_autoname(account_number, account_name, account.company)
if name != new_name:
frappe.rename_doc("Account", name, new_name, force=1)
return new_name
@frappe.whitelist()
def merge_account(old, new, is_group, root_type, company):
# Validate properties before merging
if not frappe.db.exists("Account", new):
throw(_("Account {0} does not exist").format(new))
val = list(frappe.db.get_value("Account", new,
["is_group", "root_type", "company"]))
if val != [cint(is_group), root_type, company]:
throw(_("""Merging is only possible if following properties are same in both records. Is Group, Root Type, Company"""))
if is_group and frappe.db.get_value("Account", new, "parent_account") == old:
frappe.db.set_value("Account", new, "parent_account",
frappe.db.get_value("Account", old, "parent_account"))
frappe.rename_doc("Account", old, new, merge=1, force=1)
return new
@frappe.whitelist()
def get_root_company(company):
# return the topmost company in the hierarchy
ancestors = get_ancestors_of('Company', company, "lft asc")
return [ancestors[0]] if ancestors else []
def sync_update_account_number_in_child(descendants, old_acc_name, account_name, account_number=None, old_acc_number=None):
filters = {
"company": ["in", descendants],
"account_name": old_acc_name,
}
if old_acc_number:
filters["account_number"] = old_acc_number
for d in frappe.db.get_values('Account', filters=filters, fieldname=["company", "name"], as_dict=True):
update_account_number(d["name"], account_name, account_number, from_descendant=True)

View File

@@ -1,201 +0,0 @@
frappe.provide("frappe.treeview_settings")
frappe.treeview_settings["Account"] = {
breadcrumb: "Accounts",
title: __("Chart of Accounts"),
get_tree_root: false,
filters: [
{
fieldname: "company",
fieldtype:"Select",
options: erpnext.utils.get_tree_options("company"),
label: __("Company"),
default: erpnext.utils.get_tree_default("company"),
on_change: function() {
var me = frappe.treeview_settings['Account'].treeview;
var company = me.page.fields_dict.company.get_value();
if (!company) {
frappe.throw(__("Please set a Company"));
}
frappe.call({
method: "erpnext.accounts.doctype.account.account.get_root_company",
args: {
company: company,
},
callback: function(r) {
if(r.message) {
let root_company = r.message.length ? r.message[0] : "";
me.page.fields_dict.root_company.set_value(root_company);
frappe.db.get_value("Company", {"name": company}, "allow_account_creation_against_child_company", (r) => {
frappe.flags.ignore_root_company_validation = r.allow_account_creation_against_child_company;
});
}
}
});
}
},
{
fieldname: "root_company",
fieldtype:"Data",
label: __("Root Company"),
hidden: true,
disable_onchange: true
}
],
root_label: "Accounts",
get_tree_nodes: 'erpnext.accounts.utils.get_children',
on_get_node: function(nodes, deep=false) {
if (frappe.boot.user.can_read.indexOf("GL Entry") == -1) return;
let accounts = [];
if (deep) {
// in case of `get_all_nodes`
accounts = nodes.reduce((acc, node) => [...acc, ...node.data], []);
} else {
accounts = nodes;
}
const get_balances = frappe.call({
method: 'erpnext.accounts.utils.get_account_balances',
args: {
accounts: accounts,
company: cur_tree.args.company
},
});
get_balances.then(r => {
if (!r.message || r.message.length == 0) return;
for (let account of r.message) {
const node = cur_tree.nodes && cur_tree.nodes[account.value];
if (!node || node.is_root) continue;
// show Dr if positive since balance is calculated as debit - credit else show Cr
const balance = account.balance_in_account_currency || account.balance;
const dr_or_cr = balance > 0 ? "Dr": "Cr";
const format = (value, currency) => format_currency(Math.abs(value), currency);
if (account.balance!==undefined) {
$('<span class="balance-area pull-right">'
+ (account.balance_in_account_currency ?
(format(account.balance_in_account_currency, account.account_currency) + " / ") : "")
+ format(account.balance, account.company_currency)
+ " " + dr_or_cr
+ '</span>').insertBefore(node.$ul);
}
}
});
},
add_tree_node: 'erpnext.accounts.utils.add_ac',
menu_items:[
{
label: __('New Company'),
action: function() { frappe.new_doc("Company", true) },
condition: 'frappe.boot.user.can_create.indexOf("Company") !== -1'
}
],
fields: [
{fieldtype:'Data', fieldname:'account_name', label:__('New Account Name'), reqd:true,
description: __("Name of new Account. Note: Please don't create accounts for Customers and Suppliers")},
{fieldtype:'Data', fieldname:'account_number', label:__('Account Number'),
description: __("Number of new Account, it will be included in the account name as a prefix")},
{fieldtype:'Check', fieldname:'is_group', label:__('Is Group'),
description: __('Further accounts can be made under Groups, but entries can be made against non-Groups')},
{fieldtype:'Select', fieldname:'root_type', label:__('Root Type'),
options: ['Asset', 'Liability', 'Equity', 'Income', 'Expense'].join('\n'),
depends_on: 'eval:doc.is_group && !doc.parent_account'},
{fieldtype:'Select', fieldname:'account_type', label:__('Account Type'),
options: frappe.get_meta("Account").fields.filter(d => d.fieldname=='account_type')[0].options,
description: __("Optional. This setting will be used to filter in various transactions.")
},
{fieldtype:'Float', fieldname:'tax_rate', label:__('Tax Rate'),
depends_on: 'eval:doc.is_group==0&&doc.account_type=="Tax"'},
{fieldtype:'Link', fieldname:'account_currency', label:__('Currency'), options:"Currency",
description: __("Optional. Sets company's default currency, if not specified.")}
],
ignore_fields:["parent_account"],
onload: function(treeview) {
frappe.treeview_settings['Account'].treeview = {};
$.extend(frappe.treeview_settings['Account'].treeview, 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'));
treeview.page.add_inner_button(__("Journal Entry"), function() {
frappe.new_doc('Journal Entry', {company: get_company()});
}, __('Create'));
treeview.page.add_inner_button(__("Company"), function() {
frappe.new_doc('Company');
}, __('Create'));
// financial statements
for (let report of ['Trial Balance', 'General Ledger', 'Balance Sheet',
'Profit and Loss Statement', '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'));
}
},
post_render: function(treeview) {
frappe.treeview_settings['Account'].treeview["tree"] = treeview.tree;
treeview.page.set_primary_action(__("New"), function() {
let root_company = treeview.page.fields_dict.root_company.get_value();
if(root_company) {
frappe.throw(__("Please add the account to root level Company - ") + root_company);
} else {
treeview.new_node();
}
}, "add");
},
toolbar: [
{
label:__("Add Child"),
condition: function(node) {
return frappe.boot.user.can_create.indexOf("Account") !== -1
&& (!frappe.treeview_settings['Account'].treeview.page.fields_dict.root_company.get_value()
|| frappe.flags.ignore_root_company_validation)
&& node.expandable && !node.hide_add;
},
click: function() {
var me = frappe.treeview_settings['Account'].treeview;
me.new_node();
},
btnClass: "hidden-xs"
},
{
condition: function(node) {
return !node.root && frappe.boot.user.can_read.indexOf("GL Entry") !== -1
},
label: __("View Ledger"),
click: function(node, btn) {
frappe.route_options = {
"account": node.label,
"from_date": frappe.sys_defaults.year_start_date,
"to_date": frappe.sys_defaults.year_end_date,
"company": frappe.treeview_settings['Account'].treeview.page.fields_dict.company.get_value()
};
frappe.set_route("query-report", "General Ledger");
},
btnClass: "hidden-xs"
}
],
extend_toolbar: true
}

View File

@@ -1,33 +1,28 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import json
import os
import frappe
import frappe, os, json
from frappe.utils import cstr
from frappe.utils.nestedset import rebuild_tree
from six import iteritems
from unidecode import unidecode
def create_charts(company, chart_template=None, existing_company=None, custom_chart=None, from_coa_importer=None):
chart = custom_chart or get_chart(chart_template, existing_company)
def create_charts(chart_name, company):
chart = get_chart(chart_name)
if chart:
accounts = []
def _import_accounts(children, parent, root_type, root_account=False):
for account_name, child in iteritems(children):
for account_name, child in children.items():
if root_account:
root_type = child.get("root_type")
if account_name not in ["account_name", "account_number", "account_type",
"root_type", "is_group", "tax_rate"]:
if account_name not in ["account_type", "root_type", "is_group"]:
account_number = cstr(child.get("account_number")).strip()
account_name, account_name_in_db = add_suffix_if_duplicate(account_name,
account_number, accounts)
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)
is_group = identify_is_group(child)
report_type = "Balance Sheet" if root_type in ["Asset", "Liability", "Equity"] \
@@ -35,74 +30,42 @@ def create_charts(company, chart_template=None, existing_company=None, custom_ch
account = frappe.get_doc({
"doctype": "Account",
"account_name": child.get('account_name') if from_coa_importer else account_name,
"account_name": account_name,
"company": company,
"parent_account": parent,
"is_group": is_group,
"root_type": root_type,
"report_type": report_type,
"account_number": account_number,
"account_type": child.get("account_type"),
"account_currency": child.get('account_currency') or frappe.db.get_value('Company', company, "default_currency"),
"tax_rate": child.get("tax_rate")
"account_currency": frappe.db.get_value("Company", company, "default_currency")
})
if root_account or frappe.local.flags.allow_unverified_charts:
account.flags.ignore_mandatory = True
account.flags.ignore_permissions = True
account.insert()
accounts.append(account_name_in_db)
_import_accounts(child, account.name, root_type)
# Rebuild NestedSet HSM tree for Account Doctype
# after all accounts are already inserted.
frappe.local.flags.ignore_update_nsm = True
_import_accounts(chart, None, None, root_account=True)
rebuild_tree("Account", "parent_account")
frappe.local.flags.ignore_update_nsm = False
def add_suffix_if_duplicate(account_name, account_number, accounts):
if account_number:
account_name_in_db = unidecode(" - ".join([account_number,
account_name.strip().lower()]))
else:
account_name_in_db = unidecode(account_name.strip().lower())
if account_name_in_db in accounts:
count = accounts.count(account_name_in_db)
account_name = account_name + " " + cstr(count)
return account_name, account_name_in_db
def identify_is_group(child):
if child.get("is_group"):
is_group = child.get("is_group")
elif len(set(child.keys()) - set(["account_type", "root_type", "is_group", "tax_rate", "account_number"])):
elif len(set(child.keys()) - set(["account_type", "root_type", "is_group"])):
is_group = 1
else:
is_group = 0
return is_group
def get_chart(chart_template, existing_company=None):
def get_chart(chart_name):
chart = {}
if existing_company:
return get_account_tree_from_existing_company(existing_company)
elif chart_template == "Standard":
from erpnext.accounts.doctype.account.chart_of_accounts.verified import (
standard_chart_of_accounts,
)
if chart_name == "Standard":
from erpnext.accounts.doctype.account.chart_of_accounts.verified import standard_chart_of_accounts
return standard_chart_of_accounts.get()
elif chart_template == "Standard with Numbers":
from erpnext.accounts.doctype.account.chart_of_accounts.verified import (
standard_chart_of_accounts_with_account_number,
)
return standard_chart_of_accounts_with_account_number.get()
else:
folders = ("verified",)
if frappe.local.flags.allow_unverified_charts:
@@ -110,23 +73,21 @@ def get_chart(chart_template, existing_company=None):
for folder in folders:
path = os.path.join(os.path.dirname(__file__), folder)
for fname in os.listdir(path):
fname = frappe.as_unicode(fname)
if fname.endswith(".json"):
with open(os.path.join(path, fname), "r") as f:
chart = f.read()
if chart and json.loads(chart).get("name") == chart_template:
if chart and json.loads(chart).get("name") == chart_name:
return json.loads(chart).get("tree")
@frappe.whitelist()
def get_charts_for_country(country, with_standard=False):
def get_charts_for_country(country):
charts = []
def _get_chart_name(content):
if content:
content = json.loads(content)
if (content and content.get("disabled", "No") == "No") \
or frappe.local.flags.allow_unverified_charts:
charts.append(content["name"])
if content and content.get("disabled", "No") == "No":
charts.append(content["name"])
country_code = frappe.db.get_value("Country", country, "code")
if country_code:
@@ -136,108 +97,13 @@ def get_charts_for_country(country, with_standard=False):
for folder in folders:
path = os.path.join(os.path.dirname(__file__), folder)
if not os.path.exists(path):
continue
for fname in os.listdir(path):
fname = frappe.as_unicode(fname)
if (fname.startswith(country_code) or fname.startswith(country)) and fname.endswith(".json"):
if fname.startswith(country_code) and fname.endswith(".json"):
with open(os.path.join(path, fname), "r") as f:
_get_chart_name(f.read())
# if more than one charts, returned then add the standard
if len(charts) != 1 or with_standard:
charts += ["Standard", "Standard with Numbers"]
if len(charts) != 1:
charts.append("Standard")
return charts
def get_account_tree_from_existing_company(existing_company):
all_accounts = frappe.get_all('Account',
filters={'company': existing_company},
fields = ["name", "account_name", "parent_account", "account_type",
"is_group", "root_type", "tax_rate", "account_number"],
order_by="lft, rgt")
account_tree = {}
# fill in tree starting with root accounts (those with no parent)
if all_accounts:
build_account_tree(account_tree, None, all_accounts)
return account_tree
def build_account_tree(tree, parent, all_accounts):
# find children
parent_account = parent.name if parent else ""
children = [acc for acc in all_accounts if cstr(acc.parent_account) == parent_account]
# if no children, but a group account
if not children and parent.is_group:
tree["is_group"] = 1
tree["account_number"] = parent.account_number
# build a subtree for each child
for child in children:
# start new subtree
tree[child.account_name] = {}
# assign account_type and root_type
if child.account_number:
tree[child.account_name]["account_number"] = child.account_number
if child.account_type:
tree[child.account_name]["account_type"] = child.account_type
if child.tax_rate:
tree[child.account_name]["tax_rate"] = child.tax_rate
if not parent:
tree[child.account_name]["root_type"] = child.root_type
# call recursively to build a subtree for current account
build_account_tree(tree[child.account_name], child, all_accounts)
@frappe.whitelist()
def validate_bank_account(coa, bank_account):
accounts = []
chart = get_chart(coa)
if chart:
def _get_account_names(account_master):
for account_name, child in iteritems(account_master):
if account_name not in ["account_number", "account_type",
"root_type", "is_group", "tax_rate"]:
accounts.append(account_name)
_get_account_names(child)
_get_account_names(chart)
return (bank_account in accounts)
@frappe.whitelist()
def build_tree_from_json(chart_template, chart_data=None, from_coa_importer=False):
''' get chart template from its folder and parse the json to be rendered as tree '''
chart = chart_data or get_chart(chart_template)
# if no template selected, return as it is
if not chart:
return
accounts = []
def _import_accounts(children, parent):
''' recursively called to form a parent-child based list of dict from chart template '''
for account_name, child in iteritems(children):
account = {}
if account_name in ["account_name", "account_number", "account_type",\
"root_type", "is_group", "tax_rate"]: continue
if from_coa_importer:
account_name = child['account_name']
account['parent_account'] = parent
account['expandable'] = True if identify_is_group(child) else False
account['value'] = (cstr(child.get('account_number')).strip() + ' - ' + account_name) \
if child.get('account_number') else account_name
accounts.append(account)
_import_accounts(child, account['value'])
_import_accounts(chart, None)
return accounts

View File

@@ -4,16 +4,13 @@
"""
Import chart of accounts from OpenERP sources
"""
from __future__ import print_function, unicode_literals
from __future__ import unicode_literals
import os, json
import ast
import json
import os
from xml.etree import ElementTree as ET
import frappe
from frappe.utils.csvutils import read_csv_content
from six import iteritems
import frappe
path = "/Users/nabinhait/projects/odoo/addons"
@@ -87,7 +84,7 @@ def get_csv_contents(files_path):
try:
csv_content.setdefault(file_type, [])\
.append(read_csv_content(csvfile.read()))
except Exception as e:
except Exception, e:
continue
return csv_content
@@ -140,7 +137,7 @@ def get_account_types(root_list, csv_content, prefix=None):
def make_maps_for_xml(xml_roots, account_types, country_dir):
"""make maps for `charts` and `accounts`"""
for model, root_list in iteritems(xml_roots):
for model, root_list in xml_roots.iteritems():
for root in root_list:
for node in root[0].findall("record"):
if node.get("model")=="account.account.template":
@@ -232,7 +229,7 @@ def make_charts():
filename = src["id"][5:] + "_" + chart_id
print("building " + filename)
print "building " + filename
chart = {}
chart["name"] = src["name"]
chart["country_code"] = src["id"][5:]

View File

@@ -0,0 +1,210 @@
{
"country_code": "ar",
"name": "Plan de Cuentas",
"disabled": "Yes",
"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,6 +1,6 @@
{
"country_code": "be",
"name": "Belgian - PCMN",
"name": "Belgian PCMN",
"tree": {
"CLASSE 1": {
"BENEFICE (PERTE) REPORTE(E)": {

View File

@@ -0,0 +1,797 @@
{
"country_code": "br",
"name": "Planilha de Contas Brasileira",
"tree": {
"ATIVO": {
"CIRCULANTE": {
"CONTAS RETIFICADORAS": {
"(-) Duplicatas Descontadas": {},
"(-) Outras Contas Retificadoras": {},
"(-) Provis\u00e3o para Ajuste do Estoque ao Valor de Mercado": {},
"(-) Provis\u00f5es para Ajuste ao Valor Prov\u00e1vel de Realiza\u00e7\u00e3o": {},
"(-) Provis\u00f5es para Cr\u00e9ditos de Liquida\u00e7\u00e3o Duvidosa": {}
},
"CR\u00c9DITOS": {
"Adiantamentos a Fornecedores": {},
"CSLL a Recuperar": {},
"Clientes": {
"account_type": "Receivable"
},
"Cr\u00e9ditos Fiscais CSLL \u2013 Diferen\u00e7as Tempor\u00e1rias e Base de C\u00e1lculo Negativa": {},
"Cr\u00e9ditos Fiscais IRPJ \u2013 Diferen\u00e7as Tempor\u00e1rias e Preju\u00edzos Fiscais": {},
"Cr\u00e9ditos por Contribui\u00e7\u00f5es e Doa\u00e7\u00f5es": {},
"ICMS e Contribui\u00e7\u00f5es a Recuperar": {},
"IPI a Recuperar": {},
"Imposto de Renda a Recuperar": {},
"Outras": {},
"Outros Impostos e Contribui\u00e7\u00f5es a Recuperar": {},
"PIS e COFINS a Recuperar": {},
"Tributos Municipais a Recuperar": {}
},
"DESPESAS DO EXERC\u00cdCIO SEGUINTE": {
"Despesas do Exerc\u00edcio Seguinte": {},
"Outras Contas": {}
},
"DISPONIBILIDADES": {
"Bancos": {
"account_type": "Cash"
},
"Caixa": {
"account_type": "Bank"
},
"Contas Banc\u00e1rias \u2013 Doa\u00e7\u00f5es": {},
"Contas Banc\u00e1rias \u2013 Outros Recursos Sujeitos a Restri\u00e7\u00f5es": {},
"Contas Banc\u00e1rias \u2013 Subven\u00e7\u00f5es": {},
"Outras": {},
"Recursos no Exterior Decorrentes de Exporta\u00e7\u00e3o": {},
"Valores Mobili\u00e1rios - Mercado de Capitais Externo": {},
"Valores Mobili\u00e1rios - Mercado de Capitais Interno": {},
"Valores Mobili\u00e1rios \u2013 Aplica\u00e7\u00f5es de Doa\u00e7\u00f5es": {},
"Valores Mobili\u00e1rios \u2013 Aplica\u00e7\u00f5es de Outros Recursos Sujeitos a Restri\u00e7\u00f5es": {},
"Valores Mobili\u00e1rios \u2013 Aplica\u00e7\u00f5es de Subven\u00e7\u00f5es": {}
},
"ESTOQUES": {
"Constru\u00e7\u00f5es em Andamento de Im\u00f3veis Destinados \u00e0 Venda": {},
"Estoques Destinados \u00e0 Doa\u00e7\u00e3o": {},
"Im\u00f3veis Destinados \u00e0 Venda": {},
"Insumos (materiais diretos)": {},
"Insumos Agropecu\u00e1rios": {},
"Mercadorias para Revenda": {},
"Outras": {},
"Produtos Acabados": {},
"Produtos Agropecu\u00e1rios Acabados": {},
"Produtos Agropecu\u00e1rios em Forma\u00e7\u00e3o": {},
"Produtos em Elabora\u00e7\u00e3o": {},
"Servi\u00e7os em andamento": {}
}
},
"N\u00c3O CIRCULANTE": {
"DIFERIDO": {
"(-) Amortiza\u00e7\u00e3o do Diferido": {},
"Corre\u00e7\u00e3o Monet\u00e1ria - Diferen\u00e7a IPC/BTNF (Lei no 8.200/1991)": {},
"Corre\u00e7\u00e3o Monet\u00e1ria Especial (Lei no 8.200/1991)": {},
"Demais Aplica\u00e7\u00f5es em Despesas Amortiz\u00e1veis": {},
"Despesas Pr\u00e9-Operacionais ou Pr\u00e9-Industriais": {},
"Despesas com Pesquisas Cient\u00edficas ou Tecnol\u00f3gicas": {}
},
"IMOBILIZADO": {
"(-) Deprecia\u00e7\u00f5es, Amortiza\u00e7\u00f5es e Quotas de Exaust\u00e3o": {},
"(-) Outras Contas Redutoras do Imobilizado": {},
"Aeronaves": {},
"Constru\u00e7\u00f5es em Andamento": {},
"Corre\u00e7\u00e3o Monet\u00e1ria - Diferen\u00e7a IPC/BTNF (Lei no 8.200/1991)": {},
"Corre\u00e7\u00e3o Monet\u00e1ria Especial (Lei no 8.200/1991)": {},
"Direitos Contratuais de Explora\u00e7\u00e3o de Florestas": {},
"Edif\u00edcios e Constru\u00e7\u00f5es": {},
"Embarca\u00e7\u00f5es": {},
"Equipamentos, M\u00e1quinas e Instala\u00e7\u00f5es Industriais": {},
"Florestamento e Reflorestamento": {},
"M\u00f3veis, Utens\u00edlios e Instala\u00e7\u00f5es Comerciais": {},
"Outras Imobiliza\u00e7\u00f5es": {},
"Recursos Minerais": {},
"Terrenos": {},
"Ve\u00edculos": {}
},
"INTANG\u00cdVEL": {
"(-) Amortiza\u00e7\u00e3o do Intang\u00edvel": {},
"(-) Outras Contas Redutoras do Intang\u00edvel": {},
"Concess\u00f5es": {},
"Desenvolvimento de Produtos": {},
"Direitos Autorais": {},
"Franquias": {},
"Fundo de Com\u00e9rcio": {},
"Marcas e Patentes": {},
"Outras": {},
"Software ou Programas de Computador": {}
},
"INVESTIMENTOS": {
"(-) Des\u00e1gios e Provis\u00e3o para Perdas Prov\u00e1veis em Investimentos": {},
"(-) Outras Contas Retificadoras": {},
"Corre\u00e7\u00e3o Monet\u00e1ria - Diferen\u00e7a IPC/BTNF (Lei no 8.200/1991)": {},
"Corre\u00e7\u00e3o Monet\u00e1ria Especial (Lei no 8.200/1991)": {},
"Investimentos Decorrentes de Incentivos Fiscais": {},
"Outras Contas": {},
"Outros Investimentos": {},
"Participa\u00e7\u00f5es Permanentes em Coligadas ou Controladas": {},
"\u00c1gios em Investimentos": {}
},
"REALIZ\u00c1VEL A LONGO PRAZO": {
"(-) Duplicatas Descontadas": {},
"(-) Outras Contas Retificadoras": {},
"(-) Provis\u00f5es para Ajuste ao Valor Prov\u00e1vel de Realiza\u00e7\u00e3o": {},
"(-) Provis\u00f5es para Cr\u00e9ditos de Liquida\u00e7\u00e3o Duvidosa": {},
"Clientes": {
"account_type": "Receivable"
},
"Cr\u00e9ditos Fiscais CSLL \u2013 Diferen\u00e7as Tempor\u00e1rias e Base de C\u00e1lculo Negativa": {},
"Cr\u00e9ditos Fiscais IRPJ \u2013 Diferen\u00e7as Tempor\u00e1rias e Preju\u00edzos Fiscais": {},
"Cr\u00e9ditos com Pessoas Ligadas (F\u00edsicas/Jur\u00eddicas)": {},
"Cr\u00e9ditos por Contribui\u00e7\u00f5es e Doa\u00e7\u00f5es": {},
"Dep\u00f3sitos Judiciais": {},
"Outras Contas": {},
"Valores Mobili\u00e1rios": {}
}
},
"root_type": "Asset"
},
"CUSTOS DE PRODU\u00c7\u00c3O": {
"CUSTO DOS BENS E SERVI\u00c7OS PRODUZIDOS": {
"CUSTO DOS PRODUTOS DE FABRICA\u00c7\u00c3O PR\u00d3PRIA PRODUZIDOS": {
"Alimenta\u00e7\u00e3o do Trabalhador": {},
"Arrendamento Mercantil": {},
"Constitui\u00e7\u00e3o de Provis\u00f5es": {},
"Consumo de Insumos": {},
"Custo do Pessoal Aplicado na Produ\u00e7\u00e3o": {},
"Encargos Sociais \u2013 FGTS": {},
"Encargos Sociais \u2013 Outros": {},
"Encargos Sociais \u2013 Previd\u00eancia Social": {},
"Encargos de Deprecia\u00e7\u00e3o, Amortiza\u00e7\u00e3o e Exaust\u00e3o": {},
"Fundo de Aposentadoria Programada Individual de Empregados Ligados \u00e0 Produ\u00e7\u00e3o": {},
"Loca\u00e7\u00e3o de M\u00e3o-de-obra": {},
"Manuten\u00e7\u00e3o e Reparo de Bens Aplicados na Produ\u00e7\u00e3o": {},
"Outros Custos": {},
"Outros Gastos com Pessoal Ligado \u00e0 Produ\u00e7\u00e3o": {},
"Plano de Previd\u00eancia Privada de Empregados Ligados \u00e0 Produ\u00e7\u00e3o": {},
"Planos de Poupan\u00e7a e Investimentos de Empregados Ligados \u00e0 Produ\u00e7\u00e3o": {},
"Presta\u00e7\u00e3o de Servi\u00e7o Pessoa Jur\u00eddica": {},
"Presta\u00e7\u00e3o de Servi\u00e7os por Pessoa F\u00edsica sem V\u00ednculo Empregat\u00edcio": {},
"Remunera\u00e7\u00e3o a Dirigentes de Ligados \u00e0 Produ\u00e7\u00e3o": {},
"Royalties e Assist\u00eancia T\u00e9cnica \u2013 EXTERIOR": {},
"Royalties e Assist\u00eancia T\u00e9cnica \u2013 PA\u00cdS": {},
"Servi\u00e7os Prestados Pessoa Jur\u00eddica": {},
"Servi\u00e7os Prestados por Cooperativa de Trabalho": {},
"Servi\u00e7os Prestados por Pessoa F\u00edsica sem V\u00ednculo Empregat\u00edcio": {}
},
"CUSTO DOS PRODUTOS DE FABRICA\u00c7\u00c3O PR\u00d3PRIA PRODUZIDOS DA ATIVIDADE RURAL": {
"Alimenta\u00e7\u00e3o do Trabalhador": {},
"Arrendamento Mercantil": {},
"Constitui\u00e7\u00e3o de Provis\u00f5es": {},
"Consumo de Insumos": {},
"Custo do Pessoal Aplicado na Produ\u00e7\u00e3o": {},
"Encargos Sociais \u2013 FGTS": {},
"Encargos Sociais \u2013 Outros": {},
"Encargos Sociais \u2013 Previd\u00eancia Social": {},
"Encargos de Deprecia\u00e7\u00e3o, Amortiza\u00e7\u00e3o e Exaust\u00e3o": {},
"Fundo de Aposentadoria Programada Individual de Empregados Ligados \u00e0 Produ\u00e7\u00e3o": {},
"Loca\u00e7\u00e3o de M\u00e3o-de-obra": {},
"Manuten\u00e7\u00e3o e Reparo de Bens Aplicados na Produ\u00e7\u00e3o": {},
"Outros Custos": {},
"Outros Gastos com Pessoal Ligado \u00e0 Produ\u00e7\u00e3o": {},
"Plano de Previd\u00eancia Privada de Empregados Ligados \u00e0 Produ\u00e7\u00e3o": {},
"Planos de Poupan\u00e7a e Investimentos de Empregados Ligados \u00e0 Produ\u00e7\u00e3o": {},
"Presta\u00e7\u00e3o de Servi\u00e7o Pessoa Jur\u00eddica": {},
"Presta\u00e7\u00e3o de Servi\u00e7os por Pessoa F\u00edsica sem V\u00ednculo Empregat\u00edcio": {},
"Remunera\u00e7\u00e3o a Dirigentes de Ligados \u00e0 Produ\u00e7\u00e3o": {},
"Royalties e Assist\u00eancia T\u00e9cnica \u2013 EXTERIOR": {},
"Royalties e Assist\u00eancia T\u00e9cnica \u2013 PA\u00cdS": {},
"Servi\u00e7os Prestados Pessoa Jur\u00eddica": {},
"Servi\u00e7os Prestados por Cooperativa de Trabalho": {},
"Servi\u00e7os Prestados por Pessoa F\u00edsica sem V\u00ednculo Empregat\u00edcio": {}
},
"CUSTO DOS SERVI\u00c7OS PRODUZIDOS": {
"Alimenta\u00e7\u00e3o do Trabalhador": {},
"Arrendamento Mercantil": {},
"Constitui\u00e7\u00e3o de Provis\u00f5es": {},
"Custo do Pessoal Aplicado na Produ\u00e7\u00e3o de Servi\u00e7os": {},
"Encargos Sociais \u2013 FGTS": {},
"Encargos Sociais \u2013 Outros": {},
"Encargos Sociais \u2013 Previd\u00eancia Social": {},
"Encargos de Deprecia\u00e7\u00e3o, Amortiza\u00e7\u00e3o e Exaust\u00e3o": {},
"Fundo de Aposentadoria Programada Individual de Empregados Ligados \u00e0 Produ\u00e7\u00e3o de Servi\u00e7os": {},
"Loca\u00e7\u00e3o de M\u00e3o-de-obra": {},
"Manuten\u00e7\u00e3o e Reparo de Bens Aplicados na Produ\u00e7\u00e3o de Servi\u00e7os": {},
"Material Aplicado na Produ\u00e7\u00e3o de Servi\u00e7os": {},
"Outros Custos": {},
"Outros Gastos com Pessoal Ligado \u00e0 Produ\u00e7\u00e3o de Servi\u00e7os": {},
"Plano de Previd\u00eancia Privada de Empregados Ligados \u00e0 Produ\u00e7\u00e3o de Servi\u00e7os": {},
"Planos de Poupan\u00e7a e Investimentos de Empregados Ligados \u00e0 Produ\u00e7\u00e3o de Servi\u00e7os": {},
"Presta\u00e7\u00e3o de Servi\u00e7o Pessoa Jur\u00eddica": {},
"Presta\u00e7\u00e3o de Servi\u00e7os por Pessoa F\u00edsica sem V\u00ednculo Empregat\u00edcio": {},
"Remunera\u00e7\u00e3o a Dirigentes ligados \u00e0 Produ\u00e7\u00e3o de Servi\u00e7os": {},
"Royalties e Assist\u00eancia T\u00e9cnica \u2013 EXTERIOR": {},
"Royalties e Assist\u00eancia T\u00e9cnica \u2013 PA\u00cdS": {},
"Servi\u00e7os Prestados Pessoa Jur\u00eddica": {},
"Servi\u00e7os Prestados por Cooperativa de Trabalho": {},
"Servi\u00e7os Prestados por Pessoa F\u00edsica sem V\u00ednculo Empregat\u00edcio": {}
}
},
"root_type": "Expense"
},
"PASSIVO": {
"CIRCULANTE": {
"OBRIGA\u00c7\u00d5ES DE CURTO PRAZO": {
"(-) Contas Retificadoras": {},
"Adiantamentos de Clientes": {},
"Arrendamento Mercantil (Financeiro) a Curto Prazo - Exterior": {},
"Arrendamento Mercantil (Financeiro) a Curto Prazo - Sistema Financeiro Nacional": {},
"Contribui\u00e7\u00f5es Previdenci\u00e1rias a Recolher": {},
"Dividendos Propostos ou Lucros Creditados": {},
"Doa\u00e7\u00f5es e Subven\u00e7\u00f5es para Investimentos": {},
"D\u00e9bitos Fiscais CSLL \u2013 Diferen\u00e7as Tempor\u00e1rias": {},
"D\u00e9bitos Fiscais IRPJ \u2013 Diferen\u00e7as Tempor\u00e1rias": {},
"FGTS a Recolher": {},
"Financiamentos a Curto Prazo - Exterior": {},
"Financiamentos a Curto Prazo - Outros": {},
"Financiamentos a Curto Prazo - Sistema Financeiro Nacional": {},
"Fornecedores": {
"account_type": "Payable"
},
"ICMS e Contribui\u00e7\u00f5es a Recolher": {},
"IPI a Recolher": {},
"Outras Contas": {},
"Outros tributos a recolher": {},
"PIS e COFINS a Recolher": {},
"Provis\u00e3o para a Contribui\u00e7\u00e3o Social sobre o Lucro L\u00edquido": {},
"Provis\u00e3o para o Imposto de Renda": {},
"Provis\u00f5es de Natureza C\u00edvel": {},
"Provis\u00f5es de Natureza Fiscal": {},
"Provis\u00f5es de Natureza Trabalhista": {},
"Sal\u00e1rios a Pagar": {},
"Tributos Municipais a Recolher": {}
}
},
"N\u00c3O-CIRCULANTE": {
"OBRIGA\u00c7\u00d5ES A LONGO PRAZO": {
"(-) Contas Retificadoras": {},
"Arrendamento Mercantil (Financeiro) a Longo Prazo - Sistema Financeiro Nacional": {},
"Arrendamento Mercantil (Financeiro) a Longo Prazo \u2013 Exterior": {},
"Cr\u00e9ditos de Pessoas Ligadas (F\u00edsicas/Jur\u00eddicas)": {},
"Doa\u00e7\u00f5es e Subven\u00e7\u00f5es para Investimentos": {},
"D\u00e9bitos Fiscais CSLL - Diferen\u00e7as Tempor\u00e1rias": {},
"D\u00e9bitos Fiscais IRPJ - Diferen\u00e7as Tempor\u00e1rias": {},
"Empr\u00e9stimos de S\u00f3cios/Acionistas N\u00e3o Administradores": {},
"Financiamentos a Longo Prazo - Sistema Financeiro Nacional": {},
"Financiamentos a Longo Prazo \u2013 Brasil - Outros": {},
"Financiamentos a Longo Prazo \u2013 Exterior": {},
"Fornecedores": {
"account_type": "Payable"
},
"Outras Contas": {},
"Outras Provis\u00f5es de Natureza C\u00edvel": {},
"Outras Provis\u00f5es de Natureza Fiscal": {},
"Outras Provis\u00f5es de Natureza Trabalhista": {},
"Provis\u00e3o para o Imposto de Renda sobre Lucros Diferidos": {}
},
"RECEITAS DIFERIDAS": {
"(-) Custos Correspondentes \u00e0s Receitas Diferidas": {},
"Receitas Diferidas": {}
}
},
"PATRIM\u00d4NIO L\u00cdQUIDO": {
"AJUSTES DE AVALIA\u00c7\u00c3O PATRIMONIAL": {
"(-) Ajustes \u00e0s Normas Internacionais de Contabilidade": {},
"Ajustes \u00e0s Normas Internacionais de Contabilidade": {}
},
"CAPITAL REALIZADO": {
"(-) Capital a Integralizar de Domiciliados e Residentes no Exterior": {},
"(-) Capital a Integralizar de Domiciliados e Residentes no Pa\u00eds": {},
"Capital Subscrito de Domiciliados e Residentes no Exterior": {},
"Capital Subscrito de Domiciliados e Residentes no Pa\u00eds": {}
},
"OUTRAS CONTAS": {
"(-) A\u00e7\u00f5es em Tesouraria": {},
"(-) Preju\u00edzos Acumulados": {},
"Lucros Acumulados e/ou Saldo \u00e0 Disposi\u00e7\u00e3o da Assembl\u00e9ia": {},
"Outras": {}
},
"RESERVAS": {
"Outras Reservas": {},
"Reserva para Aumento de Capital (Lei no 9.249/1995, art. 9o, \u00a7 9o)": {},
"Reservas de Capital": {},
"Reservas de Lucros": {},
"Reservas de Lucros - Doa\u00e7\u00f5es e Subven\u00e7\u00f5es para Investimentos": {},
"Reservas de Lucros - Pr\u00eamio na Emiss\u00e3o de Deb\u00eantures": {},
"Reservas de Reavalia\u00e7\u00e3o": {}
}
},
"PATRIM\u00d4NIO SOCIAL": {
"FUNDO PATRIMONIAL": {
"Fundo Patrimonial": {}
},
"OUTRAS CONTAS": {
"D\u00e9ficits Acumulados": {},
"Super\u00e1vits Acumulados": {}
},
"RESERVAS": {
"Reservas Estatut\u00e1rias": {},
"Reservas Patrimoniais": {}
}
},
"root_type": "Liability"
},
"RESULTADO L\u00cdQUIDO DO PER\u00cdODO": {
"PROVIS\u00c3O PARA CSLL E IRPJ (ATIVIDADE RURAL)": {
"PROVIS\u00c3O PARA CSLL E IRPJ": {
"PROVIS\u00c3O PARA CSLL E IRPJ": {
"PROVIS\u00c3O PARA CSLL E IRPJ": {
"(-) Contribui\u00e7\u00e3o Social sobre o Lucro L\u00edquido": {},
"(-) Provis\u00e3o para Imposto de Renda - Pessoa Jur\u00eddica": {}
}
}
}
},
"PROVIS\u00c3O PARA CSLL E IRPJ (ATIVIDADES EM GERAL)": {
"PROVIS\u00c3O PARA CSLL E IRPJ": {
"PROVIS\u00c3O PARA CSLL E IRPJ": {
"PROVIS\u00c3O PARA CSLL E IRPJ": {
"(-) Contribui\u00e7\u00e3o Social sobre o Lucro L\u00edquido": {},
"(-) Provis\u00e3o para Imposto de Renda - Pessoa Jur\u00eddica": {}
}
}
}
},
"RESULTADO ANTES DO IRPJ E DA CSLL - ATIVIDADE RURAL": {
"PARTICIPA\u00c7\u00d5ES": {
"PARTICIPA\u00c7\u00d5ES NOS LUCROS": {
"OUTRAS PARTICIPA\u00c7\u00d5ES": {
"(-) Outras": {},
"(-) Participa\u00e7\u00f5es de Administradores e Partes Benefici\u00e1rias": {},
"(-) Participa\u00e7\u00f5es de Deb\u00eantures": {}
},
"PARTICIPA\u00c7\u00d5ES DE EMPREGADOS": {
"(-) Contribui\u00e7\u00f5es para Assist\u00eancia ou Previd\u00eancia de Empregados": {},
"(-) Outras Participa\u00e7\u00f5es de Empregados": {},
"(-) Participa\u00e7\u00f5es de Empregados": {}
}
}
},
"RESULTADO OPERACIONAL DA ATIVIDADE RURAL": {
"CUSTO DOS BENS E SERVI\u00c7OS VENDIDOS": {
"CUSTO DOS PRODUTOS DA ATIVIDADE RURAL VENDIDOS": {
"AJUSTES DE ESTOQUES DECORRENTES DE ARBITRAMENTO": {},
"Custo dos Produtos Vendidos da Atividade Rural": {}
}
},
"DESPESAS OPERACIONAIS": {
"DESPESAS OPERACIONAIS DA ATIVIDADE RURAL": {
"Alimenta\u00e7\u00e3o do Trabalhador": {},
"Alugu\u00e9is": {},
"Arrendamento Mercantil": {},
"Assist\u00eancia M\u00e9dica, Odontol\u00f3gica e Farmac\u00eautica a Empregados": {},
"Bens de Natureza Permanente Deduzidos como Despesa": {},
"CPMF": {},
"Cofins": {},
"Demais Impostos, Taxas e Contribui\u00e7\u00f5es, exceto IR e CSLL": {},
"Demais Provis\u00f5es": {},
"Despesas com Ve\u00edculos e de Conserva\u00e7\u00e3o de Bens e Instala\u00e7\u00f5es": {},
"Despesas com viagens, di\u00e1rias e ajusta de custo": {},
"Doa\u00e7\u00f5es a Entidades Civis": {},
"Doa\u00e7\u00f5es a Institui\u00e7\u00f5es de Ensino e Pesquisa (Lei no 9.249/1995, art.13, \u00a7 2o)": {},
"Doa\u00e7\u00f5es e Patroc\u00ednios de Car\u00e1ter Cultural e Art\u00edstico (Lei no 8.313/1991)": {},
"Encargos Sociais - Previd\u00eancia Social": {},
"Encargos Sociais \u2013 FGTS": {},
"Encargos Sociais \u2013 Outros": {},
"Encargos de Deprecia\u00e7\u00e3o e Amortiza\u00e7\u00e3o": {},
"Fundo de Aposentadoria Programada Individual de Empregados": {},
"Gratifica\u00e7\u00f5es a Administradores": {},
"Loca\u00e7\u00e3o de M\u00e3o-de-obra": {},
"Multas": {},
"Ordenados, Sal\u00e1rios Gratifica\u00e7\u00f5es e Outras Remunera\u00e7\u00f5es a Empregados": {},
"Outras Contribui\u00e7\u00f5es e Doa\u00e7\u00f5es": {},
"Outras Despesas Operacionais": {},
"Outros Gastos com Pessoal": {},
"PIS/Pasep": {},
"Perdas em Opera\u00e7\u00f5es de Cr\u00e9dito": {},
"Pesquisas Cient\u00edficas e Tecnol\u00f3gicas": {},
"Plano de Previd\u00eancia Privada de Empregados": {},
"Planos de Poupan\u00e7a e Investimentos de Empregados": {},
"Presta\u00e7\u00e3o de Servi\u00e7o Pessoa Jur\u00eddica": {},
"Presta\u00e7\u00e3o de Servi\u00e7os por Pessoa F\u00edsica sem V\u00ednculo Empregat\u00edcio": {},
"Propaganda, Publicidade e Patroc\u00ednio": {},
"Propaganda, Publicidade e Patroc\u00ednio (Associa\u00e7\u00f5es Desportivas que Mantenham Equipe de Futebol Profissional)": {},
"Provis\u00e3o para Perda de Estoque": {},
"Provis\u00f5es para F\u00e9rias e 13o Sal\u00e1rio de Empregados": {},
"Remunera\u00e7\u00e3o a Dirigentes e a Conselho de Administra\u00e7\u00e3o": {},
"Royalties e Assist\u00eancia T\u00e9cnica \u2013 EXTERIOR": {},
"Royalties e Assist\u00eancia T\u00e9cnica \u2013 PA\u00cdS": {},
"Servi\u00e7os Prestados por Cooperativa de Trabalho": {}
}
},
"OUTRAS DESPESAS OPERACIONAIS": {
"OUTRAS DESPESAS OPERACIONAIS": {
"(-) Amortiza\u00e7\u00e3o de \u00c1gio nas Aquisi\u00e7\u00f5es de Investimentos Avaliados pelo Patrim\u00f4nio L\u00edquido": {},
"(-) Contrapartida de outros Ajustes \u00e0s Normas Internacionais de Contabilidade": {},
"(-) Contrapartida dos Ajustes ao Valor Presente": {},
"(-) Contrapartida dos ajustes de valor do imobilizado e intang\u00edvel": {},
"(-) Juros sobre o Capital Pr\u00f3prio": {},
"(-) Outras Despesas Financeiras": {},
"(-) Perdas Incorridas no Mercado de Renda Vari\u00e1vel, exceto Day-Trade": {},
"(-) Perdas em Opera\u00e7\u00f5es Day-Trade": {},
"(-) Perdas em Opera\u00e7\u00f5es Realizadas no Exterior": {},
"(-) Preju\u00edzos na Aliena\u00e7\u00e3o de Participa\u00e7\u00f5es N\u00e3o Integrantes do Ativo Permanente": {},
"(-) Resultados Negativos em Participa\u00e7\u00f5es Societ\u00e1rias": {},
"(-) Resultados Negativos em SCP": {},
"(-) Varia\u00e7\u00f5es Cambiais Passivas": {}
}
},
"OUTRAS RECEITAS OPERACIONAIS": {
"OUTRAS RECEITAS OPERACIONAIS": {
"Amortiza\u00e7\u00e3o de Des\u00e1gio nas Aquisi\u00e7\u00f5es de Investimentos Avaliados pelo Patrim\u00f4nio L\u00edquido": {},
"Contrapartida de outros Ajustes \u00e0s Normas Internacionais de Contabilidade": {},
"Contrapartida dos Ajustes ao Valor Presente": {},
"Doa\u00e7\u00f5es e Subven\u00e7\u00f5es para Investimentos": {},
"Ganhos Auferidos no Mercado de Renda Vari\u00e1vel, exceto Day-Trade": {},
"Ganhos em Opera\u00e7\u00f5es Day-Trade": {},
"Ganhos na Aliena\u00e7\u00e3o de Participa\u00e7\u00f5es N\u00e3o Integrantes do Ativo Permanente": {},
"Outras Receitas Financeiras": {},
"Outras Receitas Operacionais": {},
"Pr\u00eamios Recebidos na Emiss\u00e3o de Deb\u00eantures": {},
"Receitas de Juros sobre o Capital Pr\u00f3prio": {},
"Rendimentos e Ganhos de Capital Auferidos no Exterior": {},
"Resultados Positivos em Participa\u00e7\u00f5es Societ\u00e1rias": {},
"Resultados Positivos em SCP": {},
"Revers\u00e3o dos Saldos das Provis\u00f5es Operacionais": {},
"Varia\u00e7\u00f5es Cambiais Ativas": {}
}
},
"RECEITA OPERACIONAL L\u00cdQUIDA DA ATIVIDADE RURAL": {
"DEDU\u00c7\u00d5ES DA RECEITA BRUTA": {
"(-) Cofins": {},
"(-) Demais Impostos e Contribui\u00e7\u00f5es Incidentes sobre Vendas e Servi\u00e7os": {},
"(-) ICMS": {},
"(-) ISS": {},
"(-) PIS/Pasep": {},
"(-) Vendas Canceladas, Devolu\u00e7\u00f5es e Descontos Incondicionais": {}
},
"RECEITA BRUTA DA ATIVIDADE RURAL": {
"Receita da Atividade Rural": {}
}
}
}
},
"RESULTADO L\u00cdQUIDO DO PER\u00cdODO ANTES DO IRPJ E DA CSLL - ATIVIDADE GERAL": {
"OUTRAS RECEITAS E OUTRAS DESPESAS": {
"RECEITAS E DESPESAS N\u00c3O OPERACIONAIS": {
"DESPESAS N\u00c3O OPERACIONAIS": {
"(-) Outras Despesas N\u00e3o Operacionais": {},
"(-) Perdas de Capital por Varia\u00e7\u00e3o Percentual em Participa\u00e7\u00e3o Societ\u00e1ria Avaliada pelo Patrim\u00f4nio L\u00edquido": {},
"(-) Valor Cont\u00e1bil dos Bens e Direitos Alienados": {}
},
"RECEITAS N\u00c3O OPERACIONAIS": {
"Ganhos de Capital por Varia\u00e7\u00e3o Percentual em Participa\u00e7\u00e3o Societ\u00e1ria Avaliada pelo Patrim\u00f4nio L\u00edquido": {},
"Outras Receitas N\u00e3o Operacionais": {},
"Receitas de Aliena\u00e7\u00f5es de Bens e Direitos do Ativo Permanente": {}
}
}
},
"PARTICIPA\u00c7\u00d5ES": {
"PARTICIPA\u00c7\u00d5ES NOS LUCROS": {
"OUTRAS PARTICIPA\u00c7\u00d5ES": {
"(-) Outras": {},
"(-) Participa\u00e7\u00f5es de Administradores e Partes Benefici\u00e1rias": {},
"(-) Participa\u00e7\u00f5es de Deb\u00eantures": {}
},
"PARTICIPA\u00c7\u00d5ES DE EMPREGADOS": {
"(-) Contribui\u00e7\u00f5es para Assist\u00eancia ou Previd\u00eancia de Empregados": {},
"(-) Outras Participa\u00e7\u00f5es de Empregados": {},
"(-) Participa\u00e7\u00f5es de Empregados": {}
}
}
},
"RESULTADO OPERACIONAL": {
"CUSTO DOS BENS E SERVI\u00c7OS VENDIDOS": {
"AJUSTES DE ESTOQUES DECORRENTES DE ARBITRAMENTO": {},
"CUSTO DAS MERCADORIAS REVENDIDAS": {
"Custo das Mercadorias Revendidas": {},
"Custo dos Servi\u00e7os Vendidos": {}
},
"CUSTO DAS UNIDADES IMOBILI\u00c1RIAS VENDIDAS": {
"Custo das Unidades Imobili\u00e1rias Vendidas": {}
},
"CUSTO DOS PRODUTOS DE FABRICA\u00c7\u00c3O PR\u00d3PRIA VENDIDOS": {
"Custo dos Produtos de Fabrica\u00e7\u00e3o Pr\u00f3pria Vendidos": {}
}
},
"DESPESAS OPERACIONAIS": {
"DESPESAS OPERACIONAIS DAS ATIVIDADES EM GERAL": {
"Alimenta\u00e7\u00e3o do Trabalhador": {},
"Alugu\u00e9is": {},
"Arrendamento Mercantil": {},
"Assist\u00eancia M\u00e9dica, Odontol\u00f3gica e Farmac\u00eautica a Empregados": {},
"Bens de Natureza Permanente Deduzidos como Despesa": {},
"CPMF": {},
"Cofins": {},
"Demais Impostos, Taxas e Contribui\u00e7\u00f5es, exceto IR e CSLL": {},
"Demais Provis\u00f5es": {},
"Despesas com Ve\u00edculos e de Conserva\u00e7\u00e3o de Bens e Instala\u00e7\u00f5es": {},
"Despesas com viagens, di\u00e1rias e ajusta de custo": {},
"Doa\u00e7\u00f5es a Entidades Civis": {},
"Doa\u00e7\u00f5es a Institui\u00e7\u00f5es de Ensino e Pesquisa (Lei n\u00ba 9.249/1995, art.13, \u00a7 2\u00ba)": {},
"Doa\u00e7\u00f5es e Patroc\u00ednios de Car\u00e1ter Cultural e Art\u00edstico (Lei no 8.313/1991)": {},
"Encargos Sociais \u2013 FGTS": {},
"Encargos Sociais \u2013 Outros": {},
"Encargos Sociais \u2013 Previd\u00eancia Social": {},
"Encargos de Deprecia\u00e7\u00e3o e Amortiza\u00e7\u00e3o": {},
"Fundo de Aposentadoria Programada Individual de Empregados": {},
"Gratifica\u00e7\u00f5es a Administradores": {},
"Loca\u00e7\u00e3o de M\u00e3o-de-obra": {},
"Multas": {},
"Ordenados, Sal\u00e1rios Gratifica\u00e7\u00f5es e Outras Remunera\u00e7\u00f5es a Empregados": {},
"Outras Contribui\u00e7\u00f5es e Doa\u00e7\u00f5es": {},
"Outras Despesas Operacionais": {},
"Outros Gastos com Pessoal": {},
"PIS/Pasep": {},
"Perdas em Opera\u00e7\u00f5es de Cr\u00e9dito": {},
"Pesquisas Cient\u00edficas e Tecnol\u00f3gicas": {},
"Plano de Previd\u00eancia Privada de Empregados": {},
"Planos de Poupan\u00e7a e Investimentos de Empregados": {},
"Presta\u00e7\u00e3o de Servi\u00e7o Pessoa Jur\u00eddica": {},
"Presta\u00e7\u00e3o de Servi\u00e7os por Pessoa F\u00edsica sem V\u00ednculo Empregat\u00edcio": {},
"Propaganda, Publicidade e Patroc\u00ednio": {},
"Propaganda, Publicidade e Patroc\u00ednio (Associa\u00e7\u00f5es Desportivas que Mantenham Equipe de Futebol Profissional)": {},
"Provis\u00e3o para Perda de Estoque": {},
"Provis\u00f5es para F\u00e9rias e 13o Sal\u00e1rio de Empregados": {},
"Remunera\u00e7\u00e3o a Dirigentes e a Conselho de Administra\u00e7\u00e3o": {},
"Royalties e Assist\u00eancia T\u00e9cnica \u2013 EXTERIOR": {},
"Royalties e Assist\u00eancia T\u00e9cnica \u2013 PA\u00cdS": {},
"Servi\u00e7os Prestados por Cooperativa de Trabalho": {}
}
},
"OUTRAS DESPESAS OPERACIONAIS": {
"OUTRAS DESPESAS OPERACIONAIS": {
"(-) Amortiza\u00e7\u00e3o de \u00c1gio nas Aquisi\u00e7\u00f5es de Investimentos Avaliados pelo Patrim\u00f4nio L\u00edquido": {},
"(-) Contrapartida de outros Ajustes \u00e0s Normas Internacionais de Contabilidade": {},
"(-) Contrapartida dos Ajustes ao Valor Presente": {},
"(-) Contrapartida dos Ajustes de Valor do Imobilizado e Intang\u00edvel": {},
"(-) Juros sobre o Capital Pr\u00f3prio": {},
"(-) Outras Despesas Financeiras": {},
"(-) Perdas Incorridas no Mercado de Renda Vari\u00e1vel, exceto Day-Trade": {},
"(-) Perdas em Opera\u00e7\u00f5es Day-Trade": {},
"(-) Perdas em Opera\u00e7\u00f5es Realizadas no Exterior": {},
"(-) Preju\u00edzos na Aliena\u00e7\u00e3o de Participa\u00e7\u00f5es N\u00e3o Integrantes do Ativo Permanente": {},
"(-) Resultados Negativos em Participa\u00e7\u00f5es Societ\u00e1rias": {},
"(-) Resultados Negativos em SCP": {},
"(-) Varia\u00e7\u00f5es Cambiais Passivas": {}
}
},
"OUTRAS RECEITAS OPERACIONAIS": {
"OUTRAS RECEITAS OPERACIONAIS": {
"Amortiza\u00e7\u00e3o de Des\u00e1gio nas Aquisi\u00e7\u00f5es de Investimentos Avaliados pelo Patrim\u00f4nio L\u00edquido": {},
"Contrapartida de outros Ajustes \u00e0s Normas Internacionais de Contabilidade": {},
"Contrapartida dos Ajustes ao Valor Presente": {},
"Doa\u00e7\u00f5es e Subven\u00e7\u00f5es para Investimentos": {},
"Ganhos Auferidos no Mercado de Renda Vari\u00e1vel, exceto Day-Trade": {},
"Ganhos em Opera\u00e7\u00f5es Day-Trade": {},
"Ganhos na Aliena\u00e7\u00e3o de Participa\u00e7\u00f5es N\u00e3o Integrantes do Ativo Permanente": {},
"Outras Receitas Financeiras": {},
"Outras Receitas Operacionais": {},
"Pr\u00eamios Recebidos na Emiss\u00e3o de Deb\u00eantures": {},
"Receitas de Juros sobre o Capital Pr\u00f3prio": {},
"Rendimentos e Ganhos de Capital Auferidos no Exterior": {},
"Resultados Positivos em Participa\u00e7\u00f5es Societ\u00e1rias": {},
"Resultados Positivos em SCP": {},
"Revers\u00e3o dos Saldos das Provis\u00f5es Operacionais": {},
"Varia\u00e7\u00f5es Cambiais Ativas": {}
}
},
"RECEITA LIQUIDA": {
"DEDU\u00c7\u00d5ES DA RECEITA BRUTA": {
"(-) Cofins": {},
"(-) Demais Impostos e Contribui\u00e7\u00f5es Incidentes sobre Vendas e Servi\u00e7os": {},
"(-) ICMS": {},
"(-) ISS": {},
"(-) PIS/Pasep": {},
"(-) Vendas Canceladas, Devolu\u00e7\u00f5es e Descontos Incondicionais": {}
},
"RECEITA BRUTA": {
"Outras": {},
"Receita da Presta\u00e7\u00e3o de Servi\u00e7os \u2013 Mercado Interno": {},
"Receita da Revenda de Mercadorias no Mercado Interno": {},
"Receita da Venda no Mercado Interno de Produtos de Fabrica\u00e7\u00e3o Pr\u00f3pria": {},
"Receita das Unidades Imobili\u00e1rias Vendidas": {},
"Receita de Exporta\u00e7\u00e3o Direta de Mercadorias e Produtos": {},
"Receita de Exporta\u00e7\u00e3o de Servi\u00e7os": {},
"Receita de Loca\u00e7\u00e3o de Bens M\u00f3veis e Im\u00f3veis": {},
"Receita de Vendas de Mercadorias e Produtos a Comercial Exportadora com Fim Espec\u00edfico de Exporta\u00e7\u00e3o": {}
}
}
}
},
"root_type": "Income"
},
"SUPER\u00c1VIT/D\u00c9FICIT L\u00cdQUIDO DO PER\u00cdODO": {
"OUTRAS RECEITAS E DESPESAS": {
"RECEITAS E DESPESAS N\u00c3O OPERACIONAIS": {
"RECEITAS E DESPESAS N\u00c3O OPERACIONAIS": {
"DESPESAS N\u00c3O OPERACIONAIS": {
"(-) Outras Despesas N\u00e3o Operacionais": {},
"(-) Valor Cont\u00e1bil dos Bens e Direitos Alienados": {}
},
"RECEITAS N\u00c3O OPERACIONAIS": {
"Outras Receitas N\u00e3o Operacionais": {},
"Receitas de Aliena\u00e7\u00f5es de Bens e Direitos do Ativo Permanente.": {}
}
}
}
},
"RESULTADO OPERACIONAL": {
"CUSTO DOS PRODUTOS E SERVI\u00c7OS VENDIDOS": {
"CUSTO DOS PRODUTOS VENDIDOS": {
"CUSTO DOS PRODUTOS VENDIDOS PARA AS DEMAIS ATIVIDADES": {
"Custos dos Produtos Vendidos em Geral": {},
"Outros Custos": {}
},
"CUSTO DOS PRODUTOS VENDIDOS PARA ASSIST\u00caNCIA SOCIAL": {
"Custos dos Produtos para Assist\u00eancia Social - Gratuidades": {},
"Custos dos Produtos para Assist\u00eancia Social - Vendidos": {},
"Outras": {}
},
"CUSTO DOS PRODUTOS VENDIDOS PARA EDUCA\u00c7\u00c3O": {
"Custos dos Produtos para Educa\u00e7\u00e3o - Gratuidades": {},
"Custos dos Produtos para Educa\u00e7\u00e3o - Vendidos": {},
"Outros Custos": {}
},
"CUSTO DOS PRODUTOS VENDIDOS PARA SA\u00daDE": {
"Custos dos Produtos para Sa\u00fade - Gratuidades": {},
"Custos dos Produtos para Sa\u00fade \u2013 Vendidos": {},
"Outros Custos": {}
}
},
"CUSTO DOS SERVI\u00c7OS PRESTADOS": {
"CUSTO DOS SERVI\u00c7OS PRESTADOS PARA AS DEMAIS ATIVIDADES": {
"Custo dos Servi\u00e7os Prestados em Geral": {},
"Outros Custos": {}
},
"CUSTO DOS SERVI\u00c7OS PRESTADOS PARA ASSIST\u00caNCIA SOCIAL": {
"Custo dos Servi\u00e7os Prestados a Conv\u00eanios/Contratos/Parcerias": {},
"Custo dos Servi\u00e7os Prestados a Doa\u00e7\u00f5es": {},
"Custo dos Servi\u00e7os Prestados a Doa\u00e7\u00f5es/Subven\u00e7\u00f5es Vinculadas": {},
"Custo dos Servi\u00e7os Prestados a Gratuidade": {},
"Custo dos Servi\u00e7os Prestados a Pacientes Particulares": {},
"Outros Custos": {}
},
"CUSTO DOS SERVI\u00c7OS PRESTADOS PARA EDUCA\u00c7\u00c3O": {
"Custo dos Servi\u00e7os Prestados a Alunos N\u00e3o Bolsistas": {},
"Custo dos Servi\u00e7os Prestados a Conv\u00eanios/Contratos/Parcerias (Exceto PROUNI)": {},
"Custo dos Servi\u00e7os Prestados a Doa\u00e7\u00f5es": {},
"Custo dos Servi\u00e7os Prestados a Doa\u00e7\u00f5es/Subven\u00e7\u00f5es Vinculadas": {},
"Custo dos Servi\u00e7os Prestados a Gratuidade": {},
"Custo dos Servi\u00e7os Prestados ao PROUNI": {},
"Outros Custos": {}
},
"CUSTO DOS SERVI\u00c7OS PRESTADOS PARA SA\u00daDE": {
"Custo dos Servi\u00e7os Prestados a Conv\u00eanios SUS": {},
"Custo dos Servi\u00e7os Prestados a Conv\u00eanios/Contratos/Parcerias": {},
"Custo dos Servi\u00e7os Prestados a Doa\u00e7\u00f5es": {},
"Custo dos Servi\u00e7os Prestados a Doa\u00e7\u00f5es/Subven\u00e7\u00f5es Vinculadas": {},
"Custo dos Servi\u00e7os Prestados a Gratuidade": {},
"Custo dos Servi\u00e7os Prestados a Pacientes Particulares": {},
"Outros Custos": {}
}
}
},
"DESPESAS OPERACIONAIS": {
"DESPESAS OPERACIONAIS": {
"DESPESAS OPERACIONAIS": {
"Alugu\u00e9is": {},
"Arrendamento Mercantil": {},
"Assist\u00eancia M\u00e9dica, Odontol\u00f3gica, Medicamentos, Aparelhos Ortop\u00e9dicos e Similares": {},
"COFINS": {},
"CPMF": {},
"CSLL": {},
"Contribui\u00e7\u00f5es Previdenci\u00e1rias Patronais": {},
"Demais Impostos, Taxas e Contribui\u00e7\u00f5es, exceto as citadas acima.": {},
"Demais Provis\u00f5es": {},
"Despesas com Ve\u00edculos e de Conserva\u00e7\u00e3o de Bens e Instala\u00e7\u00f5es": {},
"Doa\u00e7\u00f5es a Entidades Civis": {},
"Doa\u00e7\u00f5es a Institui\u00e7\u00f5es de Ensino e Pesquisa (Lei no 9.249/1995, art.13, \u00a7 2o)": {},
"Doa\u00e7\u00f5es e Patroc\u00ednios de Car\u00e1ter Cultural e Art\u00edstico (Lei no 8.313/1991)": {},
"Encargos de Deprecia\u00e7\u00e3o e Amortiza\u00e7\u00e3o": {},
"FGTS (sem indeniza\u00e7\u00e3o 40%)": {},
"Indeniza\u00e7\u00f5es Trabalhistas": {},
"Multas": {},
"Outras Contribui\u00e7\u00f5es e Doa\u00e7\u00f5es": {},
"Outras Despesas Operacionais": {},
"PIS/PASEP": {},
"Presta\u00e7\u00e3o de Servi\u00e7o por Pessoa Jur\u00eddica": {},
"Presta\u00e7\u00e3o de Servi\u00e7os por Pessoa F\u00edsica sem V\u00ednculo Empregat\u00edcio": {},
"Propaganda e Publicidade": {},
"Provis\u00f5es para F\u00e9rias e 13o Sal\u00e1rio de Empregados": {},
"Remunera\u00e7\u00e3o a Dirigentes e a Conselho de Administra\u00e7\u00e3o/Fiscal": {},
"Remunera\u00e7\u00f5es a Empregados": {},
"Repasses para Outras Entidades (Sindicatos/Federa\u00e7\u00f5es/Confedera\u00e7\u00f5es)": {}
}
}
},
"OUTRAS DESPESAS OPERACIONAIS": {
"OUTRAS DESPESAS OPERACIONAIS": {
"OUTRAS DESPESAS OPERACIONAIS": {
"(-) Outras Despesas de Aplica\u00e7\u00f5es": {},
"(-) Perdas Incorridas no Mercado de Renda Vari\u00e1vel, exceto Day-Trade": {},
"(-) Perdas em Opera\u00e7\u00f5es Day-Trade": {},
"(-) Perdas em Opera\u00e7\u00f5es Realizadas no Exterior": {},
"(-) Preju\u00edzos na Aliena\u00e7\u00e3o de Participa\u00e7\u00f5es N\u00e3o Integrantes do Ativo Permanente": {},
"(-) Resultados Negativos em Participa\u00e7\u00f5es Societ\u00e1rias": {},
"(-) Varia\u00e7\u00f5es Cambiais Passivas": {},
"Outras Despesas Operacionais": {}
}
}
},
"OUTRAS RECEITAS OPERACIONAIS": {
"OUTRAS RECEITAS OPERACIONAIS": {
"OUTRAS RECEITAS OPERACIONAIS": {
"Ganhos Auferidos no Mercado de Renda Vari\u00e1vel, exceto Day-Trade": {},
"Ganhos em Opera\u00e7\u00f5es Day-Trade": {},
"Ganhos na Aliena\u00e7\u00e3o de Participa\u00e7\u00f5es N\u00e3o Integrantes do Ativo Permanente": {},
"Outras": {},
"Outras Receitas Operacionais": {},
"Outras Receitas de Aplica\u00e7\u00f5es Financeiras": {},
"Rendimentos e Ganhos de Capital Auferidos no Exterior": {},
"Resultados Positivos em Participa\u00e7\u00f5es Societ\u00e1rias": {},
"Revers\u00e3o dos Saldos das Provis\u00f5es Operacionais": {},
"Varia\u00e7\u00f5es Cambiais Ativas": {}
}
}
},
"RECEITA OPERACIONAL L\u00cdQUIDA": {
"RECEITA BRUTA": {
"DEDU\u00c7\u00d5ES DA RECEITA BRUTA": {
"(-) Devolu\u00e7\u00f5es e Descontos Incondicionais": {},
"(-) Vendas Canceladas": {},
"Outras": {}
},
"RECEITA DE PRESTA\u00c7\u00c3O DOS SERVI\u00c7OS": {
"Contribui\u00e7\u00f5es": {},
"Doa\u00e7\u00f5es": {},
"Doa\u00e7\u00f5es/Subven\u00e7\u00f5es Vinculadas": {},
"Outras": {},
"Servi\u00e7os Educacionais": {}
},
"RECEITA DE SERVI\u00c7OS DE SA\u00daDE": {
"Contribui\u00e7\u00f5es": {},
"Conv\u00eanios \u2013 Outros": {},
"Conv\u00eanios \u2013 SUS": {},
"Doa\u00e7\u00f5es": {},
"Doa\u00e7\u00f5es/Subven\u00e7\u00f5es Vinculadas": {},
"Outras": {},
"Pacientes Particulares": {}
},
"RECEITA DE VENDA DE PRODUTOS": {
"Da atividade de Assist\u00eancia Social": {},
"Da atividade de Educa\u00e7\u00e3o": {},
"Da atividade de Sa\u00fade": {},
"Outras": {}
},
"RECEITAS DE OUTRAS ATIVIDADES": {
"Contribui\u00e7\u00f5es Confederativas/Associativas": {},
"Contribui\u00e7\u00f5es Sindicais": {},
"Doa\u00e7\u00f5es/Subven\u00e7\u00f5es": {},
"Mensalidades": {},
"Outras": {},
"Outras Contribui\u00e7\u00f5es": {}
},
"RECEITAS DE SERVI\u00c7OS DE ASSIST\u00caNCIA SOCIAL": {
"Contribui\u00e7\u00f5es": {},
"Conv\u00eanios - Outros": {},
"Doa\u00e7\u00f5es": {},
"Doa\u00e7\u00f5es/Subven\u00e7\u00f5es Vinculadas": {},
"Outras": {},
"Pacientes Particulares": {}
}
}
}
},
"root_type": ""
}
}
}

View File

@@ -0,0 +1,172 @@
{
"country_code": "ca",
"name": "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

@@ -0,0 +1,153 @@
{
"country_code": "ca",
"name": "Plan comptable pour les provinces francophones",
"tree": {
"ACTIF": {
"ACTIFS COURANTS": {
"CERTIFICATS DE D\u00c9P\u00d4TS": {},
"COMPTES CLIENTS": {
"Comptes clients": {
"account_type": "Receivable"
},
"PROVISION POUR CR\u00c9ANCES DOUTEUSES": {}
},
"ENCAISSE": {},
"FRAIS PAY\u00c9S D'AVANCE": {},
"IMP\u00d4TS \u00c0 RECEVOIR": {
"TPS \u00e0 recevoir": {},
"TVH \u00e0 recevoir": {
"TVH \u00e0 recevoir - 13%": {},
"TVH \u00e0 recevoir - 14%": {},
"TVH \u00e0 recevoir - 15%": {}
},
"TVP/TVQ \u00e0 recevoir": {}
},
"PLACEMENTS D\u00c9TENUS \u00c0 DES FINS DE TRANSACTION": {},
"STOCKS": {
"Stock": {},
"Stock exp\u00e9di\u00e9 non-factur\u00e9": {}
},
"TR\u00c9SORERIE OU \u00c9QUIVALENTS DE TR\u00c9SORERIE": {}
},
"ACTIFS NON-COURANTS": {
"IMMOBILISATIONS CORPORELLES": {
"AMORTISSEMENTS CUMUL\u00c9S": {}
},
"IMMOBILISATIONS INCORPORELLES": {
"BREVETS, MARQUES DE COMMERCE ET DROITS D'AUTEURS": {}
},
"PLACEMENTS DISPONIBLES \u00c0 LA VENTE": {}
},
"root_type": "Asset"
},
"CAPITAUX PROPRES": {
"AUTRES \u00c9L\u00c9MENTS DU R\u00c9SULTAT GLOBAL": {},
"B\u00c9N\u00c9FICES NON R\u00c9PARTIS": {},
"CAPITAL-ACTIONS": {},
"DIVIDENDES": {},
"PRIMES": {},
"SURPLUS D'APPORT": {},
"root_type": "Equity",
"\u00c9CARTS DE CONVERSION": {}
},
"CHARGES": {
"CHARGES D'EXPLOITATION": {
"AUTRES FRAIS D'EXPLOITATION": {},
"CO\u00dbT DES PRODUITS VENDUS": {
"Achats": {},
"Achats dans des provinces harmonis\u00e9es": {},
"Achats dans des provinces non-harmonis\u00e9es": {},
"Achats \u00e0 l'\u00e9tranger": {}
},
"FRAIS DE RECHERCHE ET D\u00c9VELOPPEMENT": {},
"FRAIS G\u00c9N\u00c9RAUX": {},
"FRAIS SUR VENTE": {},
"SALAIRES ET CHARGES SOCIALES": {
"Assurance Emploi": {},
"Assurance parentale": {},
"Fonds des services de sant\u00e9": {},
"Imp\u00f4t f\u00e9d\u00e9ral": {},
"Imp\u00f4t provincial": {},
"Normes du travail": {},
"Rentes": {},
"Salaires": {},
"Sant\u00e9 et s\u00e9curit\u00e9 au travail": {},
"Vacances": {}
}
},
"FRAIS NON LI\u00c9S \u00c0 L'EXPLOITATION": {
"AUTRES FRAIS NON LI\u00c9S \u00c0 L'EXPLOITATION": {},
"INT\u00c9R\u00caTS D\u00c9BITEURS": {}
},
"root_type": "Expense"
},
"PASSIF": {
"PASSIFS COURANTS": {
"AUTRES COMPTES CR\u00c9DITEURS": {},
"DETTES FINANCI\u00c8RES COURANTES": {},
"FOURNISSEURS ET COMPTES RATTACH\u00c9S": {
"Comptes fournisseurs": {
"account_type": "Payable"
}
},
"IMP\u00d4TS LI\u00c9S AUX SALAIRES \u00c0 PAYER": {
"AGENCE DU REVENU DU CANADA": {
"ASSURANCE EMPLOI \u00c0 PAYER": {
"AE - Contribution de l'employeur": {},
"AE - Contribution des employ\u00e9s": {}
},
"Imp\u00f4t f\u00e9d\u00e9ral sur les revenus": {}
},
"AGENCE DU REVENU PROVINCIAL": {
"ASSURANCE PARENTALE \u00c0 PAYER": {
"AP - Contribution de l'employeur": {},
"AP - Contribution des employ\u00e9s": {}
},
"Fond des Services de Sant\u00e9 \u00e0 payer": {},
"Imp\u00f4t provincial sur les revenus": {},
"Normes du Travail \u00e0 payer": {},
"RENTES \u00c0 PAYER": {
"Rentes - Contribution de l'employeur": {},
"Rentes - Contribution des employ\u00e9s": {}
},
"Sant\u00e9 et S\u00e9curit\u00e9 au Travail \u00e0 payer": {}
}
},
"IMP\u00d4TS \u00c0 PAYER": {
"TPS \u00e0 payer": {},
"TVH \u00e0 payer": {
"TVH \u00e0 payer - 13%": {},
"TVH \u00e0 payer - 14%": {},
"TVH \u00e0 payer - 15%": {}
},
"TVP/TVQ \u00e0 payer": {}
},
"PASSIFS DE STOCK": {
"Stock re\u00e7u non factur\u00e9": {}
},
"PASSIFS LI\u00c9S AUX ACTIFS D\u00c9TENUS EN VUE DE LEUR CESSION": {}
},
"PASSIFS NON-COURANTS": {
"AUTRES PASSIFS NON-COURANTS": {},
"DETTES FINANCI\u00c8RES NON-COURANTES": {},
"IMP\u00d4TS DIFF\u00c9R\u00c9S": {},
"PROVISIONS POUR RETRAITES ET AUTRES AVANTAGES POST\u00c9RIEURS \u00c0 L'EMPLOI": {}
},
"root_type": "Liability"
},
"PRODUITS": {
"PRODUITS D'EXPLOITATION": {
"AUTRES PRODUITS D'EXPLOITATION": {},
"Ventes": {},
"Ventes avec des provinces harmonis\u00e9es": {},
"Ventes avec des provinces non-harmonis\u00e9es": {},
"Ventes \u00e0 l'\u00e9tranger": {}
},
"PRODUITS NON LI\u00c9S \u00c0 L'EXPLOITATION": {
"AUTRES PRODUITS NON LI\u00c9S \u00c0 L'EXPLOITATION": {},
"INT\u00c9R\u00caTS": {}
},
"root_type": "Income"
}
}
}

View File

@@ -1,6 +1,7 @@
{
"country_code": "ch",
"name": "Switzerland - Plan comptable STERCHI",
"name": "Plan comptable STERCHI",
"disabled": "Yes",
"tree": {
"Actif": {
"Actifs circulants": {

View File

@@ -1,6 +1,7 @@
{
"country_code": "cl",
"name": "Chile - Plan de Cuentas",
"name": "Plan de Cuentas",
"disabled": "Yes",
"tree": {
"Cuentas de Movimiento": {
"Compras": {

View File

@@ -1,6 +1,7 @@
{
"country_code": "cn",
"name": "China - \u4e2d\u56fd\u4f1a\u8ba1\u79d1\u76ee\u8868 \uff08\u8d22\u4f1a[2006]3\u53f7\u300a\u4f01\u4e1a\u4f1a\u8ba1\u51c6\u5219\u300b\uff09",
"disabled": "Yes",
"name": "\u4e2d\u56fd\u4f1a\u8ba1\u79d1\u76ee\u8868 \uff08\u8d22\u4f1a[2006]3\u53f7\u300a\u4f01\u4e1a\u4f1a\u8ba1\u51c6\u5219\u300b\uff09",
"tree": {
"\u4e3b\u8425\u4e1a\u52a1\u6210\u672c": {
"root_type": ""

View File

@@ -0,0 +1,199 @@
{
"country_code": "cn",
"disabled": "Yes",
"name": "\u5c0f\u4f01\u4e1a\u4f1a\u8ba1\u79d1\u76ee\u8868\uff08\u8d22\u4f1a[2011]17\u53f7\u300a\u5c0f\u4f01\u4e1a\u4f1a\u8ba1\u51c6\u5219\u300b\uff09",
"tree": {
"\u4e3b\u8425\u4e1a\u52a1\u6210\u672c": {
"root_type": ""
},
"\u4e3b\u8425\u4e1a\u52a1\u6536\u5165": {
"root_type": ""
},
"\u5176\u4ed6\u4e1a\u52a1\u6210\u672c": {
"root_type": ""
},
"\u5176\u4ed6\u4e1a\u52a1\u6536\u5165": {
"root_type": ""
},
"\u5176\u4ed6\u5e94\u6536\u6b3e": {
"root_type": ""
},
"\u5176\u4ed6\u8d27\u5e01\u8d44\u91d1": {
"root_type": ""
},
"\u5229\u6da6\u5206\u914d": {
"root_type": ""
},
"\u5236\u9020\u8d39\u7528": {
"root_type": ""
},
"\u539f\u6750\u6599": {
"root_type": ""
},
"\u5468\u8f6c\u6750\u6599": {
"root_type": ""
},
"\u5546\u54c1\u8fdb\u9500\u5dee\u4ef7": {
"root_type": ""
},
"\u56fa\u5b9a\u8d44\u4ea7": {
"root_type": ""
},
"\u56fa\u5b9a\u8d44\u4ea7\u6e05\u7406": {
"root_type": ""
},
"\u5728\u5efa\u5de5\u7a0b": {
"root_type": ""
},
"\u5728\u9014\u7269\u8d44": {
"root_type": ""
},
"\u59d4\u6258\u52a0\u5de5\u7269\u8d44": {
"root_type": ""
},
"\u5b9e\u6536\u8d44\u672c": {
"root_type": ""
},
"\u5de5\u7a0b\u65bd\u5de5": {
"root_type": ""
},
"\u5de5\u7a0b\u7269\u8d44": {
"root_type": ""
},
"\u5e93\u5b58\u5546\u54c1": {
"root_type": ""
},
"\u5e94\u4ea4\u7a0e\u8d39": {
"root_type": ""
},
"\u5e94\u4ed8\u5229\u606f": {
"root_type": ""
},
"\u5e94\u4ed8\u5229\u6da6": {
"root_type": ""
},
"\u5e94\u4ed8\u7968\u636e": {
"root_type": ""
},
"\u5e94\u4ed8\u804c\u5de5\u85aa\u916c": {
"root_type": ""
},
"\u5e94\u4ed8\u8d26\u6b3e": {
"root_type": ""
},
"\u5e94\u6536\u5229\u606f": {
"root_type": ""
},
"\u5e94\u6536\u7968\u636e": {
"root_type": ""
},
"\u5e94\u6536\u80a1\u5229": {
"root_type": ""
},
"\u5e94\u6536\u8d26\u6b3e": {
"root_type": ""
},
"\u5f85\u5904\u7406\u8d22\u4ea7\u635f\u6ea2": {
"root_type": ""
},
"\u6240\u5f97\u7a0e": {
"root_type": ""
},
"\u6295\u8d44\u6536\u76ca": {
"root_type": ""
},
"\u65e0\u5f62\u8d44\u4ea7": {
"root_type": ""
},
"\u672c\u5e74\u5229\u6da6": {
"root_type": ""
},
"\u673a\u68b0\u4f5c\u4e1a": {
"root_type": ""
},
"\u6750\u6599\u6210\u672c\u5dee\u5f02": {
"root_type": ""
},
"\u6750\u6599\u91c7\u8d2d": {
"root_type": ""
},
"\u6d88\u8017\u6027\u751f\u7269\u8d44\u4ea7": {
"root_type": ""
},
"\u73b0\u91d1": {
"root_type": ""
},
"\u751f\u4ea7\u6027\u751f\u7269\u8d44\u4ea7": {
"root_type": ""
},
"\u751f\u4ea7\u6027\u751f\u7269\u8d44\u4ea7\u7d2f\u8ba1\u6298\u65e7": {
"root_type": ""
},
"\u751f\u4ea7\u6210\u672c": {
"root_type": ""
},
"\u76c8\u4f59\u516c\u79ef": {
"root_type": ""
},
"\u77ed\u671f\u501f\u6b3e": {
"root_type": ""
},
"\u77ed\u671f\u6295\u8d44": {
"root_type": ""
},
"\u7814\u53d1\u652f\u51fa": {
"root_type": ""
},
"\u7ba1\u7406\u8d39\u7528": {
"root_type": ""
},
"\u7d2f\u8ba1\u644a\u9500": {
"root_type": ""
},
"\u8425\u4e1a\u5916\u652f\u51fa": {
"root_type": ""
},
"\u8425\u4e1a\u5916\u6536\u5165": {
"root_type": ""
},
"\u8425\u4e1a\u7a0e\u91d1\u53ca\u9644\u52a0": {
"root_type": ""
},
"\u8d22\u52a1\u8d39\u7528": {
"root_type": ""
},
"\u8d44\u672c\u516c\u79ef": {
"root_type": ""
},
"\u9012\u5ef6\u6536\u76ca": {
"root_type": ""
},
"\u94f6\u884c\u5b58\u6b3e": {
"root_type": ""
},
"\u9500\u552e\u8d39\u7528": {
"root_type": ""
},
"\u957f\u671f\u501f\u6b3e": {
"root_type": ""
},
"\u957f\u671f\u503a\u5238\u6295\u8d44": {
"root_type": ""
},
"\u957f\u671f\u5e94\u4ed8\u6b3e": {
"root_type": ""
},
"\u957f\u671f\u5f85\u644a\u8d39\u7528": {
"root_type": ""
},
"\u957f\u671f\u80a1\u6743\u6295\u8d44": {
"root_type": ""
},
"\u9884\u4ed8\u8d26\u6b3e": {
"root_type": ""
},
"\u9884\u6536\u8d26\u6b3e": {
"root_type": ""
}
}
}

View File

@@ -1,6 +1,6 @@
{
"country_code": "co",
"name": "Colombia - Unique Account Chart - PUC",
"name": "Unique Account Chart - PUC",
"tree": {
"ACTIVO": {
"DEUDORES": {

View File

@@ -1,6 +1,6 @@
{
"country_code": "cr",
"name": "Costa Rica - Chart of Accounts 1",
"name": "Costa Rica - Company 0",
"tree": {
"0-Activo": {
"0-Activo circulante": {

View File

@@ -1,6 +1,6 @@
{
"country_code": "cr",
"name": "Costa Rica - Chart of Accounts 2",
"name": "Costa Rica - Company 1",
"tree": {
"xActivo": {
"root_type": "Asset",

View File

@@ -1,6 +1,7 @@
{
"country_code": "de",
"name": "Germany - Kontenplan SKR03",
"name": "Deutscher Kontenplan SKR03",
"disabled": "Yes",
"tree": {
"Aktiva": {
"Abgrenzung latenter Steuern": {
@@ -398,7 +399,8 @@
"Jahres\u00fcberschuss Jahresfehlbetrag": {}
},
"Rechnungsabgrenzungsposten": {
"Passive Rechnungsabgrenzung": {}
"Passive Rechnungsabgrenzung": {},
"Verbindlichkeiten aus der Begebung und \u00dcbertragung von Wechseln, aus B\u00fcrgschaften, Wechsel- und Scheckb\u00fcrgschaften und aus Gew\u00e4hrleistungsvertr\u00e4gen sowie Haftung aus Bestellung von Sicherheiten f\u00fcr fremde Verbindlichkeiten": {}
},
"R\u00fcckstellungen": {
"R\u00fcckstellungen f\u00fcr Pensionen und \u00e4hnliche Verpflichtungen": {
@@ -1344,6 +1346,10 @@
"Statistische Konten f\u00fcr den Gewinnzuschlag nach \u00a7\u00a7 6b- 6c und 7g EStG (Haben-Buchung)": {},
"Statistische Konten f\u00fcr den Gewinnzuschlag- Gegenkonto zu 9890": {}
},
"Statistische Konten f\u00fcr den GuV-Ausweis in \"Gutschrift bzw. Belastung auf Verbindlichkeitskonten\" bei den Zuordnungstabellen f\u00fcr PersHG nach KapCoRiLiG": {
"Anteil f\u00fcr Verbindlichkeitskonten": {},
"Verrechnungskonto f\u00fcr Anteil Verbindlichkeitskonten": {}
},
"Statistische Konten f\u00fcr den Kennziffernteil der Bilanz": {
"Besch\u00e4ftigte Personen": {},
"Gegenkonto zu 9200": {},

View File

@@ -1,6 +1,7 @@
{
"country_code": "es",
"name": "Spain - PGCE com\u00fan",
"name": "PGCE com\u00fan",
"disabled": "Yes",
"tree": {
"Acreedores y deudores por operaciones comerciales": {
"Acreedores varios": {
@@ -1481,7 +1482,10 @@
}
},
"Deterioro del valor de inversiones financieras a corto plazo y de activos no corrientes mantenidos para la venta": {
"Deterioro de valor de activos no corrientes mantenidos para la venta": {
"Deterioro de valor de activos no corrientes mantenidos para la venta": {
"Deterioro de valor de existencias, deudores comerciales y otras cuentas a cobrar integrados en un grupo enajenable mantenido para la venta": {
"Deterioro de valor de existencias, deudores comerciales y otras cuentas a cobrar integrados en un grupo enajenable mantenido para la venta": {}
},
"Deterioro de valor de inmovilizado no corriente mantenido para la venta": {
"Deterioro de valor de inmovilizado no corriente mantenido para la venta": {}
},

View File

@@ -1,6 +1,6 @@
{
"country_code": "et",
"name": "Ethiopia - Chart of Accounts",
"name": "Ethiopia Tax and Account Chart Template",
"tree": {
"ASSETS": {
"Cash and Cash Equivalents": {

View File

@@ -1,6 +1,6 @@
{
"country_code": "gr",
"name": "Greece - \u03a0\u03c1\u03cc\u03c4\u03c5\u03c0\u03bf \u0395\u03bb\u03bb\u03b7\u03bd\u03b9\u03ba\u03bf\u03cd \u039b\u03bf\u03b3\u03b9\u03c3\u03c4\u03b9\u03ba\u03bf\u03cd \u03a3\u03c7\u03b5\u03b4\u03af\u03bf\u03c5",
"name": "\u03a0\u03c1\u03cc\u03c4\u03c5\u03c0\u03bf \u0395\u03bb\u03bb\u03b7\u03bd\u03b9\u03ba\u03bf\u03cd \u039b\u03bf\u03b3\u03b9\u03c3\u03c4\u03b9\u03ba\u03bf\u03cd \u03a3\u03c7\u03b5\u03b4\u03af\u03bf\u03c5",
"tree": {
"\u0391\u03a0\u0391\u0399\u03a4\u0397\u03a3\u0395\u0399\u03a3 \u039a\u0391\u0399 \u0394\u0399\u0391\u0398\u0395\u03a3\u0399\u039c\u0391": {
"root_type": "",

View File

@@ -0,0 +1,133 @@
{
"country_code": "gt",
"name": "Plantilla de cuentas de Guatemala (sencilla)",
"tree": {
"Activo": {
"Activo Corriente": {
"Caja y Bancos": {
"Caja Chica": {}
},
"Cuentas y Documentos por Cobrar": {
"Cuentas por Cobrar Empresas Afilidas": {},
"Cuentas por Cobrar Generales": {},
"Otras Cuentas por Cobrar": {},
"Prestamos al Personal": {}
},
"IVA por Cobrar": {
"IVA por Cobrar": {},
"Retenciones de IVA recibidas": {}
},
"Inventario": {}
},
"Diferido": {
"Gastos Anticipados": {
"Gastos Anticipados": {}
},
"Gastos de Organizaci\u00f3n": {
"Gastos de Organizaci\u00f3n": {}
},
"Gastos por Amortizar": {
"Gastos por Amortizar": {}
},
"Otros Activos": {
"Otros Activos": {}
}
},
"No Corriente": {
"Depreciaciones Acumuladas": {
"Depreciaciones Acumuladas": {}
},
"Propiedad, Planta y Equipo": {
"Propiedad, Planta y Equipo": {}
}
},
"root_type": "Asset"
},
"Pasivo": {
"Cr\u00e9ditos Diferidos": {
"Cr\u00e9ditos Diferidos": {
"Anticipos": {}
}
},
"Pasivo Corto Plazo": {
"Cuentas y Documentos por Pagar": {
"Cuentas y Documentos por Pagar": {}
},
"IVA por Pagar": {
"IVA por Pagar": {}
},
"Impuestos": {
"Impuestos": {}
}
},
"Pasivo a Largo Plazo": {
"Provisi\u00f3n para Indemnizaciones": {
"Provisi\u00f3n para Indemnizaciones": {}
}
},
"root_type": "Liability"
},
"Patrimonio": {
"Patrimonio de los Accionistas": {
"Patrimonio de los Accionistas": {
"Capital Autorizado, Suscr\u00edto y Pagado": {},
"Perdidas y Ganancias": {},
"Reservas": {}
}
},
"root_type": "Asset"
},
"Egresos": {
"Costos": {
"Costos de Ventas": {
"Costos de Ventas": {}
}
},
"root_type": "Expense"
},
"Gastos": {
"Gastos de Operaci\u00f3n": {
"Gastos de Administraci\u00f3n": {
"Gastos de Administraci\u00f3n": {}
},
"Otros Gastos de Operaci\u00f3n": {
"Otros Gastos de Operaci\u00f3n": {}
}
},
"Gastos de Ventas": {
"Gastos de Ventas": {
"Gastos de Ventas": {}
}
},
"Gastos no Deducibles": {
"Gastos no Deducibles": {
"Gastos no Deducibles": {}
}
},
"root_type": "Expense"
},
"Ingresos": {
"Otros Ingresos": {
"Otros Ingresos": {
"Otros Ingresos": {}
}
},
"Ventas": {
"Ventas Netas": {
"Descuentos Sobre Ventas": {},
"Ventas": {}
}
},
"root_type": "Income"
},
"Otros Gastos y Productos Financieros": {
"Otros Gastos y Productos Financieros": {
"Otros Gastos y Productos Financieros": {
"Intereses": {},
"Otros Gastos Financieros": {}
}
},
"root_type": "Expense"
}
}
}

View File

@@ -1,6 +1,6 @@
{
"country_code": "hn",
"name": "Honduras - Plantilla de cuentas de",
"name": "Plantilla de cuentas de Honduras (sencilla)",
"tree": {
"Activo": {
"Activo Corriente": {

View File

@@ -1,6 +1,6 @@
{
"country_code": "hr",
"name": "Croatia - RRIF-ov ra\u010dunski plan za poduzetnike",
"name": "RRIF-ov ra\u010dunski plan za poduzetnike",
"tree": {
"FINANCIJSKI REZULTAT POSLOVANJA": {
"DOBITAK ILI GUBITAK RAZDOBLJA": {

View File

@@ -0,0 +1,355 @@
{
"country_code": "hu",
"name": "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": ""
}
}
}

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