fix: resolved merge conflicts
diff --git a/.github/workflows/server-tests-mariadb.yml b/.github/workflows/server-tests-mariadb.yml
index ed731b8..b40faa7 100644
--- a/.github/workflows/server-tests-mariadb.yml
+++ b/.github/workflows/server-tests-mariadb.yml
@@ -59,7 +59,7 @@
- name: Setup Python
uses: actions/setup-python@v2
with:
- python-version: '3.10'
+ python-version: '3.11'
- name: Check for valid Python & Merge Conflicts
run: |
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index dc3011f..73aae33 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -16,8 +16,8 @@
- id: check-merge-conflict
- id: check-ast
- - repo: https://gitlab.com/pycqa/flake8
- rev: 3.9.2
+ - repo: https://github.com/PyCQA/flake8
+ rev: 5.0.4
hooks:
- id: flake8
additional_dependencies: [
diff --git a/erpnext/accounts/doctype/account/chart_of_accounts/verified/hu_chart_of_accounts_for_microenterprises_with_account_number.json b/erpnext/accounts/doctype/account/chart_of_accounts/verified/hu_chart_of_accounts_for_microenterprises_with_account_number.json
new file mode 100644
index 0000000..2cd6c0f
--- /dev/null
+++ b/erpnext/accounts/doctype/account/chart_of_accounts/verified/hu_chart_of_accounts_for_microenterprises_with_account_number.json
@@ -0,0 +1,1654 @@
+{
+ "tree": {
+ "SZ\u00c1MLAOSZT\u00c1LY BEFEKTETETT ESZK\u00d6Z\u00d6K": {
+ "account_number": 1,
+ "root_type": "Asset",
+ "is_group": 1,
+ "IMMATERI\u00c1LIS JAVAK": {
+ "account_number": 11,
+ "root_type": "Asset",
+ "is_group": 1,
+ "Vagyoni \u00e9rt\u00e9k\u0171 jogok": {
+ "account_number": 113,
+ "root_type": "Asset",
+ "is_group": 1,
+ "Vagyoni \u00e9rt\u00e9k\u0171 jogok brutt\u00f3 \u00e9rt\u00e9ke": {
+ "account_number": 1131,
+ "root_type": "Asset"
+ },
+ "Vagyoni \u00e9rt\u00e9k\u0171 jogok terven fel\u00fcli \u00e9rt\u00e9kcs\u00f6kken\u00e9se \u00e9s annak vissza\u00edr\u00e1sa": {
+ "account_number": 1138,
+ "root_type": "Asset"
+ },
+ "Vagyoni \u00e9rt\u00e9k\u0171 jogok terv szerinti \u00e9rt\u00e9kcs\u00f6kken\u00e9se": {
+ "account_number": 1139,
+ "root_type": "Asset"
+ }
+ },
+ "Szellemi term\u00e9kek": {
+ "account_number": 114,
+ "root_type": "Asset",
+ "is_group": 1,
+ "Szellemi term\u00e9kek brutt\u00f3 \u00e9rt\u00e9ke": {
+ "account_number": 1141,
+ "root_type": "Asset"
+ },
+ "Szellemi term\u00e9kek terven fel\u00fcli \u00e9rt\u00e9kcs\u00f6kken\u00e9se \u00e9s annak vissza\u00edr\u00e1sa": {
+ "account_number": 1148,
+ "root_type": "Asset"
+ },
+ "Szellemi term\u00e9kek terv szerinti \u00e9rt\u00e9kcs\u00f6kken\u00e9se": {
+ "account_number": 1149,
+ "root_type": "Asset"
+ }
+ },
+ "Kis \u00e9rt\u00e9k\u0171 immateri\u00e1lis javak": {
+ "account_number": 119,
+ "root_type": "Asset",
+ "is_group": 1,
+ "Kis \u00e9rt\u00e9k\u0171 immateri\u00e1lis javak brutt\u00f3 \u00e9rt\u00e9ke": {
+ "account_number": 1191,
+ "root_type": "Asset"
+ },
+ "Kis \u00e9rt\u00e9k\u0171 immateri\u00e1lis javak terv szerinti \u00e9rt\u00e9kcs\u00f6kken\u00e9se": {
+ "account_number": 1199,
+ "root_type": "Asset"
+ }
+ }
+ },
+ "INGATLANOK \u00c9S KAPCSOL\u00d3D\u00d3 VAGYONI \u00c9RT\u00c9K\u0170 JOGOK": {
+ "account_number": 12,
+ "root_type": "Asset",
+ "is_group": 1,
+ "Telkek, f\u00f6ldter\u00fcletek": {
+ "account_number": 121,
+ "root_type": "Asset",
+ "is_group": 1,
+ "Telkek, f\u00f6ldter\u00fcletek brutt\u00f3 \u00e9rt\u00e9ke": {
+ "account_number": 1211,
+ "root_type": "Asset"
+ },
+ "Telkek, f\u00f6ldter\u00fcletek terven fel\u00fcli \u00e9rt\u00e9kcs\u00f6kken\u00e9se \u00e9s annak vissza\u00edr\u00e1sa": {
+ "account_number": 1218,
+ "root_type": "Asset"
+ },
+ "Telkek, f\u00f6ldter\u00fcletek terv szerinti \u00e9rt\u00e9kcs\u00f6kken\u00e9se": {
+ "account_number": 1219,
+ "root_type": "Asset"
+ }
+ },
+ "Ingatlanokhoz kapcsol\u00f3d\u00f3 vagyoni \u00e9rt\u00e9k\u0171 jogok": {
+ "account_number": 122,
+ "root_type": "Asset",
+ "is_group": 1,
+ "Ingatlanokhoz kapcsol\u00f3d\u00f3 vagyoni \u00e9rt\u00e9k\u0171 jogok brutt\u00f3 \u00e9rt\u00e9ke": {
+ "account_number": 1221,
+ "root_type": "Asset"
+ },
+ "Ingatlanokhoz kapcsol\u00f3d\u00f3 vagyoni \u00e9rt\u00e9k\u0171 jogok terven fel\u00fcli \u00e9rt\u00e9kcs\u00f6kken\u00e9se \u00e9s annak vissza\u00edr\u00e1sa": {
+ "account_number": 1228,
+ "root_type": "Asset"
+ },
+ "Ingatlanokhoz kapcsol\u00f3d\u00f3 vagyoni \u00e9rt\u00e9k\u0171 jogok terv szerinti \u00e9rt\u00e9kcs\u00f6kken\u00e9se": {
+ "account_number": 1229,
+ "root_type": "Asset"
+ }
+ },
+ "\u00c9p\u00fcletek, \u00e9p\u00fcletr\u00e9szek, tulajdoni h\u00e1nyadok": {
+ "account_number": 123,
+ "root_type": "Asset",
+ "is_group": 1,
+ "\u00c9p\u00fcletek, \u00e9p\u00fcletr\u00e9szek, tulajdoni h\u00e1nyadok brutt\u00f3 \u00e9rt\u00e9ke": {
+ "account_number": 1231,
+ "root_type": "Asset"
+ },
+ "\u00c9p\u00fcletek, \u00e9p\u00fcletr\u00e9szek, tulajdoni h\u00e1nyadok terven fel\u00fcli \u00e9rt\u00e9kcs\u00f6kken\u00e9se \u00e9s annak vissza\u00edr\u00e1sa": {
+ "account_number": 1238,
+ "root_type": "Asset"
+ },
+ "\u00c9p\u00fcletek, \u00e9p\u00fcletr\u00e9szek, tulajdoni h\u00e1nyadok terv szerinti \u00e9rt\u00e9kcs\u00f6kken\u00e9se": {
+ "account_number": 1239,
+ "root_type": "Asset"
+ }
+ },
+ "Egy\u00e9b ingatlanok": {
+ "account_number": 124,
+ "root_type": "Asset",
+ "is_group": 1,
+ "Egy\u00e9b ingatlanok brutt\u00f3 \u00e9rt\u00e9ke": {
+ "account_number": 1241,
+ "root_type": "Asset"
+ },
+ "Egy\u00e9b ingatlanok terven fel\u00fcli \u00e9rt\u00e9kcs\u00f6kken\u00e9se \u00e9s annak vissza\u00edr\u00e1sa": {
+ "account_number": 1248,
+ "root_type": "Asset"
+ },
+ "Egy\u00e9b ingatlanok terv szerinti \u00e9rt\u00e9kcs\u00f6kken\u00e9se": {
+ "account_number": 1249,
+ "root_type": "Asset"
+ }
+ },
+ "Kis \u00e9rt\u00e9k\u0171 ingatlanok": {
+ "account_number": 129,
+ "root_type": "Asset",
+ "is_group": 1,
+ "Kis \u00e9rt\u00e9k\u0171 ingatlanok brutt\u00f3 \u00e9rt\u00e9ke": {
+ "account_number": 1291,
+ "root_type": "Asset"
+ },
+ "Kis \u00e9rt\u00e9k\u0171 ingatlanok terv szerinti \u00e9rt\u00e9kcs\u00f6kken\u00e9se": {
+ "account_number": 1299,
+ "root_type": "Asset"
+ }
+ }
+ },
+ "M\u0170SZAKI BERENDEZ\u00c9SEK, G\u00c9PEK, J\u00c1RM\u0170VEK": {
+ "account_number": 13,
+ "root_type": "Asset",
+ "is_group": 1,
+ "Termel\u0151 g\u00e9pek, berendez\u00e9sek": {
+ "account_number": 131,
+ "root_type": "Asset",
+ "is_group": 1,
+ "Termel\u0151 g\u00e9pek, berendez\u00e9sek brutt\u00f3 \u00e9rt\u00e9ke": {
+ "account_number": 1311,
+ "root_type": "Asset"
+ },
+ "Termel\u0151 g\u00e9pek, berendez\u00e9sek terven fel\u00fcli \u00e9rt\u00e9kcs\u00f6kken\u00e9se \u00e9s annak vissza\u00edr\u00e1sa": {
+ "account_number": 1318,
+ "root_type": "Asset"
+ },
+ "Termel\u0151 g\u00e9pek, berendez\u00e9sek terv szerinti \u00e9rt\u00e9kcs\u00f6kken\u00e9se": {
+ "account_number": 1319,
+ "root_type": "Asset"
+ }
+ },
+ "M\u0171szaki j\u00e1rm\u0171vek": {
+ "account_number": 132,
+ "root_type": "Asset",
+ "is_group": 1,
+ "M\u0171szaki j\u00e1rm\u0171vek brutt\u00f3 \u00e9rt\u00e9ke": {
+ "account_number": 1321,
+ "root_type": "Asset"
+ },
+ "M\u0171szaki j\u00e1rm\u0171vek terven fel\u00fcli \u00e9rt\u00e9kcs\u00f6kken\u00e9se \u00e9s annak vissza\u00edr\u00e1sa": {
+ "account_number": 1328,
+ "root_type": "Asset"
+ },
+ "M\u0171szaki j\u00e1rm\u0171vek terv szerinti \u00e9rt\u00e9kcs\u00f6kken\u00e9se": {
+ "account_number": 1329,
+ "root_type": "Asset"
+ }
+ },
+ "Ki nem emelt m\u0171szaki berendez\u00e9sek, g\u00e9pek, j\u00e1rm\u0171vek": {
+ "account_number": 133,
+ "root_type": "Asset",
+ "is_group": 1,
+ "Ki nem emelt m\u0171szaki berendez\u00e9sek, g\u00e9pek, j\u00e1rm\u0171vek brutt\u00f3 \u00e9rt\u00e9ke": {
+ "account_number": 1331,
+ "root_type": "Asset"
+ },
+ "Ki nem emelt m\u0171szaki berendez\u00e9sek, g\u00e9pek, j\u00e1rm\u0171vek terven fel\u00fcli \u00e9rt\u00e9kcs\u00f6kken\u00e9se \u00e9s annak vissza\u00edr\u00e1sa": {
+ "account_number": 1338,
+ "root_type": "Asset"
+ },
+ "Ki nem emelt m\u0171szaki berendez\u00e9sek, g\u00e9pek, j\u00e1rm\u0171vek terv szerinti \u00e9rt\u00e9kcs\u00f6kken\u00e9se": {
+ "account_number": 1339,
+ "root_type": "Asset"
+ }
+ },
+ "Kis \u00e9rt\u00e9k\u0171 m\u0171szaki berendez\u00e9sek, g\u00e9pek, j\u00e1rm\u0171vek": {
+ "account_number": 139,
+ "root_type": "Asset",
+ "is_group": 1,
+ "Kis \u00e9rt\u00e9k\u0171 m\u0171szaki berendez\u00e9sek, g\u00e9pek, j\u00e1rm\u0171vek brutt\u00f3 \u00e9rt\u00e9ke": {
+ "account_number": 1391,
+ "root_type": "Asset"
+ },
+ "Kis \u00e9rt\u00e9k\u0171 m\u0171szaki berendez\u00e9sek, g\u00e9pek, j\u00e1rm\u0171vek terv szerinti \u00e9rt\u00e9kcs\u00f6kken\u00e9se": {
+ "account_number": 1399,
+ "root_type": "Asset"
+ }
+ }
+ },
+ "EGY\u00c9B BERENDEZ\u00c9SEK, FELSZEREL\u00c9SEK, J\u00c1RM\u0170VEK": {
+ "account_number": 14,
+ "root_type": "Asset",
+ "is_group": 1,
+ "Egy\u00e9b (\u00fczemi \u00fczleti), berendez\u00e9sek, felszerel\u00e9sek": {
+ "account_number": 141,
+ "root_type": "Asset",
+ "is_group": 1,
+ "Egy\u00e9b (\u00fczemi \u00fczleti), berendez\u00e9sek, felszerel\u00e9sek brutt\u00f3 \u00e9rt\u00e9ke": {
+ "account_number": 1411,
+ "root_type": "Asset"
+ },
+ "Egy\u00e9b (\u00fczemi \u00fczleti), berendez\u00e9sek, felszerel\u00e9sek terven fel\u00fcli \u00e9rt\u00e9kcs\u00f6kken\u00e9se \u00e9s annak vissza\u00edr\u00e1sa": {
+ "account_number": 1418,
+ "root_type": "Asset"
+ },
+ "Egy\u00e9b (\u00fczemi \u00fczleti), berendez\u00e9sek, felszerel\u00e9sek terv szerinti \u00e9rt\u00e9kcs\u00f6kken\u00e9se": {
+ "account_number": 1419,
+ "root_type": "Asset"
+ }
+ },
+ "Egy\u00e9b j\u00e1rm\u0171vek": {
+ "account_number": 142,
+ "root_type": "Asset",
+ "is_group": 1,
+ "Egy\u00e9b j\u00e1rm\u0171vek brutt\u00f3 \u00e9rt\u00e9ke": {
+ "account_number": 1421,
+ "root_type": "Asset"
+ },
+ "Egy\u00e9b j\u00e1rm\u0171vek terven fel\u00fcli \u00e9rt\u00e9kcs\u00f6kken\u00e9se \u00e9s annak vissza\u00edr\u00e1sa": {
+ "account_number": 1428,
+ "root_type": "Asset"
+ },
+ "Egy\u00e9b j\u00e1rm\u0171vek terv szerinti \u00e9rt\u00e9kcs\u00f6kken\u00e9se": {
+ "account_number": 1429,
+ "root_type": "Asset"
+ }
+ },
+ "Irodai, igazgat\u00e1si berendez\u00e9sek \u00e9s felszerel\u00e9sek": {
+ "account_number": 143,
+ "root_type": "Asset",
+ "is_group": 1,
+ "Irodai, igazgat\u00e1si berendez\u00e9sek \u00e9s felszerel\u00e9sek brutt\u00f3 \u00e9rt\u00e9ke": {
+ "account_number": 1431,
+ "root_type": "Asset"
+ },
+ "Irodai, igazgat\u00e1si berendez\u00e9sek \u00e9s felszerel\u00e9sek terven fel\u00fcli \u00e9rt\u00e9kcs\u00f6kken\u00e9se \u00e9s annak vissza\u00edr\u00e1sa": {
+ "account_number": 1438,
+ "root_type": "Asset"
+ },
+ "Irodai, igazgat\u00e1si berendez\u00e9sek \u00e9s felszerel\u00e9sek terv szerinti \u00e9rt\u00e9kcs\u00f6kken\u00e9se": {
+ "account_number": 1439,
+ "root_type": "Asset"
+ }
+ },
+ "Ki nem emelt egy\u00e9b berendez\u00e9sek, felszerel\u00e9sek": {
+ "account_number": 144,
+ "root_type": "Asset",
+ "is_group": 1,
+ "Ki nem emelt egy\u00e9b berendez\u00e9sek, felszerel\u00e9sek brutt\u00f3 \u00e9rt\u00e9ke": {
+ "account_number": 1441,
+ "root_type": "Asset"
+ },
+ "Ki nem emelt egy\u00e9b berendez\u00e9sek, felszerel\u00e9sek terven fel\u00fcli \u00e9rt\u00e9kcs\u00f6kken\u00e9se \u00e9s annak vissza\u00edr\u00e1sa": {
+ "account_number": 1448,
+ "root_type": "Asset"
+ },
+ "Ki nem emelt egy\u00e9b berendez\u00e9sek, felszerel\u00e9sek terv szerinti \u00e9rt\u00e9kcs\u00f6kken\u00e9se": {
+ "account_number": 1449,
+ "root_type": "Asset"
+ }
+ },
+ "Kis \u00e9rt\u00e9k\u0171 egy\u00e9b berendez\u00e9sek, felszerel\u00e9sek, j\u00e1rm\u0171vek": {
+ "account_number": 149,
+ "root_type": "Asset",
+ "is_group": 1,
+ "Kis \u00e9rt\u00e9k\u0171 egy\u00e9b berendez\u00e9sek, felszerel\u00e9sek, j\u00e1rm\u0171vek brutt\u00f3 \u00e9rt\u00e9ke": {
+ "account_number": 1491,
+ "root_type": "Asset"
+ },
+ "Kis \u00e9rt\u00e9k\u0171 egy\u00e9b berendez\u00e9sek, felszerel\u00e9sek, j\u00e1rm\u0171vek terv szerinti \u00e9rt\u00e9kcs\u00f6kken\u00e9se": {
+ "account_number": 1499,
+ "root_type": "Asset"
+ }
+ }
+ },
+ "TENY\u00c9SZ\u00c1LLATOK": {
+ "account_number": 15,
+ "root_type": "Asset",
+ "is_group": 1,
+ "Teny\u00e9szt\u00e9sben hasznos\u00edtott \u00e1llatok": {
+ "account_number": 151,
+ "root_type": "Asset",
+ "is_group": 1,
+ "Teny\u00e9szt\u00e9sben hasznos\u00edtott \u00e1llatok brutt\u00f3 \u00e9rt\u00e9ke": {
+ "account_number": 1511,
+ "root_type": "Asset"
+ },
+ "Teny\u00e9szt\u00e9sben hasznos\u00edtott \u00e1llatok terven fel\u00fcli \u00e9rt\u00e9kcs\u00f6kken\u00e9se \u00e9s annak vissza\u00edr\u00e1sa": {
+ "account_number": 1518,
+ "root_type": "Asset"
+ },
+ "Teny\u00e9szt\u00e9sben hasznos\u00edtott \u00e1llatok terv szerinti \u00e9rt\u00e9kcs\u00f6kken\u00e9se": {
+ "account_number": 1519,
+ "root_type": "Asset"
+ }
+ },
+ "Ig\u00e1s\u00e1llatok": {
+ "account_number": 152,
+ "root_type": "Asset",
+ "is_group": 1,
+ "Ig\u00e1s\u00e1llatok brutt\u00f3 \u00e9rt\u00e9ke": {
+ "account_number": 1521,
+ "root_type": "Asset"
+ },
+ "Ig\u00e1s\u00e1llatok terven fel\u00fcli \u00e9rt\u00e9kcs\u00f6kken\u00e9se \u00e9s annak vissza\u00edr\u00e1sa": {
+ "account_number": 1528,
+ "root_type": "Asset"
+ },
+ "Ig\u00e1s\u00e1llatok terv szerinti \u00e9rt\u00e9kcs\u00f6kken\u00e9se": {
+ "account_number": 1529,
+ "root_type": "Asset"
+ }
+ },
+ "Egy\u00e9b teny\u00e9sz\u00e1llatok": {
+ "account_number": 153,
+ "root_type": "Asset",
+ "is_group": 1,
+ "Egy\u00e9b teny\u00e9sz\u00e1llatok brutt\u00f3 \u00e9rt\u00e9ke": {
+ "account_number": 1531,
+ "root_type": "Asset"
+ },
+ "Egy\u00e9b teny\u00e9sz\u00e1llatok terven fel\u00fcli \u00e9rt\u00e9kcs\u00f6kken\u00e9se \u00e9s annak vissza\u00edr\u00e1sa": {
+ "account_number": 1538,
+ "root_type": "Asset"
+ },
+ "Egy\u00e9b teny\u00e9sz\u00e1llatok terv szerinti \u00e9rt\u00e9kcs\u00f6kken\u00e9se": {
+ "account_number": 1539,
+ "root_type": "Asset"
+ }
+ },
+ "Kis \u00e9rt\u00e9k\u0171 teny\u00e9sz\u00e1llatok": {
+ "account_number": 159,
+ "root_type": "Asset",
+ "is_group": 1,
+ "Kis \u00e9rt\u00e9k\u0171 teny\u00e9sz\u00e1llatok brutt\u00f3 \u00e9rt\u00e9ke": {
+ "account_number": 1591,
+ "root_type": "Asset"
+ },
+ "Kis \u00e9rt\u00e9k\u0171 teny\u00e9sz\u00e1llatok terv szerinti \u00e9rt\u00e9kcs\u00f6kken\u00e9se": {
+ "account_number": 1599,
+ "root_type": "Asset"
+ }
+ }
+ },
+ "BERUH\u00c1Z\u00c1SOK, FEL\u00daJ\u00cdT\u00c1SOK": {
+ "account_number": 16,
+ "root_type": "Asset",
+ "is_group": 1,
+ "Beruh\u00e1z\u00e1sok": {
+ "account_number": 161,
+ "root_type": "Asset"
+ },
+ "Fel\u00faj\u00edt\u00e1sok": {
+ "account_number": 162,
+ "root_type": "Asset"
+ },
+ "Beruh\u00e1z\u00e1sok, fel\u00faj\u00edt\u00e1sok terven fel\u00fcli \u00e9rt\u00e9kcs\u00f6kken\u00e9se \u00e9s annak vissza\u00edr\u00e1sa": {
+ "account_number": 168,
+ "root_type": "Asset"
+ }
+ },
+ "TULAJDONI R\u00c9SZESED\u00c9ST JELENT\u0150 BEFEKTET\u00c9SEK (R\u00c9SZESED\u00c9SEK)": {
+ "account_number": 17,
+ "root_type": "Asset",
+ "is_group": 1,
+ "Tart\u00f3s r\u00e9szesed\u00e9sek": {
+ "account_number": 171,
+ "root_type": "Asset"
+ },
+ "R\u00e9szesed\u00e9sek \u00e9rt\u00e9kveszt\u00e9se \u00e9s annak vissza\u00edr\u00e1sa": {
+ "account_number": 179,
+ "root_type": "Asset"
+ }
+ },
+ "HITELVISZONYT MEGTESTES\u00cdT\u0150 \u00c9RT\u00c9KPAP\u00cdROK": {
+ "account_number": 18,
+ "root_type": "Asset",
+ "is_group": 1,
+ "\u00c1llamk\u00f6tv\u00e9nyek": {
+ "account_number": 181,
+ "root_type": "Asset"
+ },
+ "Tart\u00f3s diszkont \u00e9rt\u00e9kpap\u00edrok": {
+ "account_number": 182,
+ "root_type": "Asset"
+ },
+ "V\u00e1llalkoz\u00e1sok \u00e1ltal kibocs\u00e1tott tart\u00f3s \u00e9rt\u00e9kpap\u00edrok": {
+ "account_number": 183,
+ "root_type": "Asset"
+ },
+ "Egy\u00e9b hitelviszonyt megtestes\u00edt\u0151 \u00e9rt\u00e9kpap\u00edrok": {
+ "account_number": 184,
+ "root_type": "Asset"
+ },
+ "Tart\u00f3s \u00e9rt\u00e9kpap\u00edrok \u00e9rt\u00e9kveszt\u00e9se \u00e9s annak vissza\u00edr\u00e1sa": {
+ "account_number": 189,
+ "root_type": "Asset"
+ }
+ },
+ "TART\u00d3SAN ADOTT K\u00d6LCS\u00d6N\u00d6K (tart\u00f3s bankbet\u00e9tek)": {
+ "account_number": 19,
+ "root_type": "Asset",
+ "is_group": 1,
+ "Tart\u00f3san adott k\u00f6lcs\u00f6n\u00f6k": {
+ "account_number": 191,
+ "root_type": "Asset"
+ },
+ "Tart\u00f3s bankbet\u00e9tek": {
+ "account_number": 192,
+ "root_type": "Asset"
+ },
+ "Tart\u00f3san adott k\u00f6lcs\u00f6n\u00f6k (\u00e9s bankbet\u00e9tek) \u00e9rt\u00e9kveszt\u00e9se \u00e9s annak vissza\u00edr\u00e1sa": {
+ "account_number": 199,
+ "root_type": "Asset"
+ }
+ }
+ },
+ "SZ\u00c1MLAOSZT\u00c1LY K\u00c9SZLETEK": {
+ "account_number": 2,
+ "root_type": "Asset",
+ "is_group": 1,
+ "ANYAGOK": {
+ "account_number": "21-22",
+ "root_type": "Asset",
+ "is_group": 1,
+ "Nyers \u00e9s alapanyagok": {
+ "account_number": 211,
+ "root_type": "Asset"
+ },
+ "Seg\u00e9danyagok": {
+ "account_number": 221,
+ "root_type": "Asset"
+ },
+ "\u00dczem \u00e9s f\u0171t\u0151anyagok": {
+ "account_number": 222,
+ "root_type": "Asset"
+ },
+ "Fenntart\u00e1si anyagok": {
+ "account_number": 223,
+ "root_type": "Asset"
+ },
+ "\u00c9p\u00edt\u00e9si anyagok": {
+ "account_number": 224,
+ "root_type": "Asset"
+ },
+ "Egy \u00e9ven bel\u00fcl elhaszn\u00e1l\u00f3d\u00f3 anyagi eszk\u00f6z\u00f6k": {
+ "account_number": 225,
+ "root_type": "Asset"
+ },
+ "T\u00e1rgyi eszk\u00f6z\u00f6k k\u00f6z\u00fcl \u00e1tsorolt anyagok": {
+ "account_number": 226,
+ "root_type": "Asset"
+ },
+ "Egy\u00e9b anyagok": {
+ "account_number": 227,
+ "root_type": "Asset"
+ },
+ "Anyagok \u00e9rt\u00e9kveszt\u00e9se \u00e9s annak vissza\u00edr\u00e1sa": {
+ "account_number": 229,
+ "root_type": "Asset"
+ }
+ },
+ "BEFEJEZETLEN TERMEL\u00c9S \u00c9S F\u00c9LK\u00c9SZ TERM\u00c9KEK": {
+ "account_number": 23,
+ "root_type": "Asset",
+ "is_group": 1,
+ "Befejezetlen termel\u00e9s": {
+ "account_number": 231,
+ "root_type": "Asset"
+ },
+ "F\u00e9lk\u00e9sz term\u00e9kek": {
+ "account_number": 232,
+ "root_type": "Asset"
+ },
+ "Befejezetlen termel\u00e9s \u00e9s f\u00e9lk\u00e9sz term\u00e9kek \u00e9rt\u00e9kveszt\u00e9se \u00e9s annak vissza\u00edr\u00e1sa": {
+ "account_number": 239,
+ "root_type": "Asset"
+ }
+ },
+ "N\u00d6VEND\u00c9K, H\u00cdZ\u00d3 \u00c9S EGY\u00c9B \u00c1LLATOK": {
+ "account_number": 24,
+ "root_type": "Asset",
+ "is_group": 1,
+ "N\u00f6vend\u00e9k\u00e1llatok": {
+ "account_number": 241,
+ "root_type": "Asset"
+ },
+ "H\u00edz\u00f3\u00e1llatok": {
+ "account_number": 242,
+ "root_type": "Asset"
+ },
+ "Egy\u00e9b \u00e1llatok": {
+ "account_number": 243,
+ "root_type": "Asset"
+ },
+ "B\u00e9rbevett \u00e1llatok": {
+ "account_number": 244,
+ "root_type": "Asset"
+ },
+ "\u00c1llatok \u00e9rt\u00e9kveszt\u00e9se \u00e9s annak vissza\u00edr\u00e1sa": {
+ "account_number": 249,
+ "root_type": "Asset"
+ }
+ },
+ "K\u00c9SZTERM\u00c9KEK": {
+ "account_number": 25,
+ "root_type": "Asset",
+ "is_group": 1,
+ "K\u00e9szterm\u00e9kek": {
+ "account_number": 251,
+ "root_type": "Asset"
+ },
+ "K\u00e9szterm\u00e9kek \u00e9rt\u00e9kveszt\u00e9se \u00e9s annak vissza\u00edr\u00e1sa": {
+ "account_number": 259,
+ "root_type": "Asset"
+ }
+ },
+ "KERESKEDELMI \u00c1RUK": {
+ "account_number": 26,
+ "root_type": "Asset",
+ "is_group": 1,
+ "Kereskedelmi \u00e1ruk": {
+ "account_number": 261,
+ "root_type": "Asset"
+ },
+ "Idegen helyen t\u00e1rolt, bizom\u00e1nyba \u00e1tadott \u00e1ruk": {
+ "account_number": 262,
+ "root_type": "Asset"
+ },
+ "T\u00e1rgyi eszk\u00f6z\u00f6k k\u00f6z\u00fcl \u00e1tsorolt \u00e1ruk": {
+ "account_number": 263,
+ "root_type": "Asset"
+ },
+ "Bels\u0151 (egys\u00e9gek, tev\u00e9kenys\u00e9gek k\u00f6z\u00f6tti) \u00e1tad\u00e1s\u00e1tv\u00e9tel \u00fctk\u00f6z\u0151sz\u00e1mla": {
+ "account_number": 264,
+ "root_type": "Asset"
+ },
+ "Kereskedelmi \u00e1ruk \u00e9rt\u00e9kveszt\u00e9se \u00e9s annak vissza\u00edr\u00e1sa": {
+ "account_number": 269,
+ "root_type": "Asset"
+ }
+ },
+ "K\u00d6ZVET\u00cdTETT SZOLG\u00c1LTAT\u00c1SOK": {
+ "account_number": 27,
+ "root_type": "Asset",
+ "is_group": 1,
+ "K\u00f6zvet\u00edtett szolg\u00e1ltat\u00e1sok": {
+ "account_number": 271,
+ "root_type": "Asset"
+ },
+ "K\u00f6zvet\u00edtett szolg\u00e1ltat\u00e1sok \u00e9rt\u00e9kveszt\u00e9se \u00e9s annak vissza\u00edr\u00e1sa": {
+ "account_number": 279,
+ "root_type": "Asset"
+ }
+ },
+ "BET\u00c9TD\u00cdJAS G\u00d6NGY\u00d6LEGEK": {
+ "account_number": 28,
+ "root_type": "Asset",
+ "is_group": 1,
+ "Bet\u00e9td\u00edjas g\u00f6ngy\u00f6legek": {
+ "account_number": 281,
+ "root_type": "Asset"
+ },
+ "Bet\u00e9td\u00edjas g\u00f6ngy\u00f6legek \u00e9rt\u00e9kveszt\u00e9se \u00e9s annak vissza\u00edr\u00e1sa": {
+ "account_number": 289,
+ "root_type": "Asset"
+ }
+ }
+ },
+ "SZ\u00c1MLAOSZT\u00c1LY K\u00d6VETEL\u00c9SEK, P\u00c9NZ\u00dcGYI ESZK\u00d6Z\u00d6K \u00c9S AKT\u00cdV ID\u0150BELI ELHAT\u00c1ROL\u00c1SOK": {
+ "account_number": 3,
+ "root_type": "Asset",
+ "is_group": 1,
+ "K\u00d6VETEL\u00c9SEK \u00c1RUSZ\u00c1LL\u00cdT\u00c1SB\u00d3L \u00c9S SZOLG\u00c1LTAT\u00c1SB\u00d3L (VEV\u0150K)": {
+ "account_number": 31,
+ "root_type": "Asset",
+ "is_group": 1,
+ "Vev\u0151k\u00f6vetel\u00e9sek": {
+ "account_number": 311,
+ "root_type": "Asset"
+ },
+ "Vev\u0151k\u00f6vetel\u00e9sek \u00e9rt\u00e9kveszt\u00e9se": {
+ "account_number": 319,
+ "root_type": "Asset"
+ }
+ },
+ "K\u00d6VETEL\u00c9SEK TULAJDONOSSAL SZEMBEN": {
+ "account_number": 33,
+ "root_type": "Asset",
+ "is_group": 1,
+ "Jegyzett, de m\u00e9g be nem fizetett t\u0151ke": {
+ "account_number": 331,
+ "root_type": "Asset"
+ }
+ },
+ "V\u00c1LT\u00d3K\u00d6VETEL\u00c9SEK": {
+ "account_number": 34,
+ "root_type": "Asset",
+ "is_group": 1,
+ "V\u00e1lt\u00f3k\u00f6vetel\u00e9sek": {
+ "account_number": 341,
+ "root_type": "Asset"
+ },
+ "V\u00e1lt\u00f3k\u00f6vetel\u00e9sek \u00e9rt\u00e9kveszt\u00e9se": {
+ "account_number": 349,
+ "root_type": "Asset"
+ }
+ },
+ "ADOTT EL\u0150LEGEK": {
+ "account_number": 35,
+ "root_type": "Asset",
+ "is_group": 1,
+ "Immateri\u00e1lis javakra adott el\u0151legek": {
+ "account_number": 351,
+ "root_type": "Asset"
+ },
+ "Beruh\u00e1z\u00e1sokra adott el\u0151legek": {
+ "account_number": 352,
+ "root_type": "Asset"
+ },
+ "K\u00e9szletekre adott el\u0151legek": {
+ "account_number": 353,
+ "root_type": "Asset"
+ },
+ "Egy\u00e9b c\u00e9lra adott el\u0151legek": {
+ "account_number": 354,
+ "root_type": "Asset"
+ },
+ "Adott el\u0151legek \u00e9rt\u00e9kveszt\u00e9se": {
+ "account_number": 359,
+ "root_type": "Asset"
+ }
+ },
+ "EGY\u00c9B K\u00d6VETEL\u00c9SEK": {
+ "account_number": 36,
+ "root_type": "Asset",
+ "is_group": 1,
+ "Munkav\u00e1llal\u00f3kkal szembeni k\u00f6vetel\u00e9sek": {
+ "account_number": 361,
+ "root_type": "Asset"
+ },
+ "K\u00f6lts\u00e9gvet\u00e9ssel szembeni k\u00f6vetel\u00e9sek": {
+ "account_number": 362,
+ "root_type": "Asset"
+ },
+ "R\u00f6vid lej\u00e1ratra k\u00f6lcs\u00f6nadott p\u00e9nzeszk\u00f6z\u00f6k": {
+ "account_number": 363,
+ "root_type": "Asset"
+ },
+ "R\u00e9szesed\u00e9sekkel, \u00e9rt\u00e9kpap\u00edrokkal kapcsolatos k\u00f6vetel\u00e9sek": {
+ "account_number": 364,
+ "root_type": "Asset"
+ },
+ "K\u00fcl\u00f6nf\u00e9le egy\u00e9b k\u00f6vetel\u00e9sek": {
+ "account_number": 365,
+ "root_type": "Asset"
+ },
+ "Egy\u00e9b k\u00f6vetel\u00e9sek \u00e9rt\u00e9kveszt\u00e9se": {
+ "account_number": 369,
+ "root_type": "Asset"
+ }
+ },
+ "\u00c9RT\u00c9KPAP\u00cdROK": {
+ "account_number": 37,
+ "root_type": "Asset",
+ "is_group": 1,
+ "R\u00e9szesed\u00e9sek": {
+ "account_number": 371,
+ "root_type": "Asset"
+ },
+ "Saj\u00e1t r\u00e9szv\u00e9nyek, saj\u00e1t \u00fczletr\u00e9szek": {
+ "account_number": 372,
+ "root_type": "Asset"
+ },
+ "Forgat\u00e1si c\u00e9l\u00fa hitelviszonyt megtestes\u00edt\u0151 \u00e9rt\u00e9kpap\u00edrok": {
+ "account_number": 373,
+ "root_type": "Asset"
+ },
+ "\u00c9rt\u00e9kpap\u00edr elsz\u00e1mol\u00e1si sz\u00e1mla": {
+ "account_number": 378,
+ "root_type": "Asset"
+ },
+ "\u00c9rt\u00e9kpap\u00edrok \u00e9rt\u00e9kveszt\u00e9se": {
+ "account_number": 379,
+ "root_type": "Asset"
+ }
+ },
+ "P\u00c9NZESZK\u00d6Z\u00d6K": {
+ "account_number": 38,
+ "root_type": "Asset",
+ "is_group": 1,
+ "P\u00e9nzt\u00e1r": {
+ "account_number": 381,
+ "root_type": "Asset"
+ },
+ "Valutap\u00e9nzt\u00e1r": {
+ "account_number": 382,
+ "root_type": "Asset"
+ },
+ "Csekkek": {
+ "account_number": 383,
+ "root_type": "Asset"
+ },
+ "Elsz\u00e1mol\u00e1si bet\u00e9tsz\u00e1mla": {
+ "account_number": 384,
+ "root_type": "Asset"
+ },
+ "Elk\u00fcl\u00f6n\u00edtett bet\u00e9tsz\u00e1mla": {
+ "account_number": 385,
+ "root_type": "Asset"
+ },
+ "Devizabet\u00e9tsz\u00e1mla": {
+ "account_number": 386,
+ "root_type": "Asset"
+ },
+ "Elektronikus p\u00e9nz": {
+ "account_number": 387,
+ "root_type": "Asset"
+ },
+ "\u00c1tvezet\u00e9si sz\u00e1mla": {
+ "account_number": 389,
+ "root_type": "Asset"
+ }
+ },
+ "AKT\u00cdV ID\u0150BELI ELHAT\u00c1ROL\u00c1SOK": {
+ "account_number": 39,
+ "root_type": "Asset",
+ "is_group": 1,
+ "Akt\u00edv id\u0151beli elhat\u00e1rol\u00e1sok": {
+ "account_number": 391,
+ "root_type": "Asset"
+ }
+ }
+ },
+ "SZ\u00c1MLAOSZT\u00c1LY FORR\u00c1SOK": {
+ "account_number": 4,
+ "root_type": "Liability",
+ "is_group": 1,
+ "SAJ\u00c1T T\u0150KE": {
+ "account_number": 41,
+ "root_type": "Liability",
+ "is_group": 1,
+ "account_type": "Equity",
+ "Jegyzett t\u0151ke": {
+ "account_number": 411,
+ "root_type": "Liability",
+ "account_type": "Equity"
+ },
+ "T\u0151ketartal\u00e9k": {
+ "account_number": 412,
+ "root_type": "Liability",
+ "account_type": "Equity"
+ },
+ "Eredm\u00e9nytartal\u00e9k": {
+ "account_number": 413,
+ "root_type": "Liability",
+ "account_type": "Equity"
+ },
+ "Lek\u00f6t\u00f6tt tartal\u00e9k": {
+ "account_number": 414,
+ "root_type": "Liability",
+ "account_type": "Equity"
+ },
+ "Ad\u00f3zott eredm\u00e9ny": {
+ "account_number": 419,
+ "root_type": "Liability",
+ "account_type": "Equity"
+ }
+ },
+ "C\u00c9LTARTAL\u00c9KOK": {
+ "account_number": 42,
+ "root_type": "Liability",
+ "is_group": 1,
+ "C\u00e9ltartal\u00e9k a v\u00e1rhat\u00f3 k\u00f6telezetts\u00e9gekre": {
+ "account_number": 421,
+ "root_type": "Liability"
+ }
+ },
+ "H\u00c1TRASOROLT K\u00d6TELEZETTS\u00c9GEK": {
+ "account_number": 43,
+ "root_type": "Liability",
+ "is_group": 1,
+ "H\u00e1trasorolt k\u00f6telezetts\u00e9gek": {
+ "account_number": 431,
+ "root_type": "Liability"
+ }
+ },
+ "HOSSZ\u00da LEJ\u00c1RAT\u00da K\u00d6TELEZETTS\u00c9GEK": {
+ "account_number": 44,
+ "root_type": "Liability",
+ "is_group": 1,
+ "Hossz\u00fa lej\u00e1ratra kapott k\u00f6lcs\u00f6n\u00f6k": {
+ "account_number": 441,
+ "root_type": "Liability"
+ },
+ "\u00c1tv\u00e1ltoztathat\u00f3 k\u00f6tv\u00e9nyek": {
+ "account_number": 442,
+ "root_type": "Liability"
+ },
+ "Tartoz\u00e1sok k\u00f6tv\u00e9nykibocs\u00e1t\u00e1sb\u00f3l": {
+ "account_number": 443,
+ "root_type": "Liability"
+ },
+ "Beruh\u00e1z\u00e1si \u00e9s fejleszt\u00e9si hitelek": {
+ "account_number": 444,
+ "root_type": "Liability"
+ },
+ "Egy\u00e9b hossz\u00fa lej\u00e1rat\u00fa hitelek": {
+ "account_number": 445,
+ "root_type": "Liability"
+ },
+ "P\u00e9nz\u00fcgyi l\u00edzing miatti k\u00f6telezetts\u00e9gek": {
+ "account_number": 446,
+ "root_type": "Liability"
+ },
+ "Egy\u00e9b hossz\u00fa lej\u00e1rat\u00fa k\u00f6telezetts\u00e9gek": {
+ "account_number": 449,
+ "root_type": "Liability"
+ }
+ },
+ "R\u00d6VID LEJ\u00c1RAT\u00da K\u00d6TELEZETTS\u00c9GEK": {
+ "account_number": "45-47",
+ "root_type": "Liability",
+ "is_group": 1,
+ "R\u00f6vid lej\u00e1rat\u00fa k\u00f6lcs\u00f6n\u00f6k": {
+ "account_number": 451,
+ "root_type": "Liability"
+ },
+ "R\u00f6vid lej\u00e1rat\u00fa hitelek": {
+ "account_number": 452,
+ "root_type": "Liability"
+ },
+ "Vev\u0151kt\u0151l kapott el\u0151legek": {
+ "account_number": 453,
+ "root_type": "Liability"
+ },
+ "K\u00f6telezetts\u00e9gek \u00e1rusz\u00e1ll\u00edt\u00e1sb\u00f3l \u00e9s szolg\u00e1ltat\u00e1sb\u00f3l (sz\u00e1ll\u00edt\u00f3k)": {
+ "account_number": 454,
+ "root_type": "Liability"
+ },
+ "Beruh\u00e1z\u00e1si sz\u00e1ll\u00edt\u00f3k": {
+ "account_number": 455,
+ "root_type": "Liability"
+ },
+ "Nem sz\u00e1ml\u00e1zott sz\u00e1ll\u00edt\u00f3k": {
+ "account_number": 456,
+ "root_type": "Liability"
+ },
+ "V\u00e1lt\u00f3tartoz\u00e1sok": {
+ "account_number": 457,
+ "root_type": "Liability"
+ },
+ "Eredm\u00e9nyt terhel\u0151 ad\u00f3k elsz\u00e1mol\u00e1sa": {
+ "account_number": 461,
+ "root_type": "Liability"
+ },
+ "Szem\u00e9lyi j\u00f6vedelemad\u00f3 (SZJA) elsz\u00e1mol\u00e1sa": {
+ "account_number": 462,
+ "root_type": "Liability"
+ },
+ "J\u00f6ved\u00e9ki ad\u00f3 elsz\u00e1mol\u00e1sa": {
+ "account_number": 463,
+ "root_type": "Liability"
+ },
+ "G\u00e9pj\u00e1rm\u0171 ad\u00f3 (c\u00e9gaut\u00f3ad\u00f3) elsz\u00e1mol\u00e1sa": {
+ "account_number": 464,
+ "root_type": "Liability"
+ },
+ "V\u00e1melsz\u00e1mol\u00e1si sz\u00e1mla": {
+ "account_number": 465,
+ "root_type": "Liability"
+ },
+ "El\u0151zetesen felsz\u00e1m\u00edtott \u00e1ltal\u00e1nos forgalmi ad\u00f3": {
+ "account_number": 466,
+ "root_type": "Liability"
+ },
+ "Fizetend\u0151 \u00e1ltal\u00e1nos forgalmi ad\u00f3": {
+ "account_number": 467,
+ "root_type": "Liability"
+ },
+ "\u00c1ltal\u00e1nos forgalmi ad\u00f3 elsz\u00e1mol\u00e1si sz\u00e1mla": {
+ "account_number": 468,
+ "root_type": "Liability"
+ },
+ "Helyi ad\u00f3k elsz\u00e1mol\u00e1si sz\u00e1mla": {
+ "account_number": 469,
+ "root_type": "Liability"
+ },
+ "J\u00f6vedelemelsz\u00e1mol\u00e1si sz\u00e1mla": {
+ "account_number": 471,
+ "root_type": "Liability"
+ },
+ "Fel nem vett j\u00e1rand\u00f3s\u00e1gok": {
+ "account_number": 472,
+ "root_type": "Liability"
+ },
+ "Szoci\u00e1lis hozz\u00e1j\u00e1rul\u00e1si ad\u00f3": {
+ "account_number": 473,
+ "root_type": "Liability"
+ },
+ "Szakk\u00e9pz\u00e9si hozz\u00e1j\u00e1rul\u00e1s": {
+ "account_number": 474,
+ "root_type": "Liability"
+ },
+ "Egy\u00e9b \u00e1llami ad\u00f3hat\u00f3s\u00e1ggal szembeni k\u00f6telezetts\u00e9g elsz\u00e1mol\u00e1sa": {
+ "account_number": 476,
+ "root_type": "Liability"
+ },
+ "R\u00f6vid lej\u00e1rat\u00fa egy\u00e9b k\u00f6telezetts\u00e9gek munkav\u00e1llal\u00f3kkal \u00e9s tulajdonosokkal szemben": {
+ "account_number": 477,
+ "root_type": "Liability"
+ },
+ "R\u00e9szesed\u00e9sekkel, \u00e9rt\u00e9kpap\u00edrokkal kapcsolatos k\u00f6telezetts\u00e9gek": {
+ "account_number": 478,
+ "root_type": "Liability"
+ },
+ "K\u00fcl\u00f6nf\u00e9le egy\u00e9b r\u00f6vid lej\u00e1rat\u00fa k\u00f6telezetts\u00e9gek": {
+ "account_number": 479,
+ "root_type": "Liability"
+ }
+ },
+ "PASSZ\u00cdV ID\u0150BELI ELHAT\u00c1ROL\u00c1SOK": {
+ "account_number": 48,
+ "root_type": "Liability",
+ "is_group": 1,
+ "Passz\u00edv id\u0151beli elhat\u00e1rol\u00e1sok": {
+ "account_number": 481,
+ "root_type": "Liability"
+ }
+ },
+ "\u00c9VI M\u00c9RLEGSZ\u00c1ML\u00c1K": {
+ "account_number": 49,
+ "root_type": "Liability",
+ "is_group": 1,
+ "Nyit\u00f3m\u00e9rleg sz\u00e1mla": {
+ "account_number": 491,
+ "root_type": "Liability"
+ },
+ "Z\u00e1r\u00f3m\u00e9rleg sz\u00e1mla": {
+ "account_number": 492,
+ "root_type": "Liability"
+ },
+ "Ad\u00f3zott eredm\u00e9ny elsz\u00e1mol\u00e1si sz\u00e1mla": {
+ "account_number": 493,
+ "root_type": "Liability"
+ }
+ }
+ },
+ "SZ\u00c1MLAOSZT\u00c1LY K\u00d6LTS\u00c9GNEMEK": {
+ "account_number": 5,
+ "root_type": "Expense",
+ "is_group": 1,
+ "ANYAGK\u00d6LTS\u00c9G": {
+ "account_number": 51,
+ "root_type": "Expense",
+ "is_group": 1,
+ "Alapanyagok k\u00f6lts\u00e9gei": {
+ "account_number": 511,
+ "root_type": "Expense"
+ },
+ "Egy \u00e9ven bel\u00fcl elhaszn\u00e1l\u00f3d\u00f3 anyagi eszk\u00f6z\u00f6k k\u00f6lts\u00e9gei": {
+ "account_number": 512,
+ "root_type": "Expense"
+ },
+ "Egy\u00e9b anyagk\u00f6lts\u00e9g": {
+ "account_number": 513,
+ "root_type": "Expense"
+ },
+ "Anyagk\u00f6lts\u00e9g megt\u00e9r\u00fcl\u00e9s": {
+ "account_number": 519,
+ "root_type": "Expense"
+ }
+ },
+ "IG\u00c9NYBE VETT SZOLG\u00c1LTAT\u00c1SOK K\u00d6LTS\u00c9GEI": {
+ "account_number": 52,
+ "root_type": "Expense",
+ "is_group": 1,
+ "Sz\u00e1ll\u00edt\u00e1srakod\u00e1s, rakt\u00e1roz\u00e1s k\u00f6lts\u00e9gei": {
+ "account_number": 521,
+ "root_type": "Expense"
+ },
+ "B\u00e9rleti d\u00edjak": {
+ "account_number": 522,
+ "root_type": "Expense"
+ },
+ "Karbantart\u00e1si k\u00f6lts\u00e9gek": {
+ "account_number": 523,
+ "root_type": "Expense"
+ },
+ "Hirdet\u00e9s, rekl\u00e1m, propaganda k\u00f6lts\u00e9gek": {
+ "account_number": 524,
+ "root_type": "Expense"
+ },
+ "Oktat\u00e1s \u00e9s tov\u00e1bbk\u00e9pz\u00e9s k\u00f6lts\u00e9gei": {
+ "account_number": 525,
+ "root_type": "Expense"
+ },
+ "Utaz\u00e1si \u00e9s kik\u00fcldet\u00e9si k\u00f6lts\u00e9gek (napid\u00edj n\u00e9lk\u00fcl)": {
+ "account_number": 526,
+ "root_type": "Expense"
+ },
+ "Ig\u00e9nybe vett egy\u00e9b szolg\u00e1ltat\u00e1sok k\u00f6lts\u00e9gei": {
+ "account_number": 529,
+ "root_type": "Expense"
+ }
+ },
+ "EGY\u00c9B SZOLG\u00c1LTAT\u00c1SOK K\u00d6LTS\u00c9GEI": {
+ "account_number": 53,
+ "root_type": "Expense",
+ "is_group": 1,
+ "Hat\u00f3s\u00e1gi igazgat\u00e1si, szolg\u00e1ltat\u00e1si d\u00edjak, illet\u00e9kek": {
+ "account_number": 531,
+ "root_type": "Expense"
+ },
+ "P\u00e9nz\u00fcgyi, befektet\u00e9si szolg\u00e1ltat\u00e1si d\u00edjak": {
+ "account_number": 532,
+ "root_type": "Expense"
+ },
+ "Biztos\u00edt\u00e1si d\u00edjak": {
+ "account_number": 533,
+ "root_type": "Expense"
+ },
+ "K\u00f6lts\u00e9gk\u00e9nt elsz\u00e1moland\u00f3 ad\u00f3k, j\u00e1rul\u00e9kok, term\u00e9kd\u00edjak": {
+ "account_number": 534,
+ "root_type": "Expense"
+ },
+ "K\u00fcl\u00f6nf\u00e9le egy\u00e9b szolg\u00e1ltat\u00e1sok k\u00f6lts\u00e9gei": {
+ "account_number": 539,
+ "root_type": "Expense"
+ }
+ },
+ "B\u00c9RK\u00d6LTS\u00c9G": {
+ "account_number": 54,
+ "root_type": "Expense",
+ "is_group": 1,
+ "B\u00e9rk\u00f6lts\u00e9g": {
+ "account_number": 541,
+ "root_type": "Expense"
+ }
+ },
+ "SZEM\u00c9LYI JELLEG\u0170 EGY\u00c9B KIFIZET\u00c9SEK": {
+ "account_number": 55,
+ "root_type": "Expense",
+ "is_group": 1,
+ "Munkav\u00e1llal\u00f3knak, tagoknak fizetett szem\u00e9lyi jelleg\u0171 kifizet\u00e9sek": {
+ "account_number": 551,
+ "root_type": "Expense"
+ },
+ "J\u00f3l\u00e9ti \u00e9s kultur\u00e1lis k\u00f6lts\u00e9gek": {
+ "account_number": 552,
+ "root_type": "Expense"
+ },
+ "Reprezent\u00e1ci\u00f3s k\u00f6lts\u00e9gek": {
+ "account_number": 553,
+ "root_type": "Expense"
+ },
+ "Egy\u00e9b szem\u00e9lyi jelleg\u0171 kifizet\u00e9sek": {
+ "account_number": 559,
+ "root_type": "Expense"
+ }
+ },
+ "B\u00c9RJ\u00c1RUL\u00c9KOK": {
+ "account_number": 56,
+ "root_type": "Expense",
+ "is_group": 1,
+ "Szoci\u00e1lis hozz\u00e1j\u00e1rul\u00e1si ad\u00f3": {
+ "account_number": 561,
+ "root_type": "Expense"
+ },
+ "Szakk\u00e9pz\u00e9si hozz\u00e1j\u00e1rul\u00e1s": {
+ "account_number": 563,
+ "root_type": "Expense"
+ },
+ "Egy\u00e9b b\u00e9rj\u00e1rul\u00e9kok": {
+ "account_number": 569,
+ "root_type": "Expense"
+ }
+ },
+ "\u00c9RT\u00c9KCS\u00d6KKEN\u00c9SI LE\u00cdR\u00c1S": {
+ "account_number": 57,
+ "root_type": "Expense",
+ "is_group": 1,
+ "Terv szerinti \u00e9rt\u00e9kcs\u00f6kken\u00e9si le\u00edr\u00e1s": {
+ "account_number": 571,
+ "root_type": "Expense"
+ },
+ "Kis \u00e9rt\u00e9k\u0171 eszk\u00f6z\u00f6k egy \u00f6sszegben elsz\u00e1molt \u00e9rt\u00e9kcs\u00f6kken\u00e9si le\u00edr\u00e1sa": {
+ "account_number": 572,
+ "root_type": "Expense"
+ }
+ },
+ "AKTIV\u00c1LT SAJ\u00c1T TELJES\u00cdTM\u00c9NYEK \u00c9RT\u00c9KE": {
+ "account_number": 58,
+ "root_type": "Expense",
+ "is_group": 1,
+ "Saj\u00e1t termel\u00e9s\u0171 k\u00e9szletek \u00e1llom\u00e1nyv\u00e1ltoz\u00e1sa": {
+ "account_number": 581,
+ "root_type": "Expense"
+ },
+ "Saj\u00e1t el\u0151\u00e1ll\u00edt\u00e1s\u00fa eszk\u00f6z\u00f6k aktiv\u00e1lt \u00e9rt\u00e9ke": {
+ "account_number": 582,
+ "root_type": "Expense"
+ },
+ "Aktiv\u00e1lt saj\u00e1t teljes\u00edtm\u00e9nyek \u00e1tvezet\u00e9si sz\u00e1mla": {
+ "account_number": 589,
+ "root_type": "Expense"
+ }
+ },
+ "K\u00d6LTS\u00c9GNEMEK \u00c1TVEZET\u00c9SE": {
+ "account_number": 59,
+ "root_type": "Expense",
+ "is_group": 1,
+ "K\u00f6lts\u00e9gnemek \u00e1tvezet\u00e9si sz\u00e1mla": {
+ "account_number": 599,
+ "root_type": "Expense"
+ }
+ }
+ },
+ "SZ\u00c1MLAOSZT\u00c1LY R\u00c1FORD\u00cdT\u00c1SOK": {
+ "account_number": 8,
+ "root_type": "Expense",
+ "is_group": 1,
+ "ANYAGJELLEG\u0170 R\u00c1FORD\u00cdT\u00c1SOK": {
+ "account_number": 81,
+ "root_type": "Expense",
+ "is_group": 1,
+ "Anyagk\u00f6lts\u00e9g": {
+ "account_number": 811,
+ "root_type": "Expense"
+ },
+ "Ig\u00e9nybe vett szolg\u00e1ltat\u00e1sok \u00e9rt\u00e9ke": {
+ "account_number": 812,
+ "root_type": "Expense"
+ },
+ "Egy\u00e9b szolg\u00e1ltat\u00e1sok \u00e9rt\u00e9ke": {
+ "account_number": 813,
+ "root_type": "Expense"
+ },
+ "Eladott \u00e1ruk beszerz\u00e9si \u00e9rt\u00e9ke": {
+ "account_number": 814,
+ "root_type": "Expense"
+ },
+ "Eladott (k\u00f6zvet\u00edtett) szolg\u00e1ltat\u00e1sok \u00e9rt\u00e9ke": {
+ "account_number": 815,
+ "root_type": "Expense"
+ }
+ },
+ "SZEM\u00c9LYI JELLEG\u0170 R\u00c1FORD\u00cdT\u00c1SOK": {
+ "account_number": 82,
+ "root_type": "Expense",
+ "is_group": 1,
+ "B\u00e9rk\u00f6lts\u00e9g": {
+ "account_number": 821,
+ "root_type": "Expense"
+ },
+ "Szem\u00e9lyi jelleg\u0171 egy\u00e9b kifizet\u00e9sek": {
+ "account_number": 822,
+ "root_type": "Expense"
+ },
+ "B\u00e9rj\u00e1rul\u00e9kok": {
+ "account_number": 823,
+ "root_type": "Expense"
+ }
+ },
+ "\u00c9RT\u00c9KCS\u00d6KKEN\u00c9SI LE\u00cdR\u00c1S": {
+ "account_number": 83,
+ "root_type": "Expense",
+ "is_group": 1,
+ "\u00c9rt\u00e9kcs\u00f6kken\u00e9si le\u00edr\u00e1s": {
+ "account_number": 831,
+ "root_type": "Expense"
+ }
+ },
+ "EGY\u00c9B R\u00c1FORD\u00cdT\u00c1SOK": {
+ "account_number": 86,
+ "root_type": "Expense",
+ "is_group": 1,
+ "Egy\u00e9b r\u00e1ford\u00edt\u00e1snak min\u0151s\u00fcl\u0151 \u00e9rt\u00e9kes\u00edt\u00e9sek": {
+ "account_number": 861,
+ "root_type": "Expense",
+ "is_group": 1,
+ "\u00c9rt\u00e9kes\u00edtett immateri\u00e1lis javak, t\u00e1rgyi eszk\u00f6z\u00f6k k\u00f6nyv szerinti \u00e9rt\u00e9ke": {
+ "account_number": 8611,
+ "root_type": "Expense"
+ },
+ "\u00c9rt\u00e9kes\u00edtett, \u00e1truh\u00e1zott (engedm\u00e9nyezett) k\u00f6vetel\u00e9sek k\u00f6nyv szerinti \u00e9rt\u00e9ke": {
+ "account_number": 8612,
+ "root_type": "Expense"
+ }
+ },
+ "Egy\u00e9b r\u00e1ford\u00edt\u00e1snak min\u0151s\u00fcl\u0151 eszk\u00f6z kivezet\u00e9sek": {
+ "account_number": 862,
+ "root_type": "Expense",
+ "is_group": 1,
+ "Hi\u00e1nyz\u00f3, megsemmis\u00fclt, kiselejtezett immateri\u00e1lis javak, t\u00e1rgyi eszk\u00f6z\u00f6k nett\u00f3 \u00e9rt\u00e9ke": {
+ "account_number": 8621,
+ "root_type": "Expense"
+ },
+ "Hi\u00e1nyz\u00f3, megsemmis\u00fclt, \u00e1llom\u00e1nyb\u00f3l kivezetett k\u00e9szletek k\u00f6nyv szerinti \u00e9rt\u00e9ke": {
+ "account_number": 8622,
+ "root_type": "Expense"
+ }
+ },
+ "Behajthatatlan k\u00f6vetel\u00e9sek le\u00edrt \u00f6sszege": {
+ "account_number": 863,
+ "root_type": "Expense"
+ },
+ "C\u00e9ltartal\u00e9k k\u00e9pz\u00e9s": {
+ "account_number": 864,
+ "root_type": "Expense"
+ },
+ "Ut\u00f3lag adott, nem sz\u00e1ml\u00e1zott engedm\u00e9ny": {
+ "account_number": 865,
+ "root_type": "Expense"
+ },
+ "Egy\u00e9b r\u00e1ford\u00edt\u00e1sk\u00e9nt elsz\u00e1molt ad\u00f3k, illet\u00e9kek, hozz\u00e1j\u00e1rul\u00e1sok": {
+ "account_number": 866,
+ "root_type": "Expense",
+ "is_group": 1,
+ "K\u00f6zponti k\u00f6lts\u00e9gvet\u00e9ssel elsz\u00e1molt ad\u00f3k, illet\u00e9kek, hozz\u00e1j\u00e1rul\u00e1sok": {
+ "account_number": 8661,
+ "root_type": "Expense"
+ },
+ "Helyi \u00f6nkorm\u00e1nyzatokkal elsz\u00e1molt ad\u00f3k, illet\u00e9kek, hozz\u00e1j\u00e1rul\u00e1sok": {
+ "account_number": 8662,
+ "root_type": "Expense"
+ },
+ "Elk\u00fcl\u00f6n\u00edtett \u00e1llami p\u00e9nzalapokkal elsz\u00e1molt ad\u00f3k, illet\u00e9kek, hozz\u00e1j\u00e1rul\u00e1sok": {
+ "account_number": 8663,
+ "root_type": "Expense"
+ },
+ "T\u00e1rsadalombiztos\u00edt\u00e1ssal elsz\u00e1molt ad\u00f3k, illet\u00e9kek, hozz\u00e1j\u00e1rul\u00e1sok": {
+ "account_number": 8664,
+ "root_type": "Expense"
+ },
+ "EU p\u00e9nz\u00fcgyi alapokkal elsz\u00e1molt ad\u00f3k, illet\u00e9kek, hozz\u00e1j\u00e1rul\u00e1sok": {
+ "account_number": 8665,
+ "root_type": "Expense"
+ },
+ "R\u00e1ford\u00edt\u00e1sk\u00e9nt elsz\u00e1molt egy\u00e9b ad\u00f3k \u00e9s ad\u00f3jelleg\u0171 t\u00e9telek": {
+ "account_number": 8666,
+ "root_type": "Expense"
+ }
+ },
+ "Egy\u00e9b r\u00e1ford\u00edt\u00e1sk\u00e9nt elsz\u00e1molt, ad\u00f3nak nem min\u0151s\u00fcl\u0151 kifizet\u00e9sek": {
+ "account_number": 867,
+ "root_type": "Expense",
+ "is_group": 1,
+ "K\u00e1resem\u00e9nnyel kapcsolatos fizetett, fizetend\u0151 \u00f6sszegek": {
+ "account_number": 8671,
+ "root_type": "Expense"
+ },
+ "K\u00f6lts\u00e9gek (r\u00e1f.) ellent\u00e9telez\u00e9s\u00e9re visszafizet\u00e9si k\u00f6telezetts\u00e9g n\u00e9lk\u00fcl adott t\u00e1mogat\u00e1s, v\u00e9glegesen \u00e1tadott p\u00e9nzeszk\u00f6z, juttat\u00e1s": {
+ "account_number": 8672,
+ "root_type": "Expense"
+ },
+ "Fejleszt\u00e9si c\u00e9lra, visszafizet\u00e9si k\u00f6telezetts\u00e9g n\u00e9lk\u00fcl adott t\u00e1mogat\u00e1s, juttat\u00e1s": {
+ "account_number": 8673,
+ "root_type": "Expense"
+ },
+ "Fejleszt\u00e9si c\u00e9lra kapott t\u00e1mogat\u00e1s visszafizetend\u0151 \u00f6sszege": {
+ "account_number": 8674,
+ "root_type": "Expense"
+ },
+ "Tao \u00e1ltal elismert b\u00edrs\u00e1gok, k\u00f6tb\u00e9rek, k\u00e9sedelmi kamatok, p\u00f3tl\u00e9kok, k\u00e1rt\u00e9r\u00edt\u00e9sek, s\u00e9relemd\u00edjak": {
+ "account_number": 8675,
+ "root_type": "Expense"
+ },
+ "Tao \u00e1ltal el nem ismert b\u00edrs\u00e1gok, k\u00f6tb\u00e9rek, k\u00e9sedelmi kamatok, p\u00f3tl\u00e9kok, k\u00e1rt\u00e9r\u00edt\u00e9sek, s\u00e9relemd\u00edjak": {
+ "account_number": 8676,
+ "root_type": "Expense"
+ }
+ },
+ "Terven fel\u00fcli \u00e9rt\u00e9kcs\u00f6kken\u00e9sek, \u00e9rt\u00e9kveszt\u00e9sek": {
+ "account_number": 868,
+ "root_type": "Expense",
+ "is_group": 1,
+ "Immateri\u00e1lis javak terven fel\u00fcli \u00e9rt\u00e9kcs\u00f6kken\u00e9se": {
+ "account_number": 8681,
+ "root_type": "Expense"
+ },
+ "T\u00e1rgyi eszk\u00f6z\u00f6k terven fel\u00fcli \u00e9rt\u00e9kcs\u00f6kken\u00e9se": {
+ "account_number": 8682,
+ "root_type": "Expense"
+ },
+ "K\u00e9szletek \u00e9rt\u00e9kveszt\u00e9se": {
+ "account_number": 8683,
+ "root_type": "Expense"
+ },
+ "K\u00f6vetel\u00e9sek \u00e9rt\u00e9kveszt\u00e9se": {
+ "account_number": 8684,
+ "root_type": "Expense"
+ }
+ },
+ "K\u00fcl\u00f6nf\u00e9le egy\u00e9b r\u00e1ford\u00edt\u00e1sok": {
+ "account_number": 869,
+ "root_type": "Expense",
+ "is_group": 1,
+ "T\u00e1rsas\u00e1gba bevitt, \u00e9rt\u00e9kp. v. r\u00e9sz. nem min\u0151s\u00fcl\u0151 vagyont. k\u00f6nyv sz. \u00e9s l\u00e9tes\u00edt\u0151 o. meghat. \u00e9rt\u00e9k\u00e9nek vesztes\u00e9gjelleg\u0171 k\u00fcl.": {
+ "account_number": 8691,
+ "root_type": "Expense"
+ },
+ "Ellent\u00e9telez\u00e9s n\u00e9lk\u00fcl \u00e1tv\u00e1llalt k\u00f6telezetts\u00e9g szerz\u0151d\u00e9s szerinti \u00f6sszege": {
+ "account_number": 8692,
+ "root_type": "Expense"
+ },
+ "T\u00e9r\u00edt\u00e9s n\u00e9lk\u00fcl \u00e1tadott, r\u00e9szesed\u00e9snek vagy \u00e9rt\u00e9kpap\u00edrnak nem min\u0151s\u00fcl\u0151 eszk\u00f6z\u00f6k nyilv\u00e1ntart\u00e1s szerinti \u00e9rt\u00e9ke": {
+ "account_number": 8693,
+ "root_type": "Expense"
+ },
+ "T\u00e9r\u00edt\u00e9s n\u00e9lk\u00fcl ny\u00fajtott szolg\u00e1ltat\u00e1sok beker\u00fcl\u00e9si \u00e9rt\u00e9ke": {
+ "account_number": 8694,
+ "root_type": "Expense"
+ },
+ "Elengedett k\u00f6vetel\u00e9sek k\u00f6nyv szerinti \u00e9rt\u00e9ke": {
+ "account_number": 8695,
+ "root_type": "Expense"
+ },
+ "Egy\u00e9b, vagyoncs\u00f6kken\u00e9ssel j\u00e1r\u00f3 r\u00e1ford\u00edt\u00e1sok": {
+ "account_number": 8696,
+ "root_type": "Expense"
+ }
+ }
+ },
+ "P\u00c9NZ\u00dcGYI M\u0170VELETEK R\u00c1FORD\u00cdT\u00c1SAI": {
+ "account_number": 87,
+ "root_type": "Expense",
+ "is_group": 1,
+ "R\u00e9szesed\u00e9sekb\u0151l sz\u00e1rmaz\u00f3 r\u00e1ford\u00edt\u00e1sok, \u00e1rfolyamvesztes\u00e9gek": {
+ "account_number": 871,
+ "root_type": "Expense"
+ },
+ "Befektetett p\u00e9nz\u00fcgyi eszk\u00f6z\u00f6kb\u0151l (\u00e9rt\u00e9kpap\u00edrokb\u00f3l, k\u00f6lcs\u00f6n\u00f6kb\u0151l) sz\u00e1rmaz\u00f3 r\u00e1ford\u00edt\u00e1sok \u00e1rfolyamvesztes\u00e9gek": {
+ "account_number": 872,
+ "root_type": "Expense"
+ },
+ "Hitelint\u00e9zetnek fizetend\u0151 kamatok \u00e9s kamatjelleg\u0171 r\u00e1ford\u00edt\u00e1sok": {
+ "account_number": 873,
+ "root_type": "Expense"
+ },
+ "Nem hitelint\u00e9zetnek fizetend\u0151 kamatok \u00e9s kamatjelleg\u0171 r\u00e1ford\u00edt\u00e1sok": {
+ "account_number": 874,
+ "root_type": "Expense"
+ },
+ "R\u00e9szesed\u00e9sek, \u00e9rt\u00e9kpap\u00edrok, bankbet\u00e9tek \u00e9rt\u00e9kveszt\u00e9se \u00e9s vissza\u00edr\u00e1sa": {
+ "account_number": 875,
+ "root_type": "Expense",
+ "is_group": 1,
+ "R\u00e9szesed\u00e9sek, \u00e9rt\u00e9kpap\u00edrok, bankbet\u00e9tek \u00e9rt\u00e9kveszt\u00e9se": {
+ "account_number": 8751,
+ "root_type": "Expense"
+ },
+ "R\u00e9szesed\u00e9sek, \u00e9rt\u00e9kpap\u00edrok, bankbet\u00e9tek \u00e9rt\u00e9kveszt\u00e9s\u00e9nek vissza\u00edr\u00e1sa": {
+ "account_number": 8752,
+ "root_type": "Expense"
+ }
+ },
+ "K\u00fclf\u00f6ldi p\u00e9nz\u00e9rt\u00e9kre sz\u00f3l\u00f3 eszk\u00f6z\u00f6k \u00e9s k\u00f6telezetts\u00e9gek \u00e1rfolyamvesztes\u00e9gei": {
+ "account_number": 876,
+ "root_type": "Expense",
+ "is_group": 1,
+ "Deviza \u00e9s valutak\u00e9szletek forintra \u00e1tv\u00e1lt\u00e1s\u00e1nak \u00e1rfolyamvesztes\u00e9ge": {
+ "account_number": 8761,
+ "root_type": "Expense"
+ },
+ "K\u00fclf\u00f6ldi p\u00e9nz\u00e9rt\u00e9kre sz\u00f3l\u00f3 eszk\u00f6z\u00f6k \u00e9s k\u00f6telezetts\u00e9gek p\u00e9nz\u00fcgyileg rendezett \u00e1rfolyamvesztes\u00e9ge": {
+ "account_number": 8762,
+ "root_type": "Expense"
+ }
+ },
+ "P\u00e9nz\u00fcgyi m\u0171veletek egy\u00e9b r\u00e1ford\u00edt\u00e1sai": {
+ "account_number": 877,
+ "root_type": "Expense"
+ },
+ "P\u00e9nz\u00fcgyi rendez\u00e9shez kapcsol\u00f3d\u00f3an adott engedm\u00e9ny": {
+ "account_number": 878,
+ "root_type": "Expense"
+ },
+ "Egy\u00e9b vagyoncs\u00f6kken\u00e9ssel j\u00e1r\u00f3 p\u00e9nz\u00fcgyi r\u00e1ford\u00edt\u00e1sok": {
+ "account_number": 879,
+ "root_type": "Expense"
+ }
+ },
+ "EREDM\u00c9NYT TERHEL\u0150 AD\u00d3K": {
+ "account_number": 89,
+ "root_type": "Expense",
+ "is_group": 1,
+ "T\u00e1rsas\u00e1gi ad\u00f3": {
+ "account_number": 891,
+ "root_type": "Expense"
+ },
+ "Kisv\u00e1llalati ad\u00f3": {
+ "account_number": 893,
+ "root_type": "Expense"
+ },
+ "Eredm\u00e9nyt terhel\u0151 egy\u00e9b ad\u00f3k": {
+ "account_number": 899,
+ "root_type": "Expense"
+ }
+ }
+ },
+ "SZ\u00c1MLAOSZT\u00c1LY BEV\u00c9TELEK": {
+ "account_number": 9,
+ "root_type": "Income",
+ "is_group": 1,
+ "BELF\u00d6LDI \u00c9RT\u00c9KES\u00cdT\u00c9S \u00c1RBEV\u00c9TELE": {
+ "account_number": 91,
+ "root_type": "Income",
+ "is_group": 1,
+ "Belf\u00f6ldinek \u00e9rt\u00e9kes\u00edtett saj\u00e1t termel\u00e9s\u0171 k\u00e9szletek \u00e1rbev\u00e9tele": {
+ "account_number": 911,
+ "root_type": "Income"
+ },
+ "Belf\u00f6ldinek \u00e9rt\u00e9kes\u00edtett v\u00e1s\u00e1rolt k\u00e9szletek \u00e1rbev\u00e9tele": {
+ "account_number": 912,
+ "root_type": "Income"
+ },
+ "Belf\u00f6ldinek ny\u00fajtott szolg\u00e1ltat\u00e1sok \u00e1rbev\u00e9tele": {
+ "account_number": 913,
+ "root_type": "Income"
+ },
+ "Belf\u00f6ldi \u00e9rt\u00e9kes\u00edt\u00e9ssel kapcsolatos \u00e1rt\u00e1mogat\u00e1s": {
+ "account_number": 918,
+ "root_type": "Income"
+ },
+ "Egy\u00e9b belf\u00f6ldi \u00e9rt\u00e9kes\u00edt\u00e9s \u00e1rbev\u00e9tele": {
+ "account_number": 919,
+ "root_type": "Income"
+ }
+ },
+ "EXPORT\u00c9RT\u00c9KES\u00cdT\u00c9S \u00c1RBEV\u00c9TELE": {
+ "account_number": 92,
+ "root_type": "Income",
+ "is_group": 1,
+ "K\u00fclf\u00f6ldinek \u00e9rt\u00e9kes\u00edtett saj\u00e1t termel\u00e9s\u0171 k\u00e9szletek \u00e1rbev\u00e9tele": {
+ "account_number": 921,
+ "root_type": "Income"
+ },
+ "K\u00fclf\u00f6ldinek \u00e9rt\u00e9kes\u00edtett v\u00e1s\u00e1rolt k\u00e9szletek \u00e1rbev\u00e9tele": {
+ "account_number": 922,
+ "root_type": "Income"
+ },
+ "K\u00fclf\u00f6ldinek ny\u00fajtott szolg\u00e1ltat\u00e1sok \u00e1rbev\u00e9tele": {
+ "account_number": 923,
+ "root_type": "Income"
+ },
+ "K\u00fclf\u00f6ldi \u00e9rt\u00e9kes\u00edt\u00e9ssel kapcsolatos \u00e1rt\u00e1mogat\u00e1s": {
+ "account_number": 928,
+ "root_type": "Income"
+ },
+ "Egy\u00e9b k\u00fclf\u00f6ldi \u00e9rt\u00e9kes\u00edt\u00e9s \u00e1rbev\u00e9tele": {
+ "account_number": 929,
+ "root_type": "Income"
+ }
+ },
+ "EGY\u00c9B BEV\u00c9TELEK": {
+ "account_number": 96,
+ "root_type": "Income",
+ "is_group": 1,
+ "Egy\u00e9b bev\u00e9telnek min\u0151s\u00fcl\u0151 \u00e9rt\u00e9kes\u00edt\u00e9sek": {
+ "account_number": 961,
+ "root_type": "Income",
+ "is_group": 1,
+ "\u00c9rt\u00e9kes\u00edtett immateri\u00e1lis javak, t\u00e1rgyi eszk\u00f6z\u00f6k ellen\u00e9rt\u00e9ke": {
+ "account_number": 9611,
+ "root_type": "Income"
+ },
+ "\u00c9rt\u00e9kes\u00edtett, \u00e1truh\u00e1zott (engedm\u00e9nyezett) k\u00f6vetel\u00e9sek ellen\u00e9rt\u00e9ke": {
+ "account_number": 9612,
+ "root_type": "Income"
+ }
+ },
+ "K\u00f6vetel\u00e9s k\u00f6nyv szerinti \u00e9rt\u00e9k\u00e9t meghalad\u00f3an realiz\u00e1lt \u00f6sszeg": {
+ "account_number": 963,
+ "root_type": "Income"
+ },
+ "C\u00e9ltartal\u00e9k felold\u00e1s": {
+ "account_number": 964,
+ "root_type": "Income"
+ },
+ "Ut\u00f3lag kapott, nem sz\u00e1ml\u00e1zott engedm\u00e9ny": {
+ "account_number": 965,
+ "root_type": "Income"
+ },
+ "M\u0171k\u00f6d\u00e9si c\u00e9lra kapott t\u00e1mogat\u00e1s, juttat\u00e1s": {
+ "account_number": 966,
+ "root_type": "Income",
+ "is_group": 1,
+ "K\u00f6zponti k\u00f6lts\u00e9gvet\u00e9sb\u0151l kapott t\u00e1mogat\u00e1s, juttat\u00e1s": {
+ "account_number": 9661,
+ "root_type": "Income"
+ },
+ "Helyi \u00f6nkorm\u00e1nyzatokt\u00f3l kapott t\u00e1mogat\u00e1s, juttat\u00e1s": {
+ "account_number": 9662,
+ "root_type": "Income"
+ },
+ "Eur\u00f3pai Uni\u00f3t\u00f3l kapott t\u00e1mogat\u00e1s, juttat\u00e1s": {
+ "account_number": 9663,
+ "root_type": "Income"
+ },
+ "Egy\u00e9b forr\u00e1sb\u00f3l kapott t\u00e1mogat\u00e1s, juttat\u00e1s": {
+ "account_number": 9664,
+ "root_type": "Income"
+ }
+ },
+ "Egy\u00e9b bev\u00e9telk\u00e9nt elsz\u00e1molt p\u00e9nzbev\u00e9telek": {
+ "account_number": 967,
+ "root_type": "Income",
+ "is_group": 1,
+ "K\u00e1resem\u00e9nnyel kapcsolatos t\u00e9r\u00edt\u00e9sek": {
+ "account_number": 9671,
+ "root_type": "Income"
+ },
+ "K\u00f6lts\u00e9gek (r\u00e1ford\u00edt\u00e1sok) ellent\u00e9telez\u00e9s\u00e9re kapott t\u00e1mogat\u00e1s, juttat\u00e1s": {
+ "account_number": 9672,
+ "root_type": "Income"
+ },
+ "Fejleszt\u00e9si c\u00e9lra kapott t\u00e1mogat\u00e1s, juttat\u00e1s": {
+ "account_number": 9673,
+ "root_type": "Income"
+ },
+ "Kapott b\u00edrs\u00e1gok, k\u00f6tb\u00e9rek, fekb\u00e9rek, k\u00e9sedelmi kamatok, k\u00e1rt\u00e9r\u00edt\u00e9sek": {
+ "account_number": 9674,
+ "root_type": "Income"
+ }
+ },
+ "Terven fel\u00fcli \u00e9rt\u00e9kcs\u00f6kken\u00e9sek, \u00e9rt\u00e9kveszt\u00e9sek vissza\u00edr\u00e1sa": {
+ "account_number": 968,
+ "root_type": "Income",
+ "is_group": 1,
+ "Immateri\u00e1lis javak terven fel\u00fcli \u00e9rt\u00e9kcs\u00f6kken\u00e9s\u00e9nek vissza\u00edr\u00e1sa": {
+ "account_number": 9681,
+ "root_type": "Income"
+ },
+ "T\u00e1rgyi eszk\u00f6z\u00f6k terven fel\u00fcli \u00e9rt\u00e9kcs\u00f6kken\u00e9s\u00e9nek vissza\u00edr\u00e1sa": {
+ "account_number": 9682,
+ "root_type": "Income"
+ },
+ "K\u00e9szletek \u00e9rt\u00e9kveszt\u00e9s\u00e9nek vissza\u00edr\u00e1sa": {
+ "account_number": 9683,
+ "root_type": "Income"
+ },
+ "R\u00e9szesed\u00e9sek \u00e9rt\u00e9kveszt\u00e9s\u00e9nek vissza\u00edr\u00e1sa": {
+ "account_number": 9684,
+ "root_type": "Income"
+ }
+ },
+ "K\u00fcl\u00f6nf\u00e9le egy\u00e9b bev\u00e9telek": {
+ "account_number": 969,
+ "root_type": "Income",
+ "is_group": 1,
+ "Gazd. t\u00e1rs. bevitt, \u00e9rt\u00e9kp. v. r\u00e9sz. nem min\u0151s\u00fcl\u0151 vagyont. nyilv. sz. \u00e9rt. \u00e9s l\u00e9tes\u00edt\u0151 o. meghat. \u00e9rt. nyeres\u00e9gjelleg\u0171 k\u00fcl.": {
+ "account_number": 9691,
+ "root_type": "Income"
+ },
+ "El\u00e9v\u00fclt k\u00f6telezetts\u00e9g k\u00f6nyv szerinti \u00e9rt\u00e9ke": {
+ "account_number": 9692,
+ "root_type": "Income"
+ },
+ "T\u00e9r\u00edt\u00e9s n\u00e9lk\u00fcl \u00e1tvett, aj\u00e1nd\u00e9kk\u00e9nt, hagyat\u00e9kk\u00e9nt kapott, fellelt eszk\u00f6z\u00f6k piaci vagy jogszab\u00e1ly szerinti \u00e9rt\u00e9ke": {
+ "account_number": 9693,
+ "root_type": "Income"
+ },
+ "T\u00e9r\u00edt\u00e9s n\u00e9lk\u00fcl kapott szolg\u00e1ltat\u00e1sok piaci vagy jogszab\u00e1ly szerinti \u00e9rt\u00e9ke": {
+ "account_number": 9694,
+ "root_type": "Income"
+ },
+ "Elengedett \u00e9s ellent\u00e9telez\u00e9s n\u00e9lk\u00fcl \u00e1tv\u00e1llalt k\u00f6telezetts\u00e9g \u00e9rt\u00e9ke": {
+ "account_number": 9695,
+ "root_type": "Income"
+ },
+ "Egy\u00e9b, vagyonn\u00f6veked\u00e9ssel j\u00e1r\u00f3 bev\u00e9telek": {
+ "account_number": 9696,
+ "root_type": "Income"
+ }
+ }
+ },
+ "P\u00c9NZ\u00dcGYI M\u0170VELETEK BEV\u00c9TELEI": {
+ "account_number": 97,
+ "root_type": "Income",
+ "is_group": 1,
+ "R\u00e9szesed\u00e9sekb\u0151l sz\u00e1rmaz\u00f3 bev\u00e9telek, \u00e1rfolyamnyeres\u00e9gek": {
+ "account_number": 971,
+ "root_type": "Income"
+ },
+ "Befektetett p\u00e9nz\u00fcgyi eszk\u00f6z\u00f6kb\u0151l (\u00e9rt\u00e9kpap\u00edrokb\u00f3l, k\u00f6lcs\u00f6n\u00f6kb\u0151l) sz\u00e1rmaz\u00f3 bev\u00e9telek, \u00e1rfolyamnyeres\u00e9gek": {
+ "account_number": 972,
+ "root_type": "Income"
+ },
+ "Hitelint\u00e9zett\u0151l kapott kamatok \u00e9s kamatjelleg\u0171 bev\u00e9telek": {
+ "account_number": 973,
+ "root_type": "Income"
+ },
+ "Nem hitelint\u00e9zett\u0151l kapott kamatok \u00e9s kamatjelleg\u0171 bev\u00e9telek": {
+ "account_number": 974,
+ "root_type": "Income"
+ },
+ "Kapott (j\u00e1r\u00f3) osztal\u00e9k \u00e9s r\u00e9szesed\u00e9s": {
+ "account_number": 975,
+ "root_type": "Income"
+ },
+ "K\u00fclf\u00f6ldi p\u00e9nz\u00e9rt\u00e9kre sz\u00f3l\u00f3 eszk\u00f6z\u00f6k \u00e9s k\u00f6telezetts\u00e9gek \u00e1rfolyamnyeres\u00e9gei": {
+ "account_number": 976,
+ "root_type": "Income",
+ "is_group": 1,
+ "Deviza \u00e9s valutak\u00e9szletek forintra \u00e1tv\u00e1lt\u00e1s\u00e1nak \u00e1rfolyamnyeres\u00e9ge": {
+ "account_number": 9761,
+ "root_type": "Income"
+ },
+ "K\u00fclf\u00f6ldi p\u00e9nz\u00e9rt\u00e9kre sz\u00f3l\u00f3 eszk\u00f6z\u00f6k \u00e9s k\u00f6telezetts\u00e9gek p\u00e9nz\u00fcgyileg rendezett \u00e1rfolyamnyeres\u00e9ge": {
+ "account_number": 9762,
+ "root_type": "Income"
+ }
+ },
+ "P\u00e9nz\u00fcgyi m\u0171veletek egy\u00e9b bev\u00e9telei": {
+ "account_number": 977,
+ "root_type": "Income"
+ },
+ "P\u00e9nz\u00fcgyi rendez\u00e9shez kapcsol\u00f3d\u00f3an kapott engedm\u00e9ny": {
+ "account_number": 978,
+ "root_type": "Income"
+ },
+ "Egy\u00e9b vagyonn\u00f6veked\u00e9ssel j\u00e1r\u00f3 p\u00e9nz\u00fcgyi bev\u00e9telek": {
+ "account_number": 979,
+ "root_type": "Income"
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/accounting_dimension_filter/accounting_dimension_filter.js b/erpnext/accounts/doctype/accounting_dimension_filter/accounting_dimension_filter.js
index 750e129..8a6b021 100644
--- a/erpnext/accounts/doctype/accounting_dimension_filter/accounting_dimension_filter.js
+++ b/erpnext/accounts/doctype/accounting_dimension_filter/accounting_dimension_filter.js
@@ -3,10 +3,6 @@
frappe.ui.form.on('Accounting Dimension Filter', {
refresh: function(frm, cdt, cdn) {
- if (frm.doc.accounting_dimension) {
- frm.set_df_property('dimensions', 'label', frm.doc.accounting_dimension, cdn, 'dimension_value');
- }
-
let help_content =
`<table class="table table-bordered" style="background-color: var(--scrollbar-track-color);">
<tr><td>
@@ -68,6 +64,7 @@
frm.clear_table("dimensions");
let row = frm.add_child("dimensions");
row.accounting_dimension = frm.doc.accounting_dimension;
+ frm.fields_dict["dimensions"].grid.update_docfield_property("dimension_value", "label", frm.doc.accounting_dimension);
frm.refresh_field("dimensions");
frm.trigger('setup_filters');
},
diff --git a/erpnext/accounts/doctype/bank_guarantee/bank_guarantee.js b/erpnext/accounts/doctype/bank_guarantee/bank_guarantee.js
index febf85c..99cc0a7 100644
--- a/erpnext/accounts/doctype/bank_guarantee/bank_guarantee.js
+++ b/erpnext/accounts/doctype/bank_guarantee/bank_guarantee.js
@@ -43,20 +43,13 @@
reference_docname: function(frm) {
if (frm.doc.reference_docname && frm.doc.reference_doctype) {
- let fields_to_fetch = ["grand_total"];
let party_field = frm.doc.reference_doctype == "Sales Order" ? "customer" : "supplier";
- if (frm.doc.reference_doctype == "Sales Order") {
- fields_to_fetch.push("project");
- }
-
- fields_to_fetch.push(party_field);
frappe.call({
- method: "erpnext.accounts.doctype.bank_guarantee.bank_guarantee.get_vouchar_detials",
+ method: "erpnext.accounts.doctype.bank_guarantee.bank_guarantee.get_voucher_details",
args: {
- "column_list": fields_to_fetch,
- "doctype": frm.doc.reference_doctype,
- "docname": frm.doc.reference_docname
+ "bank_guarantee_type": frm.doc.bg_type,
+ "reference_name": frm.doc.reference_docname
},
callback: function(r) {
if (r.message) {
diff --git a/erpnext/accounts/doctype/bank_guarantee/bank_guarantee.py b/erpnext/accounts/doctype/bank_guarantee/bank_guarantee.py
index 9144a29..02eb599 100644
--- a/erpnext/accounts/doctype/bank_guarantee/bank_guarantee.py
+++ b/erpnext/accounts/doctype/bank_guarantee/bank_guarantee.py
@@ -2,11 +2,8 @@
# For license information, please see license.txt
-import json
-
import frappe
from frappe import _
-from frappe.desk.search import sanitize_searchfield
from frappe.model.document import Document
@@ -25,14 +22,18 @@
@frappe.whitelist()
-def get_vouchar_detials(column_list, doctype, docname):
- column_list = json.loads(column_list)
- for col in column_list:
- sanitize_searchfield(col)
- return frappe.db.sql(
- """ select {columns} from `tab{doctype}` where name=%s""".format(
- columns=", ".join(column_list), doctype=doctype
- ),
- docname,
- as_dict=1,
- )[0]
+def get_voucher_details(bank_guarantee_type: str, reference_name: str):
+ if not isinstance(reference_name, str):
+ raise TypeError("reference_name must be a string")
+
+ fields_to_fetch = ["grand_total"]
+
+ if bank_guarantee_type == "Receiving":
+ doctype = "Sales Order"
+ fields_to_fetch.append("customer")
+ fields_to_fetch.append("project")
+ else:
+ doctype = "Purchase Order"
+ fields_to_fetch.append("supplier")
+
+ return frappe.db.get_value(doctype, reference_name, fields_to_fetch, as_dict=True)
diff --git a/erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.js b/erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.js
index 46ba27c..28e79b5 100644
--- a/erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.js
+++ b/erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.js
@@ -12,6 +12,9 @@
},
};
});
+ let no_bank_transactions_text =
+ `<div class="text-muted text-center">${__("No Matching Bank Transactions Found")}</div>`
+ set_field_options("no_bank_transactions", no_bank_transactions_text);
},
onload: function (frm) {
diff --git a/erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.json b/erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.json
index b643e6e..f666101 100644
--- a/erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.json
+++ b/erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.json
@@ -81,8 +81,7 @@
},
{
"fieldname": "no_bank_transactions",
- "fieldtype": "HTML",
- "options": "<div class=\"text-muted text-center\">No Matching Bank Transactions Found</div>"
+ "fieldtype": "HTML"
}
],
"hide_toolbar": 1,
@@ -109,4 +108,4 @@
"quick_entry": 1,
"sort_field": "modified",
"sort_order": "DESC"
-}
\ No newline at end of file
+}
diff --git a/erpnext/accounts/doctype/bank_statement_import/bank_statement_import.js b/erpnext/accounts/doctype/bank_statement_import/bank_statement_import.js
index f745620..04af323 100644
--- a/erpnext/accounts/doctype/bank_statement_import/bank_statement_import.js
+++ b/erpnext/accounts/doctype/bank_statement_import/bank_statement_import.js
@@ -100,7 +100,7 @@
if (frm.doc.status.includes("Success")) {
frm.add_custom_button(
- __("Go to {0} List", [frm.doc.reference_doctype]),
+ __("Go to {0} List", [__(frm.doc.reference_doctype)]),
() => frappe.set_route("List", frm.doc.reference_doctype)
);
}
diff --git a/erpnext/accounts/doctype/chart_of_accounts_importer/chart_of_accounts_importer.py b/erpnext/accounts/doctype/chart_of_accounts_importer/chart_of_accounts_importer.py
index 3091394..325a356 100644
--- a/erpnext/accounts/doctype/chart_of_accounts_importer/chart_of_accounts_importer.py
+++ b/erpnext/accounts/doctype/chart_of_accounts_importer/chart_of_accounts_importer.py
@@ -52,7 +52,7 @@
if parent_company and (not allow_account_creation_against_child_company):
msg = _("{} is a child company.").format(frappe.bold(company)) + " "
msg += _("Please import accounts against parent company or enable {} in company master.").format(
- frappe.bold("Allow Account Creation Against Child Company")
+ frappe.bold(_("Allow Account Creation Against Child Company"))
)
frappe.throw(msg, title=_("Wrong Company"))
diff --git a/erpnext/accounts/doctype/journal_entry_template/journal_entry_template.js b/erpnext/accounts/doctype/journal_entry_template/journal_entry_template.js
index cf5fbe1..88f1c90 100644
--- a/erpnext/accounts/doctype/journal_entry_template/journal_entry_template.js
+++ b/erpnext/accounts/doctype/journal_entry_template/journal_entry_template.js
@@ -45,21 +45,6 @@
frm.trigger("clear_child");
switch(frm.doc.voucher_type){
- case "Opening Entry":
- frm.set_value("is_opening", "Yes");
- frappe.call({
- type:"GET",
- method: "erpnext.accounts.doctype.journal_entry.journal_entry.get_opening_accounts",
- args: {
- "company": frm.doc.company
- },
- callback: function(r) {
- if(r.message) {
- add_accounts(frm.doc, r.message);
- }
- }
- });
- break;
case "Bank Entry":
case "Cash Entry":
frappe.call({
diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.py b/erpnext/accounts/doctype/payment_entry/payment_entry.py
index 3341f1f..9354e44 100644
--- a/erpnext/accounts/doctype/payment_entry/payment_entry.py
+++ b/erpnext/accounts/doctype/payment_entry/payment_entry.py
@@ -62,7 +62,6 @@
self.set_missing_values()
self.validate_payment_type()
self.validate_party_details()
- self.validate_bank_accounts()
self.set_exchange_rate()
self.validate_mandatory()
self.validate_reference_documents()
@@ -243,23 +242,6 @@
if not frappe.db.exists(self.party_type, self.party):
frappe.throw(_("Invalid {0}: {1}").format(self.party_type, self.party))
- if self.party_account and self.party_type in ("Customer", "Supplier"):
- self.validate_account_type(
- self.party_account, [erpnext.get_party_account_type(self.party_type)]
- )
-
- def validate_bank_accounts(self):
- if self.payment_type in ("Pay", "Internal Transfer"):
- self.validate_account_type(self.paid_from, ["Bank", "Cash"])
-
- if self.payment_type in ("Receive", "Internal Transfer"):
- self.validate_account_type(self.paid_to, ["Bank", "Cash"])
-
- def validate_account_type(self, account, account_types):
- account_type = frappe.get_cached_value("Account", account, "account_type")
- # if account_type not in account_types:
- # frappe.throw(_("Account Type for {0} must be {1}").format(account, comma_or(account_types)))
-
def set_exchange_rate(self, ref_doc=None):
self.set_source_exchange_rate(ref_doc)
self.set_target_exchange_rate(ref_doc)
diff --git a/erpnext/accounts/doctype/pos_invoice_item/pos_invoice_item.json b/erpnext/accounts/doctype/pos_invoice_item/pos_invoice_item.json
index 3f85668..4bb1865 100644
--- a/erpnext/accounts/doctype/pos_invoice_item/pos_invoice_item.json
+++ b/erpnext/accounts/doctype/pos_invoice_item/pos_invoice_item.json
@@ -8,6 +8,7 @@
"engine": "InnoDB",
"field_order": [
"barcode",
+ "has_item_scanned",
"item_code",
"col_break1",
"item_name",
@@ -808,11 +809,19 @@
"fieldtype": "Check",
"label": "Grant Commission",
"read_only": 1
+ },
+ {
+ "default": "0",
+ "depends_on": "barcode",
+ "fieldname": "has_item_scanned",
+ "fieldtype": "Check",
+ "label": "Has Item Scanned",
+ "read_only": 1
}
],
"istable": 1,
"links": [],
- "modified": "2021-10-05 12:23:47.506290",
+ "modified": "2022-11-02 12:52:39.125295",
"modified_by": "Administrator",
"module": "Accounts",
"name": "POS Invoice Item",
@@ -820,5 +829,6 @@
"owner": "Administrator",
"permissions": [],
"sort_field": "modified",
- "sort_order": "DESC"
+ "sort_order": "DESC",
+ "states": []
}
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.json b/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.json
index 83e6370..16602d3 100644
--- a/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.json
+++ b/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.json
@@ -23,6 +23,7 @@
"fetch_customers",
"column_break_6",
"primary_mandatory",
+ "show_net_values_in_party_account",
"column_break_17",
"customers",
"preferences",
@@ -291,10 +292,16 @@
"fieldname": "include_break",
"fieldtype": "Check",
"label": "Page Break After Each SoA"
+ },
+ {
+ "default": "0",
+ "fieldname": "show_net_values_in_party_account",
+ "fieldtype": "Check",
+ "label": "Show Net Values in Party Account"
}
],
"links": [],
- "modified": "2022-10-17 17:47:08.662475",
+ "modified": "2022-11-10 17:44:17.165991",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Process Statement Of Accounts",
diff --git a/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.py b/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.py
index c6b0c57..a48c027 100644
--- a/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.py
+++ b/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.py
@@ -95,6 +95,7 @@
"show_opening_entries": 0,
"include_default_book_entries": 0,
"tax_id": tax_id if tax_id else None,
+ "show_net_values_in_party_account": doc.show_net_values_in_party_account,
}
)
col, res = get_soa(filters)
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json
index e73d602..370c0fc 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json
@@ -57,6 +57,8 @@
"column_break_28",
"total",
"net_total",
+ "tax_withholding_net_total",
+ "base_tax_withholding_net_total",
"taxes_section",
"taxes_and_charges",
"column_break_58",
@@ -89,7 +91,6 @@
"section_break_44",
"apply_discount_on",
"base_discount_amount",
- "additional_discount_account",
"column_break_46",
"additional_discount_percentage",
"discount_amount",
@@ -1422,6 +1423,26 @@
"read_only": 1
},
{
+ "default": "0",
+ "fieldname": "tax_withholding_net_total",
+ "fieldtype": "Currency",
+ "hidden": 1,
+ "label": "Tax Withholding Net Total",
+ "no_copy": 1,
+ "options": "currency",
+ "read_only": 1
+ },
+ {
+ "fieldname": "base_tax_withholding_net_total",
+ "fieldtype": "Currency",
+ "hidden": 1,
+ "label": "Base Tax Withholding Net Total",
+ "no_copy": 1,
+ "options": "currency",
+ "print_hide": 1,
+ "read_only": 1
+ },
+ {
"collapsible_depends_on": "tax_withheld_vouchers",
"fieldname": "tax_withheld_vouchers_section",
"fieldtype": "Section Break",
@@ -1519,7 +1540,7 @@
"idx": 204,
"is_submittable": 1,
"links": [],
- "modified": "2022-10-11 13:04:44.304389",
+ "modified": "2022-11-04 01:02:44.544878",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Purchase Invoice",
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
index 41be6f9..f3105e3 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
@@ -1410,7 +1410,7 @@
self.repost_future_sle_and_gle()
self.update_project()
- frappe.db.set(self, "status", "Cancelled")
+ self.db_set("status", "Cancelled")
unlink_inter_company_doc(self.doctype, self.name, self.inter_company_invoice_reference)
self.ignore_linked_doctypes = (
@@ -1463,6 +1463,7 @@
def update_billing_status_in_pr(self, update_modified=True):
updated_pr = []
+ po_details = []
for d in self.get("items"):
if d.pr_detail:
billed_amt = frappe.db.sql(
@@ -1480,7 +1481,10 @@
)
updated_pr.append(d.purchase_receipt)
elif d.po_detail:
- updated_pr += update_billed_amount_based_on_po(d.po_detail, update_modified)
+ po_details.append(d.po_detail)
+
+ if po_details:
+ updated_pr += update_billed_amount_based_on_po(po_details, update_modified)
for pr in set(updated_pr):
from erpnext.stock.doctype.purchase_receipt.purchase_receipt import update_billing_percentage
diff --git a/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json b/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json
index a8f6f80..5c1cb0d 100644
--- a/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json
+++ b/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json
@@ -40,6 +40,7 @@
"discount_amount",
"base_rate_with_margin",
"sec_break2",
+ "apply_tds",
"rate",
"amount",
"item_tax_template",
@@ -868,6 +869,12 @@
"label": "Product Bundle",
"options": "Product Bundle",
"read_only": 1
+ },
+ {
+ "default": "1",
+ "fieldname": "apply_tds",
+ "fieldtype": "Check",
+ "label": "Apply TDS"
}
],
"idx": 1,
diff --git a/erpnext/accounts/doctype/repost_payment_ledger/__init__.py b/erpnext/accounts/doctype/repost_payment_ledger/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/accounts/doctype/repost_payment_ledger/__init__.py
diff --git a/erpnext/accounts/doctype/repost_payment_ledger/repost_payment_ledger.js b/erpnext/accounts/doctype/repost_payment_ledger/repost_payment_ledger.js
new file mode 100644
index 0000000..6801408
--- /dev/null
+++ b/erpnext/accounts/doctype/repost_payment_ledger/repost_payment_ledger.js
@@ -0,0 +1,53 @@
+// Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and contributors
+// For license information, please see license.txt
+
+frappe.ui.form.on('Repost Payment Ledger', {
+ setup: function(frm) {
+ frm.set_query("voucher_type", () => {
+ return {
+ filters: {
+ name: ['in', ['Purchase Invoice', 'Sales Invoice', 'Payment Entry', 'Journal Entry']]
+ }
+ };
+ });
+
+ frm.fields_dict['repost_vouchers'].grid.get_field('voucher_type').get_query = function(doc) {
+ return {
+ filters: {
+ name: ['in', ['Purchase Invoice', 'Sales Invoice', 'Payment Entry', 'Journal Entry']]
+ }
+ }
+ }
+
+ frm.fields_dict['repost_vouchers'].grid.get_field('voucher_no').get_query = function(doc) {
+ if (doc.company) {
+ return {
+ filters: {
+ company: doc.company,
+ docstatus: 1
+ }
+ }
+ }
+ }
+
+ },
+ refresh: function(frm) {
+
+ if (frm.doc.docstatus==1 && ['Queued', 'Failed'].find(x => x == frm.doc.repost_status)) {
+ frm.set_intro(__("Use 'Repost in background' button to trigger background job. Job can only be triggered when document is in Queued or Failed status."));
+ var btn_label = __("Repost in background")
+
+ frm.add_custom_button(btn_label, () => {
+ frappe.call({
+ method: 'erpnext.accounts.doctype.repost_payment_ledger.repost_payment_ledger.execute_repost_payment_ledger',
+ args: {
+ docname: frm.doc.name,
+ }
+ });
+ frappe.msgprint(__('Reposting in the background.'));
+ });
+ }
+
+ }
+});
+
diff --git a/erpnext/accounts/doctype/repost_payment_ledger/repost_payment_ledger.json b/erpnext/accounts/doctype/repost_payment_ledger/repost_payment_ledger.json
new file mode 100644
index 0000000..5175fd1
--- /dev/null
+++ b/erpnext/accounts/doctype/repost_payment_ledger/repost_payment_ledger.json
@@ -0,0 +1,159 @@
+{
+ "actions": [],
+ "allow_rename": 1,
+ "creation": "2022-10-19 21:59:33.553852",
+ "doctype": "DocType",
+ "editable_grid": 1,
+ "engine": "InnoDB",
+ "field_order": [
+ "filters_section",
+ "company",
+ "posting_date",
+ "column_break_4",
+ "voucher_type",
+ "add_manually",
+ "status_section",
+ "repost_status",
+ "repost_error_log",
+ "selected_vouchers_section",
+ "repost_vouchers",
+ "amended_from"
+ ],
+ "fields": [
+ {
+ "default": "Today",
+ "fieldname": "posting_date",
+ "fieldtype": "Date",
+ "label": "Posting Date",
+ "reqd": 1
+ },
+ {
+ "fieldname": "voucher_type",
+ "fieldtype": "Link",
+ "label": "Voucher Type",
+ "options": "DocType"
+ },
+ {
+ "fieldname": "amended_from",
+ "fieldtype": "Link",
+ "label": "Amended From",
+ "no_copy": 1,
+ "options": "Repost Payment Ledger",
+ "print_hide": 1,
+ "read_only": 1
+ },
+ {
+ "fieldname": "company",
+ "fieldtype": "Link",
+ "in_list_view": 1,
+ "label": "Company",
+ "options": "Company",
+ "reqd": 1
+ },
+ {
+ "fieldname": "selected_vouchers_section",
+ "fieldtype": "Section Break",
+ "label": "Vouchers"
+ },
+ {
+ "fieldname": "filters_section",
+ "fieldtype": "Section Break",
+ "label": "Filters"
+ },
+ {
+ "fieldname": "column_break_4",
+ "fieldtype": "Column Break"
+ },
+ {
+ "fieldname": "repost_vouchers",
+ "fieldtype": "Table",
+ "label": "Selected Vouchers",
+ "options": "Repost Payment Ledger Items"
+ },
+ {
+ "fieldname": "repost_status",
+ "fieldtype": "Select",
+ "label": "Repost Status",
+ "options": "\nQueued\nFailed\nCompleted",
+ "read_only": 1
+ },
+ {
+ "fieldname": "status_section",
+ "fieldtype": "Section Break",
+ "label": "Status"
+ },
+ {
+ "default": "0",
+ "description": "Ignore Voucher Type filter and Select Vouchers Manually",
+ "fieldname": "add_manually",
+ "fieldtype": "Check",
+ "label": "Add Manually"
+ },
+ {
+ "depends_on": "eval:doc.repost_error_log",
+ "fieldname": "repost_error_log",
+ "fieldtype": "Long Text",
+ "label": "Repost Error Log"
+ }
+ ],
+ "index_web_pages_for_search": 1,
+ "is_submittable": 1,
+ "links": [],
+ "modified": "2022-11-08 07:38:40.079038",
+ "modified_by": "Administrator",
+ "module": "Accounts",
+ "name": "Repost Payment Ledger",
+ "owner": "Administrator",
+ "permissions": [
+ {
+ "create": 1,
+ "delete": 1,
+ "email": 1,
+ "export": 1,
+ "print": 1,
+ "read": 1,
+ "report": 1,
+ "role": "System Manager",
+ "share": 1,
+ "write": 1
+ },
+ {
+ "create": 1,
+ "delete": 1,
+ "email": 1,
+ "export": 1,
+ "print": 1,
+ "read": 1,
+ "report": 1,
+ "role": "Accounts Manager",
+ "share": 1,
+ "submit": 1,
+ "write": 1
+ },
+ {
+ "create": 1,
+ "email": 1,
+ "export": 1,
+ "print": 1,
+ "read": 1,
+ "report": 1,
+ "role": "Accounts User",
+ "share": 1,
+ "write": 1
+ },
+ {
+ "email": 1,
+ "export": 1,
+ "permlevel": 1,
+ "print": 1,
+ "read": 1,
+ "report": 1,
+ "role": "Accounts Manager",
+ "share": 1,
+ "write": 1
+ }
+ ],
+ "sort_field": "modified",
+ "sort_order": "DESC",
+ "states": []
+}
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/repost_payment_ledger/repost_payment_ledger.py b/erpnext/accounts/doctype/repost_payment_ledger/repost_payment_ledger.py
new file mode 100644
index 0000000..9f6828f
--- /dev/null
+++ b/erpnext/accounts/doctype/repost_payment_ledger/repost_payment_ledger.py
@@ -0,0 +1,111 @@
+# Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+import copy
+
+import frappe
+from frappe import _, qb
+from frappe.model.document import Document
+from frappe.query_builder.custom import ConstantColumn
+from frappe.utils.background_jobs import is_job_queued
+
+from erpnext.accounts.utils import _delete_pl_entries, create_payment_ledger_entry
+
+VOUCHER_TYPES = ["Sales Invoice", "Purchase Invoice", "Payment Entry", "Journal Entry"]
+
+
+def repost_ple_for_voucher(voucher_type, voucher_no, gle_map=None):
+ if voucher_type and voucher_no and gle_map:
+ _delete_pl_entries(voucher_type, voucher_no)
+ create_payment_ledger_entry(gle_map, cancel=0)
+
+
+@frappe.whitelist()
+def start_payment_ledger_repost(docname=None):
+ """
+ Repost Payment Ledger Entries for Vouchers through Background Job
+ """
+ if docname:
+ repost_doc = frappe.get_doc("Repost Payment Ledger", docname)
+ if repost_doc.docstatus == 1 and repost_doc.repost_status in ["Queued", "Failed"]:
+ try:
+ for entry in repost_doc.repost_vouchers:
+ doc = frappe.get_doc(entry.voucher_type, entry.voucher_no)
+
+ if doc.doctype in ["Payment Entry", "Journal Entry"]:
+ gle_map = doc.build_gl_map()
+ else:
+ gle_map = doc.get_gl_entries()
+
+ repost_ple_for_voucher(entry.voucher_type, entry.voucher_no, gle_map)
+
+ frappe.db.set_value(repost_doc.doctype, repost_doc.name, "repost_error_log", "")
+ frappe.db.set_value(repost_doc.doctype, repost_doc.name, "repost_status", "Completed")
+ except Exception as e:
+ frappe.db.rollback()
+
+ traceback = frappe.get_traceback()
+ if traceback:
+ message = "Traceback: <br>" + traceback
+ frappe.db.set_value(repost_doc.doctype, repost_doc.name, "repost_error_log", message)
+
+ frappe.db.set_value(repost_doc.doctype, repost_doc.name, "repost_status", "Failed")
+
+
+class RepostPaymentLedger(Document):
+ def __init__(self, *args, **kwargs):
+ super(RepostPaymentLedger, self).__init__(*args, **kwargs)
+ self.vouchers = []
+
+ def before_validate(self):
+ self.load_vouchers_based_on_filters()
+ self.set_status()
+
+ def load_vouchers_based_on_filters(self):
+ if not self.add_manually:
+ self.repost_vouchers.clear()
+ self.get_vouchers()
+ self.extend("repost_vouchers", copy.deepcopy(self.vouchers))
+
+ def get_vouchers(self):
+ self.vouchers.clear()
+
+ filter_on_voucher_types = [self.voucher_type] if self.voucher_type else VOUCHER_TYPES
+
+ for vtype in filter_on_voucher_types:
+ doc = qb.DocType(vtype)
+ doctype_name = ConstantColumn(vtype)
+ query = (
+ qb.from_(doc)
+ .select(doctype_name.as_("voucher_type"), doc.name.as_("voucher_no"))
+ .where(
+ (doc.docstatus == 1)
+ & (doc.company == self.company)
+ & (doc.posting_date.gte(self.posting_date))
+ )
+ )
+ entries = query.run(as_dict=True)
+ self.vouchers.extend(entries)
+
+ def set_status(self):
+ if self.docstatus == 0:
+ self.repost_status = "Queued"
+
+ def on_submit(self):
+ execute_repost_payment_ledger(self.name)
+ frappe.msgprint(_("Repost started in the background"))
+
+
+@frappe.whitelist()
+def execute_repost_payment_ledger(docname):
+ """Repost Payment Ledger Entries by background job."""
+
+ job_name = "payment_ledger_repost_" + docname
+
+ if not is_job_queued(job_name):
+ frappe.enqueue(
+ method="erpnext.accounts.doctype.repost_payment_ledger.repost_payment_ledger.start_payment_ledger_repost",
+ docname=docname,
+ is_async=True,
+ job_name=job_name,
+ )
diff --git a/erpnext/accounts/doctype/repost_payment_ledger/repost_payment_ledger_list.js b/erpnext/accounts/doctype/repost_payment_ledger/repost_payment_ledger_list.js
new file mode 100644
index 0000000..e045184
--- /dev/null
+++ b/erpnext/accounts/doctype/repost_payment_ledger/repost_payment_ledger_list.js
@@ -0,0 +1,12 @@
+frappe.listview_settings["Repost Payment Ledger"] = {
+ add_fields: ["repost_status"],
+ get_indicator: function(doc) {
+ var colors = {
+ 'Queued': 'orange',
+ 'Completed': 'green',
+ 'Failed': 'red',
+ };
+ let status = doc.repost_status;
+ return [__(status), colors[status], 'status,=,'+status];
+ },
+};
diff --git a/erpnext/accounts/doctype/repost_payment_ledger/test_repost_payment_ledger.py b/erpnext/accounts/doctype/repost_payment_ledger/test_repost_payment_ledger.py
new file mode 100644
index 0000000..781726a
--- /dev/null
+++ b/erpnext/accounts/doctype/repost_payment_ledger/test_repost_payment_ledger.py
@@ -0,0 +1,9 @@
+# Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and Contributors
+# See license.txt
+
+# import frappe
+from frappe.tests.utils import FrappeTestCase
+
+
+class TestRepostPaymentLedger(FrappeTestCase):
+ pass
diff --git a/erpnext/accounts/doctype/repost_payment_ledger_items/__init__.py b/erpnext/accounts/doctype/repost_payment_ledger_items/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/accounts/doctype/repost_payment_ledger_items/__init__.py
diff --git a/erpnext/accounts/doctype/repost_payment_ledger_items/repost_payment_ledger_items.json b/erpnext/accounts/doctype/repost_payment_ledger_items/repost_payment_ledger_items.json
new file mode 100644
index 0000000..93005ee
--- /dev/null
+++ b/erpnext/accounts/doctype/repost_payment_ledger_items/repost_payment_ledger_items.json
@@ -0,0 +1,35 @@
+{
+ "actions": [],
+ "creation": "2022-10-20 10:44:18.796489",
+ "doctype": "DocType",
+ "engine": "InnoDB",
+ "field_order": [
+ "voucher_type",
+ "voucher_no"
+ ],
+ "fields": [
+ {
+ "fieldname": "voucher_type",
+ "fieldtype": "Link",
+ "label": "Voucher Type",
+ "options": "DocType"
+ },
+ {
+ "fieldname": "voucher_no",
+ "fieldtype": "Dynamic Link",
+ "label": "Voucher No",
+ "options": "voucher_type"
+ }
+ ],
+ "istable": 1,
+ "links": [],
+ "modified": "2022-10-28 14:47:11.838109",
+ "modified_by": "Administrator",
+ "module": "Accounts",
+ "name": "Repost Payment Ledger Items",
+ "owner": "Administrator",
+ "permissions": [],
+ "sort_field": "modified",
+ "sort_order": "DESC",
+ "states": []
+}
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/repost_payment_ledger_items/repost_payment_ledger_items.py b/erpnext/accounts/doctype/repost_payment_ledger_items/repost_payment_ledger_items.py
new file mode 100644
index 0000000..fb19e84
--- /dev/null
+++ b/erpnext/accounts/doctype/repost_payment_ledger_items/repost_payment_ledger_items.py
@@ -0,0 +1,9 @@
+# Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+# import frappe
+from frappe.model.document import Document
+
+
+class RepostPaymentLedgerItems(Document):
+ pass
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
index 73ec051..7abf3f3 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
@@ -64,6 +64,25 @@
this.frm.toggle_reqd("due_date", !this.frm.doc.is_return);
+ if (this.frm.doc.repost_required && this.frm.doc.docstatus===1) {
+ this.frm.set_intro(__("Accounting entries for this invoice needs to be reposted. Please click on 'Repost' button to update."));
+ this.frm.add_custom_button(__('Repost Accounting Entries'),
+ () => {
+ this.frm.call({
+ doc: this.frm.doc,
+ method: 'repost_accounting_entries',
+ freeze: true,
+ freeze_message: __('Reposting...'),
+ callback: (r) => {
+ if (!r.exc) {
+ frappe.msgprint(__('Accounting Entries are reposted'));
+ me.frm.refresh();
+ }
+ }
+ });
+ }).removeClass('btn-default').addClass('btn-warning');
+ }
+
if (this.frm.doc.is_return) {
this.frm.return_print_format = "Sales Invoice Return";
}
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
index 97e5f40..dc2f9a9 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
@@ -207,6 +207,7 @@
"is_internal_customer",
"is_discounted",
"remarks",
+ "repost_required",
"connections_tab"
],
"fields": [
@@ -1035,6 +1036,7 @@
"read_only": 1
},
{
+ "allow_on_submit": 1,
"depends_on": "redeem_loyalty_points",
"fieldname": "loyalty_redemption_account",
"fieldtype": "Link",
@@ -1333,6 +1335,7 @@
"options": "fa fa-money"
},
{
+ "allow_on_submit": 1,
"depends_on": "is_pos",
"fieldname": "cash_bank_account",
"fieldtype": "Link",
@@ -1432,6 +1435,7 @@
"print_hide": 1
},
{
+ "allow_on_submit": 1,
"depends_on": "is_pos",
"fieldname": "account_for_change_amount",
"fieldtype": "Link",
@@ -1480,6 +1484,7 @@
"hide_seconds": 1
},
{
+ "allow_on_submit": 1,
"fieldname": "write_off_account",
"fieldtype": "Link",
"hide_days": 1,
@@ -1703,6 +1708,7 @@
"read_only": 1
},
{
+ "allow_on_submit": 1,
"default": "No",
"fieldname": "is_opening",
"fieldtype": "Select",
@@ -1917,6 +1923,7 @@
"read_only": 1
},
{
+ "allow_on_submit": 1,
"depends_on": "eval:doc.is_internal_customer",
"description": "Unrealized Profit / Loss account for intra-company transfers",
"fieldname": "unrealized_profit_loss_account",
@@ -1959,6 +1966,7 @@
"label": "Disable Rounded Total"
},
{
+ "allow_on_submit": 1,
"fieldname": "additional_discount_account",
"fieldtype": "Link",
"label": "Discount Account",
@@ -2090,13 +2098,22 @@
{
"collapsible": 1,
"collapsible_depends_on": "write_off_amount",
- "depends_on": "grand_total",
+ "depends_on": "is_pos",
"fieldname": "write_off_section",
"fieldtype": "Section Break",
"hide_days": 1,
"hide_seconds": 1,
"label": "Write Off",
"width": "50%"
+ },
+ {
+ "default": "0",
+ "fieldname": "repost_required",
+ "fieldtype": "Check",
+ "hidden": 1,
+ "label": "Repost Required",
+ "no_copy": 1,
+ "read_only": 1
}
],
"icon": "fa fa-file-text",
@@ -2109,7 +2126,7 @@
"link_fieldname": "consolidated_invoice"
}
],
- "modified": "2022-10-11 13:07:36.488095",
+ "modified": "2022-11-15 09:33:47.870616",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Sales Invoice",
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
index 0c03c55..62cf0dc 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
@@ -11,6 +11,9 @@
import erpnext
from erpnext.accounts.deferred_revenue import validate_service_stop_date
+from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import (
+ get_accounting_dimensions,
+)
from erpnext.accounts.doctype.loyalty_program.loyalty_program import (
get_loyalty_program_details_with_points,
validate_loyalty_points,
@@ -100,13 +103,11 @@
self.validate_debit_to_acc()
self.clear_unallocated_advances("Sales Invoice Advance", "advances")
self.add_remarks()
- self.validate_write_off_account()
- self.validate_account_for_change_amount()
self.validate_fixed_asset()
self.set_income_account_for_fixed_assets()
self.validate_item_cost_centers()
- self.validate_income_account()
self.check_conversion_rate()
+ self.validate_accounts()
validate_inter_company_party(
self.doctype, self.customer, self.company, self.inter_company_invoice_reference
@@ -170,6 +171,11 @@
self.reset_default_field_value("set_warehouse", "items", "warehouse")
+ def validate_accounts(self):
+ self.validate_write_off_account()
+ self.validate_account_for_change_amount()
+ self.validate_income_account()
+
def validate_fixed_asset(self):
for d in self.get("items"):
if d.is_fixed_asset and d.meta.get_field("asset") and d.asset:
@@ -367,7 +373,8 @@
if self.update_stock == 1:
self.repost_future_sle_and_gle()
- frappe.db.set(self, "status", "Cancelled")
+ self.db_set("status", "Cancelled")
+ self.db_set("repost_required", 0)
if (
frappe.db.get_single_value("Selling Settings", "sales_update_frequency") == "Each Transaction"
@@ -514,6 +521,93 @@
def on_update(self):
self.set_paid_amount()
+ def on_update_after_submit(self):
+ if hasattr(self, "repost_required"):
+ needs_repost = 0
+
+ # Check if any field affecting accounting entry is altered
+ doc_before_update = self.get_doc_before_save()
+ accounting_dimensions = get_accounting_dimensions() + ["cost_center", "project"]
+
+ # Check if opening entry check updated
+ if doc_before_update.get("is_opening") != self.is_opening:
+ needs_repost = 1
+
+ if not needs_repost:
+ # Parent Level Accounts excluding party account
+ for field in (
+ "additional_discount_account",
+ "cash_bank_account",
+ "account_for_change_amount",
+ "write_off_account",
+ "loyalty_redemption_account",
+ "unrealized_profit_loss_account",
+ ):
+ if doc_before_update.get(field) != self.get(field):
+ needs_repost = 1
+ break
+
+ # Check for parent accounting dimensions
+ for dimension in accounting_dimensions:
+ if doc_before_update.get(dimension) != self.get(dimension):
+ needs_repost = 1
+ break
+
+ # Check for child tables
+ if self.check_if_child_table_updated(
+ "items",
+ doc_before_update,
+ ("income_account", "expense_account", "discount_account"),
+ accounting_dimensions,
+ ):
+ needs_repost = 1
+
+ if self.check_if_child_table_updated(
+ "taxes", doc_before_update, ("account_head",), accounting_dimensions
+ ):
+ needs_repost = 1
+
+ self.validate_accounts()
+
+ # validate if deferred revenue is enabled for any item
+ # Don't allow to update the invoice if deferred revenue is enabled
+ if needs_repost:
+ for item in self.get("items"):
+ if item.enable_deferred_revenue:
+ frappe.throw(
+ _(
+ "Deferred Revenue is enabled for item {0}. You cannot update the invoice after submission."
+ ).format(item.item_code)
+ )
+
+ self.db_set("repost_required", needs_repost)
+
+ def check_if_child_table_updated(
+ self, child_table, doc_before_update, fields_to_check, accounting_dimensions
+ ):
+ # Check if any field affecting accounting entry is altered
+ for index, item in enumerate(self.get(child_table)):
+ for field in fields_to_check:
+ if doc_before_update.get(child_table)[index].get(field) != item.get(field):
+ return True
+
+ for dimension in accounting_dimensions:
+ if doc_before_update.get(child_table)[index].get(dimension) != item.get(dimension):
+ return True
+
+ return False
+
+ @frappe.whitelist()
+ def repost_accounting_entries(self):
+ if self.repost_required:
+ self.docstatus = 2
+ self.make_gl_entries_on_cancel()
+ self.docstatus = 1
+ self.make_gl_entries()
+ self.db_set("repost_required", 0)
+ else:
+ frappe.throw(_("No updates pending for reposting"))
+
def set_paid_amount(self):
paid_amount = 0.0
base_paid_amount = 0.0
@@ -1300,7 +1394,11 @@
def make_write_off_gl_entry(self, gl_entries):
# write off entries, applicable if only pos
- if self.write_off_account and flt(self.write_off_amount, self.precision("write_off_amount")):
+ if (
+ self.is_pos
+ and self.write_off_account
+ and flt(self.write_off_amount, self.precision("write_off_amount"))
+ ):
write_off_account_currency = get_account_currency(self.write_off_account)
default_cost_center = frappe.get_cached_value("Company", self.company, "cost_center")
@@ -2306,7 +2404,7 @@
lp_details = get_loyalty_programs(customer)
if len(lp_details) == 1:
- frappe.db.set(customer, "loyalty_program", lp_details[0])
+ customer.db_set("loyalty_program", lp_details[0])
return lp_details
else:
return lp_details
diff --git a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
index cb0d1a7..855380e 100644
--- a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
@@ -2729,6 +2729,31 @@
check_gl_entries(self, si.name, expected_gle, add_days(nowdate(), -1))
+ # Update Invoice post submit and then check GL Entries again
+
+ si.load_from_db()
+ si.items[0].income_account = "Service - _TC"
+ si.additional_discount_account = "_Test Account Sales - _TC"
+ si.taxes[0].account_head = "TDS Payable - _TC"
+ si.save()
+
+ si.load_from_db()
+ self.assertTrue(si.repost_required)
+
+ si.repost_accounting_entries()
+
+ expected_gle = [
+ ["_Test Account Sales - _TC", 22.0, 0.0, nowdate()],
+ ["Debtors - _TC", 88, 0.0, nowdate()],
+ ["Service - _TC", 0.0, 100.0, nowdate()],
+ ["TDS Payable - _TC", 0.0, 10.0, nowdate()],
+ ]
+
+ check_gl_entries(self, si.name, expected_gle, add_days(nowdate(), -1))
+
+ si.load_from_db()
+ self.assertFalse(si.repost_required)
+
def test_asset_depreciation_on_sale_with_pro_rata(self):
"""
Tests if an Asset set to depreciate yearly on June 30, that gets sold on Sept 30, creates an additional depreciation entry on its date of sale.
@@ -3286,6 +3311,7 @@
"""select account, debit, credit, posting_date
from `tabGL Entry`
where voucher_type='Sales Invoice' and voucher_no=%s and posting_date > %s
+ and is_cancelled = 0
order by posting_date asc, account asc""",
(voucher_no, posting_date),
as_dict=1,
diff --git a/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json b/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json
index 7f1a1ec..62c3ced 100644
--- a/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json
+++ b/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json
@@ -8,6 +8,7 @@
"engine": "InnoDB",
"field_order": [
"barcode",
+ "has_item_scanned",
"item_code",
"col_break1",
"item_name",
@@ -437,6 +438,7 @@
"label": "Accounting Details"
},
{
+ "allow_on_submit": 1,
"fieldname": "income_account",
"fieldtype": "Link",
"label": "Income Account",
@@ -449,6 +451,7 @@
"width": "120px"
},
{
+ "allow_on_submit": 1,
"fieldname": "expense_account",
"fieldtype": "Link",
"label": "Expense Account",
@@ -468,6 +471,7 @@
"print_hide": 1
},
{
+ "allow_on_submit": 1,
"default": ":Company",
"fieldname": "cost_center",
"fieldtype": "Link",
@@ -799,6 +803,7 @@
"options": "Finance Book"
},
{
+ "allow_on_submit": 1,
"fieldname": "project",
"fieldtype": "Link",
"label": "Project",
@@ -821,7 +826,6 @@
"label": "Incoming Rate (Costing)",
"no_copy": 1,
"options": "Company:company:default_currency",
- "precision": "6",
"print_hide": 1
},
{
@@ -834,6 +838,7 @@
"read_only": 1
},
{
+ "allow_on_submit": 1,
"fieldname": "discount_account",
"fieldtype": "Link",
"label": "Discount Account",
@@ -872,12 +877,20 @@
"label": "Purchase Order Item",
"print_hide": 1,
"read_only": 1
+ },
+ {
+ "default": "0",
+ "depends_on": "barcode",
+ "fieldname": "has_item_scanned",
+ "fieldtype": "Check",
+ "label": "Has Item Scanned",
+ "read_only": 1
}
],
"idx": 1,
"istable": 1,
"links": [],
- "modified": "2022-10-26 11:38:36.119339",
+ "modified": "2022-11-02 12:53:12.693217",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Sales Invoice Item",
diff --git a/erpnext/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.json b/erpnext/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.json
index 3a871bf..e236577 100644
--- a/erpnext/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.json
+++ b/erpnext/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.json
@@ -51,6 +51,7 @@
"oldfieldtype": "Data"
},
{
+ "allow_on_submit": 1,
"columns": 2,
"fieldname": "account_head",
"fieldtype": "Link",
@@ -63,6 +64,7 @@
"search_index": 1
},
{
+ "allow_on_submit": 1,
"default": ":Company",
"fieldname": "cost_center",
"fieldtype": "Link",
@@ -216,12 +218,13 @@
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
- "modified": "2021-08-05 20:04:01.726867",
+ "modified": "2022-10-17 13:08:17.776528",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Sales Taxes and Charges",
"owner": "Administrator",
"permissions": [],
"sort_field": "modified",
- "sort_order": "ASC"
+ "sort_order": "ASC",
+ "states": []
}
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.py b/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.py
index 7eddd81..30ed91b 100644
--- a/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.py
+++ b/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.py
@@ -61,6 +61,9 @@
def get_party_tax_withholding_details(inv, tax_withholding_category=None):
+ if inv.doctype == "Payment Entry":
+ inv.tax_withholding_net_total = inv.net_total
+
pan_no = ""
parties = []
party_type, party = get_party_details(inv)
@@ -242,7 +245,7 @@
if party_type == "Supplier":
ldc = get_lower_deduction_certificate(tax_details, pan_no)
if tax_deducted:
- net_total = inv.net_total
+ net_total = inv.tax_withholding_net_total
if ldc:
tax_amount = get_tds_amount_from_ldc(
ldc, parties, pan_no, tax_details, posting_date, net_total
@@ -272,6 +275,11 @@
def get_invoice_vouchers(parties, tax_details, company, party_type="Supplier"):
doctype = "Purchase Invoice" if party_type == "Supplier" else "Sales Invoice"
+ field = (
+ "base_tax_withholding_net_total as base_net_total"
+ if party_type == "Supplier"
+ else "base_net_total"
+ )
voucher_wise_amount = {}
vouchers = []
@@ -288,7 +296,7 @@
{"apply_tds": 1, "tax_withholding_category": tax_details.get("tax_withholding_category")}
)
- invoices_details = frappe.get_all(doctype, filters=filters, fields=["name", "base_net_total"])
+ invoices_details = frappe.get_all(doctype, filters=filters, fields=["name", field])
for d in invoices_details:
vouchers.append(d.name)
@@ -392,7 +400,7 @@
tds_amount = 0
invoice_filters = {"name": ("in", vouchers), "docstatus": 1, "apply_tds": 1}
- field = "sum(net_total)"
+ field = "sum(tax_withholding_net_total)"
if cint(tax_details.consider_party_ledger_amount):
invoice_filters.pop("apply_tds", None)
@@ -415,12 +423,12 @@
)
supp_credit_amt += supp_jv_credit_amt
- supp_credit_amt += inv.net_total
+ supp_credit_amt += inv.tax_withholding_net_total
threshold = tax_details.get("threshold", 0)
cumulative_threshold = tax_details.get("cumulative_threshold", 0)
- if (threshold and inv.net_total >= threshold) or (
+ if (threshold and inv.tax_withholding_net_total >= threshold) or (
cumulative_threshold and supp_credit_amt >= cumulative_threshold
):
if (cumulative_threshold and supp_credit_amt >= cumulative_threshold) and cint(
@@ -428,11 +436,11 @@
):
# Get net total again as TDS is calculated on net total
# Grand is used to just check for threshold breach
- net_total = 0
- if vouchers:
- net_total = frappe.db.get_value("Purchase Invoice", invoice_filters, "sum(net_total)")
-
- net_total += inv.net_total
+ net_total = (
+ frappe.db.get_value("Purchase Invoice", invoice_filters, "sum(tax_withholding_net_total)")
+ or 0.0
+ )
+ net_total += inv.tax_withholding_net_total
supp_credit_amt = net_total - cumulative_threshold
if ldc and is_valid_certificate(
@@ -440,7 +448,7 @@
ldc.valid_upto,
inv.get("posting_date") or inv.get("transaction_date"),
tax_deducted,
- inv.net_total,
+ inv.tax_withholding_net_total,
ldc.certificate_limit,
):
tds_amount = get_ltds_amount(supp_credit_amt, 0, ldc.certificate_limit, ldc.rate, tax_details)
@@ -523,7 +531,7 @@
limit_consumed = frappe.db.get_value(
"Purchase Invoice",
{"supplier": ("in", parties), "apply_tds": 1, "docstatus": 1},
- "sum(net_total)",
+ "sum(tax_withholding_net_total)",
)
if is_valid_certificate(
diff --git a/erpnext/accounts/doctype/tax_withholding_category/test_tax_withholding_category.py b/erpnext/accounts/doctype/tax_withholding_category/test_tax_withholding_category.py
index e80fe11..40c732b 100644
--- a/erpnext/accounts/doctype/tax_withholding_category/test_tax_withholding_category.py
+++ b/erpnext/accounts/doctype/tax_withholding_category/test_tax_withholding_category.py
@@ -186,6 +186,46 @@
for d in reversed(invoices):
d.cancel()
+ def test_tds_calculation_on_net_total_partial_tds(self):
+ frappe.db.set_value(
+ "Supplier", "Test TDS Supplier4", "tax_withholding_category", "Cumulative Threshold TDS"
+ )
+ invoices = []
+
+ pi = create_purchase_invoice(supplier="Test TDS Supplier4", rate=20000, do_not_save=True)
+ pi.extend(
+ "items",
+ [
+ {
+ "doctype": "Purchase Invoice Item",
+ "item_code": frappe.db.get_value("Item", {"item_name": "TDS Item"}, "name"),
+ "qty": 1,
+ "rate": 20000,
+ "cost_center": "Main - _TC",
+ "expense_account": "Stock Received But Not Billed - _TC",
+ "apply_tds": 0,
+ },
+ {
+ "doctype": "Purchase Invoice Item",
+ "item_code": frappe.db.get_value("Item", {"item_name": "TDS Item"}, "name"),
+ "qty": 1,
+ "rate": 35000,
+ "cost_center": "Main - _TC",
+ "expense_account": "Stock Received But Not Billed - _TC",
+ "apply_tds": 1,
+ },
+ ],
+ )
+ pi.save()
+ pi.submit()
+ invoices.append(pi)
+
+ self.assertEqual(pi.taxes[0].tax_amount, 5500)
+
+ # cancel invoices to avoid clashing
+ for d in reversed(invoices):
+ d.cancel()
+
def test_multi_category_single_supplier(self):
frappe.db.set_value(
"Supplier", "Test TDS Supplier5", "tax_withholding_category", "Test Service Category"
diff --git a/erpnext/accounts/report/gross_profit/gross_profit.py b/erpnext/accounts/report/gross_profit/gross_profit.py
index f0106be..dacc809 100644
--- a/erpnext/accounts/report/gross_profit/gross_profit.py
+++ b/erpnext/accounts/report/gross_profit/gross_profit.py
@@ -3,7 +3,8 @@
import frappe
-from frappe import _, scrub
+from frappe import _, qb, scrub
+from frappe.query_builder import Order
from frappe.utils import cint, flt, formatdate
from erpnext.controllers.queries import get_match_cond
@@ -398,6 +399,7 @@
self.average_buying_rate = {}
self.filters = frappe._dict(filters)
self.load_invoice_items()
+ self.get_delivery_notes()
if filters.group_by == "Invoice":
self.group_items_by_invoice()
@@ -591,6 +593,21 @@
return flt(buying_amount, self.currency_precision)
+ def calculate_buying_amount_from_sle(self, row, my_sle, parenttype, parent, item_row, item_code):
+ for i, sle in enumerate(my_sle):
+ # find the stock valution rate from stock ledger entry
+ if (
+ sle.voucher_type == parenttype
+ and parent == sle.voucher_no
+ and sle.voucher_detail_no == item_row
+ ):
+ previous_stock_value = len(my_sle) > i + 1 and flt(my_sle[i + 1].stock_value) or 0.0
+
+ if previous_stock_value:
+ return abs(previous_stock_value - flt(sle.stock_value)) * flt(row.qty) / abs(flt(sle.qty))
+ else:
+ return flt(row.qty) * self.get_average_buying_rate(row, item_code)
+
def get_buying_amount(self, row, item_code):
# IMP NOTE
# stock_ledger_entries should already be filtered by item_code and warehouse and
@@ -607,19 +624,22 @@
if row.dn_detail:
parenttype, parent = "Delivery Note", row.delivery_note
- for i, sle in enumerate(my_sle):
- # find the stock valution rate from stock ledger entry
- if (
- sle.voucher_type == parenttype
- and parent == sle.voucher_no
- and sle.voucher_detail_no == row.item_row
- ):
- previous_stock_value = len(my_sle) > i + 1 and flt(my_sle[i + 1].stock_value) or 0.0
-
- if previous_stock_value:
- return abs(previous_stock_value - flt(sle.stock_value)) * flt(row.qty) / abs(flt(sle.qty))
- else:
- return flt(row.qty) * self.get_average_buying_rate(row, item_code)
+ return self.calculate_buying_amount_from_sle(
+ row, my_sle, parenttype, parent, row.item_row, item_code
+ )
+ elif self.delivery_notes.get((row.parent, row.item_code), None):
+ # check if Invoice has delivery notes
+ dn = self.delivery_notes.get((row.parent, row.item_code))
+ parenttype, parent, item_row, warehouse = (
+ "Delivery Note",
+ dn["delivery_note"],
+ dn["item_row"],
+ dn["warehouse"],
+ )
+ my_sle = self.sle.get((item_code, warehouse))
+ return self.calculate_buying_amount_from_sle(
+ row, my_sle, parenttype, parent, item_row, item_code
+ )
else:
return flt(row.qty) * self.get_average_buying_rate(row, item_code)
@@ -753,6 +773,29 @@
as_dict=1,
)
+ def get_delivery_notes(self):
+ self.delivery_notes = frappe._dict({})
+ if self.si_list:
+ invoices = [x.parent for x in self.si_list]
+ dni = qb.DocType("Delivery Note Item")
+ delivery_notes = (
+ qb.from_(dni)
+ .select(
+ dni.against_sales_invoice.as_("sales_invoice"),
+ dni.item_code,
+ dni.warehouse,
+ dni.parent.as_("delivery_note"),
+ dni.name.as_("item_row"),
+ )
+ .where((dni.docstatus == 1) & (dni.against_sales_invoice.isin(invoices)))
+ .groupby(dni.against_sales_invoice, dni.item_code)
+ .orderby(dni.creation, order=Order.desc)
+ .run(as_dict=True)
+ )
+
+ for entry in delivery_notes:
+ self.delivery_notes[(entry.sales_invoice, entry.item_code)] = entry
+
def group_items_by_invoice(self):
"""
Turns list of Sales Invoice Items to a tree of Sales Invoices with their Items as children.
diff --git a/erpnext/accounts/report/gross_profit/test_gross_profit.py b/erpnext/accounts/report/gross_profit/test_gross_profit.py
new file mode 100644
index 0000000..0ea6b5c
--- /dev/null
+++ b/erpnext/accounts/report/gross_profit/test_gross_profit.py
@@ -0,0 +1,209 @@
+import frappe
+from frappe import qb
+from frappe.tests.utils import FrappeTestCase
+from frappe.utils import add_days, flt, nowdate
+
+from erpnext.accounts.doctype.sales_invoice.sales_invoice import make_delivery_note
+from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice
+from erpnext.accounts.report.gross_profit.gross_profit import execute
+from erpnext.stock.doctype.item.test_item import create_item
+from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry
+
+
+class TestGrossProfit(FrappeTestCase):
+ def setUp(self):
+ self.create_company()
+ self.create_item()
+ self.create_customer()
+ self.create_sales_invoice()
+ self.clear_old_entries()
+
+ def tearDown(self):
+ frappe.db.rollback()
+
+ def create_company(self):
+ company_name = "_Test Gross Profit"
+ abbr = "_GP"
+ if frappe.db.exists("Company", company_name):
+ company = frappe.get_doc("Company", company_name)
+ else:
+ company = frappe.get_doc(
+ {
+ "doctype": "Company",
+ "company_name": company_name,
+ "country": "India",
+ "default_currency": "INR",
+ "create_chart_of_accounts_based_on": "Standard Template",
+ "chart_of_accounts": "Standard",
+ }
+ )
+ company = company.save()
+
+ self.company = company.name
+ self.cost_center = company.cost_center
+ self.warehouse = "Stores - " + abbr
+ self.income_account = "Sales - " + abbr
+ self.expense_account = "Cost of Goods Sold - " + abbr
+ self.debit_to = "Debtors - " + abbr
+ self.creditors = "Creditors - " + abbr
+
+ def create_item(self):
+ item = create_item(
+ item_code="_Test GP Item", is_stock_item=1, company=self.company, warehouse=self.warehouse
+ )
+ self.item = item if isinstance(item, str) else item.item_code
+
+ def create_customer(self):
+ name = "_Test GP Customer"
+ if frappe.db.exists("Customer", name):
+ self.customer = name
+ else:
+ customer = frappe.new_doc("Customer")
+ customer.customer_name = name
+ customer.type = "Individual"
+ customer.save()
+ self.customer = customer.name
+
+ def create_sales_invoice(
+ self, qty=1, rate=100, posting_date=nowdate(), do_not_save=False, do_not_submit=False
+ ):
+ """
+ Helper function to populate default values in sales invoice
+ """
+ sinv = create_sales_invoice(
+ qty=qty,
+ rate=rate,
+ company=self.company,
+ customer=self.customer,
+ item_code=self.item,
+ item_name=self.item,
+ cost_center=self.cost_center,
+ warehouse=self.warehouse,
+ debit_to=self.debit_to,
+ parent_cost_center=self.cost_center,
+ update_stock=0,
+ currency="INR",
+ is_pos=0,
+ is_return=0,
+ return_against=None,
+ income_account=self.income_account,
+ expense_account=self.expense_account,
+ do_not_save=do_not_save,
+ do_not_submit=do_not_submit,
+ )
+ return sinv
+
+ def clear_old_entries(self):
+ doctype_list = [
+ "Sales Invoice",
+ "GL Entry",
+ "Payment Ledger Entry",
+ "Stock Entry",
+ "Stock Ledger Entry",
+ "Delivery Note",
+ ]
+ for doctype in doctype_list:
+ qb.from_(qb.DocType(doctype)).delete().where(qb.DocType(doctype).company == self.company).run()
+
+ def test_invoice_without_only_delivery_note(self):
+ """
+ Test buying amount for Invoice without `update_stock` flag set but has Delivery Note
+ """
+ se = make_stock_entry(
+ company=self.company,
+ item_code=self.item,
+ target=self.warehouse,
+ qty=1,
+ basic_rate=100,
+ do_not_submit=True,
+ )
+ item = se.items[0]
+ se.append(
+ "items",
+ {
+ "item_code": item.item_code,
+ "s_warehouse": item.s_warehouse,
+ "t_warehouse": item.t_warehouse,
+ "qty": 1,
+ "basic_rate": 200,
+ "conversion_factor": item.conversion_factor or 1.0,
+ "transfer_qty": flt(item.qty) * (flt(item.conversion_factor) or 1.0),
+ "serial_no": item.serial_no,
+ "batch_no": item.batch_no,
+ "cost_center": item.cost_center,
+ "expense_account": item.expense_account,
+ },
+ )
+ se = se.save().submit()
+
+ sinv = create_sales_invoice(
+ qty=1,
+ rate=100,
+ company=self.company,
+ customer=self.customer,
+ item_code=self.item,
+ item_name=self.item,
+ cost_center=self.cost_center,
+ warehouse=self.warehouse,
+ debit_to=self.debit_to,
+ parent_cost_center=self.cost_center,
+ update_stock=0,
+ currency="INR",
+ income_account=self.income_account,
+ expense_account=self.expense_account,
+ )
+
+ filters = frappe._dict(
+ company=self.company, from_date=nowdate(), to_date=nowdate(), group_by="Invoice"
+ )
+
+ columns, data = execute(filters=filters)
+
+ # Without Delivery Note, buying rate should be 150
+ expected_entry_without_dn = {
+ "parent_invoice": sinv.name,
+ "currency": "INR",
+ "sales_invoice": self.item,
+ "customer": self.customer,
+ "posting_date": frappe.utils.datetime.date.fromisoformat(nowdate()),
+ "item_code": self.item,
+ "item_name": self.item,
+ "warehouse": "Stores - _GP",
+ "qty": 1.0,
+ "avg._selling_rate": 100.0,
+ "valuation_rate": 150.0,
+ "selling_amount": 100.0,
+ "buying_amount": 150.0,
+ "gross_profit": -50.0,
+ "gross_profit_%": -50.0,
+ }
+ gp_entry = [x for x in data if x.parent_invoice == sinv.name]
+ self.assertDictContainsSubset(expected_entry_without_dn, gp_entry[0])
+
+ # make delivery note
+ dn = make_delivery_note(sinv.name)
+ dn.items[0].qty = 1
+ dn = dn.save().submit()
+
+ columns, data = execute(filters=filters)
+
+ # Without Delivery Note, buying rate should be 100
+ expected_entry_with_dn = {
+ "parent_invoice": sinv.name,
+ "currency": "INR",
+ "sales_invoice": self.item,
+ "customer": self.customer,
+ "posting_date": frappe.utils.datetime.date.fromisoformat(nowdate()),
+ "item_code": self.item,
+ "item_name": self.item,
+ "warehouse": "Stores - _GP",
+ "qty": 1.0,
+ "avg._selling_rate": 100.0,
+ "valuation_rate": 100.0,
+ "selling_amount": 100.0,
+ "buying_amount": 100.0,
+ "gross_profit": 0.0,
+ "gross_profit_%": 0.0,
+ }
+ gp_entry = [x for x in data if x.parent_invoice == sinv.name]
+ self.assertDictContainsSubset(expected_entry_with_dn, gp_entry[0])
diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py
index e9ff1d9..4aed7ce 100644
--- a/erpnext/accounts/utils.py
+++ b/erpnext/accounts/utils.py
@@ -1146,10 +1146,10 @@
if not existing_gle or not compare_existing_and_expected_gle(
existing_gle, expected_gle, precision
):
- _delete_gl_entries(voucher_type, voucher_no)
+ _delete_accounting_ledger_entries(voucher_type, voucher_no)
voucher_obj.make_gl_entries(gl_entries=expected_gle, from_repost=True)
else:
- _delete_gl_entries(voucher_type, voucher_no)
+ _delete_accounting_ledger_entries(voucher_type, voucher_no)
if not frappe.flags.in_test:
frappe.db.commit()
@@ -1161,18 +1161,28 @@
)
-def _delete_gl_entries(voucher_type, voucher_no):
- frappe.db.sql(
- """delete from `tabGL Entry`
- where voucher_type=%s and voucher_no=%s""",
- (voucher_type, voucher_no),
- )
+def _delete_pl_entries(voucher_type, voucher_no):
ple = qb.DocType("Payment Ledger Entry")
qb.from_(ple).delete().where(
(ple.voucher_type == voucher_type) & (ple.voucher_no == voucher_no)
).run()
+def _delete_gl_entries(voucher_type, voucher_no):
+ gle = qb.DocType("GL Entry")
+ qb.from_(gle).delete().where(
+ (gle.voucher_type == voucher_type) & (gle.voucher_no == voucher_no)
+ ).run()
+
+
+def _delete_accounting_ledger_entries(voucher_type, voucher_no):
+ """
+ Remove entries from both General and Payment Ledger for specified Voucher
+ """
+ _delete_gl_entries(voucher_type, voucher_no)
+ _delete_pl_entries(voucher_type, voucher_no)
+
+
def sort_stock_vouchers_by_posting_date(
stock_vouchers: List[Tuple[str, str]]
) -> List[Tuple[str, str]]:
diff --git a/erpnext/assets/doctype/asset/test_asset.py b/erpnext/assets/doctype/asset/test_asset.py
index 5c1311d..19c913a 100644
--- a/erpnext/assets/doctype/asset/test_asset.py
+++ b/erpnext/assets/doctype/asset/test_asset.py
@@ -230,9 +230,17 @@
self.assertTrue(asset.journal_entry_for_scrap)
expected_gle = (
- ("_Test Accumulated Depreciations - _TC", 18000.0 + pro_rata_amount, 0.0),
+ (
+ "_Test Accumulated Depreciations - _TC",
+ flt(18000.0 + pro_rata_amount, asset.precision("gross_purchase_amount")),
+ 0.0,
+ ),
("_Test Fixed Asset - _TC", 0.0, 100000.0),
- ("_Test Gain/Loss on Asset Disposal - _TC", 82000.0 - pro_rata_amount, 0.0),
+ (
+ "_Test Gain/Loss on Asset Disposal - _TC",
+ flt(82000.0 - pro_rata_amount, asset.precision("gross_purchase_amount")),
+ 0.0,
+ ),
)
gle = frappe.db.sql(
@@ -288,9 +296,17 @@
pro_rata_amount = flt(pro_rata_amount, asset.precision("gross_purchase_amount"))
expected_gle = (
- ("_Test Accumulated Depreciations - _TC", 18000.0 + pro_rata_amount, 0.0),
+ (
+ "_Test Accumulated Depreciations - _TC",
+ flt(18000.0 + pro_rata_amount, asset.precision("gross_purchase_amount")),
+ 0.0,
+ ),
("_Test Fixed Asset - _TC", 0.0, 100000.0),
- ("_Test Gain/Loss on Asset Disposal - _TC", 57000.0 - pro_rata_amount, 0.0),
+ (
+ "_Test Gain/Loss on Asset Disposal - _TC",
+ flt(57000.0 - pro_rata_amount, asset.precision("gross_purchase_amount")),
+ 0.0,
+ ),
("Debtors - _TC", 25000.0, 0.0),
)
diff --git a/erpnext/assets/doctype/location/location.py b/erpnext/assets/doctype/location/location.py
index 0d87bb2..5bff3dd 100644
--- a/erpnext/assets/doctype/location/location.py
+++ b/erpnext/assets/doctype/location/location.py
@@ -200,11 +200,11 @@
name as value,
is_group as expandable
from
- `tab{doctype}` comp
+ `tabLocation` comp
where
ifnull(parent_location, "")={parent}
""".format(
- doctype=doctype, parent=frappe.db.escape(parent)
+ parent=frappe.db.escape(parent)
),
as_dict=1,
)
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.json b/erpnext/buying/doctype/purchase_order/purchase_order.json
index 2193985..ded45b8 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.json
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.json
@@ -1108,7 +1108,8 @@
"fetch_from": "supplier.is_internal_supplier",
"fieldname": "is_internal_supplier",
"fieldtype": "Check",
- "label": "Is Internal Supplier"
+ "label": "Is Internal Supplier",
+ "read_only": 1
},
{
"fetch_from": "supplier.represents_company",
@@ -1232,7 +1233,7 @@
"idx": 105,
"is_submittable": 1,
"links": [],
- "modified": "2022-10-11 13:01:41.674352",
+ "modified": "2022-11-17 12:34:36.033363",
"modified_by": "Administrator",
"module": "Buying",
"name": "Purchase Order",
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.py b/erpnext/buying/doctype/purchase_order/purchase_order.py
index c224b61..4c10b48 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.py
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.py
@@ -361,7 +361,7 @@
self.update_reserved_qty_for_subcontract()
self.check_on_hold_or_closed_status()
- frappe.db.set(self, "status", "Cancelled")
+ self.db_set("status", "Cancelled")
self.update_prevdoc_status()
diff --git a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py
index ee28eb6..bdbc9ce 100644
--- a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py
+++ b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py
@@ -31,7 +31,7 @@
if self.docstatus < 1:
# after amend and save, status still shows as cancelled, until submit
- frappe.db.set(self, "status", "Draft")
+ self.db_set("status", "Draft")
def validate_duplicate_supplier(self):
supplier_list = [d.supplier for d in self.suppliers]
@@ -73,14 +73,14 @@
)
def on_submit(self):
- frappe.db.set(self, "status", "Submitted")
+ self.db_set("status", "Submitted")
for supplier in self.suppliers:
supplier.email_sent = 0
supplier.quote_status = "Pending"
self.send_to_supplier()
def on_cancel(self):
- frappe.db.set(self, "status", "Cancelled")
+ self.db_set("status", "Cancelled")
@frappe.whitelist()
def get_supplier_email_preview(self, supplier):
@@ -478,7 +478,7 @@
conditions += "and rfq.transaction_date = '{0}'".format(filters.get("transaction_date"))
rfq_data = frappe.db.sql(
- """
+ f"""
select
distinct rfq.name, rfq.transaction_date,
rfq.company
@@ -486,15 +486,18 @@
`tabRequest for Quotation` rfq, `tabRequest for Quotation Supplier` rfq_supplier
where
rfq.name = rfq_supplier.parent
- and rfq_supplier.supplier = '{0}'
+ and rfq_supplier.supplier = %(supplier)s
and rfq.docstatus = 1
- and rfq.company = '{1}'
- {2}
+ and rfq.company = %(company)s
+ {conditions}
order by rfq.transaction_date ASC
- limit %(page_len)s offset %(start)s """.format(
- filters.get("supplier"), filters.get("company"), conditions
- ),
- {"page_len": page_len, "start": start},
+ limit %(page_len)s offset %(start)s """,
+ {
+ "page_len": page_len,
+ "start": start,
+ "company": filters.get("company"),
+ "supplier": filters.get("supplier"),
+ },
as_dict=1,
)
diff --git a/erpnext/buying/doctype/supplier/supplier.json b/erpnext/buying/doctype/supplier/supplier.json
index e0ee658..66eafe9 100644
--- a/erpnext/buying/doctype/supplier/supplier.json
+++ b/erpnext/buying/doctype/supplier/supplier.json
@@ -10,34 +10,37 @@
"document_type": "Setup",
"engine": "InnoDB",
"field_order": [
- "basic_info",
"naming_series",
"supplier_name",
"country",
- "default_bank_account",
- "tax_id",
- "tax_category",
- "tax_withholding_category",
- "image",
"column_break0",
"supplier_group",
"supplier_type",
- "allow_purchase_invoice_creation_without_purchase_order",
- "allow_purchase_invoice_creation_without_purchase_receipt",
- "is_internal_supplier",
- "represents_company",
- "disabled",
"is_transporter",
- "warn_rfqs",
- "warn_pos",
- "prevent_rfqs",
- "prevent_pos",
- "allowed_to_transact_section",
- "companies",
- "section_break_7",
+ "image",
+ "defaults_section",
"default_currency",
+ "default_bank_account",
"column_break_10",
"default_price_list",
+ "payment_terms",
+ "internal_supplier_section",
+ "is_internal_supplier",
+ "represents_company",
+ "column_break_16",
+ "companies",
+ "column_break2",
+ "supplier_details",
+ "column_break_30",
+ "website",
+ "language",
+ "dashboard_tab",
+ "tax_tab",
+ "tax_id",
+ "column_break_27",
+ "tax_category",
+ "tax_withholding_category",
+ "contact_and_address_tab",
"address_contacts",
"address_html",
"column_break1",
@@ -49,31 +52,26 @@
"column_break_44",
"supplier_primary_address",
"primary_address",
- "default_payable_accounts",
+ "accounting_tab",
"accounts",
- "section_credit_limit",
- "payment_terms",
- "cb_21",
+ "settings_tab",
+ "allow_purchase_invoice_creation_without_purchase_order",
+ "allow_purchase_invoice_creation_without_purchase_receipt",
+ "column_break_54",
+ "is_frozen",
+ "disabled",
+ "warn_rfqs",
+ "warn_pos",
+ "prevent_rfqs",
+ "prevent_pos",
+ "block_supplier_section",
"on_hold",
"hold_type",
- "release_date",
- "default_tax_withholding_config",
- "column_break2",
- "website",
- "supplier_details",
- "column_break_30",
- "language",
- "is_frozen"
+ "column_break_59",
+ "release_date"
],
"fields": [
{
- "fieldname": "basic_info",
- "fieldtype": "Section Break",
- "label": "Name and Type",
- "oldfieldtype": "Section Break",
- "options": "fa fa-user"
- },
- {
"fieldname": "naming_series",
"fieldtype": "Select",
"label": "Series",
@@ -192,6 +190,7 @@
"default": "0",
"fieldname": "warn_rfqs",
"fieldtype": "Check",
+ "hidden": 1,
"label": "Warn RFQs",
"read_only": 1
},
@@ -199,6 +198,7 @@
"default": "0",
"fieldname": "warn_pos",
"fieldtype": "Check",
+ "hidden": 1,
"label": "Warn POs",
"read_only": 1
},
@@ -206,6 +206,7 @@
"default": "0",
"fieldname": "prevent_rfqs",
"fieldtype": "Check",
+ "hidden": 1,
"label": "Prevent RFQs",
"read_only": 1
},
@@ -213,29 +214,18 @@
"default": "0",
"fieldname": "prevent_pos",
"fieldtype": "Check",
+ "hidden": 1,
"label": "Prevent POs",
"read_only": 1
},
{
"depends_on": "represents_company",
- "fieldname": "allowed_to_transact_section",
- "fieldtype": "Section Break",
- "label": "Allowed To Transact With"
- },
- {
- "depends_on": "represents_company",
"fieldname": "companies",
"fieldtype": "Table",
"label": "Allowed To Transact With",
"options": "Allowed To Transact With"
},
{
- "collapsible": 1,
- "fieldname": "section_break_7",
- "fieldtype": "Section Break",
- "label": "Currency and Price List"
- },
- {
"fieldname": "default_currency",
"fieldtype": "Link",
"ignore_user_permissions": 1,
@@ -255,22 +245,12 @@
"options": "Price List"
},
{
- "collapsible": 1,
- "fieldname": "section_credit_limit",
- "fieldtype": "Section Break",
- "label": "Payment Terms"
- },
- {
"fieldname": "payment_terms",
"fieldtype": "Link",
"label": "Default Payment Terms Template",
"options": "Payment Terms Template"
},
{
- "fieldname": "cb_21",
- "fieldtype": "Column Break"
- },
- {
"default": "0",
"fieldname": "on_hold",
"fieldtype": "Check",
@@ -316,13 +296,6 @@
"read_only": 1
},
{
- "collapsible": 1,
- "collapsible_depends_on": "accounts",
- "fieldname": "default_payable_accounts",
- "fieldtype": "Section Break",
- "label": "Default Payable Accounts"
- },
- {
"description": "Mention if non-standard payable account",
"fieldname": "accounts",
"fieldtype": "Table",
@@ -331,12 +304,6 @@
},
{
"collapsible": 1,
- "fieldname": "default_tax_withholding_config",
- "fieldtype": "Section Break",
- "label": "Default Tax Withholding Config"
- },
- {
- "collapsible": 1,
"collapsible_depends_on": "supplier_details",
"fieldname": "column_break2",
"fieldtype": "Section Break",
@@ -383,7 +350,7 @@
{
"fieldname": "primary_address_and_contact_detail_section",
"fieldtype": "Section Break",
- "label": "Primary Address and Contact Detail"
+ "label": "Primary Address and Contact"
},
{
"description": "Reselect, if the chosen contact is edited after save",
@@ -420,6 +387,64 @@
"fieldtype": "Link",
"label": "Supplier Primary Address",
"options": "Address"
+ },
+ {
+ "fieldname": "dashboard_tab",
+ "fieldtype": "Tab Break",
+ "label": "Dashboard",
+ "show_dashboard": 1
+ },
+ {
+ "fieldname": "settings_tab",
+ "fieldtype": "Tab Break",
+ "label": "Settings"
+ },
+ {
+ "fieldname": "contact_and_address_tab",
+ "fieldtype": "Tab Break",
+ "label": "Contact & Address"
+ },
+ {
+ "fieldname": "accounting_tab",
+ "fieldtype": "Tab Break",
+ "label": "Accounting"
+ },
+ {
+ "fieldname": "defaults_section",
+ "fieldtype": "Section Break",
+ "label": "Defaults"
+ },
+ {
+ "fieldname": "tax_tab",
+ "fieldtype": "Tab Break",
+ "label": "Tax"
+ },
+ {
+ "collapsible": 1,
+ "fieldname": "internal_supplier_section",
+ "fieldtype": "Section Break",
+ "label": "Internal Supplier"
+ },
+ {
+ "fieldname": "column_break_16",
+ "fieldtype": "Column Break"
+ },
+ {
+ "fieldname": "column_break_27",
+ "fieldtype": "Column Break"
+ },
+ {
+ "fieldname": "column_break_54",
+ "fieldtype": "Column Break"
+ },
+ {
+ "fieldname": "block_supplier_section",
+ "fieldtype": "Section Break",
+ "label": "Block Supplier"
+ },
+ {
+ "fieldname": "column_break_59",
+ "fieldtype": "Column Break"
}
],
"icon": "fa fa-user",
@@ -432,7 +457,7 @@
"link_fieldname": "party"
}
],
- "modified": "2022-04-16 18:02:27.838623",
+ "modified": "2022-11-09 18:02:59.075203",
"modified_by": "Administrator",
"module": "Buying",
"name": "Supplier",
diff --git a/erpnext/buying/doctype/supplier/supplier.py b/erpnext/buying/doctype/supplier/supplier.py
index 43152e8..bebff1c 100644
--- a/erpnext/buying/doctype/supplier/supplier.py
+++ b/erpnext/buying/doctype/supplier/supplier.py
@@ -145,7 +145,7 @@
def after_rename(self, olddn, newdn, merge=False):
if frappe.defaults.get_global_default("supp_master_name") == "Supplier Name":
- frappe.db.set(self, "supplier_name", newdn)
+ self.db_set("supplier_name", newdn)
@frappe.whitelist()
diff --git a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.py b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.py
index c19c1df..2dd748b 100644
--- a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.py
+++ b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.py
@@ -30,11 +30,11 @@
self.validate_valid_till()
def on_submit(self):
- frappe.db.set(self, "status", "Submitted")
+ self.db_set("status", "Submitted")
self.update_rfq_supplier_status(1)
def on_cancel(self):
- frappe.db.set(self, "status", "Cancelled")
+ self.db_set("status", "Cancelled")
self.update_rfq_supplier_status(0)
def on_trash(self):
diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py
index 7f5dc02..216c9f4 100644
--- a/erpnext/controllers/accounts_controller.py
+++ b/erpnext/controllers/accounts_controller.py
@@ -151,6 +151,7 @@
self.validate_inter_company_reference()
self.disable_pricing_rule_on_internal_transfer()
+ self.disable_tax_included_prices_for_internal_transfer()
self.set_incoming_rate()
if self.meta.get_field("currency"):
@@ -226,7 +227,7 @@
for item in self.get("items"):
if item.get("enable_deferred_revenue") or item.get("enable_deferred_expense"):
if not item.get(field_map.get(self.doctype)):
- default_deferred_account = frappe.db.get_value(
+ default_deferred_account = frappe.get_cached_value(
"Company", self.company, "default_" + field_map.get(self.doctype)
)
if not default_deferred_account:
@@ -398,6 +399,20 @@
alert=1,
)
+ def disable_tax_included_prices_for_internal_transfer(self):
+ if self.is_internal_transfer():
+ tax_updated = False
+ for tax in self.get("taxes"):
+ if tax.get("included_in_print_rate"):
+ tax.included_in_print_rate = 0
+ tax_updated = True
+
+ if tax_updated:
+ frappe.msgprint(
+ _("Disabled tax included prices since this {} is an internal transfer").format(self.doctype),
+ alert=1,
+ )
+
def validate_due_date(self):
if self.get("is_pos"):
return
@@ -661,7 +676,7 @@
def validate_enabled_taxes_and_charges(self):
taxes_and_charges_doctype = self.meta.get_options("taxes_and_charges")
- if frappe.db.get_value(taxes_and_charges_doctype, self.taxes_and_charges, "disabled"):
+ if frappe.get_cached_value(taxes_and_charges_doctype, self.taxes_and_charges, "disabled"):
frappe.throw(
_("{0} '{1}' is disabled").format(taxes_and_charges_doctype, self.taxes_and_charges)
)
@@ -669,7 +684,7 @@
def validate_tax_account_company(self):
for d in self.get("taxes"):
if d.account_head:
- tax_account_company = frappe.db.get_value("Account", d.account_head, "company")
+ tax_account_company = frappe.get_cached_value("Account", d.account_head, "company")
if tax_account_company != self.company:
frappe.throw(
_("Row #{0}: Account {1} does not belong to company {2}").format(
@@ -804,15 +819,12 @@
self.set("advances", [])
advance_allocated = 0
for d in res:
- if d.against_order:
- allocated_amount = flt(d.amount)
+ if self.get("party_account_currency") == self.company_currency:
+ amount = self.get("base_rounded_total") or self.base_grand_total
else:
- if self.get("party_account_currency") == self.company_currency:
- amount = self.get("base_rounded_total") or self.base_grand_total
- else:
- amount = self.get("rounded_total") or self.grand_total
+ amount = self.get("rounded_total") or self.grand_total
- allocated_amount = min(amount - advance_allocated, d.amount)
+ allocated_amount = min(amount - advance_allocated, d.amount)
advance_allocated += flt(allocated_amount)
advance_row = {
@@ -917,7 +929,9 @@
party_account = self.credit_to if is_purchase_invoice else self.debit_to
party_type = "Supplier" if is_purchase_invoice else "Customer"
- gain_loss_account = frappe.db.get_value("Company", self.company, "exchange_gain_loss_account")
+ gain_loss_account = frappe.get_cached_value(
+ "Company", self.company, "exchange_gain_loss_account"
+ )
if not gain_loss_account:
frappe.throw(
_("Please set default Exchange Gain/Loss Account in Company {}").format(self.get("company"))
@@ -1014,7 +1028,7 @@
else self.grand_total
),
"outstanding_amount": self.outstanding_amount,
- "difference_account": frappe.db.get_value(
+ "difference_account": frappe.get_cached_value(
"Company", self.company, "exchange_gain_loss_account"
),
"exchange_gain_loss": flt(d.get("exchange_gain_loss")),
@@ -1382,7 +1396,7 @@
@property
def company_abbr(self):
if not hasattr(self, "_abbr"):
- self._abbr = frappe.db.get_value("Company", self.company, "abbr")
+ self._abbr = frappe.get_cached_value("Company", self.company, "abbr")
return self._abbr
@@ -1768,7 +1782,7 @@
"""
if self.is_internal_transfer() and not self.unrealized_profit_loss_account:
- unrealized_profit_loss_account = frappe.db.get_value(
+ unrealized_profit_loss_account = frappe.get_cached_value(
"Company", self.company, "unrealized_profit_loss_account"
)
@@ -1883,7 +1897,9 @@
@frappe.whitelist()
def get_tax_rate(account_head):
- return frappe.db.get_value("Account", account_head, ["tax_rate", "account_name"], as_dict=True)
+ return frappe.get_cached_value(
+ "Account", account_head, ["tax_rate", "account_name"], as_dict=True
+ )
@frappe.whitelist()
@@ -1892,7 +1908,7 @@
return {}
if tax_template and company:
- tax_template_company = frappe.db.get_value(master_doctype, tax_template, "company")
+ tax_template_company = frappe.get_cached_value(master_doctype, tax_template, "company")
if tax_template_company == company:
return
diff --git a/erpnext/controllers/sales_and_purchase_return.py b/erpnext/controllers/sales_and_purchase_return.py
index 04a0dfa..39ef68a 100644
--- a/erpnext/controllers/sales_and_purchase_return.py
+++ b/erpnext/controllers/sales_and_purchase_return.py
@@ -326,7 +326,7 @@
from erpnext.stock.doctype.serial_no.serial_no import get_serial_nos
company = frappe.db.get_value("Delivery Note", source_name, "company")
- default_warehouse_for_sales_return = frappe.db.get_value(
+ default_warehouse_for_sales_return = frappe.get_cached_value(
"Company", company, "default_warehouse_for_sales_return"
)
@@ -340,11 +340,11 @@
# look for Print Heading "Credit Note"
if not doc.select_print_heading:
- doc.select_print_heading = frappe.db.get_value("Print Heading", _("Credit Note"))
+ doc.select_print_heading = frappe.get_cached_value("Print Heading", _("Credit Note"))
elif doctype == "Purchase Invoice":
# look for Print Heading "Debit Note"
- doc.select_print_heading = frappe.db.get_value("Print Heading", _("Debit Note"))
+ doc.select_print_heading = frappe.get_cached_value("Print Heading", _("Debit Note"))
for tax in doc.get("taxes") or []:
if tax.charge_type == "Actual":
@@ -503,7 +503,7 @@
doctype
+ " Item": {
"doctype": doctype + " Item",
- "field_map": {"serial_no": "serial_no", "batch_no": "batch_no"},
+ "field_map": {"serial_no": "serial_no", "batch_no": "batch_no", "bom": "bom"},
"postprocess": update_item,
},
"Payment Schedule": {"doctype": "Payment Schedule", "postprocess": update_terms},
diff --git a/erpnext/controllers/stock_controller.py b/erpnext/controllers/stock_controller.py
index 98dc586..1e4fabe 100644
--- a/erpnext/controllers/stock_controller.py
+++ b/erpnext/controllers/stock_controller.py
@@ -57,7 +57,7 @@
make_reverse_gl_entries(voucher_type=self.doctype, voucher_no=self.name)
provisional_accounting_for_non_stock_items = cint(
- frappe.db.get_value(
+ frappe.get_cached_value(
"Company", self.company, "enable_provisional_accounting_for_non_stock_items"
)
)
@@ -200,7 +200,7 @@
elif self.get("is_internal_supplier"):
warehouse_asset_account = warehouse_account[item_row.get("warehouse")]["account"]
- expense_account = frappe.db.get_value("Company", self.company, "default_expense_account")
+ expense_account = frappe.get_cached_value("Company", self.company, "default_expense_account")
gl_list.append(
self.get_gl_dict(
@@ -235,7 +235,7 @@
if warehouse_with_no_account:
for wh in warehouse_with_no_account:
- if frappe.db.get_value("Warehouse", wh, "company"):
+ if frappe.get_cached_value("Warehouse", wh, "company"):
frappe.throw(
_(
"Warehouse {0} is not linked to any account, please mention the account in the warehouse record or set default inventory account in company {1}."
@@ -449,15 +449,15 @@
# Get value based on doctype name
if not sl_dict.get(dimension.target_fieldname):
- fieldname = frappe.get_cached_value(
- "DocField", {"parent": self.doctype, "options": dimension.fetch_from_parent}, "fieldname"
+ fieldname = next(
+ (
+ field.fieldname
+ for field in frappe.get_meta(self.doctype).fields
+ if field.options == dimension.fetch_from_parent
+ ),
+ None,
)
- if not fieldname:
- fieldname = frappe.get_cached_value(
- "Custom Field", {"dt": self.doctype, "options": dimension.fetch_from_parent}, "fieldname"
- )
-
if fieldname and self.get(fieldname):
sl_dict[dimension.target_fieldname] = self.get(fieldname)
diff --git a/erpnext/controllers/subcontracting_controller.py b/erpnext/controllers/subcontracting_controller.py
index aa4468c..8d67e30 100644
--- a/erpnext/controllers/subcontracting_controller.py
+++ b/erpnext/controllers/subcontracting_controller.py
@@ -89,6 +89,9 @@
if bom.item != item.item_code:
msg = f"Please select an valid BOM for Item {item.item_name}."
frappe.throw(_(msg))
+ else:
+ msg = f"Please select a BOM for Item {item.item_name}."
+ frappe.throw(_(msg))
def __get_data_before_save(self):
item_dict = {}
diff --git a/erpnext/controllers/taxes_and_totals.py b/erpnext/controllers/taxes_and_totals.py
index b5836c9..c6a634b 100644
--- a/erpnext/controllers/taxes_and_totals.py
+++ b/erpnext/controllers/taxes_and_totals.py
@@ -58,12 +58,25 @@
self.initialize_taxes()
self.determine_exclusive_rate()
self.calculate_net_total()
+ self.calculate_tax_withholding_net_total()
self.calculate_taxes()
self.manipulate_grand_total_for_inclusive_tax()
self.calculate_totals()
self._cleanup()
self.calculate_total_net_weight()
+ def calculate_tax_withholding_net_total(self):
+ if hasattr(self.doc, "tax_withholding_net_total"):
+ sum_net_amount = 0
+ sum_base_net_amount = 0
+ for item in self.doc.get("items"):
+ if hasattr(item, "apply_tds") and item.apply_tds:
+ sum_net_amount += item.net_amount
+ sum_base_net_amount += item.base_net_amount
+
+ self.doc.tax_withholding_net_total = sum_net_amount
+ self.doc.base_tax_withholding_net_total = sum_base_net_amount
+
def validate_item_tax_template(self):
for item in self.doc.get("items"):
if item.item_code and item.get("item_tax_template"):
@@ -1043,7 +1056,7 @@
company_currency = erpnext.get_company_currency(self.doc.company)
for d in self.doc.get(self.tax_field):
if not d.account_currency:
- account_currency = frappe.db.get_value("Account", d.expense_account, "account_currency")
+ account_currency = frappe.get_cached_value("Account", d.expense_account, "account_currency")
d.account_currency = account_currency or company_currency
def set_exchange_rate(self):
diff --git a/erpnext/controllers/tests/test_subcontracting_controller.py b/erpnext/controllers/tests/test_subcontracting_controller.py
index 8490d14..0e6fe95 100644
--- a/erpnext/controllers/tests/test_subcontracting_controller.py
+++ b/erpnext/controllers/tests/test_subcontracting_controller.py
@@ -815,6 +815,7 @@
"item_name",
"qty",
"uom",
+ "bom",
"warehouse",
"stock_uom",
"subcontracting_order",
diff --git a/erpnext/controllers/trends.py b/erpnext/controllers/trends.py
index 1d6c5dc..1fb722e 100644
--- a/erpnext/controllers/trends.py
+++ b/erpnext/controllers/trends.py
@@ -80,7 +80,7 @@
if conditions.get("trans") == "Quotation" and filters.get("group_by") == "Customer":
cond += " and t1.quotation_to = 'Customer'"
- year_start_date, year_end_date = frappe.db.get_value(
+ year_start_date, year_end_date = frappe.get_cached_value(
"Fiscal Year", filters.get("fiscal_year"), ["year_start_date", "year_end_date"]
)
@@ -275,7 +275,7 @@
from dateutil.relativedelta import relativedelta
if not year_start_date:
- year_start_date, year_end_date = frappe.db.get_value(
+ year_start_date, year_end_date = frappe.get_cached_value(
"Fiscal Year", fiscal_year, ["year_start_date", "year_end_date"]
)
diff --git a/erpnext/crm/doctype/opportunity/opportunity.py b/erpnext/crm/doctype/opportunity/opportunity.py
index 08eb472..f4b6e91 100644
--- a/erpnext/crm/doctype/opportunity/opportunity.py
+++ b/erpnext/crm/doctype/opportunity/opportunity.py
@@ -60,7 +60,7 @@
if not self.get(field) and frappe.db.field_exists(self.opportunity_from, field):
try:
value = frappe.db.get_value(self.opportunity_from, self.party_name, field)
- frappe.db.set(self, field, value)
+ self.db_set(field, value)
except Exception:
continue
diff --git a/erpnext/hooks.py b/erpnext/hooks.py
index 6bc17a3..f9ddb12 100644
--- a/erpnext/hooks.py
+++ b/erpnext/hooks.py
@@ -1,5 +1,3 @@
-from frappe import _
-
app_name = "erpnext"
app_title = "ERPNext"
app_publisher = "Frappe Technologies Pvt. Ltd."
@@ -94,7 +92,7 @@
{
"from_route": "/orders/<path:name>",
"to_route": "order",
- "defaults": {"doctype": "Sales Order", "parents": [{"label": _("Orders"), "route": "orders"}]},
+ "defaults": {"doctype": "Sales Order", "parents": [{"label": "Orders", "route": "orders"}]},
},
{"from_route": "/invoices", "to_route": "Sales Invoice"},
{
@@ -102,7 +100,7 @@
"to_route": "order",
"defaults": {
"doctype": "Sales Invoice",
- "parents": [{"label": _("Invoices"), "route": "invoices"}],
+ "parents": [{"label": "Invoices", "route": "invoices"}],
},
},
{"from_route": "/supplier-quotations", "to_route": "Supplier Quotation"},
@@ -111,7 +109,7 @@
"to_route": "order",
"defaults": {
"doctype": "Supplier Quotation",
- "parents": [{"label": _("Supplier Quotation"), "route": "supplier-quotations"}],
+ "parents": [{"label": "Supplier Quotation", "route": "supplier-quotations"}],
},
},
{"from_route": "/purchase-orders", "to_route": "Purchase Order"},
@@ -120,7 +118,7 @@
"to_route": "order",
"defaults": {
"doctype": "Purchase Order",
- "parents": [{"label": _("Purchase Order"), "route": "purchase-orders"}],
+ "parents": [{"label": "Purchase Order", "route": "purchase-orders"}],
},
},
{"from_route": "/purchase-invoices", "to_route": "Purchase Invoice"},
@@ -129,7 +127,7 @@
"to_route": "order",
"defaults": {
"doctype": "Purchase Invoice",
- "parents": [{"label": _("Purchase Invoice"), "route": "purchase-invoices"}],
+ "parents": [{"label": "Purchase Invoice", "route": "purchase-invoices"}],
},
},
{"from_route": "/quotations", "to_route": "Quotation"},
@@ -138,7 +136,7 @@
"to_route": "order",
"defaults": {
"doctype": "Quotation",
- "parents": [{"label": _("Quotations"), "route": "quotations"}],
+ "parents": [{"label": "Quotations", "route": "quotations"}],
},
},
{"from_route": "/shipments", "to_route": "Delivery Note"},
@@ -147,7 +145,7 @@
"to_route": "order",
"defaults": {
"doctype": "Delivery Note",
- "parents": [{"label": _("Shipments"), "route": "shipments"}],
+ "parents": [{"label": "Shipments", "route": "shipments"}],
},
},
{"from_route": "/rfq", "to_route": "Request for Quotation"},
@@ -156,14 +154,14 @@
"to_route": "rfq",
"defaults": {
"doctype": "Request for Quotation",
- "parents": [{"label": _("Request for Quotation"), "route": "rfq"}],
+ "parents": [{"label": "Request for Quotation", "route": "rfq"}],
},
},
{"from_route": "/addresses", "to_route": "Address"},
{
"from_route": "/addresses/<path:name>",
"to_route": "addresses",
- "defaults": {"doctype": "Address", "parents": [{"label": _("Addresses"), "route": "addresses"}]},
+ "defaults": {"doctype": "Address", "parents": [{"label": "Addresses", "route": "addresses"}]},
},
{"from_route": "/boms", "to_route": "BOM"},
{"from_route": "/timesheets", "to_route": "Timesheet"},
@@ -173,78 +171,78 @@
"to_route": "material_request_info",
"defaults": {
"doctype": "Material Request",
- "parents": [{"label": _("Material Request"), "route": "material-requests"}],
+ "parents": [{"label": "Material Request", "route": "material-requests"}],
},
},
{"from_route": "/project", "to_route": "Project"},
]
standard_portal_menu_items = [
- {"title": _("Projects"), "route": "/project", "reference_doctype": "Project"},
+ {"title": "Projects", "route": "/project", "reference_doctype": "Project"},
{
- "title": _("Request for Quotations"),
+ "title": "Request for Quotations",
"route": "/rfq",
"reference_doctype": "Request for Quotation",
"role": "Supplier",
},
{
- "title": _("Supplier Quotation"),
+ "title": "Supplier Quotation",
"route": "/supplier-quotations",
"reference_doctype": "Supplier Quotation",
"role": "Supplier",
},
{
- "title": _("Purchase Orders"),
+ "title": "Purchase Orders",
"route": "/purchase-orders",
"reference_doctype": "Purchase Order",
"role": "Supplier",
},
{
- "title": _("Purchase Invoices"),
+ "title": "Purchase Invoices",
"route": "/purchase-invoices",
"reference_doctype": "Purchase Invoice",
"role": "Supplier",
},
{
- "title": _("Quotations"),
+ "title": "Quotations",
"route": "/quotations",
"reference_doctype": "Quotation",
"role": "Customer",
},
{
- "title": _("Orders"),
+ "title": "Orders",
"route": "/orders",
"reference_doctype": "Sales Order",
"role": "Customer",
},
{
- "title": _("Invoices"),
+ "title": "Invoices",
"route": "/invoices",
"reference_doctype": "Sales Invoice",
"role": "Customer",
},
{
- "title": _("Shipments"),
+ "title": "Shipments",
"route": "/shipments",
"reference_doctype": "Delivery Note",
"role": "Customer",
},
- {"title": _("Issues"), "route": "/issues", "reference_doctype": "Issue", "role": "Customer"},
- {"title": _("Addresses"), "route": "/addresses", "reference_doctype": "Address"},
+ {"title": "Issues", "route": "/issues", "reference_doctype": "Issue", "role": "Customer"},
+ {"title": "Addresses", "route": "/addresses", "reference_doctype": "Address"},
{
- "title": _("Timesheets"),
+ "title": "Timesheets",
"route": "/timesheets",
"reference_doctype": "Timesheet",
"role": "Customer",
},
- {"title": _("Newsletter"), "route": "/newsletters", "reference_doctype": "Newsletter"},
+ {"title": "Newsletter", "route": "/newsletters", "reference_doctype": "Newsletter"},
{
- "title": _("Material Request"),
+ "title": "Material Request",
"route": "/material-requests",
"reference_doctype": "Material Request",
"role": "Customer",
},
- {"title": _("Appointment Booking"), "route": "/book_appointment"},
+ {"title": "Appointment Booking", "route": "/book_appointment"},
]
default_roles = [
diff --git a/erpnext/loan_management/doctype/loan_repayment/loan_repayment.py b/erpnext/loan_management/doctype/loan_repayment/loan_repayment.py
index e9fa2ad..8a185f8 100644
--- a/erpnext/loan_management/doctype/loan_repayment/loan_repayment.py
+++ b/erpnext/loan_management/doctype/loan_repayment/loan_repayment.py
@@ -576,8 +576,8 @@
loan_doc = frappe.get_doc("Loan", loan)
next_accrual_date = None
accrued_entries = 0
- last_repayment_amount = 0
- last_balance_amount = 0
+ last_repayment_amount = None
+ last_balance_amount = None
for term in reversed(loan_doc.get("repayment_schedule")):
if not term.is_accrued:
@@ -585,9 +585,9 @@
loan_doc.remove(term)
else:
accrued_entries += 1
- if not last_repayment_amount:
+ if last_repayment_amount is None:
last_repayment_amount = term.total_payment
- if not last_balance_amount:
+ if last_balance_amount is None:
last_balance_amount = term.balance_loan_amount
loan_doc.save()
diff --git a/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.py b/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.py
index 3dc6b0f..95e2d69 100644
--- a/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.py
+++ b/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.py
@@ -119,7 +119,7 @@
event.add_participant(self.doctype, self.name)
event.insert(ignore_permissions=1)
- frappe.db.set(self, "status", "Submitted")
+ self.db_set("status", "Submitted")
def create_schedule_list(self, start_date, end_date, no_of_visit, sales_person):
schedule_list = []
@@ -245,7 +245,7 @@
self.generate_schedule()
def on_update(self):
- frappe.db.set(self, "status", "Draft")
+ self.db_set("status", "Draft")
def update_amc_date(self, serial_nos, amc_expiry_date=None):
for serial_no in serial_nos:
@@ -344,7 +344,7 @@
if d.serial_no:
serial_nos = get_valid_serial_nos(d.serial_no)
self.update_amc_date(serial_nos)
- frappe.db.set(self, "status", "Cancelled")
+ self.db_set("status", "Cancelled")
delete_events(self.doctype, self.name)
def on_trash(self):
diff --git a/erpnext/maintenance/doctype/maintenance_visit/maintenance_visit.py b/erpnext/maintenance/doctype/maintenance_visit/maintenance_visit.py
index 66f4426..0d319bf 100644
--- a/erpnext/maintenance/doctype/maintenance_visit/maintenance_visit.py
+++ b/erpnext/maintenance/doctype/maintenance_visit/maintenance_visit.py
@@ -125,12 +125,12 @@
def on_submit(self):
self.update_customer_issue(1)
- frappe.db.set(self, "status", "Submitted")
+ self.db_set("status", "Submitted")
self.update_status_and_actual_date()
def on_cancel(self):
self.check_if_last_visit()
- frappe.db.set(self, "status", "Cancelled")
+ self.db_set("status", "Cancelled")
self.update_status_and_actual_date(cancel=True)
def on_update(self):
diff --git a/erpnext/manufacturing/doctype/bom/bom.py b/erpnext/manufacturing/doctype/bom/bom.py
index 580838e..ca4f63d 100644
--- a/erpnext/manufacturing/doctype/bom/bom.py
+++ b/erpnext/manufacturing/doctype/bom/bom.py
@@ -206,8 +206,8 @@
self.manage_default_bom()
def on_cancel(self):
- frappe.db.set(self, "is_active", 0)
- frappe.db.set(self, "is_default", 0)
+ self.db_set("is_active", 0)
+ self.db_set("is_default", 0)
# check if used in any other bom
self.validate_bom_links()
@@ -449,10 +449,10 @@
not frappe.db.exists(dict(doctype="BOM", docstatus=1, item=self.item, is_default=1))
and self.is_active
):
- frappe.db.set(self, "is_default", 1)
+ self.db_set("is_default", 1)
frappe.db.set_value("Item", self.item, "default_bom", self.name)
else:
- frappe.db.set(self, "is_default", 0)
+ self.db_set("is_default", 0)
item = frappe.get_doc("Item", self.item)
if item.default_bom == self.name:
frappe.db.set_value("Item", self.item, "default_bom", None)
diff --git a/erpnext/manufacturing/doctype/bom_operation/bom_operation.json b/erpnext/manufacturing/doctype/bom_operation/bom_operation.json
index b965a43..5a734d8 100644
--- a/erpnext/manufacturing/doctype/bom_operation/bom_operation.json
+++ b/erpnext/manufacturing/doctype/bom_operation/bom_operation.json
@@ -9,6 +9,7 @@
"sequence_id",
"operation",
"col_break1",
+ "workstation_type",
"workstation",
"time_in_mins",
"fixed_time",
@@ -40,9 +41,9 @@
"reqd": 1
},
{
+ "depends_on": "eval:!doc.workstation_type",
"fieldname": "workstation",
"fieldtype": "Link",
- "in_list_view": 1,
"label": "Workstation",
"oldfieldname": "workstation",
"oldfieldtype": "Link",
@@ -180,13 +181,20 @@
"fieldname": "set_cost_based_on_bom_qty",
"fieldtype": "Check",
"label": "Set Operating Cost Based On BOM Quantity"
+ },
+ {
+ "fieldname": "workstation_type",
+ "fieldtype": "Link",
+ "in_list_view": 1,
+ "label": "Workstation Type",
+ "options": "Workstation Type"
}
],
"idx": 1,
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
- "modified": "2022-04-08 01:18:33.547481",
+ "modified": "2022-11-04 17:17:16.986941",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "BOM Operation",
diff --git a/erpnext/manufacturing/doctype/job_card/job_card.json b/erpnext/manufacturing/doctype/job_card/job_card.json
index 5a071f1..8506111 100644
--- a/erpnext/manufacturing/doctype/job_card/job_card.json
+++ b/erpnext/manufacturing/doctype/job_card/job_card.json
@@ -27,11 +27,14 @@
"operation",
"operation_row_number",
"column_break_18",
+ "workstation_type",
"workstation",
"employee",
"section_break_21",
"sub_operations",
"timing_detail",
+ "expected_start_date",
+ "expected_end_date",
"time_logs",
"section_break_13",
"total_completed_qty",
@@ -416,11 +419,27 @@
"fieldtype": "Link",
"label": "Quality Inspection Template",
"options": "Quality Inspection Template"
+ },
+ {
+ "fieldname": "workstation_type",
+ "fieldtype": "Link",
+ "label": "Workstation Type",
+ "options": "Workstation Type"
+ },
+ {
+ "fieldname": "expected_start_date",
+ "fieldtype": "Datetime",
+ "label": "Expected Start Date"
+ },
+ {
+ "fieldname": "expected_end_date",
+ "fieldtype": "Datetime",
+ "label": "Expected End Date"
}
],
"is_submittable": 1,
"links": [],
- "modified": "2021-11-24 19:17:40.879235",
+ "modified": "2022-11-09 15:02:44.490731",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "Job Card",
@@ -475,6 +494,7 @@
],
"sort_field": "modified",
"sort_order": "DESC",
+ "states": [],
"title_field": "operation",
"track_changes": 1
}
\ No newline at end of file
diff --git a/erpnext/manufacturing/doctype/job_card/job_card.py b/erpnext/manufacturing/doctype/job_card/job_card.py
index fb94e8a..8226475 100644
--- a/erpnext/manufacturing/doctype/job_card/job_card.py
+++ b/erpnext/manufacturing/doctype/job_card/job_card.py
@@ -2,11 +2,14 @@
# For license information, please see license.txt
import datetime
import json
+from typing import Optional
import frappe
from frappe import _, bold
from frappe.model.document import Document
from frappe.model.mapper import get_mapped_doc
+from frappe.query_builder import Criterion
+from frappe.query_builder.functions import IfNull, Max, Min
from frappe.utils import (
add_days,
add_to_date,
@@ -24,6 +27,7 @@
from erpnext.manufacturing.doctype.manufacturing_settings.manufacturing_settings import (
get_mins_between_operations,
)
+from erpnext.manufacturing.doctype.workstation_type.workstation_type import get_workstations
class OverlapError(frappe.ValidationError):
@@ -54,6 +58,9 @@
self.set_onload("job_card_excess_transfer", excess_transfer)
self.set_onload("work_order_closed", self.is_work_order_closed())
+ def before_validate(self):
+ self.set_wip_warehouse()
+
def validate(self):
self.validate_time_logs()
self.set_status()
@@ -109,49 +116,66 @@
def get_overlap_for(self, args, check_next_available_slot=False):
production_capacity = 1
+ jc = frappe.qb.DocType("Job Card")
+ jctl = frappe.qb.DocType("Job Card Time Log")
+
+ time_conditions = [
+ ((jctl.from_time < args.from_time) & (jctl.to_time > args.from_time)),
+ ((jctl.from_time < args.to_time) & (jctl.to_time > args.to_time)),
+ ((jctl.from_time >= args.from_time) & (jctl.to_time <= args.to_time)),
+ ]
+
+ if check_next_available_slot:
+ time_conditions.append(((jctl.from_time >= args.from_time) & (jctl.to_time >= args.to_time)))
+
+ query = (
+ frappe.qb.from_(jctl)
+ .from_(jc)
+ .select(jc.name.as_("name"), jctl.to_time, jc.workstation, jc.workstation_type)
+ .where(
+ (jctl.parent == jc.name)
+ & (Criterion.any(time_conditions))
+ & (jctl.name != f"{args.name or 'No Name'}")
+ & (jc.name != f"{args.parent or 'No Name'}")
+ & (jc.docstatus < 2)
+ )
+ .orderby(jctl.to_time, order=frappe.qb.desc)
+ )
+
+ if self.workstation_type:
+ query = query.where(jc.workstation_type == self.workstation_type)
+
if self.workstation:
production_capacity = (
frappe.get_cached_value("Workstation", self.workstation, "production_capacity") or 1
)
- validate_overlap_for = " and jc.workstation = %(workstation)s "
+ query = query.where(jc.workstation == self.workstation)
if args.get("employee"):
# override capacity for employee
production_capacity = 1
- validate_overlap_for = " and jctl.employee = %(employee)s "
+ query = query.where(jctl.employee == args.get("employee"))
- extra_cond = ""
- if check_next_available_slot:
- extra_cond = " or (%(from_time)s <= jctl.from_time and %(to_time)s <= jctl.to_time)"
-
- existing = frappe.db.sql(
- """select jc.name as name, jctl.to_time from
- `tabJob Card Time Log` jctl, `tabJob Card` jc where jctl.parent = jc.name and
- (
- (%(from_time)s > jctl.from_time and %(from_time)s < jctl.to_time) or
- (%(to_time)s > jctl.from_time and %(to_time)s < jctl.to_time) or
- (%(from_time)s <= jctl.from_time and %(to_time)s >= jctl.to_time) {0}
- )
- and jctl.name != %(name)s and jc.name != %(parent)s and jc.docstatus < 2 {1}
- order by jctl.to_time desc""".format(
- extra_cond, validate_overlap_for
- ),
- {
- "from_time": args.from_time,
- "to_time": args.to_time,
- "name": args.name or "No Name",
- "parent": args.parent or "No Name",
- "employee": args.get("employee"),
- "workstation": self.workstation,
- },
- as_dict=True,
- )
+ existing = query.run(as_dict=True)
if existing and production_capacity > len(existing):
return
+ if self.workstation_type:
+ if workstation := self.get_workstation_based_on_available_slot(existing):
+ self.workstation = workstation
+ return None
+
return existing[0] if existing else None
+ def get_workstation_based_on_available_slot(self, existing) -> Optional[str]:
+ workstations = get_workstations(self.workstation_type)
+ if workstations:
+ busy_workstations = [row.workstation for row in existing]
+ for workstation in workstations:
+ if workstation not in busy_workstations:
+ return workstation
+
def schedule_time_logs(self, row):
row.remaining_time_in_mins = row.time_in_mins
while row.remaining_time_in_mins > 0:
@@ -164,6 +188,9 @@
# get the last record based on the to time from the job card
data = self.get_overlap_for(args, check_next_available_slot=True)
if data:
+ if not self.workstation:
+ self.workstation = data.workstation
+
row.planned_start_time = get_datetime(data.to_time + get_mins_between_operations())
def check_workstation_time(self, row):
@@ -485,18 +512,21 @@
)
def update_work_order_data(self, for_quantity, time_in_mins, wo):
- time_data = frappe.db.sql(
- """
- SELECT
- min(from_time) as start_time, max(to_time) as end_time
- FROM `tabJob Card` jc, `tabJob Card Time Log` jctl
- WHERE
- jctl.parent = jc.name and jc.work_order = %s and jc.operation_id = %s
- and jc.docstatus = 1 and IFNULL(jc.is_corrective_job_card, 0) = 0
- """,
- (self.work_order, self.operation_id),
- as_dict=1,
- )
+ jc = frappe.qb.DocType("Job Card")
+ jctl = frappe.qb.DocType("Job Card Time Log")
+
+ time_data = (
+ frappe.qb.from_(jc)
+ .from_(jctl)
+ .select(Min(jctl.from_time).as_("start_time"), Max(jctl.to_time).as_("end_time"))
+ .where(
+ (jctl.parent == jc.name)
+ & (jc.work_order == self.work_order)
+ & (jc.operation_id == self.operation_id)
+ & (jc.docstatus == 1)
+ & (IfNull(jc.is_corrective_job_card, 0) == 0)
+ )
+ ).run(as_dict=True)
for data in wo.operations:
if data.get("name") == self.operation_id:
@@ -639,6 +669,12 @@
if update_status:
self.db_set("status", self.status)
+ def set_wip_warehouse(self):
+ if not self.wip_warehouse:
+ self.wip_warehouse = frappe.db.get_single_value(
+ "Manufacturing Settings", "default_wip_warehouse"
+ )
+
def validate_operation_id(self):
if (
self.get("operation_id")
diff --git a/erpnext/manufacturing/doctype/production_plan/production_plan.py b/erpnext/manufacturing/doctype/production_plan/production_plan.py
index 000ee07..caff0a3 100644
--- a/erpnext/manufacturing/doctype/production_plan/production_plan.py
+++ b/erpnext/manufacturing/doctype/production_plan/production_plan.py
@@ -649,23 +649,13 @@
else:
material_request = material_request_map[key]
- conversion_factor = 1.0
- if (
- material_request_type == "Purchase"
- and item_doc.purchase_uom
- and item_doc.purchase_uom != item_doc.stock_uom
- ):
- conversion_factor = (
- get_conversion_factor(item_doc.name, item_doc.purchase_uom).get("conversion_factor") or 1.0
- )
-
# add item
material_request.append(
"items",
{
"item_code": item.item_code,
"from_warehouse": item.from_warehouse,
- "qty": item.quantity / conversion_factor,
+ "qty": item.quantity,
"schedule_date": schedule_date,
"warehouse": item.warehouse,
"sales_order": item.sales_order,
@@ -1053,11 +1043,25 @@
if include_safety_stock:
required_qty += flt(row["safety_stock"])
+ item_details = frappe.get_cached_value(
+ "Item", row.item_code, ["purchase_uom", "stock_uom"], as_dict=1
+ )
+
+ conversion_factor = 1.0
+ if (
+ row.get("default_material_request_type") == "Purchase"
+ and item_details.purchase_uom
+ and item_details.purchase_uom != item_details.stock_uom
+ ):
+ conversion_factor = (
+ get_conversion_factor(row.item_code, item_details.purchase_uom).get("conversion_factor") or 1.0
+ )
+
if required_qty > 0:
return {
"item_code": row.item_code,
"item_name": row.item_name,
- "quantity": required_qty,
+ "quantity": required_qty / conversion_factor,
"required_bom_qty": total_qty,
"stock_uom": row.get("stock_uom"),
"warehouse": warehouse
diff --git a/erpnext/manufacturing/doctype/production_plan/test_production_plan.py b/erpnext/manufacturing/doctype/production_plan/test_production_plan.py
index c4ab0f8..a6d034d 100644
--- a/erpnext/manufacturing/doctype/production_plan/test_production_plan.py
+++ b/erpnext/manufacturing/doctype/production_plan/test_production_plan.py
@@ -826,6 +826,11 @@
)
pln.make_material_request()
+
+ for row in pln.mr_items:
+ self.assertEqual(row.uom, "Nos")
+ self.assertEqual(row.quantity, 1)
+
for row in frappe.get_all(
"Material Request Item",
filters={"production_plan": pln.name},
diff --git a/erpnext/manufacturing/doctype/work_order/test_work_order.py b/erpnext/manufacturing/doctype/work_order/test_work_order.py
index 804f03d..694dc79 100644
--- a/erpnext/manufacturing/doctype/work_order/test_work_order.py
+++ b/erpnext/manufacturing/doctype/work_order/test_work_order.py
@@ -5,7 +5,7 @@
import frappe
from frappe.tests.utils import FrappeTestCase, change_settings, timeout
-from frappe.utils import add_days, add_months, cint, flt, now, today
+from frappe.utils import add_days, add_months, add_to_date, cint, flt, now, today
from erpnext.manufacturing.doctype.job_card.job_card import JobCardCancelError
from erpnext.manufacturing.doctype.production_plan.test_production_plan import make_bom
@@ -1480,6 +1480,166 @@
for row in return_ste_doc.items:
self.assertEqual(row.qty, 2)
+ def test_workstation_type_for_work_order(self):
+ prepare_data_for_workstation_type_check()
+
+ workstation_types = ["Workstation Type 1", "Workstation Type 2", "Workstation Type 3"]
+ planned_start_date = "2022-11-14 10:00:00"
+
+ wo_order = make_wo_order_test_record(
+ item="Test FG Item For Workstation Type", planned_start_date=planned_start_date, qty=2
+ )
+
+ job_cards = frappe.get_all(
+ "Job Card",
+ fields=[
+ "`tabJob Card`.`name`",
+ "`tabJob Card`.`workstation_type`",
+ "`tabJob Card`.`workstation`",
+ "`tabJob Card Time Log`.`from_time`",
+ "`tabJob Card Time Log`.`to_time`",
+ "`tabJob Card Time Log`.`time_in_mins`",
+ ],
+ filters=[
+ ["Job Card", "work_order", "=", wo_order.name],
+ ["Job Card Time Log", "docstatus", "=", 1],
+ ],
+ order_by="`tabJob Card`.`creation` desc",
+ )
+
+ workstations_to_check = ["Workstation 1", "Workstation 3", "Workstation 5"]
+ for index, row in enumerate(job_cards):
+ if index != 0:
+ planned_start_date = add_to_date(planned_start_date, minutes=40)
+
+ self.assertEqual(row.workstation_type, workstation_types[index])
+ self.assertEqual(row.from_time, planned_start_date)
+ self.assertEqual(row.to_time, add_to_date(planned_start_date, minutes=30))
+ self.assertEqual(row.workstation, workstations_to_check[index])
+
+ planned_start_date = "2022-11-14 10:00:00"
+
+ wo_order = make_wo_order_test_record(
+ item="Test FG Item For Workstation Type", planned_start_date=planned_start_date, qty=2
+ )
+
+ job_cards = frappe.get_all(
+ "Job Card",
+ fields=[
+ "`tabJob Card`.`name`",
+ "`tabJob Card`.`workstation_type`",
+ "`tabJob Card`.`workstation`",
+ "`tabJob Card Time Log`.`from_time`",
+ "`tabJob Card Time Log`.`to_time`",
+ "`tabJob Card Time Log`.`time_in_mins`",
+ ],
+ filters=[
+ ["Job Card", "work_order", "=", wo_order.name],
+ ["Job Card Time Log", "docstatus", "=", 1],
+ ],
+ order_by="`tabJob Card`.`creation` desc",
+ )
+
+ workstations_to_check = ["Workstation 2", "Workstation 4", "Workstation 6"]
+ for index, row in enumerate(job_cards):
+ if index != 0:
+ planned_start_date = add_to_date(planned_start_date, minutes=40)
+
+ self.assertEqual(row.workstation_type, workstation_types[index])
+ self.assertEqual(row.from_time, planned_start_date)
+ self.assertEqual(row.to_time, add_to_date(planned_start_date, minutes=30))
+ self.assertEqual(row.workstation, workstations_to_check[index])
+
+
+def prepare_data_for_workstation_type_check():
+ from erpnext.manufacturing.doctype.operation.test_operation import make_operation
+ from erpnext.manufacturing.doctype.workstation.test_workstation import make_workstation
+ from erpnext.manufacturing.doctype.workstation_type.test_workstation_type import (
+ create_workstation_type,
+ )
+
+ workstation_types = ["Workstation Type 1", "Workstation Type 2", "Workstation Type 3"]
+ for workstation_type in workstation_types:
+ create_workstation_type(workstation_type=workstation_type)
+
+ operations = ["Cutting", "Sewing", "Packing"]
+ for operation in operations:
+ make_operation(
+ {
+ "operation": operation,
+ }
+ )
+
+ workstations = [
+ {
+ "workstation": "Workstation 1",
+ "workstation_type": "Workstation Type 1",
+ },
+ {
+ "workstation": "Workstation 2",
+ "workstation_type": "Workstation Type 1",
+ },
+ {
+ "workstation": "Workstation 3",
+ "workstation_type": "Workstation Type 2",
+ },
+ {
+ "workstation": "Workstation 4",
+ "workstation_type": "Workstation Type 2",
+ },
+ {
+ "workstation": "Workstation 5",
+ "workstation_type": "Workstation Type 3",
+ },
+ {
+ "workstation": "Workstation 6",
+ "workstation_type": "Workstation Type 3",
+ },
+ ]
+
+ for row in workstations:
+ make_workstation(row)
+
+ fg_item = make_item(
+ "Test FG Item For Workstation Type",
+ {
+ "is_stock_item": 1,
+ },
+ )
+
+ rm_item = make_item(
+ "Test RM Item For Workstation Type",
+ {
+ "is_stock_item": 1,
+ },
+ )
+
+ if not frappe.db.exists("BOM", {"item": fg_item.name}):
+ bom_doc = make_bom(
+ item=fg_item.name,
+ source_warehouse="Stores - _TC",
+ raw_materials=[rm_item.name],
+ do_not_submit=True,
+ )
+
+ submit_bom = False
+ for index, operation in enumerate(operations):
+ if not frappe.db.exists("BOM Operation", {"parent": bom_doc.name, "operation": operation}):
+ bom_doc.append(
+ "operations",
+ {
+ "operation": operation,
+ "time_in_mins": 30,
+ "hour_rate": 100,
+ "workstation_type": workstation_types[index],
+ },
+ )
+
+ submit_bom = True
+
+ if submit_bom:
+ bom_doc.submit()
+
def prepare_data_for_backflush_based_on_materials_transferred():
batch_item_doc = make_item(
diff --git a/erpnext/manufacturing/doctype/work_order/work_order.js b/erpnext/manufacturing/doctype/work_order/work_order.js
index 4aab3fa..4aff42c 100644
--- a/erpnext/manufacturing/doctype/work_order/work_order.js
+++ b/erpnext/manufacturing/doctype/work_order/work_order.js
@@ -446,7 +446,6 @@
frm.fields_dict.required_items.grid.toggle_reqd("source_warehouse", true);
frm.toggle_reqd("transfer_material_against",
frm.doc.operations && frm.doc.operations.length > 0);
- frm.fields_dict.operations.grid.toggle_reqd("workstation", frm.doc.operations);
},
set_sales_order: function(frm) {
@@ -589,66 +588,69 @@
}
}
- if(!frm.doc.skip_transfer){
+ if (frm.doc.status != 'Stopped') {
// If "Material Consumption is check in Manufacturing Settings, allow Material Consumption
- if (flt(doc.material_transferred_for_manufacturing) > 0 && frm.doc.status != 'Stopped') {
- if ((flt(doc.produced_qty) < flt(doc.material_transferred_for_manufacturing))) {
- frm.has_finish_btn = true;
-
- if (frm.doc.__onload && frm.doc.__onload.material_consumption == 1) {
- // Only show "Material Consumption" when required_qty > consumed_qty
- var counter = 0;
- var tbl = frm.doc.required_items || [];
- var tbl_lenght = tbl.length;
- for (var i = 0, len = tbl_lenght; i < len; i++) {
- let wo_item_qty = frm.doc.required_items[i].transferred_qty || frm.doc.required_items[i].required_qty;
- if (flt(wo_item_qty) > flt(frm.doc.required_items[i].consumed_qty)) {
- counter += 1;
- }
- }
- if (counter > 0) {
- var consumption_btn = frm.add_custom_button(__('Material Consumption'), function() {
- const backflush_raw_materials_based_on = frm.doc.__onload.backflush_raw_materials_based_on;
- erpnext.work_order.make_consumption_se(frm, backflush_raw_materials_based_on);
- });
- consumption_btn.addClass('btn-primary');
+ if (frm.doc.__onload && frm.doc.__onload.material_consumption == 1) {
+ if (flt(doc.material_transferred_for_manufacturing) > 0 || frm.doc.skip_transfer) {
+ // Only show "Material Consumption" when required_qty > consumed_qty
+ var counter = 0;
+ var tbl = frm.doc.required_items || [];
+ var tbl_lenght = tbl.length;
+ for (var i = 0, len = tbl_lenght; i < len; i++) {
+ let wo_item_qty = frm.doc.required_items[i].transferred_qty || frm.doc.required_items[i].required_qty;
+ if (flt(wo_item_qty) > flt(frm.doc.required_items[i].consumed_qty)) {
+ counter += 1;
}
}
+ if (counter > 0) {
+ var consumption_btn = frm.add_custom_button(__('Material Consumption'), function() {
+ const backflush_raw_materials_based_on = frm.doc.__onload.backflush_raw_materials_based_on;
+ erpnext.work_order.make_consumption_se(frm, backflush_raw_materials_based_on);
+ });
+ consumption_btn.addClass('btn-primary');
+ }
+ }
+ }
+ if(!frm.doc.skip_transfer){
+ if (flt(doc.material_transferred_for_manufacturing) > 0) {
+ if ((flt(doc.produced_qty) < flt(doc.material_transferred_for_manufacturing))) {
+ frm.has_finish_btn = true;
+
+ var finish_btn = frm.add_custom_button(__('Finish'), function() {
+ erpnext.work_order.make_se(frm, 'Manufacture');
+ });
+
+ if(doc.material_transferred_for_manufacturing>=doc.qty) {
+ // all materials transferred for manufacturing, make this primary
+ finish_btn.addClass('btn-primary');
+ }
+ } else {
+ frappe.db.get_doc("Manufacturing Settings").then((doc) => {
+ let allowance_percentage = doc.overproduction_percentage_for_work_order;
+
+ if (allowance_percentage > 0) {
+ let allowed_qty = frm.doc.qty + ((allowance_percentage / 100) * frm.doc.qty);
+
+ if ((flt(doc.produced_qty) < allowed_qty)) {
+ frm.add_custom_button(__('Finish'), function() {
+ erpnext.work_order.make_se(frm, 'Manufacture');
+ });
+ }
+ }
+ });
+ }
+ }
+ } else {
+ if ((flt(doc.produced_qty) < flt(doc.qty))) {
var finish_btn = frm.add_custom_button(__('Finish'), function() {
erpnext.work_order.make_se(frm, 'Manufacture');
});
-
- if(doc.material_transferred_for_manufacturing>=doc.qty) {
- // all materials transferred for manufacturing, make this primary
- finish_btn.addClass('btn-primary');
- }
- } else {
- frappe.db.get_doc("Manufacturing Settings").then((doc) => {
- let allowance_percentage = doc.overproduction_percentage_for_work_order;
-
- if (allowance_percentage > 0) {
- let allowed_qty = frm.doc.qty + ((allowance_percentage / 100) * frm.doc.qty);
-
- if ((flt(doc.produced_qty) < allowed_qty)) {
- frm.add_custom_button(__('Finish'), function() {
- erpnext.work_order.make_se(frm, 'Manufacture');
- });
- }
- }
- });
+ finish_btn.addClass('btn-primary');
}
}
- } else {
- if ((flt(doc.produced_qty) < flt(doc.qty)) && frm.doc.status != 'Stopped') {
- var finish_btn = frm.add_custom_button(__('Finish'), function() {
- erpnext.work_order.make_se(frm, 'Manufacture');
- });
- finish_btn.addClass('btn-primary');
- }
}
}
-
},
calculate_cost: function(doc) {
if (doc.operations){
diff --git a/erpnext/manufacturing/doctype/work_order/work_order.py b/erpnext/manufacturing/doctype/work_order/work_order.py
index 1e6d982..52753a0 100644
--- a/erpnext/manufacturing/doctype/work_order/work_order.py
+++ b/erpnext/manufacturing/doctype/work_order/work_order.py
@@ -87,11 +87,18 @@
self.validate_transfer_against()
self.validate_operation_time()
self.status = self.get_status()
+ self.validate_workstation_type()
validate_uom_is_integer(self, "stock_uom", ["qty", "produced_qty"])
self.set_required_items(reset_only_qty=len(self.get("required_items")))
+ def validate_workstation_type(self):
+ for row in self.operations:
+ if not row.workstation and not row.workstation_type:
+ msg = f"Row {row.idx}: Workstation or Workstation Type is mandatory for an operation {row.operation}"
+ frappe.throw(_(msg))
+
def validate_sales_order(self):
if self.sales_order:
self.check_sales_order_on_hold_or_close()
@@ -146,7 +153,7 @@
frappe.throw(_("Sales Order {0} is {1}").format(self.sales_order, status))
def set_default_warehouse(self):
- if not self.wip_warehouse:
+ if not self.wip_warehouse and not self.skip_transfer:
self.wip_warehouse = frappe.db.get_single_value(
"Manufacturing Settings", "default_wip_warehouse"
)
@@ -373,7 +380,7 @@
def on_cancel(self):
self.validate_cancel()
- frappe.db.set(self, "status", "Cancelled")
+ self.db_set("status", "Cancelled")
if self.production_plan and frappe.db.exists(
"Production Plan Item Reference", {"parent": self.production_plan}
@@ -491,11 +498,6 @@
def prepare_data_for_job_card(self, row, index, plan_days, enable_capacity_planning):
self.set_operation_start_end_time(index, row)
- if not row.workstation:
- frappe.throw(
- _("Row {0}: select the workstation against the operation {1}").format(row.idx, row.operation)
- )
-
original_start_time = row.planned_start_time
job_card_doc = create_job_card(
self, row, auto_create=True, enable_capacity_planning=enable_capacity_planning
@@ -662,6 +664,7 @@
"description",
"workstation",
"idx",
+ "workstation_type",
"base_hour_rate as hour_rate",
"time_in_mins",
"parent as bom",
@@ -1398,6 +1401,7 @@
doc.update(
{
"work_order": work_order.name,
+ "workstation_type": row.get("workstation_type"),
"operation": row.get("operation"),
"workstation": row.get("workstation"),
"posting_date": nowdate(),
diff --git a/erpnext/manufacturing/doctype/work_order_operation/work_order_operation.json b/erpnext/manufacturing/doctype/work_order_operation/work_order_operation.json
index 4e1a464..31b9201 100644
--- a/erpnext/manufacturing/doctype/work_order_operation/work_order_operation.json
+++ b/erpnext/manufacturing/doctype/work_order_operation/work_order_operation.json
@@ -10,6 +10,7 @@
"completed_qty",
"column_break_4",
"bom",
+ "workstation_type",
"workstation",
"sequence_id",
"section_break_10",
@@ -196,12 +197,18 @@
{
"fieldname": "section_break_10",
"fieldtype": "Section Break"
+ },
+ {
+ "fieldname": "workstation_type",
+ "fieldtype": "Link",
+ "label": "Workstation Type",
+ "options": "Workstation Type"
}
],
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
- "modified": "2021-11-29 16:37:18.824489",
+ "modified": "2022-11-09 01:37:56.563068",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "Work Order Operation",
@@ -209,5 +216,6 @@
"permissions": [],
"sort_field": "modified",
"sort_order": "DESC",
+ "states": [],
"track_changes": 1
}
\ No newline at end of file
diff --git a/erpnext/manufacturing/doctype/workstation/test_workstation.py b/erpnext/manufacturing/doctype/workstation/test_workstation.py
index 6db985c..1eb47ae 100644
--- a/erpnext/manufacturing/doctype/workstation/test_workstation.py
+++ b/erpnext/manufacturing/doctype/workstation/test_workstation.py
@@ -107,6 +107,7 @@
doc = frappe.get_doc({"doctype": "Workstation", "workstation_name": workstation_name})
doc.hour_rate_rent = args.get("hour_rate_rent")
doc.hour_rate_labour = args.get("hour_rate_labour")
+ doc.workstation_type = args.get("workstation_type")
doc.insert()
return doc
diff --git a/erpnext/manufacturing/doctype/workstation/workstation.js b/erpnext/manufacturing/doctype/workstation/workstation.js
index 5b9cedb..f830b17 100644
--- a/erpnext/manufacturing/doctype/workstation/workstation.js
+++ b/erpnext/manufacturing/doctype/workstation/workstation.js
@@ -2,7 +2,7 @@
// License: GNU General Public License v3. See license.txt
frappe.ui.form.on("Workstation", {
- onload: function(frm) {
+ onload(frm) {
if(frm.is_new())
{
frappe.call({
@@ -15,6 +15,18 @@
}
})
}
+ },
+
+ workstation_type(frm) {
+ if (frm.doc.workstation_type) {
+ frm.call({
+ method: "set_data_based_on_workstation_type",
+ doc: frm.doc,
+ callback: function(r) {
+ frm.refresh_fields();
+ }
+ })
+ }
}
});
diff --git a/erpnext/manufacturing/doctype/workstation/workstation.json b/erpnext/manufacturing/doctype/workstation/workstation.json
index d130391..881cba0 100644
--- a/erpnext/manufacturing/doctype/workstation/workstation.json
+++ b/erpnext/manufacturing/doctype/workstation/workstation.json
@@ -1,26 +1,30 @@
{
+ "actions": [],
"allow_import": 1,
"allow_rename": 1,
"autoname": "field:workstation_name",
"creation": "2013-01-10 16:34:17",
"doctype": "DocType",
"document_type": "Setup",
+ "engine": "InnoDB",
"field_order": [
"workstation_name",
"production_capacity",
"column_break_3",
+ "workstation_type",
"over_heads",
"hour_rate_electricity",
"hour_rate_consumable",
"column_break_11",
"hour_rate_rent",
"hour_rate_labour",
+ "section_break_11",
"hour_rate",
+ "workstaion_description",
+ "description",
"working_hours_section",
"holiday_list",
- "working_hours",
- "workstaion_description",
- "description"
+ "working_hours"
],
"fields": [
{
@@ -44,7 +48,7 @@
},
{
"fieldname": "over_heads",
- "fieldtype": "Section Break",
+ "fieldtype": "Tab Break",
"label": "Operating Costs",
"oldfieldtype": "Section Break"
},
@@ -99,7 +103,7 @@
},
{
"fieldname": "working_hours_section",
- "fieldtype": "Section Break",
+ "fieldtype": "Tab Break",
"label": "Working Hours"
},
{
@@ -128,16 +132,29 @@
{
"collapsible": 1,
"fieldname": "workstaion_description",
- "fieldtype": "Section Break",
+ "fieldtype": "Tab Break",
"label": "Description"
+ },
+ {
+ "bold": 1,
+ "fieldname": "workstation_type",
+ "fieldtype": "Link",
+ "label": "Workstation Type",
+ "options": "Workstation Type"
+ },
+ {
+ "fieldname": "section_break_11",
+ "fieldtype": "Section Break"
}
],
"icon": "icon-wrench",
"idx": 1,
- "modified": "2019-11-26 12:39:19.742052",
+ "links": [],
+ "modified": "2022-11-04 17:39:01.549346",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "Workstation",
+ "naming_rule": "By fieldname",
"owner": "Administrator",
"permissions": [
{
@@ -154,6 +171,8 @@
],
"quick_entry": 1,
"show_name_in_global_search": 1,
+ "sort_field": "modified",
"sort_order": "ASC",
+ "states": [],
"track_changes": 1
}
\ No newline at end of file
diff --git a/erpnext/manufacturing/doctype/workstation/workstation.py b/erpnext/manufacturing/doctype/workstation/workstation.py
index 59e5318..d5b6d37 100644
--- a/erpnext/manufacturing/doctype/workstation/workstation.py
+++ b/erpnext/manufacturing/doctype/workstation/workstation.py
@@ -32,7 +32,11 @@
class Workstation(Document):
- def validate(self):
+ def before_save(self):
+ self.set_data_based_on_workstation_type()
+ self.set_hour_rate()
+
+ def set_hour_rate(self):
self.hour_rate = (
flt(self.hour_rate_labour)
+ flt(self.hour_rate_electricity)
@@ -40,6 +44,30 @@
+ flt(self.hour_rate_rent)
)
+ @frappe.whitelist()
+ def set_data_based_on_workstation_type(self):
+ if self.workstation_type:
+ fields = [
+ "hour_rate_labour",
+ "hour_rate_electricity",
+ "hour_rate_consumable",
+ "hour_rate_rent",
+ "hour_rate",
+ "description",
+ ]
+
+ data = frappe.get_cached_value("Workstation Type", self.workstation_type, fields, as_dict=True)
+
+ if not data:
+ return
+
+ for field in fields:
+ if self.get(field):
+ continue
+
+ if value := data.get(field):
+ self.set(field, value)
+
def on_update(self):
self.validate_overlap_for_operation_timings()
self.update_bom_operation()
@@ -100,9 +128,7 @@
def check_if_within_operating_hours(workstation, operation, from_datetime, to_datetime):
if from_datetime and to_datetime:
- if not cint(
- frappe.db.get_value("Manufacturing Settings", "None", "allow_production_on_holidays")
- ):
+ if not frappe.db.get_single_value("Manufacturing Settings", "allow_production_on_holidays"):
check_workstation_for_holiday(workstation, from_datetime, to_datetime)
if not cint(frappe.db.get_value("Manufacturing Settings", None, "allow_overtime")):
diff --git a/erpnext/manufacturing/doctype/workstation_type/__init__.py b/erpnext/manufacturing/doctype/workstation_type/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/manufacturing/doctype/workstation_type/__init__.py
diff --git a/erpnext/manufacturing/doctype/workstation_type/test_workstation_type.py b/erpnext/manufacturing/doctype/workstation_type/test_workstation_type.py
new file mode 100644
index 0000000..aa7a3ee
--- /dev/null
+++ b/erpnext/manufacturing/doctype/workstation_type/test_workstation_type.py
@@ -0,0 +1,21 @@
+# Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and Contributors
+# See license.txt
+
+import frappe
+from frappe.tests.utils import FrappeTestCase
+
+
+class TestWorkstationType(FrappeTestCase):
+ pass
+
+
+def create_workstation_type(**args):
+ args = frappe._dict(args)
+
+ if workstation_type := frappe.db.exists("Workstation Type", args.workstation_type):
+ return frappe.get_doc("Workstation Type", workstation_type)
+ else:
+ doc = frappe.new_doc("Workstation Type")
+ doc.update(args)
+ doc.insert()
+ return doc
diff --git a/erpnext/manufacturing/doctype/workstation_type/workstation_type.js b/erpnext/manufacturing/doctype/workstation_type/workstation_type.js
new file mode 100644
index 0000000..419fa6c
--- /dev/null
+++ b/erpnext/manufacturing/doctype/workstation_type/workstation_type.js
@@ -0,0 +1,8 @@
+// Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and contributors
+// For license information, please see license.txt
+
+frappe.ui.form.on('Workstation Type', {
+ // refresh: function(frm) {
+
+ // }
+});
diff --git a/erpnext/manufacturing/doctype/workstation_type/workstation_type.json b/erpnext/manufacturing/doctype/workstation_type/workstation_type.json
new file mode 100644
index 0000000..7d9e36a
--- /dev/null
+++ b/erpnext/manufacturing/doctype/workstation_type/workstation_type.json
@@ -0,0 +1,133 @@
+{
+ "actions": [],
+ "allow_import": 1,
+ "allow_rename": 1,
+ "autoname": "field:workstation_type",
+ "creation": "2022-11-04 17:03:23.334818",
+ "default_view": "List",
+ "doctype": "DocType",
+ "document_type": "Setup",
+ "engine": "InnoDB",
+ "field_order": [
+ "workstation_type",
+ "over_heads",
+ "hour_rate_electricity",
+ "hour_rate_consumable",
+ "column_break_5",
+ "hour_rate_rent",
+ "hour_rate_labour",
+ "section_break_8",
+ "hour_rate",
+ "description_tab",
+ "description"
+ ],
+ "fields": [
+ {
+ "fieldname": "workstation_type",
+ "fieldtype": "Data",
+ "in_list_view": 1,
+ "label": "Workstation Type",
+ "oldfieldname": "workstation_name",
+ "oldfieldtype": "Data",
+ "reqd": 1,
+ "unique": 1
+ },
+ {
+ "fieldname": "over_heads",
+ "fieldtype": "Section Break",
+ "label": "Operating Costs",
+ "oldfieldtype": "Section Break"
+ },
+ {
+ "description": "per hour",
+ "fieldname": "hour_rate_electricity",
+ "fieldtype": "Currency",
+ "label": "Electricity Cost",
+ "oldfieldname": "hour_rate_electricity",
+ "oldfieldtype": "Currency"
+ },
+ {
+ "description": "per hour",
+ "fieldname": "hour_rate_consumable",
+ "fieldtype": "Currency",
+ "label": "Consumable Cost",
+ "oldfieldname": "hour_rate_consumable",
+ "oldfieldtype": "Currency"
+ },
+ {
+ "description": "per hour",
+ "fieldname": "hour_rate_rent",
+ "fieldtype": "Currency",
+ "label": "Rent Cost",
+ "oldfieldname": "hour_rate_rent",
+ "oldfieldtype": "Currency"
+ },
+ {
+ "description": "Wages per hour",
+ "fieldname": "hour_rate_labour",
+ "fieldtype": "Currency",
+ "label": "Wages",
+ "oldfieldname": "hour_rate_labour",
+ "oldfieldtype": "Currency"
+ },
+ {
+ "description": "per hour",
+ "fieldname": "hour_rate",
+ "fieldtype": "Currency",
+ "label": "Net Hour Rate",
+ "oldfieldname": "hour_rate",
+ "oldfieldtype": "Currency",
+ "read_only": 1
+ },
+ {
+ "fieldname": "description",
+ "fieldtype": "Small Text",
+ "in_list_view": 1,
+ "label": "Description",
+ "oldfieldname": "description",
+ "oldfieldtype": "Text",
+ "width": "300px"
+ },
+ {
+ "fieldname": "column_break_5",
+ "fieldtype": "Column Break"
+ },
+ {
+ "collapsible": 1,
+ "fieldname": "description_tab",
+ "fieldtype": "Tab Break",
+ "label": "Description"
+ },
+ {
+ "fieldname": "section_break_8",
+ "fieldtype": "Section Break"
+ }
+ ],
+ "icon": "icon-wrench",
+ "links": [],
+ "modified": "2022-11-16 23:11:36.224249",
+ "modified_by": "Administrator",
+ "module": "Manufacturing",
+ "name": "Workstation Type",
+ "naming_rule": "By fieldname",
+ "owner": "Administrator",
+ "permissions": [
+ {
+ "create": 1,
+ "delete": 1,
+ "email": 1,
+ "print": 1,
+ "read": 1,
+ "report": 1,
+ "role": "Manufacturing User",
+ "share": 1,
+ "write": 1
+ }
+ ],
+ "quick_entry": 1,
+ "show_name_in_global_search": 1,
+ "sort_field": "modified",
+ "sort_order": "ASC",
+ "states": [],
+ "track_changes": 1
+}
\ No newline at end of file
diff --git a/erpnext/manufacturing/doctype/workstation_type/workstation_type.py b/erpnext/manufacturing/doctype/workstation_type/workstation_type.py
new file mode 100644
index 0000000..348f4f8
--- /dev/null
+++ b/erpnext/manufacturing/doctype/workstation_type/workstation_type.py
@@ -0,0 +1,25 @@
+# Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+import frappe
+from frappe.model.document import Document
+from frappe.utils import flt
+
+
+class WorkstationType(Document):
+ def before_save(self):
+ self.set_hour_rate()
+
+ def set_hour_rate(self):
+ self.hour_rate = (
+ flt(self.hour_rate_labour)
+ + flt(self.hour_rate_electricity)
+ + flt(self.hour_rate_consumable)
+ + flt(self.hour_rate_rent)
+ )
+
+
+def get_workstations(workstation_type):
+ workstations = frappe.get_all("Workstation", filters={"workstation_type": workstation_type})
+
+ return [workstation.name for workstation in workstations]
diff --git a/erpnext/manufacturing/workspace/manufacturing/manufacturing.json b/erpnext/manufacturing/workspace/manufacturing/manufacturing.json
index 549f5af..c25f606 100644
--- a/erpnext/manufacturing/workspace/manufacturing/manufacturing.json
+++ b/erpnext/manufacturing/workspace/manufacturing/manufacturing.json
@@ -76,168 +76,6 @@
{
"hidden": 0,
"is_query_report": 0,
- "label": "Bill of Materials",
- "link_count": 0,
- "onboard": 0,
- "type": "Card Break"
- },
- {
- "dependencies": "",
- "hidden": 0,
- "is_query_report": 0,
- "label": "Item",
- "link_count": 0,
- "link_to": "Item",
- "link_type": "DocType",
- "onboard": 1,
- "type": "Link"
- },
- {
- "dependencies": "Item",
- "hidden": 0,
- "is_query_report": 0,
- "label": "Bill of Materials",
- "link_count": 0,
- "link_to": "BOM",
- "link_type": "DocType",
- "onboard": 1,
- "type": "Link"
- },
- {
- "dependencies": "",
- "hidden": 0,
- "is_query_report": 0,
- "label": "Workstation",
- "link_count": 0,
- "link_to": "Workstation",
- "link_type": "DocType",
- "onboard": 0,
- "type": "Link"
- },
- {
- "dependencies": "",
- "hidden": 0,
- "is_query_report": 0,
- "label": "Operation",
- "link_count": 0,
- "link_to": "Operation",
- "link_type": "DocType",
- "onboard": 0,
- "type": "Link"
- },
- {
- "dependencies": "",
- "hidden": 0,
- "is_query_report": 0,
- "label": "Routing",
- "link_count": 0,
- "link_to": "Routing",
- "link_type": "DocType",
- "onboard": 0,
- "type": "Link"
- },
- {
- "dependencies": "Work Order",
- "hidden": 0,
- "is_query_report": 1,
- "label": "Production Planning Report",
- "link_count": 0,
- "link_to": "Production Planning Report",
- "link_type": "Report",
- "onboard": 0,
- "type": "Link"
- },
- {
- "dependencies": "Work Order",
- "hidden": 0,
- "is_query_report": 1,
- "label": "Work Order Summary",
- "link_count": 0,
- "link_to": "Work Order Summary",
- "link_type": "Report",
- "onboard": 0,
- "type": "Link"
- },
- {
- "dependencies": "Quality Inspection",
- "hidden": 0,
- "is_query_report": 1,
- "label": "Quality Inspection Summary",
- "link_count": 0,
- "link_to": "Quality Inspection Summary",
- "link_type": "Report",
- "onboard": 0,
- "type": "Link"
- },
- {
- "dependencies": "Downtime Entry",
- "hidden": 0,
- "is_query_report": 1,
- "label": "Downtime Analysis",
- "link_count": 0,
- "link_to": "Downtime Analysis",
- "link_type": "Report",
- "onboard": 0,
- "type": "Link"
- },
- {
- "dependencies": "Job Card",
- "hidden": 0,
- "is_query_report": 1,
- "label": "Job Card Summary",
- "link_count": 0,
- "link_to": "Job Card Summary",
- "link_type": "Report",
- "onboard": 0,
- "type": "Link"
- },
- {
- "dependencies": "BOM",
- "hidden": 0,
- "is_query_report": 1,
- "label": "BOM Search",
- "link_count": 0,
- "link_to": "BOM Search",
- "link_type": "Report",
- "onboard": 0,
- "type": "Link"
- },
- {
- "dependencies": "BOM",
- "hidden": 0,
- "is_query_report": 1,
- "label": "BOM Stock Report",
- "link_count": 0,
- "link_to": "BOM Stock Report",
- "link_type": "Report",
- "onboard": 0,
- "type": "Link"
- },
- {
- "dependencies": "Work Order",
- "hidden": 0,
- "is_query_report": 1,
- "label": "Production Analytics",
- "link_count": 0,
- "link_to": "Production Analytics",
- "link_type": "Report",
- "onboard": 0,
- "type": "Link"
- },
- {
- "dependencies": "BOM",
- "hidden": 0,
- "is_query_report": 1,
- "label": "BOM Operations Time",
- "link_count": 0,
- "link_to": "BOM Operations Time",
- "link_type": "Report",
- "onboard": 0,
- "type": "Link"
- },
- {
- "hidden": 0,
- "is_query_report": 0,
"label": "Tools",
"link_count": 0,
"onboard": 0,
@@ -400,9 +238,181 @@
"link_type": "Report",
"onboard": 0,
"type": "Link"
+ },
+ {
+ "hidden": 0,
+ "is_query_report": 0,
+ "label": "Bill of Materials",
+ "link_count": 15,
+ "onboard": 0,
+ "type": "Card Break"
+ },
+ {
+ "dependencies": "",
+ "hidden": 0,
+ "is_query_report": 0,
+ "label": "Item",
+ "link_count": 0,
+ "link_to": "Item",
+ "link_type": "DocType",
+ "onboard": 1,
+ "type": "Link"
+ },
+ {
+ "dependencies": "Item",
+ "hidden": 0,
+ "is_query_report": 0,
+ "label": "Bill of Materials",
+ "link_count": 0,
+ "link_to": "BOM",
+ "link_type": "DocType",
+ "onboard": 1,
+ "type": "Link"
+ },
+ {
+ "dependencies": "",
+ "hidden": 0,
+ "is_query_report": 0,
+ "label": "Workstation Type",
+ "link_count": 0,
+ "link_to": "Workstation Type",
+ "link_type": "DocType",
+ "onboard": 0,
+ "type": "Link"
+ },
+ {
+ "dependencies": "",
+ "hidden": 0,
+ "is_query_report": 0,
+ "label": "Workstation",
+ "link_count": 0,
+ "link_to": "Workstation",
+ "link_type": "DocType",
+ "onboard": 0,
+ "type": "Link"
+ },
+ {
+ "dependencies": "",
+ "hidden": 0,
+ "is_query_report": 0,
+ "label": "Operation",
+ "link_count": 0,
+ "link_to": "Operation",
+ "link_type": "DocType",
+ "onboard": 0,
+ "type": "Link"
+ },
+ {
+ "dependencies": "Work Order",
+ "hidden": 0,
+ "is_query_report": 1,
+ "label": "Routing",
+ "link_count": 0,
+ "link_to": "Routing",
+ "link_type": "DocType",
+ "onboard": 0,
+ "type": "Link"
+ },
+ {
+ "dependencies": "Work Order",
+ "hidden": 0,
+ "is_query_report": 1,
+ "label": "Production Planning Report",
+ "link_count": 0,
+ "link_to": "Production Planning Report",
+ "link_type": "Report",
+ "onboard": 0,
+ "type": "Link"
+ },
+ {
+ "dependencies": "Quality Inspection",
+ "hidden": 0,
+ "is_query_report": 1,
+ "label": "Work Order Summary",
+ "link_count": 0,
+ "link_to": "Work Order Summary",
+ "link_type": "Report",
+ "onboard": 0,
+ "type": "Link"
+ },
+ {
+ "dependencies": "Downtime Entry",
+ "hidden": 0,
+ "is_query_report": 1,
+ "label": "Quality Inspection Summary",
+ "link_count": 0,
+ "link_to": "Quality Inspection Summary",
+ "link_type": "Report",
+ "onboard": 0,
+ "type": "Link"
+ },
+ {
+ "dependencies": "Job Card",
+ "hidden": 0,
+ "is_query_report": 1,
+ "label": "Downtime Analysis",
+ "link_count": 0,
+ "link_to": "Downtime Analysis",
+ "link_type": "Report",
+ "onboard": 0,
+ "type": "Link"
+ },
+ {
+ "dependencies": "BOM",
+ "hidden": 0,
+ "is_query_report": 1,
+ "label": "Job Card Summary",
+ "link_count": 0,
+ "link_to": "Job Card Summary",
+ "link_type": "Report",
+ "onboard": 0,
+ "type": "Link"
+ },
+ {
+ "dependencies": "BOM",
+ "hidden": 0,
+ "is_query_report": 1,
+ "label": "BOM Search",
+ "link_count": 0,
+ "link_to": "BOM Search",
+ "link_type": "Report",
+ "onboard": 0,
+ "type": "Link"
+ },
+ {
+ "dependencies": "Work Order",
+ "hidden": 0,
+ "is_query_report": 1,
+ "label": "BOM Stock Report",
+ "link_count": 0,
+ "link_to": "BOM Stock Report",
+ "link_type": "Report",
+ "onboard": 0,
+ "type": "Link"
+ },
+ {
+ "dependencies": "BOM",
+ "hidden": 0,
+ "is_query_report": 1,
+ "label": "Production Analytics",
+ "link_count": 0,
+ "link_to": "Production Analytics",
+ "link_type": "Report",
+ "onboard": 0,
+ "type": "Link"
+ },
+ {
+ "hidden": 0,
+ "is_query_report": 0,
+ "label": "BOM Operations Time",
+ "link_count": 0,
+ "link_to": "BOM Operations Time",
+ "link_type": "Report",
+ "onboard": 0,
+ "type": "Link"
}
],
- "modified": "2022-06-15 15:18:57.062935",
+ "modified": "2022-11-14 14:53:34.616862",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "Manufacturing",
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index 6a8c21f..2624181 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -317,3 +317,4 @@
erpnext.patches.v14_0.migrate_remarks_from_gl_to_payment_ledger
erpnext.patches.v13_0.update_schedule_type_in_loans
erpnext.patches.v14_0.create_accounting_dimensions_for_asset_capitalization
+erpnext.patches.v14_0.update_tds_fields
diff --git a/erpnext/patches/v13_0/update_exchange_rate_settings.py b/erpnext/patches/v13_0/update_exchange_rate_settings.py
index ed11c62..746195f 100644
--- a/erpnext/patches/v13_0/update_exchange_rate_settings.py
+++ b/erpnext/patches/v13_0/update_exchange_rate_settings.py
@@ -1,10 +1,5 @@
-import frappe
-
from erpnext.setup.install import setup_currency_exchange
def execute():
- frappe.reload_doc("accounts", "doctype", "currency_exchange_settings_result")
- frappe.reload_doc("accounts", "doctype", "currency_exchange_settings_details")
- frappe.reload_doc("accounts", "doctype", "currency_exchange_settings")
setup_currency_exchange()
diff --git a/erpnext/patches/v14_0/update_tds_fields.py b/erpnext/patches/v14_0/update_tds_fields.py
new file mode 100644
index 0000000..a333c5d
--- /dev/null
+++ b/erpnext/patches/v14_0/update_tds_fields.py
@@ -0,0 +1,29 @@
+import frappe
+from frappe.utils import nowdate
+
+from erpnext.accounts.utils import FiscalYearError, get_fiscal_year
+
+
+def execute():
+ # Only do for current fiscal year, no need to repost for all years
+ for company in frappe.get_all("Company"):
+ try:
+ fiscal_year_details = get_fiscal_year(date=nowdate(), company=company.name, as_dict=True)
+
+ purchase_invoice = frappe.qb.DocType("Purchase Invoice")
+
+ frappe.qb.update(purchase_invoice).set(
+ purchase_invoice.tax_withholding_net_total, purchase_invoice.net_total
+ ).set(
+ purchase_invoice.base_tax_withholding_net_total, purchase_invoice.base_net_total
+ ).where(
+ purchase_invoice.company == company.name
+ ).where(
+ purchase_invoice.apply_tds == 1
+ ).where(
+ purchase_invoice.posting_date >= fiscal_year_details.year_start_date
+ ).where(
+ purchase_invoice.docstatus == 1
+ ).run()
+ except FiscalYearError:
+ pass
diff --git a/erpnext/projects/doctype/timesheet/timesheet.js b/erpnext/projects/doctype/timesheet/timesheet.js
index e1486de..a376bf4 100644
--- a/erpnext/projects/doctype/timesheet/timesheet.js
+++ b/erpnext/projects/doctype/timesheet/timesheet.js
@@ -92,18 +92,26 @@
frm.fields_dict["time_logs"].grid.toggle_enable("billing_hours", false);
frm.fields_dict["time_logs"].grid.toggle_enable("is_billable", false);
}
+
+ let filters = {
+ "status": "Open"
+ };
+
+ if (frm.doc.customer) {
+ filters["customer"] = frm.doc.customer;
+ }
+
+ frm.set_query('parent_project', function(doc) {
+ return {
+ filters: filters
+ };
+ });
+
frm.trigger('setup_filters');
frm.trigger('set_dynamic_field_label');
},
customer: function(frm) {
- frm.set_query('parent_project', function(doc) {
- return {
- filters: {
- "customer": doc.customer
- }
- };
- });
frm.set_query('project', 'time_logs', function(doc) {
return {
filters: {
diff --git a/erpnext/public/js/bank_reconciliation_tool/data_table_manager.js b/erpnext/public/js/bank_reconciliation_tool/data_table_manager.js
index 5bb58fa..9ef8ce6 100644
--- a/erpnext/public/js/bank_reconciliation_tool/data_table_manager.js
+++ b/erpnext/public/js/bank_reconciliation_tool/data_table_manager.js
@@ -30,28 +30,28 @@
get_dt_columns() {
this.columns = [
{
- name: "Date",
+ name: __("Date"),
editable: false,
width: 100,
},
{
- name: "Party Type",
+ name: __("Party Type"),
editable: false,
width: 95,
},
{
- name: "Party",
+ name: __("Party"),
editable: false,
width: 100,
},
{
- name: "Description",
+ name: __("Description"),
editable: false,
width: 350,
},
{
- name: "Deposit",
+ name: __("Deposit"),
editable: false,
width: 100,
format: (value) =>
@@ -60,7 +60,7 @@
"</span>",
},
{
- name: "Withdrawal",
+ name: __("Withdrawal"),
editable: false,
width: 100,
format: (value) =>
@@ -69,26 +69,26 @@
"</span>",
},
{
- name: "Unallocated Amount",
+ name: __("Unallocated Amount"),
editable: false,
width: 100,
format: (value) =>
- "<span style='color:blue;'>" +
+ "<span style='color:var(--blue-500);'>" +
format_currency(value, this.currency) +
"</span>",
},
{
- name: "Reference Number",
+ name: __("Reference Number"),
editable: false,
width: 140,
},
{
- name: "Actions",
+ name: __("Actions"),
editable: false,
sortable: false,
focusable: false,
dropdown: false,
- width: 80,
+ width: 100,
},
];
}
@@ -118,7 +118,7 @@
row["reference_number"],
`
<Button class="btn btn-primary btn-xs center" data-name = ${row["name"]} >
- Actions
+ ${__("Actions")}
</a>
`,
];
diff --git a/erpnext/public/js/bank_reconciliation_tool/dialog_manager.js b/erpnext/public/js/bank_reconciliation_tool/dialog_manager.js
index cb34c9b..ca01f68 100644
--- a/erpnext/public/js/bank_reconciliation_tool/dialog_manager.js
+++ b/erpnext/public/js/bank_reconciliation_tool/dialog_manager.js
@@ -87,33 +87,33 @@
get_dt_columns() {
this.columns = [
{
- name: "Document Type",
+ name: __("Document Type"),
editable: false,
width: 125,
},
{
- name: "Document Name",
+ name: __("Document Name"),
editable: false,
width: 150,
},
{
- name: "Reference Date",
+ name: __("Reference Date"),
editable: false,
width: 120,
},
{
- name: "Amount",
+ name: __("Amount"),
editable: false,
width: 100,
},
{
- name: "Party",
+ name: __("Party"),
editable: false,
width: 120,
},
{
- name: "Reference Number",
+ name: __("Reference Number"),
editable: false,
width: 140,
},
@@ -222,7 +222,7 @@
{
fieldtype: "HTML",
fieldname: "no_matching_vouchers",
- options: "<div class=\"text-muted text-center\">No Matching Vouchers Found</div>"
+ options: __("<div class=\"text-muted text-center\">{0}</div>", [__("No Matching Vouchers Found")])
},
{
fieldtype: "Section Break",
@@ -444,10 +444,7 @@
vouchers: vouchers,
},
callback: (response) => {
- const alert_string =
- "Bank Transaction " +
- this.bank_transaction.name +
- " Matched";
+ const alert_string = __("Bank Transaction {0} Matched", [this.bank_transaction.name]);
frappe.show_alert(alert_string);
this.update_dt_cards(response.message);
this.dialog.hide();
@@ -471,10 +468,7 @@
cost_center: values.cost_center,
},
callback: (response) => {
- const alert_string =
- "Bank Transaction " +
- this.bank_transaction.name +
- " added as Payment Entry";
+ const alert_string = __("Bank Transaction {0} added as Payment Entry", [this.bank_transaction.name]);
frappe.show_alert(alert_string);
this.update_dt_cards(response.message);
this.dialog.hide();
@@ -498,10 +492,7 @@
second_account: values.second_account,
},
callback: (response) => {
- const alert_string =
- "Bank Transaction " +
- this.bank_transaction.name +
- " added as Journal Entry";
+ const alert_string = __("Bank Transaction {0} added as Journal Entry", [this.bank_transaction.name]);
frappe.show_alert(alert_string);
this.update_dt_cards(response.message);
this.dialog.hide();
@@ -520,10 +511,7 @@
party: values.party,
},
callback: (response) => {
- const alert_string =
- "Bank Transaction " +
- this.bank_transaction.name +
- " updated";
+ const alert_string = __("Bank Transaction {0} updated", [this.bank_transaction.name]);
frappe.show_alert(alert_string);
this.update_dt_cards(response.message);
this.dialog.hide();
diff --git a/erpnext/public/js/bank_reconciliation_tool/number_card.js b/erpnext/public/js/bank_reconciliation_tool/number_card.js
index e10d109..7e1b269 100644
--- a/erpnext/public/js/bank_reconciliation_tool/number_card.js
+++ b/erpnext/public/js/bank_reconciliation_tool/number_card.js
@@ -15,20 +15,20 @@
var chart_data = [
{
value: this.bank_statement_closing_balance,
- label: "Closing Balance as per Bank Statement",
+ label: __("Closing Balance as per Bank Statement"),
datatype: "Currency",
currency: this.currency,
},
{
value: this.cleared_balance,
- label: "Closing Balance as per ERP",
+ label: __("Closing Balance as per ERP"),
datatype: "Currency",
currency: this.currency,
},
{
value:
this.bank_statement_closing_balance - this.cleared_balance,
- label: "Difference",
+ label: __("Difference"),
datatype: "Currency",
currency: this.currency,
},
diff --git a/erpnext/public/js/bulk_transaction_processing.js b/erpnext/public/js/bulk_transaction_processing.js
index 101f50c..0e42b47 100644
--- a/erpnext/public/js/bulk_transaction_processing.js
+++ b/erpnext/public/js/bulk_transaction_processing.js
@@ -11,7 +11,7 @@
});
let count_of_rows = checked_items.length;
- frappe.confirm(__("Create {0} {1} ?", [count_of_rows, to_doctype]), ()=>{
+ frappe.confirm(__("Create {0} {1} ?", [count_of_rows, __(to_doctype)]), ()=>{
if (doc_name.length == 0) {
frappe.call({
method: "erpnext.utilities.bulk_transaction.transaction_processing",
@@ -20,11 +20,11 @@
});
if (count_of_rows > 10) {
- frappe.show_alert("Starting a background job to create {0} {1}", [count_of_rows, to_doctype]);
+ frappe.show_alert("Starting a background job to create {0} {1}", [count_of_rows, __(to_doctype)]);
}
} else {
frappe.msgprint(__("Selected document must be in submitted state"));
}
});
}
-});
\ No newline at end of file
+});
diff --git a/erpnext/public/js/controllers/accounts.js b/erpnext/public/js/controllers/accounts.js
index c1fe72b..a07f75d 100644
--- a/erpnext/public/js/controllers/accounts.js
+++ b/erpnext/public/js/controllers/accounts.js
@@ -143,6 +143,12 @@
cur_frm.cscript.account_head = function(doc, cdt, cdn) {
var d = locals[cdt][cdn];
+
+ if (doc.docstatus == 1) {
+ // Should not trigger any changes on change post submit
+ return;
+ }
+
if(!d.charge_type && d.account_head){
frappe.msgprint(__("Please select Charge Type first"));
frappe.model.set_value(cdt, cdn, "account_head", "");
diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js
index dd957c7..46ac808 100644
--- a/erpnext/public/js/controllers/transaction.js
+++ b/erpnext/public/js/controllers/transaction.js
@@ -341,6 +341,7 @@
this.set_dynamic_labels();
this.setup_sms();
this.setup_quality_inspection();
+ this.validate_has_items();
}
scan_barcode() {
@@ -348,6 +349,12 @@
barcode_scanner.process_scan();
}
+ validate_has_items () {
+ let table = this.frm.doc.items;
+ this.frm.has_items = (table && table.length
+ && table[0].qty && table[0].item_code);
+ }
+
apply_default_taxes() {
var me = this;
var taxes_and_charges_field = frappe.meta.get_docfield(me.frm.doc.doctype, "taxes_and_charges",
@@ -1200,7 +1207,7 @@
"base_rounding_adjustment"], company_currency);
this.frm.set_currency_labels(["total", "net_total", "total_taxes_and_charges", "discount_amount",
- "grand_total", "taxes_and_charges_added", "taxes_and_charges_deducted",
+ "grand_total", "taxes_and_charges_added", "taxes_and_charges_deducted","tax_withholding_net_total",
"rounded_total", "in_words", "paid_amount", "write_off_amount", "operating_cost",
"scrap_material_cost", "rounding_adjustment", "raw_material_cost",
"total_cost"], this.frm.doc.currency);
@@ -1217,7 +1224,7 @@
}
// toggle fields
- this.frm.toggle_display(["conversion_rate", "base_total", "base_net_total",
+ this.frm.toggle_display(["conversion_rate", "base_total", "base_net_total", "base_tax_withholding_net_total",
"base_total_taxes_and_charges", "base_taxes_and_charges_added", "base_taxes_and_charges_deducted",
"base_grand_total", "base_rounded_total", "base_in_words", "base_discount_amount",
"base_paid_amount", "base_write_off_amount", "base_operating_cost", "base_raw_material_cost",
diff --git a/erpnext/public/js/utils/barcode_scanner.js b/erpnext/public/js/utils/barcode_scanner.js
index 83b108b..a4f74bd 100644
--- a/erpnext/public/js/utils/barcode_scanner.js
+++ b/erpnext/public/js/utils/barcode_scanner.js
@@ -47,42 +47,49 @@
return;
}
- frappe
- .call({
- method: this.scan_api,
- args: {
- search_value: input,
- },
- })
- .then((r) => {
- const data = r && r.message;
- if (!data || Object.keys(data).length === 0) {
- this.show_alert(__("Cannot find Item with this Barcode"), "red");
- this.clean_up();
- this.play_fail_sound();
- reject();
- return;
- }
+ this.scan_api_call(input, (r) => {
+ const data = r && r.message;
+ if (!data || Object.keys(data).length === 0) {
+ this.show_alert(__("Cannot find Item with this Barcode"), "red");
+ this.clean_up();
+ this.play_fail_sound();
+ reject();
+ return;
+ }
- me.update_table(data).then(row => {
- this.play_success_sound();
- resolve(row);
- }).catch(() => {
- this.play_fail_sound();
- reject();
- });
+ me.update_table(data).then(row => {
+ this.play_success_sound();
+ resolve(row);
+ }).catch(() => {
+ this.play_fail_sound();
+ reject();
});
+ });
});
}
+ scan_api_call(input, callback) {
+ frappe
+ .call({
+ method: this.scan_api,
+ args: {
+ search_value: input,
+ },
+ })
+ .then((r) => {
+ callback(r);
+ });
+ }
+
update_table(data) {
return new Promise((resolve, reject) => {
let cur_grid = this.frm.fields_dict[this.items_table_name].grid;
const {item_code, barcode, batch_no, serial_no, uom} = data;
- let row = this.get_row_to_modify_on_scan(item_code, batch_no, uom);
+ let row = this.get_row_to_modify_on_scan(item_code, batch_no, uom, barcode);
+ this.is_new_row = false;
if (!row) {
if (this.dont_allow_new_row) {
this.show_alert(__("Maximum quantity scanned for item {0}.", [item_code]), "red");
@@ -90,11 +97,13 @@
reject();
return;
}
+ this.is_new_row = true;
// add new row if new item/batch is scanned
row = frappe.model.add_child(this.frm.doc, cur_grid.doctype, this.items_table_name);
// trigger any row add triggers defined on child table.
this.frm.script_manager.trigger(`${this.items_table_name}_add`, row.doctype, row.name);
+ this.frm.has_items = false;
}
if (this.is_duplicate_serial_no(row, serial_no)) {
@@ -105,7 +114,7 @@
frappe.run_serially([
() => this.set_selector_trigger_flag(data),
- () => this.set_item(row, item_code).then(qty => {
+ () => this.set_item(row, item_code, barcode, batch_no, serial_no).then(qty => {
this.show_scan_message(row.idx, row.item_code, qty);
}),
() => this.set_barcode_uom(row, uom),
@@ -136,7 +145,7 @@
frappe.flags.hide_serial_batch_dialog = false;
}
- set_item(row, item_code) {
+ set_item(row, item_code, barcode, batch_no, serial_no) {
return new Promise(resolve => {
const increment = async (value = 1) => {
const item_data = {item_code: item_code};
@@ -149,12 +158,186 @@
frappe.prompt(__("Please enter quantity for item {0}", [item_code]), ({value}) => {
increment(value).then((value) => resolve(value));
});
+ } else if (this.frm.has_items) {
+ this.prepare_item_for_scan(row, item_code, barcode, batch_no, serial_no);
} else {
increment().then((value) => resolve(value));
}
});
}
+ prepare_item_for_scan(row, item_code, barcode, batch_no, serial_no) {
+ var me = this;
+ this.dialog = new frappe.ui.Dialog({
+ title: __("Scan barcode for item {0}", [item_code]),
+ fields: me.get_fields_for_dialog(row, item_code, barcode, batch_no, serial_no),
+ })
+
+ this.dialog.set_primary_action(__("Update"), () => {
+ const item_data = {item_code: item_code};
+ item_data[this.qty_field] = this.dialog.get_value("scanned_qty");
+ item_data["has_item_scanned"] = 1;
+
+ this.remaining_qty = flt(this.dialog.get_value("qty")) - flt(this.dialog.get_value("scanned_qty"));
+ frappe.model.set_value(row.doctype, row.name, item_data);
+
+ frappe.run_serially([
+ () => this.set_batch_no(row, this.dialog.get_value("batch_no")),
+ () => this.set_barcode(row, this.dialog.get_value("barcode")),
+ () => this.set_serial_no(row, this.dialog.get_value("serial_no")),
+ () => this.add_child_for_remaining_qty(row),
+ () => this.clean_up()
+ ]);
+
+ this.dialog.hide();
+ });
+
+ this.dialog.show();
+
+ this.$scan_btn = this.dialog.$wrapper.find(".link-btn");
+ this.$scan_btn.css("display", "inline");
+ }
+
+ get_fields_for_dialog(row, item_code, barcode, batch_no, serial_no) {
+ let fields = [
+ {
+ fieldtype: "Data",
+ fieldname: "barcode_scanner",
+ options: "Barcode",
+ label: __("Scan Barcode"),
+ onchange: (e) => {
+ if (!e) {
+ return;
+ }
+
+ if (e.target.value) {
+ this.scan_api_call(e.target.value, (r) => {
+ if (r.message) {
+ this.update_dialog_values(item_code, r);
+ }
+ })
+ }
+ }
+ },
+ {
+ fieldtype: "Section Break",
+ },
+ {
+ fieldtype: "Float",
+ fieldname: "qty",
+ label: __("Quantity to Scan"),
+ default: row[this.qty_field] || 1,
+ },
+ {
+ fieldtype: "Column Break",
+ fieldname: "column_break_1",
+ },
+ {
+ fieldtype: "Float",
+ read_only: 1,
+ fieldname: "scanned_qty",
+ label: __("Scanned Quantity"),
+ default: 1,
+ },
+ {
+ fieldtype: "Section Break",
+ }
+ ]
+
+ if (batch_no) {
+ fields.push({
+ fieldtype: "Link",
+ fieldname: "batch_no",
+ options: "Batch No",
+ label: __("Batch No"),
+ default: batch_no,
+ read_only: 1,
+ hidden: 1
+ });
+ }
+
+ if (serial_no) {
+ fields.push({
+ fieldtype: "Small Text",
+ fieldname: "serial_no",
+ label: __("Serial Nos"),
+ default: serial_no,
+ read_only: 1,
+ });
+ }
+
+ if (barcode) {
+ fields.push({
+ fieldtype: "Data",
+ fieldname: "barcode",
+ options: "Barcode",
+ label: __("Barcode"),
+ default: barcode,
+ read_only: 1,
+ hidden: 1
+ });
+ }
+
+ return fields;
+ }
+
+ update_dialog_values(scanned_item, r) {
+ const {item_code, barcode, batch_no, serial_no} = r.message;
+
+ this.dialog.set_value("barcode_scanner", "");
+ if (item_code === scanned_item &&
+ (this.dialog.get_value("barcode") === barcode || batch_no || serial_no)) {
+
+ if (batch_no) {
+ this.dialog.set_value("batch_no", batch_no);
+ }
+
+ if (serial_no) {
+
+ this.validate_duplicate_serial_no(serial_no);
+ let serial_nos = this.dialog.get_value("serial_no") + "\n" + serial_no;
+ this.dialog.set_value("serial_no", serial_nos);
+ }
+
+ let qty = flt(this.dialog.get_value("scanned_qty")) + 1.0;
+ this.dialog.set_value("scanned_qty", qty);
+ }
+ }
+
+ validate_duplicate_serial_no(serial_no) {
+ let serial_nos = this.dialog.get_value("serial_no") ?
+ this.dialog.get_value("serial_no").split("\n") : [];
+
+ if (in_list(serial_nos, serial_no)) {
+ frappe.throw(__("Serial No {0} already scanned", [serial_no]));
+ }
+ }
+
+ add_child_for_remaining_qty(prev_row) {
+ if (this.remaining_qty && this.remaining_qty >0) {
+ let cur_grid = this.frm.fields_dict[this.items_table_name].grid;
+ let row = frappe.model.add_child(this.frm.doc, cur_grid.doctype, this.items_table_name);
+
+ let ignore_fields = ["name", "idx", "batch_no", "barcode",
+ "received_qty", "serial_no", "has_item_scanned"];
+
+ for (let key in prev_row) {
+ if (in_list(ignore_fields, key)) {
+ continue;
+ }
+
+ row[key] = prev_row[key];
+ }
+
+ row[this.qty_field] = this.remaining_qty;
+ if (this.qty_field == "qty" && frappe.meta.has_field(row.doctype, "stock_qty")) {
+ row["stock_qty"] = this.remaining_qty * row.conversion_factor;
+ }
+
+ this.frm.script_manager.trigger("item_code", row.doctype, row.name);
+ }
+ }
+
async set_serial_no(row, serial_no) {
if (serial_no && frappe.meta.has_field(row.doctype, this.serial_no_field)) {
const existing_serial_nos = row[this.serial_no_field];
@@ -205,7 +388,7 @@
return is_duplicate;
}
- get_row_to_modify_on_scan(item_code, batch_no, uom) {
+ get_row_to_modify_on_scan(item_code, batch_no, uom, barcode) {
let cur_grid = this.frm.fields_dict[this.items_table_name].grid;
// Check if batch is scanned and table has batch no field
@@ -214,12 +397,14 @@
const matching_row = (row) => {
const item_match = row.item_code == item_code;
- const batch_match = row[this.batch_no_field] == batch_no;
+ const batch_match = (!row[this.batch_no_field] || row[this.batch_no_field] == batch_no);
const uom_match = !uom || row[this.uom_field] == uom;
const qty_in_limit = flt(row[this.qty_field]) < flt(row[this.max_qty_field]);
+ const item_scanned = row.has_item_scanned;
return item_match
&& uom_match
+ && !item_scanned
&& (!is_batch_no_scan || batch_match)
&& (!check_max_qty || qty_in_limit)
}
diff --git a/erpnext/public/scss/point-of-sale.scss b/erpnext/public/scss/point-of-sale.scss
index 7a3854c..7b7530b 100644
--- a/erpnext/public/scss/point-of-sale.scss
+++ b/erpnext/public/scss/point-of-sale.scss
@@ -159,6 +159,12 @@
}
}
+ .item-img {
+ @extend .image;
+ border-radius: 8px 8px 0 0;
+ object-fit: cover;
+ }
+
> .item-detail {
display: flex;
flex-direction: column;
diff --git a/erpnext/quality_management/doctype/quality_procedure/quality_procedure.py b/erpnext/quality_management/doctype/quality_procedure/quality_procedure.py
index 72f9e6d..e860408 100644
--- a/erpnext/quality_management/doctype/quality_procedure/quality_procedure.py
+++ b/erpnext/quality_management/doctype/quality_procedure/quality_procedure.py
@@ -79,7 +79,7 @@
]
else:
return frappe.get_all(
- doctype,
+ "Quality Procedure",
fields=["name as value", "is_group as expandable"],
filters=dict(parent_quality_procedure=parent),
order_by="name asc",
diff --git a/erpnext/regional/united_states/setup.py b/erpnext/regional/united_states/setup.py
index b8f8572..47f24ef 100644
--- a/erpnext/regional/united_states/setup.py
+++ b/erpnext/regional/united_states/setup.py
@@ -49,7 +49,7 @@
dict(
fieldname="exempt_from_sales_tax",
fieldtype="Check",
- insert_after="represents_company",
+ insert_after="dn_required",
label="Is customer exempted from sales tax?",
)
],
diff --git a/erpnext/selling/doctype/customer/customer.json b/erpnext/selling/doctype/customer/customer.json
index 7cba141..7482a33 100644
--- a/erpnext/selling/doctype/customer/customer.json
+++ b/erpnext/selling/doctype/customer/customer.json
@@ -14,30 +14,35 @@
"naming_series",
"salutation",
"customer_name",
+ "customer_type",
+ "customer_group",
+ "column_break0",
+ "territory",
"gender",
- "default_bank_account",
- "tax_id",
- "tax_category",
- "tax_withholding_category",
"lead_name",
"opportunity_name",
- "image",
- "column_break0",
- "customer_group",
- "customer_type",
- "territory",
"account_manager",
- "so_required",
- "dn_required",
+ "image",
+ "defaults_tab",
+ "default_price_list",
+ "default_bank_account",
+ "column_break_14",
+ "default_currency",
+ "internal_customer_section",
"is_internal_customer",
"represents_company",
- "disabled",
- "allowed_to_transact_section",
+ "column_break_70",
"companies",
- "currency_and_price_list",
- "default_currency",
- "column_break_14",
- "default_price_list",
+ "more_info",
+ "market_segment",
+ "industry",
+ "customer_pos_id",
+ "website",
+ "language",
+ "column_break_45",
+ "customer_details",
+ "dashboard_tab",
+ "contact_and_address_tab",
"address_contacts",
"address_html",
"column_break1",
@@ -49,34 +54,39 @@
"column_break_26",
"customer_primary_address",
"primary_address",
- "default_receivable_accounts",
- "accounts",
+ "tax_tab",
+ "taxation_section",
+ "tax_id",
+ "column_break_21",
+ "tax_category",
+ "tax_withholding_category",
+ "accounting_tab",
"credit_limit_section",
"payment_terms",
"credit_limits",
- "more_info",
- "customer_details",
- "column_break_45",
- "market_segment",
- "industry",
- "website",
- "language",
- "is_frozen",
- "column_break_38",
+ "default_receivable_accounts",
+ "accounts",
+ "loyalty_points_tab",
"loyalty_program",
+ "column_break_54",
"loyalty_program_tier",
- "sales_team_section_break",
- "default_sales_partner",
- "default_commission_rate",
- "sales_team_section",
+ "sales_team_tab",
"sales_team",
- "customer_pos_id"
+ "sales_team_section",
+ "default_sales_partner",
+ "column_break_66",
+ "default_commission_rate",
+ "settings_tab",
+ "so_required",
+ "dn_required",
+ "column_break_53",
+ "is_frozen",
+ "disabled"
],
"fields": [
{
"fieldname": "basic_info",
"fieldtype": "Section Break",
- "label": "Name and Type",
"oldfieldtype": "Section Break",
"options": "fa fa-user"
},
@@ -217,24 +227,12 @@
},
{
"depends_on": "represents_company",
- "fieldname": "allowed_to_transact_section",
- "fieldtype": "Section Break",
- "label": "Allowed To Transact With"
- },
- {
- "depends_on": "represents_company",
"fieldname": "companies",
"fieldtype": "Table",
"label": "Allowed To Transact With",
"options": "Allowed To Transact With"
},
{
- "collapsible": 1,
- "fieldname": "currency_and_price_list",
- "fieldtype": "Section Break",
- "label": "Currency and Price List"
- },
- {
"fieldname": "default_currency",
"fieldtype": "Link",
"ignore_user_permissions": 1,
@@ -295,7 +293,7 @@
"description": "Select, to make the customer searchable with these fields",
"fieldname": "primary_address_and_contact_detail",
"fieldtype": "Section Break",
- "label": "Primary Address and Contact Detail"
+ "label": "Primary Address and Contact"
},
{
"description": "Reselect, if the chosen contact is edited after save",
@@ -334,20 +332,18 @@
"read_only": 1
},
{
- "collapsible": 1,
"fieldname": "default_receivable_accounts",
"fieldtype": "Section Break",
"label": "Default Receivable Accounts"
},
{
- "description": "Mention if non-standard receivable account",
+ "description": "Mention if a non-standard receivable account",
"fieldname": "accounts",
"fieldtype": "Table",
- "label": "Accounts",
+ "label": "Receivable Accounts",
"options": "Party Account"
},
{
- "collapsible": 1,
"fieldname": "credit_limit_section",
"fieldtype": "Section Break",
"label": "Credit Limit and Payment Terms"
@@ -398,12 +394,6 @@
"label": "Is Frozen"
},
{
- "collapsible": 1,
- "fieldname": "column_break_38",
- "fieldtype": "Section Break",
- "label": "Loyalty Points"
- },
- {
"fieldname": "loyalty_program",
"fieldtype": "Link",
"label": "Loyalty Program",
@@ -418,15 +408,6 @@
"read_only": 1
},
{
- "collapsible": 1,
- "collapsible_depends_on": "default_sales_partner",
- "fieldname": "sales_team_section_break",
- "fieldtype": "Section Break",
- "label": "Sales Partner and Commission",
- "oldfieldtype": "Section Break",
- "options": "fa fa-group"
- },
- {
"fieldname": "default_sales_partner",
"fieldtype": "Link",
"ignore_user_permissions": 1,
@@ -446,13 +427,12 @@
"collapsible": 1,
"collapsible_depends_on": "sales_team",
"fieldname": "sales_team_section",
- "fieldtype": "Section Break",
- "label": "Sales Team"
+ "fieldtype": "Section Break"
},
{
"fieldname": "sales_team",
"fieldtype": "Table",
- "label": "Sales Team Details",
+ "label": "Sales Team",
"oldfieldname": "sales_team",
"oldfieldtype": "Table",
"options": "Sales Team"
@@ -498,6 +478,83 @@
"no_copy": 1,
"options": "Opportunity",
"print_hide": 1
+ },
+ {
+ "fieldname": "contact_and_address_tab",
+ "fieldtype": "Tab Break",
+ "label": "Contact & Address"
+ },
+ {
+ "fieldname": "defaults_tab",
+ "fieldtype": "Section Break",
+ "label": "Defaults"
+ },
+ {
+ "fieldname": "settings_tab",
+ "fieldtype": "Tab Break",
+ "label": "Settings"
+ },
+ {
+ "collapsible": 1,
+ "collapsible_depends_on": "default_sales_partner",
+ "fieldname": "sales_team_tab",
+ "fieldtype": "Tab Break",
+ "label": "Sales Team",
+ "oldfieldtype": "Section Break",
+ "options": "fa fa-group"
+ },
+ {
+ "fieldname": "column_break_66",
+ "fieldtype": "Column Break"
+ },
+ {
+ "fieldname": "column_break_21",
+ "fieldtype": "Column Break"
+ },
+ {
+ "fieldname": "dashboard_tab",
+ "fieldtype": "Tab Break",
+ "label": "Dashboard",
+ "show_dashboard": 1
+ },
+ {
+ "fieldname": "column_break_53",
+ "fieldtype": "Column Break"
+ },
+ {
+ "collapsible": 1,
+ "fieldname": "loyalty_points_tab",
+ "fieldtype": "Section Break",
+ "label": "Loyalty Points"
+ },
+ {
+ "fieldname": "taxation_section",
+ "fieldtype": "Section Break"
+ },
+ {
+ "fieldname": "accounting_tab",
+ "fieldtype": "Tab Break",
+ "label": "Accounting"
+ },
+ {
+ "fieldname": "tax_tab",
+ "fieldtype": "Tab Break",
+ "label": "Tax"
+ },
+ {
+ "collapsible": 1,
+ "collapsible_depends_on": "is_internal_customer",
+ "fieldname": "internal_customer_section",
+ "fieldtype": "Section Break",
+ "label": "Internal Customer"
+ },
+ {
+ "fieldname": "column_break_70",
+ "fieldtype": "Column Break"
+ },
+ {
+ "fieldname": "column_break_54",
+ "fieldtype": "Column Break"
}
],
"icon": "fa fa-user",
@@ -511,7 +568,7 @@
"link_fieldname": "party"
}
],
- "modified": "2022-04-16 20:32:34.000304",
+ "modified": "2022-11-08 15:52:34.462657",
"modified_by": "Administrator",
"module": "Selling",
"name": "Customer",
diff --git a/erpnext/selling/doctype/customer/customer.py b/erpnext/selling/doctype/customer/customer.py
index 6605685..d0eb377 100644
--- a/erpnext/selling/doctype/customer/customer.py
+++ b/erpnext/selling/doctype/customer/customer.py
@@ -294,7 +294,7 @@
def after_rename(self, olddn, newdn, merge=False):
if frappe.defaults.get_global_default("cust_master_name") == "Customer Name":
- frappe.db.set(self, "customer_name", newdn)
+ self.db_set("customer_name", newdn)
def set_loyalty_program(self):
if self.loyalty_program:
diff --git a/erpnext/selling/doctype/customer_credit_limit/customer_credit_limit.json b/erpnext/selling/doctype/customer_credit_limit/customer_credit_limit.json
index 800cb57..2fd0c67 100644
--- a/erpnext/selling/doctype/customer_credit_limit/customer_credit_limit.json
+++ b/erpnext/selling/doctype/customer_credit_limit/customer_credit_limit.json
@@ -12,7 +12,7 @@
],
"fields": [
{
- "columns": 4,
+ "columns": 3,
"fieldname": "credit_limit",
"fieldtype": "Currency",
"in_list_view": 1,
@@ -31,6 +31,7 @@
"options": "Company"
},
{
+ "columns": 3,
"default": "0",
"fieldname": "bypass_credit_limit_check",
"fieldtype": "Check",
@@ -40,7 +41,7 @@
],
"istable": 1,
"links": [],
- "modified": "2019-12-31 15:43:05.822328",
+ "modified": "2022-11-08 15:19:13.927194",
"modified_by": "Administrator",
"module": "Selling",
"name": "Customer Credit Limit",
@@ -48,5 +49,6 @@
"permissions": [],
"quick_entry": 1,
"sort_field": "modified",
- "sort_order": "DESC"
+ "sort_order": "DESC",
+ "states": []
}
\ No newline at end of file
diff --git a/erpnext/selling/doctype/installation_note/installation_note.py b/erpnext/selling/doctype/installation_note/installation_note.py
index dd0b1e8..0ef4754 100644
--- a/erpnext/selling/doctype/installation_note/installation_note.py
+++ b/erpnext/selling/doctype/installation_note/installation_note.py
@@ -87,13 +87,13 @@
frappe.throw(_("Please pull items from Delivery Note"))
def on_update(self):
- frappe.db.set(self, "status", "Draft")
+ self.db_set("status", "Draft")
def on_submit(self):
self.validate_serial_no()
self.update_prevdoc_status()
- frappe.db.set(self, "status", "Submitted")
+ self.db_set("status", "Submitted")
def on_cancel(self):
self.update_prevdoc_status()
- frappe.db.set(self, "status", "Cancelled")
+ self.db_set("status", "Cancelled")
diff --git a/erpnext/selling/doctype/quotation/quotation.py b/erpnext/selling/doctype/quotation/quotation.py
index 96092b1..484b8c9 100644
--- a/erpnext/selling/doctype/quotation/quotation.py
+++ b/erpnext/selling/doctype/quotation/quotation.py
@@ -119,10 +119,10 @@
if not (self.is_fully_ordered() or self.is_partially_ordered()):
get_lost_reasons = frappe.get_list("Quotation Lost Reason", fields=["name"])
lost_reasons_lst = [reason.get("name") for reason in get_lost_reasons]
- frappe.db.set(self, "status", "Lost")
+ self.db_set("status", "Lost")
if detailed_reason:
- frappe.db.set(self, "order_lost_reason", detailed_reason)
+ self.db_set("order_lost_reason", detailed_reason)
for reason in lost_reasons_list:
if reason.get("lost_reason") in lost_reasons_lst:
@@ -247,7 +247,7 @@
"Quotation": {"doctype": "Sales Order", "validation": {"docstatus": ["=", 1]}},
"Quotation Item": {
"doctype": "Sales Order Item",
- "field_map": {"parent": "prevdoc_docname"},
+ "field_map": {"parent": "prevdoc_docname", "name": "quotation_item"},
"postprocess": update_item,
"condition": lambda doc: doc.qty > 0,
},
diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py
index 1f3419f..78e2370 100755
--- a/erpnext/selling/doctype/sales_order/sales_order.py
+++ b/erpnext/selling/doctype/sales_order/sales_order.py
@@ -193,6 +193,9 @@
{"Quotation": {"ref_dn_field": "prevdoc_docname", "compare_fields": [["company", "="]]}}
)
+ if cint(frappe.db.get_single_value("Selling Settings", "maintain_same_sales_rate")):
+ self.validate_rate_with_reference_doc([["Quotation", "prev_docname", "quotation_item"]])
+
def update_enquiry_status(self, prevdoc, flag):
enq = frappe.db.sql(
"select t2.prevdoc_docname from `tabQuotation` t1, `tabQuotation Item` t2 where t2.parent = t1.name and t1.name=%s",
@@ -246,7 +249,7 @@
self.update_project()
self.update_prevdoc_status("cancel")
- frappe.db.set(self, "status", "Cancelled")
+ self.db_set("status", "Cancelled")
self.update_blanket_order()
diff --git a/erpnext/selling/doctype/sales_order/test_sales_order.py b/erpnext/selling/doctype/sales_order/test_sales_order.py
index dfa341b..e777f52 100644
--- a/erpnext/selling/doctype/sales_order/test_sales_order.py
+++ b/erpnext/selling/doctype/sales_order/test_sales_order.py
@@ -1774,6 +1774,69 @@
sales_order.save()
self.assertEqual(sales_order.taxes[0].tax_amount, 0)
+ def test_sales_order_partial_advance_payment(self):
+ from erpnext.accounts.doctype.payment_entry.test_payment_entry import (
+ create_payment_entry,
+ get_payment_entry,
+ )
+ from erpnext.selling.doctype.customer.test_customer import get_customer_dict
+
+ # Make a customer
+ customer = get_customer_dict("QA Logistics")
+ frappe.get_doc(customer).insert()
+
+ # Make a Sales Order
+ so = make_sales_order(
+ customer="QA Logistics",
+ item_list=[
+ {"item_code": "_Test Item", "qty": 1, "rate": 200},
+ {"item_code": "_Test Item 2", "qty": 1, "rate": 300},
+ ],
+ )
+
+ # Create a advance payment against that Sales Order
+ pe = get_payment_entry("Sales Order", so.name, bank_account="_Test Bank - _TC")
+ pe.reference_no = "1"
+ pe.reference_date = nowdate()
+ pe.paid_from_account_currency = so.currency
+ pe.paid_to_account_currency = so.currency
+ pe.source_exchange_rate = 1
+ pe.target_exchange_rate = 1
+ pe.paid_amount = so.grand_total
+ pe.save(ignore_permissions=True)
+ pe.submit()
+
+ # Make standalone advance payment entry
+ create_payment_entry(
+ payment_type="Receive",
+ party_type="Customer",
+ party="QA Logistics",
+ paid_from="Debtors - _TC",
+ paid_to="_Test Bank - _TC",
+ save=1,
+ submit=1,
+ )
+
+ si = make_sales_invoice(so.name)
+
+ item = si.get("items")[1]
+ si.remove(item)
+
+ si.allocate_advances_automatically = 1
+ si.save()
+
+ self.assertEqual(len(si.get("advances")), 1)
+ self.assertEqual(si.get("advances")[0].allocated_amount, 200)
+ self.assertEqual(si.get("advances")[0].reference_name, pe.name)
+
+ si.submit()
+ pe.load_from_db()
+
+ self.assertEqual(pe.references[0].reference_name, si.name)
+ self.assertEqual(pe.references[0].allocated_amount, 200)
+ self.assertEqual(pe.references[1].reference_name, so.name)
+ self.assertEqual(pe.references[1].allocated_amount, 300)
+
def automatically_fetch_payment_terms(enable=1):
accounts_settings = frappe.get_doc("Accounts Settings")
diff --git a/erpnext/selling/doctype/sales_order_item/sales_order_item.json b/erpnext/selling/doctype/sales_order_item/sales_order_item.json
index ea0b25f..8c7c552 100644
--- a/erpnext/selling/doctype/sales_order_item/sales_order_item.json
+++ b/erpnext/selling/doctype/sales_order_item/sales_order_item.json
@@ -70,6 +70,7 @@
"warehouse",
"target_warehouse",
"prevdoc_docname",
+ "quotation_item",
"col_break4",
"against_blanket_order",
"blanket_order",
@@ -838,12 +839,20 @@
"label": "Purchase Order Item",
"print_hide": 1,
"read_only": 1
+ },
+ {
+ "fieldname": "quotation_item",
+ "fieldtype": "Data",
+ "hidden": 1,
+ "label": "quotation_item",
+ "no_copy": 1,
+ "read_only": 1
}
],
"idx": 1,
"istable": 1,
"links": [],
- "modified": "2022-10-26 16:05:02.712705",
+ "modified": "2022-11-10 18:20:30.137455",
"modified_by": "Administrator",
"module": "Selling",
"name": "Sales Order Item",
diff --git a/erpnext/selling/page/point_of_sale/point_of_sale.py b/erpnext/selling/page/point_of_sale/point_of_sale.py
index c12a9f8..999ddc2 100644
--- a/erpnext/selling/page/point_of_sale/point_of_sale.py
+++ b/erpnext/selling/page/point_of_sale/point_of_sale.py
@@ -6,6 +6,7 @@
from typing import Dict, Optional
import frappe
+from frappe.utils import cint
from frappe.utils.nestedset import get_root_of
from erpnext.accounts.doctype.pos_invoice.pos_invoice import get_stock_availability
@@ -108,10 +109,10 @@
item.name asc
LIMIT
{page_length} offset {start}""".format(
- start=start,
- page_length=page_length,
- lft=lft,
- rgt=rgt,
+ start=cint(start),
+ page_length=cint(page_length),
+ lft=cint(lft),
+ rgt=cint(rgt),
condition=condition,
bin_join_selection=bin_join_selection,
bin_join_condition=bin_join_condition,
diff --git a/erpnext/selling/page/point_of_sale/pos_controller.js b/erpnext/selling/page/point_of_sale/pos_controller.js
index 24375d8..595b919 100644
--- a/erpnext/selling/page/point_of_sale/pos_controller.js
+++ b/erpnext/selling/page/point_of_sale/pos_controller.js
@@ -67,7 +67,7 @@
{
fieldtype: 'Link', label: __('POS Profile'),
options: 'POS Profile', fieldname: 'pos_profile', reqd: 1,
- get_query: () => pos_profile_query,
+ get_query: () => pos_profile_query(),
onchange: () => fetch_pos_payment_methods()
},
{
@@ -101,9 +101,11 @@
primary_action_label: __('Submit')
});
dialog.show();
- const pos_profile_query = {
- query: 'erpnext.accounts.doctype.pos_profile.pos_profile.pos_profile_query',
- filters: { company: dialog.fields_dict.company.get_value() }
+ const pos_profile_query = () => {
+ return {
+ query: 'erpnext.accounts.doctype.pos_profile.pos_profile.pos_profile_query',
+ filters: { company: dialog.fields_dict.company.get_value() }
+ }
};
}
diff --git a/erpnext/selling/page/point_of_sale/pos_item_selector.js b/erpnext/selling/page/point_of_sale/pos_item_selector.js
index 7a90fb0..b5eb048 100644
--- a/erpnext/selling/page/point_of_sale/pos_item_selector.js
+++ b/erpnext/selling/page/point_of_sale/pos_item_selector.js
@@ -103,9 +103,9 @@
<div class="flex items-center justify-center h-32 border-b-grey text-6xl text-grey-100">
<img
onerror="cur_pos.item_selector.handle_broken_image(this)"
- class="h-full" src="${item_image}"
+ class="h-full item-img" src="${item_image}"
alt="${frappe.get_abbr(item.item_name)}"
- style="object-fit: cover;">
+ >
</div>`;
} else {
return `<div class="item-qty-pill">
diff --git a/erpnext/setup/doctype/company/company.py b/erpnext/setup/doctype/company/company.py
index 490504a..d6f2378 100644
--- a/erpnext/setup/doctype/company/company.py
+++ b/erpnext/setup/doctype/company/company.py
@@ -207,15 +207,14 @@
frappe.local.flags.ignore_root_company_validation = True
create_charts(self.name, self.chart_of_accounts, self.existing_company)
- frappe.db.set(
- self,
+ self.db_set(
"default_receivable_account",
frappe.db.get_value(
"Account", {"company": self.name, "account_type": "Receivable", "is_group": 0}
),
)
- frappe.db.set(
- self,
+
+ self.db_set(
"default_payable_account",
frappe.db.get_value(
"Account", {"company": self.name, "account_type": "Payable", "is_group": 0}
@@ -491,12 +490,12 @@
cc_doc.flags.ignore_mandatory = True
cc_doc.insert()
- frappe.db.set(self, "cost_center", _("Main") + " - " + self.abbr)
- frappe.db.set(self, "round_off_cost_center", _("Main") + " - " + self.abbr)
- frappe.db.set(self, "depreciation_cost_center", _("Main") + " - " + self.abbr)
+ self.db_set("cost_center", _("Main") + " - " + self.abbr)
+ self.db_set("round_off_cost_center", _("Main") + " - " + self.abbr)
+ self.db_set("depreciation_cost_center", _("Main") + " - " + self.abbr)
def after_rename(self, olddn, newdn, merge=False):
- frappe.db.set(self, "company_name", newdn)
+ self.db_set("company_name", newdn)
frappe.db.sql(
"""update `tabDefaultValue` set defvalue=%s
@@ -690,11 +689,11 @@
name as value,
is_group as expandable
from
- `tab{doctype}` comp
+ `tabCompany` comp
where
ifnull(parent_company, "")={parent}
""".format(
- doctype=doctype, parent=frappe.db.escape(parent)
+ parent=frappe.db.escape(parent)
),
as_dict=1,
)
diff --git a/erpnext/setup/doctype/department/department.py b/erpnext/setup/doctype/department/department.py
index c4766ee..1745178 100644
--- a/erpnext/setup/doctype/department/department.py
+++ b/erpnext/setup/doctype/department/department.py
@@ -63,7 +63,7 @@
else:
filters["parent_department"] = parent
- return frappe.get_all(doctype, fields=fields, filters=filters, order_by="name")
+ return frappe.get_all("Department", fields=fields, filters=filters, order_by="name")
@frappe.whitelist()
diff --git a/erpnext/stock/doctype/delivery_note/test_delivery_note.py b/erpnext/stock/doctype/delivery_note/test_delivery_note.py
index 1b9f168..d747383 100644
--- a/erpnext/stock/doctype/delivery_note/test_delivery_note.py
+++ b/erpnext/stock/doctype/delivery_note/test_delivery_note.py
@@ -1050,9 +1050,22 @@
do_not_submit=True,
)
+ dn.append(
+ "taxes",
+ {
+ "charge_type": "On Net Total",
+ "account_head": "_Test Account Service Tax - _TC",
+ "description": "Tax 1",
+ "rate": 14,
+ "cost_center": "_Test Cost Center - _TC",
+ "included_in_print_rate": 1,
+ },
+ )
+
self.assertEqual(dn.items[0].rate, 500) # haven't saved yet
dn.save()
self.assertEqual(dn.ignore_pricing_rule, 1)
+ self.assertEqual(dn.taxes[0].included_in_print_rate, 0)
# rate should reset to incoming rate
self.assertEqual(dn.items[0].rate, rate)
@@ -1063,6 +1076,7 @@
dn.save()
self.assertEqual(dn.items[0].rate, rate)
+ self.assertEqual(dn.items[0].net_rate, rate)
def test_internal_transfer_precision_gle(self):
from erpnext.selling.doctype.customer.test_customer import create_internal_customer
diff --git a/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json b/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json
index 77c3253..3229463 100644
--- a/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json
+++ b/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json
@@ -8,6 +8,7 @@
"engine": "InnoDB",
"field_order": [
"barcode",
+ "has_item_scanned",
"item_code",
"item_name",
"col_break1",
@@ -809,13 +810,21 @@
"label": "Purchase Order Item",
"print_hide": 1,
"read_only": 1
+ },
+ {
+ "default": "0",
+ "depends_on": "barcode",
+ "fieldname": "has_item_scanned",
+ "fieldtype": "Check",
+ "label": "Has Item Scanned",
+ "read_only": 1
}
],
"idx": 1,
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
- "modified": "2022-10-26 16:05:17.720768",
+ "modified": "2022-11-02 12:54:07.225623",
"modified_by": "Administrator",
"module": "Stock",
"name": "Delivery Note Item",
diff --git a/erpnext/stock/doctype/material_request/material_request.py b/erpnext/stock/doctype/material_request/material_request.py
index 2614a7f..04aee42 100644
--- a/erpnext/stock/doctype/material_request/material_request.py
+++ b/erpnext/stock/doctype/material_request/material_request.py
@@ -10,7 +10,7 @@
import frappe
from frappe import _, msgprint
from frappe.model.mapper import get_mapped_doc
-from frappe.utils import cstr, flt, get_link_to_form, getdate, new_line_sep, nowdate
+from frappe.utils import cint, cstr, flt, get_link_to_form, getdate, new_line_sep, nowdate
from erpnext.buying.utils import check_on_hold_or_closed_status, validate_for_items
from erpnext.controllers.buying_controller import BuyingController
@@ -120,7 +120,6 @@
self.title = _("{0} Request for {1}").format(self.material_request_type, items)[:100]
def on_submit(self):
- # frappe.db.set(self, 'status', 'Submitted')
self.update_requested_qty()
self.update_requested_qty_in_production_plan()
if self.material_request_type == "Purchase":
@@ -501,13 +500,13 @@
and mr.per_ordered < 99.99
and mr.docstatus = 1
and mr.status != 'Stopped'
- and mr.company = '{1}'
- {2}
+ and mr.company = %s
+ {1}
order by mr_item.item_code ASC
- limit {3} offset {4} """.format(
- ", ".join(["%s"] * len(supplier_items)), filters.get("company"), conditions, page_len, start
+ limit {2} offset {3} """.format(
+ ", ".join(["%s"] * len(supplier_items)), conditions, cint(page_len), cint(start)
),
- tuple(supplier_items),
+ tuple(supplier_items) + (filters.get("company"),),
as_dict=1,
)
diff --git a/erpnext/stock/doctype/material_request/test_material_request.py b/erpnext/stock/doctype/material_request/test_material_request.py
index f02462c..f0a9499 100644
--- a/erpnext/stock/doctype/material_request/test_material_request.py
+++ b/erpnext/stock/doctype/material_request/test_material_request.py
@@ -216,7 +216,7 @@
po.load_from_db()
mr.update_status("Stopped")
self.assertRaises(frappe.InvalidStatusError, po.submit)
- frappe.db.set(po, "docstatus", 1)
+ po.db_set("docstatus", 1)
self.assertRaises(frappe.InvalidStatusError, po.cancel)
# resubmit and check for per complete
diff --git a/erpnext/stock/doctype/pick_list/pick_list.py b/erpnext/stock/doctype/pick_list/pick_list.py
index 9c1c7e5..5de7fed 100644
--- a/erpnext/stock/doctype/pick_list/pick_list.py
+++ b/erpnext/stock/doctype/pick_list/pick_list.py
@@ -10,6 +10,8 @@
from frappe import _
from frappe.model.document import Document
from frappe.model.mapper import map_child_doc
+from frappe.query_builder import Case
+from frappe.query_builder.functions import Locate
from frappe.utils import cint, floor, flt, today
from frappe.utils.nestedset import get_descendants_of
@@ -686,31 +688,22 @@
@frappe.whitelist()
def get_pending_work_orders(doctype, txt, searchfield, start, page_length, filters, as_dict):
- return frappe.db.sql(
- """
- SELECT
- `name`, `company`, `planned_start_date`
- FROM
- `tabWork Order`
- WHERE
- `status` not in ('Completed', 'Stopped')
- AND `qty` > `material_transferred_for_manufacturing`
- AND `docstatus` = 1
- AND `company` = %(company)s
- AND `name` like %(txt)s
- ORDER BY
- (case when locate(%(_txt)s, name) > 0 then locate(%(_txt)s, name) else 99999 end) name
- LIMIT
- %(start)s, %(page_length)s""",
- {
- "txt": "%%%s%%" % txt,
- "_txt": txt.replace("%", ""),
- "start": start,
- "page_length": frappe.utils.cint(page_length),
- "company": filters.get("company"),
- },
- as_dict=as_dict,
- )
+ wo = frappe.qb.DocType("Work Order")
+ return (
+ frappe.qb.from_(wo)
+ .select(wo.name, wo.company, wo.planned_start_date)
+ .where(
+ (wo.status.notin(["Completed", "Stopped"]))
+ & (wo.qty > wo.material_transferred_for_manufacturing)
+ & (wo.docstatus == 1)
+ & (wo.company == filters.get("company"))
+ & (wo.name.like("%{0}%".format(txt)))
+ )
+ .orderby(Case().when(Locate(txt, wo.name) > 0, Locate(txt, wo.name)).else_(99999))
+ .orderby(wo.name)
+ .limit(cint(page_length))
+ .offset(start)
+ ).run(as_dict=as_dict)
@frappe.whitelist()
diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
index f85c478..673fcb5 100644
--- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
+++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
@@ -6,7 +6,9 @@
from frappe import _, throw
from frappe.desk.notifications import clear_doctype_notifications
from frappe.model.mapper import get_mapped_doc
+from frappe.query_builder.functions import CombineDatetime
from frappe.utils import cint, flt, getdate, nowdate
+from pypika import functions as fn
import erpnext
from erpnext.accounts.utils import get_account_currency
@@ -750,48 +752,38 @@
def update_billing_status(self, update_modified=True):
updated_pr = [self.name]
+ po_details = []
for d in self.get("items"):
if d.get("purchase_invoice") and d.get("purchase_invoice_item"):
d.db_set("billed_amt", d.amount, update_modified=update_modified)
elif d.purchase_order_item:
- updated_pr += update_billed_amount_based_on_po(d.purchase_order_item, update_modified)
+ po_details.append(d.purchase_order_item)
+
+ if po_details:
+ updated_pr += update_billed_amount_based_on_po(po_details, update_modified)
for pr in set(updated_pr):
- pr_doc = self if (pr == self.name) else frappe.get_doc("Purchase Receipt", pr)
+ pr_doc = self if (pr == self.name) else frappe.get_cached_doc("Purchase Receipt", pr)
update_billing_percentage(pr_doc, update_modified=update_modified)
self.load_from_db()
-def update_billed_amount_based_on_po(po_detail, update_modified=True):
- # Billed against Sales Order directly
- billed_against_po = frappe.db.sql(
- """select sum(amount) from `tabPurchase Invoice Item`
- where po_detail=%s and (pr_detail is null or pr_detail = '') and docstatus=1""",
- po_detail,
- )
- billed_against_po = billed_against_po and billed_against_po[0][0] or 0
+def update_billed_amount_based_on_po(po_details, update_modified=True):
+ po_billed_amt_details = get_billed_amount_against_po(po_details)
- # Get all Purchase Receipt Item rows against the Purchase Order Item row
- pr_details = frappe.db.sql(
- """select pr_item.name, pr_item.amount, pr_item.parent
- from `tabPurchase Receipt Item` pr_item, `tabPurchase Receipt` pr
- where pr.name=pr_item.parent and pr_item.purchase_order_item=%s
- and pr.docstatus=1 and pr.is_return = 0
- order by pr.posting_date asc, pr.posting_time asc, pr.name asc""",
- po_detail,
- as_dict=1,
- )
+ # Get all Purchase Receipt Item rows against the Purchase Order Items
+ pr_details = get_purchase_receipts_against_po_details(po_details)
+
+ pr_items = [pr_detail.name for pr_detail in pr_details]
+ pr_items_billed_amount = get_billed_amount_against_pr(pr_items)
updated_pr = []
for pr_item in pr_details:
+ billed_against_po = flt(po_billed_amt_details.get(pr_item.purchase_order_item))
+
# Get billed amount directly against Purchase Receipt
- billed_amt_agianst_pr = frappe.db.sql(
- """select sum(amount) from `tabPurchase Invoice Item`
- where pr_detail=%s and docstatus=1""",
- pr_item.name,
- )
- billed_amt_agianst_pr = billed_amt_agianst_pr and billed_amt_agianst_pr[0][0] or 0
+ billed_amt_agianst_pr = flt(pr_items_billed_amount.get(pr_item.name, 0))
# Distribute billed amount directly against PO between PRs based on FIFO
if billed_against_po and billed_amt_agianst_pr < pr_item.amount:
@@ -803,19 +795,90 @@
billed_amt_agianst_pr += billed_against_po
billed_against_po = 0
- frappe.db.set_value(
- "Purchase Receipt Item",
- pr_item.name,
- "billed_amt",
- billed_amt_agianst_pr,
- update_modified=update_modified,
- )
+ po_billed_amt_details[pr_item.purchase_order_item] = billed_against_po
- updated_pr.append(pr_item.parent)
+ if pr_item.billed_amt != billed_amt_agianst_pr:
+ frappe.db.set_value(
+ "Purchase Receipt Item",
+ pr_item.name,
+ "billed_amt",
+ billed_amt_agianst_pr,
+ update_modified=update_modified,
+ )
+
+ updated_pr.append(pr_item.parent)
return updated_pr
+def get_purchase_receipts_against_po_details(po_details):
+ # Get Purchase Receipts against Purchase Order Items
+
+ purchase_receipt = frappe.qb.DocType("Purchase Receipt")
+ purchase_receipt_item = frappe.qb.DocType("Purchase Receipt Item")
+
+ query = (
+ frappe.qb.from_(purchase_receipt)
+ .inner_join(purchase_receipt_item)
+ .on(purchase_receipt.name == purchase_receipt_item.parent)
+ .select(
+ purchase_receipt_item.name,
+ purchase_receipt_item.parent,
+ purchase_receipt_item.amount,
+ purchase_receipt_item.billed_amt,
+ purchase_receipt_item.purchase_order_item,
+ )
+ .where(
+ (purchase_receipt_item.purchase_order_item.isin(po_details))
+ & (purchase_receipt.docstatus == 1)
+ & (purchase_receipt.is_return == 0)
+ )
+ .orderby(CombineDatetime(purchase_receipt.posting_date, purchase_receipt.posting_time))
+ .orderby(purchase_receipt.name)
+ )
+
+ return query.run(as_dict=True)
+
+
+def get_billed_amount_against_pr(pr_items):
+ # Get billed amount directly against Purchase Receipt
+
+ if not pr_items:
+ return {}
+
+ purchase_invoice_item = frappe.qb.DocType("Purchase Invoice Item")
+
+ query = (
+ frappe.qb.from_(purchase_invoice_item)
+ .select(fn.Sum(purchase_invoice_item.amount).as_("billed_amt"), purchase_invoice_item.pr_detail)
+ .where((purchase_invoice_item.pr_detail.isin(pr_items)) & (purchase_invoice_item.docstatus == 1))
+ .groupby(purchase_invoice_item.pr_detail)
+ ).run(as_dict=1)
+
+ return {d.pr_detail: flt(d.billed_amt) for d in query}
+
+
+def get_billed_amount_against_po(po_items):
+ # Get billed amount directly against Purchase Order
+ if not po_items:
+ return {}
+
+ purchase_invoice_item = frappe.qb.DocType("Purchase Invoice Item")
+
+ query = (
+ frappe.qb.from_(purchase_invoice_item)
+ .select(fn.Sum(purchase_invoice_item.amount).as_("billed_amt"), purchase_invoice_item.po_detail)
+ .where(
+ (purchase_invoice_item.po_detail.isin(po_items))
+ & (purchase_invoice_item.docstatus == 1)
+ & (purchase_invoice_item.pr_detail.isnull())
+ )
+ .groupby(purchase_invoice_item.po_detail)
+ ).run(as_dict=1)
+
+ return {d.po_detail: flt(d.billed_amt) for d in query}
+
+
def update_billing_percentage(pr_doc, update_modified=True):
# Reload as billed amount was set in db directly
pr_doc.load_from_db()
diff --git a/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json b/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json
index 474ee92..557bb59 100644
--- a/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json
+++ b/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json
@@ -8,6 +8,7 @@
"engine": "InnoDB",
"field_order": [
"barcode",
+ "has_item_scanned",
"section_break_2",
"item_code",
"product_bundle",
@@ -996,12 +997,20 @@
{
"fieldname": "column_break_102",
"fieldtype": "Column Break"
+ },
+ {
+ "default": "0",
+ "depends_on": "barcode",
+ "fieldname": "has_item_scanned",
+ "fieldtype": "Check",
+ "label": "Has Item Scanned",
+ "read_only": 1
}
],
"idx": 1,
"istable": 1,
"links": [],
- "modified": "2022-10-26 16:06:02.524435",
+ "modified": "2022-11-02 12:49:28.746701",
"modified_by": "Administrator",
"module": "Stock",
"name": "Purchase Receipt Item",
diff --git a/erpnext/stock/doctype/quality_inspection/quality_inspection.py b/erpnext/stock/doctype/quality_inspection/quality_inspection.py
index 8ffd3f2..9321c2c 100644
--- a/erpnext/stock/doctype/quality_inspection/quality_inspection.py
+++ b/erpnext/stock/doctype/quality_inspection/quality_inspection.py
@@ -6,7 +6,7 @@
from frappe import _
from frappe.model.document import Document
from frappe.model.mapper import get_mapped_doc
-from frappe.utils import cint, flt
+from frappe.utils import cint, cstr, flt
from erpnext.stock.doctype.quality_inspection_template.quality_inspection_template import (
get_template_details,
@@ -219,68 +219,71 @@
@frappe.whitelist()
@frappe.validate_and_sanitize_search_inputs
def item_query(doctype, txt, searchfield, start, page_len, filters):
- if filters.get("from"):
- from frappe.desk.reportview import get_match_cond
+ from frappe.desk.reportview import get_match_cond
- mcond = get_match_cond(filters["from"])
- cond, qi_condition = "", "and (quality_inspection is null or quality_inspection = '')"
+ from_doctype = cstr(filters.get("doctype"))
+ if not from_doctype or not frappe.db.exists("DocType", from_doctype):
+ return []
- if filters.get("parent"):
- if (
- filters.get("from") in ["Purchase Invoice Item", "Purchase Receipt Item"]
- and filters.get("inspection_type") != "In Process"
- ):
- cond = """and item_code in (select name from `tabItem` where
- inspection_required_before_purchase = 1)"""
- elif (
- filters.get("from") in ["Sales Invoice Item", "Delivery Note Item"]
- and filters.get("inspection_type") != "In Process"
- ):
- cond = """and item_code in (select name from `tabItem` where
- inspection_required_before_delivery = 1)"""
- elif filters.get("from") == "Stock Entry Detail":
- cond = """and s_warehouse is null"""
+ mcond = get_match_cond(from_doctype)
+ cond, qi_condition = "", "and (quality_inspection is null or quality_inspection = '')"
- if filters.get("from") in ["Supplier Quotation Item"]:
- qi_condition = ""
+ if filters.get("parent"):
+ if (
+ from_doctype in ["Purchase Invoice Item", "Purchase Receipt Item"]
+ and filters.get("inspection_type") != "In Process"
+ ):
+ cond = """and item_code in (select name from `tabItem` where
+ inspection_required_before_purchase = 1)"""
+ elif (
+ from_doctype in ["Sales Invoice Item", "Delivery Note Item"]
+ and filters.get("inspection_type") != "In Process"
+ ):
+ cond = """and item_code in (select name from `tabItem` where
+ inspection_required_before_delivery = 1)"""
+ elif from_doctype == "Stock Entry Detail":
+ cond = """and s_warehouse is null"""
- return frappe.db.sql(
- """
- SELECT item_code
- FROM `tab{doc}`
- WHERE parent=%(parent)s and docstatus < 2 and item_code like %(txt)s
- {qi_condition} {cond} {mcond}
- ORDER BY item_code limit {page_len} offset {start}
- """.format(
- doc=filters.get("from"),
- cond=cond,
- mcond=mcond,
- start=start,
- page_len=page_len,
- qi_condition=qi_condition,
- ),
- {"parent": filters.get("parent"), "txt": "%%%s%%" % txt},
- )
+ if from_doctype in ["Supplier Quotation Item"]:
+ qi_condition = ""
- elif filters.get("reference_name"):
- return frappe.db.sql(
- """
- SELECT production_item
- FROM `tab{doc}`
- WHERE name = %(reference_name)s and docstatus < 2 and production_item like %(txt)s
- {qi_condition} {cond} {mcond}
- ORDER BY production_item
- limit {page_len} offset {start}
- """.format(
- doc=filters.get("from"),
- cond=cond,
- mcond=mcond,
- start=start,
- page_len=page_len,
- qi_condition=qi_condition,
- ),
- {"reference_name": filters.get("reference_name"), "txt": "%%%s%%" % txt},
- )
+ return frappe.db.sql(
+ """
+ SELECT item_code
+ FROM `tab{doc}`
+ WHERE parent=%(parent)s and docstatus < 2 and item_code like %(txt)s
+ {qi_condition} {cond} {mcond}
+ ORDER BY item_code limit {page_len} offset {start}
+ """.format(
+ doc=from_doctype,
+ cond=cond,
+ mcond=mcond,
+ start=cint(start),
+ page_len=cint(page_len),
+ qi_condition=qi_condition,
+ ),
+ {"parent": filters.get("parent"), "txt": "%%%s%%" % txt},
+ )
+
+ elif filters.get("reference_name"):
+ return frappe.db.sql(
+ """
+ SELECT production_item
+ FROM `tab{doc}`
+ WHERE name = %(reference_name)s and docstatus < 2 and production_item like %(txt)s
+ {qi_condition} {cond} {mcond}
+ ORDER BY production_item
+ limit {page_len} offset {start}
+ """.format(
+ doc=from_doctype,
+ cond=cond,
+ mcond=mcond,
+ start=cint(start),
+ page_len=cint(page_len),
+ qi_condition=qi_condition,
+ ),
+ {"reference_name": filters.get("reference_name"), "txt": "%%%s%%" % txt},
+ )
@frappe.whitelist()
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry_list.js b/erpnext/stock/doctype/stock_entry/stock_entry_list.js
index 4eb0da1..af29d49 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry_list.js
+++ b/erpnext/stock/doctype/stock_entry/stock_entry_list.js
@@ -3,7 +3,6 @@
"`tabStock Entry`.`purpose`", "`tabStock Entry`.`work_order`", "`tabStock Entry`.`bom_no`",
"`tabStock Entry`.`is_return`"],
get_indicator: function (doc) {
- debugger
if(doc.is_return===1 && doc.purpose === "Material Transfer for Manufacture") {
return [__("Material Returned from WIP"), "orange",
"is_return,=,1|purpose,=,Material Transfer for Manufacture|docstatus,<,2"];
diff --git a/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json b/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json
index 5fe11a2..95f4f5f 100644
--- a/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json
+++ b/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json
@@ -8,6 +8,7 @@
"engine": "InnoDB",
"field_order": [
"barcode",
+ "has_item_scanned",
"section_break_2",
"s_warehouse",
"col_break1",
@@ -498,14 +499,14 @@
"read_only": 1
},
{
- "fieldname": "sco_rm_detail",
- "fieldtype": "Data",
- "hidden": 1,
- "label": "SCO Supplied Item",
- "no_copy": 1,
- "print_hide": 1,
- "read_only": 1
- },
+ "fieldname": "sco_rm_detail",
+ "fieldtype": "Data",
+ "hidden": 1,
+ "label": "SCO Supplied Item",
+ "no_copy": 1,
+ "print_hide": 1,
+ "read_only": 1
+ },
{
"default": "0",
"depends_on": "eval:parent.purpose===\"Repack\" && doc.t_warehouse",
@@ -563,13 +564,21 @@
"fieldname": "is_process_loss",
"fieldtype": "Check",
"label": "Is Process Loss"
+ },
+ {
+ "default": "0",
+ "depends_on": "barcode",
+ "fieldname": "has_item_scanned",
+ "fieldtype": "Check",
+ "label": "Has Item Scanned",
+ "read_only": 1
}
],
"idx": 1,
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
- "modified": "2022-06-17 05:06:33.621264",
+ "modified": "2022-11-02 13:00:34.258828",
"modified_by": "Administrator",
"module": "Stock",
"name": "Stock Entry Detail",
diff --git a/erpnext/stock/doctype/stock_reconciliation_item/stock_reconciliation_item.json b/erpnext/stock/doctype/stock_reconciliation_item/stock_reconciliation_item.json
index 79c2fcc..7c3e151 100644
--- a/erpnext/stock/doctype/stock_reconciliation_item/stock_reconciliation_item.json
+++ b/erpnext/stock/doctype/stock_reconciliation_item/stock_reconciliation_item.json
@@ -7,6 +7,7 @@
"engine": "InnoDB",
"field_order": [
"barcode",
+ "has_item_scanned",
"item_code",
"item_name",
"warehouse",
@@ -177,11 +178,18 @@
"label": "Allow Zero Valuation Rate",
"print_hide": 1,
"read_only": 1
+ },
+ {
+ "depends_on": "barcode",
+ "fieldname": "has_item_scanned",
+ "fieldtype": "Data",
+ "label": "Has Item Scanned",
+ "read_only": 1
}
],
"istable": 1,
"links": [],
- "modified": "2022-04-02 04:19:40.380587",
+ "modified": "2022-11-02 13:01:23.580937",
"modified_by": "Administrator",
"module": "Stock",
"name": "Stock Reconciliation Item",
diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py
index e83182f..108611c 100644
--- a/erpnext/stock/get_item_details.py
+++ b/erpnext/stock/get_item_details.py
@@ -330,6 +330,9 @@
else:
args.uom = item.stock_uom
+ # Set stock UOM in args, so that it can be used while fetching item price
+ args.stock_uom = item.stock_uom
+
if args.get("batch_no") and item.name != frappe.get_cached_value(
"Batch", args.get("batch_no"), "item"
):
diff --git a/erpnext/stock/report/warehouse_wise_item_balance_age_and_value/warehouse_wise_item_balance_age_and_value.py b/erpnext/stock/report/warehouse_wise_item_balance_age_and_value/warehouse_wise_item_balance_age_and_value.py
index eedf1a0..b5c6764 100644
--- a/erpnext/stock/report/warehouse_wise_item_balance_age_and_value/warehouse_wise_item_balance_age_and_value.py
+++ b/erpnext/stock/report/warehouse_wise_item_balance_age_and_value/warehouse_wise_item_balance_age_and_value.py
@@ -91,8 +91,8 @@
columns = [
_("Item") + ":Link/Item:180",
_("Item Group") + "::100",
- _("Value") + ":Currency:100",
- _("Age") + ":Float:60",
+ _("Value") + ":Currency:120",
+ _("Age") + ":Float:80",
]
return columns
@@ -123,7 +123,7 @@
def add_warehouse_column(columns, warehouse_list):
if len(warehouse_list) > 1:
- columns += [_("Total Qty") + ":Int:50"]
+ columns += [_("Total Qty") + ":Int:90"]
for wh in warehouse_list:
- columns += [_(wh.name) + ":Int:54"]
+ columns += [_(wh.name) + ":Int:120"]
diff --git a/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.js b/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.js
index aff76eb..b6bef8c 100644
--- a/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.js
+++ b/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.js
@@ -57,6 +57,18 @@
filters: { 'company': frm.doc.company }
};
});
+
+ frappe.db.get_single_value('Buying Settings', 'backflush_raw_materials_of_subcontract_based_on').then(val => {
+ if (val == 'Material Transferred for Subcontract') {
+ frm.fields_dict['supplied_items'].grid.grid_rows.forEach((grid_row) => {
+ grid_row.docfields.forEach((df) => {
+ if (df.fieldname == 'consumed_qty') {
+ df.read_only = 0;
+ }
+ });
+ });
+ }
+ });
},
refresh: (frm) => {
diff --git a/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.py b/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.py
index cd05b74..bce5360 100644
--- a/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.py
+++ b/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.py
@@ -57,6 +57,7 @@
def before_validate(self):
super(SubcontractingReceipt, self).before_validate()
+ self.set_items_bom()
self.set_items_cost_center()
self.set_items_expense_account()
@@ -193,6 +194,24 @@
).format(item.idx)
)
+ def set_items_bom(self):
+ if self.is_return:
+ for item in self.items:
+ if not item.bom:
+ item.bom = frappe.db.get_value(
+ "Subcontracting Receipt Item",
+ {"name": item.subcontracting_receipt_item, "parent": self.return_against},
+ "bom",
+ )
+ else:
+ for item in self.items:
+ if not item.bom:
+ item.bom = frappe.db.get_value(
+ "Subcontracting Order Item",
+ {"name": item.subcontracting_order_item, "parent": item.subcontracting_order},
+ "bom",
+ )
+
def set_items_cost_center(self):
if self.company:
cost_center = frappe.get_cached_value("Company", self.company, "cost_center")
diff --git a/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt_dashboard.py b/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt_dashboard.py
index a9e5193..deb8342 100644
--- a/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt_dashboard.py
+++ b/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt_dashboard.py
@@ -4,6 +4,9 @@
def get_data():
return {
"fieldname": "subcontracting_receipt_no",
+ "non_standard_fieldnames": {
+ "Subcontracting Receipt": "return_against",
+ },
"internal_links": {
"Subcontracting Order": ["items", "subcontracting_order"],
"Project": ["items", "project"],
@@ -11,5 +14,6 @@
},
"transactions": [
{"label": _("Reference"), "items": ["Subcontracting Order", "Quality Inspection", "Project"]},
+ {"label": _("Returns"), "items": ["Subcontracting Receipt"]},
],
}
diff --git a/erpnext/subcontracting/doctype/subcontracting_receipt/test_subcontracting_receipt.py b/erpnext/subcontracting/doctype/subcontracting_receipt/test_subcontracting_receipt.py
index 090f145..72ed4d4 100644
--- a/erpnext/subcontracting/doctype/subcontracting_receipt/test_subcontracting_receipt.py
+++ b/erpnext/subcontracting/doctype/subcontracting_receipt/test_subcontracting_receipt.py
@@ -327,7 +327,7 @@
for row in scr.supplied_items:
self.assertEqual(transferred_batch.get(row.batch_no), row.consumed_qty)
- def test_subcontracting_order_partial_return(self):
+ def test_subcontracting_receipt_partial_return(self):
sco = get_subcontracting_order()
rm_items = get_rm_items(sco.supplied_items)
itemwise_details = make_stock_in_entry(rm_items=rm_items)
@@ -343,15 +343,17 @@
scr1_return = make_return_subcontracting_receipt(scr_name=scr1.name, qty=-3)
scr1.load_from_db()
self.assertEqual(scr1_return.status, "Return")
+ self.assertIsNotNone(scr1_return.items[0].bom)
self.assertEqual(scr1.items[0].returned_qty, 3)
scr2_return = make_return_subcontracting_receipt(scr_name=scr1.name, qty=-7)
scr1.load_from_db()
self.assertEqual(scr2_return.status, "Return")
+ self.assertIsNotNone(scr2_return.items[0].bom)
self.assertEqual(scr1.status, "Return Issued")
self.assertEqual(scr1.items[0].returned_qty, 10)
- def test_subcontracting_order_over_return(self):
+ def test_subcontracting_receipt_over_return(self):
sco = get_subcontracting_order()
rm_items = get_rm_items(sco.supplied_items)
itemwise_details = make_stock_in_entry(rm_items=rm_items)
@@ -402,8 +404,8 @@
"stock_value_difference",
)
- # Service Cost(100 * 10) + Raw Materials Cost(50 * 10) + Additional Costs(100) = 1600
- self.assertEqual(stock_value_difference, 1600)
+ # Service Cost(100 * 10) + Raw Materials Cost(100 * 10) + Additional Costs(10 * 10) = 2100
+ self.assertEqual(stock_value_difference, 2100)
self.assertFalse(get_gl_entries("Subcontracting Receipt", scr.name))
def test_subcontracting_receipt_gl_entry(self):
@@ -466,6 +468,66 @@
scr.cancel()
self.assertTrue(get_gl_entries("Subcontracting Receipt", scr.name))
+ def test_supplied_items_consumed_qty(self):
+ # Set Backflush Based On as "Material Transferred for Subcontracting" to transfer RM's more than the required qty
+ set_backflush_based_on("Material Transferred for Subcontract")
+
+ # Create Material Receipt for RM's
+ make_stock_entry(
+ item_code="_Test Item", qty=100, target="_Test Warehouse 1 - _TC", basic_rate=100
+ )
+ make_stock_entry(
+ item_code="_Test Item Home Desktop 100",
+ qty=100,
+ target="_Test Warehouse 1 - _TC",
+ basic_rate=100,
+ )
+
+ service_items = [
+ {
+ "warehouse": "_Test Warehouse - _TC",
+ "item_code": "Subcontracted Service Item 1",
+ "qty": 10,
+ "rate": 100,
+ "fg_item": "_Test FG Item",
+ "fg_item_qty": 10,
+ },
+ ]
+
+ # Create Subcontracting Order
+ sco = get_subcontracting_order(service_items=service_items)
+
+ # Transfer RM's
+ rm_items = get_rm_items(sco.supplied_items)
+ rm_items[0]["qty"] = 20 # Extra 10 Qty
+ itemwise_details = make_stock_in_entry(rm_items=rm_items)
+ make_stock_transfer_entry(
+ sco_no=sco.name,
+ rm_items=rm_items,
+ itemwise_details=copy.deepcopy(itemwise_details),
+ )
+
+ # Create Subcontracting Receipt
+ scr = make_subcontracting_receipt(sco.name)
+ scr.rejected_warehouse = "_Test Warehouse 1 - _TC"
+
+ scr.items[0].qty = 5 # Accepted Qty
+ scr.items[0].rejected_qty = 3
+ scr.save()
+
+ # consumed_qty should be (accepted_qty * (transfered_qty / qty)) = (5 * (20 / 10)) = 10
+ self.assertEqual(scr.supplied_items[0].consumed_qty, 10)
+
+ # Set Backflush Based On as "BOM"
+ set_backflush_based_on("BOM")
+
+ scr.items[0].qty = 6 # Accepted Qty
+ scr.items[0].rejected_qty = 4
+ scr.save()
+
+ # consumed_qty should be (accepted_qty * qty_consumed_per_unit) = (6 * 1) = 6
+ self.assertEqual(scr.supplied_items[0].consumed_qty, 6)
+
def make_return_subcontracting_receipt(**args):
args = frappe._dict(args)
diff --git a/erpnext/subcontracting/doctype/subcontracting_receipt_supplied_item/subcontracting_receipt_supplied_item.json b/erpnext/subcontracting/doctype/subcontracting_receipt_supplied_item/subcontracting_receipt_supplied_item.json
index ddbb806..d21bc22 100644
--- a/erpnext/subcontracting/doctype/subcontracting_receipt_supplied_item/subcontracting_receipt_supplied_item.json
+++ b/erpnext/subcontracting/doctype/subcontracting_receipt_supplied_item/subcontracting_receipt_supplied_item.json
@@ -1,207 +1,208 @@
{
- "actions": [],
- "creation": "2022-04-18 10:45:16.538479",
- "doctype": "DocType",
- "editable_grid": 1,
- "engine": "InnoDB",
- "field_order": [
- "main_item_code",
- "rm_item_code",
- "item_name",
- "bom_detail_no",
- "col_break1",
- "description",
- "stock_uom",
- "conversion_factor",
- "reference_name",
- "secbreak_1",
- "rate",
- "col_break2",
- "amount",
- "secbreak_2",
- "available_qty_for_consumption",
- "required_qty",
- "col_break3",
- "consumed_qty",
- "current_stock",
- "secbreak_3",
- "batch_no",
- "col_break4",
- "serial_no",
- "subcontracting_order"
- ],
- "fields": [
- {
- "fieldname": "main_item_code",
- "fieldtype": "Link",
- "in_list_view": 1,
- "label": "Item Code",
- "options": "Item",
- "read_only": 1
- },
- {
- "fieldname": "rm_item_code",
- "fieldtype": "Link",
- "in_list_view": 1,
- "label": "Raw Material Item Code",
- "options": "Item",
- "read_only": 1
- },
- {
- "fieldname": "description",
- "fieldtype": "Text Editor",
- "in_global_search": 1,
- "label": "Description",
- "print_width": "300px",
- "read_only": 1,
- "width": "300px"
- },
- {
- "fieldname": "batch_no",
- "fieldtype": "Link",
- "label": "Batch No",
- "no_copy": 1,
- "options": "Batch"
- },
- {
- "fieldname": "serial_no",
- "fieldtype": "Text",
- "label": "Serial No",
- "no_copy": 1
- },
- {
- "fieldname": "col_break1",
- "fieldtype": "Column Break"
- },
- {
- "fieldname": "required_qty",
- "fieldtype": "Float",
- "label": "Required Qty",
- "print_hide": 1,
- "read_only": 1
- },
- {
- "columns": 2,
- "fieldname": "consumed_qty",
- "fieldtype": "Float",
- "in_list_view": 1,
- "label": "Consumed Qty",
- "reqd": 1
- },
- {
- "fieldname": "stock_uom",
- "fieldtype": "Link",
- "label": "Stock Uom",
- "options": "UOM",
- "read_only": 1
- },
- {
- "fieldname": "rate",
- "fieldtype": "Currency",
- "label": "Rate",
- "options": "Company:company:default_currency",
- "read_only": 1
- },
- {
- "fieldname": "amount",
- "fieldtype": "Currency",
- "label": "Amount",
- "options": "Company:company:default_currency",
- "read_only": 1
- },
- {
- "default": "1",
- "fieldname": "conversion_factor",
- "fieldtype": "Float",
- "hidden": 1,
- "label": "Conversion Factor",
- "read_only": 1
- },
- {
- "fieldname": "current_stock",
- "fieldtype": "Float",
- "in_list_view": 1,
- "label": "Current Stock",
- "read_only": 1
- },
- {
- "fieldname": "reference_name",
- "fieldtype": "Data",
- "hidden": 1,
- "in_list_view": 1,
- "label": "Reference Name",
- "read_only": 1
- },
- {
- "fieldname": "bom_detail_no",
- "fieldtype": "Data",
- "hidden": 1,
- "in_list_view": 1,
- "label": "BOM Detail No",
- "read_only": 1
- },
- {
- "fieldname": "secbreak_1",
- "fieldtype": "Section Break"
- },
- {
- "fieldname": "col_break2",
- "fieldtype": "Column Break"
- },
- {
- "fieldname": "secbreak_2",
- "fieldtype": "Section Break"
- },
- {
- "fieldname": "col_break3",
- "fieldtype": "Column Break"
- },
- {
- "fieldname": "secbreak_3",
- "fieldtype": "Section Break"
- },
- {
- "fieldname": "col_break4",
- "fieldtype": "Column Break"
- },
- {
- "fieldname": "item_name",
- "fieldtype": "Data",
- "label": "Item Name",
- "read_only": 1
- },
- {
- "fieldname": "subcontracting_order",
- "fieldtype": "Link",
- "hidden": 1,
- "label": "Subcontracting Order",
- "no_copy": 1,
- "options": "Subcontracting Order",
- "print_hide": 1,
- "read_only": 1
- },
- {
- "default": "0",
- "fieldname": "available_qty_for_consumption",
- "fieldtype": "Float",
- "in_list_view": 1,
- "label": "Available Qty For Consumption",
- "print_hide": 1,
- "read_only": 1
- }
- ],
- "idx": 1,
- "istable": 1,
- "links": [],
- "modified": "2022-09-02 22:28:53.392381",
- "modified_by": "Administrator",
- "module": "Subcontracting",
- "name": "Subcontracting Receipt Supplied Item",
- "naming_rule": "Autoincrement",
- "owner": "Administrator",
- "permissions": [],
- "sort_field": "modified",
- "sort_order": "DESC",
- "states": [],
- "track_changes": 1
+ "actions": [],
+ "creation": "2022-04-18 10:45:16.538479",
+ "doctype": "DocType",
+ "editable_grid": 1,
+ "engine": "InnoDB",
+ "field_order": [
+ "main_item_code",
+ "rm_item_code",
+ "item_name",
+ "bom_detail_no",
+ "col_break1",
+ "description",
+ "stock_uom",
+ "conversion_factor",
+ "reference_name",
+ "secbreak_1",
+ "rate",
+ "col_break2",
+ "amount",
+ "secbreak_2",
+ "available_qty_for_consumption",
+ "required_qty",
+ "col_break3",
+ "consumed_qty",
+ "current_stock",
+ "secbreak_3",
+ "batch_no",
+ "col_break4",
+ "serial_no",
+ "subcontracting_order"
+ ],
+ "fields": [
+ {
+ "fieldname": "main_item_code",
+ "fieldtype": "Link",
+ "in_list_view": 1,
+ "label": "Item Code",
+ "options": "Item",
+ "read_only": 1
+ },
+ {
+ "fieldname": "rm_item_code",
+ "fieldtype": "Link",
+ "in_list_view": 1,
+ "label": "Raw Material Item Code",
+ "options": "Item",
+ "read_only": 1
+ },
+ {
+ "fieldname": "description",
+ "fieldtype": "Text Editor",
+ "in_global_search": 1,
+ "label": "Description",
+ "print_width": "300px",
+ "read_only": 1,
+ "width": "300px"
+ },
+ {
+ "fieldname": "batch_no",
+ "fieldtype": "Link",
+ "label": "Batch No",
+ "no_copy": 1,
+ "options": "Batch"
+ },
+ {
+ "fieldname": "serial_no",
+ "fieldtype": "Text",
+ "label": "Serial No",
+ "no_copy": 1
+ },
+ {
+ "fieldname": "col_break1",
+ "fieldtype": "Column Break"
+ },
+ {
+ "fieldname": "required_qty",
+ "fieldtype": "Float",
+ "label": "Required Qty",
+ "print_hide": 1,
+ "read_only": 1
+ },
+ {
+ "columns": 2,
+ "fieldname": "consumed_qty",
+ "fieldtype": "Float",
+ "in_list_view": 1,
+ "label": "Consumed Qty",
+ "read_only": 1,
+ "reqd": 1
+ },
+ {
+ "fieldname": "stock_uom",
+ "fieldtype": "Link",
+ "label": "Stock Uom",
+ "options": "UOM",
+ "read_only": 1
+ },
+ {
+ "fieldname": "rate",
+ "fieldtype": "Currency",
+ "label": "Rate",
+ "options": "Company:company:default_currency",
+ "read_only": 1
+ },
+ {
+ "fieldname": "amount",
+ "fieldtype": "Currency",
+ "label": "Amount",
+ "options": "Company:company:default_currency",
+ "read_only": 1
+ },
+ {
+ "default": "1",
+ "fieldname": "conversion_factor",
+ "fieldtype": "Float",
+ "hidden": 1,
+ "label": "Conversion Factor",
+ "read_only": 1
+ },
+ {
+ "fieldname": "current_stock",
+ "fieldtype": "Float",
+ "in_list_view": 1,
+ "label": "Current Stock",
+ "read_only": 1
+ },
+ {
+ "fieldname": "reference_name",
+ "fieldtype": "Data",
+ "hidden": 1,
+ "in_list_view": 1,
+ "label": "Reference Name",
+ "read_only": 1
+ },
+ {
+ "fieldname": "bom_detail_no",
+ "fieldtype": "Data",
+ "hidden": 1,
+ "in_list_view": 1,
+ "label": "BOM Detail No",
+ "read_only": 1
+ },
+ {
+ "fieldname": "secbreak_1",
+ "fieldtype": "Section Break"
+ },
+ {
+ "fieldname": "col_break2",
+ "fieldtype": "Column Break"
+ },
+ {
+ "fieldname": "secbreak_2",
+ "fieldtype": "Section Break"
+ },
+ {
+ "fieldname": "col_break3",
+ "fieldtype": "Column Break"
+ },
+ {
+ "fieldname": "secbreak_3",
+ "fieldtype": "Section Break"
+ },
+ {
+ "fieldname": "col_break4",
+ "fieldtype": "Column Break"
+ },
+ {
+ "fieldname": "item_name",
+ "fieldtype": "Data",
+ "label": "Item Name",
+ "read_only": 1
+ },
+ {
+ "fieldname": "subcontracting_order",
+ "fieldtype": "Link",
+ "hidden": 1,
+ "label": "Subcontracting Order",
+ "no_copy": 1,
+ "options": "Subcontracting Order",
+ "print_hide": 1,
+ "read_only": 1
+ },
+ {
+ "default": "0",
+ "fieldname": "available_qty_for_consumption",
+ "fieldtype": "Float",
+ "in_list_view": 1,
+ "label": "Available Qty For Consumption",
+ "print_hide": 1,
+ "read_only": 1
+ }
+ ],
+ "idx": 1,
+ "istable": 1,
+ "links": [],
+ "modified": "2022-11-07 17:17:21.670761",
+ "modified_by": "Administrator",
+ "module": "Subcontracting",
+ "name": "Subcontracting Receipt Supplied Item",
+ "naming_rule": "Autoincrement",
+ "owner": "Administrator",
+ "permissions": [],
+ "sort_field": "modified",
+ "sort_order": "DESC",
+ "states": [],
+ "track_changes": 1
}
\ No newline at end of file
diff --git a/erpnext/support/doctype/warranty_claim/warranty_claim.py b/erpnext/support/doctype/warranty_claim/warranty_claim.py
index 5e2ea06..c86356f 100644
--- a/erpnext/support/doctype/warranty_claim/warranty_claim.py
+++ b/erpnext/support/doctype/warranty_claim/warranty_claim.py
@@ -35,7 +35,7 @@
lst1 = ",".join(x[0] for x in lst)
frappe.throw(_("Cancel Material Visit {0} before cancelling this Warranty Claim").format(lst1))
else:
- frappe.db.set(self, "status", "Cancelled")
+ self.db_set("status", "Cancelled")
def on_update(self):
pass
diff --git a/erpnext/translations/de.csv b/erpnext/translations/de.csv
index ca16403..0caea25 100644
--- a/erpnext/translations/de.csv
+++ b/erpnext/translations/de.csv
@@ -9899,3 +9899,7 @@
Website Item,Webseiten-Artikel,
Update Property,Eigenschaft aktualisieren,
Recurring Sales Invoice,Wiederkehrende Ausgangsrechnung,
+Total Asset,Aktiva,
+Total Liability,Verbindlichkeiten,
+Total Equity,Eigenkapital,
+Warehouse wise Stock Value,Warenwert nach Lager,