Compare commits
402 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c3fbc04aab | ||
|
|
5b866db6bc | ||
|
|
9fbb8192e1 | ||
|
|
ea1408f2e0 | ||
|
|
f2a941b1a4 | ||
|
|
ca1cfd91ea | ||
|
|
c3d43e672b | ||
|
|
e141fdcfcc | ||
|
|
7cb8f890bc | ||
|
|
d6aadef395 | ||
|
|
11c899bc1f | ||
|
|
00efeb26f4 | ||
|
|
1129ac711e | ||
|
|
2ea593bdd8 | ||
|
|
02fd6f56d6 | ||
|
|
098b444f6f | ||
|
|
e72bde5159 | ||
|
|
c10e106f8f | ||
|
|
2c111b7b14 | ||
|
|
f92fcdbac4 | ||
|
|
1ff9e0432a | ||
|
|
c0f149a3be | ||
|
|
2ae6cfda5f | ||
|
|
22d9f0a4aa | ||
|
|
aa7cddef5c | ||
|
|
3d2b3d37d4 | ||
|
|
821222653b | ||
|
|
adddb15380 | ||
|
|
5fd79f7f77 | ||
|
|
2505c74d64 | ||
|
|
d5f9ebd008 | ||
|
|
d021e45301 | ||
|
|
e9ca5e81d2 | ||
|
|
a7f5589564 | ||
|
|
a8df73c263 | ||
|
|
40a5a3063c | ||
|
|
d17c24f969 | ||
|
|
0289ad285f | ||
|
|
562227db8f | ||
|
|
9c1cac80fe | ||
|
|
03016e5000 | ||
|
|
9240eaa0a6 | ||
|
|
618940b5c9 | ||
|
|
ccf2b7b08b | ||
|
|
1e989b35ad | ||
|
|
cae2723920 | ||
|
|
badc855400 | ||
|
|
a4502c4f6b | ||
|
|
1f02c62339 | ||
|
|
ef770b593a | ||
|
|
a9c90c96a9 | ||
|
|
c5d222253a | ||
|
|
94769d81a8 | ||
|
|
edd63a178f | ||
|
|
ace68cd283 | ||
|
|
d3bd151c30 | ||
|
|
0794816527 | ||
|
|
7041a45294 | ||
|
|
a6746407e5 | ||
|
|
e3407083fe | ||
|
|
63e40b52af | ||
|
|
2e203e53c6 | ||
|
|
c0201877dd | ||
|
|
745292ce98 | ||
|
|
00279f27f3 | ||
|
|
f620dae8ca | ||
|
|
9d7fe1f7cd | ||
|
|
ba4f32be5c | ||
|
|
85f63a3866 | ||
|
|
149f7ee875 | ||
|
|
c9a1eb1081 | ||
|
|
2e560cb25d | ||
|
|
651b612909 | ||
|
|
398eac3f4c | ||
|
|
f3025f1596 | ||
|
|
0712013960 | ||
|
|
3fdda7a9b7 | ||
|
|
9bcadf8126 | ||
|
|
492de67d7b | ||
|
|
80a9f523d5 | ||
|
|
e3f0412570 | ||
|
|
23fa8893a8 | ||
|
|
a3714e1678 | ||
|
|
0f6c35d63f | ||
|
|
93779c21a7 | ||
|
|
e010ddf65f | ||
|
|
969c8aaf52 | ||
|
|
c711445b91 | ||
|
|
2b88ac948e | ||
|
|
c672530210 | ||
|
|
c5b061834b | ||
|
|
8a8966ce9b | ||
|
|
54f3a0f7c6 | ||
|
|
ecc4fdd3ef | ||
|
|
60da37b502 | ||
|
|
2777fd4332 | ||
|
|
9602bf4ba3 | ||
|
|
5042dd32da | ||
|
|
4d347b1ca0 | ||
|
|
3d85951c1f | ||
|
|
7b91042ae6 | ||
|
|
633a39144d | ||
|
|
94b41ea4f6 | ||
|
|
d8f7de9946 | ||
|
|
b2d318ec48 | ||
|
|
60200eaf0d | ||
|
|
1e4cfb4bf5 | ||
|
|
70abac0061 | ||
|
|
d7f32e492f | ||
|
|
6c09297bcd | ||
|
|
363cedde76 | ||
|
|
f5ad339cae | ||
|
|
c8c733bc54 | ||
|
|
7acc8cb747 | ||
|
|
9a398b4742 | ||
|
|
56882033bf | ||
|
|
74c817e7f9 | ||
|
|
d98a6d81eb | ||
|
|
baac05955b | ||
|
|
89346967da | ||
|
|
97e890d0b3 | ||
|
|
95763bc233 | ||
|
|
96f4b22589 | ||
|
|
13460f023d | ||
|
|
3907eae83f | ||
|
|
04f50be306 | ||
|
|
b34ab7549a | ||
|
|
aa54d934b8 | ||
|
|
2c7a6e6b43 | ||
|
|
58797481f0 | ||
|
|
12aa4265ff | ||
|
|
69d9f51dbb | ||
|
|
3dea6589d7 | ||
|
|
096d136460 | ||
|
|
c3889d85a1 | ||
|
|
052333ea63 | ||
|
|
aadd30d194 | ||
|
|
22e6f8d4c2 | ||
|
|
acd3479269 | ||
|
|
a32e57ae82 | ||
|
|
a3a63177a1 | ||
|
|
1643cce479 | ||
|
|
bb42e3b411 | ||
|
|
586e9400b1 | ||
|
|
668ec25d19 | ||
|
|
f0543a9765 | ||
|
|
36b4faab48 | ||
|
|
2b59a851c4 | ||
|
|
857d4f7a0b | ||
|
|
12d7bfb658 | ||
|
|
ca6e223694 | ||
|
|
343ba85e3a | ||
|
|
16c324f699 | ||
|
|
1fa992564a | ||
|
|
a65b28772f | ||
|
|
ba6003ece7 | ||
|
|
491ce05b8d | ||
|
|
2cfcbf933d | ||
|
|
2550180a05 | ||
|
|
5fd7b3bb80 | ||
|
|
35b665cb26 | ||
|
|
a6a4e86dc8 | ||
|
|
0eb8bb2511 | ||
|
|
67cfa81de2 | ||
|
|
a942722619 | ||
|
|
c10bbd6aa7 | ||
|
|
4badb45ee5 | ||
|
|
855d843e55 | ||
|
|
0df95fa781 | ||
|
|
6578bc11b6 | ||
|
|
f68dc69078 | ||
|
|
502af4dd67 | ||
|
|
db9fa78ee8 | ||
|
|
a645f36b2b | ||
|
|
332a17ee86 | ||
|
|
a310cc7156 | ||
|
|
3b43c0d160 | ||
|
|
96002c28bd | ||
|
|
91fc1a8fbe | ||
|
|
f1755fb5b1 | ||
|
|
be841ccc53 | ||
|
|
51dfba749b | ||
|
|
3799f8bec9 | ||
|
|
3edc101957 | ||
|
|
127c61e930 | ||
|
|
e55831a89c | ||
|
|
4ff4d185f7 | ||
|
|
d54953e419 | ||
|
|
339426c926 | ||
|
|
489ff6e21c | ||
|
|
d12fb58c12 | ||
|
|
82048cf3ce | ||
|
|
4d76269eeb | ||
|
|
d5b2e39f45 | ||
|
|
dd0fc1084e | ||
|
|
d283ee73f3 | ||
|
|
93f138eece | ||
|
|
2b2cf13408 | ||
|
|
7f49b57aaa | ||
|
|
00330f52bd | ||
|
|
6b69fc7e5d | ||
|
|
d8cd54dfd0 | ||
|
|
2949e9c5dc | ||
|
|
15bd3167a8 | ||
|
|
9b530fb2cb | ||
|
|
06bace9089 | ||
|
|
c15978fca0 | ||
|
|
cb2264e0b4 | ||
|
|
7d862276af | ||
|
|
e4fe2d9603 | ||
|
|
23a2b65576 | ||
|
|
0bde9e11c7 | ||
|
|
09d56754ea | ||
|
|
e9166d7c19 | ||
|
|
9a64d4371e | ||
|
|
d4491d361f | ||
|
|
09acb779d7 | ||
|
|
67f74414c4 | ||
|
|
8a77a0e1e4 | ||
|
|
bc5515651b | ||
|
|
f65afac353 | ||
|
|
2fbb4923a7 | ||
|
|
554f2de23d | ||
|
|
a5003f8f5b | ||
|
|
6c5d7986ab | ||
|
|
5448318146 | ||
|
|
174a18399c | ||
|
|
ec23a6f0eb | ||
|
|
33b2614377 | ||
|
|
b95ecd7fcd | ||
|
|
cc98d40ff7 | ||
|
|
103c4e9b92 | ||
|
|
5a947f38ab | ||
|
|
0acb63a938 | ||
|
|
db6f0848e3 | ||
|
|
ca166eaae5 | ||
|
|
a13b177908 | ||
|
|
0500ce445f | ||
|
|
351dc08576 | ||
|
|
8e675ebbe2 | ||
|
|
d53b149828 | ||
|
|
5a91989665 | ||
|
|
62d6593fe7 | ||
|
|
ed35a296ab | ||
|
|
6a7495dbc8 | ||
|
|
6e90f49a35 | ||
|
|
6e7e70c977 | ||
|
|
0aeeb7e02c | ||
|
|
caccd2289d | ||
|
|
45ac31ab93 | ||
|
|
7477899d2e | ||
|
|
13afef2f72 | ||
|
|
cab73b8a02 | ||
|
|
c7a9e3424b | ||
|
|
a884bd9c6a | ||
|
|
37b2aa2b11 | ||
|
|
f4211c4a52 | ||
|
|
c1f982a9bb | ||
|
|
4d250585a6 | ||
|
|
6041f5cb8c | ||
|
|
144c9977a2 | ||
|
|
f1fa338999 | ||
|
|
f7717b9ec2 | ||
|
|
1a4d77a962 | ||
|
|
056c1709c6 | ||
|
|
b553b7a69d | ||
|
|
0725eab858 | ||
|
|
67d6dc1ac6 | ||
|
|
33f967d97c | ||
|
|
9a5037193f | ||
|
|
80423de611 | ||
|
|
b4693c6957 | ||
|
|
ba31369764 | ||
|
|
e8d22bb999 | ||
|
|
cce29fabf4 | ||
|
|
0f5c18ca81 | ||
|
|
a4c40e0fd6 | ||
|
|
59aca770c1 | ||
|
|
9d2f04139c | ||
|
|
41c47e3ffa | ||
|
|
cf6360d825 | ||
|
|
2c95ab3897 | ||
|
|
171e5af995 | ||
|
|
5df64d84a1 | ||
|
|
a829d5a4d5 | ||
|
|
91c5e4c429 | ||
|
|
cae13bf048 | ||
|
|
2aba97bff1 | ||
|
|
d4359faa31 | ||
|
|
c830344ca7 | ||
|
|
d85247cd7a | ||
|
|
b9ce104b09 | ||
|
|
82fa04ce32 | ||
|
|
32a5f38595 | ||
|
|
4990cf7783 | ||
|
|
8f38a17c14 | ||
|
|
bff1971bb2 | ||
|
|
4e05f02038 | ||
|
|
7918b92d95 | ||
|
|
29c8142678 | ||
|
|
df1653827f | ||
|
|
fc05cc4e70 | ||
|
|
4dc329f5ea | ||
|
|
e37e5d6134 | ||
|
|
dea99cc3a8 | ||
|
|
bc640fe6a6 | ||
|
|
dba5e7645b | ||
|
|
927d13fadb | ||
|
|
0f75a022f2 | ||
|
|
4eae6c985c | ||
|
|
b9e8b917b6 | ||
|
|
2f4854ad1a | ||
|
|
585254456e | ||
|
|
ce5b93ca77 | ||
|
|
32c2c474fd | ||
|
|
f3d30c5bb9 | ||
|
|
8df20f6501 | ||
|
|
f7a4d4221b | ||
|
|
406d449e12 | ||
|
|
e2021252d9 | ||
|
|
373066e0ca | ||
|
|
52beb77539 | ||
|
|
e1e690541c | ||
|
|
86c7ede321 | ||
|
|
7e033aae11 | ||
|
|
5bf77beb83 | ||
|
|
1e1b2364ab | ||
|
|
4d50fac869 | ||
|
|
05eed01eec | ||
|
|
cfa9d1adb7 | ||
|
|
c7c1defe64 | ||
|
|
c14f1f145b | ||
|
|
186bea6e95 | ||
|
|
794ecda618 | ||
|
|
8985077652 | ||
|
|
bfa898ff9b | ||
|
|
0a33a359ca | ||
|
|
f9b5c74871 | ||
|
|
4c58299eb0 | ||
|
|
fc318ebeff | ||
|
|
3574c96c8c | ||
|
|
5743ce2b6b | ||
|
|
84f7727432 | ||
|
|
549c196beb | ||
|
|
1bf4015567 | ||
|
|
cadd31cb0c | ||
|
|
46c82c45e0 | ||
|
|
2c8ce5a717 | ||
|
|
6c3289dbcd | ||
|
|
381d452b78 | ||
|
|
769874d0e9 | ||
|
|
6cc10104f0 | ||
|
|
5b67f4d953 | ||
|
|
4b9a55b0ef | ||
|
|
c8399fd093 | ||
|
|
266e66cd1b | ||
|
|
f3a452850e | ||
|
|
57df096725 | ||
|
|
db2d02a3e3 | ||
|
|
dfae11bcee | ||
|
|
d78e6e04ea | ||
|
|
3959aeb848 | ||
|
|
51293390e4 | ||
|
|
63f4da4402 | ||
|
|
a137fe82a1 | ||
|
|
e2b31085a7 | ||
|
|
a54815fd9d | ||
|
|
4f927ac3e8 | ||
|
|
b9f678b350 | ||
|
|
fb4caff0b2 | ||
|
|
e72915847c | ||
|
|
1d93bd50eb | ||
|
|
8e998875a5 | ||
|
|
c87a3370cd | ||
|
|
c4c2bf0bfb | ||
|
|
39adc8f85f | ||
|
|
8676590cfe | ||
|
|
cf7b6511ba | ||
|
|
bc94914338 | ||
|
|
f83f6aae22 | ||
|
|
6a81acfddf | ||
|
|
edef642794 | ||
|
|
93344dff26 | ||
|
|
03adf84a8d | ||
|
|
0e61b52022 | ||
|
|
0efd7934b8 | ||
|
|
16cde58821 | ||
|
|
e1815f0989 | ||
|
|
c59d52d073 | ||
|
|
7b605a628e | ||
|
|
2f3ad64bd6 | ||
|
|
86cbde9057 | ||
|
|
65a669c81e | ||
|
|
39e0d1b7d6 | ||
|
|
de420322b5 | ||
|
|
c8e016522d | ||
|
|
5c4f52ccf1 | ||
|
|
95adb60a8f | ||
|
|
c6d5611408 | ||
|
|
bd47abdc9a | ||
|
|
00e547d319 | ||
|
|
f1b098e03c |
34
.travis.yml
34
.travis.yml
@@ -1,13 +1,6 @@
|
||||
language: python
|
||||
dist: trusty
|
||||
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- google-chrome
|
||||
packages:
|
||||
- google-chrome-stable
|
||||
|
||||
python:
|
||||
- "2.7"
|
||||
|
||||
@@ -29,15 +22,6 @@ install:
|
||||
- cp -r $TRAVIS_BUILD_DIR/test_sites/test_site ~/frappe-bench/sites/
|
||||
|
||||
before_script:
|
||||
- wget http://chromedriver.storage.googleapis.com/2.33/chromedriver_linux64.zip
|
||||
- unzip chromedriver_linux64.zip
|
||||
- sudo apt-get install libnss3
|
||||
- sudo apt-get --only-upgrade install google-chrome-stable
|
||||
- sudo cp chromedriver /usr/local/bin/.
|
||||
- sudo chmod +x /usr/local/bin/chromedriver
|
||||
- export DISPLAY=:99.0
|
||||
- sh -e /etc/init.d/xvfb start
|
||||
- sleep 3
|
||||
- mysql -u root -ptravis -e 'create database test_frappe'
|
||||
- echo "USE mysql;\nCREATE USER 'test_frappe'@'localhost' IDENTIFIED BY 'test_frappe';\nFLUSH PRIVILEGES;\n" | mysql -u root -ptravis
|
||||
- echo "USE mysql;\nGRANT ALL PRIVILEGES ON \`test_frappe\`.* TO 'test_frappe'@'localhost';\n" | mysql -u root -ptravis
|
||||
@@ -58,24 +42,6 @@ jobs:
|
||||
- set -e
|
||||
- bench run-tests
|
||||
env: Server Side Test
|
||||
- # stage
|
||||
script:
|
||||
- bench --verbose run-setup-wizard-ui-test
|
||||
- bench execute erpnext.setup.utils.enable_all_roles_and_domains
|
||||
- bench run-ui-tests --app erpnext
|
||||
env: Client Side Test
|
||||
- # stage
|
||||
script:
|
||||
- bench --verbose run-setup-wizard-ui-test
|
||||
- bench execute erpnext.setup.utils.enable_all_roles_and_domains
|
||||
- bench run-ui-tests --app erpnext --test-list erpnext/tests/ui/tests2.txt
|
||||
env: Client Side Test - 2
|
||||
- # stage
|
||||
script:
|
||||
- bench --verbose run-setup-wizard-ui-test
|
||||
- bench execute erpnext.setup.utils.enable_all_roles_and_domains
|
||||
- bench run-ui-tests --app erpnext --test-list erpnext/tests/ui/agriculture.txt
|
||||
env: Agriculture Client Side Test
|
||||
- # stage
|
||||
script:
|
||||
- wget http://build.erpnext.com/20171108_190013_955977f8_database.sql.gz
|
||||
|
||||
@@ -5,7 +5,7 @@ import frappe
|
||||
from erpnext.hooks import regional_overrides
|
||||
from frappe.utils import getdate
|
||||
|
||||
__version__ = '10.0.10'
|
||||
__version__ = '10.1.23'
|
||||
|
||||
def get_default_company(user=None):
|
||||
'''Get default company for user'''
|
||||
|
||||
@@ -169,10 +169,10 @@ class Account(NestedSet):
|
||||
# Add company abbr if not provided
|
||||
from erpnext.setup.doctype.company.company import get_name_with_abbr
|
||||
new_account = get_name_with_abbr(new, self.company)
|
||||
new_account = get_name_with_number(new_account, self.account_number)
|
||||
|
||||
# Validate properties before merging
|
||||
if merge:
|
||||
if not merge:
|
||||
new_account = get_name_with_number(new_account, self.account_number)
|
||||
else:
|
||||
# Validate properties before merging
|
||||
if not frappe.db.exists("Account", new):
|
||||
throw(_("Account {0} does not exist").format(new))
|
||||
|
||||
|
||||
@@ -176,7 +176,7 @@
|
||||
"Eingeforderte Nachsch\u00fcsse (gegenkonto 2929)": {}
|
||||
},
|
||||
"Eingeforderte- noch ausstehende Kapitaleinlagen": {
|
||||
"Ausstehende Einlagen auf das gezeichnete Kapital- eingefordert (Forderungen- nicht eingeforderte ausstehende Einlagen s. Konto 2910)": {}
|
||||
"Ausstehende Einlagen auf das gezeichnete Kapital- eingefordert": {}
|
||||
},
|
||||
"Forderungen aus Lieferungen und Leistungen H-Saldo": {
|
||||
"Einzelwertberechtigungen zu Forderungen mit einer Restlaufzeit bis zu 1 Jahr": {},
|
||||
@@ -685,7 +685,6 @@
|
||||
"Umsatzsteuer aus innergemeinschaftlichem Erwerb 16%": {},
|
||||
"Umsatzsteuer aus innergemeinschaftlichem Erwerb 19%": {},
|
||||
"Umsatzsteuer aus innergemeinschaftlichem Erwerb ohne Vorsteuerabzug": {},
|
||||
"Umsatzsteuer aus innergemeinschaftlichem Erwerb von Neufahrzeugen von Lieferanten ohne Umsatzsteuer-Identifikationsnummer": {},
|
||||
"Umsatzsteuer fr\u00fchere Jahre": {},
|
||||
"Umsatzsteuer laufendes Jahr": {},
|
||||
"Umsatzsteuer nach \u00a713b UStG": {},
|
||||
@@ -747,7 +746,7 @@
|
||||
"Verbindlichkeiten gegen\u00fcber Kreditinstituten ": {
|
||||
"Gegenkonto 3159-3209 bei Aufteilung der Konten 3210-3248": {}
|
||||
},
|
||||
"Verbindlichkeiten gegen\u00fcber Kreditinstituten oder Kassenbestand- Bundesbankguthaben- Guthaben bei Kreditinstituten und Schecks": {
|
||||
"Verbindlichkeiten gegen\u00fcber Kreditinstituten - Bundesbankguthaben- Guthaben bei Kreditinstituten und Schecks": {
|
||||
"Verbindlichkeiten gegen\u00fcber Kreditinstituten 1": {
|
||||
"(frei- in Bilanz kein Restlaufzeit vermerkt) 1": {},
|
||||
"Verbindlichkeiten gegen\u00fcber Kreditinstituten Restlaufzeit 1 bis 5 Jahre": {},
|
||||
@@ -778,8 +777,8 @@
|
||||
},
|
||||
"Gewinn u. Verlust - Aufwendungen": {
|
||||
"Betriebliche Aufwendungen": {
|
||||
"Abschreibungen a. Verm\u00f6gensgeg. d. Umlaufverm\u00f6gens- soweit diese die in der Kapitalgesellschaft \u00fcblichen Abschreibungen \u00fcberschreiten": {
|
||||
"Abschreibungen a. Verm\u00f6gensgeg. d. Umlaufverm\u00f6gens- soweit diese die in der Kapitalgesellschaft \u00fcblichen Abschreibungen \u00fcberschreiten": {
|
||||
"Abschreibungen a. Verm\u00f6gensgeg. d. Umlaufverm\u00f6gens- soweit diese die in der Abschreibungen \u00fcberschreiten": {
|
||||
"Abschreibungen a. Verm\u00f6gensgeg. d. Umlaufverm\u00f6gens- soweit diese die in der Abschreibungen \u00fcberschreiten": {
|
||||
"Abschreibungen auf Umlaufverm\u00f6gen- steuerrechtlich bedingt (soweit un\u00fcblich hoch)": {},
|
||||
"Abschreibungen auf Verm\u00f6gensgegenst\u00e4nde des Umlaufverm\u00f6gens (soweit un\u00fcblich hoch)": {},
|
||||
"Forderungsverluste (soweit un\u00fcblich hoch)": {},
|
||||
@@ -852,7 +851,7 @@
|
||||
"Sonstige betriebliche Aufwendungen 3": {
|
||||
"Sonstige betriebliche Aufwendungen 4": {
|
||||
"Abgaben f\u00fcr betrieblich genutzten Grundbesitz": {},
|
||||
"Abgang von Wirtschaftsg\u00fctern des Umlaufverm\u00f6gens 100% / 50% nicht abzugsf\u00e4hig (inlandische Kap. Ges.) nach \u00a7 4 Abs. 3 Satz 4 EStG": {},
|
||||
"Abgang von Wirtschaftsg\u00fctern des Umlaufverm\u00f6gens 100% / 50% nicht abzugsf\u00e4hig (inlandische Kap. Ges.) nach": {},
|
||||
"Abgang von Wirtschaftsg\u00fctern des Umlaufverm\u00f6gens nach \u00a7 4 Abs. 3 Satz 4 EStG": {},
|
||||
"Abschluss- und Pr\u00fcfungskosten": {},
|
||||
"Abschreibung auf Umlaufverm\u00f6gen au\u00dfer Vorr\u00e4te und Wertpapieren des UV (\u00fcbliche H\u00f6he)": {},
|
||||
@@ -867,7 +866,7 @@
|
||||
"Aufwendungen aus Anteilen an Kapitalgesellschaften 100% / 50% nicht abzugsf\u00e4hig (inlandische Kap. Ges.)": {},
|
||||
"Aufwendungen aus Bewertung Finanzmittelfonds": {},
|
||||
"Aufwendungen aus Kursdifferenzen": {},
|
||||
"Aufwendungen aus der Ver\u00e4u\u00dferung von Anteilen an Kapitalgesellschaften 100% / 50% nicht abzugsf\u00e4hig (inl\u00e4ndische Kap. Ges.)": {},
|
||||
"Aufwendungen aus der Ver\u00e4u\u00dferung von Anteilen an Kapitalgesellschaften 100% / 50% nicht abzugsf\u00e4hig": {},
|
||||
"Aufwendungen aus der Zuschreibung von steuertlich niedriger bewerteten R\u00fcckstellungen": {},
|
||||
"Aufwendungen aus der Zuschreibung von steuertlich niedriger bewerteten Verbindlichkeiten": {},
|
||||
"Aufwendungen f\u00fcr Abraum- und Abfallbeseitigung": {},
|
||||
@@ -987,9 +986,9 @@
|
||||
"Verg\u00fctungen an Mitunternehmer \u00a7 15 EStG": {},
|
||||
"Verkaufsprovisionen": {},
|
||||
"Verluste aus dem Abgang von Gegenst\u00e4nden des Anlageverm\u00f6gens": {},
|
||||
"Verluste aus dem Abgang von Gegenst\u00e4nden des Umlaufverm\u00f6gens (au\u00dfer Vorr\u00e4te) 100% / 50% nicht anzugsf\u00e4hig (inlandische Kap. Ges.)": {},
|
||||
"Verluste aus dem Abgang von Gegenst\u00e4nden des Umlaufverm\u00f6gens (au\u00dfer Vorr\u00e4te) 100%/50% nicht anzugsf\u00e4hig": {},
|
||||
"Verluste aus dem Abgang von Gegenst\u00e4nden des Umlaufverm\u00f6gens au\u00dfer Vorr\u00e4te": {},
|
||||
"Verluste aus der Ver\u00e4u\u00dferung von Anteilen an Kapitalgesellschaften 100% / 50% nicht abzugsf\u00e4hig (inl\u00e4ndische Kap. Ges.)": {},
|
||||
"Verluste aus der Ver\u00e4u\u00dferung von Anteilen an Kapitalgesellschaften 100% / 50% nicht abzugsf\u00e4hig": {},
|
||||
"Verpackungsmaterial": {},
|
||||
"Versicherungen": {},
|
||||
"Versicherungen f\u00fcr Geb\u00e4ude": {},
|
||||
@@ -1020,10 +1019,10 @@
|
||||
},
|
||||
"Abschreibungen auf Finanzanlagen 100% / 50% nicht abzugsf\u00e4hig (inl\u00e4ndische Kap. Ges.)": {},
|
||||
"Abschreibungen auf Finanzanlagen auf Grund steuerlicher Sondervorschriften": {},
|
||||
"Abschreibungen auf Finanzanlagen auf Grund steuerlicher Sondervorschriften 100% / 50% nicht abzugsf\u00e4hig (inl\u00e4ndische Kap. Ges.)": {},
|
||||
"Abschreibungen auf Finanzanlagen auf Grund steuerlicher Sondervorschriften 100% / 50% nicht abzugsf\u00e4hig": {},
|
||||
"Abschreibungen auf Grund von Verlustanteilen an Mitunternehmerschaften \u00a7 8 GewStG": {},
|
||||
"Abschreibungen auf Wertpapiere des Umlaufverm\u00f6gens": {},
|
||||
"Abschreibungen auf Wertpapiere des Umlaufverm\u00f6gens 100% / 50% nicht abzugsf\u00e4hig (inl\u00e4ndische Kap. Ges.)": {},
|
||||
"Abschreibungen auf Wertpapiere des Umlaufverm\u00f6gens 100% / 50% nicht abzugsf\u00e4hig": {},
|
||||
"Vorwegnahme k\u00fcnftiger Wertschwankungen bei Wertpapieren des Umlaufverm\u00f6gens": {}
|
||||
},
|
||||
"account_type": "Depreciation"
|
||||
@@ -1123,15 +1122,15 @@
|
||||
}
|
||||
},
|
||||
"Erh\u00f6hung oder Verminderung des Bestands an fertigen und unfertige Erzeugnissen": {
|
||||
"Erh\u00f6hung des Bestands an fertigen und unfertigen Erzeugnissen oder Verminderung des Bestands an fertigen und unfertigen Erzeugnissen": {
|
||||
"Erh\u00f6hung / Verminderung des Bestands an fertigen und unfertigen Erzeugnissen": {
|
||||
"Bestandsver\u00e4nderungen - fertige Erzeugnisse": {},
|
||||
"Bestandsver\u00e4nderungen - unfertige Erzeugnisse": {},
|
||||
"Bestandsver\u00e4nderungen - unfertige Leistungen": {}
|
||||
},
|
||||
"Erh\u00f6hung des Bestands in Arbeit befindlicher Auftr\u00e4ge oder Verminderung des Bestands in Arbeit befindlicher Auftr\u00e4ge": {
|
||||
"Erh\u00f6hung / Verminderung des Bestands in Arbeit befindlicher Auftr\u00e4ge": {
|
||||
"Bestandsver\u00e4nderungen in Arbeit befindlicher Auftr\u00e4ge": {}
|
||||
},
|
||||
"Erh\u00f6hung des Bestands in Ausf\u00fchrung befindlicher Bauaftr\u00e4ge oder Verminderung des Bestands in Ausf\u00fchrung befindlicher Bauauftr\u00e4ge": {
|
||||
"Erh\u00f6hung / Verminderung des Bestands in Ausf\u00fchrung befindlicher Bauaftr\u00e4ge": {
|
||||
"Bestandsver\u00e4nderungen in Ausf\u00fchrung befindliche Bauauftr\u00e4ge": {}
|
||||
}
|
||||
},
|
||||
@@ -1384,8 +1383,8 @@
|
||||
"Sonstige Zinsen und \u00e4hnliche Ertr\u00e4ge 1": {
|
||||
"Diskontertr\u00e4ge": {},
|
||||
"Diskontertr\u00e4ge aus verbundenen Unternehmen": {},
|
||||
"Laufende Ertr\u00e4ge aus Anteilen an Kapitalgesellschaften (Umlaufverm\u00f6gen) 100% / 50% steuerfrei (inl\u00e4ndische Kap. Ges.)": {},
|
||||
"Laufende Ertr\u00e4ge aus Anteilen an Kapitalgesellschaften (verbundene Unternehmen) 100% / 50% steuerfrei (inl\u00e4ndische Kap. Ges.)": {},
|
||||
"Laufende Ertr\u00e4ge aus Anteilen an Kapitalgesellschaften 100% / 50% steuerfrei": {},
|
||||
"Laufende Ertr\u00e4ge aus Anteilen an Kapitalgesellschaften 100% / 50% steuerfrei": {},
|
||||
"Sonstige Zinsen und \u00e4hnliche Ertr\u00e4ge 2": {},
|
||||
"Sonstige Zinsen und \u00e4hnliche Ertr\u00e4ge aus verbundenen Unternehmen": {},
|
||||
"Sonstige Zinsertr\u00e4ge": {},
|
||||
|
||||
@@ -588,7 +588,6 @@
|
||||
"5592. Munk\u00e1ltat\u00f3 \u00e1ltal \u00f6nk\u00e9ntes p\u00e9nzt\u00e1rba befizetett munk\u00e1ltat\u00f3i tagd\u00edj hozz\u00e1j\u00e1rul\u00e1s": {},
|
||||
"5593. Munk\u00e1ltat\u00f3t terhel\u0151 szem\u00e9lyi j\u00f6vedelemad\u00f3": {},
|
||||
"5594. Munk\u00e1ltat\u00f3i hozz\u00e1j\u00e1rul\u00e1s a korengedm\u00e9nyes nyugd\u00edj ig\u00e9nybev\u00e9tel\u00e9hez": {},
|
||||
"5595. Tal\u00e1lm\u00e1nyi d\u00edj, szabadalom v\u00e9tel\u00e1ra \u00e9s hasznos\u00edt\u00e1si d\u00edja, az \u00faj\u00edt\u00e1si d\u00edj \u00e9s ezekkel kapcsolatos k\u00f6zrem\u0171k\u00f6d\u00e9si d\u00edjak": {},
|
||||
"5596. Fizetett szerz\u0151i, \u00edr\u00f3i \u00e9s m\u00e1s jogv\u00e9delmet \u00e9lvez\u0151 munk\u00e1k d\u00edjai \u00e9s ezekkel kapcsolatos k\u00f6zrem\u0171k\u00f6d\u0151i d\u00edjak": {},
|
||||
"5597. Fizetett \u00f6szt\u00f6nd\u00edjak": {},
|
||||
"5598. Reprezent\u00e1ci\u00f3s k\u00f6lts\u00e9gek, \u00e9tkez\u00e9si hozz\u00e1j\u00e1rul\u00e1s": {},
|
||||
@@ -731,7 +730,7 @@
|
||||
"8684. K\u00f6vetel\u00e9sek \u00e9rt\u00e9kveszt\u00e9se": {}
|
||||
},
|
||||
"869. K\u00fcl\u00f6nf\u00e9le egy\u00e9b r\u00e1ford\u00edt\u00e1sok": {
|
||||
"8691. T\u00e1rsas\u00e1gba bevitt, \u00e9rt\u00e9kpap\u00edrnak vagy r\u00e9szesed\u00e9snek nem min\u0151s\u00fcl\u0151 vagyont. k\u00f6nyv szerinti \u00e9s l\u00e9t. okir. meghat. veszt. k\u00fcl\u00f6nb\u00f6zet": {},
|
||||
"8691. T\u00e1rsas\u00e1gba bevitt, \u00e9rt\u00e9kpap\u00edrnak vagy r\u00e9szesed\u00e9snek nem min\u0151s\u00fcl\u0151 vagyont.": {},
|
||||
"8692. Ellent\u00e9telez\u00e9s n\u00e9lk\u00fcl \u00e1tv\u00e1llalt k\u00f6telezetts\u00e9g szerz\u0151d\u00e9s szerinti \u00f6sszege": {},
|
||||
"8693. 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": {},
|
||||
"8694. T\u00e9r\u00edt\u00e9s n\u00e9lk\u00fcl ny\u00fajtott szolg\u00e1ltat\u00e1sok beker\u00fcl\u00e9si \u00e9rt\u00e9ke": {},
|
||||
@@ -813,12 +812,7 @@
|
||||
"9684. R\u00e9szesed\u00e9sek \u00e9rt\u00e9kveszt\u00e9s\u00e9nek vissza\u00edr\u00e1sa": {}
|
||||
},
|
||||
"969. K\u00fcl\u00f6nf\u00e9le egy\u00e9b bev\u00e9telek": {
|
||||
"9691. Gazdas\u00e1gi t\u00e1rsas\u00e1gba bevitt, \u00e9rt\u00e9kp. vagy r\u00e9szesed\u00e9snek nem min\u0151s\u00fcl\u0151 vagyont. \u00e9rt\u00e9ke \u00e9s l\u00e9tes\u00edt\u0151 okir. \u00e9rt. nyer. jell . k\u00fcl\u00f6nb.": {},
|
||||
"9692. El\u00e9v\u00fclt k\u00f6telezetts\u00e9g k\u00f6nyv szerinti \u00e9rt\u00e9ke": {},
|
||||
"9693. 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": {},
|
||||
"9694. T\u00e9r\u00edt\u00e9s n\u00e9lk\u00fcl kapott szolg\u00e1ltat\u00e1sok piaci vagy jogszab\u00e1ly szerinti \u00e9rt\u00e9ke": {},
|
||||
"9695. Elengedett \u00e9s ellent\u00e9telez\u00e9s n\u00e9lk\u00fcl \u00e1tv\u00e1llalt k\u00f6telezetts\u00e9g \u00e9rt\u00e9ke": {},
|
||||
"9696. Egy\u00e9b, vagyonn\u00f6veked\u00e9ssel j\u00e1r\u00f3 bev\u00e9telek": {}
|
||||
"is_group": 1
|
||||
}
|
||||
},
|
||||
"97. P\u00c9NZ\u00dcGYI M\u0170VELETEK BEV\u00c9TELEI": {
|
||||
|
||||
@@ -159,6 +159,36 @@
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "include_pos_transactions",
|
||||
"fieldtype": "Check",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Include POS Transactions",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
@@ -292,7 +322,7 @@
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": 0,
|
||||
"modified": "2017-04-21 16:58:26.902732",
|
||||
"modified": "2018-03-07 18:58:48.658687",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Bank Reconciliation",
|
||||
|
||||
@@ -53,10 +53,26 @@ class BankReconciliation(Document):
|
||||
posting_date ASC, name DESC
|
||||
""".format(condition),
|
||||
{"account":self.bank_account, "from":self.from_date, "to":self.to_date}, as_dict=1)
|
||||
|
||||
entries = sorted(list(payment_entries)+list(journal_entries),
|
||||
|
||||
pos_entries = []
|
||||
if self.include_pos_transactions:
|
||||
pos_entries = frappe.db.sql("""
|
||||
select
|
||||
"Sales Invoice Payment" as payment_document, sip.name as payment_entry, sip.amount as debit,
|
||||
si.posting_date, si.debit_to as against_account, sip.clearance_date,
|
||||
account.account_currency, 0 as credit
|
||||
from `tabSales Invoice Payment` sip, `tabSales Invoice` si, `tabAccount` account
|
||||
where
|
||||
sip.account=%(account)s and si.docstatus=1 and sip.parent = si.name
|
||||
and account.name = sip.account and si.posting_date >= %(from)s and si.posting_date <= %(to)s {0}
|
||||
order by
|
||||
si.posting_date ASC, si.name DESC
|
||||
""".format(condition),
|
||||
{"account":self.bank_account, "from":self.from_date, "to":self.to_date}, as_dict=1)
|
||||
|
||||
entries = sorted(list(payment_entries)+list(journal_entries+list(pos_entries)),
|
||||
key=lambda k: k['posting_date'] or getdate(nowdate()))
|
||||
|
||||
|
||||
self.set('payment_entries', [])
|
||||
self.total_amount = 0.0
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# See license.txt
|
||||
from __future__ import unicode_literals
|
||||
import unittest
|
||||
|
||||
class TestBankReconciliation(unittest.TestCase):
|
||||
pass
|
||||
@@ -48,5 +48,10 @@ frappe.treeview_settings["Cost Center"] = {
|
||||
}, __('Budget'));
|
||||
|
||||
},
|
||||
onrender: function(node) {
|
||||
if(node.is_root){
|
||||
node.hide_add = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
0
erpnext/accounts/doctype/gst_account/__init__.py
Normal file
0
erpnext/accounts/doctype/gst_account/__init__.py
Normal file
196
erpnext/accounts/doctype/gst_account/gst_account.json
Normal file
196
erpnext/accounts/doctype/gst_account/gst_account.json
Normal file
@@ -0,0 +1,196 @@
|
||||
{
|
||||
"allow_copy": 0,
|
||||
"allow_guest_to_view": 0,
|
||||
"allow_import": 0,
|
||||
"allow_rename": 0,
|
||||
"beta": 0,
|
||||
"creation": "2018-01-02 15:48:58.768352",
|
||||
"custom": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "DocType",
|
||||
"document_type": "",
|
||||
"editable_grid": 1,
|
||||
"engine": "InnoDB",
|
||||
"fields": [
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "company",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Company",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Company",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "cgst_account",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "CGST Account",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Account",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "sgst_account",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "SGST Account",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Account",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "igst_account",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "IGST Account",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Account",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "cess_account",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "CESS Account",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Account",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
}
|
||||
],
|
||||
"has_web_view": 0,
|
||||
"hide_heading": 0,
|
||||
"hide_toolbar": 0,
|
||||
"idx": 0,
|
||||
"image_view": 0,
|
||||
"in_create": 0,
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 1,
|
||||
"max_attachments": 0,
|
||||
"modified": "2018-01-02 15:52:22.335988",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "GST Account",
|
||||
"name_case": "",
|
||||
"owner": "Administrator",
|
||||
"permissions": [],
|
||||
"quick_entry": 1,
|
||||
"read_only": 0,
|
||||
"read_only_onload": 0,
|
||||
"show_name_in_global_search": 0,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"track_changes": 1,
|
||||
"track_seen": 0
|
||||
}
|
||||
10
erpnext/accounts/doctype/gst_account/gst_account.py
Normal file
10
erpnext/accounts/doctype/gst_account/gst_account.py
Normal file
@@ -0,0 +1,10 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe.model.document import Document
|
||||
|
||||
class GSTAccount(Document):
|
||||
pass
|
||||
@@ -82,8 +82,8 @@ erpnext.accounts.JournalEntry = frappe.ui.form.Controller.extend({
|
||||
$.each(this.frm.doc.accounts || [], function(i, jvd) {
|
||||
frappe.model.set_default_values(jvd);
|
||||
});
|
||||
|
||||
if(!this.frm.doc.amended_from) this.frm.doc.posting_date = this.frm.posting_date || frappe.datetime.get_today();
|
||||
var posting_date = this.frm.posting_date;
|
||||
if(!this.frm.doc.amended_from) this.frm.set_value('posting_date', posting_date || frappe.datetime.get_today());
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -145,13 +145,13 @@ frappe.ui.form.on('Payment Entry', {
|
||||
frm.doc.paid_amount : frm.doc.received_amount;
|
||||
|
||||
frm.toggle_display("write_off_difference_amount", (frm.doc.difference_amount && frm.doc.party &&
|
||||
(frm.doc.paid_from_account_currency == frm.doc.paid_to_account_currency) &&
|
||||
(frm.doc.total_allocated_amount > party_amount)));
|
||||
|
||||
frm.toggle_display("set_exchange_gain_loss",
|
||||
(frm.doc.paid_amount && frm.doc.received_amount && frm.doc.difference_amount &&
|
||||
(frm.doc.paid_from_account_currency != company_currency ||
|
||||
frm.doc.paid_to_account_currency != company_currency)));
|
||||
((frm.doc.paid_from_account_currency != company_currency ||
|
||||
frm.doc.paid_to_account_currency != company_currency) &&
|
||||
frm.doc.paid_from_account_currency != frm.doc.paid_to_account_currency)));
|
||||
|
||||
frm.refresh_fields();
|
||||
},
|
||||
@@ -300,7 +300,15 @@ frappe.ui.form.on('Payment Entry', {
|
||||
if(frm.doc.payment_type == "Pay") {
|
||||
frm.events.get_outstanding_documents(frm);
|
||||
} else if (frm.doc.payment_type == "Receive") {
|
||||
frm.events.received_amount(frm);
|
||||
if(frm.doc.paid_from_account_currency == frm.doc.paid_to_account_currency) {
|
||||
if(frm.doc.source_exchange_rate) {
|
||||
frm.set_value("target_exchange_rate", frm.doc.source_exchange_rate);
|
||||
}
|
||||
frm.set_value("received_amount", frm.doc.paid_amount);
|
||||
|
||||
} else {
|
||||
frm.events.received_amount(frm);
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -317,26 +325,31 @@ frappe.ui.form.on('Payment Entry', {
|
||||
},
|
||||
callback: function(r, rt) {
|
||||
if(r.message) {
|
||||
frm.set_value(currency_field, r.message['account_currency']);
|
||||
frm.set_value(balance_field, r.message['account_balance']);
|
||||
frappe.run_serially([
|
||||
() => frm.set_value(currency_field, r.message['account_currency']),
|
||||
() => {
|
||||
frm.set_value(balance_field, r.message['account_balance']);
|
||||
|
||||
if(frm.doc.payment_type=="Receive" && currency_field=="paid_to_account_currency") {
|
||||
frm.toggle_reqd(["reference_no", "reference_date"],
|
||||
(r.message['account_type'] == "Bank" ? 1 : 0));
|
||||
if(!frm.doc.received_amount && frm.doc.paid_amount)
|
||||
frm.events.paid_amount(frm);
|
||||
} else if(frm.doc.payment_type=="Pay" && currency_field=="paid_from_account_currency") {
|
||||
frm.toggle_reqd(["reference_no", "reference_date"],
|
||||
(r.message['account_type'] == "Bank" ? 1 : 0));
|
||||
if(frm.doc.payment_type=="Receive" && currency_field=="paid_to_account_currency") {
|
||||
frm.toggle_reqd(["reference_no", "reference_date"],
|
||||
(r.message['account_type'] == "Bank" ? 1 : 0));
|
||||
if(!frm.doc.received_amount && frm.doc.paid_amount)
|
||||
frm.events.paid_amount(frm);
|
||||
} else if(frm.doc.payment_type=="Pay" && currency_field=="paid_from_account_currency") {
|
||||
frm.toggle_reqd(["reference_no", "reference_date"],
|
||||
(r.message['account_type'] == "Bank" ? 1 : 0));
|
||||
|
||||
if(!frm.doc.paid_amount && frm.doc.received_amount)
|
||||
frm.events.received_amount(frm);
|
||||
}
|
||||
if(!frm.doc.paid_amount && frm.doc.received_amount)
|
||||
frm.events.received_amount(frm);
|
||||
}
|
||||
},
|
||||
() => {
|
||||
if(callback_function) callback_function(frm);
|
||||
|
||||
if(callback_function) callback_function(frm);
|
||||
|
||||
frm.events.hide_unhide_fields(frm);
|
||||
frm.events.set_dynamic_labels(frm);
|
||||
frm.events.hide_unhide_fields(frm);
|
||||
frm.events.set_dynamic_labels(frm);
|
||||
}
|
||||
]);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -405,7 +418,7 @@ frappe.ui.form.on('Payment Entry', {
|
||||
frm.set_value("base_received_amount", frm.doc.base_paid_amount);
|
||||
}
|
||||
|
||||
frm.events.set_difference_amount(frm);
|
||||
frm.events.set_unallocated_amount(frm);
|
||||
}
|
||||
|
||||
// Make read only if Accounts Settings doesn't allow stale rates
|
||||
@@ -425,7 +438,7 @@ frappe.ui.form.on('Payment Entry', {
|
||||
frm.set_value("base_paid_amount", frm.doc.base_received_amount);
|
||||
}
|
||||
|
||||
frm.events.set_difference_amount(frm);
|
||||
frm.events.set_unallocated_amount(frm);
|
||||
}
|
||||
frm.set_paid_amount_based_on_received_amount = false;
|
||||
|
||||
@@ -456,7 +469,7 @@ frappe.ui.form.on('Payment Entry', {
|
||||
if(frm.doc.payment_type == "Pay")
|
||||
frm.events.allocate_party_amount_against_ref_docs(frm, frm.doc.received_amount);
|
||||
else
|
||||
frm.events.set_difference_amount(frm);
|
||||
frm.events.set_unallocated_amount(frm);
|
||||
|
||||
frm.set_paid_amount_based_on_received_amount = false;
|
||||
},
|
||||
@@ -476,7 +489,7 @@ frappe.ui.form.on('Payment Entry', {
|
||||
if(frm.doc.payment_type == "Receive")
|
||||
frm.events.allocate_party_amount_against_ref_docs(frm, frm.doc.paid_amount);
|
||||
else
|
||||
frm.events.set_difference_amount(frm);
|
||||
frm.events.set_unallocated_amount(frm);
|
||||
},
|
||||
|
||||
get_outstanding_documents: function(frm) {
|
||||
@@ -565,8 +578,11 @@ frappe.ui.form.on('Payment Entry', {
|
||||
if(frm.doc.references.length == 0){
|
||||
frm.events.get_outstanding_documents(frm);
|
||||
}
|
||||
|
||||
frm.events.allocate_party_amount_against_ref_docs(frm, frm.doc.received_amount);
|
||||
if(frm.doc.payment_type == 'Internal Transfer') {
|
||||
frm.events.allocate_party_amount_against_ref_docs(frm, frm.doc.paid_amount);
|
||||
} else {
|
||||
frm.events.allocate_party_amount_against_ref_docs(frm, frm.doc.received_amount);
|
||||
}
|
||||
},
|
||||
|
||||
allocate_party_amount_against_ref_docs: function(frm, paid_amount) {
|
||||
@@ -651,28 +667,32 @@ frappe.ui.form.on('Payment Entry', {
|
||||
frm.set_value("total_allocated_amount", Math.abs(total_allocated_amount));
|
||||
frm.set_value("base_total_allocated_amount", Math.abs(base_total_allocated_amount));
|
||||
|
||||
frm.events.set_difference_amount(frm);
|
||||
frm.events.set_unallocated_amount(frm);
|
||||
},
|
||||
|
||||
set_difference_amount: function(frm) {
|
||||
set_unallocated_amount: function(frm) {
|
||||
var unallocated_amount = 0;
|
||||
var total_deductions = frappe.utils.sum($.map(frm.doc.deductions || [],
|
||||
function(d) { return flt(d.amount) }));
|
||||
|
||||
if(frm.doc.party) {
|
||||
var party_amount = frm.doc.payment_type=="Receive" ?
|
||||
frm.doc.paid_amount : frm.doc.received_amount;
|
||||
|
||||
if(frm.doc.total_allocated_amount < party_amount) {
|
||||
if(frm.doc.payment_type == "Receive") {
|
||||
unallocated_amount = party_amount - (frm.doc.total_allocated_amount - total_deductions);
|
||||
} else {
|
||||
unallocated_amount = party_amount - (frm.doc.total_allocated_amount + total_deductions);
|
||||
}
|
||||
if(frm.doc.payment_type == "Receive"
|
||||
&& frm.doc.base_total_allocated_amount < frm.doc.base_received_amount + total_deductions
|
||||
&& frm.doc.total_allocated_amount < frm.doc.paid_amount + (total_deductions / frm.doc.source_exchange_rate)) {
|
||||
unallocated_amount = (frm.doc.base_received_amount + total_deductions
|
||||
- frm.doc.base_total_allocated_amount) / frm.doc.source_exchange_rate;
|
||||
} else if (frm.doc.payment_type == "Pay"
|
||||
&& frm.doc.base_total_allocated_amount < frm.doc.base_paid_amount - total_deductions
|
||||
&& frm.doc.total_allocated_amount < frm.doc.received_amount + (total_deductions / frm.doc.target_exchange_rate)) {
|
||||
unallocated_amount = (frm.doc.base_paid_amount - (total_deductions
|
||||
+ frm.doc.base_total_allocated_amount)) / frm.doc.target_exchange_rate;
|
||||
}
|
||||
}
|
||||
frm.set_value("unallocated_amount", unallocated_amount);
|
||||
|
||||
frm.trigger("set_difference_amount");
|
||||
},
|
||||
|
||||
set_difference_amount: function(frm) {
|
||||
var difference_amount = 0;
|
||||
var base_unallocated_amount = flt(frm.doc.unallocated_amount) *
|
||||
(frm.doc.payment_type=="Receive" ? frm.doc.source_exchange_rate : frm.doc.target_exchange_rate);
|
||||
@@ -687,11 +707,18 @@ frappe.ui.form.on('Payment Entry', {
|
||||
difference_amount = flt(frm.doc.base_paid_amount) - flt(frm.doc.base_received_amount);
|
||||
}
|
||||
|
||||
var total_deductions = frappe.utils.sum($.map(frm.doc.deductions || [],
|
||||
function(d) { return flt(d.amount) }));
|
||||
|
||||
frm.set_value("difference_amount", difference_amount - total_deductions);
|
||||
|
||||
frm.events.hide_unhide_fields(frm);
|
||||
},
|
||||
|
||||
unallocated_amount: function(frm) {
|
||||
frm.trigger("set_difference_amount");
|
||||
},
|
||||
|
||||
check_mandatory_to_fetch: function(frm) {
|
||||
$.each(["Company", "Party Type", "Party", "payment_type"], function(i, field) {
|
||||
if(!frm.doc[frappe.model.scrub(field)]) {
|
||||
@@ -771,7 +798,7 @@ frappe.ui.form.on('Payment Entry', {
|
||||
row.amount = flt(row.amount) + flt(frm.doc.difference_amount);
|
||||
refresh_field("deductions");
|
||||
|
||||
frm.events.set_difference_amount(frm);
|
||||
frm.events.set_unallocated_amount(frm);
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -818,10 +845,10 @@ frappe.ui.form.on('Payment Entry Reference', {
|
||||
|
||||
frappe.ui.form.on('Payment Entry Deduction', {
|
||||
amount: function(frm) {
|
||||
frm.events.set_difference_amount(frm);
|
||||
frm.events.set_unallocated_amount(frm);
|
||||
},
|
||||
|
||||
deductions_remove: function(frm) {
|
||||
frm.events.set_difference_amount(frm);
|
||||
frm.events.set_unallocated_amount(frm);
|
||||
}
|
||||
})
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@@ -71,6 +72,7 @@
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 1,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@@ -102,6 +104,7 @@
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@@ -131,6 +134,7 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@@ -162,6 +166,7 @@
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@@ -193,6 +198,7 @@
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@@ -224,6 +230,7 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@@ -255,6 +262,7 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@@ -288,6 +296,7 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@@ -320,6 +329,7 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@@ -349,6 +359,7 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@@ -381,6 +392,7 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@@ -411,6 +423,7 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@@ -442,6 +455,7 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@@ -474,6 +488,7 @@
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@@ -506,6 +521,7 @@
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@@ -538,6 +554,7 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@@ -567,6 +584,7 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@@ -599,6 +617,7 @@
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@@ -631,6 +650,7 @@
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@@ -663,6 +683,7 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@@ -695,6 +716,7 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@@ -727,6 +749,7 @@
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@@ -758,6 +781,7 @@
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@@ -790,6 +814,7 @@
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@@ -819,6 +844,7 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@@ -851,6 +877,7 @@
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@@ -882,6 +909,7 @@
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@@ -914,6 +942,7 @@
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@@ -946,6 +975,7 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@@ -978,6 +1008,7 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@@ -1010,6 +1041,7 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@@ -1041,6 +1073,7 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@@ -1072,6 +1105,7 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@@ -1104,6 +1138,7 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@@ -1134,6 +1169,7 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@@ -1163,6 +1199,7 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@@ -1188,12 +1225,13 @@
|
||||
"precision": "",
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@@ -1226,6 +1264,7 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@@ -1257,6 +1296,7 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@@ -1289,6 +1329,7 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@@ -1320,6 +1361,7 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@@ -1350,6 +1392,7 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@@ -1381,6 +1424,7 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@@ -1410,6 +1454,7 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@@ -1441,6 +1486,7 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@@ -1472,6 +1518,7 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@@ -1504,6 +1551,7 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@@ -1536,6 +1584,7 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@@ -1566,6 +1615,7 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@@ -1595,6 +1645,7 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@@ -1626,6 +1677,7 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@@ -1657,6 +1709,7 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@@ -1687,6 +1740,7 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@@ -1718,6 +1772,7 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@@ -1748,6 +1803,7 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@@ -1778,6 +1834,7 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
}
|
||||
],
|
||||
@@ -1791,7 +1848,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2017-08-31 11:20:37.578469",
|
||||
"modified": "2018-02-19 16:58:23.899015",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Payment Entry",
|
||||
|
||||
@@ -20,6 +20,11 @@ class InvalidPaymentEntry(ValidationError):
|
||||
|
||||
|
||||
class PaymentEntry(AccountsController):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(PaymentEntry, self).__init__(*args, **kwargs)
|
||||
if not self.is_new():
|
||||
self.setup_party_account_field()
|
||||
|
||||
def setup_party_account_field(self):
|
||||
self.party_account_field = None
|
||||
self.party_account = None
|
||||
@@ -58,16 +63,21 @@ class PaymentEntry(AccountsController):
|
||||
if self.difference_amount:
|
||||
frappe.throw(_("Difference Amount must be zero"))
|
||||
self.make_gl_entries()
|
||||
self.update_outstanding_amounts()
|
||||
self.update_advance_paid()
|
||||
self.update_expense_claim()
|
||||
|
||||
def on_cancel(self):
|
||||
self.setup_party_account_field()
|
||||
self.make_gl_entries(cancel=1)
|
||||
self.update_outstanding_amounts()
|
||||
self.update_advance_paid()
|
||||
self.update_expense_claim()
|
||||
self.delink_advance_entry_references()
|
||||
|
||||
def update_outstanding_amounts(self):
|
||||
self.set_missing_ref_details(force=True)
|
||||
|
||||
def validate_duplicate_entry(self):
|
||||
reference_names = []
|
||||
for d in self.get("references"):
|
||||
@@ -129,14 +139,14 @@ class PaymentEntry(AccountsController):
|
||||
|
||||
self.set_missing_ref_details()
|
||||
|
||||
def set_missing_ref_details(self):
|
||||
def set_missing_ref_details(self, force=False):
|
||||
for d in self.get("references"):
|
||||
if d.allocated_amount:
|
||||
ref_details = get_reference_details(d.reference_doctype,
|
||||
d.reference_name, self.party_account_currency)
|
||||
|
||||
for field, value in ref_details.items():
|
||||
if not d.get(field):
|
||||
if not d.get(field) or force:
|
||||
d.set(field, value)
|
||||
|
||||
def validate_payment_type(self):
|
||||
@@ -281,17 +291,19 @@ class PaymentEntry(AccountsController):
|
||||
self.base_total_allocated_amount = abs(base_total_allocated_amount)
|
||||
|
||||
def set_unallocated_amount(self):
|
||||
self.unallocated_amount = 0;
|
||||
self.unallocated_amount = 0
|
||||
if self.party:
|
||||
party_amount = self.paid_amount if self.payment_type=="Receive" else self.received_amount
|
||||
|
||||
total_deductions = sum([flt(d.amount) for d in self.get("deductions")])
|
||||
|
||||
if self.total_allocated_amount < party_amount:
|
||||
if self.payment_type == "Receive":
|
||||
self.unallocated_amount = party_amount - (self.total_allocated_amount - total_deductions)
|
||||
else:
|
||||
self.unallocated_amount = party_amount - (self.total_allocated_amount + total_deductions)
|
||||
if self.payment_type == "Receive" \
|
||||
and self.base_total_allocated_amount < self.base_received_amount + total_deductions \
|
||||
and self.total_allocated_amount < self.paid_amount + (total_deductions / self.source_exchange_rate):
|
||||
self.unallocated_amount = (self.base_received_amount + total_deductions -
|
||||
self.base_total_allocated_amount) / self.source_exchange_rate
|
||||
elif self.payment_type == "Pay" \
|
||||
and self.base_total_allocated_amount < (self.base_paid_amount - total_deductions) \
|
||||
and self.total_allocated_amount < self.received_amount + (total_deductions / self.target_exchange_rate):
|
||||
self.unallocated_amount = (self.base_paid_amount - (total_deductions +
|
||||
self.base_total_allocated_amount)) / self.target_exchange_rate
|
||||
|
||||
def set_difference_amount(self):
|
||||
base_unallocated_amount = flt(self.unallocated_amount) * (flt(self.source_exchange_rate)
|
||||
@@ -660,6 +672,24 @@ def get_company_defaults(company):
|
||||
return ret
|
||||
|
||||
|
||||
def get_outstanding_on_journal_entry(name):
|
||||
res = frappe.db.sql(
|
||||
'SELECT '
|
||||
'CASE WHEN party_type IN ("Customer", "Student") '
|
||||
'THEN ifnull(sum(debit_in_account_currency - credit_in_account_currency), 0) '
|
||||
'ELSE ifnull(sum(credit_in_account_currency - debit_in_account_currency), 0) '
|
||||
'END as outstanding_amount '
|
||||
'FROM `tabGL Entry` WHERE (voucher_no=%s OR against_voucher=%s) '
|
||||
'AND party_type IS NOT NULL '
|
||||
'AND party_type != ""',
|
||||
(name, name), as_dict=1
|
||||
)
|
||||
|
||||
outstanding_amount = res[0].get('outstanding_amount', 0) if res else 0
|
||||
|
||||
return outstanding_amount
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_reference_details(reference_doctype, reference_name, party_account_currency):
|
||||
total_amount = outstanding_amount = exchange_rate = None
|
||||
@@ -670,6 +700,13 @@ def get_reference_details(reference_doctype, reference_name, party_account_curre
|
||||
total_amount = ref_doc.get("grand_total")
|
||||
exchange_rate = 1
|
||||
outstanding_amount = ref_doc.get("outstanding_amount")
|
||||
elif reference_doctype == "Journal Entry" and ref_doc.docstatus == 1:
|
||||
total_amount = ref_doc.get("total_amount")
|
||||
if ref_doc.multi_currency:
|
||||
exchange_rate = get_exchange_rate(party_account_currency, company_currency, ref_doc.posting_date)
|
||||
else:
|
||||
exchange_rate = 1
|
||||
outstanding_amount = get_outstanding_on_journal_entry(reference_name)
|
||||
elif reference_doctype != "Journal Entry":
|
||||
if party_account_currency == company_currency:
|
||||
if ref_doc.doctype == "Expense Claim":
|
||||
@@ -731,6 +768,8 @@ def get_payment_entry(dt, dn, party_amount=None, bank_account=None, bank_amount=
|
||||
party_account = doc.receivable_account
|
||||
elif dt == "Employee Advance":
|
||||
party_account = doc.advance_account
|
||||
elif dt == "Expense Claim":
|
||||
party_account = doc.payable_account
|
||||
else:
|
||||
party_account = get_party_account(party_type, doc.get(party_type.lower()), doc.company)
|
||||
|
||||
|
||||
@@ -141,7 +141,6 @@ class TestPaymentEntry(unittest.TestCase):
|
||||
def test_payment_entry_retrieves_last_exchange_rate(self):
|
||||
from erpnext.setup.doctype.currency_exchange.test_currency_exchange import test_records, save_new_records
|
||||
|
||||
test_records = test_records
|
||||
save_new_records(test_records)
|
||||
|
||||
pe = frappe.new_doc("Payment Entry")
|
||||
@@ -151,6 +150,7 @@ class TestPaymentEntry(unittest.TestCase):
|
||||
pe.paid_from = "_Test Bank USD - _TC"
|
||||
pe.paid_to = "_Test Bank - _TC"
|
||||
pe.paid_amount = 100
|
||||
pe.received_amount = 100
|
||||
pe.reference_no = "3"
|
||||
pe.reference_date = "2016-01-10"
|
||||
pe.party_type = "Supplier"
|
||||
|
||||
@@ -98,7 +98,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 1,
|
||||
"max_attachments": 0,
|
||||
"modified": "2016-07-11 03:28:03.420683",
|
||||
"modified": "2018-02-21 03:28:03.420683",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Payment Entry Deduction",
|
||||
|
||||
@@ -3,9 +3,26 @@
|
||||
|
||||
frappe.provide("erpnext.accounts");
|
||||
|
||||
frappe.ui.form.on("Payment Reconciliation Payment", {
|
||||
invoice_number: function(frm, cdt, cdn) {
|
||||
var row = locals[cdt][cdn];
|
||||
if(row.invoice_number) {
|
||||
var parts = row.invoice_number.split(' | ');
|
||||
var invoice_type = parts[0];
|
||||
var invoice_number = parts[1];
|
||||
|
||||
var invoice_amount = frm.doc.invoices.filter(function(d) {
|
||||
return d.invoice_type === invoice_type && d.invoice_number === invoice_number;
|
||||
})[0].outstanding_amount;
|
||||
|
||||
frappe.model.set_value(cdt, cdn, "allocated_amount", Math.min(invoice_amount, row.amount));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
erpnext.accounts.PaymentReconciliationController = frappe.ui.form.Controller.extend({
|
||||
onload: function() {
|
||||
var me = this
|
||||
var me = this;
|
||||
this.frm.set_query("party_type", function() {
|
||||
return{
|
||||
query: "erpnext.setup.doctype.party_type.party_type.get_party_type"
|
||||
|
||||
@@ -55,6 +55,7 @@ class PaymentReconciliation(Document):
|
||||
THEN 1=1
|
||||
ELSE {bank_account_condition}
|
||||
END)
|
||||
order by t1.posting_date
|
||||
""".format(**{
|
||||
"dr_or_cr": dr_or_cr,
|
||||
"bank_account_condition": bank_account_condition,
|
||||
|
||||
@@ -78,6 +78,9 @@ class PaymentRequest(Document):
|
||||
controller = get_payment_gateway_controller(self.payment_gateway)
|
||||
controller.validate_transaction_currency(self.currency)
|
||||
|
||||
if hasattr(controller, 'validate_minimum_transaction_amount'):
|
||||
controller.validate_minimum_transaction_amount(self.currency, self.grand_total)
|
||||
|
||||
return controller.get_payment_url(**{
|
||||
"amount": flt(self.grand_total, self.precision("grand_total")),
|
||||
"title": data.company.encode("utf-8"),
|
||||
|
||||
@@ -61,13 +61,11 @@ class TestPaymentRequest(unittest.TestCase):
|
||||
self.assertEquals(pr.currency, "USD")
|
||||
|
||||
def test_payment_entry(self):
|
||||
frappe.db.set_value("Company", "_Test Company",
|
||||
frappe.db.set_value("Company", "_Test Company",
|
||||
"exchange_gain_loss_account", "_Test Exchange Gain/Loss - _TC")
|
||||
frappe.db.set_value("Company", "_Test Company",
|
||||
"write_off_account", "_Test Write Off - _TC")
|
||||
frappe.db.set_value("Company", "_Test Company",
|
||||
"cost_center", "_Test Cost Center - _TC")
|
||||
|
||||
frappe.db.set_value("Company", "_Test Company", "write_off_account", "_Test Write Off - _TC")
|
||||
frappe.db.set_value("Company", "_Test Company", "cost_center", "_Test Cost Center - _TC")
|
||||
|
||||
so_inr = make_sales_order(currency="INR")
|
||||
pr = make_payment_request(dt="Sales Order", dn=so_inr.name, recipient_id="saurabh@erpnext.com",
|
||||
mute_email=1, submit_doc=1, return_doc=1)
|
||||
@@ -82,15 +80,15 @@ class TestPaymentRequest(unittest.TestCase):
|
||||
|
||||
pr = make_payment_request(dt="Sales Invoice", dn=si_usd.name, recipient_id="saurabh@erpnext.com",
|
||||
mute_email=1, payment_gateway="_Test Gateway - USD", submit_doc=1, return_doc=1)
|
||||
|
||||
|
||||
pe = pr.set_as_paid()
|
||||
|
||||
|
||||
expected_gle = dict((d[0], d) for d in [
|
||||
["_Test Receivable USD - _TC", 0, 5000, si_usd.name],
|
||||
[pr.payment_account, 6290.0, 0, None],
|
||||
["_Test Exchange Gain/Loss - _TC", 0, 1290, None]
|
||||
])
|
||||
|
||||
|
||||
gl_entries = frappe.db.sql("""select account, debit, credit, against_voucher
|
||||
from `tabGL Entry` where voucher_type='Payment Entry' and voucher_no=%s
|
||||
order by account asc""", pe.name, as_dict=1)
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"allow_copy": 0,
|
||||
"allow_guest_to_view": 0,
|
||||
"allow_import": 0,
|
||||
"allow_rename": 0,
|
||||
"allow_import": 1,
|
||||
"allow_rename": 1,
|
||||
"autoname": "field:payment_term_name",
|
||||
"beta": 0,
|
||||
"creation": "2017-08-10 15:24:54.876365",
|
||||
@@ -265,7 +265,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2017-08-10 16:26:03.581501",
|
||||
"modified": "2018-01-24 11:13:42.800048",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Payment Term",
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"allow_copy": 0,
|
||||
"allow_guest_to_view": 0,
|
||||
"allow_import": 0,
|
||||
"allow_rename": 0,
|
||||
"allow_import": 1,
|
||||
"allow_rename": 1,
|
||||
"autoname": "field:template_name",
|
||||
"beta": 0,
|
||||
"creation": "2017-08-10 15:34:28.058054",
|
||||
@@ -85,7 +85,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2017-08-10 15:46:33.877884",
|
||||
"modified": "2018-01-24 11:13:31.158613",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Payment Terms Template",
|
||||
|
||||
@@ -254,6 +254,36 @@
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "allow_user_to_edit_discount",
|
||||
"fieldtype": "Check",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Allow user to edit Discount",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
@@ -1476,7 +1506,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2018-01-03 17:30:45.198147",
|
||||
"modified": "2018-01-31 19:33:11.765731",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "POS Profile",
|
||||
|
||||
@@ -32,7 +32,7 @@ class POSProfile(Document):
|
||||
.format(res[0][0], row.user), raise_exception=1)
|
||||
elif not row.default and not res:
|
||||
msgprint(_("User {0} doesn't have any default POS Profile. Check Default at Row {1} for this User.")
|
||||
.format(row.user, row.idx), raise_exception=1)
|
||||
.format(row.user, row.idx))
|
||||
|
||||
def validate_all_link_fields(self):
|
||||
accounts = {"Account": [self.income_account,
|
||||
|
||||
@@ -131,7 +131,7 @@ def get_serial_no_for_item(args):
|
||||
"name": args.name,
|
||||
"serial_no": args.serial_no
|
||||
})
|
||||
if args.get("parenttype") in ("Sales Invoice", "Delivery Note") and args.stock_qty > 0:
|
||||
if args.get("parenttype") in ("Sales Invoice", "Delivery Note") and flt(args.stock_qty) > 0:
|
||||
item_details.serial_no = get_serial_no(args)
|
||||
return item_details
|
||||
|
||||
|
||||
@@ -8,6 +8,10 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({
|
||||
setup: function(doc) {
|
||||
this.setup_posting_date_time_check();
|
||||
this._super(doc);
|
||||
|
||||
// formatter for material request item
|
||||
this.frm.set_indicator_formatter('item_code',
|
||||
function(doc) { return (doc.qty<=doc.received_qty) ? "green" : "orange" })
|
||||
},
|
||||
onload: function() {
|
||||
this._super();
|
||||
@@ -18,12 +22,8 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({
|
||||
this.frm.set_df_property("credit_to", "print_hide", 0);
|
||||
}
|
||||
} else {
|
||||
this.frm.set_value("disable_rounded_total", frappe.sys_defaults.disable_rounded_total);
|
||||
this.frm.set_value("disable_rounded_total", cint(frappe.sys_defaults.disable_rounded_total));
|
||||
}
|
||||
|
||||
// formatter for material request item
|
||||
this.frm.set_indicator_formatter('item_code',
|
||||
function(doc) { return (doc.qty<=doc.received_qty) ? "green" : "orange" })
|
||||
},
|
||||
|
||||
refresh: function(doc) {
|
||||
|
||||
@@ -96,7 +96,7 @@ class PurchaseInvoice(BuyingController):
|
||||
if not self.credit_to:
|
||||
self.credit_to = get_party_account("Supplier", self.supplier, self.company)
|
||||
if not self.due_date:
|
||||
self.due_date = get_due_date(self.posting_date, "Supplier", self.supplier)
|
||||
self.due_date = get_due_date(self.posting_date, "Supplier", self.supplier, self.company)
|
||||
|
||||
super(PurchaseInvoice, self).set_missing_values(for_validate)
|
||||
|
||||
@@ -350,7 +350,6 @@ class PurchaseInvoice(BuyingController):
|
||||
self.negative_expense_to_be_booked = 0.0
|
||||
gl_entries = []
|
||||
|
||||
|
||||
self.make_supplier_gl_entry(gl_entries)
|
||||
self.make_item_gl_entries(gl_entries)
|
||||
self.make_tax_gl_entries(gl_entries)
|
||||
@@ -424,7 +423,10 @@ class PurchaseInvoice(BuyingController):
|
||||
|
||||
# sub-contracting warehouse
|
||||
if flt(item.rm_supp_cost):
|
||||
supplier_warehouse_account = warehouse_account[self.supplier_warehouse]["name"]
|
||||
supplier_warehouse_account = warehouse_account[self.supplier_warehouse]["account"]
|
||||
if not supplier_warehouse_account:
|
||||
frappe.throw(_("Please set account in Warehouse {0}")
|
||||
.format(self.supplier_warehouse))
|
||||
gl_entries.append(self.get_gl_dict({
|
||||
"account": supplier_warehouse_account,
|
||||
"against": item.expense_account,
|
||||
|
||||
@@ -106,6 +106,10 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
|
||||
on_submit: function(doc, dt, dn) {
|
||||
var me = this;
|
||||
|
||||
if (frappe.get_route()[0] != 'Form') {
|
||||
return
|
||||
}
|
||||
|
||||
$.each(doc["items"], function(i, row) {
|
||||
if(row.delivery_note) frappe.model.clear_doc("Delivery Note", row.delivery_note)
|
||||
})
|
||||
|
||||
@@ -639,6 +639,126 @@
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 1,
|
||||
"collapsible_depends_on": "po_no",
|
||||
"columns": 0,
|
||||
"fieldname": "customer_po_details",
|
||||
"fieldtype": "Section Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Customer PO Details",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 1,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "po_no",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Customer's Purchase Order",
|
||||
"length": 0,
|
||||
"no_copy": 1,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "column_break_23",
|
||||
"fieldtype": "Column Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 1,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "po_date",
|
||||
"fieldtype": "Date",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Customer's Purchase Order Date",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
@@ -4563,7 +4683,7 @@
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": 0,
|
||||
"modified": "2017-12-20 17:36:05.216046",
|
||||
"modified": "2018-03-16 15:19:54.711885",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Sales Invoice",
|
||||
|
||||
@@ -101,6 +101,8 @@ class SalesInvoice(SellingController):
|
||||
self.set_billing_hours_and_amount()
|
||||
self.update_timesheet_billing_for_project()
|
||||
self.set_status()
|
||||
if self.is_pos and not self.is_return:
|
||||
self.verify_payment_amount_is_positive()
|
||||
|
||||
def before_save(self):
|
||||
set_account_for_mode_of_payment(self)
|
||||
@@ -224,12 +226,17 @@ class SalesInvoice(SellingController):
|
||||
from erpnext.selling.doctype.customer.customer import check_credit_limit
|
||||
|
||||
validate_against_credit_limit = False
|
||||
bypass_credit_limit_check_at_sales_order = cint(frappe.db.get_value("Customer", self.customer,
|
||||
"bypass_credit_limit_check_at_sales_order"))
|
||||
if bypass_credit_limit_check_at_sales_order:
|
||||
validate_against_credit_limit = True
|
||||
|
||||
for d in self.get("items"):
|
||||
if not (d.sales_order or d.delivery_note):
|
||||
validate_against_credit_limit = True
|
||||
break
|
||||
if validate_against_credit_limit:
|
||||
check_credit_limit(self.customer, self.company)
|
||||
check_credit_limit(self.customer, self.company, bypass_credit_limit_check_at_sales_order)
|
||||
|
||||
def set_missing_values(self, for_validate=False):
|
||||
pos = self.set_pos_fields(for_validate)
|
||||
@@ -237,12 +244,16 @@ class SalesInvoice(SellingController):
|
||||
if not self.debit_to:
|
||||
self.debit_to = get_party_account("Customer", self.customer, self.company)
|
||||
if not self.due_date and self.customer:
|
||||
self.due_date = get_due_date(self.posting_date, "Customer", self.customer)
|
||||
self.due_date = get_due_date(self.posting_date, "Customer", self.customer, self.company)
|
||||
|
||||
super(SalesInvoice, self).set_missing_values(for_validate)
|
||||
|
||||
if pos:
|
||||
return {"print_format": pos.get("print_format_for_online") }
|
||||
return {
|
||||
"print_format": pos.get("print_format_for_online"),
|
||||
"allow_edit_rate": pos.get("allow_user_to_edit_rate"),
|
||||
"allow_edit_discount": pos.get("allow_user_to_edit_discount")
|
||||
}
|
||||
|
||||
def update_time_sheet(self, sales_invoice):
|
||||
for d in self.timesheets:
|
||||
@@ -323,7 +334,7 @@ class SalesInvoice(SellingController):
|
||||
for item in self.get("items"):
|
||||
if item.get('item_code'):
|
||||
for fname, val in get_pos_profile_item_details(pos,
|
||||
frappe._dict(item.as_dict()), pos).items():
|
||||
frappe._dict(item.as_dict()), pos, True).items():
|
||||
|
||||
if (not for_validate) or (for_validate and not item.get(fname)):
|
||||
item.set(fname, val)
|
||||
@@ -894,6 +905,11 @@ class SalesInvoice(SellingController):
|
||||
project.update_billed_amount()
|
||||
project.save()
|
||||
|
||||
def verify_payment_amount_is_positive(self):
|
||||
for entry in self.payments:
|
||||
if entry.amount < 0:
|
||||
frappe.throw(_("Row #{0} (Payment Table): Amount must be positive").format(entry.idx))
|
||||
|
||||
def get_list_context(context=None):
|
||||
from erpnext.controllers.website_list_for_contact import get_list_context
|
||||
list_context = get_list_context(context)
|
||||
|
||||
@@ -227,6 +227,36 @@
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "clearance_date",
|
||||
"fieldtype": "Date",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Clearance Date",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
}
|
||||
],
|
||||
"has_web_view": 0,
|
||||
@@ -239,7 +269,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 1,
|
||||
"max_attachments": 0,
|
||||
"modified": "2017-07-24 17:25:03.765856",
|
||||
"modified": "2018-03-07 18:34:39.552769",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Sales Invoice Payment",
|
||||
|
||||
@@ -232,6 +232,8 @@ def get_next_date(dt, mcount, day=None):
|
||||
def send_notification(new_rv, subscription_doc, print_format='Standard'):
|
||||
"""Notify concerned persons about recurring document generation"""
|
||||
print_format = print_format
|
||||
subject = subscription_doc.subject or ''
|
||||
message = subscription_doc.message or ''
|
||||
|
||||
if not subscription_doc.subject:
|
||||
subject = _("New {0}: #{1}").format(new_rv.doctype, new_rv.name)
|
||||
|
||||
@@ -39,18 +39,20 @@ frappe.ui.form.on("Tax Rule", "customer", function(frm) {
|
||||
});
|
||||
|
||||
frappe.ui.form.on("Tax Rule", "supplier", function(frm) {
|
||||
frappe.call({
|
||||
method:"erpnext.accounts.doctype.tax_rule.tax_rule.get_party_details",
|
||||
args: {
|
||||
"party": frm.doc.supplier,
|
||||
"party_type": "supplier"
|
||||
},
|
||||
callback: function(r) {
|
||||
if(!r.exc) {
|
||||
$.each(r.message, function(k, v) {
|
||||
frm.set_value(k, v);
|
||||
});
|
||||
if(frm.doc.supplier) {
|
||||
frappe.call({
|
||||
method:"erpnext.accounts.doctype.tax_rule.tax_rule.get_party_details",
|
||||
args: {
|
||||
"party": frm.doc.supplier,
|
||||
"party_type": "supplier"
|
||||
},
|
||||
callback: function(r) {
|
||||
if(!r.exc) {
|
||||
$.each(r.message, function(k, v) {
|
||||
frm.set_value(k, v);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -130,8 +130,8 @@ def get_party_details(party, party_type, args=None):
|
||||
def get_tax_template(posting_date, args):
|
||||
"""Get matching tax rule"""
|
||||
args = frappe._dict(args)
|
||||
conditions = ["""(from_date is null or from_date = '' or from_date <= '{0}')
|
||||
and (to_date is null or to_date = '' or to_date >= '{0}')""".format(posting_date)]
|
||||
conditions = ["""(from_date is null or from_date <= '{0}')
|
||||
and (to_date is null or to_date >= '{0}')""".format(posting_date)]
|
||||
|
||||
for key, value in args.iteritems():
|
||||
if key=="use_for_shopping_cart":
|
||||
|
||||
@@ -191,8 +191,9 @@ def delete_gl_entries(gl_entries=None, voucher_type=None, voucher_no=None,
|
||||
for entry in gl_entries:
|
||||
validate_frozen_account(entry["account"], adv_adj)
|
||||
validate_balance_type(entry["account"], adv_adj)
|
||||
validate_expense_against_budget(entry)
|
||||
if not adv_adj:
|
||||
validate_expense_against_budget(entry)
|
||||
|
||||
if entry.get("against_voucher") and update_outstanding == 'Yes':
|
||||
if entry.get("against_voucher") and update_outstanding == 'Yes' and not adv_adj:
|
||||
update_outstanding_amt(entry["account"], entry.get("party_type"), entry.get("party"), entry.get("against_voucher_type"),
|
||||
entry.get("against_voucher"), on_cancel=True)
|
||||
|
||||
@@ -15,6 +15,7 @@ frappe.pages['pos'].on_page_load = function (wrapper) {
|
||||
cur_pos = wrapper.pos;
|
||||
} else {
|
||||
// online
|
||||
frappe.flags.is_online = true
|
||||
frappe.set_route('point-of-sale');
|
||||
}
|
||||
});
|
||||
@@ -24,6 +25,10 @@ frappe.pages['pos'].refresh = function (wrapper) {
|
||||
window.onbeforeunload = function () {
|
||||
return wrapper.pos.beforeunload()
|
||||
}
|
||||
|
||||
if (frappe.flags.is_online) {
|
||||
frappe.set_route('point-of-sale');
|
||||
}
|
||||
}
|
||||
|
||||
erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
||||
@@ -388,7 +393,8 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
||||
this.frm = {}
|
||||
this.frm.doc = this.doc
|
||||
this.set_transaction_defaults("Customer");
|
||||
this.frm.doc["allow_user_to_edit_rate"] = this.pos_profile_data["allow_user_to_edit_rate"] ? true : false,
|
||||
this.frm.doc["allow_user_to_edit_rate"] = this.pos_profile_data["allow_user_to_edit_rate"] ? true : false;
|
||||
this.frm.doc["allow_user_to_edit_discount"] = this.pos_profile_data["allow_user_to_edit_discount"] ? true : false;
|
||||
this.wrapper.html(frappe.render_template("pos", this.frm.doc));
|
||||
this.make_search();
|
||||
this.make_customer();
|
||||
@@ -1172,8 +1178,17 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
||||
$(this.wrapper).on("change", ".pos-item-disc", function () {
|
||||
var item_code = $(this).parents(".pos-selected-item-action").attr("data-item-code");
|
||||
var discount = $(this).val();
|
||||
me.update_discount(item_code, discount)
|
||||
me.update_value()
|
||||
if(discount > 100){
|
||||
discount = $(this).val('');
|
||||
frappe.show_alert({
|
||||
indicator: 'red',
|
||||
message: __('Discount amount cannot be greater than 100%')
|
||||
});
|
||||
me.update_discount(item_code, discount);
|
||||
}else{
|
||||
me.update_discount(item_code, discount);
|
||||
me.update_value();
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
@@ -1242,6 +1257,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
||||
$(this.wrapper).find('.selected-item').empty();
|
||||
if(this.child_doc.length) {
|
||||
this.child_doc[0]["allow_user_to_edit_rate"] = this.pos_profile_data["allow_user_to_edit_rate"] ? true : false,
|
||||
this.child_doc[0]["allow_user_to_edit_discount"] = this.pos_profile_data["allow_user_to_edit_discount"] ? true : false;
|
||||
this.selected_row = $(frappe.render_template("pos_selected_item", this.child_doc[0]))
|
||||
$(this.wrapper).find('.selected-item').html(this.selected_row)
|
||||
}
|
||||
@@ -1669,7 +1685,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
||||
setInterval(function () {
|
||||
me.freeze_screen = false;
|
||||
me.sync_sales_invoice()
|
||||
}, 60000)
|
||||
}, 180000)
|
||||
},
|
||||
|
||||
sync_sales_invoice: function () {
|
||||
@@ -2001,4 +2017,4 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
||||
frappe.throw(__("LocalStorage is full , did not save"))
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
@@ -4,12 +4,11 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
import datetime
|
||||
from frappe import _, msgprint, scrub
|
||||
from frappe.defaults import get_user_permissions
|
||||
from frappe.model.utils import get_fetch_values
|
||||
from frappe.utils import (add_days, getdate, formatdate, get_first_day, date_diff,
|
||||
add_years, get_timestamp, nowdate, flt, add_months, get_last_day)
|
||||
from frappe.utils import (add_days, getdate, formatdate, date_diff,
|
||||
add_years, get_timestamp, nowdate, flt, add_months, get_last_day)
|
||||
from frappe.contacts.doctype.address.address import (get_address_display,
|
||||
get_default_address, get_company_address)
|
||||
from frappe.contacts.doctype.contact.contact import get_contact_details, get_default_contact
|
||||
@@ -51,7 +50,7 @@ def _get_party_details(party=None, account=None, party_type="Customer", company=
|
||||
set_other_values(out, party, party_type)
|
||||
set_price_list(out, party, party_type, price_list)
|
||||
out["taxes_and_charges"] = set_taxes(party.name, party_type, posting_date, company, out.customer_group, out.supplier_type)
|
||||
out["payment_terms_template"] = get_pyt_term_template(party.name, party_type)
|
||||
out["payment_terms_template"] = get_pyt_term_template(party.name, party_type, company)
|
||||
|
||||
if not out.get("currency"):
|
||||
out["currency"] = currency
|
||||
@@ -164,7 +163,7 @@ def set_account_and_due_date(party, account, party_type, company, posting_date,
|
||||
out = {
|
||||
party_type.lower(): party,
|
||||
account_fieldname : account,
|
||||
"due_date": get_due_date(posting_date, party_type, party)
|
||||
"due_date": get_due_date(posting_date, party_type, party, company)
|
||||
}
|
||||
return out
|
||||
|
||||
@@ -267,12 +266,12 @@ def validate_party_accounts(doc):
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_due_date(posting_date, party_type, party):
|
||||
def get_due_date(posting_date, party_type, party, company=None):
|
||||
"""Get due date from `Payment Terms Template`"""
|
||||
due_date = None
|
||||
if posting_date and party:
|
||||
due_date = posting_date
|
||||
template_name = get_pyt_term_template(party, party_type)
|
||||
template_name = get_pyt_term_template(party, party_type, company)
|
||||
if template_name:
|
||||
due_date = get_due_date_from_template(template_name, posting_date).strftime("%Y-%m-%d")
|
||||
else:
|
||||
@@ -305,12 +304,11 @@ def get_due_date_from_template(template_name, posting_date):
|
||||
|
||||
return due_date
|
||||
|
||||
|
||||
def validate_due_date(posting_date, due_date, party_type, party):
|
||||
def validate_due_date(posting_date, due_date, party_type, party, company=None):
|
||||
if getdate(due_date) < getdate(posting_date):
|
||||
frappe.throw(_("Due Date cannot be before Posting Date"))
|
||||
else:
|
||||
default_due_date = get_due_date(posting_date, party_type, party)
|
||||
default_due_date = get_due_date(posting_date, party_type, party, company)
|
||||
if not default_due_date:
|
||||
return
|
||||
|
||||
@@ -360,14 +358,32 @@ def set_taxes(party, party_type, posting_date, company, customer_group=None, sup
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_pyt_term_template(party_name, party_type):
|
||||
def get_pyt_term_template(party_name, party_type, company=None):
|
||||
if party_type not in ("Customer", "Supplier"):
|
||||
return
|
||||
|
||||
template = None
|
||||
if party_type in ('Customer', 'Supplier'):
|
||||
template = frappe.db.get_value(party_type, party_name, fieldname='payment_terms')
|
||||
if party_type == 'Customer':
|
||||
customer = frappe.db.get_value("Customer", party_name,
|
||||
fieldname=['payment_terms', "customer_group"], as_dict=1)
|
||||
template = customer.payment_terms
|
||||
|
||||
if not template and customer.customer_group:
|
||||
template = frappe.db.get_value("Customer Group",
|
||||
customer.customer_group, fieldname='payment_terms')
|
||||
else:
|
||||
supplier = frappe.db.get_value("Supplier", party_name,
|
||||
fieldname=['payment_terms', "supplier_type"], as_dict=1)
|
||||
template = supplier.payment_terms
|
||||
|
||||
if not template and supplier.supplier_type:
|
||||
template = frappe.db.get_value("Supplier Type", supplier.supplier_type, fieldname='payment_terms')
|
||||
|
||||
if not template and company:
|
||||
template = frappe.db.get_value("Company", company, fieldname='payment_terms')
|
||||
|
||||
return template
|
||||
|
||||
|
||||
def validate_party_frozen_disabled(party_type, party_name):
|
||||
if party_type and party_name:
|
||||
if party_type in ("Customer", "Supplier"):
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
"docstatus": 0,
|
||||
"doctype": "Print Format",
|
||||
"font": "Default",
|
||||
"html": "<style>\n\t.print-format table, .print-format tr, \n\t.print-format td, .print-format div, .print-format p {\n\t\tfont-family: Monospace;\n\t\tline-height: 200%;\n\t\tvertical-align: middle;\n\t}\n\t@media screen {\n\t\t.print-format {\n\t\t\twidth: 4in;\n\t\t\tpadding: 0.25in;\n\t\t\tmin-height: 8in;\n\t\t}\n\t}\n</style>\n\n<p class=\"text-center\">\n\t{{ doc.company }}<br>\n\t{% if doc.company_address_display %}\n\t\t{% set company_address = doc.company_address_display.replace(\"\\n\", \" \").replace(\"<br>\", \" \") %}\n\t\t{% if \"GSTIN\" not in company_address %}\n\t\t\t{{ company_address }}\n\t\t\t<b>{{ _(\"GSTIN\") }}:</b>{{ doc.company_gstin }}\n\t\t{% else %}\n\t\t\t{{ company_address.replace(\"GSTIN\", \"<br>GSTIN\") }}\n\t\t{% endif %}\n\t{% endif %}\n\t<br>\n\t<b>{{ doc.select_print_heading or _(\"Invoice\") }}</b><br>\n</p>\n<p>\n\t<b>{{ _(\"Receipt No\") }}:</b> {{ doc.name }}<br>\n\t<b>{{ _(\"Date\") }}:</b> {{ doc.get_formatted(\"posting_date\") }}<br>\n\t{% if doc.grand_total > 50000 %}\n\t\t{% set customer_address = doc.address_display.replace(\"\\n\", \" \").replace(\"<br>\", \" \") %}\n\t\t<b>{{ _(\"Customer\") }}:</b><br>\n\t\t{{ doc.customer_name }}<br>\n\t\t{{ customer_address }}\n\t{% endif %}\n</p>\n\n<hr>\n<table class=\"table table-condensed cart no-border\">\n\t<thead>\n\t\t<tr>\n\t\t\t<th width=\"40%\">{{ _(\"Item\") }}</b></th>\n\t\t\t<th width=\"30%\" class=\"text-right\">{{ _(\"Qty\") }}</th>\n\t\t\t<th width=\"30%\" class=\"text-right\">{{ _(\"Amount\") }}</th>\n\t\t</tr>\n\t</thead>\n\t<tbody>\n\t\t{%- for item in doc.items -%}\n\t\t<tr>\n\t\t\t<td>\n\t\t\t\t{{ item.item_code }}\n\t\t\t\t{%- if item.item_name != item.item_code -%}\n\t\t\t\t\t<br>{{ item.item_name }}\n\t\t\t\t{%- endif -%}\n\t\t\t\t{%- if item.gst_hsn_code -%}\n\t\t\t\t\t<br><b>{{ _(\"HSN/SAC\") }}:</b> {{ item.gst_hsn_code }}\n\t\t\t\t{%- endif -%}\n\t\t\t\t{%- if item.serial_no -%}\n\t\t\t\t\t<br><b>{{ _(\"Serial No\") }}:</b> {{ item.serial_no }}\n\t\t\t\t{%- endif -%}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">{{ item.qty }}<br>@ {{ item.rate }}</td>\n\t\t\t<td class=\"text-right\">{{ item.get_formatted(\"amount\") }}</td>\n\t\t</tr>\n\t\t{%- endfor -%}\n\t</tbody>\n</table>\n<table class=\"table table-condensed no-border\">\n\t<tbody>\n\t\t<tr>\n\t\t\t{% if doc.flags.show_inclusive_tax_in_print %}\n\t\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t\t{{ _(\"Total Excl. Tax\") }}\n\t\t\t\t</td>\n\t\t\t\t<td class=\"text-right\">\n\t\t\t\t\t{{ doc.get_formatted(\"net_total\", doc) }}\n\t\t\t\t</td>\n\t\t\t{% else %}\n\t\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t\t{{ _(\"Total\") }}\n\t\t\t\t</td>\n\t\t\t\t<td class=\"text-right\">\n\t\t\t\t\t{{ doc.get_formatted(\"total\", doc) }}\n\t\t\t\t</td>\n\t\t\t{% endif %}\n\t\t</tr>\n\t\t{%- for row in doc.taxes -%}\n\t\t {%- if not row.included_in_print_rate or doc.flags.show_inclusive_tax_in_print -%}\n\t\t\t<tr>\n\t\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t\t{{ row.description }}\n\t\t\t\t</td>\n\t\t\t\t<td class=\"text-right\">\n\t\t\t\t\t{{ row.get_formatted(\"tax_amount\", doc) }}\n\t\t\t\t</td>\n\t\t\t<tr>\n\t\t {%- endif -%}\n\t\t{%- endfor -%}\n\t\t{%- if doc.discount_amount -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t{{ _(\"Discount\") }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"discount_amount\") }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{%- endif -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t<b>{{ _(\"Grand Total\") }}</b>\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"grand_total\") }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{%- if doc.rounded_total -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t<b>{{ _(\"Rounded Total\") }}</b>\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"rounded_total\") }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{%- endif -%}\n\t</tbody>\n</table>\n<p><b>Tax Breakup:</b></p>\n<div style=\"font-size: 8px\">\n\t{{ doc.other_charges_calculation }}\n</div>\n<p>{{ doc.terms or \"\" }}</p>\n<p class=\"text-center\">{{ _(\"Thank you, please visit again.\") }}</p>",
|
||||
"html": "<style>\n\t.print-format table, .print-format tr, \n\t.print-format td, .print-format div, .print-format p {\n\t\tfont-family: Monospace;\n\t\tline-height: 200%;\n\t\tvertical-align: middle;\n\t}\n\t@media screen {\n\t\t.print-format {\n\t\t\twidth: 4in;\n\t\t\tpadding: 0.25in;\n\t\t\tmin-height: 8in;\n\t\t}\n\t}\n</style>\n\n<p class=\"text-center\">\n\t{{ doc.company }}<br>\n\t{% if doc.company_address_display %}\n\t\t{% set company_address = doc.company_address_display.replace(\"\\n\", \" \").replace(\"<br>\", \" \") %}\n\t\t{% if \"GSTIN\" not in company_address %}\n\t\t\t{{ company_address }}\n\t\t\t<b>{{ _(\"GSTIN\") }}:</b>{{ doc.company_gstin }}\n\t\t{% else %}\n\t\t\t{{ company_address.replace(\"GSTIN\", \"<br>GSTIN\") }}\n\t\t{% endif %}\n\t{% endif %}\n\t<br>\n\t<b>{{ doc.select_print_heading or _(\"Invoice\") }}</b><br>\n</p>\n<p>\n\t<b>{{ _(\"Receipt No\") }}:</b> {{ doc.name }}<br>\n\t<b>{{ _(\"Date\") }}:</b> {{ doc.get_formatted(\"posting_date\") }}<br>\n\t{% if doc.grand_total > 50000 %}\n\t\t{% set customer_address = doc.address_display.replace(\"\\n\", \" \").replace(\"<br>\", \" \") %}\n\t\t<b>{{ _(\"Customer\") }}:</b><br>\n\t\t{{ doc.customer_name }}<br>\n\t\t{{ customer_address }}\n\t{% endif %}\n</p>\n\n<hr>\n<table class=\"table table-condensed cart no-border\">\n\t<thead>\n\t\t<tr>\n\t\t\t<th width=\"40%\">{{ _(\"Item\") }}</b></th>\n\t\t\t<th width=\"30%\" class=\"text-right\">{{ _(\"Qty\") }}</th>\n\t\t\t<th width=\"30%\" class=\"text-right\">{{ _(\"Amount\") }}</th>\n\t\t</tr>\n\t</thead>\n\t<tbody>\n\t\t{%- for item in doc.items -%}\n\t\t<tr>\n\t\t\t<td>\n\t\t\t\t{{ item.item_code }}\n\t\t\t\t{%- if item.item_name != item.item_code -%}\n\t\t\t\t\t<br>{{ item.item_name }}\n\t\t\t\t{%- endif -%}\n\t\t\t\t{%- if item.gst_hsn_code -%}\n\t\t\t\t\t<br><b>{{ _(\"HSN/SAC\") }}:</b> {{ item.gst_hsn_code }}\n\t\t\t\t{%- endif -%}\n\t\t\t\t{%- if item.serial_no -%}\n\t\t\t\t\t<br><b>{{ _(\"Serial No\") }}:</b> {{ item.serial_no }}\n\t\t\t\t{%- endif -%}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">{{ item.qty }}<br>@ {{ item.rate }}</td>\n\t\t\t<td class=\"text-right\">{{ item.get_formatted(\"amount\") }}</td>\n\t\t</tr>\n\t\t{%- endfor -%}\n\t</tbody>\n</table>\n<table class=\"table table-condensed no-border\">\n\t<tbody>\n\t\t<tr>\n\t\t\t{% if doc.flags.show_inclusive_tax_in_print %}\n\t\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t\t{{ _(\"Total Excl. Tax\") }}\n\t\t\t\t</td>\n\t\t\t\t<td class=\"text-right\">\n\t\t\t\t\t{{ doc.get_formatted(\"net_total\", doc) }}\n\t\t\t\t</td>\n\t\t\t{% else %}\n\t\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t\t{{ _(\"Total\") }}\n\t\t\t\t</td>\n\t\t\t\t<td class=\"text-right\">\n\t\t\t\t\t{{ doc.get_formatted(\"total\", doc) }}\n\t\t\t\t</td>\n\t\t\t{% endif %}\n\t\t</tr>\n\t\t{%- for row in doc.taxes -%}\n\t\t {%- if not row.included_in_print_rate or doc.flags.show_inclusive_tax_in_print -%}\n\t\t\t<tr>\n\t\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t\t{{ row.description }}\n\t\t\t\t</td>\n\t\t\t\t<td class=\"text-right\">\n\t\t\t\t\t{{ row.get_formatted(\"tax_amount\", doc) }}\n\t\t\t\t</td>\n\t\t\t<tr>\n\t\t {%- endif -%}\n\t\t{%- endfor -%}\n\t\t{%- if doc.discount_amount -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t{{ _(\"Discount\") }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"discount_amount\") }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{%- endif -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t<b>{{ _(\"Grand Total\") }}</b>\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"grand_total\") }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{%- if doc.rounded_total -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t<b>{{ _(\"Rounded Total\") }}</b>\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"rounded_total\") }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{%- endif -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t<b>{{ _(\"Paid Amount\") }}</b>\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"paid_amount\") }}\n\t\t\t</td>\n\t\t</tr>\n\t{%- if doc.change_amount -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t<b>{{ _(\"Change Amount\") }}</b>\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"change_amount\") }}\n\t\t\t</td>\n\t\t</tr>\n\t{%- endif -%}\n\t</tbody>\n</table>\n<p><b>Tax Breakup:</b></p>\n<div style=\"font-size: 8px\">\n\t{{ doc.other_charges_calculation }}\n</div>\n<p>{{ doc.terms or \"\" }}</p>\n<p class=\"text-center\">{{ _(\"Thank you, please visit again.\") }}</p>",
|
||||
"idx": 0,
|
||||
"line_breaks": 0,
|
||||
"modified": "2018-01-12 11:19:17.432600",
|
||||
"modified": "2018-03-20 14:24:08.167930",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "GST POS Invoice",
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
"doc_type": "Sales Invoice",
|
||||
"docstatus": 0,
|
||||
"doctype": "Print Format",
|
||||
"html": "<style>\n\t.print-format table, .print-format tr, \n\t.print-format td, .print-format div, .print-format p {\n\t\tfont-family: Monospace;\n\t\tline-height: 200%;\n\t\tvertical-align: middle;\n\t}\n\t@media screen {\n\t\t.print-format {\n\t\t\twidth: 4in;\n\t\t\tpadding: 0.25in;\n\t\t\tmin-height: 8in;\n\t\t}\n\t}\n</style>\n\n<p class=\"text-center\">\n\t{{ doc.company }}<br>\n\t{{ doc.select_print_heading or _(\"Invoice\") }}<br>\n</p>\n<p>\n\t<b>{{ _(\"Receipt No\") }}:</b> {{ doc.name }}<br>\n\t<b>{{ _(\"Date\") }}:</b> {{ doc.get_formatted(\"posting_date\") }}<br>\n\t<b>{{ _(\"Customer\") }}:</b> {{ doc.customer_name }}\n</p>\n\n<hr>\n<table class=\"table table-condensed cart no-border\">\n\t<thead>\n\t\t<tr>\n\t\t\t<th width=\"50%\">{{ _(\"Item\") }}</b></th>\n\t\t\t<th width=\"25%\" class=\"text-right\">{{ _(\"Qty\") }}</th>\n\t\t\t<th width=\"25%\" class=\"text-right\">{{ _(\"Amount\") }}</th>\n\t\t</tr>\n\t</thead>\n\t<tbody>\n\t\t{%- for item in doc.items -%}\n\t\t<tr>\n\t\t\t<td>\n\t\t\t\t{{ item.item_code }}\n\t\t\t\t{%- if item.item_name != item.item_code -%}\n\t\t\t\t\t<br>{{ item.item_name }}{%- endif -%}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">{{ item.qty }}<br>@ {{ item.get_formatted(\"rate\") }}</td>\n\t\t\t<td class=\"text-right\">{{ item.get_formatted(\"amount\") }}</td>\n\t\t</tr>\n\t\t{%- endfor -%}\n\t</tbody>\n</table>\n<table class=\"table table-condensed no-border\">\n\t<tbody>\n\t\t<tr>\n\t\t\t{% if doc.flags.show_inclusive_tax_in_print %}\n\t\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t\t{{ _(\"Total Excl. Tax\") }}\n\t\t\t\t</td>\n\t\t\t\t<td class=\"text-right\">\n\t\t\t\t\t{{ doc.get_formatted(\"net_total\", doc) }}\n\t\t\t\t</td>\n\t\t\t{% else %}\n\t\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t\t{{ _(\"Total\") }}\n\t\t\t\t</td>\n\t\t\t\t<td class=\"text-right\">\n\t\t\t\t\t{{ doc.get_formatted(\"total\", doc) }}\n\t\t\t\t</td>\n\t\t\t{% endif %}\n\t\t</tr>\n\t\t{%- for row in doc.taxes -%}\n\t\t {%- if not row.included_in_print_rate or doc.flags.show_inclusive_tax_in_print -%}\n\t\t\t<tr>\n\t\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t\t{{ row.description }}\n\t\t\t\t</td>\n\t\t\t\t<td class=\"text-right\">\n\t\t\t\t\t{{ row.get_formatted(\"tax_amount\", doc) }}\n\t\t\t\t</td>\n\t\t\t<tr>\n\t\t {%- endif -%}\n\t\t{%- endfor -%}\n\n\t\t{%- if doc.discount_amount -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t{{ _(\"Discount\") }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"discount_amount\") }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{%- endif -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t<b>{{ _(\"Grand Total\") }}</b>\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"grand_total\") }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{%- if doc.rounded_total -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t<b>{{ _(\"Rounded Total\") }}</b>\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"rounded_total\") }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{%- endif -%}\n\t</tbody>\n</table>\n<hr>\n<p>{{ doc.terms or \"\" }}</p>\n<p class=\"text-center\">{{ _(\"Thank you, please visit again.\") }}</p>",
|
||||
"html": "<style>\n\t.print-format table, .print-format tr, \n\t.print-format td, .print-format div, .print-format p {\n\t\tfont-family: Monospace;\n\t\tline-height: 200%;\n\t\tvertical-align: middle;\n\t}\n\t@media screen {\n\t\t.print-format {\n\t\t\twidth: 4in;\n\t\t\tpadding: 0.25in;\n\t\t\tmin-height: 8in;\n\t\t}\n\t}\n</style>\n\n<p class=\"text-center\">\n\t{{ doc.company }}<br>\n\t{{ doc.select_print_heading or _(\"Invoice\") }}<br>\n</p>\n<p>\n\t<b>{{ _(\"Receipt No\") }}:</b> {{ doc.name }}<br>\n\t<b>{{ _(\"Date\") }}:</b> {{ doc.get_formatted(\"posting_date\") }}<br>\n\t<b>{{ _(\"Customer\") }}:</b> {{ doc.customer_name }}\n</p>\n\n<hr>\n<table class=\"table table-condensed cart no-border\">\n\t<thead>\n\t\t<tr>\n\t\t\t<th width=\"50%\">{{ _(\"Item\") }}</b></th>\n\t\t\t<th width=\"25%\" class=\"text-right\">{{ _(\"Qty\") }}</th>\n\t\t\t<th width=\"25%\" class=\"text-right\">{{ _(\"Amount\") }}</th>\n\t\t</tr>\n\t</thead>\n\t<tbody>\n\t\t{%- for item in doc.items -%}\n\t\t<tr>\n\t\t\t<td>\n\t\t\t\t{{ item.item_code }}\n\t\t\t\t{%- if item.item_name != item.item_code -%}\n\t\t\t\t\t<br>{{ item.item_name }}{%- endif -%}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">{{ item.qty }}<br>@ {{ item.get_formatted(\"rate\") }}</td>\n\t\t\t<td class=\"text-right\">{{ item.get_formatted(\"amount\") }}</td>\n\t\t</tr>\n\t\t{%- endfor -%}\n\t</tbody>\n</table>\n<table class=\"table table-condensed no-border\">\n\t<tbody>\n\t\t<tr>\n\t\t\t{% if doc.flags.show_inclusive_tax_in_print %}\n\t\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t\t{{ _(\"Total Excl. Tax\") }}\n\t\t\t\t</td>\n\t\t\t\t<td class=\"text-right\">\n\t\t\t\t\t{{ doc.get_formatted(\"net_total\", doc) }}\n\t\t\t\t</td>\n\t\t\t{% else %}\n\t\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t\t{{ _(\"Total\") }}\n\t\t\t\t</td>\n\t\t\t\t<td class=\"text-right\">\n\t\t\t\t\t{{ doc.get_formatted(\"total\", doc) }}\n\t\t\t\t</td>\n\t\t\t{% endif %}\n\t\t</tr>\n\t\t{%- for row in doc.taxes -%}\n\t\t {%- if not row.included_in_print_rate or doc.flags.show_inclusive_tax_in_print -%}\n\t\t\t<tr>\n\t\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t\t{{ row.description }}\n\t\t\t\t</td>\n\t\t\t\t<td class=\"text-right\">\n\t\t\t\t\t{{ row.get_formatted(\"tax_amount\", doc) }}\n\t\t\t\t</td>\n\t\t\t<tr>\n\t\t {%- endif -%}\n\t\t{%- endfor -%}\n\n\t\t{%- if doc.discount_amount -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t{{ _(\"Discount\") }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"discount_amount\") }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{%- endif -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t<b>{{ _(\"Grand Total\") }}</b>\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"grand_total\") }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{%- if doc.rounded_total -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t<b>{{ _(\"Rounded Total\") }}</b>\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"rounded_total\") }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{%- endif -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t<b>{{ _(\"Paid Amount\") }}</b>\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"paid_amount\") }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{%- if doc.change_amount -%}\n\t\t\t<tr>\n\t\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t\t<b>{{ _(\"Change Amount\") }}</b>\n\t\t\t\t</td>\n\t\t\t\t<td class=\"text-right\">\n\t\t\t\t\t{{ doc.get_formatted(\"change_amount\") }}\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t{%- endif -%}\n\t</tbody>\n</table>\n<hr>\n<p>{{ doc.terms or \"\" }}</p>\n<p class=\"text-center\">{{ _(\"Thank you, please visit again.\") }}</p>",
|
||||
"idx": 1,
|
||||
"line_breaks": 0,
|
||||
"modified": "2018-01-12 11:18:54.229254",
|
||||
"modified": "2018-03-20 14:24:12.394354",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "POS Invoice",
|
||||
|
||||
@@ -14,7 +14,13 @@ frappe.query_reports["Accounts Payable"] = {
|
||||
"fieldname":"supplier",
|
||||
"label": __("Supplier"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Supplier"
|
||||
"options": "Supplier",
|
||||
on_change: () => {
|
||||
var supplier = frappe.query_report_filters_by_name.supplier.get_value();
|
||||
frappe.db.get_value('Supplier', supplier, "tax_id", function(value) {
|
||||
frappe.query_report_filters_by_name.tax_id.set_value(value["tax_id"]);
|
||||
});
|
||||
}
|
||||
},
|
||||
{
|
||||
"fieldname":"report_date",
|
||||
@@ -52,6 +58,12 @@ frappe.query_reports["Accounts Payable"] = {
|
||||
"fieldtype": "Int",
|
||||
"default": "90",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname":"tax_id",
|
||||
"label": __("Tax Id"),
|
||||
"fieldtype": "Data",
|
||||
"hidden": 1
|
||||
}
|
||||
],
|
||||
onload: function(report) {
|
||||
|
||||
@@ -1,22 +1,123 @@
|
||||
{% if(filters.show_pdc_in_print) { %}
|
||||
<style>
|
||||
@media screen {
|
||||
.print-format {
|
||||
padding: 4mm;
|
||||
font-size: 8.0pt !important;
|
||||
font-family: Tahoma, sans-serif;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
{% } %}
|
||||
<style>
|
||||
.print-format {
|
||||
padding: 4mm;
|
||||
font-size: 8.0pt !important;
|
||||
font-family: Tahoma, sans-serif;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
<h2 class="text-center">{%= __(report.report_name) %}</h2>
|
||||
<h4 class="text-center">{%= filters.customer || filters.supplier %} </h4>
|
||||
<h6 class="text-center">
|
||||
{% if (filters.tax_id) { %}
|
||||
{%= __("Tax Id: ")%} {%= filters.tax_id %}
|
||||
{% } %}
|
||||
</h6>
|
||||
<h5 class="text-center">
|
||||
{%= __(filters.ageing_based_on) %}
|
||||
{%= __("Until") %}
|
||||
{%= dateutil.str_to_user(filters.report_date) %}
|
||||
</h5>
|
||||
<hr>
|
||||
{% if(filters.show_pdc_in_print) { %}
|
||||
{% var balance_row = data.slice(-1).pop();
|
||||
var range1 = report.columns[11].label;
|
||||
var range2 = report.columns[12].label;
|
||||
var range3 = report.columns[13].label;
|
||||
var range4 = report.columns[14].label;
|
||||
%}
|
||||
{% if(balance_row) { %}
|
||||
<table class="table table-bordered table-condensed">
|
||||
<caption class="text-right">(Amount in {%= data[0][__("currency")] || "" %})</caption>
|
||||
<colgroup>
|
||||
<col style="width: 30mm;">
|
||||
<col style="width: 18mm;">
|
||||
<col style="width: 18mm;">
|
||||
<col style="width: 18mm;">
|
||||
<col style="width: 18mm;">
|
||||
<col style="width: 18mm;">
|
||||
<col style="width: 18mm;">
|
||||
</colgroup>
|
||||
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{%= __(" ") %}</th>
|
||||
<th>{%= __(range1) %}</th>
|
||||
<th>{%= __(range2) %}</th>
|
||||
<th>{%= __(range3) %}</th>
|
||||
<th>{%= __(range4) %}</th>
|
||||
<th>{%= __("Total") %}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>{%= __("Total Outstanding") %}</td>
|
||||
<td class="text-right">{%= format_currency(balance_row[range1]) %}</td>
|
||||
<td class="text-right">{%= format_currency(balance_row[range2]) %}</td>
|
||||
<td class="text-right">{%= format_currency(balance_row[range3]) %}</td>
|
||||
<td class="text-right">{%= format_currency(balance_row[range4]) %}</td>
|
||||
<td class="text-right">
|
||||
{%= format_currency(flt(balance_row[__("Outstanding Amount")]), data[data.length-1]["currency"]) %}
|
||||
</td>
|
||||
</tr>
|
||||
<td>{%= __("PDC/LC") %}</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td class="text-right">
|
||||
{%= format_currency(flt(balance_row[__("PDC/LC Amount")]), data[data.length-1]["currency"]) %}
|
||||
</td>
|
||||
<tr class="cvs-footer">
|
||||
<th class="text-left">{%= __("Cheques Required") %}</th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th class="text-right">
|
||||
{%= format_currency(flt(balance_row[__("Outstanding Amount")]-balance_row[__("PDC/LC Amount")]), data[data.length-1]["currency"]) %}</th>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
{% } %}
|
||||
{% } %}
|
||||
<table class="table table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
{% if(report.report_name === "Accounts Receivable" || report.report_name === "Accounts Payable") { %}
|
||||
<th style="width: 14%">{%= __("Date") %}</th>
|
||||
<th style="width: 16%">{%= __("Ref") %}</th>
|
||||
<th style="width: 30%">{%= (filters.customer || filters.supplier) ? __("Remarks"): __("Party") %}</th>
|
||||
<th style="width: 18%">{%= __("Date") %}</th>
|
||||
<th style="width: 17%">{%= __("Reference") %}</th>
|
||||
{% if(!filters.show_pdc_in_print) { %}
|
||||
<th style="width: 20%">{%= (filters.customer || filters.supplier) ? __("Remarks"): __("Party") %}</th>
|
||||
{% } %}
|
||||
<th style="width: 10%">{%= __("Invoiced Amount") %}</th>
|
||||
<th style="width: 10%">{%= __("Paid Amount") %}</th>
|
||||
<th style="width: 10%">{%= report.report_name === "Accounts Receivable" ? __('Credit Note') : __('Debit Note') %}</th>
|
||||
<th style="width: 10%">{%= __("Outstanding Amount") %}</th>
|
||||
{% if(!filters.show_pdc_in_print) { %}
|
||||
<th style="width: 10%">{%= __("Paid Amount") %}</th>
|
||||
<th style="width: 10%">{%= report.report_name === "Accounts Receivable" ? __('Credit Note') : __('Debit Note') %}</th>
|
||||
{% } %}
|
||||
<th style="width: 15%">{%= __("Outstanding Amount") %}</th>
|
||||
{% if(filters.show_pdc_in_print) { %}
|
||||
{% if(report.report_name === "Accounts Receivable") { %}
|
||||
<th style="width: 10%">{%= __("Customer LPO No.") %}</th>
|
||||
{% } %}
|
||||
<th style="width: 10%">{%= __("PDC/LC Date") %}</th>
|
||||
<th style="width: 10%">{%= __("PDC/LC Ref") %}</th>
|
||||
<th style="width: 10%">{%= __("PDC/LC Amount") %}</th>
|
||||
<th style="width: 10%">{%= __("Remaining Balance") %}</th>
|
||||
{% } %}
|
||||
{% } else { %}
|
||||
<th style="width: 40%">{%= (filters.customer || filters.supplier) ? __("Remarks"): __("Party") %}</th>
|
||||
<th style="width: 15%">{%= __("Total Invoiced Amount") %}</th>
|
||||
@@ -31,9 +132,15 @@
|
||||
<tr>
|
||||
{% if(report.report_name === "Accounts Receivable" || report.report_name === "Accounts Payable") { %}
|
||||
{% if(data[i][__("Customer")] || data[i][__("Supplier")]) { %}
|
||||
<td>{%= dateutil.str_to_user(data[i][__("Posting Date")]) %}</td>
|
||||
<td>{%= data[i][__("Voucher Type")] %}
|
||||
<br>{%= data[i][__("Voucher No")] %}</td>
|
||||
<td>{%= dateutil.str_to_user(data[i]["posting_date"]) %}</td>
|
||||
<td>
|
||||
{% if(!filters.show_pdc_in_print) { %}
|
||||
{%= data[i]["voucher_type"] %}
|
||||
<br>
|
||||
{% } %}
|
||||
{%= data[i]["voucher_no"] %}
|
||||
</td>
|
||||
{% if(!filters.show_pdc_in_print) { %}
|
||||
<td>
|
||||
{% if(!(filters.customer || filters.supplier)) { %}
|
||||
{%= data[i][__("Customer")] || data[i][__("Supplier")] %}
|
||||
@@ -46,25 +153,56 @@
|
||||
<br>{%= __("Remarks") %}:
|
||||
{%= data[i][__("Remarks")] %}
|
||||
</td>
|
||||
{% } %}
|
||||
<td style="text-align: right">
|
||||
{%= format_currency(data[i]["Invoiced Amount"], data[i]["currency"]) %}</td>
|
||||
<td style="text-align: right">
|
||||
{%= format_currency(data[i]["Paid Amount"], data[i]["currency"]) %}</td>
|
||||
<td style="text-align: right">
|
||||
{%= report.report_name === "Accounts Receivable" ? format_currency(data[i]["Credit Note"], data[i]["currency"]) : format_currency(data[i]["Debit Note"], data[i]["currency"]) %}</td>
|
||||
|
||||
{% if(!filters.show_pdc_in_print) { %}
|
||||
<td style="text-align: right">
|
||||
{%= format_currency(data[i]["Paid Amount"], data[i]["currency"]) %}</td>
|
||||
<td style="text-align: right">
|
||||
{%= report.report_name === "Accounts Receivable" ? format_currency(data[i]["Credit Note"], data[i]["currency"]) : format_currency(data[i]["Debit Note"], data[i]["currency"]) %}</td>
|
||||
{% } %}
|
||||
<td style="text-align: right">
|
||||
{%= format_currency(data[i]["Outstanding Amount"], data[i]["currency"]) %}</td>
|
||||
|
||||
{% if(filters.show_pdc_in_print) { %}
|
||||
{% if(report.report_name === "Accounts Receivable") { %}
|
||||
<td style="text-align: right">
|
||||
{%= data[i][__("Customer LPO")] %}</td>
|
||||
{% } %}
|
||||
<td style="text-align: right">{%= frappe.datetime.str_to_user(data[i][__("PDC/LC Date")]) %}</td>
|
||||
<td style="text-align: right">{%= data[i][__("PDC/LC Ref")] %}</td>
|
||||
<td style="text-align: right">{%= format_currency(data[i][__("PDC/LC Amount")], data[i]["currency"]) %}</td>
|
||||
<td style="text-align: right">{%= format_currency(data[i][__("Remaining Balance")], data[i]["currency"]) %}</td>
|
||||
{% } %}
|
||||
{% } else { %}
|
||||
<td></td>
|
||||
{% if(!filters.show_pdc_in_print) { %}
|
||||
<td></td>
|
||||
{% } %}
|
||||
<td><b>{%= __("Total") %}</b></td>
|
||||
<td style="text-align: right">
|
||||
{%= format_currency(data[i]["Invoiced Amount"], data[i]["currency"] ) %}</td>
|
||||
<td style="text-align: right">
|
||||
{%= format_currency(data[i]["Paid Amount"], data[i]["currency"]) %}</td>
|
||||
<td style="text-align: right">{%= report.report_name === "Accounts Receivable" ? format_currency(data[i]["Credit Note"], data[i]["currency"]) : format_currency(data[i]["Debit Note"], data[i]["currency"]) %} </td>
|
||||
|
||||
{% if(!filters.show_pdc_in_print) { %}
|
||||
<td style="text-align: right">
|
||||
{%= format_currency(data[i]["Paid Amount"], data[i]["currency"]) %}</td>
|
||||
<td style="text-align: right">{%= report.report_name === "Accounts Receivable" ? format_currency(data[i]["Credit Note"], data[i]["currency"]) : format_currency(data[i]["Debit Note"], data[i]["currency"]) %} </td>
|
||||
{% } %}
|
||||
<td style="text-align: right">
|
||||
{%= format_currency(data[i]["Outstanding Amount"], data[i]["currency"]) %}</td>
|
||||
|
||||
{% if(filters.show_pdc_in_print) { %}
|
||||
{% if(report.report_name === "Accounts Receivable") { %}
|
||||
<td style="text-align: right">
|
||||
{%= data[i][__("Customer LPO")] %}</td>
|
||||
{% } %}
|
||||
<td style="text-align: right">{%= frappe.datetime.str_to_user(data[i][__("PDC/LC Date")]) %}</td>
|
||||
<td style="text-align: right">{%= data[i][__("PDC/LC Ref")] %}</td>
|
||||
<td style="text-align: right">{%= format_currency(data[i][__("PDC/LC Amount")], data[i]["currency"]) %}</td>
|
||||
<td style="text-align: right">{%= format_currency(data[i][__("Remaining Balance")], data[i]["currency"]) %}</td>
|
||||
{% } %}
|
||||
{% } %}
|
||||
{% } else { %}
|
||||
{% if(data[i][__("Customer")] || data[i][__("Supplier")]|| " ") { %}
|
||||
@@ -94,4 +232,4 @@
|
||||
{% } %}
|
||||
</tbody>
|
||||
</table>
|
||||
<p class="text-right text-muted">{{ __("Printed On") }}{%= dateutil.str_to_user(dateutil.get_datetime_as_string()) %}</p>
|
||||
<p class="text-right text-muted">{{ __("Printed On ") }}{%= dateutil.str_to_user(dateutil.get_datetime_as_string()) %}</p>
|
||||
@@ -14,7 +14,13 @@ frappe.query_reports["Accounts Receivable"] = {
|
||||
"fieldname":"customer",
|
||||
"label": __("Customer"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Customer"
|
||||
"options": "Customer",
|
||||
on_change: () => {
|
||||
var customer = frappe.query_report_filters_by_name.customer.get_value();
|
||||
frappe.db.get_value('Customer', customer, "tax_id", function(value) {
|
||||
frappe.query_report_filters_by_name.tax_id.set_value(value["tax_id"]);
|
||||
});
|
||||
}
|
||||
},
|
||||
{
|
||||
"fieldname":"customer_group",
|
||||
@@ -64,6 +70,17 @@ frappe.query_reports["Accounts Receivable"] = {
|
||||
"fieldtype": "Int",
|
||||
"default": "90",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname":"show_pdc_in_print",
|
||||
"label": __("Show PDC in Print"),
|
||||
"fieldtype": "Check",
|
||||
},
|
||||
{
|
||||
"fieldname":"tax_id",
|
||||
"label": __("Tax Id"),
|
||||
"fieldtype": "Data",
|
||||
"hidden": 1
|
||||
}
|
||||
],
|
||||
|
||||
|
||||
@@ -22,13 +22,35 @@ class ReceivablePayableReport(object):
|
||||
return columns, data, None, chart
|
||||
|
||||
def get_columns(self, party_naming_by, args):
|
||||
columns = [_("Posting Date") + ":Date:80", _(args.get("party_type")) + ":Link/" + args.get("party_type") + ":200"]
|
||||
columns = []
|
||||
columns.append({
|
||||
"label": _("Posting Date"),
|
||||
"fieldtype": "Date",
|
||||
"fieldname": "posting_date",
|
||||
"width": 90
|
||||
})
|
||||
|
||||
columns += [_(args.get("party_type")) + ":Link/" + args.get("party_type") + ":200"]
|
||||
|
||||
if party_naming_by == "Naming Series":
|
||||
columns += [args.get("party_type") + " Name::110"]
|
||||
|
||||
columns += [_("Voucher Type") + "::110", _("Voucher No") + ":Dynamic Link/"+_("Voucher Type")+":120",
|
||||
_("Due Date") + ":Date:80"]
|
||||
columns.append({
|
||||
"label": _("Voucher Type"),
|
||||
"fieldtype": "Data",
|
||||
"fieldname": "voucher_type",
|
||||
"width": 110
|
||||
})
|
||||
|
||||
columns.append({
|
||||
"label": _("Voucher No"),
|
||||
"fieldtype": "Dynamic Link",
|
||||
"fieldname": "voucher_no",
|
||||
"width": 110,
|
||||
"options": "voucher_type",
|
||||
})
|
||||
|
||||
columns += [_("Due Date") + ":Date:80"]
|
||||
|
||||
if args.get("party_type") == "Supplier":
|
||||
columns += [_("Bill No") + "::80", _("Bill Date") + ":Date:80"]
|
||||
@@ -72,6 +94,18 @@ class ReceivablePayableReport(object):
|
||||
"options": "Currency",
|
||||
"width": 100
|
||||
})
|
||||
|
||||
columns += [
|
||||
_("PDC/LC Date") + ":Date:110",
|
||||
_("PDC/LC Ref") + ":Data:110",
|
||||
_("PDC/LC Amount") + ":Currency/currency:130",
|
||||
_("Remaining Balance") + ":Currency/currency:130"
|
||||
]
|
||||
|
||||
if args.get('party_type') == 'Customer':
|
||||
columns += [_("Customer LPO") + ":Data:100"]
|
||||
columns += [_("Delivery Note") + ":Data:100"]
|
||||
|
||||
if args.get("party_type") == "Customer":
|
||||
columns += [
|
||||
_("Territory") + ":Link/Territory:80",
|
||||
@@ -89,7 +123,8 @@ class ReceivablePayableReport(object):
|
||||
currency_precision = get_currency_precision() or 2
|
||||
dr_or_cr = "debit" if args.get("party_type") == "Customer" else "credit"
|
||||
|
||||
voucher_details = self.get_voucher_details(args.get("party_type"))
|
||||
dn_details = get_dn_details(args.get("party_type"))
|
||||
voucher_details = self.get_voucher_details(args.get("party_type"), dn_details)
|
||||
|
||||
future_vouchers = self.get_entries_after(self.filters.report_date, args.get("party_type"))
|
||||
|
||||
@@ -101,6 +136,8 @@ class ReceivablePayableReport(object):
|
||||
return_entries = self.get_return_entries(args.get("party_type"))
|
||||
|
||||
data = []
|
||||
pdc_details = get_pdc_details(args.get("party_type"), self.filters.report_date)
|
||||
|
||||
for gle in self.get_entries_till(self.filters.report_date, args.get("party_type")):
|
||||
if self.is_receivable_or_payable(gle, dr_or_cr, future_vouchers):
|
||||
outstanding_amount, credit_note_amount = self.get_outstanding_amount(gle,
|
||||
@@ -144,6 +181,19 @@ class ReceivablePayableReport(object):
|
||||
else:
|
||||
row.append(company_currency)
|
||||
|
||||
pdc = pdc_details.get((gle.voucher_no, gle.party), {})
|
||||
|
||||
remaining_balance = outstanding_amount - flt(pdc.get("pdc_amount"))
|
||||
row += [pdc.get("pdc_date"), pdc.get("pdc_ref"),
|
||||
flt(pdc.get("pdc_amount")), remaining_balance]
|
||||
|
||||
if args.get('party_type') == 'Customer':
|
||||
# customer LPO
|
||||
row += [voucher_details.get(gle.voucher_no, {}).get("po_no")]
|
||||
|
||||
# Delivery Note
|
||||
row += [voucher_details.get(gle.voucher_no, {}).get("delivery_note")]
|
||||
|
||||
# customer territory / supplier type
|
||||
if args.get("party_type") == "Customer":
|
||||
row += [self.get_territory(gle.party), self.get_customer_group(gle.party)]
|
||||
@@ -225,12 +275,13 @@ class ReceivablePayableReport(object):
|
||||
|
||||
return self.party_map
|
||||
|
||||
def get_voucher_details(self, party_type):
|
||||
def get_voucher_details(self, party_type, dn_details):
|
||||
voucher_details = frappe._dict()
|
||||
|
||||
if party_type == "Customer":
|
||||
for si in frappe.db.sql("""select name, due_date
|
||||
for si in frappe.db.sql("""select name, due_date, po_no
|
||||
from `tabSales Invoice` where docstatus=1""", as_dict=1):
|
||||
si['delivery_note'] = dn_details.get(si.name)
|
||||
voucher_details.setdefault(si.name, si)
|
||||
|
||||
if party_type == "Supplier":
|
||||
@@ -347,3 +398,63 @@ def get_ageing_data(first_range, second_range, third_range, age_as_on, entry_dat
|
||||
outstanding_range[index] = outstanding_amount
|
||||
|
||||
return [age] + outstanding_range
|
||||
|
||||
def get_pdc_details(party_type, report_date):
|
||||
pdc_details = frappe._dict()
|
||||
|
||||
for pdc in frappe.db.sql("""
|
||||
select
|
||||
pref.reference_name as invoice_no, pent.party, pent.party_type,
|
||||
max(pent.reference_date) as pdc_date, sum(ifnull(pref.allocated_amount,0)) as pdc_amount,
|
||||
GROUP_CONCAT(pent.reference_no SEPARATOR ', ') as pdc_ref
|
||||
from
|
||||
`tabPayment Entry` as pent inner join `tabPayment Entry Reference` as pref
|
||||
on
|
||||
(pref.parent = pent.name)
|
||||
where
|
||||
pent.docstatus < 2 and pent.reference_date >= %s
|
||||
and pent.party_type = %s
|
||||
group by pent.party, pref.reference_name""", (report_date, party_type), as_dict=1):
|
||||
pdc_details.setdefault((pdc.invoice_no, pdc.party), pdc)
|
||||
|
||||
if scrub(party_type):
|
||||
amount_field = ("jea.debit_in_account_currency"
|
||||
if party_type == 'Supplier' else "jea.credit_in_account_currency")
|
||||
else:
|
||||
amount_field = "jea.debit + jea.credit"
|
||||
|
||||
for pdc in frappe.db.sql("""
|
||||
select
|
||||
jea.reference_name as invoice_no, jea.party, jea.party_type,
|
||||
max(je.cheque_date) as pdc_date, sum(ifnull({0},0)) as pdc_amount,
|
||||
GROUP_CONCAT(je.cheque_no SEPARATOR ', ') as pdc_ref
|
||||
from
|
||||
`tabJournal Entry` as je inner join `tabJournal Entry Account` as jea
|
||||
on
|
||||
(jea.parent = je.name)
|
||||
where
|
||||
je.docstatus < 2 and je.cheque_date >= %s
|
||||
and jea.party_type = %s
|
||||
group by jea.party, jea.reference_name""".format(amount_field), (report_date, party_type), as_dict=1):
|
||||
if (pdc.invoice_no, pdc.party) in pdc_details:
|
||||
pdc_details[(pdc.invoice_no, pdc.party)]["pdc_amount"] += pdc.pdc_amount
|
||||
else:
|
||||
pdc_details.setdefault((pdc.invoice_no, pdc.party), pdc)
|
||||
|
||||
return pdc_details
|
||||
|
||||
def get_dn_details(party_type):
|
||||
dn_details = frappe._dict()
|
||||
|
||||
if party_type == "Customer":
|
||||
for si in frappe.db.sql("""select parent, GROUP_CONCAT(delivery_note SEPARATOR ', ') as dn
|
||||
from `tabSales Invoice Item`
|
||||
where docstatus=1 and delivery_note is not null and delivery_note != '' group by parent
|
||||
Union
|
||||
select against_sales_invoice as parent, GROUP_CONCAT(parent SEPARATOR ', ') as dn
|
||||
from `tabDelivery Note Item`
|
||||
where docstatus=1 and against_sales_invoice is not null
|
||||
and against_sales_invoice != '' group by against_sales_invoice""", as_dict=1):
|
||||
dn_details.setdefault(si.parent, si.dn)
|
||||
|
||||
return dn_details
|
||||
|
||||
@@ -23,10 +23,10 @@ frappe.query_reports["Accounts Receivable Summary"] = {
|
||||
"options": "Customer Group"
|
||||
},
|
||||
{
|
||||
"fieldname":"credit_days_based_on",
|
||||
"label": __("Credit Days Based On"),
|
||||
"fieldtype": "Select",
|
||||
"options": "\nFixed Days\nLast Day of the Next Month"
|
||||
"fieldname":"payment_terms_template",
|
||||
"label": __("Payment Terms Template"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Payment Terms Template"
|
||||
},
|
||||
{
|
||||
"fieldtype": "Break",
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe import _
|
||||
from frappe.utils import flt
|
||||
from erpnext.accounts.report.accounts_receivable.accounts_receivable import ReceivablePayableReport
|
||||
|
||||
class AccountsReceivableSummary(ReceivablePayableReport):
|
||||
@@ -88,7 +89,8 @@ class AccountsReceivableSummary(ReceivablePayableReport):
|
||||
})
|
||||
)
|
||||
for k in party_total[d.party].keys():
|
||||
party_total[d.party][k] += d.get(k, 0)
|
||||
if k != "currency":
|
||||
party_total[d.party][k] += flt(d.get(k, 0))
|
||||
|
||||
party_total[d.party].currency = d.currency
|
||||
|
||||
|
||||
@@ -28,5 +28,10 @@ frappe.query_reports["Bank Reconciliation Statement"] = {
|
||||
"default": frappe.datetime.get_today(),
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname":"include_pos_transactions",
|
||||
"label": __("Include POS Transactions"),
|
||||
"fieldtype": "Check"
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -138,7 +138,23 @@ def get_entries(filters):
|
||||
and ifnull(clearance_date, '4000-01-01') > %(report_date)s
|
||||
""", filters, as_dict=1)
|
||||
|
||||
return sorted(list(payment_entries)+list(journal_entries),
|
||||
pos_entries = []
|
||||
if filters.include_pos_transactions:
|
||||
pos_entries = frappe.db.sql("""
|
||||
select
|
||||
"Sales Invoice Payment" as payment_document, sip.name as payment_entry, sip.amount as debit,
|
||||
si.posting_date, si.debit_to as against_account, sip.clearance_date,
|
||||
account.account_currency, 0 as credit
|
||||
from `tabSales Invoice Payment` sip, `tabSales Invoice` si, `tabAccount` account
|
||||
where
|
||||
sip.account=%(account)s and si.docstatus=1 and sip.parent = si.name
|
||||
and account.name = sip.account and si.posting_date <= %(report_date)s and
|
||||
ifnull(sip.clearance_date, '4000-01-01') > %(report_date)s
|
||||
order by
|
||||
si.posting_date ASC, si.name DESC
|
||||
""", filters, as_dict=1)
|
||||
|
||||
return sorted(list(payment_entries)+list(journal_entries+list(pos_entries)),
|
||||
key=lambda k: k['posting_date'] or getdate(nowdate()))
|
||||
|
||||
def get_amounts_not_reflected_in_system(filters):
|
||||
|
||||
@@ -8,6 +8,13 @@
|
||||
{%= filters.account %}
|
||||
{% } %}
|
||||
</h4>
|
||||
|
||||
<h6 class="text-center">
|
||||
{% if (filters.tax_id) { %}
|
||||
{%= __("Tax Id: ")%} {%= filters.tax_id %}
|
||||
{% } %}
|
||||
</h6>
|
||||
|
||||
<h5 class="text-center">
|
||||
{%= dateutil.str_to_user(filters.from_date) %}
|
||||
{%= __("to") %}
|
||||
@@ -17,38 +24,70 @@
|
||||
<table class="table table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 15%">{%= __("Date") %}</th>
|
||||
<th style="width: 12%">{%= __("Date") %}</th>
|
||||
<th style="width: 15%">{%= __("Ref") %}</th>
|
||||
<th style="width: 40%">{%= __("Party") %}</th>
|
||||
<th style="width: 25%">{%= __("Party") %}</th>
|
||||
<th style="width: 15%">{%= __("Debit") %}</th>
|
||||
<th style="width: 15%">{%= __("Credit") %}</th>
|
||||
<th style="width: 18%">{%= __("Balance (Dr - Cr)") %}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for(var i=0, l=data.length; i<l; i++) { %}
|
||||
<tr>
|
||||
{% if(data[i][__("Posting Date")]) { %}
|
||||
<td>{%= dateutil.str_to_user(data[i][__("Posting Date")]) %}</td>
|
||||
<td>{%= data[i][__("Voucher Type")] %}
|
||||
<br>{%= data[i][__("Voucher No")] %}</td>
|
||||
{% if(data[i].posting_date) { %}
|
||||
<td>{%= dateutil.str_to_user(data[i].posting_date) %}</td>
|
||||
<td>{%= data[i].voucher_type %}
|
||||
<br>{%= data[i].voucher_no %}</td>
|
||||
<td>
|
||||
{% if(!(filters.party || filters.account)) { %}
|
||||
{%= data[i][__("Party")] || data[i][__("Account")] %}
|
||||
{%= data[i].party || data[i].account %}
|
||||
<br>
|
||||
{% } %}
|
||||
|
||||
{{ __("Against") }}: {%= data[i][__("Against Account")] %}
|
||||
<br>{%= __("Remarks") %}: {%= data[i][__("Remarks")] %}</td>
|
||||
<td style="text-align: right">{%= format_currency(data[i][__("Debit")]) %}</td>
|
||||
<td style="text-align: right">{%= format_currency(data[i][__("Credit")]) %}</td>
|
||||
{{ __("Against") }}: {%= data[i].against %}
|
||||
<br>{%= __("Remarks") %}: {%= data[i].remarks %}
|
||||
{% if(data[i].bill_no) { %}
|
||||
<br>{%= __("Supplier Invoice No") %}: {%= data[i].bill_no %}
|
||||
{% } %}
|
||||
</td>
|
||||
{% if(filters.print_in_account_currency) { %}
|
||||
<td style="text-align: right">
|
||||
{%= format_currency(data[i].debit_in_account_currency, data[i].account_currency) %}
|
||||
</td>
|
||||
<td style="text-align: right">
|
||||
{%= format_currency(data[i].credit_in_account_currency, data[i].account_currency) %}
|
||||
</td>
|
||||
{% } else { %}
|
||||
<td style="text-align: right">
|
||||
{%= format_currency(data[i].debit) %}</td>
|
||||
<td style="text-align: right">
|
||||
{%= format_currency(data[i].credit) %}</td>
|
||||
{% } %}
|
||||
{% } else { %}
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td><b>{%= frappe.format(data[i][__("Account")], {fieldtype: "Link"}) || " " %}</b></td>
|
||||
<td><b>{%= frappe.format(data[i].account, {fieldtype: "Link"}) || " " %}</b></td>
|
||||
{% if(filters.print_in_account_currency) { %}
|
||||
<td style="text-align: right">
|
||||
{%= data[i].account && format_currency(data[i].debit_in_account_currency, data[i].account_currency) %}</td>
|
||||
<td style="text-align: right">
|
||||
{%= data[i].account && format_currency(data[i].credit_in_account_currency, data[i].account_currency) %}</td>
|
||||
{% } else { %}
|
||||
<td style="text-align: right">
|
||||
{%= data[i].account && format_currency(data[i].debit) %}
|
||||
</td>
|
||||
<td style="text-align: right">
|
||||
{%= data[i].account && format_currency(data[i].credit) %}
|
||||
</td>
|
||||
{% } %}
|
||||
{% } %}
|
||||
{% if(filters.print_in_account_currency) { %}
|
||||
<td style="text-align: right">
|
||||
{%= data[i][__("Account")] && format_currency(data[i][__("Debit")]) %}</td>
|
||||
<td style="text-align: right">
|
||||
{%= data[i][__("Account")] && format_currency(data[i][__("Credit")]) %}</td>
|
||||
{%= format_currency(data[i].balance_in_account_currency, data[i].account_currency) %}
|
||||
</td>
|
||||
{% } else { %}
|
||||
<td style="text-align: right">{%= format_currency(data[i].balance) %}</td>
|
||||
{% } %}
|
||||
</tr>
|
||||
{% } %}
|
||||
|
||||
@@ -61,7 +61,10 @@ frappe.query_reports["General Ledger"] = {
|
||||
"label": __("Party Type"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Party Type",
|
||||
"default": ""
|
||||
"default": "",
|
||||
on_change: function() {
|
||||
frappe.query_report_filters_by_name.party.set_value("");
|
||||
}
|
||||
},
|
||||
{
|
||||
"fieldname":"party",
|
||||
@@ -82,11 +85,16 @@ frappe.query_reports["General Ledger"] = {
|
||||
frappe.query_report_filters_by_name.party_name.set_value("");
|
||||
return;
|
||||
}
|
||||
|
||||
var fieldname = frappe.scrub(party_type) + "_name";
|
||||
var fieldname = erpnext.utils.get_party_name(party_type) || "name";
|
||||
frappe.db.get_value(party_type, party, fieldname, function(value) {
|
||||
frappe.query_report_filters_by_name.party_name.set_value(value[fieldname]);
|
||||
});
|
||||
|
||||
if (party_type === "Customer" || party_type === "Supplier") {
|
||||
frappe.db.get_value(party_type, party, "tax_id", function(value) {
|
||||
frappe.query_report_filters_by_name.tax_id.set_value(value["tax_id"]);
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -95,6 +103,12 @@ frappe.query_reports["General Ledger"] = {
|
||||
"fieldtype": "Data",
|
||||
"hidden": 1
|
||||
},
|
||||
{
|
||||
"fieldname":"tax_id",
|
||||
"label": __("Tax Id"),
|
||||
"fieldtype": "Data",
|
||||
"hidden": 1
|
||||
},
|
||||
{
|
||||
"fieldname":"group_by_voucher",
|
||||
"label": __("Group by Voucher"),
|
||||
@@ -105,6 +119,11 @@ frappe.query_reports["General Ledger"] = {
|
||||
"fieldname":"group_by_account",
|
||||
"label": __("Group by Account"),
|
||||
"fieldtype": "Check",
|
||||
},
|
||||
{
|
||||
"fieldname":"print_in_account_currency",
|
||||
"label": __("Print in Account Currency"),
|
||||
"fieldtype": "Check",
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -3,12 +3,17 @@
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe.utils import getdate, cstr, flt
|
||||
from frappe.utils import getdate, cstr, flt, fmt_money
|
||||
from frappe import _, _dict
|
||||
from erpnext.accounts.utils import get_account_currency
|
||||
|
||||
def execute(filters=None):
|
||||
account_details = {}
|
||||
|
||||
if filters and filters.get('print_in_account_currency') and \
|
||||
not filters.get('account'):
|
||||
frappe.throw(_("Select an account to print in account currency"))
|
||||
|
||||
for acc in frappe.db.sql("""select name, is_group from tabAccount""", as_dict=1):
|
||||
account_details.setdefault(acc.name, acc)
|
||||
|
||||
@@ -66,7 +71,7 @@ def set_account_currency(filters):
|
||||
if gle_currency:
|
||||
account_currency = gle_currency
|
||||
else:
|
||||
account_currency = None if filters.party_type == "Employee" else \
|
||||
account_currency = None if filters.party_type in ["Employee", "Student", "Shareholder"] else \
|
||||
frappe.db.get_value(filters.party_type, filters.party, "default_currency")
|
||||
|
||||
filters["account_currency"] = account_currency or filters.company_currency
|
||||
@@ -76,28 +81,6 @@ def set_account_currency(filters):
|
||||
|
||||
return filters
|
||||
|
||||
def get_columns(filters):
|
||||
columns = [
|
||||
_("Posting Date") + ":Date:90", _("Account") + ":Link/Account:200",
|
||||
_("Debit") + ":Float:100", _("Credit") + ":Float:100"
|
||||
]
|
||||
|
||||
if filters.get("show_in_account_currency"):
|
||||
columns += [
|
||||
_("Debit") + " (" + filters.account_currency + ")" + ":Float:100",
|
||||
_("Credit") + " (" + filters.account_currency + ")" + ":Float:100"
|
||||
]
|
||||
|
||||
columns += [
|
||||
_("Voucher Type") + "::120", _("Voucher No") + ":Dynamic Link/"+_("Voucher Type")+":160",
|
||||
_("Against Account") + "::120", _("Party Type") + "::80", _("Party") + "::150",
|
||||
_("Project") + ":Link/Project:100", _("Cost Center") + ":Link/Cost Center:100",
|
||||
_("Against Voucher Type") + "::120", _("Against Voucher") + ":Dynamic Link/"+_("Against Voucher Type")+":160",
|
||||
_("Remarks") + "::400"
|
||||
]
|
||||
|
||||
return columns
|
||||
|
||||
def get_result(filters, account_details):
|
||||
gl_entries = get_gl_entries(filters)
|
||||
|
||||
@@ -193,24 +176,6 @@ def get_data_with_opening_closing(filters, account_details, gl_entries):
|
||||
# closing
|
||||
data.append(totals.closing)
|
||||
|
||||
#total closing
|
||||
total_closing = totals.total_closing
|
||||
total_debit = totals.closing.get('debit', 0)
|
||||
total_credit = totals.closing.get('credit', 0)
|
||||
debit_in_account_currency = totals.closing.get('debit_in_account_currency', 0)
|
||||
credit_in_account_currency = totals.closing.get('credit_in_account_currency', 0)
|
||||
|
||||
total_amount = total_debit - total_credit
|
||||
|
||||
if total_amount > 0:
|
||||
total_closing['debit'] = total_amount
|
||||
total_closing['debit_in_account_currency'] = debit_in_account_currency - credit_in_account_currency
|
||||
else:
|
||||
total_closing['credit'] = abs(total_amount)
|
||||
total_closing['credit_in_account_currency'] = abs(debit_in_account_currency - credit_in_account_currency)
|
||||
|
||||
data.append(totals.total_closing)
|
||||
|
||||
return data
|
||||
|
||||
def get_totals_dict():
|
||||
@@ -225,8 +190,7 @@ def get_totals_dict():
|
||||
return _dict(
|
||||
opening = _get_debit_credit_dict(_('Opening')),
|
||||
total = _get_debit_credit_dict(_('Total')),
|
||||
closing = _get_debit_credit_dict(_('Closing (Opening + Total)')),
|
||||
total_closing = _get_debit_credit_dict(_('Closing Balance (Dr - Cr)'))
|
||||
closing = _get_debit_credit_dict(_('Closing (Opening + Total)'))
|
||||
)
|
||||
|
||||
def initialize_gle_map(gl_entries):
|
||||
@@ -270,17 +234,163 @@ def get_accountwise_gle(filters, gl_entries, gle_map):
|
||||
return totals, entries
|
||||
|
||||
def get_result_as_list(data, filters):
|
||||
result = []
|
||||
balance, balance_in_account_currency = 0, 0
|
||||
inv_details = get_supplier_invoice_details()
|
||||
|
||||
for d in data:
|
||||
row = [d.get("posting_date"), d.get("account"), d.get("debit"), d.get("credit")]
|
||||
if not d.get('posting_date'):
|
||||
balance, balance_in_account_currency = 0, 0
|
||||
|
||||
balance = get_balance(d, balance, 'debit', 'credit')
|
||||
d['balance'] = balance
|
||||
|
||||
if filters.get("show_in_account_currency"):
|
||||
row += [d.get("debit_in_account_currency"), d.get("credit_in_account_currency")]
|
||||
balance_in_account_currency = get_balance(d, balance_in_account_currency,
|
||||
'debit_in_account_currency', 'credit_in_account_currency')
|
||||
d['balance_in_account_currency'] = balance_in_account_currency
|
||||
else:
|
||||
d['debit_in_account_currency'] = d.get('debit', 0)
|
||||
d['credit_in_account_currency'] = d.get('credit', 0)
|
||||
d['balance_in_account_currency'] = d.get('balance')
|
||||
|
||||
row += [d.get("voucher_type"), d.get("voucher_no"), d.get("against"),
|
||||
d.get("party_type"), d.get("party"), d.get("project"), d.get("cost_center"), d.get("against_voucher_type"), d.get("against_voucher"), d.get("remarks")
|
||||
]
|
||||
d['account_currency'] = filters.account_currency
|
||||
d['bill_no'] = inv_details.get(d.get('against_voucher'), '')
|
||||
|
||||
result.append(row)
|
||||
return data
|
||||
|
||||
return result
|
||||
def get_supplier_invoice_details():
|
||||
inv_details = {}
|
||||
for d in frappe.db.sql(""" select name, bill_no from `tabPurchase Invoice`
|
||||
where docstatus = 1 and bill_no is not null and bill_no != '' """, as_dict=1):
|
||||
inv_details[d.name] = d.bill_no
|
||||
|
||||
return inv_details
|
||||
|
||||
def get_balance(row, balance, debit_field, credit_field):
|
||||
balance += (row.get(debit_field, 0) - row.get(credit_field, 0))
|
||||
|
||||
return balance
|
||||
|
||||
def get_columns(filters):
|
||||
columns = [
|
||||
{
|
||||
"label": _("Posting Date"),
|
||||
"fieldname": "posting_date",
|
||||
"fieldtype": "Date",
|
||||
"width": 90
|
||||
},
|
||||
{
|
||||
"label": _("Account"),
|
||||
"fieldname": "account",
|
||||
"fieldtype": "Link",
|
||||
"options": "Account",
|
||||
"width": 180
|
||||
},
|
||||
{
|
||||
"label": _("Debit"),
|
||||
"fieldname": "debit",
|
||||
"fieldtype": "Float",
|
||||
"width": 100
|
||||
},
|
||||
{
|
||||
"label": _("Credit"),
|
||||
"fieldname": "credit",
|
||||
"fieldtype": "Float",
|
||||
"width": 100
|
||||
},
|
||||
{
|
||||
"label": _("Balance (Dr - Cr)"),
|
||||
"fieldname": "balance",
|
||||
"fieldtype": "Float",
|
||||
"width": 130
|
||||
}
|
||||
]
|
||||
|
||||
if filters.get("show_in_account_currency"):
|
||||
columns.extend([
|
||||
{
|
||||
"label": _("Debit") + " (" + filters.account_currency + ")",
|
||||
"fieldname": "debit_in_account_currency",
|
||||
"fieldtype": "Float",
|
||||
"width": 100
|
||||
},
|
||||
{
|
||||
"label": _("Credit") + " (" + filters.account_currency + ")",
|
||||
"fieldname": "credit_in_account_currency",
|
||||
"fieldtype": "Float",
|
||||
"width": 100
|
||||
},
|
||||
{
|
||||
"label": _("Balance") + " (" + filters.account_currency + ")",
|
||||
"fieldname": "balance_in_account_currency",
|
||||
"fieldtype": "Data",
|
||||
"width": 100
|
||||
}
|
||||
])
|
||||
|
||||
columns.extend([
|
||||
{
|
||||
"label": _("Voucher Type"),
|
||||
"fieldname": "voucher_type",
|
||||
"width": 120
|
||||
},
|
||||
{
|
||||
"label": _("Voucher No"),
|
||||
"fieldname": "voucher_no",
|
||||
"fieldtype": "Dynamic Link",
|
||||
"options": "voucher_type",
|
||||
"width": 180
|
||||
},
|
||||
{
|
||||
"label": _("Against Account"),
|
||||
"fieldname": "against",
|
||||
"width": 120
|
||||
},
|
||||
{
|
||||
"label": _("Party Type"),
|
||||
"fieldname": "party_type",
|
||||
"width": 100
|
||||
},
|
||||
{
|
||||
"label": _("Party"),
|
||||
"fieldname": "party",
|
||||
"width": 100
|
||||
},
|
||||
{
|
||||
"label": _("Project"),
|
||||
"options": "Project",
|
||||
"fieldname": "project",
|
||||
"width": 100
|
||||
},
|
||||
{
|
||||
"label": _("Cost Center"),
|
||||
"options": "Cost Center",
|
||||
"fieldname": "cost_center",
|
||||
"width": 100
|
||||
},
|
||||
{
|
||||
"label": _("Against Voucher Type"),
|
||||
"fieldname": "against_voucher_type",
|
||||
"width": 100
|
||||
},
|
||||
{
|
||||
"label": _("Against Voucher"),
|
||||
"fieldname": "against_voucher",
|
||||
"fieldtype": "Dynamic Link",
|
||||
"options": "against_voucher_type",
|
||||
"width": 100
|
||||
},
|
||||
{
|
||||
"label": _("Supplier Invoice No"),
|
||||
"fieldname": "bill_no",
|
||||
"fieldtype": "Data",
|
||||
"width": 100
|
||||
},
|
||||
{
|
||||
"label": _("Remarks"),
|
||||
"fieldname": "remarks",
|
||||
"width": 400
|
||||
}
|
||||
])
|
||||
|
||||
return columns
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
// License: GNU General Public License v3. See license.txt
|
||||
|
||||
frappe.query_reports["Item-wise Sales Register"] = frappe.query_reports["Sales Register"] = {
|
||||
frappe.query_reports["Item-wise Sales Register"] = {
|
||||
"filters": [
|
||||
{
|
||||
"fieldname":"from_date",
|
||||
|
||||
@@ -50,10 +50,12 @@ def _execute(filters=None, additional_table_columns=None, additional_query_colum
|
||||
row += [
|
||||
d.customer_group, d.debit_to, ", ".join(mode_of_payments.get(d.parent, [])),
|
||||
d.territory, d.project, d.company, d.sales_order,
|
||||
delivery_note, d.income_account, d.cost_center, d.stock_qty, d.stock_uom,
|
||||
d.base_net_rate, d.base_net_amount
|
||||
delivery_note, d.income_account, d.cost_center, d.stock_qty, d.stock_uom
|
||||
]
|
||||
|
||||
row += [d.base_net_rate/d.stock_qty, d.base_net_amount] \
|
||||
if d.stock_uom != d.uom else [d.base_net_rate, d.base_net_amount]
|
||||
|
||||
total_tax = 0
|
||||
for tax in tax_columns:
|
||||
item_tax = itemised_tax.get(d.name, {}).get(tax, {})
|
||||
@@ -103,7 +105,7 @@ def get_conditions(filters):
|
||||
|
||||
if filters.get("mode_of_payment"):
|
||||
conditions += """ and exists(select name from `tabSales Invoice Payment`
|
||||
where parent=si.name
|
||||
where parent=`tabSales Invoice`.name
|
||||
and ifnull(`tabSales Invoice Payment`.mode_of_payment, '') = %(mode_of_payment)s)"""
|
||||
|
||||
return conditions
|
||||
@@ -131,7 +133,7 @@ def get_items(filters, additional_query_columns):
|
||||
`tabSales Invoice Item`.stock_uom, `tabSales Invoice Item`.base_net_rate,
|
||||
`tabSales Invoice Item`.base_net_amount, `tabSales Invoice`.customer_name,
|
||||
`tabSales Invoice`.customer_group, `tabSales Invoice Item`.so_detail,
|
||||
`tabSales Invoice`.update_stock {0}
|
||||
`tabSales Invoice`.update_stock, `tabSales Invoice Item`.uom {0}
|
||||
from `tabSales Invoice`, `tabSales Invoice Item`
|
||||
where `tabSales Invoice`.name = `tabSales Invoice Item`.parent
|
||||
and `tabSales Invoice`.docstatus = 1 %s %s
|
||||
@@ -168,11 +170,11 @@ def get_tax_accounts(item_list, columns, company_currency,
|
||||
|
||||
for d in item_list:
|
||||
invoice_item_row.setdefault(d.parent, []).append(d)
|
||||
item_row_map.setdefault(d.parent, {}).setdefault(d.item_code, []).append(d)
|
||||
item_row_map.setdefault(d.parent, {}).setdefault(d.item_code or d.item_name, []).append(d)
|
||||
|
||||
conditions = ""
|
||||
if doctype == "Purchase Invoice":
|
||||
conditions = " and category in ('Total', 'Valuation and Total')"
|
||||
conditions = " and category in ('Total', 'Valuation and Total') and base_tax_amount_after_discount_amount != 0"
|
||||
|
||||
tax_details = frappe.db.sql("""
|
||||
select
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"add_total_row": 0,
|
||||
"add_total_row": 1,
|
||||
"apply_user_permissions": 1,
|
||||
"creation": "2013-06-13 18:46:55",
|
||||
"disabled": 0,
|
||||
@@ -7,7 +7,7 @@
|
||||
"doctype": "Report",
|
||||
"idx": 3,
|
||||
"is_standard": "Yes",
|
||||
"modified": "2017-02-24 20:16:25.027061",
|
||||
"modified": "2018-02-21 01:28:31.261299",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Purchase Invoice Trends",
|
||||
|
||||
@@ -43,7 +43,7 @@ def _execute(filters=None, additional_table_columns=None, additional_query_colum
|
||||
|
||||
row += [
|
||||
supplier_details.get(inv.supplier), # supplier_type
|
||||
inv.credit_to, inv.mode_of_payment, ", ".join(project),
|
||||
inv.tax_id, inv.credit_to, inv.mode_of_payment, ", ".join(project),
|
||||
inv.bill_no, inv.bill_date, inv.remarks,
|
||||
", ".join(purchase_order), ", ".join(purchase_receipt), company_currency
|
||||
]
|
||||
@@ -83,7 +83,7 @@ def get_columns(invoice_list, additional_table_columns):
|
||||
columns += additional_table_columns
|
||||
|
||||
columns += [
|
||||
_("Supplier Type") + ":Link/Supplier Type:120", _("Payable Account") + ":Link/Account:120",
|
||||
_("Supplier Type") + ":Link/Supplier Type:120", _("Tax Id") + "::80", _("Payable Account") + ":Link/Account:120",
|
||||
_("Mode of Payment") + ":Link/Mode of Payment:80", _("Project") + ":Link/Project:80",
|
||||
_("Bill No") + "::120", _("Bill Date") + ":Date:80", _("Remarks") + "::150",
|
||||
_("Purchase Order") + ":Link/Purchase Order:100",
|
||||
@@ -143,7 +143,7 @@ def get_invoices(filters, additional_query_columns):
|
||||
conditions = get_conditions(filters)
|
||||
return frappe.db.sql("""
|
||||
select
|
||||
name, posting_date, credit_to, supplier, supplier_name, bill_no, bill_date,
|
||||
name, posting_date, credit_to, supplier, supplier_name, tax_id, bill_no, bill_date,
|
||||
remarks, base_net_total, base_grand_total, outstanding_amount,
|
||||
mode_of_payment {0}
|
||||
from `tabPurchase Invoice`
|
||||
@@ -172,6 +172,7 @@ def get_invoice_tax_map(invoice_list, invoice_expense_map, expense_accounts):
|
||||
else sum(base_tax_amount_after_discount_amount) * -1 end as tax_amount
|
||||
from `tabPurchase Taxes and Charges`
|
||||
where parent in (%s) and category in ('Total', 'Valuation and Total')
|
||||
and base_tax_amount_after_discount_amount != 0
|
||||
group by parent, account_head, add_deduct_tax
|
||||
""" % ', '.join(['%s']*len(invoice_list)), tuple([inv.name for inv in invoice_list]), as_dict=1)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"add_total_row": 0,
|
||||
"add_total_row": 1,
|
||||
"apply_user_permissions": 1,
|
||||
"creation": "2013-06-13 18:44:21",
|
||||
"disabled": 0,
|
||||
@@ -7,7 +7,7 @@
|
||||
"doctype": "Report",
|
||||
"idx": 3,
|
||||
"is_standard": "Yes",
|
||||
"modified": "2017-02-24 20:15:12.885723",
|
||||
"modified": "2018-02-21 01:28:03.622485",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Sales Invoice Trends",
|
||||
|
||||
@@ -33,8 +33,13 @@ frappe.query_reports["Sales Payment Summary"] = {
|
||||
},
|
||||
{
|
||||
"fieldname":"is_pos",
|
||||
"label": __("POS?"),
|
||||
"label": __("Show only POS"),
|
||||
"fieldtype": "Check"
|
||||
}
|
||||
},
|
||||
{
|
||||
"fieldname":"payment_detail",
|
||||
"label": __("Show Payment Details"),
|
||||
"fieldtype": "Check"
|
||||
},
|
||||
]
|
||||
};
|
||||
@@ -14,30 +14,46 @@ def execute(filters=None):
|
||||
def get_columns():
|
||||
return [
|
||||
_("Date") + ":Date:80",
|
||||
_("Owner") + "::150",
|
||||
_("Payment Mode") + "::140",
|
||||
_("Owner") + ":Data:200",
|
||||
_("Payment Mode") + ":Data:240",
|
||||
_("Sales and Returns") + ":Currency/currency:120",
|
||||
_("Taxes") + ":Currency/currency:120",
|
||||
_("Payments") + ":Currency/currency:120",
|
||||
_("Outstanding Amount") + ":Currency/currency:150",
|
||||
_("Payments") + ":Currency/currency:120"
|
||||
]
|
||||
|
||||
def get_sales_payment_data(filters, columns):
|
||||
sales_invoice_data = get_sales_invoice_data(filters)
|
||||
data = []
|
||||
show_payment_detail = False
|
||||
|
||||
sales_invoice_data = get_sales_invoice_data(filters)
|
||||
mode_of_payments = get_mode_of_payments(filters)
|
||||
mode_of_payment_details = get_mode_of_payment_details(filters)
|
||||
|
||||
if filters.get("payment_detail"):
|
||||
show_payment_detail = True
|
||||
else:
|
||||
show_payment_detail = False
|
||||
|
||||
for inv in sales_invoice_data:
|
||||
mode_of_payment = inv["owner"]+cstr(inv["posting_date"])
|
||||
row = [inv.posting_date, inv.owner,", ".join(mode_of_payments.get(mode_of_payment, [])),
|
||||
inv.net_total,
|
||||
inv.total_taxes, (inv.net_total + inv.total_taxes - inv.outstanding_amount),
|
||||
inv.outstanding_amount]
|
||||
data.append(row)
|
||||
owner_posting_date = inv["owner"]+cstr(inv["posting_date"])
|
||||
if show_payment_detail:
|
||||
row = [inv.posting_date, inv.owner," ",inv.net_total,inv.total_taxes, 0]
|
||||
data.append(row)
|
||||
for mop_detail in mode_of_payment_details.get(owner_posting_date,[]):
|
||||
row = [inv.posting_date, inv.owner,mop_detail[0],0,0,mop_detail[1],0]
|
||||
data.append(row)
|
||||
else:
|
||||
total_payment = 0
|
||||
for mop_detail in mode_of_payment_details.get(owner_posting_date,[]):
|
||||
total_payment = total_payment + mop_detail[1]
|
||||
row = [inv.posting_date, inv.owner,", ".join(mode_of_payments.get(owner_posting_date, [])),
|
||||
inv.net_total,inv.total_taxes,total_payment]
|
||||
data.append(row)
|
||||
return data
|
||||
|
||||
def get_conditions(filters):
|
||||
conditions = ""
|
||||
if filters.get("from_date"): conditions += "a.posting_date >= %(from_date)s"
|
||||
conditions = "1=1"
|
||||
if filters.get("from_date"): conditions += " and a.posting_date >= %(from_date)s"
|
||||
if filters.get("to_date"): conditions += " and a.posting_date <= %(to_date)s"
|
||||
if filters.get("company"): conditions += " and a.company=%(company)s"
|
||||
if filters.get("customer"): conditions += " and a.customer = %(customer)s"
|
||||
@@ -73,9 +89,17 @@ def get_mode_of_payments(filters):
|
||||
union
|
||||
select a.owner,a.posting_date, ifnull(b.mode_of_payment, '') as mode_of_payment
|
||||
from `tabSales Invoice` a, `tabPayment Entry` b,`tabPayment Entry Reference` c
|
||||
where a.name = c.reference_name
|
||||
where a.name = c.reference_name
|
||||
and b.name = c.parent
|
||||
and a.name in ({invoice_list_names})
|
||||
union
|
||||
select a.owner, a.posting_date,
|
||||
ifnull(a.voucher_type,'') as mode_of_payment
|
||||
from `tabJournal Entry` a, `tabJournal Entry Account` b
|
||||
where a.name = b.parent
|
||||
and a.docstatus = 1
|
||||
and b.reference_type = "Sales Invoice"
|
||||
and b.reference_name in ({invoice_list_names})
|
||||
""".format(invoice_list_names=invoice_list_names), as_dict=1)
|
||||
for d in inv_mop:
|
||||
mode_of_payments.setdefault(d["owner"]+cstr(d["posting_date"]), []).append(d.mode_of_payment)
|
||||
@@ -86,4 +110,37 @@ def get_invoices(filters):
|
||||
return frappe.db.sql("""select a.name
|
||||
from `tabSales Invoice` a
|
||||
where a.docstatus = 1 and {conditions}""".format(conditions=conditions),
|
||||
filters, as_dict=1)
|
||||
filters, as_dict=1)
|
||||
|
||||
def get_mode_of_payment_details(filters):
|
||||
mode_of_payment_details = {}
|
||||
invoice_list = get_invoices(filters)
|
||||
invoice_list_names = ",".join(['"' + invoice['name'] + '"' for invoice in invoice_list])
|
||||
if invoice_list:
|
||||
inv_mop_detail = frappe.db.sql("""select a.owner, a.posting_date,
|
||||
ifnull(b.mode_of_payment, '') as mode_of_payment, sum(b.base_amount) as paid_amount
|
||||
from `tabSales Invoice` a, `tabSales Invoice Payment` b
|
||||
where a.name = b.parent
|
||||
and a.name in ({invoice_list_names})
|
||||
group by a.owner, a.posting_date, mode_of_payment
|
||||
union
|
||||
select a.owner,a.posting_date,
|
||||
ifnull(b.mode_of_payment, '') as mode_of_payment, sum(b.base_paid_amount) as paid_amount
|
||||
from `tabSales Invoice` a, `tabPayment Entry` b,`tabPayment Entry Reference` c
|
||||
where a.name = c.reference_name
|
||||
and b.name = c.parent
|
||||
and a.name in ({invoice_list_names})
|
||||
group by a.owner, a.posting_date, mode_of_payment
|
||||
union
|
||||
select a.owner, a.posting_date,
|
||||
ifnull(a.voucher_type,'') as mode_of_payment, sum(b.credit)
|
||||
from `tabJournal Entry` a, `tabJournal Entry Account` b
|
||||
where a.name = b.parent
|
||||
and a.docstatus = 1
|
||||
and b.reference_type = "Sales Invoice"
|
||||
and b.reference_name in ({invoice_list_names})
|
||||
group by a.owner, a.posting_date, mode_of_payment
|
||||
""".format(invoice_list_names=invoice_list_names), as_dict=1)
|
||||
for d in inv_mop_detail:
|
||||
mode_of_payment_details.setdefault(d["owner"]+cstr(d["posting_date"]), []).append((d.mode_of_payment,d.paid_amount))
|
||||
return mode_of_payment_details
|
||||
@@ -25,8 +25,6 @@ def _execute(filters, additional_table_columns=None, additional_query_columns=No
|
||||
#Cost Center & Warehouse Map
|
||||
invoice_cc_wh_map = get_invoice_cc_wh_map(invoice_list)
|
||||
invoice_so_dn_map = get_invoice_so_dn_map(invoice_list)
|
||||
customers = list(set([inv.customer for inv in invoice_list]))
|
||||
customer_map = get_customer_details(customers)
|
||||
company_currency = frappe.db.get_value("Company", filters.get("company"), "default_currency")
|
||||
mode_of_payments = get_mode_of_payments([inv.name for inv in invoice_list])
|
||||
|
||||
@@ -38,7 +36,6 @@ def _execute(filters, additional_table_columns=None, additional_query_columns=No
|
||||
cost_center = list(set(invoice_cc_wh_map.get(inv.name, {}).get("cost_center", [])))
|
||||
warehouse = list(set(invoice_cc_wh_map.get(inv.name, {}).get("warehouse", [])))
|
||||
|
||||
customer_details = customer_map.get(inv.customer, {})
|
||||
row = [
|
||||
inv.name, inv.posting_date, inv.customer, inv.customer_name
|
||||
]
|
||||
@@ -48,8 +45,9 @@ def _execute(filters, additional_table_columns=None, additional_query_columns=No
|
||||
row.append(inv.get(col))
|
||||
|
||||
row +=[
|
||||
customer_details.get("customer_group"),
|
||||
customer_details.get("territory"),
|
||||
inv.get("customer_group"),
|
||||
inv.get("territory"),
|
||||
inv.get("tax_id"),
|
||||
inv.debit_to, ", ".join(mode_of_payments.get(inv.name, [])),
|
||||
inv.project, inv.owner, inv.remarks,
|
||||
", ".join(sales_order), ", ".join(delivery_note),", ".join(cost_center),
|
||||
@@ -92,7 +90,7 @@ def get_columns(invoice_list, additional_table_columns):
|
||||
|
||||
columns +=[
|
||||
_("Customer Group") + ":Link/Customer Group:120", _("Territory") + ":Link/Territory:80",
|
||||
_("Receivable Account") + ":Link/Account:120", _("Mode of Payment") + "::120",
|
||||
_("Tax Id") + "::80", _("Receivable Account") + ":Link/Account:120", _("Mode of Payment") + "::120",
|
||||
_("Project") +":Link/Project:80", _("Owner") + "::150", _("Remarks") + "::150",
|
||||
_("Sales Order") + ":Link/Sales Order:100", _("Delivery Note") + ":Link/Delivery Note:100",
|
||||
_("Cost Center") + ":Link/Cost Center:100", _("Warehouse") + ":Link/Warehouse:100",
|
||||
@@ -162,7 +160,9 @@ def get_invoices(filters, additional_query_columns):
|
||||
additional_query_columns = ', ' + ', '.join(additional_query_columns)
|
||||
|
||||
conditions = get_conditions(filters)
|
||||
return frappe.db.sql("""select name, posting_date, debit_to, project, customer, customer_name, owner, remarks,
|
||||
return frappe.db.sql("""
|
||||
select name, posting_date, debit_to, project, customer,
|
||||
customer_name, owner, remarks, territory, tax_id, customer_group,
|
||||
base_net_total, base_grand_total, base_rounded_total, outstanding_amount {0}
|
||||
from `tabSales Invoice`
|
||||
where docstatus = 1 %s order by posting_date desc, name desc""".format(additional_query_columns or '') %
|
||||
@@ -241,15 +241,6 @@ def get_invoice_cc_wh_map(invoice_list):
|
||||
|
||||
return invoice_cc_wh_map
|
||||
|
||||
def get_customer_details(customers):
|
||||
customer_map = {}
|
||||
for cust in frappe.db.sql("""select name, territory, customer_group from `tabCustomer`
|
||||
where name in (%s)""" % ", ".join(["%s"]*len(customers)), tuple(customers), as_dict=1):
|
||||
customer_map.setdefault(cust.name, cust)
|
||||
|
||||
return customer_map
|
||||
|
||||
|
||||
def get_mode_of_payments(invoice_list):
|
||||
mode_of_payments = {}
|
||||
if invoice_list:
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe.model.document import Document
|
||||
from frappe import _
|
||||
|
||||
class Crop(Document):
|
||||
def validate(self):
|
||||
@@ -12,7 +13,7 @@ class Crop(Document):
|
||||
for task in self.agriculture_task:
|
||||
# validate start_day is not > end_day
|
||||
if task.start_day > task.end_day:
|
||||
frappe.throw("Start day is greater than end day in task '{0}'".format(task.subject))
|
||||
frappe.throw(_("Start day is greater than end day in task '{0}'").format(task.task_name))
|
||||
# to calculate the period of the Crop Cycle
|
||||
if task.end_day > max_period: max_period = task.end_day
|
||||
if max_period > self.period: self.period = max_period
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe.model.document import Document
|
||||
from frappe import _
|
||||
|
||||
class Disease(Document):
|
||||
def validate(self):
|
||||
@@ -12,7 +13,7 @@ class Disease(Document):
|
||||
for task in self.treatment_task:
|
||||
# validate start_day is not > end_day
|
||||
if task.start_day > task.end_day:
|
||||
frappe.throw("Start day is greater than end day in task '{0}'".format(task.task_name))
|
||||
frappe.throw(_("Start day is greater than end day in task '{0}'").format(task.task_name))
|
||||
# to calculate the period of the Crop Cycle
|
||||
if task.end_day > max_period: max_period = task.end_day
|
||||
self.treatment_period = max_period
|
||||
@@ -6,6 +6,7 @@ from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe.model.document import Document
|
||||
from frappe.utils import flt, cint
|
||||
from frappe import _
|
||||
|
||||
class SoilTexture(Document):
|
||||
soil_edit_order = [2, 1, 0]
|
||||
@@ -20,9 +21,9 @@ class SoilTexture(Document):
|
||||
self.update_soil_edit('sand_composition')
|
||||
for soil_type in self.soil_types:
|
||||
if self.get(soil_type) > 100 or self.get(soil_type) < 0:
|
||||
frappe.throw("{0} should be a value between 0 and 100".format(soil_type))
|
||||
frappe.throw(_("{0} should be a value between 0 and 100").format(soil_type))
|
||||
if sum(self.get(soil_type) for soil_type in self.soil_types) != 100:
|
||||
frappe.throw('Soil compositions do not add up to 100')
|
||||
frappe.throw(_('Soil compositions do not add up to 100'))
|
||||
|
||||
def update_soil_edit(self, soil_type):
|
||||
self.soil_edit_order[self.soil_types.index(soil_type)] = max(self.soil_edit_order)+1
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe.model.document import Document
|
||||
from frappe import _
|
||||
|
||||
class WaterAnalysis(Document):
|
||||
def load_contents(self):
|
||||
@@ -18,6 +19,6 @@ class WaterAnalysis(Document):
|
||||
|
||||
def validate(self):
|
||||
if self.collection_datetime > self.laboratory_testing_datetime:
|
||||
frappe.throw('Lab testing datetime cannot be before collection datetime')
|
||||
frappe.throw(_('Lab testing datetime cannot be before collection datetime'))
|
||||
if self.laboratory_testing_datetime > self.result_datetime:
|
||||
frappe.throw('Lab result datetime cannot be before testing datetime')
|
||||
frappe.throw(_('Lab result datetime cannot be before testing datetime'))
|
||||
@@ -12,6 +12,18 @@ frappe.ui.form.on("Purchase Order", {
|
||||
'Purchase Invoice': 'Invoice',
|
||||
'Stock Entry': 'Material to Supplier'
|
||||
}
|
||||
|
||||
frm.set_indicator_formatter('item_code',
|
||||
function(doc) { return (doc.qty<=doc.received_qty) ? "green" : "orange" })
|
||||
|
||||
frm.set_query("reserve_warehouse", "supplied_items", function() {
|
||||
return {
|
||||
filters: {
|
||||
"company": frm.doc.company,
|
||||
"is_group": 0
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
onload: function(frm) {
|
||||
@@ -21,13 +33,10 @@ frappe.ui.form.on("Purchase Order", {
|
||||
return erpnext.queries.warehouse(frm.doc);
|
||||
});
|
||||
|
||||
frappe.db.get_value('Buying Settings', {name: 'Buying Settings'}, 'disable_fetch_last_purchase_rate', (r) => {
|
||||
value = r && cint(r.disable_fetch_last_purchase_rate);
|
||||
frm.toggle_display('get_last_purchase_rate', !value);
|
||||
});
|
||||
|
||||
frm.set_indicator_formatter('item_code',
|
||||
function(doc) { return (doc.qty<=doc.received_qty) ? "green" : "orange" })
|
||||
if (frm.doc.__onload) {
|
||||
frm.toggle_display('get_last_purchase_rate',
|
||||
frm.doc.__onload.disable_fetch_last_purchase_rate);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
@@ -134,23 +143,124 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend(
|
||||
var items = $.map(cur_frm.doc.items, function(d) { return d.bom ? d.item_code : false; });
|
||||
var me = this;
|
||||
|
||||
if(items.length===1) {
|
||||
me._make_stock_entry(items[0]);
|
||||
return;
|
||||
if(items.length >= 1){
|
||||
me.raw_material_data = [];
|
||||
me.show_dialog = 1;
|
||||
let title = "";
|
||||
let fields = [
|
||||
{fieldtype:'Section Break', label: __('Raw Materials')},
|
||||
{fieldname: 'sub_con_rm_items', fieldtype: 'Table',
|
||||
fields: [
|
||||
{
|
||||
fieldtype:'Data',
|
||||
fieldname:'item_code',
|
||||
label: __('Item'),
|
||||
read_only:1,
|
||||
in_list_view:1
|
||||
},
|
||||
{
|
||||
fieldtype:'Data',
|
||||
fieldname:'rm_item_code',
|
||||
label: __('Raw Material'),
|
||||
read_only:1,
|
||||
in_list_view:1
|
||||
},
|
||||
{
|
||||
fieldtype:'Float',
|
||||
read_only:1,
|
||||
fieldname:'qty',
|
||||
label: __('Quantity'),
|
||||
read_only:1,
|
||||
in_list_view:1
|
||||
},
|
||||
{
|
||||
fieldtype:'Data',
|
||||
read_only:1,
|
||||
fieldname:'warehouse',
|
||||
label: __('Reserve Warehouse'),
|
||||
in_list_view:1
|
||||
},
|
||||
{
|
||||
fieldtype:'Float',
|
||||
read_only:1,
|
||||
fieldname:'rate',
|
||||
label: __('Rate'),
|
||||
hidden:1
|
||||
},
|
||||
{
|
||||
fieldtype:'Float',
|
||||
read_only:1,
|
||||
fieldname:'amount',
|
||||
label: __('Amount'),
|
||||
hidden:1
|
||||
},
|
||||
{
|
||||
fieldtype:'Link',
|
||||
read_only:1,
|
||||
fieldname:'uom',
|
||||
label: __('UOM'),
|
||||
hidden:1
|
||||
}
|
||||
],
|
||||
data: me.raw_material_data,
|
||||
get_data: function() {
|
||||
return me.raw_material_data;
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
me.dialog = new frappe.ui.Dialog({
|
||||
title: title, fields: fields
|
||||
});
|
||||
|
||||
if (me.frm.doc['supplied_items']) {
|
||||
me.frm.doc['supplied_items'].forEach((item, index) => {
|
||||
if (item.rm_item_code && item.main_item_code) {
|
||||
me.raw_material_data.push ({
|
||||
'name':item.name,
|
||||
'item_code': item.main_item_code,
|
||||
'rm_item_code': item.rm_item_code,
|
||||
'item_name': item.rm_item_code,
|
||||
'qty': item.required_qty,
|
||||
'warehouse':item.reserve_warehouse,
|
||||
'rate':item.rate,
|
||||
'amount':item.amount,
|
||||
'stock_uom':item.stock_uom
|
||||
});
|
||||
me.dialog.fields_dict.sub_con_rm_items.grid.refresh();
|
||||
}
|
||||
})
|
||||
}
|
||||
frappe.prompt({fieldname:"item", options: items, fieldtype:"Select",
|
||||
label: __("Select Item for Transfer"), reqd: 1}, function(data) {
|
||||
me._make_stock_entry(data.item);
|
||||
}, __("Select Item"), __("Make"));
|
||||
|
||||
me.dialog.show()
|
||||
this.dialog.set_primary_action(__('Transfer'), function() {
|
||||
me.values = me.dialog.get_values();
|
||||
if(me.values) {
|
||||
me.values.sub_con_rm_items.map((row,i) => {
|
||||
if (!row.item_code || !row.rm_item_code || !row.warehouse || !row.qty || row.qty === 0) {
|
||||
frappe.throw(__("Item Code, warehouse, quantity are required on row" + (i+1)));
|
||||
}
|
||||
})
|
||||
me._make_rm_stock_entry(me.dialog.fields_dict.sub_con_rm_items.grid.get_selected_children())
|
||||
me.dialog.hide()
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
me.dialog.get_close_btn().on('click', () => {
|
||||
me.dialog.hide();
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
_make_stock_entry: function(item) {
|
||||
_make_rm_stock_entry: function(rm_items) {
|
||||
frappe.call({
|
||||
method:"erpnext.buying.doctype.purchase_order.purchase_order.make_stock_entry",
|
||||
method:"erpnext.buying.doctype.purchase_order.purchase_order.make_rm_stock_entry",
|
||||
args: {
|
||||
purchase_order: cur_frm.doc.name,
|
||||
item_code: item
|
||||
},
|
||||
rm_items: rm_items
|
||||
}
|
||||
,
|
||||
callback: function(r) {
|
||||
var doclist = frappe.model.sync(r.message);
|
||||
frappe.set_route("Form", doclist[0].doctype, doclist[0].name);
|
||||
@@ -284,7 +394,8 @@ cur_frm.fields_dict['items'].grid.get_field('bom').get_query = function(doc, cdt
|
||||
filters: [
|
||||
['BOM', 'item', '=', d.item_code],
|
||||
['BOM', 'is_active', '=', '1'],
|
||||
['BOM', 'docstatus', '=', '1']
|
||||
['BOM', 'docstatus', '=', '1'],
|
||||
['BOM', 'company', '=', doc.company]
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,11 +41,11 @@
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 1,
|
||||
"bold": 0,
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 1,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"default": "{supplier_name}",
|
||||
@@ -292,40 +292,40 @@
|
||||
"search_index": 1,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 1,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"default": "",
|
||||
"fieldname": "schedule_date",
|
||||
"fieldtype": "Date",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Reqd By Date",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 1,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"default": "",
|
||||
"fieldname": "schedule_date",
|
||||
"fieldtype": "Date",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Reqd By Date",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -3101,7 +3101,70 @@
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"collapsible_depends_on": "supplied_items",
|
||||
"columns": 0,
|
||||
"fieldname": "raw_material_details",
|
||||
"fieldtype": "Section Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Raw Materials Supplied",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"depends_on": "eval:doc.is_subcontracted",
|
||||
"fieldname": "supplied_items_section",
|
||||
"fieldtype": "Section Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Supplied Items",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"depends_on": "",
|
||||
"fieldname": "supplied_items",
|
||||
"fieldtype": "Table",
|
||||
"hidden": 0,
|
||||
@@ -3291,9 +3354,9 @@
|
||||
"is_submittable": 1,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2017-12-21 14:45:34.140128",
|
||||
"modified_by": "Administrator",
|
||||
"max_attachments": 0,
|
||||
"modified": "2018-02-17 11:00:05.037716",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Buying",
|
||||
"name": "Purchase Order",
|
||||
"owner": "Administrator",
|
||||
|
||||
@@ -12,7 +12,7 @@ from erpnext.stock.doctype.item.item import get_last_purchase_details
|
||||
from erpnext.stock.stock_balance import update_bin_qty, get_ordered_qty
|
||||
from frappe.desk.notifications import clear_doctype_notifications
|
||||
from erpnext.buying.utils import validate_for_items, check_for_closed_status
|
||||
|
||||
from erpnext.stock.utils import get_bin
|
||||
|
||||
form_grid_templates = {
|
||||
"items": "templates/form_grid/item_grid.html"
|
||||
@@ -30,10 +30,15 @@ class PurchaseOrder(BuyingController):
|
||||
'target_parent_field': 'per_ordered',
|
||||
'target_ref_field': 'stock_qty',
|
||||
'source_field': 'stock_qty',
|
||||
'percent_join_field': 'material_request',
|
||||
'overflow_type': 'order'
|
||||
'percent_join_field': 'material_request'
|
||||
}]
|
||||
|
||||
def onload(self):
|
||||
super(PurchaseOrder, self).onload()
|
||||
|
||||
self.set_onload('disable_fetch_last_purchase_rate',
|
||||
cint(frappe.db.get_single_value("Buying Settings", "disable_fetch_last_purchase_rate")))
|
||||
|
||||
def validate(self):
|
||||
super(PurchaseOrder, self).validate()
|
||||
|
||||
@@ -62,17 +67,23 @@ class PurchaseOrder(BuyingController):
|
||||
},
|
||||
"Supplier Quotation Item": {
|
||||
"ref_dn_field": "supplier_quotation_item",
|
||||
"compare_fields": [["rate", "="], ["project", "="], ["item_code", "="],
|
||||
"compare_fields": [["project", "="], ["item_code", "="],
|
||||
["uom", "="], ["conversion_factor", "="]],
|
||||
"is_child_table": True
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
if cint(frappe.db.get_single_value('Buying Settings', 'maintain_same_rate')):
|
||||
self.validate_rate_with_reference_doc([["Supplier Quotation", "supplier_quotation", "supplier_quotation_item"]])
|
||||
|
||||
def validate_supplier(self):
|
||||
prevent_po = frappe.db.get_value("Supplier", self.supplier, 'prevent_pos')
|
||||
if prevent_po:
|
||||
standing = frappe.db.get_value("Supplier Scorecard",self.supplier, 'status')
|
||||
frappe.throw(_("Purchase Orders are not allowed for {0} due to a scorecard standing of {1}.").format(self.supplier, standing))
|
||||
standing = frappe.db.get_value("Supplier Scorecard", self.supplier, 'status')
|
||||
if standing:
|
||||
frappe.throw(_("Purchase Orders are not allowed for {0} due to a scorecard standing of {1}.")
|
||||
.format(self.supplier, standing))
|
||||
|
||||
warn_po = frappe.db.get_value("Supplier", self.supplier, 'warn_pos')
|
||||
if warn_po:
|
||||
@@ -183,6 +194,9 @@ class PurchaseOrder(BuyingController):
|
||||
self.set_status(update=True, status=status)
|
||||
self.update_requested_qty()
|
||||
self.update_ordered_qty()
|
||||
if self.is_subcontracted == "Yes":
|
||||
self.update_reserved_qty_for_subcontract()
|
||||
|
||||
self.notify_update()
|
||||
clear_doctype_notifications(self)
|
||||
|
||||
@@ -195,6 +209,8 @@ class PurchaseOrder(BuyingController):
|
||||
self.update_prevdoc_status()
|
||||
self.update_requested_qty()
|
||||
self.update_ordered_qty()
|
||||
if self.is_subcontracted == "Yes":
|
||||
self.update_reserved_qty_for_subcontract()
|
||||
|
||||
frappe.get_doc('Authorization Control').validate_approving_authority(self.doctype,
|
||||
self.company, self.base_grand_total)
|
||||
@@ -208,6 +224,9 @@ class PurchaseOrder(BuyingController):
|
||||
if self.has_drop_ship_item():
|
||||
self.update_delivered_qty_in_sales_order()
|
||||
|
||||
if self.is_subcontracted == "Yes":
|
||||
self.update_reserved_qty_for_subcontract()
|
||||
|
||||
self.check_for_closed_status()
|
||||
|
||||
frappe.db.set(self,'status','Cancelled')
|
||||
@@ -222,12 +241,16 @@ class PurchaseOrder(BuyingController):
|
||||
pass
|
||||
|
||||
def update_status_updater(self):
|
||||
self.status_updater[0].update({
|
||||
"target_parent_dt": "Sales Order",
|
||||
"target_dt": "Sales Order Item",
|
||||
self.status_updater.append({
|
||||
'source_dt': 'Purchase Order Item',
|
||||
'target_dt': 'Sales Order Item',
|
||||
'target_field': 'ordered_qty',
|
||||
"join_field": "sales_order_item",
|
||||
"target_parent_field": ''
|
||||
'target_parent_dt': 'Sales Order',
|
||||
'target_parent_field': '',
|
||||
'join_field': 'sales_order_item',
|
||||
'source_dt': 'Purchase Order Item',
|
||||
'target_ref_field': 'stock_qty',
|
||||
'source_field': 'stock_qty'
|
||||
})
|
||||
|
||||
def update_delivered_qty_in_sales_order(self):
|
||||
@@ -255,6 +278,12 @@ class PurchaseOrder(BuyingController):
|
||||
if item.delivered_by_supplier == 1:
|
||||
item.received_qty = item.qty
|
||||
|
||||
def update_reserved_qty_for_subcontract(self):
|
||||
for d in self.supplied_items:
|
||||
if d.rm_item_code:
|
||||
stock_bin = get_bin(d.rm_item_code, d.reserve_warehouse)
|
||||
stock_bin.update_reserved_qty_for_sub_contracting()
|
||||
|
||||
def item_last_purchase_rate(name, conversion_rate, item_code, conversion_factor= 1.0):
|
||||
"""get last purchase rate for an item"""
|
||||
if cint(frappe.db.get_single_value("Buying Settings", "disable_fetch_last_purchase_rate")): return
|
||||
@@ -375,23 +404,52 @@ def make_purchase_invoice(source_name, target_doc=None):
|
||||
return doc
|
||||
|
||||
@frappe.whitelist()
|
||||
def make_stock_entry(purchase_order, item_code):
|
||||
purchase_order = frappe.get_doc("Purchase Order", purchase_order)
|
||||
def make_rm_stock_entry(purchase_order, rm_items):
|
||||
if isinstance(rm_items, basestring):
|
||||
rm_items_list = json.loads(rm_items)
|
||||
else:
|
||||
frappe.throw(_("No Items available for transfer"))
|
||||
|
||||
stock_entry = frappe.new_doc("Stock Entry")
|
||||
stock_entry.purpose = "Subcontract"
|
||||
stock_entry.purchase_order = purchase_order.name
|
||||
stock_entry.supplier = purchase_order.supplier
|
||||
stock_entry.supplier_name = purchase_order.supplier_name
|
||||
stock_entry.supplier_address = purchase_order.supplier_address
|
||||
stock_entry.address_display = purchase_order.address_display
|
||||
stock_entry.company = purchase_order.company
|
||||
stock_entry.from_bom = 1
|
||||
po_item = [d for d in purchase_order.items if d.item_code == item_code][0]
|
||||
stock_entry.fg_completed_qty = po_item.qty
|
||||
stock_entry.bom_no = po_item.bom
|
||||
stock_entry.get_items()
|
||||
return stock_entry.as_dict()
|
||||
if rm_items_list:
|
||||
fg_items = list(set(d["item_code"] for d in rm_items_list))
|
||||
else:
|
||||
frappe.throw(_("No Items selected for transfer"))
|
||||
|
||||
if purchase_order:
|
||||
purchase_order = frappe.get_doc("Purchase Order", purchase_order)
|
||||
|
||||
if fg_items:
|
||||
items = tuple(set(d["rm_item_code"] for d in rm_items_list))
|
||||
item_wh = frappe._dict(frappe.db.sql("""
|
||||
select item_code, description
|
||||
from `tabItem` where name in ({0})
|
||||
""".format(", ".join(["%s"] * len(items))), items))
|
||||
|
||||
stock_entry = frappe.new_doc("Stock Entry")
|
||||
stock_entry.purpose = "Subcontract"
|
||||
stock_entry.purchase_order = purchase_order.name
|
||||
stock_entry.supplier = purchase_order.supplier
|
||||
stock_entry.supplier_name = purchase_order.supplier_name
|
||||
stock_entry.supplier_address = purchase_order.supplier_address
|
||||
stock_entry.address_display = purchase_order.address_display
|
||||
stock_entry.company = purchase_order.company
|
||||
for item_code in fg_items:
|
||||
for rm_item_data in rm_items_list:
|
||||
if rm_item_data["item_code"] == item_code:
|
||||
items_dict = {
|
||||
rm_item_data["rm_item_code"]: {
|
||||
"item_name":rm_item_data["item_name"],
|
||||
"description":item_wh.get(rm_item_data["rm_item_code"]),
|
||||
'qty':rm_item_data["qty"],
|
||||
'from_warehouse':rm_item_data["warehouse"],
|
||||
'stock_uom':rm_item_data["stock_uom"]
|
||||
}
|
||||
}
|
||||
stock_entry.add_to_stock_entry_detail(items_dict)
|
||||
return stock_entry.as_dict()
|
||||
else:
|
||||
frappe.throw(_("No Items selected for transfer"))
|
||||
return purchase_order.name
|
||||
|
||||
@frappe.whitelist()
|
||||
def update_status(status, name):
|
||||
|
||||
@@ -6,8 +6,9 @@ import unittest
|
||||
import frappe
|
||||
import frappe.defaults
|
||||
from frappe.utils import flt, add_days, nowdate
|
||||
from erpnext.buying.doctype.purchase_order.purchase_order import make_purchase_receipt, make_purchase_invoice
|
||||
|
||||
from erpnext.buying.doctype.purchase_order.purchase_order import (make_purchase_receipt, make_purchase_invoice, make_rm_stock_entry as make_subcontract_transfer_entry)
|
||||
from erpnext.stock.doctype.stock_entry.test_stock_entry import make_stock_entry
|
||||
import json
|
||||
|
||||
class TestPurchaseOrder(unittest.TestCase):
|
||||
def test_make_purchase_receipt(self):
|
||||
@@ -182,24 +183,129 @@ class TestPurchaseOrder(unittest.TestCase):
|
||||
pi.insert()
|
||||
self.assertTrue(pi.get('payment_schedule'))
|
||||
|
||||
|
||||
def test_reserved_qty_subcontract_po(self):
|
||||
# Make stock available for raw materials
|
||||
make_stock_entry(target="_Test Warehouse - _TC", qty=10, basic_rate=100)
|
||||
make_stock_entry(target="_Test Warehouse - _TC", item_code="_Test Item Home Desktop 100",
|
||||
qty=20, basic_rate=100)
|
||||
|
||||
bin1 = frappe.db.get_value("Bin",
|
||||
filters={"warehouse": "_Test Warehouse - _TC", "item_code": "_Test Item"},
|
||||
fieldname=["reserved_qty_for_sub_contract", "projected_qty"], as_dict=1)
|
||||
|
||||
# Submit PO
|
||||
po = create_purchase_order(item_code="_Test FG Item", is_subcontracted="Yes")
|
||||
|
||||
bin2 = frappe.db.get_value("Bin",
|
||||
filters={"warehouse": "_Test Warehouse - _TC", "item_code": "_Test Item"},
|
||||
fieldname=["reserved_qty_for_sub_contract", "projected_qty"], as_dict=1)
|
||||
self.assertEquals(bin2.reserved_qty_for_sub_contract, bin1.reserved_qty_for_sub_contract + 10)
|
||||
self.assertEquals(bin2.projected_qty, bin1.projected_qty - 10)
|
||||
|
||||
# Create stock transfer
|
||||
rm_item = [{"item_code":"_Test FG Item","rm_item_code":"_Test Item","item_name":"_Test Item",
|
||||
"qty":6,"warehouse":"_Test Warehouse - _TC","rate":100,"amount":600,"stock_uom":"Nos"}]
|
||||
rm_item_string = json.dumps(rm_item)
|
||||
se = frappe.get_doc(make_subcontract_transfer_entry(po.name, rm_item_string))
|
||||
se.to_warehouse = "_Test Warehouse 1 - _TC"
|
||||
se.save()
|
||||
se.submit()
|
||||
|
||||
bin3 = frappe.db.get_value("Bin",
|
||||
filters={"warehouse": "_Test Warehouse - _TC", "item_code": "_Test Item"},
|
||||
fieldname="reserved_qty_for_sub_contract", as_dict=1)
|
||||
|
||||
self.assertEquals(bin3.reserved_qty_for_sub_contract, bin2.reserved_qty_for_sub_contract - 6)
|
||||
|
||||
# close PO
|
||||
po.update_status("Closed")
|
||||
bin4 = frappe.db.get_value("Bin",
|
||||
filters={"warehouse": "_Test Warehouse - _TC", "item_code": "_Test Item"},
|
||||
fieldname="reserved_qty_for_sub_contract", as_dict=1)
|
||||
|
||||
self.assertEquals(bin4.reserved_qty_for_sub_contract, bin1.reserved_qty_for_sub_contract)
|
||||
|
||||
# Re-open PO
|
||||
po.update_status("Submitted")
|
||||
bin5 = frappe.db.get_value("Bin",
|
||||
filters={"warehouse": "_Test Warehouse - _TC", "item_code": "_Test Item"},
|
||||
fieldname="reserved_qty_for_sub_contract", as_dict=1)
|
||||
|
||||
self.assertEquals(bin5.reserved_qty_for_sub_contract, bin2.reserved_qty_for_sub_contract - 6)
|
||||
|
||||
# make Purchase Receipt against PO
|
||||
pr = make_purchase_receipt(po.name)
|
||||
pr.supplier_warehouse = "_Test Warehouse 1 - _TC"
|
||||
pr.save()
|
||||
pr.submit()
|
||||
|
||||
bin6 = frappe.db.get_value("Bin",
|
||||
filters={"warehouse": "_Test Warehouse - _TC", "item_code": "_Test Item"},
|
||||
fieldname="reserved_qty_for_sub_contract", as_dict=1)
|
||||
|
||||
self.assertEquals(bin6.reserved_qty_for_sub_contract, bin1.reserved_qty_for_sub_contract)
|
||||
|
||||
# Cancel PR
|
||||
pr.cancel()
|
||||
bin7 = frappe.db.get_value("Bin",
|
||||
filters={"warehouse": "_Test Warehouse - _TC", "item_code": "_Test Item"},
|
||||
fieldname="reserved_qty_for_sub_contract", as_dict=1)
|
||||
|
||||
self.assertEquals(bin7.reserved_qty_for_sub_contract, bin2.reserved_qty_for_sub_contract - 6)
|
||||
|
||||
# Make Purchase Invoice
|
||||
pi = make_purchase_invoice(po.name)
|
||||
pi.update_stock = 1
|
||||
pi.supplier_warehouse = "_Test Warehouse 1 - _TC"
|
||||
pi.insert()
|
||||
pi.submit()
|
||||
bin8 = frappe.db.get_value("Bin",
|
||||
filters={"warehouse": "_Test Warehouse - _TC", "item_code": "_Test Item"},
|
||||
fieldname="reserved_qty_for_sub_contract", as_dict=1)
|
||||
|
||||
self.assertEquals(bin8.reserved_qty_for_sub_contract, bin1.reserved_qty_for_sub_contract)
|
||||
|
||||
# Cancel PR
|
||||
pi.cancel()
|
||||
bin9 = frappe.db.get_value("Bin",
|
||||
filters={"warehouse": "_Test Warehouse - _TC", "item_code": "_Test Item"},
|
||||
fieldname="reserved_qty_for_sub_contract", as_dict=1)
|
||||
|
||||
self.assertEquals(bin9.reserved_qty_for_sub_contract, bin2.reserved_qty_for_sub_contract - 6)
|
||||
|
||||
# Cancel Stock Entry
|
||||
se.cancel()
|
||||
bin10 = frappe.db.get_value("Bin",
|
||||
filters={"warehouse": "_Test Warehouse - _TC", "item_code": "_Test Item"},
|
||||
fieldname="reserved_qty_for_sub_contract", as_dict=1)
|
||||
self.assertEquals(bin10.reserved_qty_for_sub_contract, bin1.reserved_qty_for_sub_contract + 10)
|
||||
|
||||
# Cancel PO
|
||||
po.reload()
|
||||
po.cancel()
|
||||
bin11 = frappe.db.get_value("Bin",
|
||||
filters={"warehouse": "_Test Warehouse - _TC", "item_code": "_Test Item"},
|
||||
fieldname="reserved_qty_for_sub_contract", as_dict=1)
|
||||
|
||||
self.assertEquals(bin11.reserved_qty_for_sub_contract, bin1.reserved_qty_for_sub_contract)
|
||||
|
||||
def get_same_items():
|
||||
return [
|
||||
{
|
||||
"item_code": "_Test FG Item",
|
||||
"warehouse": "_Test Warehouse - _TC",
|
||||
"qty": 1,
|
||||
"rate": 500,
|
||||
"schedule_date": add_days(nowdate(), 1)
|
||||
},
|
||||
{
|
||||
"item_code": "_Test FG Item",
|
||||
"warehouse": "_Test Warehouse - _TC",
|
||||
"qty": 4,
|
||||
"rate": 500,
|
||||
"schedule_date": add_days(nowdate(), 1)
|
||||
}
|
||||
]
|
||||
{
|
||||
"item_code": "_Test FG Item",
|
||||
"warehouse": "_Test Warehouse - _TC",
|
||||
"qty": 1,
|
||||
"rate": 500,
|
||||
"schedule_date": add_days(nowdate(), 1)
|
||||
},
|
||||
{
|
||||
"item_code": "_Test FG Item",
|
||||
"warehouse": "_Test Warehouse - _TC",
|
||||
"qty": 4,
|
||||
"rate": 500,
|
||||
"schedule_date": add_days(nowdate(), 1)
|
||||
}
|
||||
]
|
||||
|
||||
def create_purchase_order(**args):
|
||||
po = frappe.new_doc("Purchase Order")
|
||||
@@ -224,6 +330,10 @@ def create_purchase_order(**args):
|
||||
if not args.do_not_save:
|
||||
po.insert()
|
||||
if not args.do_not_submit:
|
||||
if po.is_subcontracted == "Yes":
|
||||
supp_items = po.get("supplied_items")
|
||||
for d in supp_items:
|
||||
d.reserve_warehouse = args.warehouse or "_Test Warehouse - _TC"
|
||||
po.submit()
|
||||
|
||||
return po
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"allow_copy": 0,
|
||||
"allow_guest_to_view": 0,
|
||||
"allow_import": 0,
|
||||
"allow_rename": 0,
|
||||
"beta": 0,
|
||||
@@ -10,68 +11,86 @@
|
||||
"editable_grid": 1,
|
||||
"fields": [
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 2,
|
||||
"fieldname": "main_item_code",
|
||||
"fieldtype": "Data",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Item Code",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"oldfieldname": "main_item_code",
|
||||
"oldfieldtype": "Data",
|
||||
"options": "Item",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 2,
|
||||
"fieldname": "rm_item_code",
|
||||
"fieldtype": "Data",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Raw Material Item Code",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"oldfieldname": "rm_item_code",
|
||||
"oldfieldtype": "Data",
|
||||
"options": "Item",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 2,
|
||||
"fieldname": "required_qty",
|
||||
"fieldtype": "Float",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Supplied Qty",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@@ -81,23 +100,29 @@
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 2,
|
||||
"fieldname": "rate",
|
||||
"fieldtype": "Currency",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Rate",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@@ -108,23 +133,29 @@
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "amount",
|
||||
"fieldtype": "Currency",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Amount",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@@ -135,23 +166,59 @@
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "column_break_6",
|
||||
"fieldtype": "Column Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "bom_detail_no",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "BOM Detail No",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@@ -161,23 +228,29 @@
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "reference_name",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Reference Name",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@@ -187,23 +260,29 @@
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "conversion_factor",
|
||||
"fieldtype": "Float",
|
||||
"hidden": 1,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Conversion Factor",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@@ -213,23 +292,29 @@
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "stock_uom",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Stock Uom",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@@ -240,24 +325,58 @@
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 2,
|
||||
"fieldname": "reserve_warehouse",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Reserve Warehouse",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Warehouse",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
}
|
||||
],
|
||||
"has_web_view": 0,
|
||||
"hide_heading": 0,
|
||||
"hide_toolbar": 1,
|
||||
"idx": 1,
|
||||
"image_view": 0,
|
||||
"in_create": 0,
|
||||
"in_dialog": 0,
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 1,
|
||||
"max_attachments": 0,
|
||||
"modified": "2016-07-11 03:28:05.533063",
|
||||
"modified": "2018-03-13 12:37:57.150914",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Buying",
|
||||
"name": "Purchase Order Item Supplied",
|
||||
@@ -266,5 +385,7 @@
|
||||
"quick_entry": 0,
|
||||
"read_only": 0,
|
||||
"read_only_onload": 0,
|
||||
"show_name_in_global_search": 0,
|
||||
"track_changes": 0,
|
||||
"track_seen": 0
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"allow_copy": 0,
|
||||
"allow_guest_to_view": 0,
|
||||
"allow_import": 0,
|
||||
"allow_rename": 0,
|
||||
"beta": 0,
|
||||
@@ -11,12 +12,13 @@
|
||||
"engine": "InnoDB",
|
||||
"fields": [
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "main_item_code",
|
||||
"fieldtype": "Data",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
@@ -29,6 +31,7 @@
|
||||
"no_copy": 0,
|
||||
"oldfieldname": "main_item_code",
|
||||
"oldfieldtype": "Data",
|
||||
"options": "Item",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
@@ -38,15 +41,17 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "rm_item_code",
|
||||
"fieldtype": "Data",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
@@ -59,6 +64,7 @@
|
||||
"no_copy": 0,
|
||||
"oldfieldname": "rm_item_code",
|
||||
"oldfieldtype": "Data",
|
||||
"options": "Item",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
@@ -68,9 +74,11 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -99,10 +107,12 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0,
|
||||
"width": "300px"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -129,9 +139,11 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -157,9 +169,11 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -184,9 +198,11 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -214,9 +230,11 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -244,9 +262,11 @@
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -275,9 +295,11 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -306,9 +328,11 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -337,9 +361,11 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -367,9 +393,11 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -397,9 +425,11 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -427,9 +457,11 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -457,20 +489,21 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
}
|
||||
],
|
||||
"has_web_view": 0,
|
||||
"hide_heading": 0,
|
||||
"hide_toolbar": 0,
|
||||
"idx": 1,
|
||||
"image_view": 0,
|
||||
"in_create": 0,
|
||||
"in_dialog": 0,
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 1,
|
||||
"max_attachments": 0,
|
||||
"modified": "2017-02-17 16:43:21.668443",
|
||||
"modified": "2018-03-13 12:38:40.807453",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Buying",
|
||||
"name": "Purchase Receipt Item Supplied",
|
||||
|
||||
@@ -8,8 +8,7 @@
|
||||
{
|
||||
"doctype": "Supplier",
|
||||
"supplier_name": "_Test Supplier P",
|
||||
"supplier_type": "_Test Supplier Type",
|
||||
"credit_days_based_on": "Fixed Days"
|
||||
"supplier_type": "_Test Supplier Type"
|
||||
},
|
||||
{
|
||||
"doctype": "Supplier",
|
||||
|
||||
@@ -124,7 +124,8 @@ def make_purchase_order(source_name, target_doc=None):
|
||||
["name", "supplier_quotation_item"],
|
||||
["parent", "supplier_quotation"],
|
||||
["material_request", "material_request"],
|
||||
["material_request_item", "material_request_item"]
|
||||
["material_request_item", "material_request_item"],
|
||||
["sales_order", "sales_order"]
|
||||
],
|
||||
"postprocess": update_item
|
||||
},
|
||||
|
||||
@@ -1326,6 +1326,37 @@
|
||||
"unique": 0,
|
||||
"width": "120px"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "sales_order",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Sales Order",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Sales Order",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 1,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
@@ -1614,7 +1645,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 1,
|
||||
"max_attachments": 0,
|
||||
"modified": "2017-12-14 09:37:47.427897",
|
||||
"modified": "2018-01-25 15:04:40.171617",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Buying",
|
||||
"name": "Supplier Quotation Item",
|
||||
|
||||
@@ -4,14 +4,14 @@
|
||||
/* global frappe, refresh_field */
|
||||
|
||||
frappe.ui.form.on("Supplier Scorecard", {
|
||||
|
||||
onload: function(frm) {
|
||||
|
||||
setup: function(frm) {
|
||||
if (frm.doc.indicator_color !== "") {
|
||||
frm.set_indicator_formatter("status", function(doc) {
|
||||
return doc.indicator_color.toLowerCase();
|
||||
});
|
||||
}
|
||||
},
|
||||
onload: function(frm) {
|
||||
if (frm.doc.__unsaved == 1) {
|
||||
loadAllCriteria(frm);
|
||||
loadAllStandings(frm);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"add_total_row": 0,
|
||||
"add_total_row": 1,
|
||||
"apply_user_permissions": 1,
|
||||
"creation": "2013-06-13 18:45:01",
|
||||
"disabled": 0,
|
||||
@@ -7,7 +7,7 @@
|
||||
"doctype": "Report",
|
||||
"idx": 3,
|
||||
"is_standard": "Yes",
|
||||
"modified": "2017-02-24 20:16:13.121638",
|
||||
"modified": "2018-02-21 01:28:37.416562",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Buying",
|
||||
"name": "Purchase Order Trends",
|
||||
|
||||
@@ -126,6 +126,11 @@ def get_data():
|
||||
"link": "Tree/Sales Person",
|
||||
"description": _("Manage Sales Person Tree."),
|
||||
},
|
||||
{
|
||||
"type": "doctype",
|
||||
"name": "Lead Source",
|
||||
"description": _("Track Leads by Lead Source.")
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -200,7 +200,7 @@ def get_data():
|
||||
"color": "#fd784f",
|
||||
"icon": "octicon octicon-calendar",
|
||||
"label": _("Course Schedule"),
|
||||
"link": "Calendar/Course Schedule",
|
||||
"link": "List/Course Schedule/Calendar",
|
||||
"_doctype": "Course Schedule",
|
||||
"type": "list",
|
||||
"hidden": 1
|
||||
|
||||
@@ -21,18 +21,7 @@ def get_data():
|
||||
{
|
||||
"type": "doctype",
|
||||
"name": "Student Group"
|
||||
},
|
||||
{
|
||||
"type": "doctype",
|
||||
"name": "Student Group Creation Tool"
|
||||
},
|
||||
{
|
||||
"type": "report",
|
||||
"is_query_report": True,
|
||||
"name": "Student and Guardian Contact Details",
|
||||
"doctype": "Program Enrollment"
|
||||
}
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -50,10 +39,6 @@ def get_data():
|
||||
{
|
||||
"type": "doctype",
|
||||
"name": "Program Enrollment"
|
||||
},
|
||||
{
|
||||
"type": "doctype",
|
||||
"name": "Program Enrollment Tool"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -68,10 +53,6 @@ def get_data():
|
||||
"type": "doctype",
|
||||
"name": "Student Leave Application"
|
||||
},
|
||||
{
|
||||
"type": "doctype",
|
||||
"name": "Student Attendance Tool"
|
||||
},
|
||||
{
|
||||
"type": "report",
|
||||
"is_query_report": True,
|
||||
@@ -84,21 +65,26 @@ def get_data():
|
||||
"name": "Student Batch-Wise Attendance",
|
||||
"doctype": "Student Attendance"
|
||||
},
|
||||
{
|
||||
"type": "report",
|
||||
"is_query_report": True,
|
||||
"name": "Student Monthly Attendance Sheet",
|
||||
"doctype": "Student Attendance"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": _("Schedule"),
|
||||
"label": _("Tools"),
|
||||
"items": [
|
||||
{
|
||||
"type": "doctype",
|
||||
"name": "Course Schedule",
|
||||
"route": "List/Course Schedule/Calendar"
|
||||
"name": "Student Attendance Tool"
|
||||
},
|
||||
{
|
||||
"type": "doctype",
|
||||
"name": "Assessment Result Tool"
|
||||
},
|
||||
{
|
||||
"type": "doctype",
|
||||
"name": "Student Group Creation Tool"
|
||||
},
|
||||
{
|
||||
"type": "doctype",
|
||||
"name": "Program Enrollment Tool"
|
||||
},
|
||||
{
|
||||
"type": "doctype",
|
||||
@@ -125,28 +111,34 @@ def get_data():
|
||||
{
|
||||
"type": "doctype",
|
||||
"name": "Assessment Criteria"
|
||||
},
|
||||
{
|
||||
"type": "doctype",
|
||||
"name": "Assessment Criteria Group"
|
||||
},
|
||||
{
|
||||
"type": "doctype",
|
||||
"name": "Assessment Result Tool"
|
||||
},
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": _("Assessment Reports"),
|
||||
"items": [
|
||||
{
|
||||
"type": "report",
|
||||
"is_query_report": True,
|
||||
"name": "Course wise Assessment Report",
|
||||
"doctype": "Assessment Result"
|
||||
},
|
||||
{
|
||||
"type": "report",
|
||||
"is_query_report": True,
|
||||
"name": "Final Assessment Grades",
|
||||
"doctype": "Assessment Result"
|
||||
},
|
||||
{
|
||||
"type": "report",
|
||||
"is_query_report": True,
|
||||
"name": "Assessment Plan Status",
|
||||
"doctype": "Assessment Plan"
|
||||
},
|
||||
|
||||
{
|
||||
"type": "doctype",
|
||||
"name": "Student Report Generation Tool"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -167,17 +159,25 @@ def get_data():
|
||||
{
|
||||
"type": "doctype",
|
||||
"name": "Fee Category"
|
||||
},
|
||||
{
|
||||
"type": "report",
|
||||
"name": "Student Fee Collection",
|
||||
"doctype": "Fees",
|
||||
"is_query_report": True
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": _("Setup"),
|
||||
"label": _("Schedule"),
|
||||
"items": [
|
||||
{
|
||||
"type": "doctype",
|
||||
"name": "Course Schedule",
|
||||
"route": "List/Course Schedule/Calendar"
|
||||
},
|
||||
{
|
||||
"type": "doctype",
|
||||
"name": "Course Scheduling Tool"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": _("Masters"),
|
||||
"items": [
|
||||
{
|
||||
"type": "doctype",
|
||||
@@ -194,7 +194,12 @@ def get_data():
|
||||
{
|
||||
"type": "doctype",
|
||||
"name": "Room"
|
||||
},
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": _("Setup"),
|
||||
"items": [
|
||||
{
|
||||
"type": "doctype",
|
||||
"name": "Student Category"
|
||||
@@ -221,4 +226,27 @@ def get_data():
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": _("Other Reports"),
|
||||
"items": [
|
||||
{
|
||||
"type": "report",
|
||||
"is_query_report": True,
|
||||
"name": "Student and Guardian Contact Details",
|
||||
"doctype": "Program Enrollment"
|
||||
},
|
||||
{
|
||||
"type": "report",
|
||||
"is_query_report": True,
|
||||
"name": "Student Monthly Attendance Sheet",
|
||||
"doctype": "Student Attendance"
|
||||
},
|
||||
{
|
||||
"type": "report",
|
||||
"name": "Student Fee Collection",
|
||||
"doctype": "Fees",
|
||||
"is_query_report": True
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
@@ -15,7 +15,7 @@ def get_data():
|
||||
{
|
||||
"type": "doctype",
|
||||
"name": "Task",
|
||||
"route": "Tree/Task",
|
||||
"route": "List/Task",
|
||||
"description": _("Project activity / task."),
|
||||
},
|
||||
{
|
||||
|
||||
@@ -173,6 +173,11 @@ def get_data():
|
||||
"name": "Industry Type",
|
||||
"description": _("Track Leads by Industry Type.")
|
||||
},
|
||||
{
|
||||
"type": "doctype",
|
||||
"name": "Lead Source",
|
||||
"description": _("Track Leads by Lead Source.")
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -135,9 +135,9 @@ class AccountsController(TransactionBase):
|
||||
if not self.due_date:
|
||||
frappe.throw(_("Due Date is mandatory"))
|
||||
|
||||
validate_due_date(self.posting_date, self.due_date, "Customer", self.customer)
|
||||
validate_due_date(self.posting_date, self.due_date, "Customer", self.customer, self.company)
|
||||
elif self.doctype == "Purchase Invoice":
|
||||
validate_due_date(self.posting_date, self.due_date, "Supplier", self.supplier)
|
||||
validate_due_date(self.posting_date, self.due_date, "Supplier", self.supplier, self.company)
|
||||
|
||||
def set_price_list_currency(self, buying_or_selling):
|
||||
if self.meta.get_field("posting_date"):
|
||||
@@ -484,7 +484,7 @@ class AccountsController(TransactionBase):
|
||||
max_allowed_amt = flt(ref_amt * (100 + tolerance) / 100)
|
||||
|
||||
if total_billed_amt - max_allowed_amt > 0.01:
|
||||
frappe.throw(_("Cannot overbill for Item {0} in row {1} more than {2}. To allow over-billing, please set in Buying Settings").format(item.item_code, item.idx, max_allowed_amt))
|
||||
frappe.throw(_("Cannot overbill for Item {0} in row {1} more than {2}. To allow over-billing, please set in Stock Settings").format(item.item_code, item.idx, max_allowed_amt))
|
||||
|
||||
def get_company_default(self, fieldname):
|
||||
from erpnext.accounts.utils import get_company_default
|
||||
@@ -666,6 +666,10 @@ class AccountsController(TransactionBase):
|
||||
self.remove(item)
|
||||
|
||||
def set_payment_schedule(self):
|
||||
if self.doctype == 'Sales Invoice' and self.is_pos:
|
||||
self.payment_terms_template = ''
|
||||
return
|
||||
|
||||
posting_date = self.get("bill_date") or self.get("posting_date") or self.get("transaction_date")
|
||||
date = self.get("due_date")
|
||||
due_date = date or posting_date
|
||||
@@ -695,6 +699,8 @@ class AccountsController(TransactionBase):
|
||||
dates = []
|
||||
li = []
|
||||
|
||||
if self.doctype == 'Sales Invoice' and self.is_pos: return
|
||||
|
||||
for d in self.get("payment_schedule"):
|
||||
if self.doctype == "Sales Order" and getdate(d.due_date) < getdate(self.transaction_date):
|
||||
frappe.throw(_("Row {0}: Due Date cannot be before posting date").format(d.idx))
|
||||
@@ -708,6 +714,8 @@ class AccountsController(TransactionBase):
|
||||
.format(list=duplicates))
|
||||
|
||||
def validate_payment_schedule_amount(self):
|
||||
if self.doctype == 'Sales Invoice' and self.is_pos: return
|
||||
|
||||
if self.get("payment_schedule"):
|
||||
total = 0
|
||||
for d in self.get("payment_schedule"):
|
||||
@@ -883,6 +891,7 @@ def get_advance_payment_entries(party_type, party, party_account,
|
||||
t1.name = t2.parent and t1.{0} = %s and t1.payment_type = %s
|
||||
and t1.party_type = %s and t1.party = %s and t1.docstatus = 1
|
||||
and t2.reference_doctype = %s {1}
|
||||
order by t1.posting_date
|
||||
""".format(party_account_field, reference_condition),
|
||||
[party_account, payment_type, party_type, party, order_doctype] + order_list, as_dict=1)
|
||||
|
||||
@@ -894,6 +903,7 @@ def get_advance_payment_entries(party_type, party, party_account,
|
||||
where
|
||||
{0} = %s and party_type = %s and party = %s and payment_type = %s
|
||||
and docstatus = 1 and unallocated_amount > 0
|
||||
order by posting_date
|
||||
""".format(party_account_field), (party_account, party_type, party, payment_type), as_dict=1)
|
||||
|
||||
return list(payment_entries_against_order) + list(unallocated_payment_entries)
|
||||
|
||||
@@ -163,6 +163,11 @@ class BuyingController(StockController):
|
||||
if item in self.sub_contracted_items and not item.bom:
|
||||
frappe.throw(_("Please select BOM in BOM field for Item {0}").format(item.item_code))
|
||||
|
||||
if self.doctype == "Purchase Order":
|
||||
for supplied_item in self.get("supplied_items"):
|
||||
if not supplied_item.reserve_warehouse:
|
||||
frappe.throw(_("Reserved Warehouse is mandatory for Item {0} in Raw Materials supplied").format(frappe.bold(supplied_item.rm_item_code)))
|
||||
|
||||
else:
|
||||
for item in self.get("items"):
|
||||
if item.bom:
|
||||
@@ -192,8 +197,16 @@ class BuyingController(StockController):
|
||||
def update_raw_materials_supplied(self, item, raw_material_table):
|
||||
bom_items = self.get_items_from_bom(item.item_code, item.bom)
|
||||
raw_materials_cost = 0
|
||||
items = list(set([d.item_code for d in bom_items]))
|
||||
item_wh = frappe._dict(frappe.db.sql("""select item_code, default_warehouse
|
||||
from `tabItem` where name in ({0})""".format(", ".join(["%s"] * len(items))), items))
|
||||
|
||||
for bom_item in bom_items:
|
||||
if self.doctype == "Purchase Order":
|
||||
reserve_warehouse = bom_item.source_warehouse or item_wh.get(bom_item.item_code)
|
||||
if frappe.db.get_value("Warehouse", reserve_warehouse, "company") != self.company:
|
||||
reserve_warehouse = None
|
||||
|
||||
# check if exists
|
||||
exists = 0
|
||||
for d in self.get(raw_material_table):
|
||||
@@ -213,6 +226,8 @@ class BuyingController(StockController):
|
||||
rm.rm_item_code = bom_item.item_code
|
||||
rm.stock_uom = bom_item.stock_uom
|
||||
rm.required_qty = required_qty
|
||||
if self.doctype == "Purchase Order" and not rm.reserve_warehouse:
|
||||
rm.reserve_warehouse = reserve_warehouse
|
||||
|
||||
rm.conversion_factor = item.conversion_factor
|
||||
|
||||
@@ -264,7 +279,7 @@ class BuyingController(StockController):
|
||||
def get_items_from_bom(self, item_code, bom):
|
||||
bom_items = frappe.db.sql("""select t2.item_code,
|
||||
t2.stock_qty / ifnull(t1.quantity, 1) as qty_consumed_per_unit,
|
||||
t2.rate, t2.stock_uom, t2.name, t2.description
|
||||
t2.rate, t2.stock_uom, t2.name, t2.description, t2.source_warehouse
|
||||
from `tabBOM` t1, `tabBOM Item` t2, tabItem t3
|
||||
where t2.parent = t1.name and t1.item = %s
|
||||
and t1.docstatus = 1 and t1.is_active = 1 and t1.name = %s
|
||||
@@ -339,7 +354,7 @@ class BuyingController(StockController):
|
||||
frappe.get_meta(item_row.doctype).get_label(fieldname), item_row['item_code'])))
|
||||
|
||||
def update_stock_ledger(self, allow_negative_stock=False, via_landed_cost_voucher=False):
|
||||
self.update_ordered_qty()
|
||||
self.update_ordered_and_reserved_qty()
|
||||
|
||||
sl_entries = []
|
||||
stock_items = self.get_stock_items()
|
||||
@@ -381,7 +396,7 @@ class BuyingController(StockController):
|
||||
self.make_sl_entries(sl_entries, allow_negative_stock=allow_negative_stock,
|
||||
via_landed_cost_voucher=via_landed_cost_voucher)
|
||||
|
||||
def update_ordered_qty(self):
|
||||
def update_ordered_and_reserved_qty(self):
|
||||
po_map = {}
|
||||
for d in self.get("items"):
|
||||
if self.doctype=="Purchase Receipt" \
|
||||
@@ -400,6 +415,8 @@ class BuyingController(StockController):
|
||||
frappe.InvalidStatusError)
|
||||
|
||||
po_obj.update_ordered_qty(po_item_rows)
|
||||
if self.is_subcontracted:
|
||||
po_obj.update_reserved_qty_for_subcontract()
|
||||
|
||||
def make_sl_entries_for_supplier_warehouse(self, sl_entries):
|
||||
if hasattr(self, 'supplied_items'):
|
||||
|
||||
@@ -92,7 +92,10 @@ def validate_is_incremental(numeric_attribute, attribute, value, item):
|
||||
InvalidItemAttributeValueError, title=_('Invalid Attribute'))
|
||||
|
||||
def validate_item_attribute_value(attributes_list, attribute, attribute_value, item):
|
||||
if attribute_value not in attributes_list:
|
||||
allow_rename_attribute_value = frappe.db.get_single_value('Item Variant Settings', 'allow_rename_attribute_value')
|
||||
if allow_rename_attribute_value:
|
||||
pass
|
||||
elif attribute_value not in attributes_list:
|
||||
frappe.throw(_("Value {0} for Attribute {1} does not exist in the list of valid Item Attribute Values for Item {2}").format(
|
||||
attribute_value, attribute, item), InvalidItemAttributeValueError, title=_('Invalid Attribute'))
|
||||
|
||||
|
||||
@@ -152,7 +152,12 @@ def tax_account_query(doctype, txt, searchfield, start, page_len, filters):
|
||||
def item_query(doctype, txt, searchfield, start, page_len, filters, as_dict=False):
|
||||
conditions = []
|
||||
|
||||
return frappe.db.sql("""select tabItem.name, tabItem.item_group, tabItem.image,
|
||||
description_cond = ''
|
||||
if frappe.db.count('Item', cache=True) < 50000:
|
||||
# scan description only if items are less than 50000
|
||||
description_cond = 'or tabItem.description LIKE %(txt)s'
|
||||
|
||||
return frappe.db.sql("""select tabItem.name, tabItem.item_group,
|
||||
if(length(tabItem.item_name) > 40,
|
||||
concat(substr(tabItem.item_name, 1, 40), "..."), item_name) as item_name,
|
||||
if(length(tabItem.description) > 40, \
|
||||
@@ -166,7 +171,7 @@ def item_query(doctype, txt, searchfield, start, page_len, filters, as_dict=Fals
|
||||
or tabItem.item_group LIKE %(txt)s
|
||||
or tabItem.item_name LIKE %(txt)s
|
||||
or tabItem.barcode LIKE %(txt)s
|
||||
or tabItem.description LIKE %(txt)s)
|
||||
{description_cond})
|
||||
{fcond} {mcond}
|
||||
order by
|
||||
if(locate(%(_txt)s, name), locate(%(_txt)s, name), 99999),
|
||||
@@ -176,7 +181,8 @@ def item_query(doctype, txt, searchfield, start, page_len, filters, as_dict=Fals
|
||||
limit %(start)s, %(page_len)s """.format(
|
||||
key=searchfield,
|
||||
fcond=get_filters_cond(doctype, filters, conditions).replace('%', '%%'),
|
||||
mcond=get_match_cond(doctype).replace('%', '%%')),
|
||||
mcond=get_match_cond(doctype).replace('%', '%%'),
|
||||
description_cond = description_cond),
|
||||
{
|
||||
"today": nowdate(),
|
||||
"txt": "%%%s%%" % txt,
|
||||
@@ -257,7 +263,7 @@ def get_delivery_notes_to_be_billed(doctype, txt, searchfield, start, page_len,
|
||||
def get_batch_no(doctype, txt, searchfield, start, page_len, filters):
|
||||
cond = ""
|
||||
if filters.get("posting_date"):
|
||||
cond = "and (ifnull(batch.expiry_date, '')='' or batch.expiry_date >= %(posting_date)s)"
|
||||
cond = "and (batch.expiry_date is null or batch.expiry_date >= %(posting_date)s)"
|
||||
|
||||
batch_nos = None
|
||||
args = {
|
||||
|
||||
@@ -53,8 +53,9 @@ def validate_returned_items(doc):
|
||||
|
||||
valid_items = frappe._dict()
|
||||
|
||||
select_fields = "item_code, qty, rate, parenttype" if doc.doctype=="Purchase Invoice" \
|
||||
else "item_code, qty, rate, serial_no, batch_no, parenttype"
|
||||
select_fields = "item_code, qty, stock_qty, rate, parenttype, conversion_factor"
|
||||
if doc.doctype != 'Purchase Invoice':
|
||||
select_fields += ",serial_no, batch_no"
|
||||
|
||||
if doc.doctype in ['Purchase Invoice', 'Purchase Receipt']:
|
||||
select_fields += ",rejected_qty, received_qty"
|
||||
@@ -111,7 +112,7 @@ def validate_returned_items(doc):
|
||||
frappe.throw(_("Atleast one item should be entered with negative quantity in return document"))
|
||||
|
||||
def validate_quantity(doc, args, ref, valid_items, already_returned_items):
|
||||
fields = ['qty']
|
||||
fields = ['stock_qty']
|
||||
if doc.doctype in ['Purchase Receipt', 'Purchase Invoice']:
|
||||
fields.extend(['received_qty', 'rejected_qty'])
|
||||
|
||||
@@ -119,16 +120,19 @@ def validate_quantity(doc, args, ref, valid_items, already_returned_items):
|
||||
|
||||
for column in fields:
|
||||
returned_qty = flt(already_returned_data.get(column, 0)) if len(already_returned_data) > 0 else 0
|
||||
reference_qty = ref.get(column)
|
||||
reference_qty = (ref.get(column) if column == 'stock_qty'
|
||||
else ref.get(column) * ref.get("conversion_factor", 1.0))
|
||||
|
||||
max_returnable_qty = flt(reference_qty) - returned_qty
|
||||
label = column.replace('_', ' ').title()
|
||||
|
||||
if reference_qty:
|
||||
if flt(args.get(column)) > 0:
|
||||
frappe.throw(_("{0} must be negative in return document").format(label))
|
||||
elif returned_qty >= reference_qty and args.get(column):
|
||||
frappe.throw(_("Item {0} has already been returned")
|
||||
.format(args.item_code), StockOverReturnError)
|
||||
elif abs(args.get(column)) > max_returnable_qty:
|
||||
elif (abs(args.get(column)) * args.get("conversion_factor", 1.0)) > max_returnable_qty:
|
||||
frappe.throw(_("Row # {0}: Cannot return more than {1} for Item {2}")
|
||||
.format(args.idx, reference_qty, args.item_code), StockOverReturnError)
|
||||
|
||||
@@ -138,6 +142,7 @@ def get_ref_item_dict(valid_items, ref_item_row):
|
||||
valid_items.setdefault(ref_item_row.item_code, frappe._dict({
|
||||
"qty": 0,
|
||||
"rate": 0,
|
||||
"stock_qty": 0,
|
||||
"rejected_qty": 0,
|
||||
"received_qty": 0,
|
||||
"serial_no": [],
|
||||
@@ -145,6 +150,7 @@ def get_ref_item_dict(valid_items, ref_item_row):
|
||||
}))
|
||||
item_dict = valid_items[ref_item_row.item_code]
|
||||
item_dict["qty"] += ref_item_row.qty
|
||||
item_dict["stock_qty"] += ref_item_row.get('stock_qty', 0)
|
||||
if ref_item_row.get("rate", 0) > item_dict["rate"]:
|
||||
item_dict["rate"] = ref_item_row.get("rate", 0)
|
||||
|
||||
@@ -161,9 +167,10 @@ def get_ref_item_dict(valid_items, ref_item_row):
|
||||
return valid_items
|
||||
|
||||
def get_already_returned_items(doc):
|
||||
column = 'child.item_code, sum(abs(child.qty)) as qty'
|
||||
column = 'child.item_code, sum(abs(child.qty)) as qty, sum(abs(child.stock_qty)) as stock_qty'
|
||||
if doc.doctype in ['Purchase Invoice', 'Purchase Receipt']:
|
||||
column += ', sum(abs(child.rejected_qty)) as rejected_qty, sum(abs(child.received_qty)) as received_qty'
|
||||
column += """, sum(abs(child.rejected_qty) * child.conversion_factor) as rejected_qty,
|
||||
sum(abs(child.received_qty) * child.conversion_factor) as received_qty"""
|
||||
|
||||
data = frappe.db.sql("""
|
||||
select {0}
|
||||
@@ -180,6 +187,7 @@ def get_already_returned_items(doc):
|
||||
for d in data:
|
||||
items.setdefault(d.item_code, frappe._dict({
|
||||
"qty": d.get("qty"),
|
||||
"stock_qty": d.get("stock_qty"),
|
||||
"received_qty": d.get("received_qty"),
|
||||
"rejected_qty": d.get("rejected_qty")
|
||||
}))
|
||||
@@ -231,6 +239,7 @@ def make_return_doc(doctype, source_name, target_doc=None):
|
||||
target_doc.received_qty = -1* source_doc.received_qty
|
||||
target_doc.rejected_qty = -1* source_doc.rejected_qty
|
||||
target_doc.qty = -1* source_doc.qty
|
||||
target_doc.stock_qty = -1 * source_doc.stock_qty
|
||||
target_doc.purchase_order = source_doc.purchase_order
|
||||
target_doc.purchase_order_item = source_doc.purchase_order_item
|
||||
target_doc.rejected_warehouse = source_doc.rejected_warehouse
|
||||
@@ -238,6 +247,7 @@ def make_return_doc(doctype, source_name, target_doc=None):
|
||||
target_doc.received_qty = -1* source_doc.received_qty
|
||||
target_doc.rejected_qty = -1* source_doc.rejected_qty
|
||||
target_doc.qty = -1* source_doc.qty
|
||||
target_doc.stock_qty = -1 * source_doc.stock_qty
|
||||
target_doc.purchase_order = source_doc.purchase_order
|
||||
target_doc.purchase_receipt = source_doc.purchase_receipt
|
||||
target_doc.rejected_warehouse = source_doc.rejected_warehouse
|
||||
|
||||
@@ -38,6 +38,7 @@ class SellingController(StockController):
|
||||
self.validate_max_discount()
|
||||
self.validate_selling_price()
|
||||
self.set_qty_as_per_stock_uom()
|
||||
self.set_po_nos()
|
||||
check_active_sales_items(self)
|
||||
|
||||
def set_missing_values(self, for_validate=False):
|
||||
@@ -150,6 +151,9 @@ class SellingController(StockController):
|
||||
if not frappe.db.get_single_value("Selling Settings", "validate_selling_price"):
|
||||
return
|
||||
|
||||
if hasattr(self, "is_return") and self.is_return:
|
||||
return
|
||||
|
||||
for it in self.get("items"):
|
||||
if not it.item_code:
|
||||
continue
|
||||
@@ -323,9 +327,16 @@ class SellingController(StockController):
|
||||
"actual_qty": -1*flt(d.qty),
|
||||
"incoming_rate": return_rate
|
||||
}))
|
||||
|
||||
self.make_sl_entries(sl_entries)
|
||||
|
||||
def set_po_nos(self):
|
||||
if self.doctype in ("Delivery Note", "Sales Invoice") and hasattr(self, "items"):
|
||||
ref_fieldname = "against_sales_order" if self.doctype == "Delivery Note" else "sales_order"
|
||||
sales_orders = list(set([d.get(ref_fieldname) for d in self.items if d.get(ref_fieldname)]))
|
||||
if sales_orders:
|
||||
po_nos = frappe.get_all('Sales Order', 'po_no', filters = {'name': ('in', sales_orders)})
|
||||
self.po_no = ', '.join(list(set([d.po_no for d in po_nos if d.po_no])))
|
||||
|
||||
def check_active_sales_items(obj):
|
||||
for d in obj.get("items"):
|
||||
if d.item_code:
|
||||
|
||||
@@ -156,6 +156,9 @@ class StatusUpdater(Document):
|
||||
|
||||
# get unique transactions to update
|
||||
for d in self.get_all_children():
|
||||
if hasattr(d, 'qty') and d.qty < 0 and not self.get('is_return'):
|
||||
frappe.throw(_("For an item {0}, quantity must be positive number").format(d.item_code))
|
||||
|
||||
if d.doctype == args['source_dt'] and d.get(args["join_field"]):
|
||||
args['name'] = d.get(args['join_field'])
|
||||
|
||||
@@ -250,7 +253,7 @@ class StatusUpdater(Document):
|
||||
|
||||
if args['detail_id']:
|
||||
if not args.get("extra_cond"): args["extra_cond"] = ""
|
||||
|
||||
|
||||
frappe.db.sql("""update `tab%(target_dt)s`
|
||||
set %(target_field)s = (
|
||||
(select ifnull(sum(%(source_field)s), 0)
|
||||
@@ -275,14 +278,14 @@ class StatusUpdater(Document):
|
||||
"""Update percent field in parent transaction"""
|
||||
|
||||
self._update_modified(args, update_modified)
|
||||
|
||||
|
||||
if args.get('target_parent_field'):
|
||||
frappe.db.sql("""update `tab%(target_parent_dt)s`
|
||||
set %(target_parent_field)s = round(
|
||||
ifnull((select
|
||||
ifnull(sum(if(%(target_ref_field)s > %(target_field)s, abs(%(target_field)s), abs(%(target_ref_field)s))), 0)
|
||||
/ sum(abs(%(target_ref_field)s)) * 100
|
||||
from `tab%(target_dt)s` where parent="%(name)s"), 0), 2)
|
||||
from `tab%(target_dt)s` where parent="%(name)s" having sum(abs(%(target_ref_field)s)) > 0), 0), 6)
|
||||
%(update_modified)s
|
||||
where name='%(name)s'""" % args)
|
||||
|
||||
@@ -290,7 +293,7 @@ class StatusUpdater(Document):
|
||||
if args.get('status_field'):
|
||||
frappe.db.sql("""update `tab%(target_parent_dt)s`
|
||||
set %(status_field)s = if(%(target_parent_field)s<0.001,
|
||||
'Not %(keyword)s', if(%(target_parent_field)s>=99.99,
|
||||
'Not %(keyword)s', if(%(target_parent_field)s>=99.999999,
|
||||
'Fully %(keyword)s', 'Partly %(keyword)s'))
|
||||
where name='%(name)s'""" % args)
|
||||
|
||||
|
||||
@@ -252,7 +252,7 @@ class StockController(AccountsController):
|
||||
"company": self.company,
|
||||
"batch_no": cstr(d.get("batch_no")).strip(),
|
||||
"serial_no": d.get("serial_no"),
|
||||
"project": d.get("project"),
|
||||
"project": d.get("project") or self.get('project'),
|
||||
"is_cancelled": self.docstatus==2 and "Yes" or "No"
|
||||
})
|
||||
|
||||
|
||||
@@ -415,13 +415,15 @@ class calculate_taxes_and_totals(object):
|
||||
|
||||
self.doc.total_advance = flt(total_allocated_amount, self.doc.precision("total_advance"))
|
||||
|
||||
grand_total = self.doc.rounded_total or self.doc.grand_total
|
||||
|
||||
if self.doc.party_account_currency == self.doc.currency:
|
||||
invoice_total = flt(self.doc.grand_total - flt(self.doc.write_off_amount),
|
||||
invoice_total = flt(grand_total - flt(self.doc.write_off_amount),
|
||||
self.doc.precision("grand_total"))
|
||||
else:
|
||||
base_write_off_amount = flt(flt(self.doc.write_off_amount) * self.doc.conversion_rate,
|
||||
self.doc.precision("base_write_off_amount"))
|
||||
invoice_total = flt(self.doc.grand_total * self.doc.conversion_rate,
|
||||
invoice_total = flt(grand_total * self.doc.conversion_rate,
|
||||
self.doc.precision("grand_total")) - base_write_off_amount
|
||||
|
||||
if invoice_total > 0 and self.doc.total_advance > invoice_total:
|
||||
@@ -491,11 +493,13 @@ class calculate_taxes_and_totals(object):
|
||||
if self.doc.doctype == "Sales Invoice" \
|
||||
and self.doc.paid_amount > self.doc.grand_total and not self.doc.is_return \
|
||||
and any([d.type == "Cash" for d in self.doc.payments]):
|
||||
grand_total = self.doc.rounded_total or self.doc.grand_total
|
||||
base_grand_total = self.doc.base_rounded_total or self.doc.base_grand_total
|
||||
|
||||
self.doc.change_amount = flt(self.doc.paid_amount - self.doc.grand_total +
|
||||
self.doc.change_amount = flt(self.doc.paid_amount - grand_total +
|
||||
self.doc.write_off_amount, self.doc.precision("change_amount"))
|
||||
|
||||
self.doc.base_change_amount = flt(self.doc.base_paid_amount - self.doc.base_grand_total +
|
||||
self.doc.base_change_amount = flt(self.doc.base_paid_amount - base_grand_total +
|
||||
self.doc.base_write_off_amount, self.doc.precision("base_change_amount"))
|
||||
|
||||
def calculate_write_off_amount(self):
|
||||
|
||||
@@ -20,6 +20,10 @@ frappe.ui.form.on("Opportunity", {
|
||||
frm.trigger('set_contact_link');
|
||||
},
|
||||
|
||||
with_items: function(frm) {
|
||||
frm.trigger('toggle_mandatory');
|
||||
},
|
||||
|
||||
customer_address: function(frm, cdt, cdn) {
|
||||
erpnext.utils.get_address_display(frm, 'customer_address', 'address_display', false);
|
||||
},
|
||||
@@ -35,6 +39,7 @@ frappe.ui.form.on("Opportunity", {
|
||||
var doc = frm.doc;
|
||||
frm.events.enquiry_from(frm);
|
||||
frm.trigger('set_contact_link');
|
||||
frm.trigger('toggle_mandatory');
|
||||
erpnext.toggle_naming_series();
|
||||
|
||||
if(!doc.__islocal && doc.status!=="Lost") {
|
||||
@@ -84,6 +89,10 @@ frappe.ui.form.on("Opportunity", {
|
||||
method: "erpnext.crm.doctype.opportunity.opportunity.make_supplier_quotation",
|
||||
frm: cur_frm
|
||||
})
|
||||
},
|
||||
|
||||
toggle_mandatory: function(frm) {
|
||||
frm.toggle_reqd("items", frm.doc.with_items ? 1:0);
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@@ -65,7 +65,6 @@
|
||||
"taxes": [],
|
||||
"thumbnail": null,
|
||||
"tolerance": 0.0,
|
||||
"total_projected_qty": 0.0,
|
||||
"uoms": [
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
@@ -151,7 +150,6 @@
|
||||
"taxes": [],
|
||||
"thumbnail": null,
|
||||
"tolerance": 0.0,
|
||||
"total_projected_qty": 0.0,
|
||||
"uoms": [
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
@@ -237,7 +235,6 @@
|
||||
"taxes": [],
|
||||
"thumbnail": null,
|
||||
"tolerance": 0.0,
|
||||
"total_projected_qty": 0.0,
|
||||
"uoms": [
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
@@ -323,7 +320,6 @@
|
||||
"taxes": [],
|
||||
"thumbnail": null,
|
||||
"tolerance": 0.0,
|
||||
"total_projected_qty": 0.0,
|
||||
"uoms": [
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
@@ -409,7 +405,6 @@
|
||||
"taxes": [],
|
||||
"thumbnail": null,
|
||||
"tolerance": 0.0,
|
||||
"total_projected_qty": 0.0,
|
||||
"uoms": [
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
@@ -495,7 +490,6 @@
|
||||
"taxes": [],
|
||||
"thumbnail": null,
|
||||
"tolerance": 0.0,
|
||||
"total_projected_qty": 0.0,
|
||||
"uoms": [
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
@@ -581,7 +575,6 @@
|
||||
"taxes": [],
|
||||
"thumbnail": null,
|
||||
"tolerance": 0.0,
|
||||
"total_projected_qty": 0.0,
|
||||
"uoms": [
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
@@ -667,7 +660,6 @@
|
||||
"taxes": [],
|
||||
"thumbnail": null,
|
||||
"tolerance": 0.0,
|
||||
"total_projected_qty": 0.0,
|
||||
"uoms": [
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
@@ -753,7 +745,6 @@
|
||||
"taxes": [],
|
||||
"thumbnail": null,
|
||||
"tolerance": 0.0,
|
||||
"total_projected_qty": 0.0,
|
||||
"uoms": [
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
@@ -839,7 +830,6 @@
|
||||
"taxes": [],
|
||||
"thumbnail": null,
|
||||
"tolerance": 0.0,
|
||||
"total_projected_qty": 0.0,
|
||||
"uoms": [
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
@@ -925,7 +915,6 @@
|
||||
"taxes": [],
|
||||
"thumbnail": null,
|
||||
"tolerance": 0.0,
|
||||
"total_projected_qty": 0.0,
|
||||
"uoms": [
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
@@ -1011,7 +1000,6 @@
|
||||
"taxes": [],
|
||||
"thumbnail": null,
|
||||
"tolerance": 0.0,
|
||||
"total_projected_qty": 0.0,
|
||||
"uoms": [
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
@@ -1097,7 +1085,6 @@
|
||||
"taxes": [],
|
||||
"thumbnail": null,
|
||||
"tolerance": 0.0,
|
||||
"total_projected_qty": 0.0,
|
||||
"uoms": [
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
@@ -1183,7 +1170,6 @@
|
||||
"taxes": [],
|
||||
"thumbnail": null,
|
||||
"tolerance": 0.0,
|
||||
"total_projected_qty": 0.0,
|
||||
"uoms": [
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
@@ -1269,7 +1255,6 @@
|
||||
"taxes": [],
|
||||
"thumbnail": null,
|
||||
"tolerance": 0.0,
|
||||
"total_projected_qty": 0.0,
|
||||
"uoms": [
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
@@ -1355,7 +1340,6 @@
|
||||
"taxes": [],
|
||||
"thumbnail": null,
|
||||
"tolerance": 0.0,
|
||||
"total_projected_qty": 0.0,
|
||||
"uoms": [
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
@@ -1441,7 +1425,6 @@
|
||||
"taxes": [],
|
||||
"thumbnail": null,
|
||||
"tolerance": 0.0,
|
||||
"total_projected_qty": 0.0,
|
||||
"uoms": [
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
@@ -1527,7 +1510,6 @@
|
||||
"taxes": [],
|
||||
"thumbnail": null,
|
||||
"tolerance": 0.0,
|
||||
"total_projected_qty": 0.0,
|
||||
"uoms": [
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
@@ -1613,7 +1595,6 @@
|
||||
"taxes": [],
|
||||
"thumbnail": null,
|
||||
"tolerance": 0.0,
|
||||
"total_projected_qty": 0.0,
|
||||
"uoms": [
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
@@ -1699,7 +1680,6 @@
|
||||
"taxes": [],
|
||||
"thumbnail": null,
|
||||
"tolerance": 0.0,
|
||||
"total_projected_qty": 0.0,
|
||||
"uoms": [
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
@@ -1785,7 +1765,6 @@
|
||||
"taxes": [],
|
||||
"thumbnail": null,
|
||||
"tolerance": 0.0,
|
||||
"total_projected_qty": 0.0,
|
||||
"uoms": [
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
@@ -1871,7 +1850,6 @@
|
||||
"taxes": [],
|
||||
"thumbnail": null,
|
||||
"tolerance": 0.0,
|
||||
"total_projected_qty": 0.0,
|
||||
"uoms": [
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
@@ -1957,7 +1935,6 @@
|
||||
"taxes": [],
|
||||
"thumbnail": null,
|
||||
"tolerance": 0.0,
|
||||
"total_projected_qty": 0.0,
|
||||
"uoms": [
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
@@ -2043,7 +2020,6 @@
|
||||
"taxes": [],
|
||||
"thumbnail": null,
|
||||
"tolerance": 0.0,
|
||||
"total_projected_qty": 0.0,
|
||||
"uoms": [
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
@@ -2129,7 +2105,6 @@
|
||||
"taxes": [],
|
||||
"thumbnail": null,
|
||||
"tolerance": 0.0,
|
||||
"total_projected_qty": 0.0,
|
||||
"uoms": [
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
@@ -2215,7 +2190,6 @@
|
||||
"taxes": [],
|
||||
"thumbnail": null,
|
||||
"tolerance": 0.0,
|
||||
"total_projected_qty": 0.0,
|
||||
"uoms": [
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
@@ -2301,7 +2275,6 @@
|
||||
"taxes": [],
|
||||
"thumbnail": null,
|
||||
"tolerance": 0.0,
|
||||
"total_projected_qty": 0.0,
|
||||
"uoms": [
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
@@ -2387,7 +2360,6 @@
|
||||
"taxes": [],
|
||||
"thumbnail": null,
|
||||
"tolerance": 0.0,
|
||||
"total_projected_qty": 0.0,
|
||||
"uoms": [
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
@@ -2473,7 +2445,6 @@
|
||||
"taxes": [],
|
||||
"thumbnail": null,
|
||||
"tolerance": 0.0,
|
||||
"total_projected_qty": 0.0,
|
||||
"uoms": [
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
@@ -2559,7 +2530,6 @@
|
||||
"taxes": [],
|
||||
"thumbnail": null,
|
||||
"tolerance": 0.0,
|
||||
"total_projected_qty": 0.0,
|
||||
"uoms": [
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
@@ -2645,7 +2615,6 @@
|
||||
"taxes": [],
|
||||
"thumbnail": null,
|
||||
"tolerance": 0.0,
|
||||
"total_projected_qty": 0.0,
|
||||
"uoms": [
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
@@ -2731,7 +2700,6 @@
|
||||
"taxes": [],
|
||||
"thumbnail": null,
|
||||
"tolerance": 0.0,
|
||||
"total_projected_qty": 0.0,
|
||||
"uoms": [
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
@@ -2817,7 +2785,6 @@
|
||||
"taxes": [],
|
||||
"thumbnail": null,
|
||||
"tolerance": 0.0,
|
||||
"total_projected_qty": 0.0,
|
||||
"uoms": [
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
@@ -2903,7 +2870,6 @@
|
||||
"taxes": [],
|
||||
"thumbnail": null,
|
||||
"tolerance": 0.0,
|
||||
"total_projected_qty": 0.0,
|
||||
"uoms": [
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
@@ -2989,7 +2955,6 @@
|
||||
"taxes": [],
|
||||
"thumbnail": null,
|
||||
"tolerance": 0.0,
|
||||
"total_projected_qty": 0.0,
|
||||
"uoms": [
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
@@ -3075,7 +3040,6 @@
|
||||
"taxes": [],
|
||||
"thumbnail": null,
|
||||
"tolerance": 0.0,
|
||||
"total_projected_qty": 0.0,
|
||||
"uoms": [
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
@@ -3161,7 +3125,6 @@
|
||||
"taxes": [],
|
||||
"thumbnail": null,
|
||||
"tolerance": 0.0,
|
||||
"total_projected_qty": 0.0,
|
||||
"uoms": [
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
@@ -3247,7 +3210,6 @@
|
||||
"taxes": [],
|
||||
"thumbnail": null,
|
||||
"tolerance": 0.0,
|
||||
"total_projected_qty": 0.0,
|
||||
"uoms": [
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
@@ -3333,7 +3295,6 @@
|
||||
"taxes": [],
|
||||
"thumbnail": null,
|
||||
"tolerance": 0.0,
|
||||
"total_projected_qty": 0.0,
|
||||
"uoms": [
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
@@ -3419,7 +3380,6 @@
|
||||
"taxes": [],
|
||||
"thumbnail": null,
|
||||
"tolerance": 0.0,
|
||||
"total_projected_qty": 0.0,
|
||||
"uoms": [
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
@@ -3505,7 +3465,6 @@
|
||||
"taxes": [],
|
||||
"thumbnail": null,
|
||||
"tolerance": 0.0,
|
||||
"total_projected_qty": 0.0,
|
||||
"uoms": [
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
@@ -3591,7 +3550,6 @@
|
||||
"taxes": [],
|
||||
"thumbnail": null,
|
||||
"tolerance": 0.0,
|
||||
"total_projected_qty": 0.0,
|
||||
"uoms": [
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
@@ -3677,7 +3635,6 @@
|
||||
"taxes": [],
|
||||
"thumbnail": null,
|
||||
"tolerance": 0.0,
|
||||
"total_projected_qty": 0.0,
|
||||
"uoms": [
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
@@ -3763,7 +3720,6 @@
|
||||
"taxes": [],
|
||||
"thumbnail": null,
|
||||
"tolerance": 0.0,
|
||||
"total_projected_qty": 0.0,
|
||||
"uoms": [
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
@@ -3849,7 +3805,6 @@
|
||||
"taxes": [],
|
||||
"thumbnail": null,
|
||||
"tolerance": 0.0,
|
||||
"total_projected_qty": 0.0,
|
||||
"uoms": [
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
@@ -3935,7 +3890,6 @@
|
||||
"taxes": [],
|
||||
"thumbnail": null,
|
||||
"tolerance": 0.0,
|
||||
"total_projected_qty": 0.0,
|
||||
"uoms": [
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
@@ -4021,7 +3975,6 @@
|
||||
"taxes": [],
|
||||
"thumbnail": null,
|
||||
"tolerance": 0.0,
|
||||
"total_projected_qty": 0.0,
|
||||
"uoms": [
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
@@ -4107,7 +4060,6 @@
|
||||
"taxes": [],
|
||||
"thumbnail": null,
|
||||
"tolerance": 0.0,
|
||||
"total_projected_qty": 0.0,
|
||||
"uoms": [
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
@@ -4193,7 +4145,6 @@
|
||||
"taxes": [],
|
||||
"thumbnail": null,
|
||||
"tolerance": 0.0,
|
||||
"total_projected_qty": 0.0,
|
||||
"uoms": [
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
@@ -4279,7 +4230,6 @@
|
||||
"taxes": [],
|
||||
"thumbnail": null,
|
||||
"tolerance": 0.0,
|
||||
"total_projected_qty": 0.0,
|
||||
"uoms": [
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
@@ -4365,7 +4315,6 @@
|
||||
"taxes": [],
|
||||
"thumbnail": null,
|
||||
"tolerance": 0.0,
|
||||
"total_projected_qty": 0.0,
|
||||
"uoms": [
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
@@ -4451,7 +4400,6 @@
|
||||
"taxes": [],
|
||||
"thumbnail": null,
|
||||
"tolerance": 0.0,
|
||||
"total_projected_qty": 0.0,
|
||||
"uoms": [
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
@@ -4537,7 +4485,6 @@
|
||||
"taxes": [],
|
||||
"thumbnail": null,
|
||||
"tolerance": 0.0,
|
||||
"total_projected_qty": 0.0,
|
||||
"uoms": [
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
@@ -4623,7 +4570,6 @@
|
||||
"taxes": [],
|
||||
"thumbnail": null,
|
||||
"tolerance": 0.0,
|
||||
"total_projected_qty": 0.0,
|
||||
"uoms": [
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
@@ -4709,7 +4655,6 @@
|
||||
"taxes": [],
|
||||
"thumbnail": null,
|
||||
"tolerance": 0.0,
|
||||
"total_projected_qty": 0.0,
|
||||
"uoms": [
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
@@ -4795,7 +4740,6 @@
|
||||
"taxes": [],
|
||||
"thumbnail": null,
|
||||
"tolerance": 0.0,
|
||||
"total_projected_qty": 0.0,
|
||||
"uoms": [
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
@@ -4881,7 +4825,6 @@
|
||||
"taxes": [],
|
||||
"thumbnail": null,
|
||||
"tolerance": 0.0,
|
||||
"total_projected_qty": 0.0,
|
||||
"uoms": [
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
@@ -4967,7 +4910,6 @@
|
||||
"taxes": [],
|
||||
"thumbnail": null,
|
||||
"tolerance": 0.0,
|
||||
"total_projected_qty": 0.0,
|
||||
"uoms": [
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
@@ -5053,7 +4995,6 @@
|
||||
"taxes": [],
|
||||
"thumbnail": null,
|
||||
"tolerance": 0.0,
|
||||
"total_projected_qty": 0.0,
|
||||
"uoms": [
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
@@ -5139,7 +5080,6 @@
|
||||
"taxes": [],
|
||||
"thumbnail": null,
|
||||
"tolerance": 0.0,
|
||||
"total_projected_qty": 0.0,
|
||||
"uoms": [
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
@@ -5225,7 +5165,6 @@
|
||||
"taxes": [],
|
||||
"thumbnail": null,
|
||||
"tolerance": 0.0,
|
||||
"total_projected_qty": 0.0,
|
||||
"uoms": [
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
@@ -5311,7 +5250,6 @@
|
||||
"taxes": [],
|
||||
"thumbnail": null,
|
||||
"tolerance": 0.0,
|
||||
"total_projected_qty": 0.0,
|
||||
"uoms": [
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
@@ -5397,7 +5335,6 @@
|
||||
"taxes": [],
|
||||
"thumbnail": null,
|
||||
"tolerance": 0.0,
|
||||
"total_projected_qty": 0.0,
|
||||
"uoms": [
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
|
||||
@@ -34,14 +34,14 @@ def work():
|
||||
payroll_entry.salary_slip_based_on_timesheet = 0
|
||||
payroll_entry.create_salary_slips()
|
||||
payroll_entry.submit_salary_slips()
|
||||
payroll_entry.make_accural_jv_entry()
|
||||
payroll_entry.make_accrual_jv_entry()
|
||||
# payroll_entry.make_journal_entry(reference_date=frappe.flags.current_date,
|
||||
# reference_number=random_string(10))
|
||||
|
||||
payroll_entry.salary_slip_based_on_timesheet = 1
|
||||
payroll_entry.create_salary_slips()
|
||||
payroll_entry.submit_salary_slips()
|
||||
payroll_entry.make_accural_jv_entry()
|
||||
payroll_entry.make_accrual_jv_entry()
|
||||
# payroll_entry.make_journal_entry(reference_date=frappe.flags.current_date,
|
||||
# reference_number=random_string(10))
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ In the document, you can select multiple Purchase Receipts and fetch all items f
|
||||
|
||||
<img class="screenshot" alt="Landed Cost Vouher" src="/docs/assets/img/stock/landed-cost.png">
|
||||
|
||||
### What happend on submission?
|
||||
### What happens on submission?
|
||||
|
||||
1. On submission of Landed Cost Voucher, the applicable landed cost charges are updated in Purchase Receipt Item table.
|
||||
|
||||
|
||||
@@ -269,7 +269,10 @@ def get_grade(grading_scale, percentage):
|
||||
:param Percentage: Score Percentage Percentage
|
||||
"""
|
||||
grading_scale_intervals = {}
|
||||
for d in frappe.get_all("Grading Scale Interval", fields=["grade_code", "threshold"], filters={"parent": grading_scale}):
|
||||
if not hasattr(frappe.local, 'grading_scale'):
|
||||
grading_scale = frappe.get_all("Grading Scale Interval", fields=["grade_code", "threshold"], filters={"parent": grading_scale})
|
||||
frappe.local.grading_scale = grading_scale
|
||||
for d in frappe.local.grading_scale:
|
||||
grading_scale_intervals.update({d.threshold:d.grade_code})
|
||||
intervals = sorted(grading_scale_intervals.keys(), key=float, reverse=True)
|
||||
for interval in intervals:
|
||||
|
||||
@@ -6,5 +6,9 @@ from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe.model.document import Document
|
||||
|
||||
STD_CRITERIA = ["total", "total score", "total grade", "maximum score", "score", "grade"]
|
||||
|
||||
class AssessmentCriteria(Document):
|
||||
pass
|
||||
def validate(self):
|
||||
if self.assessment_criteria.lower() in STD_CRITERIA:
|
||||
frappe.throw("Can't create standard criteria. Please rename the criteria")
|
||||
@@ -38,9 +38,6 @@ frappe.ui.form.on('Fee Schedule', {
|
||||
if (data.reload && data.reload === 1) {
|
||||
frm.reload_doc();
|
||||
}
|
||||
if (data.progress && data.progress === "0") {
|
||||
frappe.msgprint(__("Fee records will be created in the background. In case of any error the error message will be updated in the Schedule."));
|
||||
}
|
||||
if (data.progress) {
|
||||
let progress_bar = $(cur_frm.dashboard.progress_area).find(".progress-bar");
|
||||
if (progress_bar) {
|
||||
@@ -74,6 +71,15 @@ frappe.ui.form.on('Fee Schedule', {
|
||||
});
|
||||
}, "fa fa-play", "btn-success");
|
||||
}
|
||||
if (frm.doc.fee_creation_status == "Successful") {
|
||||
frm.add_custom_button(__("View Fees Records"), function() {
|
||||
frappe.route_options = {
|
||||
fee_schedule: frm.doc.name
|
||||
};
|
||||
frappe.set_route("List", "Fees");
|
||||
});
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
fee_structure: function(frm) {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"allow_import": 1,
|
||||
"allow_rename": 0,
|
||||
"autoname": "naming_series:",
|
||||
"beta": 1,
|
||||
"beta": 0,
|
||||
"creation": "2017-07-18 15:21:21.527136",
|
||||
"custom": 0,
|
||||
"docstatus": 0,
|
||||
@@ -1029,7 +1029,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2017-12-04 13:08:27.727709",
|
||||
"modified": "2018-02-26 13:59:36.560780",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Education",
|
||||
"name": "Fee Schedule",
|
||||
|
||||
@@ -56,8 +56,15 @@ class FeeSchedule(Document):
|
||||
self.db_set("fee_creation_status", "In Process")
|
||||
frappe.publish_realtime("fee_schedule_progress",
|
||||
{"progress": "0", "reload": 1}, user=frappe.session.user)
|
||||
enqueue(generate_fee, queue='default', timeout=6000, event='generate_fee',
|
||||
fee_schedule=self.name)
|
||||
|
||||
total_records = sum([int(d.total_students) for d in self.student_groups])
|
||||
if total_records > 10:
|
||||
frappe.msgprint(_('''Fee records will be created in the background.
|
||||
In case of any error the error message will be updated in the Schedule.'''))
|
||||
enqueue(generate_fee, queue='default', timeout=6000, event='generate_fee',
|
||||
fee_schedule=self.name)
|
||||
else:
|
||||
generate_fee(self.name)
|
||||
|
||||
def generate_fee(fee_schedule):
|
||||
doc = frappe.get_doc("Fee Schedule", fee_schedule)
|
||||
@@ -69,10 +76,7 @@ def generate_fee(fee_schedule):
|
||||
frappe.throw(_("Please setup Students under Student Groups"))
|
||||
|
||||
for d in doc.student_groups:
|
||||
students = frappe.db.sql(""" select sg.program, sg.batch, sgs.student, sgs.student_name
|
||||
from `tabStudent Group` sg, `tabStudent Group Student` sgs
|
||||
where sg.name=%s and sg.name=sgs.parent and sgs.active=1""", d.student_group, as_dict=1)
|
||||
|
||||
students = get_students(d.student_group, doc.academic_year, doc.academic_term, doc.student_category)
|
||||
for student in students:
|
||||
try:
|
||||
fees_doc = get_mapped_doc("Fee Schedule", fee_schedule, {
|
||||
@@ -86,7 +90,7 @@ def generate_fee(fee_schedule):
|
||||
fees_doc.student = student.student
|
||||
fees_doc.student_name = student.student_name
|
||||
fees_doc.program = student.program
|
||||
fees_doc.student_batch = student.batch
|
||||
fees_doc.student_batch = student.student_batch_name
|
||||
fees_doc.send_payment_request = doc.send_email
|
||||
fees_doc.save()
|
||||
fees_doc.submit()
|
||||
@@ -110,6 +114,30 @@ def generate_fee(fee_schedule):
|
||||
{"progress": "100", "reload": 1}, user=frappe.session.user)
|
||||
|
||||
|
||||
def get_students(student_group, academic_year, academic_term=None, student_category=None):
|
||||
conditions = ""
|
||||
if student_category:
|
||||
conditions = " and pe.student_category='{}'".format(frappe.db.escape(student_category))
|
||||
if academic_term:
|
||||
conditions = " and pe.academic_term='{}'".format(frappe.db.escape(academic_term))
|
||||
|
||||
students = frappe.db.sql("""
|
||||
select pe.student, pe.student_name, pe.program, pe.student_batch_name
|
||||
from `tabStudent Group Student` sgs, `tabProgram Enrollment` pe
|
||||
where
|
||||
pe.student = sgs.student and pe.academic_year = %s
|
||||
and sgs.parent = %s and sgs.active = 1
|
||||
{conditions}
|
||||
""".format(conditions=conditions), (academic_year, student_group), as_dict=1)
|
||||
return students
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_total_students(student_group, academic_year, academic_term=None, student_category=None):
|
||||
total_students = get_students(student_group, academic_year, academic_term, student_category)
|
||||
return len(total_students)
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_fee_structure(source_name,target_doc=None):
|
||||
fee_request = get_mapped_doc("Fee Structure", source_name,
|
||||
@@ -117,23 +145,3 @@ def get_fee_structure(source_name,target_doc=None):
|
||||
"doctype": "Fee Schedule"
|
||||
}}, ignore_permissions=True)
|
||||
return fee_request
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_total_students(student_group, academic_year, academic_term=None, student_category=None):
|
||||
conditions = ""
|
||||
if student_category:
|
||||
conditions = " and pe.student_category='{}'".format(frappe.db.escape(student_category))
|
||||
if academic_term:
|
||||
conditions = " and pe.academic_term='{}'".format(frappe.db.escape(academic_term))
|
||||
|
||||
|
||||
return frappe.db.sql("""
|
||||
select count(pe.name)
|
||||
from `tabStudent Group Student` sgs, `tabProgram Enrollment` pe
|
||||
where
|
||||
pe.student = sgs.student
|
||||
and pe.academic_year = %s
|
||||
and sgs.parent = %s
|
||||
and sgs.active = 1
|
||||
{conditions}
|
||||
""".format(conditions=conditions), (academic_year, student_group))[0][0]
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"allow_import": 1,
|
||||
"allow_rename": 0,
|
||||
"autoname": "naming_series:",
|
||||
"beta": 1,
|
||||
"beta": 0,
|
||||
"creation": "2015-09-22 16:57:22.143710",
|
||||
"custom": 0,
|
||||
"docstatus": 0,
|
||||
@@ -1276,7 +1276,7 @@
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": 0,
|
||||
"modified": "2017-12-06 05:55:10.502567",
|
||||
"modified": "2018-02-08 02:12:34.185245",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Education",
|
||||
"name": "Fees",
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"allow_copy": 0,
|
||||
"allow_guest_to_view": 0,
|
||||
"allow_import": 1,
|
||||
"allow_rename": 0,
|
||||
"allow_rename": 1,
|
||||
"autoname": "GARD.####",
|
||||
"beta": 0,
|
||||
"creation": "2016-07-21 15:32:51.163292",
|
||||
@@ -507,7 +507,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2017-12-06 18:17:38.090252",
|
||||
"modified": "2018-03-07 12:51:06.941609",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Education",
|
||||
"name": "Guardian",
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user