Compare commits
296 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 | ||
|
|
a7bcf6791e | ||
|
|
f76fb50685 | ||
|
|
da941af687 | ||
|
|
91fd29a963 | ||
|
|
230805b016 | ||
|
|
60febc5465 | ||
|
|
4d4ce3e5cf | ||
|
|
052b51ab20 | ||
|
|
2bfa1803e9 | ||
|
|
b44ef0b249 | ||
|
|
dfb1646a16 | ||
|
|
d40bfeb7d3 | ||
|
|
af7df6ba50 | ||
|
|
f18cd2eaf7 | ||
|
|
a2426fcc9e | ||
|
|
184491bbbe | ||
|
|
eec0f7fd6b | ||
|
|
e04aedadcd | ||
|
|
e88f928f0f | ||
|
|
e43a3c269a | ||
|
|
59edc6028d | ||
|
|
93d3020e4b | ||
|
|
b19fd57043 | ||
|
|
7b78f6bee6 | ||
|
|
9fbed5617f | ||
|
|
bba5fd7a38 | ||
|
|
c9172e0079 | ||
|
|
6c3082591c | ||
|
|
3955fa5102 | ||
|
|
02302ff009 | ||
|
|
5b45bcf5f3 | ||
|
|
20dead5d91 | ||
|
|
752d21e658 | ||
|
|
3732033d9b | ||
|
|
6f75885d86 | ||
|
|
527e6c02b3 | ||
|
|
6b89644ca7 | ||
|
|
471bc618b5 | ||
|
|
0b3b63a9af | ||
|
|
412e044e8f | ||
|
|
0f458b1260 | ||
|
|
da22167741 | ||
|
|
8b94f1b553 | ||
|
|
7fcc21bc8b | ||
|
|
bf4c114c58 | ||
|
|
44fa9a6d9d | ||
|
|
50b6d79758 | ||
|
|
3a972c4d85 | ||
|
|
745c2658eb |
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.6'
|
||||
__version__ = '10.1.5'
|
||||
|
||||
def get_default_company(user=None):
|
||||
'''Get default company for user'''
|
||||
|
||||
@@ -163,7 +163,7 @@ class Account(NestedSet):
|
||||
if self.check_gle_exists():
|
||||
throw(_("Account with existing transaction can not be deleted"))
|
||||
|
||||
super(Account, self).on_trash()
|
||||
super(Account, self).on_trash(True)
|
||||
|
||||
def before_rename(self, old, new, merge=False):
|
||||
# Add company abbr if not provided
|
||||
|
||||
@@ -79,15 +79,17 @@ frappe.treeview_settings["Account"] = {
|
||||
|
||||
},
|
||||
onrender: function(node) {
|
||||
var dr_or_cr = node.data.balance < 0 ? "Cr" : "Dr";
|
||||
if (node.data && node.data.balance!==undefined) {
|
||||
$('<span class="balance-area pull-right text-muted small">'
|
||||
+ (node.data.balance_in_account_currency ?
|
||||
(format_currency(Math.abs(node.data.balance_in_account_currency),
|
||||
node.data.account_currency) + " / ") : "")
|
||||
+ format_currency(Math.abs(node.data.balance), node.data.company_currency)
|
||||
+ " " + dr_or_cr
|
||||
+ '</span>').insertBefore(node.$ul);
|
||||
if(frappe.boot.user.can_read.indexOf("GL Entry") !== -1){
|
||||
var dr_or_cr = node.data.balance < 0 ? "Cr" : "Dr";
|
||||
if (node.data && node.data.balance!==undefined) {
|
||||
$('<span class="balance-area pull-right text-muted small">'
|
||||
+ (node.data.balance_in_account_currency ?
|
||||
(format_currency(Math.abs(node.data.balance_in_account_currency),
|
||||
node.data.account_currency) + " / ") : "")
|
||||
+ format_currency(Math.abs(node.data.balance), node.data.company_currency)
|
||||
+ " " + dr_or_cr
|
||||
+ '</span>').insertBefore(node.$ul);
|
||||
}
|
||||
}
|
||||
},
|
||||
toolbar: [
|
||||
|
||||
@@ -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": {
|
||||
|
||||
@@ -287,6 +287,95 @@
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "print_settings",
|
||||
"fieldtype": "Section Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Print Settings",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "show_inclusive_tax_in_print",
|
||||
"fieldtype": "Check",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Show Inclusive Tax In Print",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "column_break_12",
|
||||
"fieldtype": "Column Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
@@ -422,7 +511,7 @@
|
||||
"issingle": 1,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2017-12-25 13:28:05.067615",
|
||||
"modified": "2018-01-05 15:26:10.357085",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Accounts Settings",
|
||||
|
||||
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,10 +667,10 @@ 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) }));
|
||||
@@ -662,17 +678,34 @@ frappe.ui.form.on('Payment Entry', {
|
||||
if(frm.doc.party) {
|
||||
var party_amount = frm.doc.payment_type=="Receive" ?
|
||||
frm.doc.paid_amount : frm.doc.received_amount;
|
||||
var company_currency = frm.doc.company? frappe.get_doc(":Company", frm.doc.company).default_currency: "";
|
||||
|
||||
if(frm.doc.total_allocated_amount < party_amount) {
|
||||
if(frm.doc.payment_type == "Receive") {
|
||||
if (frm.doc.party_account_currency == company_currency) {
|
||||
if(frm.doc.payment_type == "Receive" && frm.doc.total_allocated_amount <= party_amount + total_deductions) {
|
||||
unallocated_amount = party_amount - (frm.doc.total_allocated_amount - total_deductions);
|
||||
} else {
|
||||
} else if (frm.doc.payment_type == "Pay" && frm.doc.total_allocated_amount <= party_amount - total_deductions) {
|
||||
unallocated_amount = party_amount - (frm.doc.total_allocated_amount + total_deductions);
|
||||
}
|
||||
} else {
|
||||
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) {
|
||||
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) {
|
||||
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 +720,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 +811,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 +858,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",
|
||||
|
||||
@@ -58,16 +58,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 +134,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 +286,30 @@ 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.party_account_currency == self.company_currency:
|
||||
if self.payment_type == "Receive" \
|
||||
and self.total_allocated_amount <= self.paid_amount + total_deductions:
|
||||
self.unallocated_amount = self.paid_amount - \
|
||||
(self.total_allocated_amount - total_deductions)
|
||||
elif self.payment_type == "Pay" \
|
||||
and self.total_allocated_amount <= self.received_amount - total_deductions:
|
||||
self.unallocated_amount = self.received_amount - \
|
||||
(self.total_allocated_amount + total_deductions)
|
||||
else:
|
||||
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:
|
||||
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:
|
||||
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)
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -25,14 +25,14 @@ class POSProfile(Document):
|
||||
`tabPOS Profile User` pfu, `tabPOS Profile` pf
|
||||
where
|
||||
pf.name = pfu.parent and pfu.user = %s and pf.name != %s and pf.company = %s
|
||||
and pfu.default=1""", (row.user, self.name, self.company))
|
||||
and pfu.default=1 and pf.disabled = 0""", (row.user, self.name, self.company))
|
||||
|
||||
if row.default and res:
|
||||
msgprint(_("Already set default in pos profile {0} for user {1}, kindly disabled default")
|
||||
.format(res[0][0], row.user), raise_exception=1)
|
||||
elif not row.default and not res:
|
||||
msgprint(_("User {0} doesn't have any default POS Profile. Check Default at Row {1} for this User.")
|
||||
.format(row.user, row.idx), raise_exception=1)
|
||||
.format(row.user, row.idx))
|
||||
|
||||
def validate_all_link_fields(self):
|
||||
accounts = {"Account": [self.income_account,
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
QUnit.module('Purchase Invoice');
|
||||
|
||||
QUnit.test("test purchase invoice", function(assert) {
|
||||
assert.expect(6);
|
||||
assert.expect(9);
|
||||
let done = assert.async();
|
||||
frappe.run_serially([
|
||||
() => {
|
||||
@@ -39,6 +39,33 @@ QUnit.test("test purchase invoice", function(assert) {
|
||||
assert.ok(cur_frm.doc.payment_schedule.length > 0, "Payment Term Schedule is not empty");
|
||||
|
||||
},
|
||||
() => {
|
||||
let date = cur_frm.doc.due_date;
|
||||
frappe.tests.set_control('due_date', frappe.datetime.add_days(date, 1));
|
||||
frappe.timeout(0.5);
|
||||
assert.ok(cur_dialog && cur_dialog.is_visible, 'Message is displayed to user');
|
||||
},
|
||||
() => frappe.timeout(1),
|
||||
() => frappe.tests.click_button('Close'),
|
||||
() => frappe.timeout(0.5),
|
||||
() => frappe.tests.set_form_values(cur_frm, [{'payment_terms_schedule': ''}]),
|
||||
() => {
|
||||
let date = cur_frm.doc.due_date;
|
||||
frappe.tests.set_control('due_date', frappe.datetime.add_days(date, 1));
|
||||
frappe.timeout(0.5);
|
||||
assert.ok(cur_dialog && cur_dialog.is_visible, 'Message is displayed to user');
|
||||
},
|
||||
() => frappe.timeout(1),
|
||||
() => frappe.tests.click_button('Close'),
|
||||
() => frappe.timeout(0.5),
|
||||
() => frappe.tests.set_form_values(cur_frm, [{'payment_schedule': []}]),
|
||||
() => {
|
||||
let date = cur_frm.doc.due_date;
|
||||
frappe.tests.set_control('due_date', frappe.datetime.add_days(date, 1));
|
||||
frappe.timeout(0.5);
|
||||
assert.ok(!cur_dialog, 'Message is not shown');
|
||||
},
|
||||
() => cur_frm.save(),
|
||||
() => frappe.tests.click_button('Submit'),
|
||||
() => frappe.tests.click_button('Yes'),
|
||||
() => frappe.timeout(1),
|
||||
|
||||
@@ -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": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_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": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
@@ -4563,7 +4683,7 @@
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": 0,
|
||||
"modified": "2017-12-20 17:36:05.216046",
|
||||
"modified": "2018-01-12 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)
|
||||
@@ -142,7 +144,7 @@ class SalesInvoice(SellingController):
|
||||
|
||||
self.update_time_sheet(self.name)
|
||||
|
||||
self.update_current_month_sales()
|
||||
update_company_current_month_sales(self.company)
|
||||
self.update_project()
|
||||
|
||||
def validate_pos_paid_amount(self):
|
||||
@@ -181,16 +183,9 @@ class SalesInvoice(SellingController):
|
||||
self.make_gl_entries_on_cancel()
|
||||
frappe.db.set(self, 'status', 'Cancelled')
|
||||
|
||||
self.update_current_month_sales()
|
||||
update_company_current_month_sales(self.company)
|
||||
self.update_project()
|
||||
|
||||
def update_current_month_sales(self):
|
||||
if frappe.flags.in_test:
|
||||
update_company_current_month_sales(self.company)
|
||||
else:
|
||||
frappe.enqueue('erpnext.setup.doctype.company.company.update_company_current_month_sales',
|
||||
company=self.company)
|
||||
|
||||
def update_status_updater_args(self):
|
||||
if cint(self.update_stock):
|
||||
self.status_updater.extend([{
|
||||
@@ -231,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)
|
||||
@@ -244,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:
|
||||
@@ -675,28 +679,28 @@ class SalesInvoice(SellingController):
|
||||
# income account gl entries
|
||||
for item in self.get("items"):
|
||||
if flt(item.base_net_amount):
|
||||
account_currency = get_account_currency(item.income_account)
|
||||
gl_entries.append(
|
||||
self.get_gl_dict({
|
||||
"account": item.income_account,
|
||||
"against": self.customer,
|
||||
"credit": item.base_net_amount,
|
||||
"credit_in_account_currency": item.base_net_amount \
|
||||
if account_currency==self.company_currency else item.net_amount,
|
||||
"cost_center": item.cost_center
|
||||
}, account_currency)
|
||||
)
|
||||
|
||||
if item.is_fixed_asset:
|
||||
asset = frappe.get_doc("Asset", item.asset)
|
||||
|
||||
fixed_asset_gl_entries = get_gl_entries_on_asset_disposal(asset, is_sale=True)
|
||||
fixed_asset_gl_entries = get_gl_entries_on_asset_disposal(asset, item.base_net_amount)
|
||||
for gle in fixed_asset_gl_entries:
|
||||
gle["against"] = self.customer
|
||||
gl_entries.append(self.get_gl_dict(gle))
|
||||
|
||||
asset.db_set("disposal_date", self.posting_date)
|
||||
asset.set_status("Sold" if self.docstatus==1 else None)
|
||||
else:
|
||||
account_currency = get_account_currency(item.income_account)
|
||||
gl_entries.append(
|
||||
self.get_gl_dict({
|
||||
"account": item.income_account,
|
||||
"against": self.customer,
|
||||
"credit": item.base_net_amount,
|
||||
"credit_in_account_currency": item.base_net_amount \
|
||||
if account_currency==self.company_currency else item.net_amount,
|
||||
"cost_center": item.cost_center
|
||||
}, account_currency)
|
||||
)
|
||||
|
||||
# expense account gl entries
|
||||
if cint(self.update_stock) and \
|
||||
@@ -901,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)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
QUnit.module('Sales Invoice');
|
||||
|
||||
QUnit.test("test sales Invoice", function(assert) {
|
||||
assert.expect(6);
|
||||
assert.expect(9);
|
||||
let done = assert.async();
|
||||
frappe.run_serially([
|
||||
() => {
|
||||
@@ -38,6 +38,33 @@ QUnit.test("test sales Invoice", function(assert) {
|
||||
assert.ok(cur_frm.doc.payment_schedule.length > 0, "Payment Term Schedule is not empty");
|
||||
|
||||
},
|
||||
() => {
|
||||
let date = cur_frm.doc.due_date;
|
||||
frappe.tests.set_control('due_date', frappe.datetime.add_days(date, 1));
|
||||
frappe.timeout(0.5);
|
||||
assert.ok(cur_dialog && cur_dialog.is_visible, 'Message is displayed to user');
|
||||
},
|
||||
() => frappe.timeout(1),
|
||||
() => frappe.tests.click_button('Close'),
|
||||
() => frappe.timeout(0.5),
|
||||
() => frappe.tests.set_form_values(cur_frm, [{'payment_terms_schedule': ''}]),
|
||||
() => {
|
||||
let date = cur_frm.doc.due_date;
|
||||
frappe.tests.set_control('due_date', frappe.datetime.add_days(date, 1));
|
||||
frappe.timeout(0.5);
|
||||
assert.ok(cur_dialog && cur_dialog.is_visible, 'Message is displayed to user');
|
||||
},
|
||||
() => frappe.timeout(1),
|
||||
() => frappe.tests.click_button('Close'),
|
||||
() => frappe.timeout(0.5),
|
||||
() => frappe.tests.set_form_values(cur_frm, [{'payment_schedule': []}]),
|
||||
() => {
|
||||
let date = cur_frm.doc.due_date;
|
||||
frappe.tests.set_control('due_date', frappe.datetime.add_days(date, 1));
|
||||
frappe.timeout(0.5);
|
||||
assert.ok(!cur_dialog, 'Message is not shown');
|
||||
},
|
||||
() => cur_frm.save(),
|
||||
() => frappe.tests.click_button('Submit'),
|
||||
() => frappe.tests.click_button('Yes'),
|
||||
() => frappe.timeout(0.3),
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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({
|
||||
@@ -1172,8 +1177,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();
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
@@ -2001,4 +2015,4 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
||||
frappe.throw(__("LocalStorage is full , did not save"))
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
@@ -51,7 +51,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 +164,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 +267,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 +305,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 +359,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<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t{{ _(\"Net Total\") }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"net_total\") }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{%- for row in doc.taxes -%}\n\t\t{%- if not row.included_in_print_rate -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t{{ row.description }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ row.get_formatted(\"tax_amount\", doc) }}\n\t\t\t</td>\n\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</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</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": "2017-12-15 11:57:11.712191",
|
||||
"modified": "2018-01-12 11:19:17.432600",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "GST POS Invoice",
|
||||
|
||||
@@ -1,15 +1,21 @@
|
||||
{
|
||||
"align_labels_right": 0,
|
||||
"creation": "2011-12-21 11:08:55",
|
||||
"custom_format": 1,
|
||||
"disabled": 1,
|
||||
"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<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t{{ _(\"Net Total\") }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"net_total\") }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{%- for row in doc.taxes -%}\n\t\t{%- if not row.included_in_print_rate -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t{{ row.description }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ row.get_formatted(\"tax_amount\", doc) }}\n\t\t\t</td>\n\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</tbody>\n</table>\n{% if doc.get(\"taxes\", filters={\"included_in_print_rate\": 1}) %}\n<hr>\n<p><b>Taxes Included:</b></p>\n<table class=\"table table-condensed no-border\">\n\t<tbody>\n\t\t{%- for row in doc.taxes -%}\n\t\t{%- if row.included_in_print_rate -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t{{ row.description }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ row.get_formatted(\"tax_amount_after_discount_amount\", doc) }}\n\t\t\t</td>\n\t\t<tr>\n\t\t{%- endif -%}\n\t\t{%- endfor -%}\n\t</tbody>\n</table>\n{%- endif -%}\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</tbody>\n</table>\n<hr>\n<p>{{ doc.terms or \"\" }}</p>\n<p class=\"text-center\">{{ _(\"Thank you, please visit again.\") }}</p>",
|
||||
"idx": 1,
|
||||
"modified": "2015-04-21 05:06:29.380856",
|
||||
"line_breaks": 0,
|
||||
"modified": "2018-01-12 11:18:54.229254",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "POS Invoice",
|
||||
"owner": "Administrator",
|
||||
"print_format_builder": 0,
|
||||
"print_format_type": "Server",
|
||||
"show_section_headings": 0,
|
||||
"standard": "Yes"
|
||||
}
|
||||
@@ -1,3 +1,16 @@
|
||||
{% if(filters.show_pdc_in_print) { %}
|
||||
<style>
|
||||
@media screen {
|
||||
.print-format {
|
||||
padding: 8mm;
|
||||
margin:4mm;
|
||||
font-size:10px;
|
||||
font-family: Tahoma, sans-serif;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
{% } %}
|
||||
|
||||
<h2 class="text-center">{%= __(report.report_name) %}</h2>
|
||||
<h4 class="text-center">{%= filters.customer || filters.supplier %} </h4>
|
||||
<h5 class="text-center">
|
||||
@@ -6,17 +19,93 @@
|
||||
{%= 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 table-sm small">
|
||||
<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: 10%">{%= __("Date") %}</th>
|
||||
<th style="width: 15%">{%= __("Ref") %}</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>
|
||||
@@ -34,6 +123,7 @@
|
||||
<td>{%= dateutil.str_to_user(data[i][__("Posting Date")]) %}</td>
|
||||
<td>{%= 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 +136,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")]|| " ") { %}
|
||||
|
||||
@@ -23,10 +23,10 @@ frappe.query_reports["Accounts Receivable"] = {
|
||||
"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",
|
||||
@@ -64,6 +64,11 @@ frappe.query_reports["Accounts Receivable"] = {
|
||||
"fieldtype": "Int",
|
||||
"default": "90",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname":"show_pdc_in_print",
|
||||
"label": __("Show PDC in Print"),
|
||||
"fieldtype": "Check",
|
||||
}
|
||||
],
|
||||
|
||||
|
||||
@@ -72,6 +72,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 +101,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 +114,8 @@ class ReceivablePayableReport(object):
|
||||
return_entries = self.get_return_entries(args.get("party_type"))
|
||||
|
||||
data = []
|
||||
pdc_details = get_pdc_details(args.get("party_type"))
|
||||
|
||||
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 +159,18 @@ 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 +252,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":
|
||||
@@ -283,9 +311,9 @@ class ReceivablePayableReport(object):
|
||||
where exists(select name from `tabCustomer Group` where lft >= {0} and rgt <= {1}
|
||||
and name=tabCustomer.customer_group))""".format(lft, rgt))
|
||||
|
||||
if self.filters.get("credit_days_based_on"):
|
||||
conditions.append("party in (select name from tabCustomer where credit_days_based_on=%s)")
|
||||
values.append(self.filters.get("credit_days_based_on"))
|
||||
if self.filters.get("payment_terms_template"):
|
||||
conditions.append("party in (select name from tabCustomer where payment_terms=%s)")
|
||||
values.append(self.filters.get("payment_terms_template"))
|
||||
|
||||
return " and ".join(conditions), values
|
||||
|
||||
@@ -347,3 +375,62 @@ 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):
|
||||
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 >= pent.posting_date
|
||||
and pent.party_type = %s
|
||||
group by pent.party, pref.reference_name""", 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 + 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 >= je.posting_date
|
||||
and jea.party_type = %s
|
||||
group by jea.party, jea.reference_name""".format(amount_field), 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",
|
||||
|
||||
@@ -17,38 +17,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>
|
||||
{% } %}
|
||||
|
||||
@@ -105,6 +105,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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -6,7 +6,6 @@ import frappe
|
||||
from frappe import _, scrub
|
||||
from erpnext.stock.utils import get_incoming_rate
|
||||
from erpnext.controllers.queries import get_match_cond
|
||||
from erpnext.stock.stock_ledger import get_valuation_rate
|
||||
from frappe.utils import flt
|
||||
|
||||
|
||||
@@ -248,6 +247,7 @@ class GrossProfitGenerator(object):
|
||||
return 0.0
|
||||
|
||||
def get_average_buying_rate(self, row, item_code):
|
||||
args = row
|
||||
if not item_code in self.average_buying_rate:
|
||||
if item_code in self.non_stock_items:
|
||||
self.average_buying_rate[item_code] = flt(frappe.db.sql("""
|
||||
@@ -255,12 +255,14 @@ class GrossProfitGenerator(object):
|
||||
from `tabPurchase Invoice Item`
|
||||
where item_code = %s and docstatus=1""", item_code)[0][0])
|
||||
else:
|
||||
average_buying_rate = get_incoming_rate(row)
|
||||
if not average_buying_rate:
|
||||
average_buying_rate = get_valuation_rate(item_code, row.warehouse,
|
||||
row.parenttype, row.parent, allow_zero_rate=True,
|
||||
currency=self.filters.currency, company=self.filters.company)
|
||||
args.update({
|
||||
'voucher_type': row.parenttype,
|
||||
'voucher_no': row.parent,
|
||||
'allow_zero_valuation': True,
|
||||
'company': self.filters.company
|
||||
})
|
||||
|
||||
average_buying_rate = get_incoming_rate(args)
|
||||
self.average_buying_rate[item_code] = flt(average_buying_rate)
|
||||
|
||||
return self.average_buying_rate[item_code]
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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
|
||||
@@ -252,7 +252,7 @@ def add_ac(args=None):
|
||||
if not ac.parent_account:
|
||||
ac.parent_account = args.get("parent")
|
||||
|
||||
if ac.is_root:
|
||||
if getattr(ac, 'is_root', None):
|
||||
ac.parent_account=''
|
||||
|
||||
ac.old_parent = ""
|
||||
|
||||
@@ -51,9 +51,6 @@ class Asset(Document):
|
||||
if not self.get(field):
|
||||
self.set(field, value)
|
||||
|
||||
self.value_after_depreciation = (flt(self.gross_purchase_amount) -
|
||||
flt(self.opening_accumulated_depreciation))
|
||||
|
||||
def validate_asset_values(self):
|
||||
if flt(self.expected_value_after_useful_life) >= flt(self.gross_purchase_amount):
|
||||
frappe.throw(_("Expected Value After Useful Life must be less than Gross Purchase Amount"))
|
||||
@@ -61,7 +58,10 @@ class Asset(Document):
|
||||
if not flt(self.gross_purchase_amount):
|
||||
frappe.throw(_("Gross Purchase Amount is mandatory"), frappe.MandatoryError)
|
||||
|
||||
if not self.is_existing_asset and self.calculate_depreciation:
|
||||
if not self.calculate_depreciation:
|
||||
return
|
||||
|
||||
if not self.is_existing_asset:
|
||||
self.opening_accumulated_depreciation = 0
|
||||
self.number_of_depreciations_booked = 0
|
||||
if not self.next_depreciation_date:
|
||||
@@ -81,6 +81,9 @@ class Asset(Document):
|
||||
if cint(self.number_of_depreciations_booked) > cint(self.total_number_of_depreciations):
|
||||
frappe.throw(_("Number of Depreciations Booked cannot be greater than Total Number of Depreciations"))
|
||||
|
||||
self.value_after_depreciation = (flt(self.gross_purchase_amount) -
|
||||
flt(self.opening_accumulated_depreciation))
|
||||
|
||||
if self.next_depreciation_date and getdate(self.next_depreciation_date) < getdate(nowdate()):
|
||||
frappe.msgprint(_("Next Depreciation Date is entered as past date"), title=_('Warning'), indicator='red')
|
||||
|
||||
@@ -106,12 +109,13 @@ class Asset(Document):
|
||||
n * cint(self.frequency_of_depreciation))
|
||||
|
||||
depreciation_amount = self.get_depreciation_amount(value_after_depreciation)
|
||||
value_after_depreciation -= flt(depreciation_amount)
|
||||
if depreciation_amount:
|
||||
value_after_depreciation -= flt(depreciation_amount)
|
||||
|
||||
self.append("schedules", {
|
||||
"schedule_date": schedule_date,
|
||||
"depreciation_amount": depreciation_amount
|
||||
})
|
||||
self.append("schedules", {
|
||||
"schedule_date": schedule_date,
|
||||
"depreciation_amount": depreciation_amount
|
||||
})
|
||||
|
||||
def set_accumulated_depreciation(self):
|
||||
accumulated_depreciation = flt(self.opening_accumulated_depreciation)
|
||||
|
||||
@@ -151,13 +151,11 @@ def restore_asset(asset_name):
|
||||
asset.set_status()
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_gl_entries_on_asset_disposal(asset, is_sale=False):
|
||||
def get_gl_entries_on_asset_disposal(asset, selling_amount=0):
|
||||
fixed_asset_account, accumulated_depr_account, depr_expense_account = get_depreciation_accounts(asset)
|
||||
accumulated_depr_amount = flt(asset.gross_purchase_amount) - flt(asset.value_after_depreciation)
|
||||
disposal_account, depreciation_cost_center = get_disposal_account_and_cost_center(asset.company)
|
||||
|
||||
expense_account, cost_center = get_disposal_account_and_cost_center(asset.company)
|
||||
if is_sale:
|
||||
expense_account = depr_expense_account
|
||||
accumulated_depr_amount = flt(asset.gross_purchase_amount) - flt(asset.value_after_depreciation)
|
||||
|
||||
gl_entries = [
|
||||
{
|
||||
@@ -172,12 +170,14 @@ def get_gl_entries_on_asset_disposal(asset, is_sale=False):
|
||||
}
|
||||
]
|
||||
|
||||
if flt(asset.value_after_depreciation):
|
||||
profit_amount = flt(selling_amount) - flt(asset.value_after_depreciation)
|
||||
if profit_amount:
|
||||
debit_or_credit = "debit" if profit_amount < 0 else "credit"
|
||||
gl_entries.append({
|
||||
"account": expense_account,
|
||||
"cost_center": cost_center,
|
||||
"debit": flt(asset.value_after_depreciation),
|
||||
"debit_in_account_currency": flt(asset.value_after_depreciation)
|
||||
"account": disposal_account,
|
||||
"cost_center": depreciation_cost_center,
|
||||
debit_or_credit: abs(profit_amount),
|
||||
debit_or_credit + "_in_account_currency": abs(profit_amount)
|
||||
})
|
||||
|
||||
return gl_entries
|
||||
|
||||
@@ -234,9 +234,8 @@ class TestAsset(unittest.TestCase):
|
||||
|
||||
expected_gle = (
|
||||
("_Test Accumulated Depreciations - _TC", 30000.0, 0.0),
|
||||
("_Test Depreciations - _TC", 70000.0, 0.0),
|
||||
("_Test Fixed Asset - _TC", 0.0, 100000.0),
|
||||
("_Test Gain/Loss on Asset Disposal - _TC", 0.0, 25000.0),
|
||||
("_Test Gain/Loss on Asset Disposal - _TC", 45000.0, 0.0),
|
||||
("Debtors - _TC", 25000.0, 0.0)
|
||||
)
|
||||
|
||||
|
||||
@@ -225,7 +225,7 @@
|
||||
"is_submittable": 0,
|
||||
"issingle": 1,
|
||||
"istable": 0,
|
||||
"modified": "2015-08-25 04:55:06.052342",
|
||||
"modified": "2017-12-27 15:20:06.052342",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Buying",
|
||||
"name": "Buying Settings",
|
||||
|
||||
@@ -12,6 +12,9 @@ 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" })
|
||||
},
|
||||
|
||||
onload: function(frm) {
|
||||
@@ -21,22 +24,14 @@ frappe.ui.form.on("Purchase Order", {
|
||||
return erpnext.queries.warehouse(frm.doc);
|
||||
});
|
||||
|
||||
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);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
frappe.ui.form.on("Purchase Order Item", {
|
||||
item_code: function(frm) {
|
||||
frappe.call({
|
||||
method: "get_last_purchase_rate",
|
||||
doc: frm.doc,
|
||||
callback: function(r, rt) {
|
||||
frm.trigger('calculate_taxes_and_totals');
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
schedule_date: function(frm, cdt, cdn) {
|
||||
var row = locals[cdt][cdn];
|
||||
if (row.schedule_date) {
|
||||
|
||||
@@ -1238,6 +1238,37 @@
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"depends_on": "eval:doc.docstatus===0 && (doc.items && doc.items.length)",
|
||||
"fieldname": "get_last_purchase_rate",
|
||||
"fieldtype": "Button",
|
||||
"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": "Get last purchase rate",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
@@ -3065,6 +3096,37 @@
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"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,
|
||||
@@ -3261,8 +3323,8 @@
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2017-12-19 14:53:03.986840",
|
||||
"modified_by": "nabinhait@gmail.com",
|
||||
"modified": "2018-02-17 11:00:05.037716",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Buying",
|
||||
"name": "Purchase Order",
|
||||
"owner": "Administrator",
|
||||
|
||||
@@ -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,12 +67,16 @@ 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:
|
||||
@@ -111,27 +120,26 @@ class PurchaseOrder(BuyingController):
|
||||
|
||||
def get_last_purchase_rate(self):
|
||||
"""get last purchase rates for all items"""
|
||||
if cint(frappe.db.get_single_value("Buying Settings", "disable_fetch_last_purchase_rate")): return
|
||||
|
||||
if not cint(frappe.db.get_single_value("Buying Settings", "disable_fetch_last_purchase_rate")):
|
||||
conversion_rate = flt(self.get('conversion_rate')) or 1.0
|
||||
conversion_rate = flt(self.get('conversion_rate')) or 1.0
|
||||
for d in self.get("items"):
|
||||
if d.item_code:
|
||||
last_purchase_details = get_last_purchase_details(d.item_code, self.name)
|
||||
if last_purchase_details:
|
||||
d.base_price_list_rate = (last_purchase_details['base_price_list_rate'] *
|
||||
(flt(d.conversion_factor) or 1.0))
|
||||
d.discount_percentage = last_purchase_details['discount_percentage']
|
||||
d.base_rate = last_purchase_details['base_rate'] * (flt(d.conversion_factor) or 1.0)
|
||||
d.price_list_rate = d.base_price_list_rate / conversion_rate
|
||||
d.rate = d.base_rate / conversion_rate
|
||||
d.last_purchase_rate = d.rate
|
||||
else:
|
||||
|
||||
for d in self.get("items"):
|
||||
if d.item_code:
|
||||
last_purchase_details = get_last_purchase_details(d.item_code, self.name)
|
||||
|
||||
if last_purchase_details:
|
||||
d.base_price_list_rate = (last_purchase_details['base_price_list_rate'] *
|
||||
(flt(d.conversion_factor) or 1.0))
|
||||
d.discount_percentage = last_purchase_details['discount_percentage']
|
||||
d.base_rate = last_purchase_details['base_rate'] * (flt(d.conversion_factor) or 1.0)
|
||||
d.price_list_rate = d.base_price_list_rate / conversion_rate
|
||||
d.last_purchase_rate = d.base_rate / conversion_rate
|
||||
else:
|
||||
|
||||
item_last_purchase_rate = frappe.db.get_value("Item", d.item_code, "last_purchase_rate")
|
||||
if item_last_purchase_rate:
|
||||
d.base_price_list_rate = d.base_rate = d.price_list_rate \
|
||||
= d.last_purchase_rate = item_last_purchase_rate
|
||||
item_last_purchase_rate = frappe.db.get_value("Item", d.item_code, "last_purchase_rate")
|
||||
if item_last_purchase_rate:
|
||||
d.base_price_list_rate = d.base_rate = d.price_list_rate \
|
||||
= d.rate = d.last_purchase_rate = item_last_purchase_rate
|
||||
|
||||
# Check for Closed status
|
||||
def check_for_closed_status(self):
|
||||
@@ -223,12 +231,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):
|
||||
@@ -256,6 +268,21 @@ class PurchaseOrder(BuyingController):
|
||||
if item.delivered_by_supplier == 1:
|
||||
item.received_qty = item.qty
|
||||
|
||||
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
|
||||
|
||||
conversion_rate = flt(conversion_rate) or 1.0
|
||||
|
||||
last_purchase_details = get_last_purchase_details(item_code, name)
|
||||
if last_purchase_details:
|
||||
last_purchase_rate = (last_purchase_details['base_rate'] * (flt(conversion_factor) or 1.0)) / conversion_rate
|
||||
return last_purchase_rate
|
||||
else:
|
||||
item_last_purchase_rate = frappe.db.get_value("Item", item_code, "last_purchase_rate")
|
||||
if item_last_purchase_rate:
|
||||
return item_last_purchase_rate
|
||||
|
||||
@frappe.whitelist()
|
||||
def close_or_unclose_purchase_orders(names, status):
|
||||
if not frappe.has_permission("Purchase Order", "write"):
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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,30 @@ 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"
|
||||
},
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -167,17 +155,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 +190,12 @@ def get_data():
|
||||
{
|
||||
"type": "doctype",
|
||||
"name": "Room"
|
||||
},
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": _("Setup"),
|
||||
"items": [
|
||||
{
|
||||
"type": "doctype",
|
||||
"name": "Student Category"
|
||||
@@ -221,4 +222,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."),
|
||||
},
|
||||
{
|
||||
|
||||
@@ -54,6 +54,7 @@ class AccountsController(TransactionBase):
|
||||
|
||||
if self.meta.get_field("taxes_and_charges"):
|
||||
self.validate_enabled_taxes_and_charges()
|
||||
self.validate_tax_account_company()
|
||||
|
||||
self.validate_party()
|
||||
self.validate_currency()
|
||||
@@ -134,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"):
|
||||
@@ -255,6 +256,14 @@ class AccountsController(TransactionBase):
|
||||
if frappe.db.get_value(taxes_and_charges_doctype, self.taxes_and_charges, "disabled"):
|
||||
frappe.throw(_("{0} '{1}' is disabled").format(taxes_and_charges_doctype, self.taxes_and_charges))
|
||||
|
||||
def validate_tax_account_company(self):
|
||||
for d in self.get("taxes"):
|
||||
if d.account_head:
|
||||
tax_account_company = frappe.db.get_value("Account", d.account_head, "company")
|
||||
if tax_account_company != self.company:
|
||||
frappe.throw(_("Row #{0}: Account {1} does not belong to company {2}")
|
||||
.format(d.idx, d.account_head, self.company))
|
||||
|
||||
def get_gl_dict(self, args, account_currency=None):
|
||||
"""this method populates the common properties of a gl entry record"""
|
||||
|
||||
@@ -375,6 +384,17 @@ class AccountsController(TransactionBase):
|
||||
|
||||
return res
|
||||
|
||||
def is_inclusive_tax(self):
|
||||
is_inclusive = cint(frappe.db.get_single_value("Accounts Settings",
|
||||
"show_inclusive_tax_in_print"))
|
||||
|
||||
if is_inclusive:
|
||||
is_inclusive = 0
|
||||
if self.get("taxes", filters={"included_in_print_rate": 1}):
|
||||
is_inclusive = 1
|
||||
|
||||
return is_inclusive
|
||||
|
||||
def validate_advance_entries(self):
|
||||
order_field = "sales_order" if self.doctype == "Sales Invoice" else "purchase_order"
|
||||
order_list = list(set([d.get(order_field)
|
||||
@@ -464,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
|
||||
@@ -646,7 +666,9 @@ class AccountsController(TransactionBase):
|
||||
self.remove(item)
|
||||
|
||||
def set_payment_schedule(self):
|
||||
posting_date = self.get("posting_date") or self.get("transaction_date")
|
||||
if self.doctype == 'Sales Invoice' and self.is_pos: 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
|
||||
grand_total = self.get("rounded_total") or self.grand_total
|
||||
@@ -675,6 +697,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))
|
||||
@@ -688,6 +712,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"):
|
||||
@@ -711,11 +737,15 @@ def get_tax_rate(account_head):
|
||||
return frappe.db.get_value("Account", account_head, ["tax_rate", "account_name"], as_dict=True)
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_default_taxes_and_charges(master_doctype, company=None):
|
||||
def get_default_taxes_and_charges(master_doctype, tax_template=None, company=None):
|
||||
if not company: return {}
|
||||
|
||||
default_tax = frappe.db.get_value(master_doctype,
|
||||
{"is_default": 1, "company": company})
|
||||
if tax_template and company:
|
||||
tax_template_company = frappe.db.get_value(master_doctype, tax_template, "company")
|
||||
if tax_template_company == company:
|
||||
return
|
||||
|
||||
default_tax = frappe.db.get_value(master_doctype, {"is_default": 1, "company": company})
|
||||
|
||||
return {
|
||||
'taxes_and_charges': default_tax,
|
||||
@@ -859,6 +889,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)
|
||||
|
||||
@@ -870,6 +901,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)
|
||||
|
||||
@@ -18,7 +18,10 @@ class BuyingController(StockController):
|
||||
if hasattr(self, "taxes"):
|
||||
self.flags.print_taxes_with_zero_amount = cint(frappe.db.get_single_value("Print Settings",
|
||||
"print_taxes_with_zero_amount"))
|
||||
self.flags.show_inclusive_tax_in_print = self.is_inclusive_tax()
|
||||
|
||||
self.print_templates = {
|
||||
"total": "templates/print_formats/includes/total.html",
|
||||
"taxes": "templates/print_formats/includes/taxes.html"
|
||||
}
|
||||
|
||||
@@ -430,7 +433,8 @@ class BuyingController(StockController):
|
||||
if not d.schedule_date:
|
||||
d.schedule_date = self.schedule_date
|
||||
|
||||
if d.schedule_date and getdate(d.schedule_date) < getdate(self.transaction_date):
|
||||
if (d.schedule_date and self.transaction_date and
|
||||
getdate(d.schedule_date) < getdate(self.transaction_date)):
|
||||
frappe.throw(_("Row #{0}: Reqd by Date cannot be before Transaction Date").format(d.idx))
|
||||
else:
|
||||
frappe.throw(_("Please enter Reqd by Date"))
|
||||
|
||||
@@ -152,7 +152,7 @@ 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,
|
||||
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, \
|
||||
@@ -257,7 +257,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 = {
|
||||
@@ -414,10 +414,11 @@ def get_doctype_wise_filters(filters):
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_batch_numbers(doctype, txt, searchfield, start, page_len, filters):
|
||||
query = 'select batch_id from `tabBatch` ' \
|
||||
'where (`tabBatch`.expiry_date >= CURDATE() or `tabBatch`.expiry_date IS NULL)'
|
||||
query = """select batch_id from `tabBatch`
|
||||
where (expiry_date >= CURDATE() or expiry_date IS NULL)
|
||||
and name like '{txt}'""".format(txt = frappe.db.escape('%{0}%'.format(txt)))
|
||||
|
||||
if filters and filters.get('item_code'):
|
||||
query += 'where item = %(item_code)s' % filters
|
||||
if filters and filters.get('item'):
|
||||
query += " and item = '{item}'".format(item = frappe.db.escape(filters.get('item')))
|
||||
|
||||
return frappe.db.sql(query)
|
||||
|
||||
@@ -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")
|
||||
}))
|
||||
|
||||
@@ -16,7 +16,10 @@ class SellingController(StockController):
|
||||
if hasattr(self, "taxes"):
|
||||
self.flags.print_taxes_with_zero_amount = cint(frappe.db.get_single_value("Print Settings",
|
||||
"print_taxes_with_zero_amount"))
|
||||
self.flags.show_inclusive_tax_in_print = self.is_inclusive_tax()
|
||||
|
||||
self.print_templates = {
|
||||
"total": "templates/print_formats/includes/total.html",
|
||||
"taxes": "templates/print_formats/includes/taxes.html"
|
||||
}
|
||||
|
||||
@@ -147,6 +150,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
|
||||
|
||||
@@ -250,7 +250,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,7 +275,7 @@ 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(
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -232,7 +232,7 @@ def make_quotation(source_name, target_doc=None):
|
||||
quotation.conversion_rate = exchange_rate
|
||||
|
||||
# get default taxes
|
||||
taxes = get_default_taxes_and_charges("Sales Taxes and Charges Template", quotation.company)
|
||||
taxes = get_default_taxes_and_charges("Sales Taxes and Charges Template", company=quotation.company)
|
||||
if taxes.get('taxes'):
|
||||
quotation.update(taxes)
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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")
|
||||
@@ -1,41 +1,46 @@
|
||||
// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
|
||||
// For license information, please see license.txt
|
||||
|
||||
cur_frm.add_fetch("student_group", "course", "course");
|
||||
cur_frm.add_fetch("examiner", "instructor_name", "examiner_name");
|
||||
cur_frm.add_fetch("supervisor", "instructor_name", "supervisor_name");
|
||||
cur_frm.add_fetch("course", "default_grading_scale", "grading_scale");
|
||||
|
||||
frappe.ui.form.on("Assessment Plan", {
|
||||
onload: function(frm) {
|
||||
frm.set_query("assessment_group", function(doc, cdt, cdn) {
|
||||
return{
|
||||
filters: {
|
||||
'is_group': 0
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
refresh: function(frm) {
|
||||
if (frm.doc.docstatus == 1) {
|
||||
frm.add_custom_button(__("Assessment Result"), function() {
|
||||
frappe.route_options = {
|
||||
assessment_plan: frm.doc.name,
|
||||
student_group: frm.doc.student_group
|
||||
}
|
||||
frappe.set_route("Form", "Assessment Result Tool");
|
||||
});
|
||||
}
|
||||
setup: function(frm) {
|
||||
frm.add_fetch("student_group", "course", "course");
|
||||
frm.add_fetch("student_group", "program", "program");
|
||||
frm.add_fetch("student_group", "academic_year", "academic_year");
|
||||
frm.add_fetch("student_group", "academic_term", "academic_term");
|
||||
frm.add_fetch("examiner", "instructor_name", "examiner_name");
|
||||
frm.add_fetch("supervisor", "instructor_name", "supervisor_name");
|
||||
frm.add_fetch("course", "default_grading_scale", "grading_scale");
|
||||
},
|
||||
|
||||
onload: function(frm) {
|
||||
frm.set_query("assessment_group", function(doc, cdt, cdn) {
|
||||
return{
|
||||
filters: {
|
||||
'is_group': 0
|
||||
}
|
||||
};
|
||||
});
|
||||
frm.set_query('grading_scale', function(){
|
||||
return {
|
||||
filters: {
|
||||
docstatus: 1
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
},
|
||||
},
|
||||
|
||||
refresh: function(frm) {
|
||||
if (frm.doc.docstatus == 1) {
|
||||
frm.add_custom_button(__("Assessment Result"), function() {
|
||||
frappe.route_options = {
|
||||
assessment_plan: frm.doc.name,
|
||||
student_group: frm.doc.student_group
|
||||
}
|
||||
frappe.set_route("Form", "Assessment Result Tool");
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
course: function(frm) {
|
||||
if (frm.doc.course && frm.doc.maximum_assessment_score) {
|
||||
|
||||
@@ -13,36 +13,6 @@
|
||||
"editable_grid": 0,
|
||||
"engine": "InnoDB",
|
||||
"fields": [
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "assessment_name",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 1,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Assessment Name",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
@@ -80,19 +50,80 @@
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "course",
|
||||
"fieldtype": "Link",
|
||||
"fieldname": "assessment_name",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 1,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 1,
|
||||
"label": "Course",
|
||||
"in_standard_filter": 0,
|
||||
"label": "Assessment Name",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Course",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "assessment_group",
|
||||
"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": 1,
|
||||
"label": "Assessment Group",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Assessment Group",
|
||||
"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": "grading_scale",
|
||||
"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": 1,
|
||||
"label": "Grading Scale",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Grading Scale",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
@@ -140,19 +171,50 @@
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "assessment_group",
|
||||
"fieldname": "course",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_global_search": 1,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 1,
|
||||
"label": "Assessment Group",
|
||||
"label": "Course",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Assessment Group",
|
||||
"options": "Course",
|
||||
"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": "program",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 1,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Program",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Program",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
@@ -171,8 +233,8 @@
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "maximum_assessment_score",
|
||||
"fieldtype": "Float",
|
||||
"fieldname": "academic_year",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
@@ -180,9 +242,10 @@
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Maximum Assessment Score",
|
||||
"label": "Academic Year",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Academic Year",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
@@ -190,7 +253,7 @@
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
@@ -201,7 +264,7 @@
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "grading_scale",
|
||||
"fieldname": "academic_term",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
@@ -209,11 +272,11 @@
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 1,
|
||||
"label": "Grading Scale",
|
||||
"in_standard_filter": 0,
|
||||
"label": "Academic Term",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Grading Scale",
|
||||
"options": "Academic Term",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
@@ -221,7 +284,7 @@
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
@@ -546,6 +609,7 @@
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Evaluate",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
@@ -560,6 +624,36 @@
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "maximum_assessment_score",
|
||||
"fieldtype": "Float",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Maximum Assessment Score",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
@@ -633,7 +727,7 @@
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": 0,
|
||||
"modified": "2017-11-28 17:23:36.657725",
|
||||
"modified": "2018-01-08 17:53:39.340356",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Education",
|
||||
"name": "Assessment Plan",
|
||||
|
||||
@@ -9,10 +9,22 @@ from frappe import _
|
||||
|
||||
class AssessmentPlan(Document):
|
||||
def validate(self):
|
||||
self.set_missing_field()
|
||||
self.validate_overlap()
|
||||
self.validate_max_score()
|
||||
self.validate_assessment_criteria()
|
||||
|
||||
def set_missing_field(self):
|
||||
if self.student_group:
|
||||
academic_term, academic_year, program, course = frappe.get_value("Student Group", self.student_group,
|
||||
["academic_term", "academic_year", "program", "course"])
|
||||
self.academic_term = academic_term
|
||||
self.academic_year = academic_year
|
||||
if program:
|
||||
self.program = program
|
||||
if course and not self.course: #pylint: disable=E0203
|
||||
self.course = course
|
||||
|
||||
def validate_overlap(self):
|
||||
"""Validates overlap for Student Group, Instructor, Room"""
|
||||
|
||||
|
||||
@@ -1,11 +1,29 @@
|
||||
// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
|
||||
// For license information, please see license.txt
|
||||
|
||||
cur_frm.add_fetch("student", "title", "student_name");
|
||||
cur_frm.add_fetch("assessment_plan", "grading_scale", "grading_scale");
|
||||
cur_frm.add_fetch("assessment_plan", "maximum_assessment_score", "maximum_score");
|
||||
|
||||
frappe.ui.form.on("Assessment Result", {
|
||||
setup: function(frm) {
|
||||
frm.add_fetch("student", "title", "student_name");
|
||||
frm.add_fetch("assessment_plan", "course", "course");
|
||||
frm.add_fetch("assessment_plan", "program", "program");
|
||||
frm.add_fetch("assessment_plan", "academic_year", "academic_year");
|
||||
frm.add_fetch("assessment_plan", "academic_term", "academic_term");
|
||||
frm.add_fetch("assessment_plan", "grading_scale", "grading_scale");
|
||||
frm.add_fetch("assessment_plan", "student_group", "student_group");
|
||||
frm.add_fetch("assessment_plan", "assessment_group", "assessment_group");
|
||||
frm.add_fetch("assessment_plan", "maximum_assessment_score", "maximum_score");
|
||||
},
|
||||
|
||||
onload: function(frm) {
|
||||
frm.set_query('assessment_plan', function(){
|
||||
return {
|
||||
filters: {
|
||||
docstatus: 1
|
||||
}
|
||||
};
|
||||
});
|
||||
},
|
||||
|
||||
assessment_plan: function(frm) {
|
||||
if (frm.doc.assessment_plan) {
|
||||
frappe.call({
|
||||
|
||||
@@ -13,6 +13,190 @@
|
||||
"editable_grid": 1,
|
||||
"engine": "InnoDB",
|
||||
"fields": [
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "assessment_plan",
|
||||
"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": "Assessment Plan",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Assessment Plan",
|
||||
"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": "program",
|
||||
"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": "Program",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Program",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "course",
|
||||
"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": "Course",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Course",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "academic_year",
|
||||
"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": "Academic Year",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Academic Year",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "academic_term",
|
||||
"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": "Academic Term",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Academic Term",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "column_break_3",
|
||||
"fieldtype": "Column Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
@@ -80,8 +264,8 @@
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "column_break_3",
|
||||
"fieldtype": "Column Break",
|
||||
"fieldname": "student_group",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
@@ -89,8 +273,10 @@
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Student Group",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Student Group",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
@@ -109,19 +295,19 @@
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "assessment_plan",
|
||||
"fieldname": "assessment_group",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Assessment Plan",
|
||||
"label": "Assessment Group",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Assessment Plan",
|
||||
"options": "Assessment Group",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
@@ -129,7 +315,7 @@
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
@@ -180,6 +366,7 @@
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Result",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
@@ -285,6 +472,35 @@
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "column_break_11",
|
||||
"fieldtype": "Column Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
@@ -315,35 +531,6 @@
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "column_break_11",
|
||||
"fieldtype": "Column Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
@@ -389,6 +576,7 @@
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Summary",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
@@ -474,7 +662,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2017-11-10 18:58:32.114529",
|
||||
"modified": "2018-01-09 14:14:30.090317",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Education",
|
||||
"name": "Assessment Result",
|
||||
|
||||
@@ -14,15 +14,25 @@ from frappe.utils.csvutils import getlink
|
||||
|
||||
class AssessmentResult(Document):
|
||||
def validate(self):
|
||||
if self.student and not self.student_name:
|
||||
self.student_name = frappe.db.get_value("Student", self.student, "title")
|
||||
self.grading_scale = frappe.db.get_value("Assessment Plan", self.assessment_plan, "grading_scale")
|
||||
self.set_missing_values()
|
||||
self.validate_maximum_score()
|
||||
self.validate_grade()
|
||||
self.validate_duplicate()
|
||||
|
||||
def set_missing_values(self):
|
||||
if self.student and not self.student_name:
|
||||
self.student_name = frappe.db.get_value("Student", self.student, "title")
|
||||
assessment_plan_details = frappe.get_value("Assessment Plan", self.assessment_plan, ["academic_term",
|
||||
"academic_year", "program", "course", "grading_scale", "assessment_group", "student_group",
|
||||
"maximum_assessment_score"], as_dict=1)
|
||||
|
||||
for field in assessment_plan_details:
|
||||
if field != "maximum_assessment_score":
|
||||
setattr(self, field, assessment_plan_details[field])
|
||||
else:
|
||||
self.maximum_score = assessment_plan_details[field]
|
||||
|
||||
def validate_maximum_score(self):
|
||||
self.maximum_score = frappe.db.get_value("Assessment Plan", self.assessment_plan, "maximum_assessment_score")
|
||||
assessment_details = get_assessment_details(self.assessment_plan)
|
||||
max_scores = {}
|
||||
for d in assessment_details:
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -10,6 +10,7 @@ from erpnext.education.api import enroll_student
|
||||
|
||||
class ProgramEnrollmentTool(Document):
|
||||
def get_students(self):
|
||||
students = []
|
||||
if not self.get_students_from:
|
||||
frappe.throw(_("Mandatory field - Get Students From"))
|
||||
elif not self.program:
|
||||
|
||||
@@ -6,9 +6,15 @@
|
||||
{% } %}
|
||||
<h4 class="text-center">{%= __("Assessment Report") %}</h4>
|
||||
<hr>
|
||||
<h5 class="text-center">{%= __("Academic Year: ") %} {%= filters.academic_year %} </h5>
|
||||
{% if (filters.academic_term){ %}
|
||||
<h5 class="text-center">{%= __("Academic Term: ") %} {%= filters.academic_term %} </h5>
|
||||
{% } %}
|
||||
<h5 class="text-center">{%= __("Course Code: ") %} {%= filters.course %}</h5>
|
||||
<h5 class="text-center">{%= __("Assessment Group: ") %} {%= filters.assessment_group %}</h5>
|
||||
<h5 class="text-center">{%= __("Assessment Plan: ") %} {%= data_to_be_printed[0]["assessment_plan"] %} </h5>
|
||||
{% if (filters.student_group){ %}
|
||||
<h5 class="text-center">{%= __("Student Group: ") %} {%= filters.student_group %} </h5>
|
||||
{% } %}
|
||||
<hr>
|
||||
|
||||
<table class="table table-bordered">
|
||||
|
||||
@@ -4,18 +4,17 @@
|
||||
frappe.query_reports["Course wise Assessment Report"] = {
|
||||
"filters": [
|
||||
{
|
||||
"fieldname":"assessment_group",
|
||||
"label": __("Assessment Group"),
|
||||
"fieldname":"academic_year",
|
||||
"label": __("Academic Year"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Assessment Group",
|
||||
"reqd": 1,
|
||||
"get_query": function() {
|
||||
return{
|
||||
filters: {
|
||||
'is_group': 0
|
||||
}
|
||||
};
|
||||
}
|
||||
"options": "Academic Year",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname":"academic_term",
|
||||
"label": __("Academic Term"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Academic Term"
|
||||
},
|
||||
{
|
||||
"fieldname":"course",
|
||||
@@ -29,6 +28,13 @@ frappe.query_reports["Course wise Assessment Report"] = {
|
||||
"label": __("Student Group"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Student Group"
|
||||
},
|
||||
{
|
||||
"fieldname":"assessment_group",
|
||||
"label": __("Assessment Group"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Assessment Group",
|
||||
"reqd": 1
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
"doctype": "Report",
|
||||
"idx": 0,
|
||||
"is_standard": "Yes",
|
||||
"modified": "2017-11-10 19:41:46.641227",
|
||||
"modified": "2018-02-08 15:11:24.904628",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Education",
|
||||
"name": "Course wise Assessment Report",
|
||||
@@ -17,7 +17,10 @@
|
||||
"report_type": "Script Report",
|
||||
"roles": [
|
||||
{
|
||||
"role": "Academics User"
|
||||
"role": "Instructor"
|
||||
},
|
||||
{
|
||||
"role": "Education Manager"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -5,129 +5,189 @@ from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe import _
|
||||
from frappe.utils import flt
|
||||
from collections import defaultdict
|
||||
from collections import defaultdict, OrderedDict
|
||||
from erpnext.education.api import get_grade
|
||||
|
||||
|
||||
def execute(filters=None):
|
||||
data = []
|
||||
|
||||
data, chart, grades = [], [], []
|
||||
args = frappe._dict()
|
||||
grade_wise_analysis = defaultdict(dict)
|
||||
|
||||
args["academic_year"] = filters.get("academic_year")
|
||||
args["course"] = filters.get("course")
|
||||
args["assessment_group"] = filters.get("assessment_group")
|
||||
|
||||
args["academic_term"] = filters.get("academic_term")
|
||||
args["student_group"] = filters.get("student_group")
|
||||
|
||||
if args["assessment_group"] == "All Assessment Groups":
|
||||
frappe.throw(_("Please select the assessment group other than 'All Assessment Groups'"))
|
||||
|
||||
args["course"] = filters.get("course")
|
||||
args["student_group"] = filters.get("student_group")
|
||||
returned_values = get_formatted_result(args, get_assessment_criteria=True)
|
||||
student_dict = returned_values["student_details"]
|
||||
result_dict = returned_values["assessment_result"]
|
||||
assessment_criteria_dict = returned_values["assessment_criteria"]
|
||||
|
||||
for student in result_dict:
|
||||
student_row = {}
|
||||
student_row["student"] = student
|
||||
student_row["student_name"] = student_dict[student]
|
||||
for criteria in assessment_criteria_dict:
|
||||
scrub_criteria = frappe.scrub(criteria)
|
||||
if criteria in result_dict[student][args.course][args.assessment_group]:
|
||||
student_row[scrub_criteria] = result_dict[student][args.course][args.assessment_group][criteria]["grade"]
|
||||
student_row[scrub_criteria + "_score"] = result_dict[student][args.course][args.assessment_group][criteria]["score"]
|
||||
|
||||
# create the list of possible grades
|
||||
if student_row[scrub_criteria] not in grades:
|
||||
grades.append(student_row[scrub_criteria])
|
||||
|
||||
# create the dict of for gradewise analysis
|
||||
if student_row[scrub_criteria] not in grade_wise_analysis[criteria]:
|
||||
grade_wise_analysis[criteria][student_row[scrub_criteria]] = 1
|
||||
else:
|
||||
grade_wise_analysis[criteria][student_row[scrub_criteria]] += 1
|
||||
else:
|
||||
student_row[frappe.scrub(criteria)] = ""
|
||||
student_row[frappe.scrub(criteria)+ "_score"] = ""
|
||||
data.append(student_row)
|
||||
|
||||
assessment_criteria_list = [d for d in assessment_criteria_dict]
|
||||
columns = get_column(assessment_criteria_dict)
|
||||
chart = get_chart_data(grades, assessment_criteria_list, grade_wise_analysis)
|
||||
|
||||
return columns, data, None, chart
|
||||
|
||||
|
||||
# find all assessment plan and related details linked with the given filters
|
||||
def get_assessment_details():
|
||||
if args["student_group"]:
|
||||
cond = "and ap.student_group=%(student_group)s"
|
||||
def get_formatted_result(args, get_assessment_criteria=False, get_course=False):
|
||||
cond, cond1, cond2, cond3, cond4 = " ", " ", " ", " ", " "
|
||||
args_list = [args.academic_year]
|
||||
|
||||
if args.course:
|
||||
cond = " and ar.course=%s"
|
||||
args_list.append(args.course)
|
||||
|
||||
if args.academic_term:
|
||||
cond1 = " and ar.academic_term=%s"
|
||||
args_list.append(args.academic_term)
|
||||
|
||||
if args.student_group:
|
||||
cond2 = " and ar.student_group=%s"
|
||||
args_list.append(args.student_group)
|
||||
|
||||
create_total_dict = False
|
||||
group_type = frappe.get_value("Assessment Group", args.assessment_group, "is_group")
|
||||
if group_type:
|
||||
from frappe.desk.treeview import get_children
|
||||
assessment_groups = [d.get("value") for d in get_children("Assessment Group",
|
||||
args.assessment_group) if d.get("value") and not d.get("expandable")]
|
||||
cond3 = " and ar.assessment_group in (%s)"%(', '.join(['%s']*len(assessment_groups)))
|
||||
else:
|
||||
assessment_groups = [args.assessment_group]
|
||||
cond3 = " and ar.assessment_group=%s"
|
||||
args_list += assessment_groups
|
||||
|
||||
if args.students:
|
||||
cond4 = " and ar.student in (%s)"%(', '.join(['%s']*len(args.students)))
|
||||
args_list += args.students
|
||||
|
||||
assessment_result = frappe.db.sql('''
|
||||
SELECT
|
||||
ar.student, ar.student_name, ar.academic_year, ar.academic_term, ar.program, ar.course,
|
||||
ar.assessment_plan, ar.grading_scale, ar.assessment_group, ar.student_group,
|
||||
ard.assessment_criteria, ard.maximum_score, ard.grade, ard.score
|
||||
FROM
|
||||
`tabAssessment Result` ar, `tabAssessment Result Detail` ard
|
||||
WHERE
|
||||
ar.name=ard.parent and ar.docstatus=1 and ar.academic_year=%s {0} {1} {2} {3} {4}
|
||||
ORDER BY
|
||||
ard.assessment_criteria'''.format(cond, cond1, cond2, cond3, cond4),
|
||||
tuple(args_list), as_dict=1)
|
||||
|
||||
# create the nested dictionary structure as given below:
|
||||
# <variable_name>.<student_name>.<course>.<assessment_group>.<assessment_criteria>.<grade/score/max_score>
|
||||
# "Total Score" -> assessment criteria used for totaling and args.assessment_group -> for totaling all the assesments
|
||||
|
||||
student_details = {}
|
||||
formatted_assessment_result = defaultdict(dict)
|
||||
assessment_criteria_dict = OrderedDict()
|
||||
course_dict = OrderedDict()
|
||||
total_maximum_score = None
|
||||
if not (len(assessment_groups) == 1 and assessment_groups[0] == args.assessment_group):
|
||||
create_total_dict = True
|
||||
|
||||
# add the score for a given score and recalculate the grades
|
||||
def add_score_and_recalculate_grade(result, assessment_group, assessment_criteria):
|
||||
formatted_assessment_result[result.student][result.course][assessment_group]\
|
||||
[assessment_criteria]["maximum_score"] += result.maximum_score
|
||||
formatted_assessment_result[result.student][result.course][assessment_group]\
|
||||
[assessment_criteria]["score"] += result.score
|
||||
tmp_grade = get_grade(result.grading_scale, ((formatted_assessment_result[result.student][result.course]
|
||||
[assessment_group][assessment_criteria]["score"])/(formatted_assessment_result[result.student]
|
||||
[result.course][assessment_group][assessment_criteria]["maximum_score"]))*100)
|
||||
formatted_assessment_result[result.student][result.course][assessment_group]\
|
||||
[assessment_criteria]["grade"] = tmp_grade
|
||||
|
||||
# create the assessment criteria "Total Score" with the sum of all the scores of the assessment criteria in a given assessment group
|
||||
def add_total_score(result, assessment_group):
|
||||
if "Total Score" not in formatted_assessment_result[result.student][result.course][assessment_group]:
|
||||
formatted_assessment_result[result.student][result.course][assessment_group]["Total Score"] = frappe._dict({
|
||||
"assessment_criteria": "Total Score", "maximum_score": result.maximum_score, "score": result.score, "grade": result.grade})
|
||||
else:
|
||||
cond = ''
|
||||
add_score_and_recalculate_grade(result, assessment_group, "Total Score")
|
||||
|
||||
assessment_plan = frappe.db.sql('''
|
||||
select
|
||||
ap.name, ap.student_group, ap.grading_scale, apc.assessment_criteria, apc.maximum_score as max_score
|
||||
from
|
||||
`tabAssessment Plan` ap, `tabAssessment Plan Criteria` apc
|
||||
where
|
||||
ap.assessment_group=%(assessment_group)s and ap.course=%(course)s and
|
||||
ap.name=apc.parent and ap.docstatus=1 {0}
|
||||
order by
|
||||
apc.assessment_criteria'''.format(cond), (args), as_dict=1)
|
||||
for result in assessment_result:
|
||||
if result.student not in student_details:
|
||||
student_details[result.student] = result.student_name
|
||||
|
||||
assessment_plan_list = list(set([d["name"] for d in assessment_plan]))
|
||||
if not assessment_plan_list:
|
||||
frappe.throw(_("No assessment plan linked with this assessment group"))
|
||||
assessment_criteria_details = frappe._dict({"assessment_criteria": result.assessment_criteria,
|
||||
"maximum_score": result.maximum_score, "score": result.score, "grade": result.grade})
|
||||
|
||||
assessment_criteria_list = list(set([(d["assessment_criteria"],d["max_score"]) for d in assessment_plan]))
|
||||
student_group_list = list(set([d["student_group"] for d in assessment_plan]))
|
||||
total_maximum_score = flt(sum([flt(d[1]) for d in assessment_criteria_list]))
|
||||
grading_scale = assessment_plan[0]["grading_scale"]
|
||||
if not formatted_assessment_result[result.student]:
|
||||
formatted_assessment_result[result.student] = defaultdict(dict)
|
||||
if not formatted_assessment_result[result.student][result.course]:
|
||||
formatted_assessment_result[result.student][result.course] = defaultdict(dict)
|
||||
|
||||
return assessment_plan_list, assessment_criteria_list, total_maximum_score, grading_scale, student_group_list
|
||||
if not create_total_dict:
|
||||
formatted_assessment_result[result.student][result.course][result.assessment_group]\
|
||||
[result.assessment_criteria] = assessment_criteria_details
|
||||
add_total_score(result, result.assessment_group)
|
||||
|
||||
# create the total of all the assessment groups criteria-wise
|
||||
elif create_total_dict:
|
||||
if not formatted_assessment_result[result.student][result.course][args.assessment_group]:
|
||||
formatted_assessment_result[result.student][result.course][args.assessment_group] = defaultdict(dict)
|
||||
formatted_assessment_result[result.student][result.course][args.assessment_group]\
|
||||
[result.assessment_criteria] = assessment_criteria_details
|
||||
elif result.assessment_criteria not in formatted_assessment_result[result.student][result.course][args.assessment_group]:
|
||||
formatted_assessment_result[result.student][result.course][args.assessment_group]\
|
||||
[result.assessment_criteria] = assessment_criteria_details
|
||||
elif result.assessment_criteria in formatted_assessment_result[result.student][result.course][args.assessment_group]:
|
||||
add_score_and_recalculate_grade(result, args.assessment_group, result.assessment_criteria)
|
||||
|
||||
add_total_score(result, args.assessment_group)
|
||||
|
||||
total_maximum_score = formatted_assessment_result[result.student][result.course][args.assessment_group]\
|
||||
["Total Score"]["maximum_score"]
|
||||
if get_assessment_criteria:
|
||||
assessment_criteria_dict[result.assessment_criteria] = formatted_assessment_result[result.student][result.course]\
|
||||
[args.assessment_group][result.assessment_criteria]["maximum_score"]
|
||||
if get_course:
|
||||
course_dict[result.course] = total_maximum_score
|
||||
|
||||
if get_assessment_criteria and total_maximum_score:
|
||||
assessment_criteria_dict["Total Score"] = total_maximum_score
|
||||
|
||||
return {
|
||||
"student_details": student_details,
|
||||
"assessment_result": formatted_assessment_result,
|
||||
"assessment_criteria": assessment_criteria_dict,
|
||||
"course_dict": course_dict
|
||||
}
|
||||
|
||||
|
||||
# get all the result and make a dict map student as the key and value as dict of result
|
||||
def get_result_map():
|
||||
result_dict = defaultdict(dict)
|
||||
kounter = defaultdict(dict)
|
||||
assessment_result = frappe.db.sql('''select ar.student, ard.assessment_criteria, ard.grade, ard.score
|
||||
from `tabAssessment Result` ar, `tabAssessment Result Detail` ard
|
||||
where ar.assessment_plan in (%s) and ar.name=ard.parent and ar.docstatus=1
|
||||
order by ard.assessment_criteria''' %', '.join(['%s']*len(assessment_plan_list)),
|
||||
tuple(assessment_plan_list), as_dict=1)
|
||||
|
||||
for result in assessment_result:
|
||||
if "total_score" in result_dict[result.student]:
|
||||
total_score = result_dict[result.student]["total_score"] + result.score
|
||||
else:
|
||||
total_score = result.score
|
||||
total = get_grade(grading_scale, (total_score/total_maximum_score)*100)
|
||||
|
||||
if result.grade in kounter[result.assessment_criteria]:
|
||||
kounter[result.assessment_criteria][result.grade] += 1
|
||||
else:
|
||||
kounter[result.assessment_criteria].update({result.grade: 1})
|
||||
|
||||
if "Total" not in kounter:
|
||||
kounter["Total"] = {}
|
||||
|
||||
if "total" in result_dict[result.student]:
|
||||
prev_grade = result_dict[result.student]["total"]
|
||||
prev_grade_count = kounter["Total"].get(prev_grade) - 1
|
||||
kounter["Total"].update({prev_grade: prev_grade_count})
|
||||
latest_grade_count = kounter["Total"].get(total)+1 if kounter["Total"].get(total) else 1
|
||||
kounter["Total"].update({total: latest_grade_count})
|
||||
|
||||
result_dict[result.student].update({
|
||||
frappe.scrub(result.assessment_criteria): result.grade,
|
||||
frappe.scrub(result.assessment_criteria)+"_score": result.score,
|
||||
"total_score": total_score,
|
||||
"total": total
|
||||
})
|
||||
|
||||
return result_dict, kounter
|
||||
|
||||
# make data from the result dict
|
||||
def get_data():
|
||||
student_list = frappe.db.sql('''select sgs.student, sgs.student_name
|
||||
from `tabStudent Group` sg, `tabStudent Group Student` sgs
|
||||
where sg.name = sgs.parent and sg.name in (%s)
|
||||
order by sgs.group_roll_number asc''' %', '.join(['%s']*len(student_group_list)),
|
||||
tuple(student_group_list), as_dict=1)
|
||||
|
||||
for student in student_list:
|
||||
student.update(result_dict[student.student])
|
||||
return student_list
|
||||
|
||||
|
||||
# get chart data
|
||||
def get_chart():
|
||||
grading_scale = frappe.db.get_value("Assessment Plan", list(assessment_plan_list)[0], "grading_scale")
|
||||
grades = frappe.db.sql_list('''select grade_code from `tabGrading Scale Interval` where parent=%s''',
|
||||
(grading_scale))
|
||||
criteria_list = [d[0] for d in assessment_criteria_list] + ["Total"]
|
||||
return get_chart_data(grades, criteria_list, kounter)
|
||||
|
||||
|
||||
assessment_plan_list, assessment_criteria_list, total_maximum_score, grading_scale,\
|
||||
student_group_list = get_assessment_details()
|
||||
result_dict, kounter = get_result_map()
|
||||
data = get_data()
|
||||
|
||||
columns = get_column(assessment_criteria_list, total_maximum_score)
|
||||
chart = get_chart()
|
||||
data_to_be_printed = [{
|
||||
"assessment_plan": ", ".join(assessment_plan_list)
|
||||
}]
|
||||
|
||||
return columns, data, None, chart, data_to_be_printed
|
||||
|
||||
def get_column(assessment_criteria, total_maximum_score):
|
||||
def get_column(assessment_criteria):
|
||||
columns = [{
|
||||
"fieldname": "student",
|
||||
"label": _("Student ID"),
|
||||
@@ -143,40 +203,28 @@ def get_column(assessment_criteria, total_maximum_score):
|
||||
}]
|
||||
for d in assessment_criteria:
|
||||
columns.append({
|
||||
"fieldname": frappe.scrub(d[0]),
|
||||
"label": d[0],
|
||||
"fieldname": frappe.scrub(d),
|
||||
"label": d,
|
||||
"fieldtype": "Data",
|
||||
"width": 110
|
||||
})
|
||||
columns.append({
|
||||
"fieldname": frappe.scrub(d[0]) +"_score",
|
||||
"label": "Score(" + str(int(d[1])) + ")",
|
||||
"fieldname": frappe.scrub(d) +"_score",
|
||||
"label": "Score(" + str(int(assessment_criteria[d])) + ")",
|
||||
"fieldtype": "Float",
|
||||
"width": 100
|
||||
})
|
||||
|
||||
columns += [{
|
||||
"fieldname": "total",
|
||||
"label": "Total",
|
||||
"fieldtype": "Data",
|
||||
"width": 100
|
||||
},
|
||||
{
|
||||
"fieldname": "total_score",
|
||||
"label": "Total Score("+ str(int(total_maximum_score)) + ")",
|
||||
"fieldtype": "Float",
|
||||
"width": 110
|
||||
}]
|
||||
|
||||
return columns
|
||||
|
||||
def get_chart_data(grades, assessment_criteria_list, kounter):
|
||||
|
||||
def get_chart_data(grades, criteria_list, kounter):
|
||||
grades = sorted(grades)
|
||||
datasets = []
|
||||
|
||||
for grade in grades:
|
||||
tmp = frappe._dict({"values":[], "title": grade})
|
||||
for criteria in assessment_criteria_list:
|
||||
for criteria in criteria_list:
|
||||
if grade in kounter[criteria]:
|
||||
tmp["values"].append(kounter[criteria][grade])
|
||||
else:
|
||||
@@ -185,7 +233,7 @@ def get_chart_data(grades, assessment_criteria_list, kounter):
|
||||
|
||||
return {
|
||||
"data": {
|
||||
"labels": assessment_criteria_list,
|
||||
"labels": criteria_list,
|
||||
"datasets": datasets
|
||||
},
|
||||
"type": 'bar',
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
|
||||
// For license information, please see license.txt
|
||||
/* eslint-disable */
|
||||
|
||||
frappe.query_reports["Final Assessment Grades"] = {
|
||||
"filters": [
|
||||
{
|
||||
"fieldname":"academic_year",
|
||||
"label": __("Academic Year"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Academic Year",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname":"student_group",
|
||||
"label": __("Student Group"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Student Group",
|
||||
"reqd": 1,
|
||||
"get_query": function() {
|
||||
return{
|
||||
filters: {
|
||||
"group_based_on": "Batch",
|
||||
"academic_year": frappe.query_report_filters_by_name.academic_year.value
|
||||
}
|
||||
};
|
||||
}
|
||||
},
|
||||
{
|
||||
"fieldname":"assessment_group",
|
||||
"label": __("Assessment Group"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Assessment Group",
|
||||
"reqd": 1
|
||||
}
|
||||
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"add_total_row": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"creation": "2018-01-22 17:04:43.412054",
|
||||
"disabled": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "Report",
|
||||
"idx": 0,
|
||||
"is_standard": "Yes",
|
||||
"letter_head": "Shishuvan Secondary School",
|
||||
"modified": "2018-02-08 15:11:35.339434",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Education",
|
||||
"name": "Final Assessment Grades",
|
||||
"owner": "Administrator",
|
||||
"ref_doctype": "Assessment Result",
|
||||
"report_name": "Final Assessment Grades",
|
||||
"report_type": "Script Report",
|
||||
"roles": [
|
||||
{
|
||||
"role": "Instructor"
|
||||
},
|
||||
{
|
||||
"role": "Education Manager"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
# Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe import _
|
||||
from collections import defaultdict
|
||||
|
||||
from erpnext.education.report.course_wise_assessment_report.course_wise_assessment_report import get_formatted_result
|
||||
from erpnext.education.report.course_wise_assessment_report.course_wise_assessment_report import get_chart_data
|
||||
|
||||
|
||||
def execute(filters=None):
|
||||
columns, data, grades = [], [], []
|
||||
args = frappe._dict()
|
||||
course_wise_analysis = defaultdict(dict)
|
||||
|
||||
args["academic_year"] = filters.get("academic_year")
|
||||
assessment_group = args["assessment_group"] = filters.get("assessment_group")
|
||||
|
||||
student_group = filters.get("student_group")
|
||||
args.students = frappe.db.sql_list("select student from `tabStudent Group Student` where parent=%s", (student_group))
|
||||
|
||||
values = get_formatted_result(args, get_course=True)
|
||||
student_details = values.get("student_details")
|
||||
assessment_result = values.get("assessment_result")
|
||||
course_dict = values.get("course_dict")
|
||||
|
||||
for student in args.students:
|
||||
student_row = {}
|
||||
student_row["student"] = student
|
||||
student_row["student_name"] = student_details[student]
|
||||
for course in course_dict:
|
||||
scrub_course = frappe.scrub(course)
|
||||
if assessment_group in assessment_result[student][course]:
|
||||
student_row["grade_" + scrub_course] = assessment_result[student][course][assessment_group]["Total Score"]["grade"]
|
||||
student_row["score_" + scrub_course] = assessment_result[student][course][assessment_group]["Total Score"]["score"]
|
||||
|
||||
# create the list of possible grades
|
||||
if student_row["grade_" + scrub_course] not in grades:
|
||||
grades.append(student_row["grade_" + scrub_course])
|
||||
|
||||
# create the dict of for gradewise analysis
|
||||
if student_row["grade_" + scrub_course] not in course_wise_analysis[course]:
|
||||
course_wise_analysis[course][student_row["grade_" + scrub_course]] = 1
|
||||
else:
|
||||
course_wise_analysis[course][student_row["grade_" + scrub_course]] += 1
|
||||
|
||||
data.append(student_row)
|
||||
|
||||
course_list = [d for d in course_dict]
|
||||
columns = get_column(course_dict)
|
||||
chart = get_chart_data(grades, course_list, course_wise_analysis)
|
||||
return columns, data, None, chart
|
||||
|
||||
|
||||
def get_column(course_dict):
|
||||
columns = [{
|
||||
"fieldname": "student",
|
||||
"label": _("Student ID"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Student",
|
||||
"width": 90
|
||||
},
|
||||
{
|
||||
"fieldname": "student_name",
|
||||
"label": _("Student Name"),
|
||||
"fieldtype": "Data",
|
||||
"width": 160
|
||||
}]
|
||||
for course in course_dict:
|
||||
columns.append({
|
||||
"fieldname": "grade_" + frappe.scrub(course),
|
||||
"label": course,
|
||||
"fieldtype": "Data",
|
||||
"width": 110
|
||||
})
|
||||
columns.append({
|
||||
"fieldname": "score_" + frappe.scrub(course),
|
||||
"label": "Score(" + str(course_dict[course]) + ")",
|
||||
"fieldtype": "Float",
|
||||
"width": 100
|
||||
})
|
||||
|
||||
return columns
|
||||
@@ -14,6 +14,10 @@
|
||||
margin-bottom: -4px;
|
||||
}
|
||||
|
||||
.medical_record-row > * {
|
||||
z-index: -999;
|
||||
}
|
||||
|
||||
.date-indicator {
|
||||
background:none;
|
||||
font-size:12px;
|
||||
@@ -48,7 +52,6 @@
|
||||
.medical_record-date {
|
||||
padding: 15px;
|
||||
padding-right: 0px;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
#page-medical_record .plot-wrapper {
|
||||
|
||||
@@ -11,7 +11,7 @@ app_email = "info@erpnext.com"
|
||||
app_license = "GNU General Public License (v3)"
|
||||
source_link = "https://github.com/frappe/erpnext"
|
||||
|
||||
develop_version = '9.x.x-develop'
|
||||
develop_version = '10.x.x-develop'
|
||||
|
||||
error_report_email = "support@erpnext.com"
|
||||
|
||||
@@ -203,6 +203,9 @@ doc_events = {
|
||||
},
|
||||
'Address': {
|
||||
'validate': 'erpnext.regional.india.utils.validate_gstin_for_india'
|
||||
},
|
||||
('Sales Invoice', 'Purchase Invoice'): {
|
||||
'validate': 'erpnext.regional.india.utils.set_place_of_supply'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ frappe.ui.form.on('Employee',{
|
||||
}
|
||||
frappe.call({
|
||||
method: "erpnext.hr.doctype.employee.employee.create_user",
|
||||
args: { employee: cur_frm.doc.name },
|
||||
args: { employee: frm.doc.name, email: frm.doc.prefered_email },
|
||||
callback: function(r)
|
||||
{
|
||||
frm.set_value("user_id", r.message)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user