Compare commits
1846 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bc41ce95fc | ||
|
|
4948d336c4 | ||
|
|
be2527d93d | ||
|
|
7f5bb1c8aa | ||
|
|
a8d40e4409 | ||
|
|
e9b4686fec | ||
|
|
5086ef2499 | ||
|
|
1caca80203 | ||
|
|
9114c26857 | ||
|
|
941a965af4 | ||
|
|
4acd431b92 | ||
|
|
fad0d566f9 | ||
|
|
e2d4079363 | ||
|
|
b9ce1f590b | ||
|
|
36463ed790 | ||
|
|
3c8838816d | ||
|
|
11e50a8eee | ||
|
|
9de4c60bd6 | ||
|
|
5288bdeabb | ||
|
|
f5804438bb | ||
|
|
6e06357dc5 | ||
|
|
28913b97b0 | ||
|
|
c59cd46391 | ||
|
|
dda239fd49 | ||
|
|
b86a6ce26a | ||
|
|
ee212e7bb5 | ||
|
|
4952c7b3b5 | ||
|
|
4e61536f50 | ||
|
|
f2886f152b | ||
|
|
b5c56f6cea | ||
|
|
80e95388f5 | ||
|
|
daed0b655a | ||
|
|
fbb994c731 | ||
|
|
10b155a486 | ||
|
|
ce6eda709b | ||
|
|
14e1d20df3 | ||
|
|
da8a02d56e | ||
|
|
16343683d9 | ||
|
|
2bdc017aff | ||
|
|
16e05c321c | ||
|
|
23d7919865 | ||
|
|
38265efc39 | ||
|
|
2d414706dc | ||
|
|
d85e4b0d46 | ||
|
|
45d03af8f6 | ||
|
|
73a3a2a131 | ||
|
|
73804580d4 | ||
|
|
259f9779db | ||
|
|
14e0e58a7d | ||
|
|
5eb373f7b5 | ||
|
|
4595c30a7b | ||
|
|
fc2dd44694 | ||
|
|
053c54017e | ||
|
|
af473d78f2 | ||
|
|
26d096aa87 | ||
|
|
476c613ba6 | ||
|
|
2348a5f592 | ||
|
|
9d8d045c66 | ||
|
|
63914dd55b | ||
|
|
93a8042f08 | ||
|
|
b2f32dac1b | ||
|
|
577a3acaac | ||
|
|
5e46ce8a50 | ||
|
|
3b7342b7b5 | ||
|
|
531077e504 | ||
|
|
147918ed66 | ||
|
|
9bbfca9226 | ||
|
|
f1a07ff105 | ||
|
|
fb6e434315 | ||
|
|
3811d96feb | ||
|
|
1017615d02 | ||
|
|
056d627f46 | ||
|
|
663bfeacf4 | ||
|
|
e918ebd721 | ||
|
|
0dc18f0102 | ||
|
|
8ddc882a66 | ||
|
|
49365d0982 | ||
|
|
50c29c7d0f | ||
|
|
bf492122f8 | ||
|
|
38d0ed9f3a | ||
|
|
248a65b37d | ||
|
|
78f86e9385 | ||
|
|
d9f3e0c275 | ||
|
|
c40451ee2e | ||
|
|
6644406185 | ||
|
|
b3a962e121 | ||
|
|
8a28ccfa2f | ||
|
|
0a75fa09ef | ||
|
|
17a16eeaf4 | ||
|
|
3d3f0bcf54 | ||
|
|
bc8b20ae3c | ||
|
|
daf344e5fd | ||
|
|
7916792f99 | ||
|
|
27e37e68b2 | ||
|
|
a538f8a24a | ||
|
|
70ec88b733 | ||
|
|
4f0e5db216 | ||
|
|
79ed124939 | ||
|
|
c0a3cd603b | ||
|
|
7c6f990cf9 | ||
|
|
7820b171d3 | ||
|
|
0cf4cc283c | ||
|
|
9a4b173b88 | ||
|
|
6d83454237 | ||
|
|
ff231b5e62 | ||
|
|
4d74216147 | ||
|
|
b7e5ad0a31 | ||
|
|
e435592d64 | ||
|
|
7ddde8dc3a | ||
|
|
fce2881de6 | ||
|
|
e96e83d557 | ||
|
|
1b2944e871 | ||
|
|
074e73a0dd | ||
|
|
8923801881 | ||
|
|
cfafe93391 | ||
|
|
6c48ef781b | ||
|
|
adeb976a1b | ||
|
|
bb19b91ef9 | ||
|
|
bfa7f171bd | ||
|
|
b96c014daf | ||
|
|
e0c83e22d9 | ||
|
|
099ad0f5e1 | ||
|
|
cf9746dd84 | ||
|
|
b70712dbba | ||
|
|
4c057fe693 | ||
|
|
ee8ff51d60 | ||
|
|
9974b16c32 | ||
|
|
9e5f319d80 | ||
|
|
4f614b4030 | ||
|
|
3d458e973e | ||
|
|
3a19a71262 | ||
|
|
29d1a1c593 | ||
|
|
3b90de558f | ||
|
|
af7e31acb3 | ||
|
|
a2c9d35efb | ||
|
|
4c058f4056 | ||
|
|
ad67b84d43 | ||
|
|
4e81e4065b | ||
|
|
81332789cb | ||
|
|
82d7c0c9eb | ||
|
|
d60235e239 | ||
|
|
9b50b0a762 | ||
|
|
21e14c4c98 | ||
|
|
16edacebc7 | ||
|
|
75027b4d54 | ||
|
|
b0bd99266d | ||
|
|
b9e04815f8 | ||
|
|
18ccc27b1b | ||
|
|
95f1fe92e2 | ||
|
|
b783f519ee | ||
|
|
996a1010cb | ||
|
|
32a9dfd983 | ||
|
|
1394509343 | ||
|
|
0f31c36b2c | ||
|
|
14ac8f71b7 | ||
|
|
6a92d51383 | ||
|
|
7c831c3fe5 | ||
|
|
778ff463af | ||
|
|
70a31d5402 | ||
|
|
48f5fa69f3 | ||
|
|
83a2d12cd2 | ||
|
|
e539297e53 | ||
|
|
bbc3d015a3 | ||
|
|
e4475c635d | ||
|
|
8370cb3e71 | ||
|
|
4073880ecf | ||
|
|
763c7a56dc | ||
|
|
556fbc487d | ||
|
|
54938d431c | ||
|
|
31c61e7eae | ||
|
|
a23151b138 | ||
|
|
11b75759d2 | ||
|
|
a2c562fea4 | ||
|
|
8950abc36f | ||
|
|
27c7226d97 | ||
|
|
1db294e837 | ||
|
|
16e943f120 | ||
|
|
9d610214cf | ||
|
|
c25681c36c | ||
|
|
1aea75261d | ||
|
|
5cd20e3d24 | ||
|
|
9968c7ef70 | ||
|
|
ca260618d8 | ||
|
|
30c5b41398 | ||
|
|
f37d4337a4 | ||
|
|
93c2adb2cd | ||
|
|
525ab0a925 | ||
|
|
a92c6886cd | ||
|
|
01d171756b | ||
|
|
930e7f5578 | ||
|
|
d14e15d432 | ||
|
|
4d3a18890b | ||
|
|
65bef02607 | ||
|
|
cb9331ddca | ||
|
|
ac0c3fb696 | ||
|
|
a844fb78bb | ||
|
|
6d02939256 | ||
|
|
e3b63f2d9c | ||
|
|
1c440b3b31 | ||
|
|
c5a0ef8399 | ||
|
|
951da0ca3d | ||
|
|
351be9ca42 | ||
|
|
4bab0a2f54 | ||
|
|
97478b746d | ||
|
|
61a591944b | ||
|
|
8e7ca41817 | ||
|
|
84e08fd534 | ||
|
|
b0e56fa1b5 | ||
|
|
e7c48ed3b0 | ||
|
|
c432270ca8 | ||
|
|
6a7f75c3e3 | ||
|
|
e9882e12ba | ||
|
|
3df10429db | ||
|
|
eee569bb20 | ||
|
|
2e07305616 | ||
|
|
2f9c36a588 | ||
|
|
907494c5d4 | ||
|
|
b14401c320 | ||
|
|
4d2520ea53 | ||
|
|
cece0c7ffe | ||
|
|
5e34383e25 | ||
|
|
b2a3f2d386 | ||
|
|
8e39ee79b0 | ||
|
|
6b679c45df | ||
|
|
e3d2643f2b | ||
|
|
fc33d5a75b | ||
|
|
6e566fb154 | ||
|
|
6675ce9036 | ||
|
|
2cf75fcca2 | ||
|
|
941f698daf | ||
|
|
48b3d1383f | ||
|
|
dc79334f1c | ||
|
|
ab74a502e2 | ||
|
|
fa18e7c21f | ||
|
|
ff7e9b6b22 | ||
|
|
00e93d1c1d | ||
|
|
45c9b1c065 | ||
|
|
dcfcd693c2 | ||
|
|
7ab4ee1d79 | ||
|
|
c017ed251d | ||
|
|
34b94aff73 | ||
|
|
65a5f85af5 | ||
|
|
52a39a00d5 | ||
|
|
ce9a9eeecc | ||
|
|
cbd433603d | ||
|
|
91fb661d12 | ||
|
|
0b74b6d98c | ||
|
|
d42326bf43 | ||
|
|
4c93f35c2b | ||
|
|
84f0cc6614 | ||
|
|
0f798dda15 | ||
|
|
629e51a8e9 | ||
|
|
4211aa41a0 | ||
|
|
5893e143f4 | ||
|
|
d91c4d3e00 | ||
|
|
3d911eba6c | ||
|
|
0c8e4335f9 | ||
|
|
247e9ffc96 | ||
|
|
3f4c3086df | ||
|
|
a84f3663dd | ||
|
|
714b3ef7f8 | ||
|
|
96bdc5834c | ||
|
|
3f4885e342 | ||
|
|
ee2bc92ab2 | ||
|
|
144f06e381 | ||
|
|
7f3f2a0f0a | ||
|
|
9e563e7b47 | ||
|
|
12ce3eefca | ||
|
|
f395b7ce11 | ||
|
|
4228adfaa7 | ||
|
|
8ad474b910 | ||
|
|
737d8e4d9f | ||
|
|
aaac7c17b8 | ||
|
|
28a975dd32 | ||
|
|
e60822b094 | ||
|
|
ac085e0f59 | ||
|
|
e8331d40f3 | ||
|
|
21b8d30c80 | ||
|
|
24989b90ba | ||
|
|
4f1bccb53d | ||
|
|
98eacdb785 | ||
|
|
8331ec7482 | ||
|
|
d43752fc4f | ||
|
|
bd03c8b28a | ||
|
|
d490933fce | ||
|
|
f65817d4c2 | ||
|
|
40a8ae2907 | ||
|
|
12b98027ee | ||
|
|
45a0ea9628 | ||
|
|
98ff85dea1 | ||
|
|
0015157cba | ||
|
|
f513531d3a | ||
|
|
4e16e9ed89 | ||
|
|
9f0ea97d85 | ||
|
|
7a435bb4f1 | ||
|
|
014346acba | ||
|
|
c90773cc85 | ||
|
|
0514e07ef4 | ||
|
|
14b8af2e65 | ||
|
|
818bacae49 | ||
|
|
6ba2e3deef | ||
|
|
bb370f3b6a | ||
|
|
f680626f53 | ||
|
|
83ca3e5563 | ||
|
|
37cb544839 | ||
|
|
ec8964dde5 | ||
|
|
913c51b1f8 | ||
|
|
cd1efb94ed | ||
|
|
d6d71e8078 | ||
|
|
4cb67339c5 | ||
|
|
4b71fe6fc1 | ||
|
|
46256cddd7 | ||
|
|
ad24069cdc | ||
|
|
3b1733bc04 | ||
|
|
43f087c99d | ||
|
|
54ca95bc6e | ||
|
|
e3f2323e14 | ||
|
|
c147667486 | ||
|
|
5ed2c06eb5 | ||
|
|
9d1e8b61fe | ||
|
|
e0ffe7a575 | ||
|
|
d676491b6e | ||
|
|
580f447bbd | ||
|
|
52f04da5f5 | ||
|
|
06927a20b2 | ||
|
|
caba531e89 | ||
|
|
7a6ab91080 | ||
|
|
e8dd4160d4 | ||
|
|
bb6b58c271 | ||
|
|
def374370f | ||
|
|
b748115609 | ||
|
|
a592a914b8 | ||
|
|
1ae48f4988 | ||
|
|
bb29d15d5a | ||
|
|
40e3d0c780 | ||
|
|
00fc600e8b | ||
|
|
f4ad37d208 | ||
|
|
79f91109cd | ||
|
|
d67cbdf725 | ||
|
|
16aba71da0 | ||
|
|
9426522159 | ||
|
|
8058832a48 | ||
|
|
fa3f22c448 | ||
|
|
cabf9c5bee | ||
|
|
4417529952 | ||
|
|
bb3f192b07 | ||
|
|
f71011aff0 | ||
|
|
df5ab4e228 | ||
|
|
b02b59b8c8 | ||
|
|
f29449ba07 | ||
|
|
bf4ceb981f | ||
|
|
84e5a4a2c2 | ||
|
|
ebd30beee4 | ||
|
|
cb067aa579 | ||
|
|
74bc2baa1d | ||
|
|
f546ab3130 | ||
|
|
35142cb206 | ||
|
|
13313b5cb6 | ||
|
|
432431f2e6 | ||
|
|
dd952146d1 | ||
|
|
237f3765e5 | ||
|
|
cca6460e65 | ||
|
|
354acf6fc9 | ||
|
|
7ce0609800 | ||
|
|
0a35effe49 | ||
|
|
95b395505f | ||
|
|
67e14a48b8 | ||
|
|
2026148dbe | ||
|
|
78b6366325 | ||
|
|
9c3535307f | ||
|
|
5e893ef8fd | ||
|
|
f72de95a38 | ||
|
|
6ab831b387 | ||
|
|
e4c434ab6f | ||
|
|
1f3310e0d1 | ||
|
|
c41a9480b8 | ||
|
|
6394f5b1a9 | ||
|
|
448c9b71c1 | ||
|
|
32a3a86a00 | ||
|
|
dcce0c86ed | ||
|
|
f4b3d30312 | ||
|
|
62aa8fa4e7 | ||
|
|
e8a52d810f | ||
|
|
5e27a759b7 | ||
|
|
c0d31ce648 | ||
|
|
eb39435481 | ||
|
|
54498452b6 | ||
|
|
821aad5281 | ||
|
|
5145b1445b | ||
|
|
e368091627 | ||
|
|
d5a08ea449 | ||
|
|
c31a1eec5b | ||
|
|
0d0f5f6c25 | ||
|
|
ab8bde0149 | ||
|
|
cf8bb668b3 | ||
|
|
f0075b9ce2 | ||
|
|
67d249eea9 | ||
|
|
c7105a1a79 | ||
|
|
f957cbd8ef | ||
|
|
5c0db8d05e | ||
|
|
200e8d971f | ||
|
|
a97e700371 | ||
|
|
4e6c52dd24 | ||
|
|
2b776e8c3a | ||
|
|
f3e1181ad9 | ||
|
|
9cbcf96aeb | ||
|
|
8ca3189f07 | ||
|
|
98e7dcfe2c | ||
|
|
cfd1b10980 | ||
|
|
f807cda375 | ||
|
|
11594c7927 | ||
|
|
509aa52efc | ||
|
|
e2c3f7ab14 | ||
|
|
fe39442c48 | ||
|
|
b21b6598f1 | ||
|
|
5e1b0014c2 | ||
|
|
cc0692d714 | ||
|
|
87f2401c1e | ||
|
|
f6ea21c8ae | ||
|
|
4436157da1 | ||
|
|
b00a2422e4 | ||
|
|
475b118fba | ||
|
|
42335fb2cb | ||
|
|
15ec1e1860 | ||
|
|
96964a4e03 | ||
|
|
e4aaa3d18f | ||
|
|
a6b597a0bd | ||
|
|
52d1ea83a0 | ||
|
|
5d64f5abd4 | ||
|
|
3e103ebffe | ||
|
|
992bc448a2 | ||
|
|
23607f91cd | ||
|
|
3a97739f83 | ||
|
|
e0ee6fe8cd | ||
|
|
a3f76fc14d | ||
|
|
c85abbfeca | ||
|
|
139ec2a64f | ||
|
|
72e1719220 | ||
|
|
3de7757ba4 | ||
|
|
7c3fad63b1 | ||
|
|
6b8145a813 | ||
|
|
688a7a7329 | ||
|
|
26201a5828 | ||
|
|
6cd59537b6 | ||
|
|
854f9895e4 | ||
|
|
4cc94df752 | ||
|
|
03eadb74ab | ||
|
|
7a4e739d6c | ||
|
|
a660464cec | ||
|
|
c9bd3f5d4a | ||
|
|
873141c1a5 | ||
|
|
8544447b19 | ||
|
|
18eb4f5015 | ||
|
|
67af99794d | ||
|
|
b5e768906a | ||
|
|
c13727adba | ||
|
|
69ccf9695c | ||
|
|
995185d02d | ||
|
|
f4de6e21fa | ||
|
|
a6db05e18d | ||
|
|
d91cefb23d | ||
|
|
e7f7416190 | ||
|
|
67cd3fb89c | ||
|
|
849b7b172a | ||
|
|
9a0c46fda7 | ||
|
|
05b56d0d08 | ||
|
|
43ffa64849 | ||
|
|
7881df2138 | ||
|
|
fd90571d49 | ||
|
|
9f7e00bb3a | ||
|
|
45b7d17ee8 | ||
|
|
859a995bd6 | ||
|
|
959bd6e9e7 | ||
|
|
9c47cae5c7 | ||
|
|
f16fefafe3 | ||
|
|
8d16e9fd6d | ||
|
|
2b8344e75c | ||
|
|
a8755af0fa | ||
|
|
ca70eaa388 | ||
|
|
1271bc4457 | ||
|
|
4d18b3f96d | ||
|
|
1279f1d430 | ||
|
|
e88b7fbcc4 | ||
|
|
8c838061f9 | ||
|
|
6c608e04bc | ||
|
|
6e4efa7edd | ||
|
|
a66ef778ec | ||
|
|
1b90207360 | ||
|
|
3f28ac3205 | ||
|
|
29817d6d8b | ||
|
|
92980e6882 | ||
|
|
b4ad175b13 | ||
|
|
b91079676d | ||
|
|
fbe37c9158 | ||
|
|
1483e9d8d2 | ||
|
|
8efd74b9b1 | ||
|
|
c2371af779 | ||
|
|
8dbd295c9b | ||
|
|
d6ff58daa1 | ||
|
|
4859b48c43 | ||
|
|
c34329284b | ||
|
|
0ad677045a | ||
|
|
c1f65dd863 | ||
|
|
b9fed3f046 | ||
|
|
35cc320e21 | ||
|
|
5a5b405a18 | ||
|
|
cd4d6a228b | ||
|
|
6c5e1c9701 | ||
|
|
627f13ea26 | ||
|
|
20fbfa2a44 | ||
|
|
3f790eae55 | ||
|
|
ddbf14adba | ||
|
|
22608ad206 | ||
|
|
60ee2ea8af | ||
|
|
bc708ee4c2 | ||
|
|
0e93352c8d | ||
|
|
a12312553b | ||
|
|
78777e141a | ||
|
|
9d9192d496 | ||
|
|
ad1638e6b6 | ||
|
|
0bab81aef9 | ||
|
|
92a1e06665 | ||
|
|
079611936f | ||
|
|
d4b92a1d20 | ||
|
|
7555d619f2 | ||
|
|
bd748bd115 | ||
|
|
85eefadada | ||
|
|
07d3261467 | ||
|
|
11586eda4c | ||
|
|
423361946d | ||
|
|
0a35277c96 | ||
|
|
16317748dd | ||
|
|
3d48a4ef65 | ||
|
|
b739264243 | ||
|
|
957971eb1d | ||
|
|
e3c161f0ea | ||
|
|
39edcbc93b | ||
|
|
beb3e35153 | ||
|
|
0416e59267 | ||
|
|
57f8dabf59 | ||
|
|
9ea4154b81 | ||
|
|
9c018fe984 | ||
|
|
faeca7cf11 | ||
|
|
f8b318aef1 | ||
|
|
93e2defc96 | ||
|
|
1c735365d0 | ||
|
|
161f63d393 | ||
|
|
8f49cf7c03 | ||
|
|
62b1cbf003 | ||
|
|
a5437cdac1 | ||
|
|
16deabef82 | ||
|
|
82ec488b99 | ||
|
|
781ddc3a25 | ||
|
|
85ff3bcd04 | ||
|
|
5b51cc86a9 | ||
|
|
d82352eacc | ||
|
|
f84c240d1c | ||
|
|
28804bfb62 | ||
|
|
5cf3a6bcd2 | ||
|
|
329a8ef9a1 | ||
|
|
9e89dcf855 | ||
|
|
344dd3793a | ||
|
|
d93f4c99e1 | ||
|
|
ffd57a0565 | ||
|
|
92c043423e | ||
|
|
d1a2ce2750 | ||
|
|
3c78ab5841 | ||
|
|
de85a3af15 | ||
|
|
cb86d597b7 | ||
|
|
9df4196597 | ||
|
|
87633d6be6 | ||
|
|
33a94a74df | ||
|
|
b5ae643b6e | ||
|
|
b0cffac79d | ||
|
|
b5f9b5de45 | ||
|
|
c772b3d86a | ||
|
|
7d7123de37 | ||
|
|
7f1e4a29c5 | ||
|
|
97ab902895 | ||
|
|
6e15f675a5 | ||
|
|
67ecce695d | ||
|
|
ac11d6ff97 | ||
|
|
4c5d7617fb | ||
|
|
7fcb3c9865 | ||
|
|
994d9075b4 | ||
|
|
649d18c4f7 | ||
|
|
cbf0cb7de7 | ||
|
|
5f0459c321 | ||
|
|
2d355c7478 | ||
|
|
4dfe19e613 | ||
|
|
1c6313679b | ||
|
|
f457bce0e7 | ||
|
|
6cc5babd2e | ||
|
|
db4ba39824 | ||
|
|
825d014616 | ||
|
|
fa576a22e3 | ||
|
|
059f1e09a8 | ||
|
|
7a7675c7ef | ||
|
|
b1e7bf16ba | ||
|
|
711e8bec3d | ||
|
|
b1c5738a67 | ||
|
|
5283e5a7d8 | ||
|
|
1a2516d4be | ||
|
|
d141cf7293 | ||
|
|
3c45c37428 | ||
|
|
d4e080be29 | ||
|
|
84fd33ea7a | ||
|
|
87e30f68b9 | ||
|
|
e8332be285 | ||
|
|
e5df7a7f01 | ||
|
|
fa0db761da | ||
|
|
5f2f955224 | ||
|
|
e26204e61d | ||
|
|
fa1cd5faff | ||
|
|
d16081c4d9 | ||
|
|
143400d444 | ||
|
|
96cb130263 | ||
|
|
0a4c824a06 | ||
|
|
b8189d7d23 | ||
|
|
4b5e89a067 | ||
|
|
f214bfcfc3 | ||
|
|
2e21e25613 | ||
|
|
d93fa2f78b | ||
|
|
75936cdde5 | ||
|
|
e73ed2afae | ||
|
|
c70d2d23a8 | ||
|
|
540a1eb6d9 | ||
|
|
d934cd105b | ||
|
|
ec05d7f8a1 | ||
|
|
345753ed19 | ||
|
|
c58e6c0dff | ||
|
|
1829bd84d3 | ||
|
|
7700c62fa8 | ||
|
|
8efbf5ef33 | ||
|
|
e8c5cb8c9a | ||
|
|
d5fd535909 | ||
|
|
b0a8d000b1 | ||
|
|
5c38488590 | ||
|
|
614fb750b7 | ||
|
|
e6cee7b41f | ||
|
|
0e57b971ad | ||
|
|
90b79fcd1f | ||
|
|
9d31705f75 | ||
|
|
059922cef1 | ||
|
|
8e4a9ba831 | ||
|
|
9b7b9b2e93 | ||
|
|
e0d7a6869c | ||
|
|
28c4bee0b1 | ||
|
|
052b5a68ed | ||
|
|
ee8b6f28b8 | ||
|
|
d5fb5d91e9 | ||
|
|
16658c14fe | ||
|
|
a96cf5b96b | ||
|
|
287fe0559e | ||
|
|
9006bba11e | ||
|
|
48d3b54e02 | ||
|
|
0c3bb75fd9 | ||
|
|
7e848b1924 | ||
|
|
8e4fcca216 | ||
|
|
fcfa42d992 | ||
|
|
5e0de79c0d | ||
|
|
8adb211216 | ||
|
|
5eea6f1b6d | ||
|
|
3f606b6c64 | ||
|
|
f31221d0d3 | ||
|
|
5220b462fd | ||
|
|
89b5e3e2ea | ||
|
|
ff2cc1626e | ||
|
|
cf6d31cefc | ||
|
|
46d64849b4 | ||
|
|
6c40079139 | ||
|
|
2c0c66e756 | ||
|
|
bc408d8d0b | ||
|
|
06cf2c7b51 | ||
|
|
37f15ea664 | ||
|
|
0da9060a80 | ||
|
|
e729516af7 | ||
|
|
4f0a42846c | ||
|
|
484b092720 | ||
|
|
ada6e5a5c4 | ||
|
|
2cf256c6d0 | ||
|
|
58692fe4d1 | ||
|
|
3a389788bf | ||
|
|
47f26b0df4 | ||
|
|
80a988c04f | ||
|
|
51f722d20f | ||
|
|
dffec8fb85 | ||
|
|
f9cae65df5 | ||
|
|
bcad536a90 | ||
|
|
d2f44006bd | ||
|
|
23cce731ab | ||
|
|
c01f4582de | ||
|
|
0e085e15bb | ||
|
|
e673a664ac | ||
|
|
57f76e936a | ||
|
|
501b2cc617 | ||
|
|
843cdbe690 | ||
|
|
df7f1c17ac | ||
|
|
1601742092 | ||
|
|
6084a3e63a | ||
|
|
adfada707d | ||
|
|
e8533d15b3 | ||
|
|
67721444b9 | ||
|
|
5f42276dbd | ||
|
|
c53efc0d6c | ||
|
|
ddd2648c1e | ||
|
|
079e640b6b | ||
|
|
bc71f737b8 | ||
|
|
c33ae0c7df | ||
|
|
e9f43251ab | ||
|
|
bc920dd2a5 | ||
|
|
9398932c47 | ||
|
|
da8adea0a9 | ||
|
|
669e789bc3 | ||
|
|
02cb347ac7 | ||
|
|
0e72a87613 | ||
|
|
8ac4643fd7 | ||
|
|
578a6db659 | ||
|
|
4aa2380de2 | ||
|
|
2adf73cca1 | ||
|
|
27b0d16422 | ||
|
|
c459fe21f8 | ||
|
|
6c7cd70202 | ||
|
|
606c601fc0 | ||
|
|
7c9652997b | ||
|
|
4e4a83bcef | ||
|
|
7cac2884ae | ||
|
|
11ada53ed5 | ||
|
|
5ba7ab0fed | ||
|
|
ebcb654649 | ||
|
|
a46af033b9 | ||
|
|
a0a18d963d | ||
|
|
4105f324f7 | ||
|
|
b7e91ee95e | ||
|
|
f1af06c00d | ||
|
|
779111d781 | ||
|
|
3e6586f58d | ||
|
|
cf2632fe59 | ||
|
|
322f3caec6 | ||
|
|
56198f40ac | ||
|
|
4a1c897b2d | ||
|
|
2b62accee0 | ||
|
|
16e543e734 | ||
|
|
1030af7b48 | ||
|
|
7f41ff26fa | ||
|
|
994f0c3d49 | ||
|
|
500e1bc9b5 | ||
|
|
23152f68f2 | ||
|
|
00778c9a1e | ||
|
|
33a21ffbdc | ||
|
|
5263b1a9c1 | ||
|
|
3fc1088d73 | ||
|
|
d12be12f72 | ||
|
|
fda8858fc3 | ||
|
|
29de86253f | ||
|
|
c7c89a5927 | ||
|
|
48f1142523 | ||
|
|
9c2459658a | ||
|
|
ca37ff8b08 | ||
|
|
e6440a75b5 | ||
|
|
2b400dc2ad | ||
|
|
860b2e2bbb | ||
|
|
f27fa5cbf3 | ||
|
|
98bec6f96b | ||
|
|
379d86f9a3 | ||
|
|
8b2dfcff29 | ||
|
|
b569930b2a | ||
|
|
061c9744af | ||
|
|
43616619ec | ||
|
|
838aeb149f | ||
|
|
37f809a1f4 | ||
|
|
32303daf63 | ||
|
|
d709f4dfdd | ||
|
|
80142af9b8 | ||
|
|
1b1b3a8fd6 | ||
|
|
afffd656f6 | ||
|
|
4f6e31eb08 | ||
|
|
9daca108b3 | ||
|
|
de5e397fd4 | ||
|
|
f5ec92c79a | ||
|
|
f654fea736 | ||
|
|
daa56ca50f | ||
|
|
c20de7b264 | ||
|
|
c5e813f9f4 | ||
|
|
3b7dd0396f | ||
|
|
c226292d8e | ||
|
|
216e5bb208 | ||
|
|
afdc0a5f59 | ||
|
|
5a9e00ce71 | ||
|
|
ca3d60c160 | ||
|
|
222b7b660e | ||
|
|
a469954ef3 | ||
|
|
be1d11f98d | ||
|
|
457515fc08 | ||
|
|
e3ac8dd5a8 | ||
|
|
14920b447c | ||
|
|
0c6177dd9a | ||
|
|
cea571fc31 | ||
|
|
d5a4c871f2 | ||
|
|
7c6c2e0ccf | ||
|
|
476d1fb334 | ||
|
|
7ca3be57df | ||
|
|
d1419edfd0 | ||
|
|
a740f750c7 | ||
|
|
610a405c85 | ||
|
|
aa1edfb6ae | ||
|
|
4864c9e96a | ||
|
|
faefeaa644 | ||
|
|
e0a7ff77df | ||
|
|
60c48fee16 | ||
|
|
1ef3dbabfc | ||
|
|
0b15755441 | ||
|
|
e9b95bbfe8 | ||
|
|
d0bf91d639 | ||
|
|
a1be6021c4 | ||
|
|
21efc93e54 | ||
|
|
fdf38dab6f | ||
|
|
5dfacf2615 | ||
|
|
613d784cfb | ||
|
|
efd426650d | ||
|
|
f62b75c731 | ||
|
|
65efd0a9a1 | ||
|
|
f08881a2b7 | ||
|
|
83da92fdcc | ||
|
|
16fa6472b3 | ||
|
|
6781f62c70 | ||
|
|
a445c39901 | ||
|
|
da490e3f53 | ||
|
|
ccd2e2496c | ||
|
|
36da171a3d | ||
|
|
e84f8b23aa | ||
|
|
864d1ea87f | ||
|
|
58ff651c6d | ||
|
|
c027563b13 | ||
|
|
f0a1735ac8 | ||
|
|
56f6d01757 | ||
|
|
3c946b2a72 | ||
|
|
1d37698d4c | ||
|
|
be50c289f8 | ||
|
|
444f956e7b | ||
|
|
b35d84156f | ||
|
|
496123a646 | ||
|
|
861747ec26 | ||
|
|
7bbaf0298e | ||
|
|
a2f5a7f3cd | ||
|
|
a5cfc59d81 | ||
|
|
da342c7855 | ||
|
|
aecddefbc8 | ||
|
|
fd05f458e1 | ||
|
|
faf176d78c | ||
|
|
151125e537 | ||
|
|
64a0eb42ed | ||
|
|
ba6cc2864a | ||
|
|
4d7c4fc0f4 | ||
|
|
e7c2f74a07 | ||
|
|
a7da6e1480 | ||
|
|
ae0d753cad | ||
|
|
31c977b906 | ||
|
|
87179346d4 | ||
|
|
d768afb80b | ||
|
|
de12a0941f | ||
|
|
987a28fc6a | ||
|
|
c5dbf0f8ad | ||
|
|
297939325a | ||
|
|
2f800521cb | ||
|
|
72a178a37e | ||
|
|
8c7b4549ed | ||
|
|
91090042d1 | ||
|
|
0693937c1e | ||
|
|
ac1a4ed576 | ||
|
|
b73d3f925d | ||
|
|
69641ddc36 | ||
|
|
36881807ed | ||
|
|
1a18b427a8 | ||
|
|
69ce97b80a | ||
|
|
9f887b436c | ||
|
|
5780163fb7 | ||
|
|
1c5fb9495e | ||
|
|
5df521bad5 | ||
|
|
be75d0265b | ||
|
|
b20de6a3ec | ||
|
|
4ee8704b99 | ||
|
|
d2e8a0a96a | ||
|
|
ff367c7b31 | ||
|
|
98d9d797fd | ||
|
|
a6fc3f6337 | ||
|
|
539f352318 | ||
|
|
e1b2b3e995 | ||
|
|
3b7bcf0f4f | ||
|
|
03ae32d937 | ||
|
|
ccf370f813 | ||
|
|
0521814dea | ||
|
|
e35841a2ea | ||
|
|
3474c273a5 | ||
|
|
3dc722b096 | ||
|
|
5002a6467d | ||
|
|
c1bfb63d96 | ||
|
|
27e295a4cb | ||
|
|
99703a95c2 | ||
|
|
f2202fc014 | ||
|
|
3761ff3522 | ||
|
|
205438669a | ||
|
|
e7f2d3179d | ||
|
|
277f4a1bfe | ||
|
|
46dc3b1442 | ||
|
|
2128c98c35 | ||
|
|
e98b326ba3 | ||
|
|
7bcd31bddb | ||
|
|
6def968c3c | ||
|
|
f2ee3cec19 | ||
|
|
589a298096 | ||
|
|
94c17bdf85 | ||
|
|
fdfea0c17b | ||
|
|
862fe60368 | ||
|
|
6a3e97a9f8 | ||
|
|
7656377f3f | ||
|
|
82029be6f9 | ||
|
|
339f75eb53 | ||
|
|
7425634692 | ||
|
|
38d5407ea1 | ||
|
|
6febfca5a6 | ||
|
|
7cba72a0b7 | ||
|
|
fb6c003c97 | ||
|
|
91016ba989 | ||
|
|
2aaf1de7fe | ||
|
|
b527e54809 | ||
|
|
c01db5fe9c | ||
|
|
534ebde638 | ||
|
|
d532d2f64f | ||
|
|
7bcd69e157 | ||
|
|
af63d053b1 | ||
|
|
d9ff118b40 | ||
|
|
be3f914acd | ||
|
|
edb9efd9a6 | ||
|
|
cdfa9a371d | ||
|
|
390efdc884 | ||
|
|
ac276a27b7 | ||
|
|
b63e99eb43 | ||
|
|
00976cfe47 | ||
|
|
6f561aa846 | ||
|
|
276386c94a | ||
|
|
0aa125304d | ||
|
|
482d29dc53 | ||
|
|
cd0aed993a | ||
|
|
f56656f6b4 | ||
|
|
fc601659f5 | ||
|
|
4a069a1e7f | ||
|
|
04badf7e6e | ||
|
|
0b31a163a3 | ||
|
|
171c00cfd6 | ||
|
|
b5cefa92fa | ||
|
|
8cead48342 | ||
|
|
1989e4fca0 | ||
|
|
880b3ef6c0 | ||
|
|
2ec93590e4 | ||
|
|
5fe69fb556 | ||
|
|
290ed09dc6 | ||
|
|
65018daebc | ||
|
|
0739937fa2 | ||
|
|
ede8ea52b0 | ||
|
|
ba83e9cfbe | ||
|
|
977331806b | ||
|
|
86207afe15 | ||
|
|
704a453b7a | ||
|
|
b7438894f6 | ||
|
|
4022586015 | ||
|
|
26fcef69c7 | ||
|
|
5036706f81 | ||
|
|
c02fbd22fa | ||
|
|
33020a63b8 | ||
|
|
eaa2e55d20 | ||
|
|
c22e11d483 | ||
|
|
41471c3b44 | ||
|
|
17e7538937 | ||
|
|
c8be8ba42c | ||
|
|
4d4df03f88 | ||
|
|
deb6e06336 | ||
|
|
c3d1d6a946 | ||
|
|
1055139c83 | ||
|
|
19d1e499c3 | ||
|
|
b161eea793 | ||
|
|
8fbe4b9c3b | ||
|
|
85479bcbc0 | ||
|
|
ec8240e890 | ||
|
|
221dec8cac | ||
|
|
9a0f6f5bb4 | ||
|
|
38dedf402b | ||
|
|
c280d0655c | ||
|
|
cdc1b640d9 | ||
|
|
37993dd713 | ||
|
|
cd25301607 | ||
|
|
4985691617 | ||
|
|
69eec9e344 | ||
|
|
a8ce570635 | ||
|
|
fab0904af7 | ||
|
|
ffc28faa51 | ||
|
|
b6843f2087 | ||
|
|
3f6606acdb | ||
|
|
7a3885863c | ||
|
|
67d8b91690 | ||
|
|
ce6977ffe6 | ||
|
|
bc7efa6da6 | ||
|
|
9198444a3b | ||
|
|
b15764ef2c | ||
|
|
abb62c76d8 | ||
|
|
51b7f322cc | ||
|
|
be99b1240c | ||
|
|
315e3b563b | ||
|
|
430d132ee0 | ||
|
|
cc37cc83cd | ||
|
|
0984f227a8 | ||
|
|
548cf96c44 | ||
|
|
0be378af6a | ||
|
|
fb988ba834 | ||
|
|
e6ddd28067 | ||
|
|
0acd3159db | ||
|
|
1897e75894 | ||
|
|
852e7cdb41 | ||
|
|
c1367d9d10 | ||
|
|
cb9bdf43f6 | ||
|
|
6b1a8e0a40 | ||
|
|
7f32cbeb06 | ||
|
|
c7253b3a37 | ||
|
|
7f03e24c55 | ||
|
|
66cecf4824 | ||
|
|
f3552ca737 | ||
|
|
3dc6a80198 | ||
|
|
e71159d6ea | ||
|
|
732a7e81a0 | ||
|
|
c3cbe2a30c | ||
|
|
9bc9b8795b | ||
|
|
d0605443fb | ||
|
|
47a8670d37 | ||
|
|
e7546e2305 | ||
|
|
ccb9826afd | ||
|
|
8de61559b0 | ||
|
|
ea4aa04cc4 | ||
|
|
a3dd72a759 | ||
|
|
62ec60188b | ||
|
|
10cb4799bc | ||
|
|
8e0438bad4 | ||
|
|
76e48b5c3f | ||
|
|
1bf9df7c85 | ||
|
|
32063bb472 | ||
|
|
f944e819e9 | ||
|
|
9c1ae09994 | ||
|
|
d82e85d099 | ||
|
|
c1d0851a56 | ||
|
|
08dd6af446 | ||
|
|
ff8f32ca80 | ||
|
|
a7c46e4d83 | ||
|
|
b15d760406 | ||
|
|
9f399f139b | ||
|
|
3b0f026522 | ||
|
|
8db94e7407 | ||
|
|
8d321446ad | ||
|
|
c783c2636f | ||
|
|
5468740042 | ||
|
|
69e4b16817 | ||
|
|
e35a1025c9 | ||
|
|
0f5601dad4 | ||
|
|
a5f35e2b3c | ||
|
|
c57d7dea8b | ||
|
|
a39cae9c2e | ||
|
|
53142f125b | ||
|
|
edf87a258f | ||
|
|
18144da755 | ||
|
|
d6007e7d9c | ||
|
|
92ce693e6f | ||
|
|
d2802cab6c | ||
|
|
177fb132b9 | ||
|
|
d811303d7b | ||
|
|
27b12ef1b6 | ||
|
|
4efc5d74d4 | ||
|
|
b5c552faf3 | ||
|
|
dec02340e8 | ||
|
|
3f80ef0648 | ||
|
|
44ae408b36 | ||
|
|
0e6554edc1 | ||
|
|
c8c5d37bcf | ||
|
|
5873e50c50 | ||
|
|
4f1371945d | ||
|
|
444d496c8b | ||
|
|
98c09e2a91 | ||
|
|
f5ac91da06 | ||
|
|
f7361fc982 | ||
|
|
c49b7f8c63 | ||
|
|
1a7c3897b1 | ||
|
|
956d7868b5 | ||
|
|
85786f3071 | ||
|
|
2e0620e370 | ||
|
|
f87c72646c | ||
|
|
6664af9557 | ||
|
|
097227d5ea | ||
|
|
e60853930b | ||
|
|
091b48168e | ||
|
|
ad68d64d93 | ||
|
|
fa7444ec94 | ||
|
|
3d8f8f68d8 | ||
|
|
a220e5d850 | ||
|
|
ac3ba70ed9 | ||
|
|
52b5c134fc | ||
|
|
5c50e213ac | ||
|
|
740dd447b4 | ||
|
|
9419575126 | ||
|
|
d0a915c47a | ||
|
|
b5a8cab8df | ||
|
|
bc7659ab90 | ||
|
|
38d5424b21 | ||
|
|
3c4dba3e51 | ||
|
|
ea7e3d6405 | ||
|
|
f70c7320d5 | ||
|
|
54b7962eb9 | ||
|
|
7b1698dbae | ||
|
|
39cc1df560 | ||
|
|
5ce287d611 | ||
|
|
51ba6f816b | ||
|
|
a8e7191b14 | ||
|
|
4c83e407a9 | ||
|
|
b1f212d653 | ||
|
|
0e2cf69345 | ||
|
|
8fe0208fb6 | ||
|
|
03f3a8a2ef | ||
|
|
aade34b0c9 | ||
|
|
10f97d2e9e | ||
|
|
54f0d24d80 | ||
|
|
b76061530e | ||
|
|
d711209dde | ||
|
|
3b5f107a11 | ||
|
|
b3bead2f06 | ||
|
|
827480fd2b | ||
|
|
0c54e2d0d0 | ||
|
|
2fdb51f85e | ||
|
|
37f54f9a35 | ||
|
|
b2ce9c5487 | ||
|
|
02edae8fac | ||
|
|
fb7fb73ba3 | ||
|
|
bbfe2517ea | ||
|
|
0baf1479a3 | ||
|
|
2f50b85f99 | ||
|
|
8ae4bcac58 | ||
|
|
0ff6e3a6bb | ||
|
|
75e50ee082 | ||
|
|
6d5c248402 | ||
|
|
5365108ef9 | ||
|
|
7e373010d7 | ||
|
|
409c8e9732 | ||
|
|
75e11a7270 | ||
|
|
6e686224eb | ||
|
|
95f558e7bc | ||
|
|
2667a50334 | ||
|
|
9591b8ec93 | ||
|
|
78e9c6ef70 | ||
|
|
a5ac0149af | ||
|
|
34e36a233c | ||
|
|
d64a952b5d | ||
|
|
7dada72085 | ||
|
|
966edff222 | ||
|
|
b52c6e866f | ||
|
|
344f4436f1 | ||
|
|
5d070753fd | ||
|
|
844dd36ff9 | ||
|
|
3c5bc544ea | ||
|
|
227db769a0 | ||
|
|
713e453126 | ||
|
|
0c85169539 | ||
|
|
3415cdb208 | ||
|
|
08ef467fc6 | ||
|
|
5da2f21aed | ||
|
|
e37b8e6682 | ||
|
|
23649c6852 | ||
|
|
7e1b75a705 | ||
|
|
17425a24c6 | ||
|
|
f410bd9bf9 | ||
|
|
706eb7f2c7 | ||
|
|
90f2d8d9fc | ||
|
|
dc644c37e6 | ||
|
|
4b438eee6d | ||
|
|
8a6febbaa5 | ||
|
|
8c2dbab878 | ||
|
|
cc6b20b614 | ||
|
|
3fcec56f7b | ||
|
|
a521343063 | ||
|
|
ce4a87ce83 | ||
|
|
7fc9b63dc7 | ||
|
|
50e962b279 | ||
|
|
4b7a6b13ec | ||
|
|
3190f99ebe | ||
|
|
37909b292f | ||
|
|
8b22fab2f7 | ||
|
|
5c82014ba9 | ||
|
|
c82e967e97 | ||
|
|
b63384b3d4 | ||
|
|
02d37bbb5a | ||
|
|
728be8c4d4 | ||
|
|
07a31d2975 | ||
|
|
de560aa094 | ||
|
|
b1285f9fce | ||
|
|
cea4cd4e5f | ||
|
|
4d911db902 | ||
|
|
b99a3517c3 | ||
|
|
98c2a052e5 | ||
|
|
ac1bc212ea | ||
|
|
91b451b8ce | ||
|
|
648062d071 | ||
|
|
45a3226645 | ||
|
|
f2db87a766 | ||
|
|
53dab55703 | ||
|
|
0c7e28ec9f | ||
|
|
ed8a845e83 | ||
|
|
d5886f36af | ||
|
|
f57f0a661a | ||
|
|
69e0cb5d6f | ||
|
|
2af558598c | ||
|
|
6dad4e9e89 | ||
|
|
a096b2004f | ||
|
|
4ab5382d3f | ||
|
|
24a3ec57e3 | ||
|
|
75042fd502 | ||
|
|
2b0e4266cf | ||
|
|
ef5407479a | ||
|
|
56f29cbb27 | ||
|
|
232954d4b9 | ||
|
|
053a87edf6 | ||
|
|
296d626e53 | ||
|
|
bc83b9c1ac | ||
|
|
b71a18cd1e | ||
|
|
2cebf9b499 | ||
|
|
ef30932807 | ||
|
|
6b03914731 | ||
|
|
f29bcaf436 | ||
|
|
4ceb20e07f | ||
|
|
1e6c32e95f | ||
|
|
92c4fc4e19 | ||
|
|
d341254786 | ||
|
|
51e6d2228d | ||
|
|
292a254bc1 | ||
|
|
5b98340d15 | ||
|
|
e5bd955f4d | ||
|
|
d9f0f27cd4 | ||
|
|
dcfad4f645 | ||
|
|
613919325d | ||
|
|
a15164750d | ||
|
|
b85a9108eb | ||
|
|
498ecfc192 | ||
|
|
576f025c84 | ||
|
|
a47bf2ab66 | ||
|
|
f62da519d6 | ||
|
|
04f8990c11 | ||
|
|
33003c6168 | ||
|
|
104c9f465d | ||
|
|
d21f55b5d2 | ||
|
|
b54307d58e | ||
|
|
b1777ecfd8 | ||
|
|
17910aa0d6 | ||
|
|
cd17bdffcd | ||
|
|
6777efa7fa | ||
|
|
985918d42b | ||
|
|
69aa8ffac4 | ||
|
|
2594e41462 | ||
|
|
48962e1148 | ||
|
|
65f83cbae7 | ||
|
|
3b3d55cda2 | ||
|
|
4c90bae16d | ||
|
|
6916baa299 | ||
|
|
ac87c1d618 | ||
|
|
21412ddf65 | ||
|
|
41d126586e | ||
|
|
8e5b2af0fb | ||
|
|
fc79efb97c | ||
|
|
1872312cc6 | ||
|
|
e3f6b6d899 | ||
|
|
69a2c25ca5 | ||
|
|
bbffaf78fb | ||
|
|
8bde7f9b3a | ||
|
|
7f2d08b03f | ||
|
|
8c62c40a3d | ||
|
|
78eeacb53c | ||
|
|
f50a65294f | ||
|
|
b054eb7a4f | ||
|
|
4bb87373dc | ||
|
|
68d0b7c7ff | ||
|
|
3e41fd1fd3 | ||
|
|
4ef1835bee | ||
|
|
2944f49974 | ||
|
|
07339fc69e | ||
|
|
3f51705ba4 | ||
|
|
0549b1c5c9 | ||
|
|
21ae930b4c | ||
|
|
424c033395 | ||
|
|
40b2b03bcb | ||
|
|
f63513ed38 | ||
|
|
9365b616b8 | ||
|
|
cbbf451974 | ||
|
|
0900beecb2 | ||
|
|
5d591ebe83 | ||
|
|
603e6e21b5 | ||
|
|
370a024e46 | ||
|
|
169c1fd93b | ||
|
|
ac32bad25a | ||
|
|
33e1db8c40 | ||
|
|
52e618d0b2 | ||
|
|
dbfcd328fb | ||
|
|
0d345c9152 | ||
|
|
de1a97d506 | ||
|
|
094610d7ce | ||
|
|
eea802298e | ||
|
|
052fe82688 | ||
|
|
166bc2a0e0 | ||
|
|
c38fc713c6 | ||
|
|
8c51318d82 | ||
|
|
e8b0402a10 | ||
|
|
c635875765 | ||
|
|
652bc0784a | ||
|
|
13429a3b34 | ||
|
|
a0c239db8d | ||
|
|
450d9d72d7 | ||
|
|
6298536e46 | ||
|
|
88a869f34d | ||
|
|
1d8f1a9a46 | ||
|
|
82d8a637ac | ||
|
|
d85dc868ca | ||
|
|
ff93802d58 | ||
|
|
a6e2ca9d3b | ||
|
|
8a40c136ce | ||
|
|
c5e057f676 | ||
|
|
2c45899a02 | ||
|
|
5d4ffa6cf8 | ||
|
|
f37d6fe32b | ||
|
|
e1eeb22f1e | ||
|
|
13c92e3ad5 | ||
|
|
ec9c448ccf | ||
|
|
549977bf4f | ||
|
|
354b32177d | ||
|
|
9f0d625300 | ||
|
|
b0f279a34e | ||
|
|
b52618c142 | ||
|
|
7da01d6007 | ||
|
|
bd67e87921 | ||
|
|
13ae548ff6 | ||
|
|
f7daab7393 | ||
|
|
233fbb08b2 | ||
|
|
61649c1d43 | ||
|
|
ddd2b8a398 | ||
|
|
8c45d4ce3c | ||
|
|
20771621e7 | ||
|
|
9fd50bcfb6 | ||
|
|
d29465029d | ||
|
|
cd71e1d8ab | ||
|
|
2ce39cf770 | ||
|
|
103cc58cb6 | ||
|
|
4155e58a61 | ||
|
|
088dec6c09 | ||
|
|
322d39f3a6 | ||
|
|
49f49ea603 | ||
|
|
dc82d4f0cd | ||
|
|
9f66c306ea | ||
|
|
bedc62f090 | ||
|
|
e7885e3ee0 | ||
|
|
a504f0638b | ||
|
|
558a9aabfb | ||
|
|
312ba99e71 | ||
|
|
c10213d861 | ||
|
|
0cf531c8a6 | ||
|
|
c272f2020b | ||
|
|
365ae27acf | ||
|
|
7db7112d3f | ||
|
|
99f914b782 | ||
|
|
2fbb00fd8d | ||
|
|
f14b809ab5 | ||
|
|
d36cb5c812 | ||
|
|
cfb6ccfe51 | ||
|
|
f191f854cd | ||
|
|
943e614810 | ||
|
|
63dfe3d3b3 | ||
|
|
5b552b51f1 | ||
|
|
732825cb23 | ||
|
|
dd32d6eb1f | ||
|
|
f2227d033c | ||
|
|
231f6a5b58 | ||
|
|
0a0f2495a2 | ||
|
|
0e13cd5ac9 | ||
|
|
0d8d30e1cc | ||
|
|
b385ecf65e | ||
|
|
43405203b2 | ||
|
|
81ba0b29da | ||
|
|
f78d1aee28 | ||
|
|
67d6a4e3aa | ||
|
|
40534f076b | ||
|
|
daae743608 | ||
|
|
e88bc8b12a | ||
|
|
4090c78c3f | ||
|
|
becf75d791 | ||
|
|
d2b34dc30c | ||
|
|
66d52b55c0 | ||
|
|
aa355af2cf | ||
|
|
5c6b34a84c | ||
|
|
3a70ba3ba1 | ||
|
|
d6e4ab3fd4 | ||
|
|
1d630ccaa5 | ||
|
|
754cbd4036 | ||
|
|
6fa0f25e7c | ||
|
|
0c9d42258c | ||
|
|
79196a9ef7 | ||
|
|
059b83a2ce | ||
|
|
3be9e26934 | ||
|
|
2c517e0a62 | ||
|
|
ec9fb67d84 | ||
|
|
7fbdba02ab | ||
|
|
221a8fff1c | ||
|
|
96c0afe0f1 | ||
|
|
06a595090d | ||
|
|
425bfc5c8d | ||
|
|
c07537b1e9 | ||
|
|
155c96b410 | ||
|
|
19dadb4a82 | ||
|
|
f7f95ea37a | ||
|
|
0c21e2afef | ||
|
|
b5e6d7e171 | ||
|
|
47a3c10334 | ||
|
|
e67202484d | ||
|
|
e0f98d7202 | ||
|
|
102842ba79 | ||
|
|
73083dc960 | ||
|
|
27bb7892b3 | ||
|
|
482ffac83f | ||
|
|
439dceebd8 | ||
|
|
e848914da1 | ||
|
|
d8dcdfbf4f | ||
|
|
eb1192771f | ||
|
|
e71cf6d6a1 | ||
|
|
037bf6b382 | ||
|
|
24e136e3f3 | ||
|
|
3dfe854108 | ||
|
|
fc37fd8b6e | ||
|
|
55a03dbf69 | ||
|
|
b93ebaebe4 | ||
|
|
a18bf07920 | ||
|
|
d7d9d25d71 | ||
|
|
813a93d78d | ||
|
|
a69c30edec | ||
|
|
d89f3403ac | ||
|
|
b77773ca07 | ||
|
|
2b57ecbd6c | ||
|
|
53822ae9d0 | ||
|
|
49a6f0754e | ||
|
|
133490a0c5 | ||
|
|
4d713ac5ba | ||
|
|
eb7fea673b | ||
|
|
4b2692182a | ||
|
|
76f330ca66 | ||
|
|
2134d24b36 | ||
|
|
9d1e8640ef | ||
|
|
49e0a687b3 | ||
|
|
54106807e4 | ||
|
|
a8dbb0dd41 | ||
|
|
65e8676f8b | ||
|
|
5c81f9c44e | ||
|
|
7c932003ed | ||
|
|
c379c78fec | ||
|
|
09a9f4c0c9 | ||
|
|
ec621194fc | ||
|
|
c12ccdb6ea | ||
|
|
d8de921c40 | ||
|
|
73f0bf36c1 | ||
|
|
2e7ad8980c | ||
|
|
4541875c81 | ||
|
|
0fabc6a841 | ||
|
|
2a45e1cfd0 | ||
|
|
2d5727b17b | ||
|
|
b2c2fca8a5 | ||
|
|
9472247b6e | ||
|
|
ebdac5db5c | ||
|
|
7ea8528d50 | ||
|
|
74d0e40bdc | ||
|
|
2d57b0aa52 | ||
|
|
0c4ef64b32 | ||
|
|
e30511d315 | ||
|
|
64f2ccd9e1 | ||
|
|
6b12b07b33 | ||
|
|
f5794f1c07 | ||
|
|
8e4640f464 | ||
|
|
f976143063 | ||
|
|
177b86a15b | ||
|
|
e7e615cf18 | ||
|
|
13b93ebed8 | ||
|
|
3319170805 | ||
|
|
ed5f423e65 | ||
|
|
311079a311 | ||
|
|
08222150f2 | ||
|
|
7e8e8ba714 | ||
|
|
c65a0c7197 | ||
|
|
bc34f3edae | ||
|
|
615d342056 | ||
|
|
8462a7691b | ||
|
|
063141d152 | ||
|
|
fb21ce3893 | ||
|
|
1ee5675750 | ||
|
|
e9baaa68e7 | ||
|
|
901f4434fd | ||
|
|
0936ae6dca | ||
|
|
4362443b6e | ||
|
|
201dbbd977 | ||
|
|
a6628eee56 | ||
|
|
a1c96de9fc | ||
|
|
6fbda08583 | ||
|
|
cda83bba59 | ||
|
|
2f8d4451f5 | ||
|
|
0f2310690e | ||
|
|
33f36c3462 | ||
|
|
a08855a0de | ||
|
|
3197767650 | ||
|
|
28da7523be | ||
|
|
ce64afaa51 | ||
|
|
f5bb9ae1b1 | ||
|
|
22831563ff | ||
|
|
32f168617c | ||
|
|
74bbd24b1d | ||
|
|
9d1f077922 | ||
|
|
e0e3f92019 | ||
|
|
05b28eb161 | ||
|
|
36a4db69b8 | ||
|
|
da0a23e635 | ||
|
|
31affc0e67 | ||
|
|
d4f9af3498 | ||
|
|
ad9b4faa47 | ||
|
|
0240dc53ae | ||
|
|
ed20b68a3a | ||
|
|
86903e5f5b | ||
|
|
793ba6bd37 | ||
|
|
8ae051cb39 | ||
|
|
adeff27f28 | ||
|
|
9ea461638e | ||
|
|
989b60ae52 | ||
|
|
fc274e29ec | ||
|
|
d45f7d60c3 | ||
|
|
c1611abebf | ||
|
|
e0f6b3edbe | ||
|
|
a038831c45 | ||
|
|
36028bfb56 | ||
|
|
a87121c6da | ||
|
|
e219d61ed4 | ||
|
|
66b2717c54 | ||
|
|
eba1bdbcca | ||
|
|
139dc7b9b2 | ||
|
|
0aa71a5c41 | ||
|
|
5aecc538dd | ||
|
|
5f59726903 | ||
|
|
1eb560130a | ||
|
|
7979f7ed21 | ||
|
|
a7f757a3f4 | ||
|
|
777397489e | ||
|
|
436f526102 | ||
|
|
c28c86dfd8 | ||
|
|
9beffb646d | ||
|
|
f0d29be1d5 | ||
|
|
f2b7cd65a9 | ||
|
|
2735733d1f | ||
|
|
93fdc670fe | ||
|
|
40c5174aa0 | ||
|
|
0799b28e46 | ||
|
|
89a3ee7f57 | ||
|
|
347bf93b4f | ||
|
|
d7cc47e3ac | ||
|
|
1d7e933590 | ||
|
|
080b64a98f | ||
|
|
c4ec534b06 | ||
|
|
22ababbec1 | ||
|
|
17cb5b7799 | ||
|
|
e0c9dd3d23 | ||
|
|
41891ec95c | ||
|
|
dfc0072929 | ||
|
|
e1e5d675ac | ||
|
|
c4e92c6416 | ||
|
|
7c34f1c472 | ||
|
|
2c832addca | ||
|
|
c095cfa224 | ||
|
|
fbb10d37d3 | ||
|
|
7bb9c3f125 | ||
|
|
a03f654446 | ||
|
|
574c7e7c63 | ||
|
|
9294fc8e7e | ||
|
|
07d4c373f3 | ||
|
|
79499e3615 | ||
|
|
cc9bc95b25 | ||
|
|
ae763d7afa | ||
|
|
70e2a50f0f | ||
|
|
c22ff12951 | ||
|
|
1b8c158fdc | ||
|
|
4078ef8ef5 | ||
|
|
462740f72b | ||
|
|
c055ea6465 | ||
|
|
3decf4dbc5 | ||
|
|
4b41e420c0 | ||
|
|
2c545ef1ad | ||
|
|
c6b59ef082 | ||
|
|
dbbba659a8 | ||
|
|
3c3719fa9c | ||
|
|
a7af1d619e | ||
|
|
307fac8b78 | ||
|
|
18eb8c5f68 | ||
|
|
602fdc0000 | ||
|
|
f1c3537924 | ||
|
|
81578d2e77 | ||
|
|
8f674fe0fb | ||
|
|
abb3af7b30 | ||
|
|
cc008cc109 | ||
|
|
347889b233 | ||
|
|
8ed0268b9d | ||
|
|
fa799f7d81 | ||
|
|
23c28704d2 | ||
|
|
dd905fcaba | ||
|
|
53593c9c47 | ||
|
|
8612778136 | ||
|
|
9adcf85a14 | ||
|
|
d6d2193f91 | ||
|
|
bec11fa86e | ||
|
|
dfae0ea570 | ||
|
|
d7fb6dce89 | ||
|
|
759f9ee973 | ||
|
|
646d06ee9f | ||
|
|
7f80485070 | ||
|
|
45f0c25a6d | ||
|
|
c3211ab394 | ||
|
|
dc45153430 | ||
|
|
4e3b601990 | ||
|
|
b5be7bab9b | ||
|
|
8dc2c6a16c | ||
|
|
fe977289eb | ||
|
|
45b5b6d11f | ||
|
|
ec43e4dd33 | ||
|
|
c58b330673 | ||
|
|
5d976ca3ac | ||
|
|
fcb6b01e4e | ||
|
|
f2f17959ab | ||
|
|
e0a1039756 | ||
|
|
6448076143 | ||
|
|
3f657bcf51 | ||
|
|
4cdb79941b | ||
|
|
0ff32e73ba | ||
|
|
fe8db590a1 | ||
|
|
53f7ba26f6 | ||
|
|
937103f840 | ||
|
|
1969f9e1ac | ||
|
|
60fcce66f7 | ||
|
|
47fcc0310d | ||
|
|
7e676f3aae | ||
|
|
30aac9bbcf | ||
|
|
c2a5858143 | ||
|
|
879b3a0cbc | ||
|
|
ef0a0e8209 | ||
|
|
f7f20f624a | ||
|
|
b87e9f2651 | ||
|
|
b665d86292 | ||
|
|
4f7215662d | ||
|
|
db22657d93 | ||
|
|
24da761a17 | ||
|
|
115dcc09d4 | ||
|
|
990d7c4862 | ||
|
|
166024a23c | ||
|
|
3c4bb0c7c9 | ||
|
|
258191ab40 | ||
|
|
d66396abe3 | ||
|
|
2ced3b07d4 | ||
|
|
49dd7bee87 | ||
|
|
3b432dce88 | ||
|
|
21d324c597 | ||
|
|
a7ab20ec78 | ||
|
|
7c1976950d | ||
|
|
158200b209 | ||
|
|
a570cd66f7 | ||
|
|
d7f3d63a8e | ||
|
|
2e67426936 | ||
|
|
16f88ba3cd | ||
|
|
e31a41854b | ||
|
|
7349c191ab | ||
|
|
dc540dda4d | ||
|
|
4b97811941 | ||
|
|
5c494f79f3 | ||
|
|
191935bbf5 | ||
|
|
ffa4769b51 | ||
|
|
db4304914c | ||
|
|
db7901ec49 | ||
|
|
8c78a1abb7 | ||
|
|
8821541f33 | ||
|
|
5cec7ec84a | ||
|
|
9d5566634c | ||
|
|
86894f3bbf | ||
|
|
9536f112b5 | ||
|
|
44a40b860e | ||
|
|
b3d26c08f6 | ||
|
|
98d4622ed8 | ||
|
|
24b26db327 | ||
|
|
fa9fabaa49 | ||
|
|
49e8e783e3 | ||
|
|
1230e3a28b | ||
|
|
c4ee74857d | ||
|
|
3f8f4ff6cd | ||
|
|
cb39e0878e | ||
|
|
a4e0a1c061 | ||
|
|
fc13b87fd5 | ||
|
|
d9ba544e09 | ||
|
|
2fa914b410 | ||
|
|
e288e5238a | ||
|
|
7cbf5b4e67 | ||
|
|
44edfb7231 | ||
|
|
1cd96a136f | ||
|
|
af21479665 | ||
|
|
93eab5521c | ||
|
|
4ba95d0b7a | ||
|
|
5ae6a61c4d | ||
|
|
eec59ae7c4 | ||
|
|
efa9a7ed5b | ||
|
|
557abdebe0 | ||
|
|
8589b1db22 | ||
|
|
82a21beba0 | ||
|
|
256c4da0a5 | ||
|
|
7395dc9969 | ||
|
|
6a23cfa5cd | ||
|
|
d39bc09e62 | ||
|
|
c7676797e1 | ||
|
|
7460dcf406 | ||
|
|
423932fab2 | ||
|
|
efda5b0d36 | ||
|
|
13a9e27320 | ||
|
|
b0433d96a3 | ||
|
|
f3aba2e536 | ||
|
|
1594f102fd | ||
|
|
b2f2df4c64 | ||
|
|
9f6c48d82e | ||
|
|
f0307dc75e | ||
|
|
872e4d1f3d | ||
|
|
b164e606f9 | ||
|
|
806343395a | ||
|
|
afe93d633c | ||
|
|
cd20717c3d | ||
|
|
f96bcf943b | ||
|
|
9e056ec1ce | ||
|
|
cef681942f | ||
|
|
5c6d13a0df | ||
|
|
719f2803b3 | ||
|
|
dc15b4fa8a | ||
|
|
529709e08b | ||
|
|
e82eee512b | ||
|
|
ee0c623760 | ||
|
|
dbb4955483 | ||
|
|
ed87335513 | ||
|
|
8a4111fe0e | ||
|
|
4bfa8d560b | ||
|
|
96db41d996 | ||
|
|
9a74330d6f | ||
|
|
1951baca57 | ||
|
|
da08124df2 | ||
|
|
2aecc5a717 | ||
|
|
a37ffe162b | ||
|
|
bc99c9d6e0 | ||
|
|
f32314dd0b | ||
|
|
7e73f35916 | ||
|
|
e1e63a91d6 | ||
|
|
9a05aad8ea | ||
|
|
f6b77479d7 | ||
|
|
3c279163fc | ||
|
|
6933617538 | ||
|
|
2648661757 | ||
|
|
e31a97f355 | ||
|
|
6bdb73c392 | ||
|
|
deda7e2c75 | ||
|
|
5cdb8cea13 | ||
|
|
90a8c9e636 | ||
|
|
c0c951b6a9 | ||
|
|
39eb7faeb9 | ||
|
|
4829ad3eb8 | ||
|
|
a682d45846 | ||
|
|
76dd468f0e | ||
|
|
a6df26839d | ||
|
|
2a79b00700 | ||
|
|
6a749e3a8e | ||
|
|
c5d4fc38aa | ||
|
|
b9b6a6cea5 | ||
|
|
95e45574cb | ||
|
|
f6cf5e0f43 | ||
|
|
5dd92fd5d6 | ||
|
|
e27717261d | ||
|
|
57738a0ff3 | ||
|
|
5c96b75a68 | ||
|
|
064d2ba16a | ||
|
|
b09d9dabc5 | ||
|
|
06720dfb90 | ||
|
|
a2e0a9b05f | ||
|
|
3f7e2729bb | ||
|
|
6260b58a0a | ||
|
|
2511aa2b14 | ||
|
|
9a4a13cb73 | ||
|
|
139aa71666 | ||
|
|
d3f04d754a | ||
|
|
432b86344e | ||
|
|
829eda47a8 | ||
|
|
0663ec4a9c | ||
|
|
61bf425935 | ||
|
|
d203aea7c2 | ||
|
|
c4a0ed63ef | ||
|
|
31ccf9a80b | ||
|
|
4ac68952e8 | ||
|
|
e7fc25d6a8 | ||
|
|
0527a393aa | ||
|
|
2b1d8854d5 | ||
|
|
8e332ffd16 | ||
|
|
3ab9f24a12 | ||
|
|
13fa595282 | ||
|
|
aebb844da9 | ||
|
|
7334bea3c2 | ||
|
|
caa4380d49 | ||
|
|
54047780fc | ||
|
|
c53dbc7cdf | ||
|
|
4b6b377134 | ||
|
|
df200f305b | ||
|
|
63aa5fd673 | ||
|
|
3c68488873 | ||
|
|
30fb30cffb | ||
|
|
f437e867fd | ||
|
|
2926651e1c | ||
|
|
9b67f4344b | ||
|
|
68852f25b5 | ||
|
|
8a436500f0 | ||
|
|
2298d59b8b | ||
|
|
620145c59a | ||
|
|
bcf2422848 | ||
|
|
83638b5f05 | ||
|
|
57518fc5f1 | ||
|
|
fea93d0f65 | ||
|
|
b1ea6b1f66 | ||
|
|
497d363fc1 | ||
|
|
b63d550a70 | ||
|
|
b09dc46e68 | ||
|
|
2b08985e16 | ||
|
|
91e9822f65 | ||
|
|
c652a6254f | ||
|
|
30430796c7 | ||
|
|
6de403f2be | ||
|
|
1f84799f2d | ||
|
|
d2dd83c3a3 | ||
|
|
1b23208779 | ||
|
|
39bb8e2ed4 | ||
|
|
e460aa277b | ||
|
|
b234a3545a | ||
|
|
afea58b7a1 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -5,3 +5,5 @@ conf.py
|
||||
locale
|
||||
latest_updates.json
|
||||
.wnf-lang-status
|
||||
*.egg-info
|
||||
dist/
|
||||
|
||||
37
.travis.yml
Normal file
37
.travis.yml
Normal file
@@ -0,0 +1,37 @@
|
||||
language: python
|
||||
|
||||
python:
|
||||
- "2.7"
|
||||
|
||||
services:
|
||||
- mysql
|
||||
|
||||
install:
|
||||
- sudo service mysql stop
|
||||
- sudo apt-get install python-software-properties
|
||||
- sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db
|
||||
- sudo add-apt-repository 'deb http://ftp.osuosl.org/pub/mariadb/repo/5.5/ubuntu precise main'
|
||||
- sudo apt-get update
|
||||
- sudo apt-get purge -y mysql-common
|
||||
- sudo apt-get install mariadb-server mariadb-common libmariadbclient-dev
|
||||
- ./ci/fix-mariadb.sh
|
||||
|
||||
- wget http://downloads.sourceforge.net/project/wkhtmltopdf/0.12.1/wkhtmltox-0.12.1_linux-precise-amd64.deb
|
||||
- sudo dpkg -i wkhtmltox-0.12.1_linux-precise-amd64.deb
|
||||
- CFLAGS=-O0 pip install git+https://github.com/frappe/frappe.git@develop
|
||||
- CFLAGS=-O0 pip install --editable .
|
||||
|
||||
before_script:
|
||||
- mysql -e 'create database test_frappe'
|
||||
- echo "USE mysql;\nCREATE USER 'test_frappe'@'localhost' IDENTIFIED BY 'test_frappe';\nFLUSH PRIVILEGES;\n" | mysql -u root
|
||||
- echo "USE mysql;\nGRANT ALL PRIVILEGES ON \`test_frappe\`.* TO 'test_frappe'@'localhost';\n" | mysql -u root
|
||||
|
||||
script:
|
||||
- cd ./test_sites/
|
||||
- frappe --use test_site
|
||||
- frappe --reinstall
|
||||
- frappe --install_app erpnext --verbose
|
||||
- frappe -b
|
||||
- frappe --build_website
|
||||
- frappe --serve_test &
|
||||
- frappe --verbose --run_tests --app erpnext
|
||||
@@ -1,16 +1,23 @@
|
||||
# Contributing to ERPNext
|
||||
# Contributing to Frappe / ERPNext
|
||||
|
||||
### Update 16-Sep-14
|
||||
|
||||
Please send pull requests to branch v5.0
|
||||
|
||||
## Reporting issues
|
||||
|
||||
We only accept issues that are bug reports or feature requests. Bugs must be isolated and reproducible problems. Please read the following guidelines before opening any issue.
|
||||
|
||||
1. **Search for existing issues.** We want to avoid duplication, and you'd help us out a lot by first checking if someone else has reported the same issue. The issue may have already been resolved with a fix available.
|
||||
1. **Search for existing issues:** We want to avoid duplication, and you'd help us out a lot by first checking if someone else has reported the same issue. The issue may have already been resolved with a fix available.
|
||||
1. **Report each issue separately:** Don't club multiple, unreleated issues in one note.
|
||||
1. **Mention the version number:** Please mention the application, browser and platform version numbers.
|
||||
|
||||
### Issues
|
||||
|
||||
1. **Share as much information as possible.** Include operating system and version, browser and version, when did you last update ERPNext, how is it customized, etc. where appropriate. Also include steps to reproduce the bug.
|
||||
1. Consider adding screenshots annotated with what goes wrong.
|
||||
1. If you are reporting an issue from the browser, Open the Javascript Console and paste us any error messages you see.
|
||||
1. **Share as much information as possible:** Include operating system and version, browser and version, when did you last update ERPNext, how is it customized, etc. where appropriate. Also include steps to reproduce the bug.
|
||||
1. **Include Screenshots if possible:** Consider adding screenshots annotated with what goes wrong.
|
||||
1. **Find and post the trace for bugs:** If you are reporting an issue from the browser, Open the Javascript Console and paste us any error messages you see.
|
||||
|
||||
|
||||
### Feature Requests
|
||||
|
||||
@@ -37,14 +44,10 @@ that function to accommodate your use case.
|
||||
|
||||
DocTypes are easy to create but hard to maintain. If you find that there is a another DocType with a similar functionality, then please try and extend that functionality. For example, by adding a "type" field to classify the new type of record.
|
||||
|
||||
#### Don't Send Trivial Requests
|
||||
|
||||
Don't send pull requests for fixing a simple typo in a code comment.
|
||||
|
||||
#### Tabs or spaces?
|
||||
|
||||
Tabs!
|
||||
|
||||
### Copyright
|
||||
|
||||
Please see README.md
|
||||
Please see README.md
|
||||
|
||||
20
MANIFEST.in
Normal file
20
MANIFEST.in
Normal file
@@ -0,0 +1,20 @@
|
||||
include MANIFEST.in
|
||||
include requirements.txt
|
||||
include *.json
|
||||
include *.md
|
||||
include *.py
|
||||
include *.txt
|
||||
include .travis.yml
|
||||
recursive-include erpnext *.txt
|
||||
recursive-include erpnext *.css
|
||||
recursive-include erpnext *.csv
|
||||
recursive-include erpnext *.html
|
||||
recursive-include erpnext *.ico
|
||||
recursive-include erpnext *.js
|
||||
recursive-include erpnext *.json
|
||||
recursive-include erpnext *.md
|
||||
recursive-include erpnext *.png
|
||||
recursive-include erpnext *.py
|
||||
recursive-include erpnext *.svg
|
||||
recursive-include erpnext/public *
|
||||
recursive-exclude * *.pyc
|
||||
39
README.md
39
README.md
@@ -1,10 +1,10 @@
|
||||
# ERPNext - Open Source ERP for small, medium sized businesses
|
||||
# ERPNext - Open Source ERP for small, medium sized businesses [](https://travis-ci.org/frappe/erpnext)
|
||||
|
||||
[https://erpnext.com](https://erpnext.com)
|
||||
|
||||
Includes Accounting, Inventory, CRM, Sales, Purchase, Projects, HRMS. Built on Python / MySQL.
|
||||
Includes Accounting, Inventory, CRM, Sales, Purchase, Projects, HRMS. Built on Python / MariaDB.
|
||||
|
||||
ERPNext is built on [wnframework](https://github.com/webnotes/wnframework)
|
||||
ERPNext is built on [frappe](https://github.com/frappe/frappe) Python Framework.
|
||||
|
||||
- [User Guide](http://erpnext.org/user-guide.html)
|
||||
- [Getting Help](http://erpnext.org/getting-help.html)
|
||||
@@ -13,28 +13,21 @@ ERPNext is built on [wnframework](https://github.com/webnotes/wnframework)
|
||||
|
||||
---
|
||||
|
||||
### Install
|
||||
|
||||
Use the bench, https://github.com/frappe/bench
|
||||
|
||||
### Admin Login
|
||||
|
||||
1. go to "/login"
|
||||
1. Administrator user name: "Administrator"
|
||||
1. Administrator password: "admin"
|
||||
|
||||
### Download and Install
|
||||
|
||||
##### Virtual Image:
|
||||
|
||||
- [ERPNext Download](http://erpnext.com/erpnext-download)
|
||||
|
||||
##### On Linux:
|
||||
|
||||
1. Switch to root user using `sudo su`
|
||||
1. create a folder where you want to install erpnext
|
||||
1. go to the new folder
|
||||
1. `wget https://raw.github.com/webnotes/erpnext/master/install_erpnext.py`
|
||||
1. `python install_erpnext.py`
|
||||
|
||||
[See installation notes](https://github.com/webnotes/erpnext/wiki/How-to-Install-ERPNext)
|
||||
|
||||
##### Patch and update
|
||||
|
||||
To patch and update from the latest git repository the erpnext folder and run.
|
||||
You will have to set your origin in git remote
|
||||
|
||||
$ lib/wnf.py --update origin master
|
||||
- [ERPNext Download](http://erpnext.com/download)
|
||||
|
||||
---
|
||||
|
||||
@@ -42,7 +35,7 @@ You will have to set your origin in git remote
|
||||
|
||||
GNU/General Public License (see LICENSE.txt)
|
||||
|
||||
The ERPNext code is licensed as GNU General Public License (v3) and the Documentation is licensed as Creative Commons (CC-BY-SA-3.0) and the copyright is owned by Web Notes Technologies Pvt Ltd (Web Notes) and Contributors.
|
||||
The ERPNext code is licensed as GNU General Public License (v3) and the Documentation is licensed as Creative Commons (CC-BY-SA-3.0) and the copyright is owned by Web Notes Technologies Pvt Ltd (Web Notes) and Contributors.
|
||||
|
||||
---
|
||||
|
||||
@@ -67,7 +60,7 @@ We will grant permission to use the ERPNext name and logo for projects that meet
|
||||
- The primary purpose of your project is to promote the spread and improvement of the ERPNext software.
|
||||
- Your project is non-commercial in nature (it can make money to cover its costs or contribute to non-profit entities, but it cannot be run as a for-profit project or business).
|
||||
Your project neither promotes nor is associated with entities that currently fail to comply with the GPL license under which ERPNext is distributed.
|
||||
- If your project meets these criteria, you will be permitted to use the ERPNext name and logo to promote your project in any way you see fit with one exception: Please do not use ERPNext as part of a domain name.
|
||||
- If your project meets these criteria, you will be permitted to use the ERPNext name and logo to promote your project in any way you see fit with one exception: Please do not use ERPNext as part of a domain name.
|
||||
|
||||
Use of the ERPNext name and logo is additionally allowed in the following situations:
|
||||
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
[
|
||||
{
|
||||
"owner": "Administrator",
|
||||
"docstatus": 0,
|
||||
"creation": "2012-04-11 13:16:56",
|
||||
"modified_by": "Administrator",
|
||||
"modified": "2012-04-13 12:24:20"
|
||||
},
|
||||
{
|
||||
"doc_type": "Journal Voucher",
|
||||
"name": "__common__",
|
||||
"module": "Accounts",
|
||||
"doctype": "Print Format",
|
||||
"html": "<!-- p.big {line-height: 200%} .noborder td { border: 0px solid #fff; } -->\n<div style=\"position: relative;\">\n<h3><script>doc.company</script><br /> <br /> \n<hr />\nPAYMENT ADVICE</h3>\n<table class=\"noborder\" style=\"width: 100%;\">\n<tbody>\n<tr>\n<td style=\"vertical-align: top;\" width=\"50%\">To :<br />\n<script type=\"text/javascript\">// <![CDATA[\ndoc.pay_to_recd_from\n// ]]></script>\n</td>\n<td width=\"50%\">\n<table class=\"noborder\" width=\"100%\">\n<tbody>\n<tr>\n<td width=\"30%\">Voucher No :</td>\n<td width=\"70%\">\n<script type=\"text/javascript\">// <![CDATA[\ndoc.name\n// ]]></script>\n</td>\n</tr>\n<tr>\n<td width=\"30%\">Voucher Date :</td>\n<td width=\"70%\">\n<script type=\"text/javascript\">// <![CDATA[\ndate.str_to_user(doc.voucher_date)\n// ]]></script>\n</td>\n</tr>\n<tr>\n<td width=\"30%\">Cheque No :</td>\n<td width=\"70%\">\n<script type=\"text/javascript\">// <![CDATA[\ndate.str_to_user(doc.cheque_no)\n// ]]></script>\n</td>\n</tr>\n<tr>\n<td width=\"30%\">Cheque Date :</td>\n<td width=\"70%\">\n<script type=\"text/javascript\">// <![CDATA[\ndate.str_to_user(doc.cheque_date)\n// ]]></script>\n</td>\n</tr>\n</tbody>\n</table>\n</td>\n</tr>\n</tbody>\n</table>\n<br /> <strong>We are pleased to enclose our cheque in full/part Settlement of your under noted bills</strong> <br /> \n<hr />\n<table class=\"noborder\" width=\"100%\">\n<tbody>\n<tr>\n<td width=\"70%\"> </td>\n<td width=\"15%\">Total :</td>\n<td class=\"pos_left\" width=\"15%\">\n<script type=\"text/javascript\">// <![CDATA[\ndoc.total_amount\n// ]]></script>\n</td>\n</tr>\n<tr>\n<td colspan=\"3\">Narration :\n<script type=\"text/javascript\">// <![CDATA[\nreplace_newlines(doc.remark)\n// ]]></script>\n<br /><br /><br /></td>\n</tr>\n</tbody>\n</table>\n<div style=\"position: absolute; top: 14cm; left: 0cm;\">Prepared By</div>\n<div style=\"position: absolute; top: 14cm; left: 5.5cm;\">Authorised Signatory</div>\n<div style=\"position: absolute; top: 14cm; left: 11cm;\">Received Payment as Above</div>\n<div style=\"position: absolute; top: 16.4cm; left: 5.9cm;\"><strong>_____________</strong></div>\n<div style=\"position: absolute; top: 16.7cm; left: 6cm;\"><strong>A/c Payee</strong></div>\n<div style=\"position: absolute; top: 16.7cm; left: 5.9cm;\"><strong>_____________</strong></div>\n<div style=\"position: absolute; top: 16.9cm; left: 12cm;\">\n<script type=\"text/javascript\">// <![CDATA[\ndate.str_to_user(doc.cheque_date)\n// ]]></script>\n</div>\n<div style=\"position: absolute; top: 17.9cm; left: 1cm;\">\n<script type=\"text/javascript\">// <![CDATA[\ndoc.pay_to_recd_from\n// ]]></script>\n</div>\n<div style=\"position: absolute; top: 18.6cm; left: 1cm; width: 7cm;\">\n<script type=\"text/javascript\">// <![CDATA[\ndoc.total_amount_in_words\n// ]]></script>\n</div>\n<div style=\"position: absolute; top: 19.7cm; left: 12cm;\">\n<script type=\"text/javascript\">// <![CDATA[\ndoc.total_amount\n// ]]></script>\n</div>\n</div>",
|
||||
"standard": "Yes"
|
||||
},
|
||||
{
|
||||
"name": "Cheque Printing Format",
|
||||
"doctype": "Print Format"
|
||||
}
|
||||
]
|
||||
File diff suppressed because one or more lines are too long
@@ -1,21 +0,0 @@
|
||||
[
|
||||
{
|
||||
"creation": "2012-05-01 12:46:31",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-01-21 18:40:20",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
{
|
||||
"doc_type": "Journal Voucher",
|
||||
"doctype": "Print Format",
|
||||
"html": "<h3 align=\"center\"><script>doc.select_print_heading || \"Payment Receipt Note\"</script></h3>\n\n<table class='simpletable'>\n<tr>\n<td><b> Receipt No.: </b></td>\n<td><script>doc.name</script></td>\n</tr>\n<tr>\n<td><b> Date : </b></td>\n<td><script>date.str_to_user(doc.voucher_date)</script></td>\n</tr> \n<tr>\n<td><b> Remark: </b></td>\n<td><script> doc.remark </script></td>\n</tr>\n<tr>\n<td><b> Received From: </b></td>\n<td><b><script> doc.pay_to_recd_from </script></b></td>\n</tr>\n</table>\n<br>\n\n<div><b><script>doc.total_amount</script></b> </td></div><br>\n<div style=\"text-align:left\"><b><script>doc.total_amount_in_words</script></b></div><br>\n<br>\n<table class=\"noborder\">\n<tr>\n<td style = \"text-align = right;\"><h3>For <script>doc.company</script>,</h3><br><div>(Authorised Signatory)</div></td>\n</tr>\n</table>",
|
||||
"module": "Accounts",
|
||||
"name": "__common__",
|
||||
"standard": "Yes"
|
||||
},
|
||||
{
|
||||
"doctype": "Print Format",
|
||||
"name": "Payment Receipt Voucher"
|
||||
}
|
||||
]
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,135 +0,0 @@
|
||||
{%- if doc.letter_head -%}
|
||||
{{ webnotes.conn.get_value("Letter Head", doc.letter_head, "content") }}
|
||||
{%- endif -%}
|
||||
<!-- Page Layout Settings -->
|
||||
<div class='common page-header'>
|
||||
<table class='header-table' cellspacing=0>
|
||||
<thead>
|
||||
<tr><td colspan="2"><h1>{{ doc.select_print_heading or 'Invoice' }}</h1></td></tr>
|
||||
<tr><td colspan="2"><h3>{{ doc.name }}</h3></td></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td width=60%><table width=100% cellspacing=0><tbody>
|
||||
<tr>
|
||||
<td width=39%><b>Name</b></td>
|
||||
<td>{{ doc.customer_name }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>Address</b></td>
|
||||
<td>{{ doc.address_display.replace("\n", "<br>") }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>Contact</b></td>
|
||||
<td>{{ doc.contact_display }}</td>
|
||||
</tr>
|
||||
</tbody></table></td>
|
||||
<td><table width=100% cellspacing=0><tbody>
|
||||
<tr>
|
||||
<td width=40%><b>Invoice Date</b></td>
|
||||
<td>{{ utils.formatdate(doc.posting_date) }}</td>
|
||||
<tr>
|
||||
{%- if doc.convert_into_recurring_invoice and doc.recurring_id -%}
|
||||
<tr>
|
||||
<td width=40%><b>Invoice Period</b></td>
|
||||
<td>{{ (utils.formatdate(doc.invoice_period_from_date)) +
|
||||
' to ' + utils.formatdate(doc.invoice_period_to_date) }}</td>
|
||||
<tr>
|
||||
{%- endif -%}
|
||||
<tr>
|
||||
<td><b>Due Date</b></td>
|
||||
<td>{{ utils.formatdate(doc.due_date) }}</td>
|
||||
<tr>
|
||||
</tbody></table></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
<div class='common page-body'>
|
||||
<!--
|
||||
Page Body will contain
|
||||
+ table 2
|
||||
- Sales Invoice Data
|
||||
-->
|
||||
<table class="table table-bordered">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Sr</th>
|
||||
<th>Item Name</th>
|
||||
<th>Description</th>
|
||||
<th>Qty</th>
|
||||
<th>UoM</th>
|
||||
<th>Basic Rate</th>
|
||||
<th>Amount</th>
|
||||
</tr>
|
||||
{%- for row in doclist.get({"doctype":"Sales Invoice Item"}) %}
|
||||
<tr>
|
||||
<td style="width: 3%;">{{ row.idx }}</td>
|
||||
<td style="width: 20%;">{{ row.item_name }}</td>
|
||||
<td style="width: 37%;">{{ row.description }}</td>
|
||||
<td style="width: 5%; text-align: right;">{{ row.qty }}</td>
|
||||
<td style="width: 5%;">{{ row.stock_uom }}</td>
|
||||
<td style="width: 15%; text-align: right;">{{ utils.fmt_money(row.export_rate, currency=doc.currency) }}</td>
|
||||
<td style="width: 15%; text-align: right;">{{ utils.fmt_money(row.export_amount, currency=doc.currency) }}</td>
|
||||
</tr>
|
||||
{% endfor -%}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class='common page-footer'>
|
||||
<!--
|
||||
Page Footer will contain
|
||||
+ table 3
|
||||
- Terms and Conditions
|
||||
- Total Rounded Amount Calculation
|
||||
- Total Rounded Amount in Words
|
||||
-->
|
||||
<table class='footer-table' width=100% cellspacing=0>
|
||||
<thead>
|
||||
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td width=60% style='padding-right: 10px;'>
|
||||
<b>Terms, Conditions & Other Information:</b><br />
|
||||
{{ doc.terms }}
|
||||
</td>
|
||||
<td>
|
||||
<table cellspacing=0 width=100%>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Net Total</td>
|
||||
<td width=40% style="text-align: right;">{{
|
||||
utils.fmt_money(doc.net_total_export, currency=doc.currency)
|
||||
}}</td>
|
||||
</tr>
|
||||
{%- for charge in doclist.get({"doctype":"Sales Taxes and Charges"}) -%}
|
||||
{%- if not charge.included_in_print_rate -%}
|
||||
<tr>
|
||||
<td>{{ charge.description }}</td>
|
||||
<td style="text-align: right;">{{ utils.fmt_money(charge.tax_amount / doc.conversion_rate, currency=doc.currency) }}</td>
|
||||
</tr>
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
<tr>
|
||||
<td>Grand Total</td>
|
||||
<td style="text-align: right;">{{ utils.fmt_money(doc.grand_total_export, currency=doc.currency) }}</td>
|
||||
</tr>
|
||||
<tr style='font-weight: bold'>
|
||||
<td>Rounded Total</td>
|
||||
<td style="text-align: right;">{{ utils.fmt_money(doc.rounded_total_export, currency=doc.currency) }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<br /><b>In Words</b><br />
|
||||
<i>{{ doc.in_words_export }}</i>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
@@ -1,20 +0,0 @@
|
||||
[
|
||||
{
|
||||
"creation": "2013-03-21 15:24:28",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-03-21 15:26:21",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
{
|
||||
"doc_type": "Sales Invoice",
|
||||
"doctype": "Print Format",
|
||||
"module": "Accounts",
|
||||
"name": "__common__",
|
||||
"standard": "Yes"
|
||||
},
|
||||
{
|
||||
"doctype": "Print Format",
|
||||
"name": "SalesInvoice"
|
||||
}
|
||||
]
|
||||
@@ -1,146 +0,0 @@
|
||||
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
// License: GNU General Public License v3. See license.txt
|
||||
|
||||
|
||||
// Onload
|
||||
// -----------------------------------------
|
||||
cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
||||
}
|
||||
|
||||
// Refresh
|
||||
// -----------------------------------------
|
||||
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
||||
if(doc.__islocal) {
|
||||
msgprint(wn._("Please create new account from Chart of Accounts."));
|
||||
throw "cannot create";
|
||||
}
|
||||
|
||||
cur_frm.toggle_display('account_name', doc.__islocal);
|
||||
|
||||
// hide fields if group
|
||||
cur_frm.toggle_display(['account_type', 'master_type', 'master_name',
|
||||
'credit_days', 'credit_limit', 'tax_rate'], doc.group_or_ledger=='Ledger')
|
||||
|
||||
// disable fields
|
||||
cur_frm.toggle_enable(['account_name', 'debit_or_credit', 'group_or_ledger',
|
||||
'is_pl_account', 'company'], false);
|
||||
|
||||
if(doc.group_or_ledger=='Ledger') {
|
||||
wn.model.with_doc("Accounts Settings", "Accounts Settings", function (name) {
|
||||
var accounts_settings = wn.model.get_doc("Accounts Settings", name);
|
||||
var display = accounts_settings["frozen_accounts_modifier"]
|
||||
&& in_list(user_roles, accounts_settings["frozen_accounts_modifier"]);
|
||||
|
||||
cur_frm.toggle_display('freeze_account', display);
|
||||
});
|
||||
}
|
||||
|
||||
// read-only for root accounts
|
||||
if(!doc.parent_account) {
|
||||
cur_frm.perm = [[1,0,0], [1,0,0]];
|
||||
cur_frm.set_intro(wn._("This is a root account and cannot be edited."));
|
||||
} else {
|
||||
// credit days and type if customer or supplier
|
||||
cur_frm.set_intro(null);
|
||||
cur_frm.toggle_display(['credit_days', 'credit_limit'], in_list(['Customer', 'Supplier'],
|
||||
doc.master_type));
|
||||
|
||||
cur_frm.cscript.master_type(doc, cdt, cdn);
|
||||
cur_frm.cscript.account_type(doc, cdt, cdn);
|
||||
|
||||
// show / hide convert buttons
|
||||
cur_frm.cscript.add_toolbar_buttons(doc);
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.cscript.master_type = function(doc, cdt, cdn) {
|
||||
cur_frm.toggle_display(['credit_days', 'credit_limit'], in_list(['Customer', 'Supplier'],
|
||||
doc.master_type));
|
||||
|
||||
cur_frm.toggle_display('master_name', doc.account_type=='Warehouse' ||
|
||||
in_list(['Customer', 'Supplier'], doc.master_type));
|
||||
}
|
||||
|
||||
|
||||
// Fetch parent details
|
||||
// -----------------------------------------
|
||||
cur_frm.add_fetch('parent_account', 'debit_or_credit', 'debit_or_credit');
|
||||
cur_frm.add_fetch('parent_account', 'is_pl_account', 'is_pl_account');
|
||||
|
||||
// Hide tax rate based on account type
|
||||
// -----------------------------------------
|
||||
cur_frm.cscript.account_type = function(doc, cdt, cdn) {
|
||||
if(doc.group_or_ledger=='Ledger') {
|
||||
cur_frm.toggle_display(['tax_rate'], doc.account_type == 'Tax');
|
||||
cur_frm.toggle_display('master_type', cstr(doc.account_type)=='');
|
||||
cur_frm.toggle_display('master_name', doc.account_type=='Warehouse' ||
|
||||
in_list(['Customer', 'Supplier'], doc.master_type));
|
||||
}
|
||||
}
|
||||
|
||||
// Hide/unhide group or ledger
|
||||
// -----------------------------------------
|
||||
cur_frm.cscript.add_toolbar_buttons = function(doc) {
|
||||
cur_frm.appframe.add_button(wn._('Chart of Accounts'),
|
||||
function() { wn.set_route("Accounts Browser", "Account"); }, 'icon-sitemap')
|
||||
|
||||
if (cstr(doc.group_or_ledger) == 'Group') {
|
||||
cur_frm.add_custom_button(wn._('Convert to Ledger'),
|
||||
function() { cur_frm.cscript.convert_to_ledger(); }, 'icon-retweet')
|
||||
} else if (cstr(doc.group_or_ledger) == 'Ledger') {
|
||||
cur_frm.add_custom_button(wn._('Convert to Group'),
|
||||
function() { cur_frm.cscript.convert_to_group(); }, 'icon-retweet')
|
||||
|
||||
cur_frm.appframe.add_button(wn._('View Ledger'), function() {
|
||||
wn.route_options = {
|
||||
"account": doc.name,
|
||||
"from_date": sys_defaults.year_start_date,
|
||||
"to_date": sys_defaults.year_end_date,
|
||||
"company": doc.company
|
||||
};
|
||||
wn.set_route("query-report", "General Ledger");
|
||||
}, "icon-table");
|
||||
}
|
||||
}
|
||||
// Convert group to ledger
|
||||
// -----------------------------------------
|
||||
cur_frm.cscript.convert_to_ledger = function(doc, cdt, cdn) {
|
||||
return $c_obj(cur_frm.get_doclist(),'convert_group_to_ledger','',function(r,rt) {
|
||||
if(r.message == 1) {
|
||||
cur_frm.refresh();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Convert ledger to group
|
||||
// -----------------------------------------
|
||||
cur_frm.cscript.convert_to_group = function(doc, cdt, cdn) {
|
||||
return $c_obj(cur_frm.get_doclist(),'convert_ledger_to_group','',function(r,rt) {
|
||||
if(r.message == 1) {
|
||||
cur_frm.refresh();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['master_name'].get_query = function(doc) {
|
||||
if (doc.master_type || doc.account_type=="Warehouse") {
|
||||
var dt = doc.master_type || "Warehouse";
|
||||
return {
|
||||
doctype: dt,
|
||||
query: "accounts.doctype.account.account.get_master_name",
|
||||
filters: {
|
||||
"master_type": dt,
|
||||
"company": doc.company
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['parent_account'].get_query = function(doc) {
|
||||
return {
|
||||
filters: {
|
||||
"group_or_ledger": "Group",
|
||||
"company": doc.company
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,248 +0,0 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
from webnotes.utils import flt, fmt_money, cstr, cint
|
||||
from webnotes import msgprint, _
|
||||
|
||||
get_value = webnotes.conn.get_value
|
||||
|
||||
class DocType:
|
||||
def __init__(self,d,dl):
|
||||
self.doc, self.doclist = d,dl
|
||||
self.nsm_parent_field = 'parent_account'
|
||||
|
||||
def autoname(self):
|
||||
self.doc.name = self.doc.account_name.strip() + ' - ' + \
|
||||
webnotes.conn.get_value("Company", self.doc.company, "abbr")
|
||||
|
||||
def get_address(self):
|
||||
return {
|
||||
'address': webnotes.conn.get_value(self.doc.master_type,
|
||||
self.doc.master_name, "address")
|
||||
}
|
||||
|
||||
def validate(self):
|
||||
self.validate_master_name()
|
||||
self.validate_parent()
|
||||
self.validate_duplicate_account()
|
||||
self.validate_root_details()
|
||||
self.validate_mandatory()
|
||||
self.validate_warehouse_account()
|
||||
self.validate_frozen_accounts_modifier()
|
||||
|
||||
if not self.doc.parent_account:
|
||||
self.doc.parent_account = ''
|
||||
|
||||
def validate_master_name(self):
|
||||
"""Remind to add master name"""
|
||||
if self.doc.master_type in ('Customer', 'Supplier') or self.doc.account_type == "Warehouse":
|
||||
if not self.doc.master_name:
|
||||
msgprint(_("Please enter Master Name once the account is created."))
|
||||
elif not webnotes.conn.exists(self.doc.master_type or self.doc.account_type,
|
||||
self.doc.master_name):
|
||||
webnotes.throw(_("Invalid Master Name"))
|
||||
|
||||
def validate_parent(self):
|
||||
"""Fetch Parent Details and validation for account not to be created under ledger"""
|
||||
if self.doc.parent_account:
|
||||
par = webnotes.conn.sql("""select name, group_or_ledger, is_pl_account, debit_or_credit
|
||||
from tabAccount where name =%s""", self.doc.parent_account)
|
||||
if not par:
|
||||
msgprint("Parent account does not exists", raise_exception=1)
|
||||
elif par[0][0] == self.doc.name:
|
||||
msgprint("You can not assign itself as parent account", raise_exception=1)
|
||||
elif par[0][1] != 'Group':
|
||||
msgprint("Parent account can not be a ledger", raise_exception=1)
|
||||
elif self.doc.debit_or_credit and par[0][3] != self.doc.debit_or_credit:
|
||||
msgprint("You can not move a %s account under %s account" %
|
||||
(self.doc.debit_or_credit, par[0][3]), raise_exception=1)
|
||||
|
||||
if not self.doc.is_pl_account:
|
||||
self.doc.is_pl_account = par[0][2]
|
||||
if not self.doc.debit_or_credit:
|
||||
self.doc.debit_or_credit = par[0][3]
|
||||
|
||||
def validate_max_root_accounts(self):
|
||||
"""Raise exception if there are more than 4 root accounts"""
|
||||
if webnotes.conn.sql("""select count(*) from tabAccount where
|
||||
company=%s and ifnull(parent_account,'')='' and docstatus != 2""",
|
||||
self.doc.company)[0][0] > 4:
|
||||
webnotes.msgprint("One company cannot have more than 4 root Accounts",
|
||||
raise_exception=1)
|
||||
|
||||
def validate_duplicate_account(self):
|
||||
if self.doc.fields.get('__islocal') or not self.doc.name:
|
||||
company_abbr = webnotes.conn.get_value("Company", self.doc.company, "abbr")
|
||||
if webnotes.conn.sql("""select name from tabAccount where name=%s""",
|
||||
(self.doc.account_name + " - " + company_abbr)):
|
||||
msgprint("Account Name: %s already exists, please rename"
|
||||
% self.doc.account_name, raise_exception=1)
|
||||
|
||||
def validate_root_details(self):
|
||||
#does not exists parent
|
||||
if webnotes.conn.exists("Account", self.doc.name):
|
||||
if not webnotes.conn.get_value("Account", self.doc.name, "parent_account"):
|
||||
webnotes.msgprint("Root cannot be edited.", raise_exception=1)
|
||||
|
||||
def validate_frozen_accounts_modifier(self):
|
||||
old_value = webnotes.conn.get_value("Account", self.doc.name, "freeze_account")
|
||||
if old_value and old_value != self.doc.freeze_account:
|
||||
frozen_accounts_modifier = webnotes.conn.get_value( 'Accounts Settings', None,
|
||||
'frozen_accounts_modifier')
|
||||
if not frozen_accounts_modifier or \
|
||||
frozen_accounts_modifier not in webnotes.user.get_roles():
|
||||
webnotes.throw(_("You are not authorized to set Frozen value"))
|
||||
|
||||
def convert_group_to_ledger(self):
|
||||
if self.check_if_child_exists():
|
||||
msgprint("Account: %s has existing child. You can not convert this account to ledger" %
|
||||
(self.doc.name), raise_exception=1)
|
||||
elif self.check_gle_exists():
|
||||
msgprint("Account with existing transaction can not be converted to ledger.",
|
||||
raise_exception=1)
|
||||
else:
|
||||
self.doc.group_or_ledger = 'Ledger'
|
||||
self.doc.save()
|
||||
return 1
|
||||
|
||||
def convert_ledger_to_group(self):
|
||||
if self.check_gle_exists():
|
||||
msgprint("Account with existing transaction can not be converted to group.",
|
||||
raise_exception=1)
|
||||
elif self.doc.master_type or self.doc.account_type:
|
||||
msgprint("Cannot covert to Group because Master Type or Account Type is selected.",
|
||||
raise_exception=1)
|
||||
else:
|
||||
self.doc.group_or_ledger = 'Group'
|
||||
self.doc.save()
|
||||
return 1
|
||||
|
||||
# Check if any previous balance exists
|
||||
def check_gle_exists(self):
|
||||
return webnotes.conn.get_value("GL Entry", {"account": self.doc.name})
|
||||
|
||||
def check_if_child_exists(self):
|
||||
return webnotes.conn.sql("""select name from `tabAccount` where parent_account = %s
|
||||
and docstatus != 2""", self.doc.name)
|
||||
|
||||
def validate_mandatory(self):
|
||||
if not self.doc.debit_or_credit:
|
||||
msgprint("Debit or Credit field is mandatory", raise_exception=1)
|
||||
if not self.doc.is_pl_account:
|
||||
msgprint("Is PL Account field is mandatory", raise_exception=1)
|
||||
|
||||
def validate_warehouse_account(self):
|
||||
if not cint(webnotes.defaults.get_global_default("auto_accounting_for_stock")):
|
||||
return
|
||||
|
||||
if self.doc.account_type == "Warehouse":
|
||||
old_warehouse = cstr(webnotes.conn.get_value("Account", self.doc.name, "master_name"))
|
||||
if old_warehouse != cstr(self.doc.master_name):
|
||||
if old_warehouse:
|
||||
self.validate_warehouse(old_warehouse)
|
||||
if self.doc.master_name:
|
||||
self.validate_warehouse(self.doc.master_name)
|
||||
else:
|
||||
webnotes.throw(_("Master Name is mandatory if account type is Warehouse"))
|
||||
|
||||
def validate_warehouse(self, warehouse):
|
||||
if webnotes.conn.get_value("Stock Ledger Entry", {"warehouse": warehouse}):
|
||||
webnotes.throw(_("Stock transactions exist against warehouse ") + warehouse +
|
||||
_(" .You can not assign / modify / remove Master Name"))
|
||||
|
||||
def update_nsm_model(self):
|
||||
"""update lft, rgt indices for nested set model"""
|
||||
import webnotes
|
||||
import webnotes.utils.nestedset
|
||||
webnotes.utils.nestedset.update_nsm(self)
|
||||
|
||||
def on_update(self):
|
||||
self.validate_max_root_accounts()
|
||||
self.update_nsm_model()
|
||||
|
||||
def get_authorized_user(self):
|
||||
# Check logged-in user is authorized
|
||||
if webnotes.conn.get_value('Accounts Settings', None, 'credit_controller') \
|
||||
in webnotes.user.get_roles():
|
||||
return 1
|
||||
|
||||
def check_credit_limit(self, total_outstanding):
|
||||
# Get credit limit
|
||||
credit_limit_from = 'Customer'
|
||||
|
||||
cr_limit = webnotes.conn.sql("""select t1.credit_limit from tabCustomer t1, `tabAccount` t2
|
||||
where t2.name=%s and t1.name = t2.master_name""", self.doc.name)
|
||||
credit_limit = cr_limit and flt(cr_limit[0][0]) or 0
|
||||
if not credit_limit:
|
||||
credit_limit = webnotes.conn.get_value('Company', self.doc.company, 'credit_limit')
|
||||
credit_limit_from = 'Company'
|
||||
|
||||
# If outstanding greater than credit limit and not authorized person raise exception
|
||||
if credit_limit > 0 and flt(total_outstanding) > credit_limit \
|
||||
and not self.get_authorized_user():
|
||||
msgprint("""Total Outstanding amount (%s) for <b>%s</b> can not be \
|
||||
greater than credit limit (%s). To change your credit limit settings, \
|
||||
please update in the <b>%s</b> master""" % (fmt_money(total_outstanding),
|
||||
self.doc.name, fmt_money(credit_limit), credit_limit_from), raise_exception=1)
|
||||
|
||||
def validate_trash(self):
|
||||
"""checks gl entries and if child exists"""
|
||||
if not self.doc.parent_account:
|
||||
msgprint("Root account can not be deleted", raise_exception=1)
|
||||
|
||||
if self.check_gle_exists():
|
||||
msgprint("""Account with existing transaction (Sales Invoice / Purchase Invoice / \
|
||||
Journal Voucher) can not be deleted""", raise_exception=1)
|
||||
if self.check_if_child_exists():
|
||||
msgprint("Child account exists for this account. You can not delete this account.",
|
||||
raise_exception=1)
|
||||
|
||||
def on_trash(self):
|
||||
self.validate_trash()
|
||||
self.update_nsm_model()
|
||||
|
||||
def before_rename(self, old, new, merge=False):
|
||||
# Add company abbr if not provided
|
||||
from setup.doctype.company.company import get_name_with_abbr
|
||||
new_account = get_name_with_abbr(new, self.doc.company)
|
||||
|
||||
# Validate properties before merging
|
||||
if merge:
|
||||
if not webnotes.conn.exists("Account", new):
|
||||
webnotes.throw(_("Account ") + new +_(" does not exists"))
|
||||
|
||||
val = list(webnotes.conn.get_value("Account", new_account,
|
||||
["group_or_ledger", "debit_or_credit", "is_pl_account"]))
|
||||
|
||||
if val != [self.doc.group_or_ledger, self.doc.debit_or_credit, self.doc.is_pl_account]:
|
||||
webnotes.throw(_("""Merging is only possible if following \
|
||||
properties are same in both records.
|
||||
Group or Ledger, Debit or Credit, Is PL Account"""))
|
||||
|
||||
return new_account
|
||||
|
||||
def after_rename(self, old, new, merge=False):
|
||||
if not merge:
|
||||
webnotes.conn.set_value("Account", new, "account_name",
|
||||
" - ".join(new.split(" - ")[:-1]))
|
||||
else:
|
||||
from webnotes.utils.nestedset import rebuild_tree
|
||||
rebuild_tree("Account", "parent_account")
|
||||
|
||||
def get_master_name(doctype, txt, searchfield, start, page_len, filters):
|
||||
conditions = (" and company='%s'"% filters["company"]) if doctype == "Warehouse" else ""
|
||||
|
||||
return webnotes.conn.sql("""select name from `tab%s` where %s like %s %s
|
||||
order by name limit %s, %s""" %
|
||||
(filters["master_type"], searchfield, "%s", conditions, "%s", "%s"),
|
||||
("%%%s%%" % txt, start, page_len), as_list=1)
|
||||
|
||||
def get_parent_account(doctype, txt, searchfield, start, page_len, filters):
|
||||
return webnotes.conn.sql("""select name from tabAccount
|
||||
where group_or_ledger = 'Group' and docstatus != 2 and company = %s
|
||||
and %s like %s order by name limit %s, %s""" %
|
||||
("%s", searchfield, "%s", "%s", "%s"),
|
||||
(filters["company"], "%%%s%%" % txt, start, page_len), as_list=1)
|
||||
@@ -1,320 +0,0 @@
|
||||
[
|
||||
{
|
||||
"creation": "2013-01-30 12:49:46",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-09-24 11:22:18",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
{
|
||||
"allow_copy": 1,
|
||||
"allow_rename": 1,
|
||||
"description": "Heads (or groups) against which Accounting Entries are made and balances are maintained.",
|
||||
"doctype": "DocType",
|
||||
"document_type": "Master",
|
||||
"icon": "icon-money",
|
||||
"in_create": 1,
|
||||
"module": "Accounts",
|
||||
"name": "__common__",
|
||||
"search_fields": "debit_or_credit, group_or_ledger"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"name": "__common__",
|
||||
"parent": "Account",
|
||||
"parentfield": "fields",
|
||||
"parenttype": "DocType",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"doctype": "DocPerm",
|
||||
"name": "__common__",
|
||||
"parent": "Account",
|
||||
"parentfield": "permissions",
|
||||
"parenttype": "DocType",
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"submit": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocType",
|
||||
"name": "Account"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "properties",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Account Details",
|
||||
"oldfieldtype": "Section Break"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "column_break0",
|
||||
"fieldtype": "Column Break",
|
||||
"width": "50%"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "account_name",
|
||||
"fieldtype": "Data",
|
||||
"in_filter": 1,
|
||||
"label": "Account Name",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "account_name",
|
||||
"oldfieldtype": "Data",
|
||||
"read_only": 1,
|
||||
"reqd": 1,
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "level",
|
||||
"fieldtype": "Int",
|
||||
"hidden": 1,
|
||||
"label": "Level",
|
||||
"oldfieldname": "level",
|
||||
"oldfieldtype": "Int",
|
||||
"print_hide": 1,
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"default": "Ledger",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "group_or_ledger",
|
||||
"fieldtype": "Select",
|
||||
"in_filter": 1,
|
||||
"label": "Group or Ledger",
|
||||
"oldfieldname": "group_or_ledger",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "\nLedger\nGroup",
|
||||
"read_only": 1,
|
||||
"reqd": 1,
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "debit_or_credit",
|
||||
"fieldtype": "Data",
|
||||
"in_filter": 1,
|
||||
"label": "Debit or Credit",
|
||||
"oldfieldname": "debit_or_credit",
|
||||
"oldfieldtype": "Data",
|
||||
"read_only": 1,
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "is_pl_account",
|
||||
"fieldtype": "Select",
|
||||
"in_filter": 1,
|
||||
"label": "Is PL Account",
|
||||
"oldfieldname": "is_pl_account",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "Yes\nNo",
|
||||
"read_only": 1,
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "company",
|
||||
"fieldtype": "Link",
|
||||
"in_filter": 1,
|
||||
"label": "Company",
|
||||
"oldfieldname": "company",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Company",
|
||||
"read_only": 1,
|
||||
"reqd": 1,
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "column_break1",
|
||||
"fieldtype": "Column Break",
|
||||
"width": "50%"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "parent_account",
|
||||
"fieldtype": "Link",
|
||||
"label": "Parent Account",
|
||||
"oldfieldname": "parent_account",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Account",
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"description": "Setting Account Type helps in selecting this Account in transactions.",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "account_type",
|
||||
"fieldtype": "Select",
|
||||
"in_filter": 1,
|
||||
"label": "Account Type",
|
||||
"oldfieldname": "account_type",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "\nFixed Asset Account\nBank or Cash\nExpense Account\nTax\nIncome Account\nChargeable\nWarehouse",
|
||||
"permlevel": 0,
|
||||
"search_index": 0
|
||||
},
|
||||
{
|
||||
"description": "Rate at which this tax is applied",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "tax_rate",
|
||||
"fieldtype": "Float",
|
||||
"hidden": 0,
|
||||
"label": "Rate",
|
||||
"oldfieldname": "tax_rate",
|
||||
"oldfieldtype": "Currency",
|
||||
"reqd": 0
|
||||
},
|
||||
{
|
||||
"description": "If the account is frozen, entries are allowed to restricted users.",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "freeze_account",
|
||||
"fieldtype": "Select",
|
||||
"label": "Frozen",
|
||||
"oldfieldname": "freeze_account",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "No\nYes"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "credit_days",
|
||||
"fieldtype": "Int",
|
||||
"hidden": 1,
|
||||
"label": "Credit Days",
|
||||
"oldfieldname": "credit_days",
|
||||
"oldfieldtype": "Int",
|
||||
"print_hide": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "credit_limit",
|
||||
"fieldtype": "Currency",
|
||||
"hidden": 1,
|
||||
"label": "Credit Limit",
|
||||
"oldfieldname": "credit_limit",
|
||||
"oldfieldtype": "Currency",
|
||||
"options": "Company:company:default_currency",
|
||||
"print_hide": 1
|
||||
},
|
||||
{
|
||||
"description": "If this Account represents a Customer, Supplier or Employee, set it here.",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "master_type",
|
||||
"fieldtype": "Select",
|
||||
"label": "Master Type",
|
||||
"oldfieldname": "master_type",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "\nSupplier\nCustomer\nEmployee"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "master_name",
|
||||
"fieldtype": "Link",
|
||||
"label": "Master Name",
|
||||
"oldfieldname": "master_name",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "[Select]"
|
||||
},
|
||||
{
|
||||
"default": "1",
|
||||
"depends_on": "eval:doc.group_or_ledger==\"Ledger\"",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "allow_negative_balance",
|
||||
"fieldtype": "Check",
|
||||
"label": "Allow Negative Balance"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "lft",
|
||||
"fieldtype": "Int",
|
||||
"hidden": 1,
|
||||
"label": "Lft",
|
||||
"print_hide": 1,
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "rgt",
|
||||
"fieldtype": "Int",
|
||||
"hidden": 1,
|
||||
"label": "Rgt",
|
||||
"print_hide": 1,
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "old_parent",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 1,
|
||||
"label": "Old Parent",
|
||||
"print_hide": 1,
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"permlevel": 0,
|
||||
"role": "Accounts User",
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"doctype": "DocPerm",
|
||||
"permlevel": 0,
|
||||
"role": "Auditor",
|
||||
"write": 0
|
||||
},
|
||||
{
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"doctype": "DocPerm",
|
||||
"permlevel": 0,
|
||||
"role": "Sales User",
|
||||
"write": 0
|
||||
},
|
||||
{
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"doctype": "DocPerm",
|
||||
"permlevel": 0,
|
||||
"role": "Purchase User",
|
||||
"write": 0
|
||||
},
|
||||
{
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"doctype": "DocPerm",
|
||||
"permlevel": 2,
|
||||
"role": "Auditor",
|
||||
"write": 0
|
||||
},
|
||||
{
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"permlevel": 0,
|
||||
"role": "Accounts Manager",
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"doctype": "DocPerm",
|
||||
"permlevel": 2,
|
||||
"role": "Accounts Manager",
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"doctype": "DocPerm",
|
||||
"permlevel": 2,
|
||||
"role": "Accounts User",
|
||||
"write": 0
|
||||
}
|
||||
]
|
||||
@@ -1,46 +0,0 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
def make_test_records(verbose):
|
||||
from webnotes.test_runner import make_test_objects
|
||||
|
||||
accounts = [
|
||||
# [account_name, parent_account, group_or_ledger]
|
||||
["_Test Account Bank Account", "Bank Accounts", "Ledger"],
|
||||
|
||||
["_Test Account Stock Expenses", "Direct Expenses", "Group"],
|
||||
["_Test Account Shipping Charges", "_Test Account Stock Expenses", "Ledger"],
|
||||
["_Test Account Customs Duty", "_Test Account Stock Expenses", "Ledger"],
|
||||
|
||||
|
||||
["_Test Account Tax Assets", "Current Assets", "Group"],
|
||||
["_Test Account VAT", "_Test Account Tax Assets", "Ledger"],
|
||||
["_Test Account Service Tax", "_Test Account Tax Assets", "Ledger"],
|
||||
|
||||
["_Test Account Reserves and Surplus", "Current Liabilities", "Ledger"],
|
||||
|
||||
["_Test Account Cost for Goods Sold", "Expenses", "Ledger"],
|
||||
["_Test Account Excise Duty", "_Test Account Tax Assets", "Ledger"],
|
||||
["_Test Account Education Cess", "_Test Account Tax Assets", "Ledger"],
|
||||
["_Test Account S&H Education Cess", "_Test Account Tax Assets", "Ledger"],
|
||||
["_Test Account CST", "Direct Expenses", "Ledger"],
|
||||
["_Test Account Discount", "Direct Expenses", "Ledger"],
|
||||
|
||||
# related to Account Inventory Integration
|
||||
["_Test Account Stock In Hand", "Current Assets", "Ledger"],
|
||||
["_Test Account Fixed Assets", "Current Assets", "Ledger"],
|
||||
]
|
||||
|
||||
for company, abbr in [["_Test Company", "_TC"], ["_Test Company 1", "_TC1"]]:
|
||||
test_objects = make_test_objects("Account", [[{
|
||||
"doctype": "Account",
|
||||
"account_name": account_name,
|
||||
"parent_account": parent_account + " - " + abbr,
|
||||
"company": company,
|
||||
"group_or_ledger": group_or_ledger
|
||||
}] for account_name, parent_account, group_or_ledger in accounts])
|
||||
|
||||
return test_objects
|
||||
@@ -1,25 +0,0 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
# For license information, please see license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
from webnotes import _
|
||||
|
||||
class DocType:
|
||||
def __init__(self, d, dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
|
||||
def on_update(self):
|
||||
webnotes.conn.set_default("auto_accounting_for_stock", self.doc.auto_accounting_for_stock)
|
||||
|
||||
if self.doc.auto_accounting_for_stock:
|
||||
warehouse_list = webnotes.conn.sql("select name, company from tabWarehouse", as_dict=1)
|
||||
warehouse_with_no_company = [d.name for d in warehouse_list if not d.company]
|
||||
if warehouse_with_no_company:
|
||||
webnotes.throw(_("Company is missing in following warehouses") + ": \n" +
|
||||
"\n".join(warehouse_with_no_company))
|
||||
for wh in warehouse_list:
|
||||
wh_bean = webnotes.bean("Warehouse", wh.name)
|
||||
wh_bean.save()
|
||||
@@ -1,83 +0,0 @@
|
||||
[
|
||||
{
|
||||
"creation": "2013-06-24 15:49:57",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-09-24 11:52:58",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
{
|
||||
"description": "Settings for Accounts",
|
||||
"doctype": "DocType",
|
||||
"icon": "icon-cog",
|
||||
"issingle": 1,
|
||||
"module": "Accounts",
|
||||
"name": "__common__"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"name": "__common__",
|
||||
"parent": "Accounts Settings",
|
||||
"parentfield": "fields",
|
||||
"parenttype": "DocType",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"name": "__common__",
|
||||
"parent": "Accounts Settings",
|
||||
"parentfield": "permissions",
|
||||
"parenttype": "DocType",
|
||||
"permlevel": 0,
|
||||
"read": 1,
|
||||
"role": "Accounts Manager",
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocType",
|
||||
"name": "Accounts Settings"
|
||||
},
|
||||
{
|
||||
"default": "1",
|
||||
"description": "If enabled, the system will post accounting entries for inventory automatically.",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "auto_accounting_for_stock",
|
||||
"fieldtype": "Check",
|
||||
"label": "Make Accounting Entry For Every Stock Movement"
|
||||
},
|
||||
{
|
||||
"description": "Accounting entry frozen up to this date, nobody can do / modify entry except role specified below.",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "acc_frozen_upto",
|
||||
"fieldtype": "Date",
|
||||
"label": "Accounts Frozen Upto"
|
||||
},
|
||||
{
|
||||
"description": "Users with this role are allowed to create / modify accounting entry before frozen date",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "bde_auth_role",
|
||||
"fieldtype": "Link",
|
||||
"label": "Allowed Role to Edit Entries Before Frozen Date",
|
||||
"options": "Role"
|
||||
},
|
||||
{
|
||||
"description": "Users with this role are allowed to set frozen accounts and create / modify accounting entries against frozen accounts",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "frozen_accounts_modifier",
|
||||
"fieldtype": "Link",
|
||||
"label": "Frozen Accounts Modifier",
|
||||
"options": "Role"
|
||||
},
|
||||
{
|
||||
"description": "Role that is allowed to submit transactions that exceed credit limits set.",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "credit_controller",
|
||||
"fieldtype": "Link",
|
||||
"label": "Credit Controller",
|
||||
"options": "Role"
|
||||
},
|
||||
{
|
||||
"doctype": "DocPerm"
|
||||
}
|
||||
]
|
||||
@@ -1,9 +0,0 @@
|
||||
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
// License: GNU General Public License v3. See license.txt
|
||||
|
||||
|
||||
cur_frm.add_fetch("bank_account", "company", "company");
|
||||
cur_frm.cscript.onload = function(doc, cdt, cdn){
|
||||
cur_frm.set_intro('<i class="icon-question" /> ' +
|
||||
wn._("Update clearance date of Journal Entries marked as 'Bank Vouchers'"))
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
from webnotes.utils import cstr, flt, getdate, now, nowdate
|
||||
from webnotes.model import db_exists
|
||||
from webnotes.model.doc import addchild
|
||||
from webnotes.model.bean import getlist, copy_doclist
|
||||
from webnotes import msgprint
|
||||
|
||||
|
||||
|
||||
|
||||
class DocType:
|
||||
def __init__(self, d, dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
|
||||
def get_details(self):
|
||||
if not (self.doc.bank_account and self.doc.from_date and self.doc.to_date):
|
||||
msgprint("Bank Account, From Date and To Date are Mandatory")
|
||||
return
|
||||
|
||||
dl = webnotes.conn.sql("select t1.name, t1.cheque_no, t1.cheque_date, t2.debit, t2.credit, t1.posting_date, t2.against_account from `tabJournal Voucher` t1, `tabJournal Voucher Detail` t2 where t2.parent = t1.name and t2.account = %s and (clearance_date is null or clearance_date = '0000-00-00' or clearance_date = '') and t1.posting_date >= %s and t1.posting_date <= %s and t1.docstatus=1", (self.doc.bank_account, self.doc.from_date, self.doc.to_date))
|
||||
|
||||
self.doclist = self.doc.clear_table(self.doclist, 'entries')
|
||||
self.doc.total_amount = 0.0
|
||||
|
||||
for d in dl:
|
||||
nl = addchild(self.doc, 'entries', 'Bank Reconciliation Detail', self.doclist)
|
||||
nl.posting_date = cstr(d[5])
|
||||
nl.voucher_id = cstr(d[0])
|
||||
nl.cheque_number = cstr(d[1])
|
||||
nl.cheque_date = cstr(d[2])
|
||||
nl.debit = flt(d[3])
|
||||
nl.credit = flt(d[4])
|
||||
nl.against_account = cstr(d[6])
|
||||
self.doc.total_amount += flt(flt(d[4]) - flt(d[3]))
|
||||
|
||||
def update_details(self):
|
||||
vouchers = []
|
||||
for d in getlist(self.doclist, 'entries'):
|
||||
if d.clearance_date:
|
||||
if d.cheque_date and getdate(d.clearance_date) < getdate(d.cheque_date):
|
||||
msgprint("Clearance Date can not be before Cheque Date (Row #%s)" %
|
||||
d.idx, raise_exception=1)
|
||||
|
||||
webnotes.conn.sql("""update `tabJournal Voucher`
|
||||
set clearance_date = %s, modified = %s where name=%s""",
|
||||
(d.clearance_date, nowdate(), d.voucher_id))
|
||||
vouchers.append(d.voucher_id)
|
||||
|
||||
if vouchers:
|
||||
msgprint("Clearance Date updated in %s" % ", ".join(vouchers))
|
||||
else:
|
||||
msgprint("Clearance Date not mentioned")
|
||||
@@ -1,115 +0,0 @@
|
||||
[
|
||||
{
|
||||
"creation": "2013-01-10 16:34:05",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-07-05 14:26:22",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
{
|
||||
"allow_copy": 1,
|
||||
"allow_email": 1,
|
||||
"allow_print": 1,
|
||||
"doctype": "DocType",
|
||||
"hide_heading": 1,
|
||||
"hide_toolbar": 1,
|
||||
"icon": "icon-check",
|
||||
"issingle": 1,
|
||||
"module": "Accounts",
|
||||
"name": "__common__",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"name": "__common__",
|
||||
"parent": "Bank Reconciliation",
|
||||
"parentfield": "fields",
|
||||
"parenttype": "DocType",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"name": "__common__",
|
||||
"parent": "Bank Reconciliation",
|
||||
"parentfield": "permissions",
|
||||
"parenttype": "DocType",
|
||||
"permlevel": 0,
|
||||
"read": 1,
|
||||
"report": 0,
|
||||
"role": "Accounts User",
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocType",
|
||||
"name": "Bank Reconciliation"
|
||||
},
|
||||
{
|
||||
"description": "Select account head of the bank where cheque was deposited.",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "bank_account",
|
||||
"fieldtype": "Link",
|
||||
"label": "Bank Account",
|
||||
"options": "Account",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "company",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 1,
|
||||
"label": "Company",
|
||||
"options": "Company",
|
||||
"print_hide": 1,
|
||||
"reqd": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "from_date",
|
||||
"fieldtype": "Date",
|
||||
"label": "From Date",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "to_date",
|
||||
"fieldtype": "Date",
|
||||
"label": "To Date",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "get_non_reconciled_entries",
|
||||
"fieldtype": "Button",
|
||||
"label": "Get Non Reconciled Entries",
|
||||
"options": "get_details"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "entries",
|
||||
"fieldtype": "Table",
|
||||
"label": "Entries",
|
||||
"options": "Bank Reconciliation Detail"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "update_clearance_date",
|
||||
"fieldtype": "Button",
|
||||
"label": "Update Clearance Date",
|
||||
"options": "update_details"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "total_amount",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Total Amount",
|
||||
"options": "Company:company:default_currency",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocPerm"
|
||||
}
|
||||
]
|
||||
@@ -1,9 +0,0 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
class DocType:
|
||||
def __init__(self, d, dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
@@ -1,108 +0,0 @@
|
||||
[
|
||||
{
|
||||
"creation": "2013-02-22 01:27:37",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-11-03 14:11:31",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
{
|
||||
"doctype": "DocType",
|
||||
"istable": 1,
|
||||
"module": "Accounts",
|
||||
"name": "__common__"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"name": "__common__",
|
||||
"no_copy": 0,
|
||||
"parent": "Bank Reconciliation Detail",
|
||||
"parentfield": "fields",
|
||||
"parenttype": "DocType",
|
||||
"permlevel": 0,
|
||||
"search_index": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocType",
|
||||
"name": "Bank Reconciliation Detail"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "voucher_id",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 1,
|
||||
"label": "Voucher ID",
|
||||
"oldfieldname": "voucher_id",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Journal Voucher"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "against_account",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
"label": "Against Account",
|
||||
"oldfieldname": "against_account",
|
||||
"oldfieldtype": "Data",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "posting_date",
|
||||
"fieldtype": "Date",
|
||||
"in_list_view": 1,
|
||||
"label": "Posting Date",
|
||||
"oldfieldname": "posting_date",
|
||||
"oldfieldtype": "Date",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "clearance_date",
|
||||
"fieldtype": "Date",
|
||||
"in_list_view": 1,
|
||||
"label": "Clearance Date",
|
||||
"oldfieldname": "clearance_date",
|
||||
"oldfieldtype": "Date"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "cheque_number",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
"label": "Cheque Number",
|
||||
"oldfieldname": "cheque_number",
|
||||
"oldfieldtype": "Data",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "cheque_date",
|
||||
"fieldtype": "Date",
|
||||
"in_list_view": 1,
|
||||
"label": "Cheque Date",
|
||||
"oldfieldname": "cheque_date",
|
||||
"oldfieldtype": "Date",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "debit",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Debit",
|
||||
"oldfieldname": "debit",
|
||||
"oldfieldtype": "Currency",
|
||||
"options": "Company:company:default_currency",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "credit",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Credit",
|
||||
"oldfieldname": "credit",
|
||||
"oldfieldtype": "Currency",
|
||||
"options": "Company:company:default_currency",
|
||||
"read_only": 1
|
||||
}
|
||||
]
|
||||
@@ -1,9 +0,0 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
class DocType:
|
||||
def __init__(self, d, dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
@@ -1,61 +0,0 @@
|
||||
[
|
||||
{
|
||||
"creation": "2013-03-07 11:55:04",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-08-22 17:27:59",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
{
|
||||
"autoname": "CBD/.######",
|
||||
"doctype": "DocType",
|
||||
"istable": 1,
|
||||
"module": "Accounts",
|
||||
"name": "__common__"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"in_list_view": 1,
|
||||
"name": "__common__",
|
||||
"parent": "Budget Detail",
|
||||
"parentfield": "fields",
|
||||
"parenttype": "DocType",
|
||||
"permlevel": 0,
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocType",
|
||||
"name": "Budget Detail"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "account",
|
||||
"fieldtype": "Link",
|
||||
"in_filter": 1,
|
||||
"label": "Account",
|
||||
"oldfieldname": "account",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Account",
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "budget_allocated",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Budget Allocated",
|
||||
"oldfieldname": "budget_allocated",
|
||||
"oldfieldtype": "Currency",
|
||||
"options": "Company:company:default_currency"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "fiscal_year",
|
||||
"fieldtype": "Select",
|
||||
"in_filter": 1,
|
||||
"label": "Fiscal Year",
|
||||
"oldfieldname": "fiscal_year",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "link:Fiscal Year",
|
||||
"search_index": 1
|
||||
}
|
||||
]
|
||||
@@ -1,17 +0,0 @@
|
||||
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
// License: GNU General Public License v3. See license.txt
|
||||
|
||||
cur_frm.cscript.onload = function(doc,cdt,cdn){
|
||||
if(doc.__islocal){
|
||||
var callback1 = function(r,rt){
|
||||
refresh_field('budget_distribution_details');
|
||||
}
|
||||
|
||||
return $c('runserverobj',args={'method' : 'get_months', 'docs' :
|
||||
wn.model.compress(make_doclist(doc.doctype, doc.name))},callback1);
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.cscript.refresh = function(doc,cdt,cdn){
|
||||
cur_frm.toggle_display('distribution_id', doc.__islocal);
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
from webnotes.utils import flt
|
||||
from webnotes.model.doc import addchild
|
||||
from webnotes.model.bean import getlist
|
||||
from webnotes import msgprint, _
|
||||
|
||||
class DocType:
|
||||
def __init__(self,doc,doclist=[]):
|
||||
self.doc,self.doclist = doc,doclist
|
||||
|
||||
def get_months(self):
|
||||
month_list = ['January','February','March','April','May','June','July','August','September',
|
||||
'October','November','December']
|
||||
idx =1
|
||||
for m in month_list:
|
||||
mnth = addchild(self.doc, 'budget_distribution_details',
|
||||
'Budget Distribution Detail', self.doclist)
|
||||
mnth.month = m or ''
|
||||
mnth.idx = idx
|
||||
idx += 1
|
||||
|
||||
def validate(self):
|
||||
total = sum([flt(d.percentage_allocation, 2) for d in self.doclist.get(
|
||||
{"parentfield": "budget_distribution_details"})])
|
||||
|
||||
if total != 100.0:
|
||||
msgprint(_("Percentage Allocation should be equal to ") + "100%", raise_exception=1)
|
||||
@@ -1,92 +0,0 @@
|
||||
[
|
||||
{
|
||||
"creation": "2013-01-10 16:34:05",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-07-22 15:30:37",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
{
|
||||
"autoname": "field:distribution_id",
|
||||
"description": "**Budget Distribution** helps you distribute your budget across months if you have seasonality in your business.\n\nTo distribute a budget using this distribution, set this **Budget Distribution** in the **Cost Center**",
|
||||
"doctype": "DocType",
|
||||
"icon": "icon-bar-chart",
|
||||
"module": "Accounts",
|
||||
"name": "__common__",
|
||||
"name_case": "Title Case"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"name": "__common__",
|
||||
"parent": "Budget Distribution",
|
||||
"parentfield": "fields",
|
||||
"parenttype": "DocType",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocPerm",
|
||||
"name": "__common__",
|
||||
"parent": "Budget Distribution",
|
||||
"parentfield": "permissions",
|
||||
"parenttype": "DocType",
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Accounts Manager",
|
||||
"submit": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocType",
|
||||
"name": "Budget Distribution"
|
||||
},
|
||||
{
|
||||
"description": "Name of the Budget Distribution",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "distribution_id",
|
||||
"fieldtype": "Data",
|
||||
"label": "Distribution Name",
|
||||
"oldfieldname": "distribution_id",
|
||||
"oldfieldtype": "Data",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "fiscal_year",
|
||||
"fieldtype": "Select",
|
||||
"in_filter": 1,
|
||||
"label": "Fiscal Year",
|
||||
"oldfieldname": "fiscal_year",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "link:Fiscal Year",
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "budget_distribution_details",
|
||||
"fieldtype": "Table",
|
||||
"label": "Budget Distribution Details",
|
||||
"oldfieldname": "budget_distribution_details",
|
||||
"oldfieldtype": "Table",
|
||||
"options": "Budget Distribution Detail"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "trash_reason",
|
||||
"fieldtype": "Small Text",
|
||||
"label": "Trash Reason",
|
||||
"oldfieldname": "trash_reason",
|
||||
"oldfieldtype": "Small Text",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"permlevel": 0,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocPerm",
|
||||
"permlevel": 2
|
||||
}
|
||||
]
|
||||
@@ -1,70 +0,0 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
test_records = [
|
||||
[{
|
||||
"doctype": "Budget Distribution",
|
||||
"distribution_id": "_Test Distribution",
|
||||
"fiscal_year": "_Test Fiscal Year 2013",
|
||||
}, {
|
||||
"doctype": "Budget Distribution Detail",
|
||||
"parentfield": "budget_distribution_details",
|
||||
"month": "January",
|
||||
"percentage_allocation": "8"
|
||||
}, {
|
||||
"doctype": "Budget Distribution Detail",
|
||||
"parentfield": "budget_distribution_details",
|
||||
"month": "February",
|
||||
"percentage_allocation": "8"
|
||||
}, {
|
||||
"doctype": "Budget Distribution Detail",
|
||||
"parentfield": "budget_distribution_details",
|
||||
"month": "March",
|
||||
"percentage_allocation": "8"
|
||||
}, {
|
||||
"doctype": "Budget Distribution Detail",
|
||||
"parentfield": "budget_distribution_details",
|
||||
"month": "April",
|
||||
"percentage_allocation": "8"
|
||||
}, {
|
||||
"doctype": "Budget Distribution Detail",
|
||||
"parentfield": "budget_distribution_details",
|
||||
"month": "May",
|
||||
"percentage_allocation": "8"
|
||||
}, {
|
||||
"doctype": "Budget Distribution Detail",
|
||||
"parentfield": "budget_distribution_details",
|
||||
"month": "June",
|
||||
"percentage_allocation": "8"
|
||||
}, {
|
||||
"doctype": "Budget Distribution Detail",
|
||||
"parentfield": "budget_distribution_details",
|
||||
"month": "July",
|
||||
"percentage_allocation": "8"
|
||||
}, {
|
||||
"doctype": "Budget Distribution Detail",
|
||||
"parentfield": "budget_distribution_details",
|
||||
"month": "August",
|
||||
"percentage_allocation": "8"
|
||||
}, {
|
||||
"doctype": "Budget Distribution Detail",
|
||||
"parentfield": "budget_distribution_details",
|
||||
"month": "September",
|
||||
"percentage_allocation": "8"
|
||||
}, {
|
||||
"doctype": "Budget Distribution Detail",
|
||||
"parentfield": "budget_distribution_details",
|
||||
"month": "October",
|
||||
"percentage_allocation": "8"
|
||||
}, {
|
||||
"doctype": "Budget Distribution Detail",
|
||||
"parentfield": "budget_distribution_details",
|
||||
"month": "November",
|
||||
"percentage_allocation": "10"
|
||||
}, {
|
||||
"doctype": "Budget Distribution Detail",
|
||||
"parentfield": "budget_distribution_details",
|
||||
"month": "December",
|
||||
"percentage_allocation": "10"
|
||||
}]
|
||||
]
|
||||
@@ -1,9 +0,0 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
class DocType:
|
||||
def __init__(self, d, dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
@@ -1,47 +0,0 @@
|
||||
[
|
||||
{
|
||||
"creation": "2013-02-22 01:27:38",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-07-10 14:54:06",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
{
|
||||
"autoname": "BDD/.#####",
|
||||
"doctype": "DocType",
|
||||
"istable": 1,
|
||||
"module": "Accounts",
|
||||
"name": "__common__"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"in_list_view": 1,
|
||||
"name": "__common__",
|
||||
"parent": "Budget Distribution Detail",
|
||||
"parentfield": "fields",
|
||||
"parenttype": "DocType",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocType",
|
||||
"name": "Budget Distribution Detail"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "month",
|
||||
"fieldtype": "Data",
|
||||
"label": "Month",
|
||||
"oldfieldname": "month",
|
||||
"oldfieldtype": "Data",
|
||||
"read_only": 1,
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "percentage_allocation",
|
||||
"fieldtype": "Float",
|
||||
"label": "Percentage Allocation",
|
||||
"oldfieldname": "percentage_allocation",
|
||||
"oldfieldtype": "Currency"
|
||||
}
|
||||
]
|
||||
@@ -1,86 +0,0 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
from webnotes.utils import flt, getdate
|
||||
from webnotes.model.bean import getlist
|
||||
|
||||
class DocType:
|
||||
def __init__(self,d,dl):
|
||||
self.doc, self.doclist = d,dl
|
||||
|
||||
def validate(self):
|
||||
"""Validate invoice that c-form is applicable
|
||||
and no other c-form is received for that"""
|
||||
|
||||
for d in getlist(self.doclist, 'invoice_details'):
|
||||
if d.invoice_no:
|
||||
inv = webnotes.conn.sql("""select c_form_applicable, c_form_no from
|
||||
`tabSales Invoice` where name = %s and docstatus = 1""", d.invoice_no)
|
||||
|
||||
if not inv:
|
||||
webnotes.msgprint("""Invoice: %s is not exists in the system or
|
||||
is not submitted, please check.""" % d.invoice_no, raise_exception=1)
|
||||
|
||||
elif inv[0][0] != 'Yes':
|
||||
webnotes.msgprint("C-form is not applicable for Invoice: %s" %
|
||||
d.invoice_no, raise_exception=1)
|
||||
|
||||
elif inv[0][1] and inv[0][1] != self.doc.name:
|
||||
webnotes.msgprint("""Invoice %s is tagged in another C-form: %s.
|
||||
If you want to change C-form no for this invoice,
|
||||
please remove invoice no from the previous c-form and then try again""" %
|
||||
(d.invoice_no, inv[0][1]), raise_exception=1)
|
||||
|
||||
def on_update(self):
|
||||
""" Update C-Form No on invoices"""
|
||||
self.set_total_invoiced_amount()
|
||||
|
||||
def on_submit(self):
|
||||
self.set_cform_in_sales_invoices()
|
||||
|
||||
def before_cancel(self):
|
||||
# remove cform reference
|
||||
webnotes.conn.sql("""update `tabSales Invoice` set c_form_no=null
|
||||
where c_form_no=%s""", self.doc.name)
|
||||
|
||||
def set_cform_in_sales_invoices(self):
|
||||
inv = [d.invoice_no for d in getlist(self.doclist, 'invoice_details')]
|
||||
if inv:
|
||||
webnotes.conn.sql("""update `tabSales Invoice` set c_form_no=%s, modified=%s
|
||||
where name in (%s)""" % ('%s', '%s', ', '.join(['%s'] * len(inv))),
|
||||
tuple([self.doc.name, self.doc.modified] + inv))
|
||||
|
||||
webnotes.conn.sql("""update `tabSales Invoice` set c_form_no = null, modified = %s
|
||||
where name not in (%s) and ifnull(c_form_no, '') = %s""" %
|
||||
('%s', ', '.join(['%s']*len(inv)), '%s'),
|
||||
tuple([self.doc.modified] + inv + [self.doc.name]))
|
||||
else:
|
||||
webnotes.msgprint("Please enter atleast 1 invoice in the table", raise_exception=1)
|
||||
|
||||
def set_total_invoiced_amount(self):
|
||||
total = sum([flt(d.grand_total) for d in getlist(self.doclist, 'invoice_details')])
|
||||
webnotes.conn.set(self.doc, 'total_invoiced_amount', total)
|
||||
|
||||
def get_invoice_details(self, invoice_no):
|
||||
""" Pull details from invoices for referrence """
|
||||
|
||||
inv = webnotes.conn.sql("""select posting_date, territory, net_total, grand_total
|
||||
from `tabSales Invoice` where name = %s""", invoice_no)
|
||||
return {
|
||||
'invoice_date' : inv and getdate(inv[0][0]).strftime('%Y-%m-%d') or '',
|
||||
'territory' : inv and inv[0][1] or '',
|
||||
'net_total' : inv and flt(inv[0][2]) or '',
|
||||
'grand_total' : inv and flt(inv[0][3]) or ''
|
||||
}
|
||||
|
||||
def get_invoice_nos(doctype, txt, searchfield, start, page_len, filters):
|
||||
from utilities import build_filter_conditions
|
||||
conditions, filter_values = build_filter_conditions(filters)
|
||||
|
||||
return webnotes.conn.sql("""select name from `tabSales Invoice` where docstatus = 1
|
||||
and c_form_applicable = 'Yes' and ifnull(c_form_no, '') = '' %s
|
||||
and %s like %s order by name limit %s, %s""" %
|
||||
(conditions, searchfield, "%s", "%s", "%s"),
|
||||
tuple(filter_values + ["%%%s%%" % txt, start, page_len]))
|
||||
@@ -1,188 +0,0 @@
|
||||
[
|
||||
{
|
||||
"creation": "2013-03-07 11:55:06",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-11-02 14:05:25",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
{
|
||||
"allow_attach": 1,
|
||||
"autoname": "naming_series:",
|
||||
"doctype": "DocType",
|
||||
"icon": "icon-file-text",
|
||||
"is_submittable": 1,
|
||||
"max_attachments": 3,
|
||||
"module": "Accounts",
|
||||
"name": "__common__"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"name": "__common__",
|
||||
"parent": "C-Form",
|
||||
"parentfield": "fields",
|
||||
"parenttype": "DocType",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocPerm",
|
||||
"name": "__common__",
|
||||
"parent": "C-Form",
|
||||
"parentfield": "permissions",
|
||||
"parenttype": "DocType",
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"submit": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocType",
|
||||
"name": "C-Form"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "column_break0",
|
||||
"fieldtype": "Column Break",
|
||||
"print_width": "50%",
|
||||
"read_only": 0,
|
||||
"width": "50%"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "naming_series",
|
||||
"fieldtype": "Select",
|
||||
"label": "Series",
|
||||
"options": "\nC-FORM/",
|
||||
"read_only": 0,
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "c_form_no",
|
||||
"fieldtype": "Data",
|
||||
"label": "C-Form No",
|
||||
"read_only": 0,
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "received_date",
|
||||
"fieldtype": "Date",
|
||||
"label": "Received Date",
|
||||
"read_only": 0,
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "customer",
|
||||
"fieldtype": "Link",
|
||||
"label": "Customer",
|
||||
"options": "Customer",
|
||||
"read_only": 0,
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "column_break1",
|
||||
"fieldtype": "Column Break",
|
||||
"print_width": "50%",
|
||||
"read_only": 0,
|
||||
"width": "50%"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "company",
|
||||
"fieldtype": "Select",
|
||||
"label": "Company",
|
||||
"options": "link:Company",
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "fiscal_year",
|
||||
"fieldtype": "Select",
|
||||
"label": "Fiscal Year",
|
||||
"options": "link:Fiscal Year",
|
||||
"read_only": 0,
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "quarter",
|
||||
"fieldtype": "Select",
|
||||
"label": "Quarter",
|
||||
"options": "\nI\nII\nIII\nIV",
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "total_amount",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Total Amount",
|
||||
"options": "Company:company:default_currency",
|
||||
"read_only": 0,
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "state",
|
||||
"fieldtype": "Data",
|
||||
"label": "State",
|
||||
"read_only": 0,
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "section_break0",
|
||||
"fieldtype": "Section Break",
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "invoice_details",
|
||||
"fieldtype": "Table",
|
||||
"label": "Invoice Details",
|
||||
"options": "C-Form Invoice Detail",
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "total_invoiced_amount",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Total Invoiced Amount",
|
||||
"options": "Company:company:default_currency",
|
||||
"print_hide": 0,
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "amended_from",
|
||||
"fieldtype": "Link",
|
||||
"label": "Amended From",
|
||||
"no_copy": 1,
|
||||
"options": "C-Form",
|
||||
"print_hide": 1,
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"permlevel": 0,
|
||||
"role": "Accounts User",
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"permlevel": 0,
|
||||
"role": "Accounts Manager",
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"doctype": "DocPerm",
|
||||
"permlevel": 1,
|
||||
"role": "All"
|
||||
}
|
||||
]
|
||||
@@ -1,9 +0,0 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
class DocType:
|
||||
def __init__(self, d, dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
@@ -1,77 +0,0 @@
|
||||
[
|
||||
{
|
||||
"creation": "2013-02-22 01:27:38",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-11-02 16:58:31",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
{
|
||||
"doctype": "DocType",
|
||||
"istable": 1,
|
||||
"module": "Accounts",
|
||||
"name": "__common__"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"in_list_view": 1,
|
||||
"name": "__common__",
|
||||
"parent": "C-Form Invoice Detail",
|
||||
"parentfield": "fields",
|
||||
"parenttype": "DocType",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocType",
|
||||
"name": "C-Form Invoice Detail"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "invoice_no",
|
||||
"fieldtype": "Link",
|
||||
"label": "Invoice No",
|
||||
"options": "Sales Invoice",
|
||||
"print_width": "160px",
|
||||
"width": "160px"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "invoice_date",
|
||||
"fieldtype": "Date",
|
||||
"label": "Invoice Date",
|
||||
"print_width": "120px",
|
||||
"read_only": 1,
|
||||
"width": "120px"
|
||||
},
|
||||
{
|
||||
"description": "<a href=\"#Sales Browser/Territory\">Add / Edit</a>",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "territory",
|
||||
"fieldtype": "Link",
|
||||
"label": "Territory",
|
||||
"options": "Territory",
|
||||
"print_width": "120px",
|
||||
"read_only": 1,
|
||||
"width": "120px"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "net_total",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Net Total",
|
||||
"options": "Company:company:default_currency",
|
||||
"print_width": "120px",
|
||||
"read_only": 1,
|
||||
"width": "120px"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "grand_total",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Grand Total",
|
||||
"options": "Company:company:default_currency",
|
||||
"print_width": "120px",
|
||||
"read_only": 1,
|
||||
"width": "120px"
|
||||
}
|
||||
]
|
||||
@@ -1,87 +0,0 @@
|
||||
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
// License: GNU General Public License v3. See license.txt
|
||||
|
||||
wn.provide("erpnext.accounts");
|
||||
erpnext.accounts.CostCenterController = wn.ui.form.Controller.extend({
|
||||
onload: function() {
|
||||
this.setup_queries();
|
||||
},
|
||||
|
||||
setup_queries: function() {
|
||||
var me = this;
|
||||
if(this.frm.fields_dict["budget_details"].grid.get_field("account")) {
|
||||
this.frm.set_query("account", "budget_details", function() {
|
||||
return {
|
||||
filters:[
|
||||
['Account', 'company', '=', me.frm.doc.company],
|
||||
['Account', 'is_pl_account', '=', 'Yes'],
|
||||
['Account', 'debit_or_credit', '=', 'Debit'],
|
||||
['Account', 'group_or_ledger', '!=', 'Group'],
|
||||
]
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
this.frm.set_query("parent_cost_center", function() {
|
||||
return {
|
||||
filters:[
|
||||
['Cost Center', 'group_or_ledger', '=', 'Group'],
|
||||
['Cost Center', 'company', '=', me.frm.doc.company],
|
||||
]
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$.extend(cur_frm.cscript, new erpnext.accounts.CostCenterController({frm: cur_frm}));
|
||||
|
||||
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
||||
var intro_txt = '';
|
||||
cur_frm.toggle_display('cost_center_name', doc.__islocal);
|
||||
cur_frm.toggle_enable(['group_or_ledger', 'company'], doc.__islocal);
|
||||
|
||||
if(!doc.__islocal && doc.group_or_ledger=='Group') {
|
||||
intro_txt += '<p><b>'+wn._('Note:')+'</b>'+ wn._('This Cost Center is a')+ '<i>'+wn._('Group')+'</i>, '+
|
||||
wn._('Accounting Entries are not allowed against groups.')+'</p>';
|
||||
}
|
||||
|
||||
cur_frm.cscript.hide_unhide_group_ledger(doc);
|
||||
|
||||
cur_frm.toggle_display('sb1', doc.group_or_ledger=='Ledger')
|
||||
cur_frm.set_intro(intro_txt);
|
||||
|
||||
cur_frm.appframe.add_button(wn._('Chart of Cost Centers'),
|
||||
function() { wn.set_route("Accounts Browser", "Cost Center"); }, 'icon-sitemap')
|
||||
}
|
||||
|
||||
cur_frm.cscript.parent_cost_center = function(doc,cdt,cdn){
|
||||
if(!doc.company){
|
||||
alert(wn._('Please enter company name first'));
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.cscript.hide_unhide_group_ledger = function(doc) {
|
||||
if (cstr(doc.group_or_ledger) == 'Group') {
|
||||
cur_frm.add_custom_button(wn._('Convert to Ledger'),
|
||||
function() { cur_frm.cscript.convert_to_ledger(); }, 'icon-retweet')
|
||||
} else if (cstr(doc.group_or_ledger) == 'Ledger') {
|
||||
cur_frm.add_custom_button(wn._('Convert to Group'),
|
||||
function() { cur_frm.cscript.convert_to_group(); }, 'icon-retweet')
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.cscript.convert_to_ledger = function(doc, cdt, cdn) {
|
||||
return $c_obj(cur_frm.get_doclist(),'convert_group_to_ledger','',function(r,rt) {
|
||||
if(r.message == 1) {
|
||||
cur_frm.refresh();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
cur_frm.cscript.convert_to_group = function(doc, cdt, cdn) {
|
||||
return $c_obj(cur_frm.get_doclist(),'convert_ledger_to_group','',function(r,rt) {
|
||||
if(r.message == 1) {
|
||||
cur_frm.refresh();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -1,92 +0,0 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
from webnotes.model.bean import getlist
|
||||
from webnotes import msgprint, _
|
||||
|
||||
from webnotes.utils.nestedset import DocTypeNestedSet
|
||||
|
||||
class DocType(DocTypeNestedSet):
|
||||
def __init__(self,d,dl):
|
||||
self.doc, self.doclist = d,dl
|
||||
self.nsm_parent_field = 'parent_cost_center'
|
||||
|
||||
def autoname(self):
|
||||
company_abbr = webnotes.conn.sql("select abbr from tabCompany where name=%s",
|
||||
self.doc.company)[0][0]
|
||||
self.doc.name = self.doc.cost_center_name.strip() + ' - ' + company_abbr
|
||||
|
||||
def validate_mandatory(self):
|
||||
if not self.doc.group_or_ledger:
|
||||
msgprint("Please select Group or Ledger value", raise_exception=1)
|
||||
|
||||
if self.doc.cost_center_name != self.doc.company and not self.doc.parent_cost_center:
|
||||
msgprint("Please enter parent cost center", raise_exception=1)
|
||||
elif self.doc.cost_center_name == self.doc.company and self.doc.parent_cost_center:
|
||||
msgprint(_("Root cannot have a parent cost center"), raise_exception=1)
|
||||
|
||||
def convert_group_to_ledger(self):
|
||||
if self.check_if_child_exists():
|
||||
msgprint("Cost Center: %s has existing child. You can not convert this cost center to ledger" % (self.doc.name), raise_exception=1)
|
||||
elif self.check_gle_exists():
|
||||
msgprint("Cost Center with existing transaction can not be converted to ledger.", raise_exception=1)
|
||||
else:
|
||||
self.doc.group_or_ledger = 'Ledger'
|
||||
self.doc.save()
|
||||
return 1
|
||||
|
||||
def convert_ledger_to_group(self):
|
||||
if self.check_gle_exists():
|
||||
msgprint("Cost Center with existing transaction can not be converted to group.", raise_exception=1)
|
||||
else:
|
||||
self.doc.group_or_ledger = 'Group'
|
||||
self.doc.save()
|
||||
return 1
|
||||
|
||||
def check_gle_exists(self):
|
||||
return webnotes.conn.get_value("GL Entry", {"cost_center": self.doc.name})
|
||||
|
||||
def check_if_child_exists(self):
|
||||
return webnotes.conn.sql("select name from `tabCost Center` where \
|
||||
parent_cost_center = %s and docstatus != 2", self.doc.name)
|
||||
|
||||
def validate_budget_details(self):
|
||||
check_acc_list = []
|
||||
for d in getlist(self.doclist, 'budget_details'):
|
||||
if self.doc.group_or_ledger=="Group":
|
||||
msgprint("Budget cannot be set for Group Cost Centers", raise_exception=1)
|
||||
|
||||
if [d.account, d.fiscal_year] in check_acc_list:
|
||||
msgprint("Account " + d.account + "has been entered more than once for fiscal year " + d.fiscal_year, raise_exception=1)
|
||||
else:
|
||||
check_acc_list.append([d.account, d.fiscal_year])
|
||||
|
||||
def validate(self):
|
||||
"""
|
||||
Cost Center name must be unique
|
||||
"""
|
||||
if (self.doc.fields.get("__islocal") or not self.doc.name) and webnotes.conn.sql("select name from `tabCost Center` where cost_center_name = %s and company=%s", (self.doc.cost_center_name, self.doc.company)):
|
||||
msgprint("Cost Center Name already exists, please rename", raise_exception=1)
|
||||
|
||||
self.validate_mandatory()
|
||||
self.validate_budget_details()
|
||||
|
||||
def before_rename(self, olddn, newdn, merge=False):
|
||||
# Add company abbr if not provided
|
||||
from setup.doctype.company.company import get_name_with_abbr
|
||||
new_cost_center = get_name_with_abbr(newdn, self.doc.company)
|
||||
|
||||
# Validate properties before merging
|
||||
super(DocType, self).before_rename(olddn, new_cost_center, merge, "group_or_ledger")
|
||||
|
||||
return new_cost_center
|
||||
|
||||
def after_rename(self, olddn, newdn, merge=False):
|
||||
if not merge:
|
||||
webnotes.conn.set_value("Cost Center", newdn, "cost_center_name",
|
||||
" - ".join(newdn.split(" - ")[:-1]))
|
||||
else:
|
||||
super(DocType, self).after_rename(olddn, newdn, merge)
|
||||
|
||||
@@ -1,196 +0,0 @@
|
||||
[
|
||||
{
|
||||
"creation": "2013-01-23 19:57:17",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-07-22 15:23:10",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
{
|
||||
"allow_copy": 1,
|
||||
"allow_rename": 1,
|
||||
"autoname": "field:cost_center_name",
|
||||
"description": "Track separate Income and Expense for product verticals or divisions.",
|
||||
"doctype": "DocType",
|
||||
"document_type": "Master",
|
||||
"icon": "icon-money",
|
||||
"in_create": 1,
|
||||
"module": "Accounts",
|
||||
"name": "__common__",
|
||||
"search_fields": "name,parent_cost_center"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"name": "__common__",
|
||||
"parent": "Cost Center",
|
||||
"parentfield": "fields",
|
||||
"parenttype": "DocType",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"doctype": "DocPerm",
|
||||
"name": "__common__",
|
||||
"parent": "Cost Center",
|
||||
"parentfield": "permissions",
|
||||
"parenttype": "DocType",
|
||||
"permlevel": 0,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"submit": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocType",
|
||||
"name": "Cost Center"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "sb0",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Cost Center Details"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "trash_reason",
|
||||
"fieldtype": "Small Text",
|
||||
"label": "Trash Reason",
|
||||
"oldfieldname": "trash_reason",
|
||||
"oldfieldtype": "Small Text",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "cost_center_name",
|
||||
"fieldtype": "Data",
|
||||
"in_filter": 0,
|
||||
"label": "Cost Center Name",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "cost_center_name",
|
||||
"oldfieldtype": "Data",
|
||||
"reqd": 1,
|
||||
"search_index": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "parent_cost_center",
|
||||
"fieldtype": "Link",
|
||||
"label": "Parent Cost Center",
|
||||
"oldfieldname": "parent_cost_center",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Cost Center",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "company",
|
||||
"fieldtype": "Link",
|
||||
"label": "Company",
|
||||
"oldfieldname": "company_name",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Company",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "cb0",
|
||||
"fieldtype": "Column Break",
|
||||
"width": "50%"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "group_or_ledger",
|
||||
"fieldtype": "Select",
|
||||
"hidden": 0,
|
||||
"label": "Group or Ledger",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "group_or_ledger",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "\nGroup\nLedger",
|
||||
"print_hide": 1,
|
||||
"report_hide": 1,
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"description": "Define Budget for this Cost Center. To set budget action, see <a href=\"#!List/Company\">Company Master</a>",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "sb1",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Budget"
|
||||
},
|
||||
{
|
||||
"description": "Select Budget Distribution, if you want to track based on seasonality.",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "distribution_id",
|
||||
"fieldtype": "Link",
|
||||
"label": "Distribution Id",
|
||||
"oldfieldname": "distribution_id",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Budget Distribution"
|
||||
},
|
||||
{
|
||||
"description": "Add rows to set annual budgets on Accounts.",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "budget_details",
|
||||
"fieldtype": "Table",
|
||||
"label": "Budget Details",
|
||||
"oldfieldname": "budget_details",
|
||||
"oldfieldtype": "Table",
|
||||
"options": "Budget Detail"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "lft",
|
||||
"fieldtype": "Int",
|
||||
"hidden": 1,
|
||||
"in_filter": 1,
|
||||
"label": "lft",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "lft",
|
||||
"oldfieldtype": "Int",
|
||||
"print_hide": 1,
|
||||
"report_hide": 1,
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "rgt",
|
||||
"fieldtype": "Int",
|
||||
"hidden": 1,
|
||||
"in_filter": 1,
|
||||
"label": "rgt",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "rgt",
|
||||
"oldfieldtype": "Int",
|
||||
"print_hide": 1,
|
||||
"report_hide": 1,
|
||||
"reqd": 0,
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "old_parent",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 1,
|
||||
"label": "old_parent",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "old_parent",
|
||||
"oldfieldtype": "Data",
|
||||
"options": "Cost Center",
|
||||
"print_hide": 1,
|
||||
"report_hide": 1
|
||||
},
|
||||
{
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"role": "Accounts Manager",
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"doctype": "DocPerm",
|
||||
"role": "Accounts User",
|
||||
"write": 0
|
||||
}
|
||||
]
|
||||
@@ -1,19 +0,0 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
test_records = [
|
||||
[{
|
||||
"doctype": "Cost Center",
|
||||
"cost_center_name": "_Test Cost Center",
|
||||
"parent_cost_center": "_Test Company - _TC",
|
||||
"company": "_Test Company",
|
||||
"group_or_ledger": "Ledger",
|
||||
"distribution_id": "_Test Distribution",
|
||||
}, {
|
||||
"doctype": "Budget Detail",
|
||||
"parentfield": "budget_details",
|
||||
"account": "_Test Account Cost for Goods Sold - _TC",
|
||||
"budget_allocated": 100000,
|
||||
"fiscal_year": "_Test Fiscal Year 2013"
|
||||
}],
|
||||
]
|
||||
@@ -1,28 +0,0 @@
|
||||
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
// License: GNU General Public License v3. See license.txt
|
||||
|
||||
$.extend(cur_frm.cscript, {
|
||||
refresh: function (doc, dt, dn) {
|
||||
var me = this;
|
||||
this.frm.toggle_enable('year_start_date', doc.__islocal)
|
||||
this.frm.toggle_enable('year_end_date', doc.__islocal)
|
||||
|
||||
if (!doc.__islocal && (doc.name != sys_defaults.fiscal_year)) {
|
||||
this.frm.add_custom_button(wn._("Set as Default"), this.frm.cscript.set_as_default);
|
||||
this.frm.set_intro(wn._("To set this Fiscal Year as Default, click on 'Set as Default'"));
|
||||
} else this.frm.set_intro("");
|
||||
},
|
||||
set_as_default: function() {
|
||||
return wn.call({
|
||||
doc: cur_frm.doc,
|
||||
method: "set_as_default"
|
||||
});
|
||||
},
|
||||
year_start_date: function(doc, dt, dn) {
|
||||
var me = this;
|
||||
|
||||
year_end_date =
|
||||
wn.datetime.add_days(wn.datetime.add_months(this.frm.doc.year_start_date, 12), -1);
|
||||
this.frm.set_value("year_end_date", year_end_date);
|
||||
},
|
||||
});
|
||||
@@ -1,47 +0,0 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
from webnotes import msgprint, _
|
||||
from webnotes.utils import getdate
|
||||
|
||||
class DocType:
|
||||
def __init__(self, d, dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
|
||||
def set_as_default(self):
|
||||
webnotes.conn.set_value("Global Defaults", None, "current_fiscal_year", self.doc.name)
|
||||
webnotes.get_obj("Global Defaults").on_update()
|
||||
|
||||
# clear cache
|
||||
webnotes.clear_cache()
|
||||
|
||||
msgprint(self.doc.name + _(""" is now the default Fiscal Year. \
|
||||
Please refresh your browser for the change to take effect."""))
|
||||
|
||||
def validate(self):
|
||||
year_start_end_dates = webnotes.conn.sql("""select year_start_date, year_end_date
|
||||
from `tabFiscal Year` where name=%s""", (self.doc.name))
|
||||
|
||||
if year_start_end_dates:
|
||||
if getdate(self.doc.year_start_date) != year_start_end_dates[0][0] or getdate(self.doc.year_end_date) != year_start_end_dates[0][1]:
|
||||
webnotes.throw(_("Cannot change Year Start Date and Year End Date \
|
||||
once the Fiscal Year is saved."))
|
||||
|
||||
def on_update(self):
|
||||
# validate year start date and year end date
|
||||
if getdate(self.doc.year_start_date) > getdate(self.doc.year_end_date):
|
||||
webnotes.throw(_("Year Start Date should not be greater than Year End Date"))
|
||||
|
||||
if (getdate(self.doc.year_end_date) - getdate(self.doc.year_start_date)).days > 366:
|
||||
webnotes.throw(_("Year Start Date and Year End Date are not within Fiscal Year."))
|
||||
|
||||
year_start_end_dates = webnotes.conn.sql("""select name, year_start_date, year_end_date
|
||||
from `tabFiscal Year` where name!=%s""", (self.doc.name))
|
||||
|
||||
for fiscal_year, ysd, yed in year_start_end_dates:
|
||||
if (getdate(self.doc.year_start_date) == ysd and getdate(self.doc.year_end_date) == yed) \
|
||||
and (not webnotes.flags.in_test):
|
||||
webnotes.throw(_("Year Start Date and Year End Date are already \
|
||||
set in Fiscal Year: ") + fiscal_year)
|
||||
@@ -1,93 +0,0 @@
|
||||
[
|
||||
{
|
||||
"creation": "2013-01-22 16:50:25",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-11-25 11:40:02",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
{
|
||||
"autoname": "field:year",
|
||||
"description": "**Fiscal Year** represents a Financial Year. All accounting entries and other major transactions are tracked against **Fiscal Year**.",
|
||||
"doctype": "DocType",
|
||||
"document_type": "Master",
|
||||
"icon": "icon-calendar",
|
||||
"module": "Accounts",
|
||||
"name": "__common__"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"name": "__common__",
|
||||
"parent": "Fiscal Year",
|
||||
"parentfield": "fields",
|
||||
"parenttype": "DocType",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocPerm",
|
||||
"name": "__common__",
|
||||
"parent": "Fiscal Year",
|
||||
"parentfield": "permissions",
|
||||
"parenttype": "DocType",
|
||||
"permlevel": 0,
|
||||
"read": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocType",
|
||||
"name": "Fiscal Year"
|
||||
},
|
||||
{
|
||||
"description": "For e.g. 2012, 2012-13",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "year",
|
||||
"fieldtype": "Data",
|
||||
"label": "Year Name",
|
||||
"oldfieldname": "year",
|
||||
"oldfieldtype": "Data",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "year_start_date",
|
||||
"fieldtype": "Date",
|
||||
"label": "Year Start Date",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "year_start_date",
|
||||
"oldfieldtype": "Date",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "year_end_date",
|
||||
"fieldtype": "Date",
|
||||
"label": "Year End Date",
|
||||
"no_copy": 1,
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"default": "No",
|
||||
"description": "Entries are not allowed against this Fiscal Year if the year is closed.",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "is_fiscal_year_closed",
|
||||
"fieldtype": "Select",
|
||||
"label": "Year Closed",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "is_fiscal_year_closed",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "\nNo\nYes",
|
||||
"reqd": 0
|
||||
},
|
||||
{
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"report": 1,
|
||||
"role": "System Manager",
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocPerm",
|
||||
"role": "All"
|
||||
}
|
||||
]
|
||||
@@ -1,37 +0,0 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
test_records = [
|
||||
[{
|
||||
"doctype": "Fiscal Year",
|
||||
"year": "_Test Fiscal Year 2012",
|
||||
"year_start_date": "2012-01-01",
|
||||
"year_end_date": "2012-12-31"
|
||||
}],
|
||||
[{
|
||||
"doctype": "Fiscal Year",
|
||||
"year": "_Test Fiscal Year 2013",
|
||||
"year_start_date": "2013-01-01",
|
||||
"year_end_date": "2013-12-31"
|
||||
}],
|
||||
[{
|
||||
"doctype": "Fiscal Year",
|
||||
"year": "_Test Fiscal Year 2014",
|
||||
"year_start_date": "2014-01-01",
|
||||
"year_end_date": "2014-12-31"
|
||||
}],
|
||||
[{
|
||||
"doctype": "Fiscal Year",
|
||||
"year": "_Test Fiscal Year 2015",
|
||||
"year_start_date": "2015-01-01",
|
||||
"year_end_date": "2015-12-31"
|
||||
}],
|
||||
[{
|
||||
"doctype": "Fiscal Year",
|
||||
"year": "_Test Fiscal Year 2016",
|
||||
"year_start_date": "2016-01-01",
|
||||
"year_end_date": "2016-12-31"
|
||||
}],
|
||||
]
|
||||
@@ -1,162 +0,0 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
from webnotes.utils import flt, fmt_money, getdate
|
||||
from webnotes import _
|
||||
|
||||
class DocType:
|
||||
def __init__(self,d,dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
|
||||
def validate(self):
|
||||
self.check_mandatory()
|
||||
self.pl_must_have_cost_center()
|
||||
self.validate_posting_date()
|
||||
self.check_pl_account()
|
||||
self.validate_cost_center()
|
||||
|
||||
def on_update_with_args(self, adv_adj, update_outstanding = 'Yes'):
|
||||
self.validate_account_details(adv_adj)
|
||||
validate_frozen_account(self.doc.account, adv_adj)
|
||||
check_freezing_date(self.doc.posting_date, adv_adj)
|
||||
check_negative_balance(self.doc.account, adv_adj)
|
||||
|
||||
# Update outstanding amt on against voucher
|
||||
if self.doc.against_voucher and self.doc.against_voucher_type != "POS" \
|
||||
and update_outstanding == 'Yes':
|
||||
update_outstanding_amt(self.doc.account, self.doc.against_voucher_type,
|
||||
self.doc.against_voucher)
|
||||
|
||||
def check_mandatory(self):
|
||||
mandatory = ['account','remarks','voucher_type','voucher_no','fiscal_year','company']
|
||||
for k in mandatory:
|
||||
if not self.doc.fields.get(k):
|
||||
webnotes.throw(k + _(" is mandatory for GL Entry"))
|
||||
|
||||
# Zero value transaction is not allowed
|
||||
if not (flt(self.doc.debit) or flt(self.doc.credit)):
|
||||
webnotes.throw(_("GL Entry: Debit or Credit amount is mandatory for ") +
|
||||
self.doc.account)
|
||||
|
||||
def pl_must_have_cost_center(self):
|
||||
if webnotes.conn.get_value("Account", self.doc.account, "is_pl_account") == "Yes":
|
||||
if not self.doc.cost_center and self.doc.voucher_type != 'Period Closing Voucher':
|
||||
webnotes.throw(_("Cost Center must be specified for PL Account: ") +
|
||||
self.doc.account)
|
||||
elif self.doc.cost_center:
|
||||
self.doc.cost_center = None
|
||||
|
||||
def validate_posting_date(self):
|
||||
from accounts.utils import validate_fiscal_year
|
||||
validate_fiscal_year(self.doc.posting_date, self.doc.fiscal_year, "Posting Date")
|
||||
|
||||
def check_pl_account(self):
|
||||
if self.doc.is_opening=='Yes' and \
|
||||
webnotes.conn.get_value("Account", self.doc.account, "is_pl_account") == "Yes":
|
||||
webnotes.throw(_("For opening balance entry account can not be a PL account"))
|
||||
|
||||
def validate_account_details(self, adv_adj):
|
||||
"""Account must be ledger, active and not freezed"""
|
||||
|
||||
ret = webnotes.conn.sql("""select group_or_ledger, docstatus, company
|
||||
from tabAccount where name=%s""", self.doc.account, as_dict=1)[0]
|
||||
|
||||
if ret.group_or_ledger=='Group':
|
||||
webnotes.throw(_("Account") + ": " + self.doc.account + _(" is not a ledger"))
|
||||
|
||||
if ret.docstatus==2:
|
||||
webnotes.throw(_("Account") + ": " + self.doc.account + _(" is not active"))
|
||||
|
||||
if ret.company != self.doc.company:
|
||||
webnotes.throw(_("Account") + ": " + self.doc.account +
|
||||
_(" does not belong to the company") + ": " + self.doc.company)
|
||||
|
||||
def validate_cost_center(self):
|
||||
if not hasattr(self, "cost_center_company"):
|
||||
self.cost_center_company = {}
|
||||
|
||||
def _get_cost_center_company():
|
||||
if not self.cost_center_company.get(self.doc.cost_center):
|
||||
self.cost_center_company[self.doc.cost_center] = webnotes.conn.get_value(
|
||||
"Cost Center", self.doc.cost_center, "company")
|
||||
|
||||
return self.cost_center_company[self.doc.cost_center]
|
||||
|
||||
if self.doc.cost_center and _get_cost_center_company() != self.doc.company:
|
||||
webnotes.throw(_("Cost Center") + ": " + self.doc.cost_center +
|
||||
_(" does not belong to the company") + ": " + self.doc.company)
|
||||
|
||||
def check_negative_balance(account, adv_adj=False):
|
||||
if not adv_adj and account:
|
||||
account_details = webnotes.conn.get_value("Account", account,
|
||||
["allow_negative_balance", "debit_or_credit"], as_dict=True)
|
||||
if not account_details["allow_negative_balance"]:
|
||||
balance = webnotes.conn.sql("""select sum(debit) - sum(credit) from `tabGL Entry`
|
||||
where account = %s""", account)
|
||||
balance = account_details["debit_or_credit"] == "Debit" and \
|
||||
flt(balance[0][0]) or -1*flt(balance[0][0])
|
||||
|
||||
if flt(balance) < 0:
|
||||
webnotes.throw(_("Negative balance is not allowed for account ") + account)
|
||||
|
||||
def check_freezing_date(posting_date, adv_adj=False):
|
||||
"""
|
||||
Nobody can do GL Entries where posting date is before freezing date
|
||||
except authorized person
|
||||
"""
|
||||
if not adv_adj:
|
||||
acc_frozen_upto = webnotes.conn.get_value('Accounts Settings', None, 'acc_frozen_upto')
|
||||
if acc_frozen_upto:
|
||||
bde_auth_role = webnotes.conn.get_value( 'Accounts Settings', None,'bde_auth_role')
|
||||
if getdate(posting_date) <= getdate(acc_frozen_upto) \
|
||||
and not bde_auth_role in webnotes.user.get_roles():
|
||||
webnotes.throw(_("You are not authorized to do/modify back dated entries before ")
|
||||
+ getdate(acc_frozen_upto).strftime('%d-%m-%Y'))
|
||||
|
||||
def update_outstanding_amt(account, against_voucher_type, against_voucher, on_cancel=False):
|
||||
# get final outstanding amt
|
||||
bal = flt(webnotes.conn.sql("""select sum(ifnull(debit, 0)) - sum(ifnull(credit, 0))
|
||||
from `tabGL Entry`
|
||||
where against_voucher_type=%s and against_voucher=%s and account = %s""",
|
||||
(against_voucher_type, against_voucher, account))[0][0] or 0.0)
|
||||
|
||||
if against_voucher_type == 'Purchase Invoice':
|
||||
bal = -bal
|
||||
elif against_voucher_type == "Journal Voucher":
|
||||
against_voucher_amount = flt(webnotes.conn.sql("""
|
||||
select sum(ifnull(debit, 0)) - sum(ifnull(credit, 0))
|
||||
from `tabGL Entry` where voucher_type = 'Journal Voucher' and voucher_no = %s
|
||||
and account = %s and ifnull(against_voucher, '') = ''""",
|
||||
(against_voucher, account))[0][0])
|
||||
bal = against_voucher_amount + bal
|
||||
if against_voucher_amount < 0:
|
||||
bal = -bal
|
||||
|
||||
# Validation : Outstanding can not be negative
|
||||
if bal < 0 and not on_cancel:
|
||||
webnotes.throw(_("Outstanding for Voucher ") + against_voucher + _(" will become ") +
|
||||
fmt_money(bal) + _(". Outstanding cannot be less than zero. \
|
||||
Please match exact outstanding."))
|
||||
|
||||
# Update outstanding amt on against voucher
|
||||
if against_voucher_type in ["Sales Invoice", "Purchase Invoice"]:
|
||||
webnotes.conn.sql("update `tab%s` set outstanding_amount=%s where name='%s'" %
|
||||
(against_voucher_type, bal, against_voucher))
|
||||
|
||||
def validate_frozen_account(account, adv_adj=None):
|
||||
frozen_account = webnotes.conn.get_value("Account", account, "freeze_account")
|
||||
if frozen_account == 'Yes' and not adv_adj:
|
||||
frozen_accounts_modifier = webnotes.conn.get_value( 'Accounts Settings', None,
|
||||
'frozen_accounts_modifier')
|
||||
|
||||
if not frozen_accounts_modifier:
|
||||
webnotes.throw(account + _(" is a frozen account. \
|
||||
Either make the account active or assign role in Accounts Settings \
|
||||
who can create / modify entries against this account"))
|
||||
elif frozen_accounts_modifier not in webnotes.user.get_roles():
|
||||
webnotes.throw(account + _(" is a frozen account. ") +
|
||||
_("To create / edit transactions against this account, you need role") + ": " +
|
||||
frozen_accounts_modifier)
|
||||
@@ -1,232 +0,0 @@
|
||||
[
|
||||
{
|
||||
"creation": "2013-01-10 16:34:06",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-11-03 14:14:09",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
{
|
||||
"autoname": "GL.#######",
|
||||
"doctype": "DocType",
|
||||
"icon": "icon-list",
|
||||
"in_create": 1,
|
||||
"module": "Accounts",
|
||||
"name": "__common__",
|
||||
"search_fields": "voucher_no,account,posting_date,against_voucher"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"name": "__common__",
|
||||
"parent": "GL Entry",
|
||||
"parentfield": "fields",
|
||||
"parenttype": "DocType",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"create": 0,
|
||||
"doctype": "DocPerm",
|
||||
"name": "__common__",
|
||||
"parent": "GL Entry",
|
||||
"parentfield": "permissions",
|
||||
"parenttype": "DocType",
|
||||
"permlevel": 0,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"submit": 0,
|
||||
"write": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocType",
|
||||
"name": "GL Entry"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "posting_date",
|
||||
"fieldtype": "Date",
|
||||
"in_filter": 1,
|
||||
"label": "Posting Date",
|
||||
"oldfieldname": "posting_date",
|
||||
"oldfieldtype": "Date",
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "transaction_date",
|
||||
"fieldtype": "Date",
|
||||
"label": "Transaction Date",
|
||||
"oldfieldname": "transaction_date",
|
||||
"oldfieldtype": "Date"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "aging_date",
|
||||
"fieldtype": "Date",
|
||||
"in_filter": 1,
|
||||
"label": "Aging Date",
|
||||
"oldfieldname": "aging_date",
|
||||
"oldfieldtype": "Date",
|
||||
"search_index": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "account",
|
||||
"fieldtype": "Link",
|
||||
"in_filter": 1,
|
||||
"label": "Account",
|
||||
"oldfieldname": "account",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Account",
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "cost_center",
|
||||
"fieldtype": "Link",
|
||||
"in_filter": 1,
|
||||
"label": "Cost Center",
|
||||
"oldfieldname": "cost_center",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Cost Center",
|
||||
"search_index": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "debit",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Debit Amt",
|
||||
"oldfieldname": "debit",
|
||||
"oldfieldtype": "Currency",
|
||||
"options": "Company:company:default_currency"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "credit",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Credit Amt",
|
||||
"oldfieldname": "credit",
|
||||
"oldfieldtype": "Currency",
|
||||
"options": "Company:company:default_currency"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "against",
|
||||
"fieldtype": "Text",
|
||||
"in_filter": 1,
|
||||
"label": "Against",
|
||||
"oldfieldname": "against",
|
||||
"oldfieldtype": "Text"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "against_voucher",
|
||||
"fieldtype": "Data",
|
||||
"in_filter": 1,
|
||||
"label": "Against Voucher",
|
||||
"oldfieldname": "against_voucher",
|
||||
"oldfieldtype": "Data",
|
||||
"search_index": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "against_voucher_type",
|
||||
"fieldtype": "Data",
|
||||
"in_filter": 0,
|
||||
"label": "Against Voucher Type",
|
||||
"oldfieldname": "against_voucher_type",
|
||||
"oldfieldtype": "Data",
|
||||
"search_index": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "voucher_type",
|
||||
"fieldtype": "Select",
|
||||
"in_filter": 1,
|
||||
"label": "Voucher Type",
|
||||
"oldfieldname": "voucher_type",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "Journal Voucher\nSales Invoice\nPurchase Invoice",
|
||||
"search_index": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "voucher_no",
|
||||
"fieldtype": "Data",
|
||||
"in_filter": 1,
|
||||
"label": "Voucher No",
|
||||
"oldfieldname": "voucher_no",
|
||||
"oldfieldtype": "Data",
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "remarks",
|
||||
"fieldtype": "Text",
|
||||
"in_filter": 1,
|
||||
"label": "Remarks",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "remarks",
|
||||
"oldfieldtype": "Text",
|
||||
"search_index": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "is_opening",
|
||||
"fieldtype": "Select",
|
||||
"in_filter": 1,
|
||||
"label": "Is Opening",
|
||||
"oldfieldname": "is_opening",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "No\nYes",
|
||||
"search_index": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "is_advance",
|
||||
"fieldtype": "Select",
|
||||
"in_filter": 0,
|
||||
"label": "Is Advance",
|
||||
"oldfieldname": "is_advance",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "No\nYes",
|
||||
"search_index": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "fiscal_year",
|
||||
"fieldtype": "Select",
|
||||
"in_filter": 1,
|
||||
"label": "Fiscal Year",
|
||||
"oldfieldname": "fiscal_year",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "link:Fiscal Year",
|
||||
"search_index": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "company",
|
||||
"fieldtype": "Link",
|
||||
"in_filter": 1,
|
||||
"label": "Company",
|
||||
"oldfieldname": "company",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Company",
|
||||
"search_index": 0
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"cancel": 0,
|
||||
"doctype": "DocPerm",
|
||||
"role": "Accounts User"
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"cancel": 0,
|
||||
"doctype": "DocPerm",
|
||||
"role": "Accounts Manager"
|
||||
},
|
||||
{
|
||||
"doctype": "DocPerm",
|
||||
"role": "System Manager"
|
||||
}
|
||||
]
|
||||
@@ -1,241 +0,0 @@
|
||||
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
// License: GNU General Public License v3. See license.txt
|
||||
|
||||
wn.provide("erpnext.accounts");
|
||||
|
||||
erpnext.accounts.JournalVoucher = wn.ui.form.Controller.extend({
|
||||
onload: function() {
|
||||
this.load_defaults();
|
||||
this.setup_queries();
|
||||
},
|
||||
|
||||
load_defaults: function() {
|
||||
if(this.frm.doc.__islocal && this.frm.doc.company) {
|
||||
wn.model.set_default_values(this.frm.doc);
|
||||
$.each(wn.model.get_doclist(this.frm.doc.doctype,
|
||||
this.frm.doc.name, {parentfield: "entries"}), function(i, jvd) {
|
||||
wn.model.set_default_values(jvd);
|
||||
}
|
||||
);
|
||||
|
||||
if(!this.frm.doc.amended_from) this.frm.doc.posting_date = get_today();
|
||||
}
|
||||
},
|
||||
|
||||
setup_queries: function() {
|
||||
var me = this;
|
||||
|
||||
$.each(["account", "cost_center"], function(i, fieldname) {
|
||||
me.frm.set_query(fieldname, "entries", function() {
|
||||
wn.model.validate_missing(me.frm.doc, "company");
|
||||
return {
|
||||
filters: {
|
||||
company: me.frm.doc.company,
|
||||
group_or_ledger: "Ledger"
|
||||
}
|
||||
};
|
||||
});
|
||||
});
|
||||
|
||||
$.each([["against_voucher", "Purchase Invoice", "credit_to"],
|
||||
["against_invoice", "Sales Invoice", "debit_to"]], function(i, opts) {
|
||||
me.frm.set_query(opts[0], "entries", function(doc, cdt, cdn) {
|
||||
var jvd = wn.model.get_doc(cdt, cdn);
|
||||
wn.model.validate_missing(jvd, "account");
|
||||
return {
|
||||
filters: [
|
||||
[opts[1], opts[2], "=", jvd.account],
|
||||
[opts[1], "docstatus", "=", 1],
|
||||
[opts[1], "outstanding_amount", ">", 0]
|
||||
]
|
||||
};
|
||||
});
|
||||
});
|
||||
|
||||
this.frm.set_query("against_jv", "entries", function(doc, cdt, cdn) {
|
||||
var jvd = wn.model.get_doc(cdt, cdn);
|
||||
wn.model.validate_missing(jvd, "account");
|
||||
|
||||
return {
|
||||
query: "accounts.doctype.journal_voucher.journal_voucher.get_against_jv",
|
||||
filters: { account: jvd.account }
|
||||
};
|
||||
});
|
||||
},
|
||||
|
||||
against_voucher: function(doc, cdt, cdn) {
|
||||
var d = wn.model.get_doc(cdt, cdn);
|
||||
if (d.against_voucher && !flt(d.debit)) {
|
||||
this.get_outstanding({
|
||||
'doctype': 'Purchase Invoice',
|
||||
'docname': d.against_voucher
|
||||
}, d)
|
||||
}
|
||||
},
|
||||
|
||||
against_invoice: function(doc, cdt, cdn) {
|
||||
var d = wn.model.get_doc(cdt, cdn);
|
||||
if (d.against_invoice && !flt(d.credit)) {
|
||||
this.get_outstanding({
|
||||
'doctype': 'Sales Invoice',
|
||||
'docname': d.against_invoice
|
||||
}, d)
|
||||
}
|
||||
},
|
||||
|
||||
against_jv: function(doc, cdt, cdn) {
|
||||
var d = wn.model.get_doc(cdt, cdn);
|
||||
if (d.against_jv && !flt(d.credit) && !flt(d.debit)) {
|
||||
this.get_outstanding({
|
||||
'doctype': 'Journal Voucher',
|
||||
'docname': d.against_jv,
|
||||
'account': d.account
|
||||
}, d)
|
||||
}
|
||||
},
|
||||
|
||||
get_outstanding: function(args, child) {
|
||||
var me = this;
|
||||
return this.frm.call({
|
||||
child: child,
|
||||
method: "get_outstanding",
|
||||
args: { args: args},
|
||||
callback: function(r) {
|
||||
cur_frm.cscript.update_totals(me.frm.doc);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
cur_frm.script_manager.make(erpnext.accounts.JournalVoucher);
|
||||
|
||||
cur_frm.cscript.refresh = function(doc) {
|
||||
cur_frm.cscript.is_opening(doc)
|
||||
erpnext.hide_naming_series();
|
||||
cur_frm.cscript.voucher_type(doc);
|
||||
if(doc.docstatus==1) {
|
||||
cur_frm.appframe.add_button(wn._('View Ledger'), function() {
|
||||
wn.route_options = {
|
||||
"voucher_no": doc.name,
|
||||
"from_date": doc.posting_date,
|
||||
"to_date": doc.posting_date,
|
||||
"company": doc.company,
|
||||
group_by_voucher: 0
|
||||
};
|
||||
wn.set_route("query-report", "General Ledger");
|
||||
}, "icon-table");
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.cscript.company = function(doc, cdt, cdn) {
|
||||
cur_frm.refresh_fields();
|
||||
}
|
||||
|
||||
cur_frm.cscript.is_opening = function(doc, cdt, cdn) {
|
||||
hide_field('aging_date');
|
||||
if (doc.is_opening == 'Yes') unhide_field('aging_date');
|
||||
}
|
||||
|
||||
cur_frm.cscript.update_totals = function(doc) {
|
||||
var td=0.0; var tc =0.0;
|
||||
var el = getchildren('Journal Voucher Detail', doc.name, 'entries');
|
||||
for(var i in el) {
|
||||
td += flt(el[i].debit, 2);
|
||||
tc += flt(el[i].credit, 2);
|
||||
}
|
||||
var doc = locals[doc.doctype][doc.name];
|
||||
doc.total_debit = td;
|
||||
doc.total_credit = tc;
|
||||
doc.difference = flt((td - tc), 2);
|
||||
refresh_many(['total_debit','total_credit','difference']);
|
||||
}
|
||||
|
||||
cur_frm.cscript.debit = function(doc,dt,dn) { cur_frm.cscript.update_totals(doc); }
|
||||
cur_frm.cscript.credit = function(doc,dt,dn) { cur_frm.cscript.update_totals(doc); }
|
||||
|
||||
cur_frm.cscript.get_balance = function(doc,dt,dn) {
|
||||
cur_frm.cscript.update_totals(doc);
|
||||
return $c_obj(make_doclist(dt,dn), 'get_balance', '', function(r, rt){
|
||||
cur_frm.refresh();
|
||||
});
|
||||
}
|
||||
// Get balance
|
||||
// -----------
|
||||
|
||||
cur_frm.cscript.account = function(doc,dt,dn) {
|
||||
var d = locals[dt][dn];
|
||||
if(d.account) {
|
||||
return wn.call({
|
||||
method: "accounts.utils.get_balance_on",
|
||||
args: {account: d.account, date: doc.posting_date},
|
||||
callback: function(r) {
|
||||
d.balance = r.message;
|
||||
refresh_field('balance', d.name, 'entries');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.cscript.validate = function(doc,cdt,cdn) {
|
||||
cur_frm.cscript.update_totals(doc);
|
||||
}
|
||||
|
||||
cur_frm.cscript.select_print_heading = function(doc,cdt,cdn){
|
||||
if(doc.select_print_heading){
|
||||
// print heading
|
||||
cur_frm.pformat.print_heading = doc.select_print_heading;
|
||||
}
|
||||
else
|
||||
cur_frm.pformat.print_heading = wn._("Journal Voucher");
|
||||
}
|
||||
|
||||
cur_frm.cscript.voucher_type = function(doc, cdt, cdn) {
|
||||
cur_frm.set_df_property("cheque_no", "reqd", doc.voucher_type=="Bank Voucher");
|
||||
cur_frm.set_df_property("cheque_date", "reqd", doc.voucher_type=="Bank Voucher");
|
||||
|
||||
if(wn.model.get("Journal Voucher Detail", {"parent":doc.name}).length!==0 // too late
|
||||
|| !doc.company) // too early
|
||||
return;
|
||||
|
||||
var update_jv_details = function(doc, r) {
|
||||
$.each(r.message, function(i, d) {
|
||||
var jvdetail = wn.model.add_child(doc, "Journal Voucher Detail", "entries");
|
||||
jvdetail.account = d.account;
|
||||
jvdetail.balance = d.balance;
|
||||
});
|
||||
refresh_field("entries");
|
||||
}
|
||||
|
||||
if(in_list(["Bank Voucher", "Cash Voucher"], doc.voucher_type)) {
|
||||
return wn.call({
|
||||
type: "GET",
|
||||
method: "accounts.doctype.journal_voucher.journal_voucher.get_default_bank_cash_account",
|
||||
args: {
|
||||
"voucher_type": doc.voucher_type,
|
||||
"company": doc.company
|
||||
},
|
||||
callback: function(r) {
|
||||
if(r.message) {
|
||||
update_jv_details(doc, r);
|
||||
}
|
||||
}
|
||||
})
|
||||
} else if(doc.voucher_type=="Opening Entry") {
|
||||
return wn.call({
|
||||
type:"GET",
|
||||
method: "accounts.doctype.journal_voucher.journal_voucher.get_opening_accounts",
|
||||
args: {
|
||||
"company": doc.company
|
||||
},
|
||||
callback: function(r) {
|
||||
wn.model.clear_table("Journal Voucher Detail", "Journal Voucher",
|
||||
doc.name, "entries");
|
||||
if(r.message) {
|
||||
update_jv_details(doc, r);
|
||||
}
|
||||
cur_frm.set_value("is_opening", "Yes")
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -1,463 +0,0 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
from webnotes.utils import cint, cstr, flt, fmt_money, formatdate, getdate
|
||||
from webnotes.model.doc import addchild
|
||||
from webnotes.model.bean import getlist
|
||||
from webnotes import msgprint, _
|
||||
from setup.utils import get_company_currency
|
||||
|
||||
from controllers.accounts_controller import AccountsController
|
||||
|
||||
class DocType(AccountsController):
|
||||
def __init__(self,d,dl):
|
||||
self.doc, self.doclist = d,dl
|
||||
self.master_type = {}
|
||||
self.credit_days_for = {}
|
||||
self.credit_days_global = -1
|
||||
self.is_approving_authority = -1
|
||||
|
||||
def validate(self):
|
||||
if not self.doc.is_opening:
|
||||
self.doc.is_opening='No'
|
||||
|
||||
self.doc.clearance_date = None
|
||||
|
||||
super(DocType, self).validate_date_with_fiscal_year()
|
||||
|
||||
self.validate_debit_credit()
|
||||
self.validate_cheque_info()
|
||||
self.validate_entries_for_advance()
|
||||
self.validate_against_jv()
|
||||
|
||||
self.set_against_account()
|
||||
self.create_remarks()
|
||||
self.set_aging_date()
|
||||
self.set_print_format_fields()
|
||||
|
||||
|
||||
def on_submit(self):
|
||||
if self.doc.voucher_type in ['Bank Voucher', 'Contra Voucher', 'Journal Entry']:
|
||||
self.check_credit_days()
|
||||
self.check_account_against_entries()
|
||||
self.make_gl_entries()
|
||||
self.check_credit_limit()
|
||||
|
||||
def on_cancel(self):
|
||||
from accounts.utils import remove_against_link_from_jv
|
||||
remove_against_link_from_jv(self.doc.doctype, self.doc.name, "against_jv")
|
||||
|
||||
self.make_gl_entries(1)
|
||||
|
||||
def on_trash(self):
|
||||
pass
|
||||
#if self.doc.amended_from:
|
||||
# webnotes.delete_doc("Journal Voucher", self.doc.amended_from)
|
||||
|
||||
def validate_debit_credit(self):
|
||||
for d in getlist(self.doclist, 'entries'):
|
||||
if d.debit and d.credit:
|
||||
msgprint("You cannot credit and debit same account at the same time.",
|
||||
raise_exception=1)
|
||||
|
||||
def validate_cheque_info(self):
|
||||
if self.doc.voucher_type in ['Bank Voucher']:
|
||||
if not self.doc.cheque_no or not self.doc.cheque_date:
|
||||
msgprint("Reference No & Reference Date is required for %s" %
|
||||
self.doc.voucher_type, raise_exception=1)
|
||||
|
||||
if self.doc.cheque_date and not self.doc.cheque_no:
|
||||
msgprint("Reference No is mandatory if you entered Reference Date", raise_exception=1)
|
||||
|
||||
def validate_entries_for_advance(self):
|
||||
for d in getlist(self.doclist,'entries'):
|
||||
if not d.is_advance and not d.against_voucher and \
|
||||
not d.against_invoice and not d.against_jv:
|
||||
master_type = webnotes.conn.get_value("Account", d.account, "master_type")
|
||||
if (master_type == 'Customer' and flt(d.credit) > 0) or \
|
||||
(master_type == 'Supplier' and flt(d.debit) > 0):
|
||||
msgprint("Message: Please check Is Advance as 'Yes' against \
|
||||
Account %s if this is an advance entry." % d.account)
|
||||
|
||||
def validate_against_jv(self):
|
||||
for d in getlist(self.doclist, 'entries'):
|
||||
if d.against_jv:
|
||||
if d.against_jv == self.doc.name:
|
||||
msgprint("You can not enter current voucher in 'Against JV' column",
|
||||
raise_exception=1)
|
||||
elif not webnotes.conn.sql("""select name from `tabJournal Voucher Detail`
|
||||
where account = '%s' and docstatus = 1 and parent = '%s'""" %
|
||||
(d.account, d.against_jv)):
|
||||
msgprint("Against JV: %s is not valid." % d.against_jv, raise_exception=1)
|
||||
|
||||
def set_against_account(self):
|
||||
# Debit = Credit
|
||||
debit, credit = 0.0, 0.0
|
||||
debit_list, credit_list = [], []
|
||||
for d in getlist(self.doclist, 'entries'):
|
||||
debit += flt(d.debit, 2)
|
||||
credit += flt(d.credit, 2)
|
||||
if flt(d.debit)>0 and (d.account not in debit_list): debit_list.append(d.account)
|
||||
if flt(d.credit)>0 and (d.account not in credit_list): credit_list.append(d.account)
|
||||
|
||||
self.doc.total_debit = debit
|
||||
self.doc.total_credit = credit
|
||||
|
||||
if abs(self.doc.total_debit-self.doc.total_credit) > 0.001:
|
||||
msgprint("Debit must be equal to Credit. The difference is %s" %
|
||||
(self.doc.total_debit-self.doc.total_credit), raise_exception=1)
|
||||
|
||||
# update against account
|
||||
for d in getlist(self.doclist, 'entries'):
|
||||
if flt(d.debit) > 0: d.against_account = ', '.join(credit_list)
|
||||
if flt(d.credit) > 0: d.against_account = ', '.join(debit_list)
|
||||
|
||||
def create_remarks(self):
|
||||
r = []
|
||||
if self.doc.cheque_no :
|
||||
if self.doc.cheque_date:
|
||||
r.append('Via Reference #%s dated %s' %
|
||||
(self.doc.cheque_no, formatdate(self.doc.cheque_date)))
|
||||
else :
|
||||
msgprint("Please enter Reference date", raise_exception=1)
|
||||
|
||||
for d in getlist(self.doclist, 'entries'):
|
||||
if d.against_invoice and d.credit:
|
||||
currency = webnotes.conn.get_value("Sales Invoice", d.against_invoice, "currency")
|
||||
r.append('%s %s against Invoice: %s' %
|
||||
(cstr(currency), fmt_money(flt(d.credit)), d.against_invoice))
|
||||
|
||||
if d.against_voucher and d.debit:
|
||||
bill_no = webnotes.conn.sql("""select bill_no, bill_date, currency
|
||||
from `tabPurchase Invoice` where name=%s""", d.against_voucher)
|
||||
if bill_no and bill_no[0][0] and bill_no[0][0].lower().strip() \
|
||||
not in ['na', 'not applicable', 'none']:
|
||||
r.append('%s %s against Bill %s dated %s' %
|
||||
(cstr(bill_no[0][2]), fmt_money(flt(d.debit)), bill_no[0][0],
|
||||
bill_no[0][1] and formatdate(bill_no[0][1].strftime('%Y-%m-%d')) or ''))
|
||||
|
||||
if self.doc.user_remark:
|
||||
r.append("User Remark : %s"%self.doc.user_remark)
|
||||
|
||||
if r:
|
||||
self.doc.remark = ("\n").join(r)
|
||||
else:
|
||||
webnotes.msgprint("User Remarks is mandatory", raise_exception=1)
|
||||
|
||||
def set_aging_date(self):
|
||||
if self.doc.is_opening != 'Yes':
|
||||
self.doc.aging_date = self.doc.posting_date
|
||||
else:
|
||||
# check account type whether supplier or customer
|
||||
exists = False
|
||||
for d in getlist(self.doclist, 'entries'):
|
||||
account_type = webnotes.conn.get_value("Account", d.account, "account_type")
|
||||
if account_type in ["Supplier", "Customer"]:
|
||||
exists = True
|
||||
break
|
||||
|
||||
# If customer/supplier account, aging date is mandatory
|
||||
if exists and not self.doc.aging_date:
|
||||
msgprint("Aging Date is mandatory for opening entry", raise_exception=1)
|
||||
else:
|
||||
self.doc.aging_date = self.doc.posting_date
|
||||
|
||||
def set_print_format_fields(self):
|
||||
for d in getlist(self.doclist, 'entries'):
|
||||
account_type, master_type = webnotes.conn.get_value("Account", d.account,
|
||||
["account_type", "master_type"])
|
||||
|
||||
if master_type in ['Supplier', 'Customer']:
|
||||
if not self.doc.pay_to_recd_from:
|
||||
self.doc.pay_to_recd_from = webnotes.conn.get_value(master_type,
|
||||
' - '.join(d.account.split(' - ')[:-1]),
|
||||
master_type == 'Customer' and 'customer_name' or 'supplier_name')
|
||||
|
||||
if account_type == 'Bank or Cash':
|
||||
company_currency = get_company_currency(self.doc.company)
|
||||
amt = flt(d.debit) and d.debit or d.credit
|
||||
self.doc.total_amount = company_currency + ' ' + cstr(amt)
|
||||
from webnotes.utils import money_in_words
|
||||
self.doc.total_amount_in_words = money_in_words(amt, company_currency)
|
||||
|
||||
def check_credit_days(self):
|
||||
date_diff = 0
|
||||
if self.doc.cheque_date:
|
||||
date_diff = (getdate(self.doc.cheque_date)-getdate(self.doc.posting_date)).days
|
||||
|
||||
if date_diff <= 0: return
|
||||
|
||||
# Get List of Customer Account
|
||||
acc_list = filter(lambda d: webnotes.conn.get_value("Account", d.account,
|
||||
"master_type")=='Customer', getlist(self.doclist,'entries'))
|
||||
|
||||
for d in acc_list:
|
||||
credit_days = self.get_credit_days_for(d.account)
|
||||
# Check credit days
|
||||
if credit_days > 0 and not self.get_authorized_user() and cint(date_diff) > credit_days:
|
||||
msgprint("Credit Not Allowed: Cannot allow a check that is dated \
|
||||
more than %s days after the posting date" % credit_days, raise_exception=1)
|
||||
|
||||
def get_credit_days_for(self, ac):
|
||||
if not self.credit_days_for.has_key(ac):
|
||||
self.credit_days_for[ac] = cint(webnotes.conn.get_value("Account", ac, "credit_days"))
|
||||
|
||||
if not self.credit_days_for[ac]:
|
||||
if self.credit_days_global==-1:
|
||||
self.credit_days_global = cint(webnotes.conn.get_value("Company",
|
||||
self.doc.company, "credit_days"))
|
||||
|
||||
return self.credit_days_global
|
||||
else:
|
||||
return self.credit_days_for[ac]
|
||||
|
||||
def get_authorized_user(self):
|
||||
if self.is_approving_authority==-1:
|
||||
self.is_approving_authority = 0
|
||||
|
||||
# Fetch credit controller role
|
||||
approving_authority = webnotes.conn.get_value("Global Defaults", None,
|
||||
"credit_controller")
|
||||
|
||||
# Check logged-in user is authorized
|
||||
if approving_authority in webnotes.user.get_roles():
|
||||
self.is_approving_authority = 1
|
||||
|
||||
return self.is_approving_authority
|
||||
|
||||
def check_account_against_entries(self):
|
||||
for d in self.doclist.get({"parentfield": "entries"}):
|
||||
if d.against_invoice and webnotes.conn.get_value("Sales Invoice",
|
||||
d.against_invoice, "debit_to") != d.account:
|
||||
webnotes.throw(_("Credited account (Customer) is not matching with Sales Invoice"))
|
||||
|
||||
if d.against_voucher and webnotes.conn.get_value("Purchase Invoice",
|
||||
d.against_voucher, "credit_to") != d.account:
|
||||
webnotes.throw(_("Debited account (Supplier) is not matching with \
|
||||
Purchase Invoice"))
|
||||
|
||||
def make_gl_entries(self, cancel=0, adv_adj=0):
|
||||
from accounts.general_ledger import make_gl_entries
|
||||
gl_map = []
|
||||
for d in self.doclist.get({"parentfield": "entries"}):
|
||||
if d.debit or d.credit:
|
||||
gl_map.append(
|
||||
self.get_gl_dict({
|
||||
"account": d.account,
|
||||
"against": d.against_account,
|
||||
"debit": d.debit,
|
||||
"credit": d.credit,
|
||||
"against_voucher_type": ((d.against_voucher and "Purchase Invoice")
|
||||
or (d.against_invoice and "Sales Invoice")
|
||||
or (d.against_jv and "Journal Voucher")),
|
||||
"against_voucher": d.against_voucher or d.against_invoice or d.against_jv,
|
||||
"remarks": self.doc.remark,
|
||||
"cost_center": d.cost_center
|
||||
})
|
||||
)
|
||||
if gl_map:
|
||||
make_gl_entries(gl_map, cancel=cancel, adv_adj=adv_adj)
|
||||
|
||||
def check_credit_limit(self):
|
||||
for d in self.doclist.get({"parentfield": "entries"}):
|
||||
master_type, master_name = webnotes.conn.get_value("Account", d.account,
|
||||
["master_type", "master_name"])
|
||||
if master_type == "Customer" and master_name:
|
||||
super(DocType, self).check_credit_limit(d.account)
|
||||
|
||||
def get_balance(self):
|
||||
if not getlist(self.doclist,'entries'):
|
||||
msgprint("Please enter atleast 1 entry in 'GL Entries' table")
|
||||
else:
|
||||
flag, self.doc.total_debit, self.doc.total_credit = 0, 0, 0
|
||||
diff = flt(self.doc.difference, 2)
|
||||
|
||||
# If any row without amount, set the diff on that row
|
||||
for d in getlist(self.doclist,'entries'):
|
||||
if not d.credit and not d.debit and diff != 0:
|
||||
if diff>0:
|
||||
d.credit = diff
|
||||
elif diff<0:
|
||||
d.debit = diff
|
||||
flag = 1
|
||||
|
||||
# Set the diff in a new row
|
||||
if flag == 0 and diff != 0:
|
||||
jd = addchild(self.doc, 'entries', 'Journal Voucher Detail', self.doclist)
|
||||
if diff>0:
|
||||
jd.credit = abs(diff)
|
||||
elif diff<0:
|
||||
jd.debit = abs(diff)
|
||||
|
||||
# Set the total debit, total credit and difference
|
||||
for d in getlist(self.doclist,'entries'):
|
||||
self.doc.total_debit += flt(d.debit, 2)
|
||||
self.doc.total_credit += flt(d.credit, 2)
|
||||
|
||||
self.doc.difference = flt(self.doc.total_debit, 2) - flt(self.doc.total_credit, 2)
|
||||
|
||||
def get_outstanding_invoices(self):
|
||||
self.doclist = self.doc.clear_table(self.doclist, 'entries')
|
||||
total = 0
|
||||
for d in self.get_values():
|
||||
total += flt(d[2])
|
||||
jd = addchild(self.doc, 'entries', 'Journal Voucher Detail', self.doclist)
|
||||
jd.account = cstr(d[1])
|
||||
if self.doc.write_off_based_on == 'Accounts Receivable':
|
||||
jd.credit = flt(d[2])
|
||||
jd.against_invoice = cstr(d[0])
|
||||
elif self.doc.write_off_based_on == 'Accounts Payable':
|
||||
jd.debit = flt(d[2])
|
||||
jd.against_voucher = cstr(d[0])
|
||||
jd.save(1)
|
||||
jd = addchild(self.doc, 'entries', 'Journal Voucher Detail', self.doclist)
|
||||
if self.doc.write_off_based_on == 'Accounts Receivable':
|
||||
jd.debit = total
|
||||
elif self.doc.write_off_based_on == 'Accounts Payable':
|
||||
jd.credit = total
|
||||
jd.save(1)
|
||||
|
||||
def get_values(self):
|
||||
cond = (flt(self.doc.write_off_amount) > 0) and \
|
||||
' and outstanding_amount <= '+ self.doc.write_off_amount or ''
|
||||
if self.doc.write_off_based_on == 'Accounts Receivable':
|
||||
return webnotes.conn.sql("""select name, debit_to, outstanding_amount
|
||||
from `tabSales Invoice` where docstatus = 1 and company = %s
|
||||
and outstanding_amount > 0 %s""" % ('%s', cond), self.doc.company)
|
||||
elif self.doc.write_off_based_on == 'Accounts Payable':
|
||||
return webnotes.conn.sql("""select name, credit_to, outstanding_amount
|
||||
from `tabPurchase Invoice` where docstatus = 1 and company = %s
|
||||
and outstanding_amount > 0 %s""" % ('%s', cond), self.doc.company)
|
||||
|
||||
@webnotes.whitelist()
|
||||
def get_default_bank_cash_account(company, voucher_type):
|
||||
from accounts.utils import get_balance_on
|
||||
account = webnotes.conn.get_value("Company", company,
|
||||
voucher_type=="Bank Voucher" and "default_bank_account" or "default_cash_account")
|
||||
if account:
|
||||
return {
|
||||
"account": account,
|
||||
"balance": get_balance_on(account)
|
||||
}
|
||||
|
||||
@webnotes.whitelist()
|
||||
def get_payment_entry_from_sales_invoice(sales_invoice):
|
||||
from accounts.utils import get_balance_on
|
||||
si = webnotes.bean("Sales Invoice", sales_invoice)
|
||||
jv = get_payment_entry(si.doc)
|
||||
jv.doc.remark = 'Payment received against Sales Invoice %(name)s. %(remarks)s' % si.doc.fields
|
||||
|
||||
# credit customer
|
||||
jv.doclist[1].account = si.doc.debit_to
|
||||
jv.doclist[1].balance = get_balance_on(si.doc.debit_to)
|
||||
jv.doclist[1].credit = si.doc.outstanding_amount
|
||||
jv.doclist[1].against_invoice = si.doc.name
|
||||
|
||||
# debit bank
|
||||
jv.doclist[2].debit = si.doc.outstanding_amount
|
||||
|
||||
return [d.fields for d in jv.doclist]
|
||||
|
||||
@webnotes.whitelist()
|
||||
def get_payment_entry_from_purchase_invoice(purchase_invoice):
|
||||
from accounts.utils import get_balance_on
|
||||
pi = webnotes.bean("Purchase Invoice", purchase_invoice)
|
||||
jv = get_payment_entry(pi.doc)
|
||||
jv.doc.remark = 'Payment against Purchase Invoice %(name)s. %(remarks)s' % pi.doc.fields
|
||||
|
||||
# credit supplier
|
||||
jv.doclist[1].account = pi.doc.credit_to
|
||||
jv.doclist[1].balance = get_balance_on(pi.doc.credit_to)
|
||||
jv.doclist[1].debit = pi.doc.outstanding_amount
|
||||
jv.doclist[1].against_voucher = pi.doc.name
|
||||
|
||||
# credit bank
|
||||
jv.doclist[2].credit = pi.doc.outstanding_amount
|
||||
|
||||
return [d.fields for d in jv.doclist]
|
||||
|
||||
def get_payment_entry(doc):
|
||||
bank_account = get_default_bank_cash_account(doc.company, "Bank Voucher")
|
||||
|
||||
jv = webnotes.new_bean('Journal Voucher')
|
||||
jv.doc.voucher_type = 'Bank Voucher'
|
||||
|
||||
jv.doc.company = doc.company
|
||||
jv.doc.fiscal_year = doc.fiscal_year
|
||||
|
||||
jv.doclist.append({
|
||||
"doctype": "Journal Voucher Detail",
|
||||
"parentfield": "entries"
|
||||
})
|
||||
|
||||
jv.doclist.append({
|
||||
"doctype": "Journal Voucher Detail",
|
||||
"parentfield": "entries"
|
||||
})
|
||||
|
||||
if bank_account:
|
||||
jv.doclist[2].account = bank_account["account"]
|
||||
jv.doclist[2].balance = bank_account["balance"]
|
||||
|
||||
return jv
|
||||
|
||||
@webnotes.whitelist()
|
||||
def get_opening_accounts(company):
|
||||
"""get all balance sheet accounts for opening entry"""
|
||||
from accounts.utils import get_balance_on
|
||||
accounts = webnotes.conn.sql_list("""select name from tabAccount
|
||||
where group_or_ledger='Ledger' and is_pl_account='No' and company=%s""", company)
|
||||
|
||||
return [{"account": a, "balance": get_balance_on(a)} for a in accounts]
|
||||
|
||||
def get_against_purchase_invoice(doctype, txt, searchfield, start, page_len, filters):
|
||||
return webnotes.conn.sql("""select name, credit_to, outstanding_amount, bill_no, bill_date
|
||||
from `tabPurchase Invoice` where credit_to = %s and docstatus = 1
|
||||
and outstanding_amount > 0 and %s like %s order by name desc limit %s, %s""" %
|
||||
("%s", searchfield, "%s", "%s", "%s"),
|
||||
(filters["account"], "%%%s%%" % txt, start, page_len))
|
||||
|
||||
def get_against_sales_invoice(doctype, txt, searchfield, start, page_len, filters):
|
||||
return webnotes.conn.sql("""select name, debit_to, outstanding_amount
|
||||
from `tabSales Invoice` where debit_to = %s and docstatus = 1
|
||||
and outstanding_amount > 0 and `%s` like %s order by name desc limit %s, %s""" %
|
||||
("%s", searchfield, "%s", "%s", "%s"),
|
||||
(filters["account"], "%%%s%%" % txt, start, page_len))
|
||||
|
||||
def get_against_jv(doctype, txt, searchfield, start, page_len, filters):
|
||||
return webnotes.conn.sql("""select jv.name, jv.posting_date, jv.user_remark
|
||||
from `tabJournal Voucher` jv, `tabJournal Voucher Detail` jv_detail
|
||||
where jv_detail.parent = jv.name and jv_detail.account = %s and jv.docstatus = 1
|
||||
and jv.%s like %s order by jv.name desc limit %s, %s""" %
|
||||
("%s", searchfield, "%s", "%s", "%s"),
|
||||
(filters["account"], "%%%s%%" % txt, start, page_len))
|
||||
|
||||
@webnotes.whitelist()
|
||||
def get_outstanding(args):
|
||||
args = eval(args)
|
||||
if args.get("doctype") == "Journal Voucher" and args.get("account"):
|
||||
against_jv_amount = webnotes.conn.sql("""
|
||||
select sum(ifnull(debit, 0)) - sum(ifnull(credit, 0))
|
||||
from `tabJournal Voucher Detail` where parent=%s and account=%s
|
||||
and ifnull(against_invoice, '')='' and ifnull(against_voucher, '')=''
|
||||
and ifnull(against_jv, '')=''""", (args['docname'], args['account']))
|
||||
|
||||
against_jv_amount = flt(against_jv_amount[0][0]) if against_jv_amount else 0
|
||||
if against_jv_amount > 0:
|
||||
return {"credit": against_jv_amount}
|
||||
else:
|
||||
return {"debit": -1* against_jv_amount}
|
||||
|
||||
elif args.get("doctype") == "Sales Invoice":
|
||||
return {
|
||||
"credit": flt(webnotes.conn.get_value("Sales Invoice", args["docname"],
|
||||
"outstanding_amount"))
|
||||
}
|
||||
elif args.get("doctype") == "Purchase Invoice":
|
||||
return {
|
||||
"debit": flt(webnotes.conn.get_value("Purchase Invoice", args["docname"],
|
||||
"outstanding_amount"))
|
||||
}
|
||||
@@ -1,497 +0,0 @@
|
||||
[
|
||||
{
|
||||
"creation": "2013-03-25 10:53:52",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-11-03 14:11:33",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
{
|
||||
"allow_import": 1,
|
||||
"autoname": "naming_series:",
|
||||
"doctype": "DocType",
|
||||
"icon": "icon-file-text",
|
||||
"is_submittable": 1,
|
||||
"module": "Accounts",
|
||||
"name": "__common__",
|
||||
"read_only_onload": 1,
|
||||
"search_fields": "voucher_type,posting_date, due_date, cheque_no"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"name": "__common__",
|
||||
"parent": "Journal Voucher",
|
||||
"parentfield": "fields",
|
||||
"parenttype": "DocType",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocPerm",
|
||||
"name": "__common__",
|
||||
"parent": "Journal Voucher",
|
||||
"parentfield": "permissions",
|
||||
"parenttype": "DocType",
|
||||
"permlevel": 0,
|
||||
"read": 1,
|
||||
"report": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocType",
|
||||
"name": "Journal Voucher"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "voucher_type_and_date",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Voucher Type and Date",
|
||||
"options": "icon-flag"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "column_break0",
|
||||
"fieldtype": "Column Break",
|
||||
"oldfieldtype": "Column Break",
|
||||
"read_only": 0,
|
||||
"width": "50%"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "naming_series",
|
||||
"fieldtype": "Select",
|
||||
"label": "Series",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "naming_series",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "JV",
|
||||
"print_hide": 1,
|
||||
"read_only": 0,
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "voucher_type",
|
||||
"fieldtype": "Select",
|
||||
"in_filter": 1,
|
||||
"in_list_view": 1,
|
||||
"label": "Voucher Type",
|
||||
"oldfieldname": "voucher_type",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "\nJournal Entry\nBank Voucher\nCash Voucher\nCredit Card Voucher\nDebit Note\nCredit Note\nContra Voucher\nExcise Voucher\nWrite Off Voucher\nOpening Entry",
|
||||
"print_hide": 0,
|
||||
"read_only": 0,
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "column_break1",
|
||||
"fieldtype": "Column Break",
|
||||
"oldfieldtype": "Column Break",
|
||||
"read_only": 0,
|
||||
"width": "50%"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "posting_date",
|
||||
"fieldtype": "Date",
|
||||
"in_filter": 1,
|
||||
"in_list_view": 1,
|
||||
"label": "Posting Date",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "posting_date",
|
||||
"oldfieldtype": "Date",
|
||||
"read_only": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "2_add_edit_gl_entries",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Journal Entries",
|
||||
"oldfieldtype": "Section Break",
|
||||
"options": "icon-table",
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 1,
|
||||
"doctype": "DocField",
|
||||
"fieldname": "entries",
|
||||
"fieldtype": "Table",
|
||||
"label": "Entries",
|
||||
"oldfieldname": "entries",
|
||||
"oldfieldtype": "Table",
|
||||
"options": "Journal Voucher Detail",
|
||||
"print_hide": 0,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "section_break99",
|
||||
"fieldtype": "Section Break",
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "total_debit",
|
||||
"fieldtype": "Currency",
|
||||
"in_filter": 1,
|
||||
"in_list_view": 1,
|
||||
"label": "Total Debit",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "total_debit",
|
||||
"oldfieldtype": "Currency",
|
||||
"options": "Company:company:default_currency",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "total_credit",
|
||||
"fieldtype": "Currency",
|
||||
"in_filter": 1,
|
||||
"label": "Total Credit",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "total_credit",
|
||||
"oldfieldtype": "Currency",
|
||||
"options": "Company:company:default_currency",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "column_break99",
|
||||
"fieldtype": "Column Break",
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "difference",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Difference",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "difference",
|
||||
"oldfieldtype": "Currency",
|
||||
"options": "Company:company:default_currency",
|
||||
"print_hide": 1,
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "get_balance",
|
||||
"fieldtype": "Button",
|
||||
"label": "Make Difference Entry",
|
||||
"oldfieldtype": "Button",
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "reference",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Reference",
|
||||
"options": "icon-pushpin",
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"description": "eg. Cheque Number",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "cheque_no",
|
||||
"fieldtype": "Data",
|
||||
"in_filter": 1,
|
||||
"in_list_view": 1,
|
||||
"label": "Reference Number",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "cheque_no",
|
||||
"oldfieldtype": "Data",
|
||||
"read_only": 0,
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "cheque_date",
|
||||
"fieldtype": "Date",
|
||||
"label": "Reference Date",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "cheque_date",
|
||||
"oldfieldtype": "Date",
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "clearance_date",
|
||||
"fieldtype": "Date",
|
||||
"in_filter": 1,
|
||||
"label": "Clearance Date",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "clearance_date",
|
||||
"oldfieldtype": "Date",
|
||||
"print_hide": 0,
|
||||
"read_only": 1,
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "column_break98",
|
||||
"fieldtype": "Column Break",
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "user_remark",
|
||||
"fieldtype": "Small Text",
|
||||
"in_filter": 1,
|
||||
"label": "User Remark",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "user_remark",
|
||||
"oldfieldtype": "Small Text",
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"description": "User Remark will be added to Auto Remark",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "remark",
|
||||
"fieldtype": "Small Text",
|
||||
"in_list_view": 0,
|
||||
"label": "Remark",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "remark",
|
||||
"oldfieldtype": "Small Text",
|
||||
"read_only": 1,
|
||||
"reqd": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "bill_no",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 0,
|
||||
"label": "Bill No",
|
||||
"oldfieldname": "bill_no",
|
||||
"oldfieldtype": "Data",
|
||||
"print_hide": 1,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "bill_date",
|
||||
"fieldtype": "Date",
|
||||
"label": "Bill Date",
|
||||
"oldfieldname": "bill_date",
|
||||
"oldfieldtype": "Date",
|
||||
"print_hide": 1,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "due_date",
|
||||
"fieldtype": "Date",
|
||||
"label": "Due Date",
|
||||
"oldfieldname": "due_date",
|
||||
"oldfieldtype": "Date",
|
||||
"print_hide": 0,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "addtional_info",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "More Info",
|
||||
"oldfieldtype": "Section Break",
|
||||
"options": "icon-file-text",
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "column_break2",
|
||||
"fieldtype": "Column Break",
|
||||
"oldfieldtype": "Column Break",
|
||||
"read_only": 0,
|
||||
"width": "50%"
|
||||
},
|
||||
{
|
||||
"default": "No",
|
||||
"description": "Considered as Opening Balance",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "is_opening",
|
||||
"fieldtype": "Select",
|
||||
"in_filter": 1,
|
||||
"label": "Is Opening",
|
||||
"oldfieldname": "is_opening",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "No\nYes",
|
||||
"print_hide": 1,
|
||||
"read_only": 0,
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"description": "Actual Posting Date",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "aging_date",
|
||||
"fieldtype": "Date",
|
||||
"label": "Aging Date",
|
||||
"no_copy": 0,
|
||||
"oldfieldname": "aging_date",
|
||||
"oldfieldtype": "Date",
|
||||
"print_hide": 1,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"default": "Accounts Receivable",
|
||||
"depends_on": "eval:doc.voucher_type == 'Write Off Voucher'",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "write_off_based_on",
|
||||
"fieldtype": "Select",
|
||||
"label": "Write Off Based On",
|
||||
"options": "Accounts Receivable\nAccounts Payable",
|
||||
"print_hide": 1,
|
||||
"read_only": 0,
|
||||
"report_hide": 1
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:doc.voucher_type == 'Write Off Voucher'",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "write_off_amount",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Write Off Amount <=",
|
||||
"options": "Company:company:default_currency",
|
||||
"print_hide": 1,
|
||||
"read_only": 0,
|
||||
"report_hide": 1
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:doc.voucher_type == 'Write Off Voucher'",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "get_outstanding_invoices",
|
||||
"fieldtype": "Button",
|
||||
"label": "Get Outstanding Invoices",
|
||||
"options": "get_outstanding_invoices",
|
||||
"print_hide": 1,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "letter_head",
|
||||
"fieldtype": "Link",
|
||||
"label": "Letter Head",
|
||||
"options": "Letter Head"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "column_break3",
|
||||
"fieldtype": "Column Break",
|
||||
"oldfieldtype": "Column Break",
|
||||
"read_only": 0,
|
||||
"width": "50%"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "pay_to_recd_from",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"label": "Pay To / Recd From",
|
||||
"no_copy": 1,
|
||||
"print_hide": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "total_amount",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 1,
|
||||
"in_list_view": 0,
|
||||
"label": "Total Amount",
|
||||
"no_copy": 1,
|
||||
"print_hide": 1,
|
||||
"read_only": 1,
|
||||
"report_hide": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "total_amount_in_words",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 1,
|
||||
"label": "Total Amount in Words",
|
||||
"no_copy": 1,
|
||||
"print_hide": 1,
|
||||
"read_only": 1,
|
||||
"report_hide": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "fiscal_year",
|
||||
"fieldtype": "Select",
|
||||
"in_filter": 1,
|
||||
"label": "Fiscal Year",
|
||||
"oldfieldname": "fiscal_year",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "link:Fiscal Year",
|
||||
"print_hide": 1,
|
||||
"read_only": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "company",
|
||||
"fieldtype": "Link",
|
||||
"in_filter": 1,
|
||||
"label": "Company",
|
||||
"oldfieldname": "company",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Company",
|
||||
"print_hide": 1,
|
||||
"read_only": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 1,
|
||||
"doctype": "DocField",
|
||||
"fieldname": "select_print_heading",
|
||||
"fieldtype": "Link",
|
||||
"label": "Print Heading",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "select_print_heading",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Print Heading",
|
||||
"print_hide": 1,
|
||||
"read_only": 0,
|
||||
"report_hide": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "amended_from",
|
||||
"fieldtype": "Link",
|
||||
"label": "Amended From",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "amended_from",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Journal Voucher",
|
||||
"print_hide": 1,
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"amend": 1,
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"role": "Accounts User",
|
||||
"submit": 1,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"amend": 1,
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"role": "Accounts Manager",
|
||||
"submit": 1,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"doctype": "DocPerm",
|
||||
"role": "Auditor",
|
||||
"submit": 0,
|
||||
"write": 0
|
||||
}
|
||||
]
|
||||
@@ -1,208 +0,0 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import unittest
|
||||
import webnotes
|
||||
|
||||
class TestJournalVoucher(unittest.TestCase):
|
||||
def test_journal_voucher_with_against_jv(self):
|
||||
self.clear_account_balance()
|
||||
jv_invoice = webnotes.bean(copy=test_records[2])
|
||||
jv_invoice.insert()
|
||||
jv_invoice.submit()
|
||||
|
||||
self.assertTrue(not webnotes.conn.sql("""select name from `tabJournal Voucher Detail`
|
||||
where against_jv=%s""", jv_invoice.doc.name))
|
||||
|
||||
jv_payment = webnotes.bean(copy=test_records[0])
|
||||
jv_payment.doclist[1].against_jv = jv_invoice.doc.name
|
||||
jv_payment.insert()
|
||||
jv_payment.submit()
|
||||
|
||||
self.assertTrue(webnotes.conn.sql("""select name from `tabJournal Voucher Detail`
|
||||
where against_jv=%s""", jv_invoice.doc.name))
|
||||
|
||||
self.assertTrue(webnotes.conn.sql("""select name from `tabJournal Voucher Detail`
|
||||
where against_jv=%s and credit=400""", jv_invoice.doc.name))
|
||||
|
||||
# cancel jv_invoice
|
||||
jv_invoice.cancel()
|
||||
|
||||
self.assertTrue(not webnotes.conn.sql("""select name from `tabJournal Voucher Detail`
|
||||
where against_jv=%s""", jv_invoice.doc.name))
|
||||
|
||||
def test_jv_against_stock_account(self):
|
||||
from stock.doctype.purchase_receipt.test_purchase_receipt import set_perpetual_inventory
|
||||
set_perpetual_inventory()
|
||||
|
||||
jv = webnotes.bean(copy=test_records[0])
|
||||
jv.doclist[1].account = "_Test Warehouse - _TC"
|
||||
jv.insert()
|
||||
|
||||
from accounts.general_ledger import StockAccountInvalidTransaction
|
||||
self.assertRaises(StockAccountInvalidTransaction, jv.submit)
|
||||
|
||||
set_perpetual_inventory(0)
|
||||
|
||||
def test_monthly_budget_crossed_ignore(self):
|
||||
webnotes.conn.set_value("Company", "_Test Company", "monthly_bgt_flag", "Ignore")
|
||||
self.clear_account_balance()
|
||||
|
||||
jv = webnotes.bean(copy=test_records[0])
|
||||
jv.doclist[2].account = "_Test Account Cost for Goods Sold - _TC"
|
||||
jv.doclist[2].cost_center = "_Test Cost Center - _TC"
|
||||
jv.doclist[2].debit = 20000.0
|
||||
jv.doclist[1].credit = 20000.0
|
||||
jv.insert()
|
||||
jv.submit()
|
||||
self.assertTrue(webnotes.conn.get_value("GL Entry",
|
||||
{"voucher_type": "Journal Voucher", "voucher_no": jv.doc.name}))
|
||||
|
||||
def test_monthly_budget_crossed_stop(self):
|
||||
from accounts.utils import BudgetError
|
||||
webnotes.conn.set_value("Company", "_Test Company", "monthly_bgt_flag", "Stop")
|
||||
self.clear_account_balance()
|
||||
|
||||
jv = webnotes.bean(copy=test_records[0])
|
||||
jv.doclist[2].account = "_Test Account Cost for Goods Sold - _TC"
|
||||
jv.doclist[2].cost_center = "_Test Cost Center - _TC"
|
||||
jv.doclist[2].debit = 20000.0
|
||||
jv.doclist[1].credit = 20000.0
|
||||
jv.insert()
|
||||
|
||||
self.assertRaises(BudgetError, jv.submit)
|
||||
|
||||
webnotes.conn.set_value("Company", "_Test Company", "monthly_bgt_flag", "Ignore")
|
||||
|
||||
def test_yearly_budget_crossed_stop(self):
|
||||
from accounts.utils import BudgetError
|
||||
self.clear_account_balance()
|
||||
self.test_monthly_budget_crossed_ignore()
|
||||
|
||||
webnotes.conn.set_value("Company", "_Test Company", "yearly_bgt_flag", "Stop")
|
||||
|
||||
jv = webnotes.bean(copy=test_records[0])
|
||||
jv.doc.posting_date = "2013-08-12"
|
||||
jv.doclist[2].account = "_Test Account Cost for Goods Sold - _TC"
|
||||
jv.doclist[2].cost_center = "_Test Cost Center - _TC"
|
||||
jv.doclist[2].debit = 150000.0
|
||||
jv.doclist[1].credit = 150000.0
|
||||
jv.insert()
|
||||
|
||||
self.assertRaises(BudgetError, jv.submit)
|
||||
|
||||
webnotes.conn.set_value("Company", "_Test Company", "yearly_bgt_flag", "Ignore")
|
||||
|
||||
def test_monthly_budget_on_cancellation(self):
|
||||
from accounts.utils import BudgetError
|
||||
webnotes.conn.set_value("Company", "_Test Company", "monthly_bgt_flag", "Stop")
|
||||
self.clear_account_balance()
|
||||
|
||||
jv = webnotes.bean(copy=test_records[0])
|
||||
jv.doclist[1].account = "_Test Account Cost for Goods Sold - _TC"
|
||||
jv.doclist[1].cost_center = "_Test Cost Center - _TC"
|
||||
jv.doclist[1].credit = 30000.0
|
||||
jv.doclist[2].debit = 30000.0
|
||||
jv.submit()
|
||||
|
||||
self.assertTrue(webnotes.conn.get_value("GL Entry",
|
||||
{"voucher_type": "Journal Voucher", "voucher_no": jv.doc.name}))
|
||||
|
||||
jv1 = webnotes.bean(copy=test_records[0])
|
||||
jv1.doclist[2].account = "_Test Account Cost for Goods Sold - _TC"
|
||||
jv1.doclist[2].cost_center = "_Test Cost Center - _TC"
|
||||
jv1.doclist[2].debit = 40000.0
|
||||
jv1.doclist[1].credit = 40000.0
|
||||
jv1.submit()
|
||||
|
||||
self.assertTrue(webnotes.conn.get_value("GL Entry",
|
||||
{"voucher_type": "Journal Voucher", "voucher_no": jv1.doc.name}))
|
||||
|
||||
self.assertRaises(BudgetError, jv.cancel)
|
||||
|
||||
webnotes.conn.set_value("Company", "_Test Company", "monthly_bgt_flag", "Ignore")
|
||||
|
||||
def clear_account_balance(self):
|
||||
webnotes.conn.sql("""delete from `tabGL Entry`""")
|
||||
|
||||
|
||||
test_records = [
|
||||
[{
|
||||
"company": "_Test Company",
|
||||
"doctype": "Journal Voucher",
|
||||
"fiscal_year": "_Test Fiscal Year 2013",
|
||||
"naming_series": "_T-Journal Voucher-",
|
||||
"posting_date": "2013-02-14",
|
||||
"user_remark": "test",
|
||||
"voucher_type": "Bank Voucher",
|
||||
"cheque_no": "33",
|
||||
"cheque_date": "2013-02-14"
|
||||
},
|
||||
{
|
||||
"account": "_Test Customer - _TC",
|
||||
"doctype": "Journal Voucher Detail",
|
||||
"credit": 400.0,
|
||||
"debit": 0.0,
|
||||
"parentfield": "entries"
|
||||
},
|
||||
{
|
||||
"account": "_Test Account Bank Account - _TC",
|
||||
"doctype": "Journal Voucher Detail",
|
||||
"debit": 400.0,
|
||||
"credit": 0.0,
|
||||
"parentfield": "entries"
|
||||
}],
|
||||
[{
|
||||
"company": "_Test Company",
|
||||
"doctype": "Journal Voucher",
|
||||
"fiscal_year": "_Test Fiscal Year 2013",
|
||||
"naming_series": "_T-Journal Voucher-",
|
||||
"posting_date": "2013-02-14",
|
||||
"user_remark": "test",
|
||||
"voucher_type": "Bank Voucher",
|
||||
"cheque_no": "33",
|
||||
"cheque_date": "2013-02-14"
|
||||
},
|
||||
{
|
||||
"account": "_Test Supplier - _TC",
|
||||
"doctype": "Journal Voucher Detail",
|
||||
"credit": 0.0,
|
||||
"debit": 400.0,
|
||||
"parentfield": "entries"
|
||||
},
|
||||
{
|
||||
"account": "_Test Account Bank Account - _TC",
|
||||
"doctype": "Journal Voucher Detail",
|
||||
"debit": 0.0,
|
||||
"credit": 400.0,
|
||||
"parentfield": "entries"
|
||||
}],
|
||||
[{
|
||||
"company": "_Test Company",
|
||||
"doctype": "Journal Voucher",
|
||||
"fiscal_year": "_Test Fiscal Year 2013",
|
||||
"naming_series": "_T-Journal Voucher-",
|
||||
"posting_date": "2013-02-14",
|
||||
"user_remark": "test",
|
||||
"voucher_type": "Bank Voucher",
|
||||
"cheque_no": "33",
|
||||
"cheque_date": "2013-02-14"
|
||||
},
|
||||
{
|
||||
"account": "_Test Customer - _TC",
|
||||
"doctype": "Journal Voucher Detail",
|
||||
"credit": 0.0,
|
||||
"debit": 400.0,
|
||||
"parentfield": "entries"
|
||||
},
|
||||
{
|
||||
"account": "Sales - _TC",
|
||||
"doctype": "Journal Voucher Detail",
|
||||
"credit": 400.0,
|
||||
"debit": 0.0,
|
||||
"parentfield": "entries",
|
||||
"cost_center": "_Test Cost Center - _TC"
|
||||
}],
|
||||
]
|
||||
@@ -1,9 +0,0 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
class DocType:
|
||||
def __init__(self, d, dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
@@ -1,159 +0,0 @@
|
||||
[
|
||||
{
|
||||
"creation": "2013-02-22 01:27:39",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-08-02 18:15:56",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
{
|
||||
"autoname": "JVD.######",
|
||||
"doctype": "DocType",
|
||||
"istable": 1,
|
||||
"module": "Accounts",
|
||||
"name": "__common__"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"name": "__common__",
|
||||
"parent": "Journal Voucher Detail",
|
||||
"parentfield": "fields",
|
||||
"parenttype": "DocType",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocType",
|
||||
"name": "Journal Voucher Detail"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "account",
|
||||
"fieldtype": "Link",
|
||||
"in_filter": 1,
|
||||
"in_list_view": 1,
|
||||
"label": "Account",
|
||||
"oldfieldname": "account",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Account",
|
||||
"print_width": "250px",
|
||||
"reqd": 1,
|
||||
"search_index": 1,
|
||||
"width": "250px"
|
||||
},
|
||||
{
|
||||
"default": ":Company",
|
||||
"description": "If Income or Expense",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "cost_center",
|
||||
"fieldtype": "Link",
|
||||
"in_filter": 1,
|
||||
"in_list_view": 1,
|
||||
"label": "Cost Center",
|
||||
"oldfieldname": "cost_center",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Cost Center",
|
||||
"print_width": "180px",
|
||||
"search_index": 0,
|
||||
"width": "180px"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "debit",
|
||||
"fieldtype": "Currency",
|
||||
"in_list_view": 1,
|
||||
"label": "Debit",
|
||||
"oldfieldname": "debit",
|
||||
"oldfieldtype": "Currency",
|
||||
"options": "Company:company:default_currency"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "credit",
|
||||
"fieldtype": "Currency",
|
||||
"in_list_view": 1,
|
||||
"label": "Credit",
|
||||
"oldfieldname": "credit",
|
||||
"oldfieldtype": "Currency",
|
||||
"options": "Company:company:default_currency"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "balance",
|
||||
"fieldtype": "Currency",
|
||||
"in_list_view": 1,
|
||||
"label": "Account Balance",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "balance",
|
||||
"oldfieldtype": "Data",
|
||||
"options": "Company:company:default_currency",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "reference",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Reference"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "against_voucher",
|
||||
"fieldtype": "Link",
|
||||
"in_filter": 1,
|
||||
"in_list_view": 1,
|
||||
"label": "Against Purchase Invoice",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "against_voucher",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Purchase Invoice",
|
||||
"print_hide": 0,
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "against_invoice",
|
||||
"fieldtype": "Link",
|
||||
"in_filter": 1,
|
||||
"label": "Against Sales Invoice",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "against_invoice",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Sales Invoice",
|
||||
"print_hide": 0,
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "against_jv",
|
||||
"fieldtype": "Link",
|
||||
"in_filter": 1,
|
||||
"label": "Against Journal Voucher",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "against_jv",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Journal Voucher",
|
||||
"print_hide": 0,
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "is_advance",
|
||||
"fieldtype": "Select",
|
||||
"label": "Is Advance",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "is_advance",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "No\nYes",
|
||||
"print_hide": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "against_account",
|
||||
"fieldtype": "Text",
|
||||
"hidden": 1,
|
||||
"label": "Against Account",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "against_account",
|
||||
"oldfieldtype": "Text",
|
||||
"print_hide": 1
|
||||
}
|
||||
]
|
||||
@@ -1 +0,0 @@
|
||||
Backend scripts for Financial Statements (to be deprecated)
|
||||
@@ -1,166 +0,0 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
from webnotes.utils import flt, get_first_day, get_last_day, has_common
|
||||
import webnotes.defaults
|
||||
from accounts.utils import get_balance_on
|
||||
|
||||
class DocType:
|
||||
def __init__(self, doc, doclist):
|
||||
self.doc = doc
|
||||
self.doclist = doclist
|
||||
self.account_list = []
|
||||
self.ac_details = {} # key: account id, values: debit_or_credit, lft, rgt
|
||||
|
||||
self.period_list = []
|
||||
self.period_start_date = {}
|
||||
self.period_end_date = {}
|
||||
|
||||
self.fs_list = []
|
||||
self.root_bal = []
|
||||
self.flag = 0
|
||||
|
||||
# Get defaults on load of MIS, MIS - Comparison Report and Financial statements
|
||||
def get_comp(self):
|
||||
ret = {}
|
||||
type = []
|
||||
|
||||
ret['period'] = ['Annual','Half Yearly','Quarterly','Monthly']
|
||||
|
||||
from accounts.page.accounts_browser.accounts_browser import get_companies
|
||||
ret['company'] = get_companies()
|
||||
|
||||
#--- to get fiscal year and start_date of that fiscal year -----
|
||||
res = webnotes.conn.sql("select name, year_start_date from `tabFiscal Year`")
|
||||
ret['fiscal_year'] = [r[0] for r in res]
|
||||
ret['start_dates'] = {}
|
||||
for r in res:
|
||||
ret['start_dates'][r[0]] = str(r[1])
|
||||
|
||||
#--- from month and to month (for MIS - Comparison Report) -------
|
||||
month_list = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']
|
||||
fiscal_start_month = webnotes.conn.sql("select MONTH(year_start_date) from `tabFiscal Year` where name = %s",(webnotes.defaults.get_global_default("fiscal_year")))
|
||||
fiscal_start_month = fiscal_start_month and fiscal_start_month[0][0] or 1
|
||||
mon = ['']
|
||||
for i in range(fiscal_start_month,13): mon.append(month_list[i-1])
|
||||
for i in range(0,fiscal_start_month-1): mon.append(month_list[i])
|
||||
ret['month'] = mon
|
||||
|
||||
# get MIS Type on basis of roles of session user
|
||||
self.roles = webnotes.user.get_roles()
|
||||
if has_common(self.roles, ['Sales Manager']):
|
||||
type.append('Sales')
|
||||
if has_common(self.roles, ['Purchase Manager']):
|
||||
type.append('Purchase')
|
||||
ret['type'] = type
|
||||
return ret
|
||||
|
||||
|
||||
def get_statement(self, arg):
|
||||
self.return_data = []
|
||||
|
||||
# define periods
|
||||
arg = eval(arg)
|
||||
pl = ''
|
||||
|
||||
self.define_periods(arg['year'], arg['period'])
|
||||
self.return_data.append([4,'']+self.period_list)
|
||||
|
||||
|
||||
if arg['statement'] == 'Balance Sheet': pl = 'No'
|
||||
if arg['statement'] == 'Profit & Loss': pl = 'Yes'
|
||||
self.get_children('',0,pl,arg['company'], arg['year'])
|
||||
|
||||
return self.return_data
|
||||
|
||||
def get_children(self, parent_account, level, pl, company, fy):
|
||||
cl = webnotes.conn.sql("select distinct account_name, name, debit_or_credit, lft, rgt from `tabAccount` where ifnull(parent_account, '') = %s and ifnull(is_pl_account, 'No')=%s and company=%s and docstatus != 2 order by name asc", (parent_account, pl, company))
|
||||
level0_diff = [0 for p in self.period_list]
|
||||
if pl=='Yes' and level==0: # switch for income & expenses
|
||||
cl = [c for c in cl]
|
||||
cl.reverse()
|
||||
if cl:
|
||||
for c in cl:
|
||||
self.ac_details[c[1]] = [c[2], c[3], c[4]]
|
||||
bal_list = self.get_period_balance(c[1], pl)
|
||||
if level==0: # top level - put balances as totals
|
||||
self.return_data.append([level, c[0]] + ['' for b in bal_list])
|
||||
totals = bal_list
|
||||
for i in range(len(totals)): # make totals
|
||||
if c[2]=='Credit':
|
||||
level0_diff[i] += flt(totals[i])
|
||||
else:
|
||||
level0_diff[i] -= flt(totals[i])
|
||||
else:
|
||||
self.return_data.append([level, c[0]]+bal_list)
|
||||
|
||||
if level < 2:
|
||||
self.get_children(c[1], level+1, pl, company, fy)
|
||||
|
||||
# make totals - for top level
|
||||
if level==0:
|
||||
# add rows for profit / loss in B/S
|
||||
if pl=='No':
|
||||
if c[2]=='Credit':
|
||||
self.return_data.append([1, 'Total Liabilities'] + totals)
|
||||
level0_diff = [-i for i in level0_diff] # convert to debit
|
||||
self.return_data.append([5, 'Profit/Loss (Provisional)'] + level0_diff)
|
||||
for i in range(len(totals)): # make totals
|
||||
level0_diff[i] = flt(totals[i]) + level0_diff[i]
|
||||
else:
|
||||
self.return_data.append([4, 'Total '+c[0]] + totals)
|
||||
|
||||
# add rows for profit / loss in P/L
|
||||
else:
|
||||
if c[2]=='Debit':
|
||||
self.return_data.append([1, 'Total Expenses'] + totals)
|
||||
self.return_data.append([5, 'Profit/Loss (Provisional)'] + level0_diff)
|
||||
for i in range(len(totals)): # make totals
|
||||
level0_diff[i] = flt(totals[i]) + level0_diff[i]
|
||||
else:
|
||||
self.return_data.append([4, 'Total '+c[0]] + totals)
|
||||
|
||||
def define_periods(self, year, period):
|
||||
ysd = webnotes.conn.sql("select year_start_date from `tabFiscal Year` where name=%s", year)
|
||||
ysd = ysd and ysd[0][0] or ''
|
||||
|
||||
self.ysd = ysd
|
||||
|
||||
# year
|
||||
if period == 'Annual':
|
||||
pn = 'FY'+year
|
||||
self.period_list.append(pn)
|
||||
self.period_start_date[pn] = ysd
|
||||
self.period_end_date[pn] = get_last_day(get_first_day(ysd,0,11))
|
||||
|
||||
# quarter
|
||||
if period == 'Quarterly':
|
||||
for i in range(4):
|
||||
pn = 'Q'+str(i+1)
|
||||
self.period_list.append(pn)
|
||||
self.period_start_date[pn] = get_first_day(ysd,0,i*3)
|
||||
self.period_end_date[pn] = get_last_day(get_first_day(ysd,0,((i+1)*3)-1))
|
||||
|
||||
# month
|
||||
if period == 'Monthly':
|
||||
mlist = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']
|
||||
for i in range(12):
|
||||
fd = get_first_day(ysd,0,i)
|
||||
pn = mlist[fd.month-1]
|
||||
self.period_list.append(pn)
|
||||
|
||||
self.period_start_date[pn] = fd
|
||||
self.period_end_date[pn] = get_last_day(fd)
|
||||
|
||||
def get_period_balance(self, acc, pl):
|
||||
ret, i = [], 0
|
||||
for p in self.period_list:
|
||||
period_end_date = self.period_end_date[p].strftime('%Y-%m-%d')
|
||||
bal = get_balance_on(acc, period_end_date)
|
||||
if pl=='Yes':
|
||||
bal = bal - sum(ret)
|
||||
|
||||
ret.append(bal)
|
||||
return ret
|
||||
@@ -1,19 +0,0 @@
|
||||
[
|
||||
{
|
||||
"creation": "2012-03-27 14:35:49",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-07-10 14:54:11",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
{
|
||||
"doctype": "DocType",
|
||||
"issingle": 1,
|
||||
"module": "Accounts",
|
||||
"name": "__common__"
|
||||
},
|
||||
{
|
||||
"doctype": "DocType",
|
||||
"name": "MIS Control"
|
||||
}
|
||||
]
|
||||
@@ -1,12 +0,0 @@
|
||||
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
// License: GNU General Public License v3. See license.txt
|
||||
|
||||
cur_frm.set_query("default_account", function(doc) {
|
||||
return{
|
||||
filters: {
|
||||
'account_type': "Bank or Cash",
|
||||
"group_or_ledger": "Ledger",
|
||||
'company': doc.company
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -1,9 +0,0 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
class DocType:
|
||||
def __init__(self, d, dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
@@ -1,72 +0,0 @@
|
||||
[
|
||||
{
|
||||
"creation": "2012-12-04 17:49:20",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-07-05 14:46:28",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "harshada@webnotestech.com"
|
||||
},
|
||||
{
|
||||
"allow_rename": 1,
|
||||
"autoname": "field:mode_of_payment",
|
||||
"doctype": "DocType",
|
||||
"document_type": "Master",
|
||||
"icon": "icon-credit-card",
|
||||
"module": "Accounts",
|
||||
"name": "__common__"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"name": "__common__",
|
||||
"parent": "Mode of Payment",
|
||||
"parentfield": "fields",
|
||||
"parenttype": "DocType",
|
||||
"permlevel": 0,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"name": "__common__",
|
||||
"parent": "Mode of Payment",
|
||||
"parentfield": "permissions",
|
||||
"parenttype": "DocType",
|
||||
"permlevel": 0,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Accounts Manager",
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocType",
|
||||
"name": "Mode of Payment"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "mode_of_payment",
|
||||
"fieldtype": "Data",
|
||||
"label": "Mode of Payment",
|
||||
"oldfieldname": "mode_of_payment",
|
||||
"oldfieldtype": "Data",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "company",
|
||||
"fieldtype": "Link",
|
||||
"label": "Company",
|
||||
"options": "Company"
|
||||
},
|
||||
{
|
||||
"description": "Default Bank / Cash account will be automatically updated in POS Invoice when this mode is selected.",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "default_account",
|
||||
"fieldtype": "Link",
|
||||
"label": "Default Account",
|
||||
"options": "Account"
|
||||
},
|
||||
{
|
||||
"doctype": "DocPerm"
|
||||
}
|
||||
]
|
||||
@@ -1 +0,0 @@
|
||||
Tool for mapping (cancelling) unpaid invoices and payments.
|
||||
@@ -1,50 +0,0 @@
|
||||
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
// License: GNU General Public License v3. See license.txt
|
||||
|
||||
// Booking Entry Id
|
||||
// --------------------
|
||||
|
||||
cur_frm.add_fetch("account", "company", "company")
|
||||
|
||||
cur_frm.cscript.onload_post_render = function(doc) {
|
||||
$(cur_frm.get_field("reconcile").input).addClass("btn-info");
|
||||
}
|
||||
|
||||
cur_frm.cscript.refresh = function(doc) {
|
||||
cur_frm.set_intro("");
|
||||
if(!doc.voucher_no) {
|
||||
cur_frm.set_intro(wn._("Select the Invoice against which you want to allocate payments."));
|
||||
} else {
|
||||
cur_frm.set_intro(wn._("Set allocated amount against each Payment Entry and click 'Allocate'."));
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.fields_dict.voucher_no.get_query = function(doc) {
|
||||
// TO-do: check for pos, it should not come
|
||||
if (!doc.account) msgprint(wn._("Please select Account first"));
|
||||
else {
|
||||
return {
|
||||
doctype: doc.voucher_type,
|
||||
query: "accounts.doctype.payment_to_invoice_matching_tool.payment_to_invoice_matching_tool.gl_entry_details",
|
||||
filters: {
|
||||
"dt": doc.voucher_type,
|
||||
"acc": doc.account,
|
||||
"account_type": doc.account_type
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.cscript.voucher_no =function(doc, cdt, cdn) {
|
||||
return get_server_fields('get_voucher_details', '', '', doc, cdt, cdn, 1)
|
||||
}
|
||||
|
||||
cur_frm.cscript.account = function(doc, cdt, cdn) {
|
||||
return wn.call({
|
||||
doc: this.frm.doc,
|
||||
method: "set_account_type",
|
||||
callback: function(r) {
|
||||
if(!r.exc) refresh_field("account_type");
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -1,160 +0,0 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
from webnotes.utils import flt
|
||||
from webnotes.model.doc import addchild
|
||||
from webnotes.model.bean import getlist
|
||||
from webnotes import msgprint
|
||||
|
||||
class DocType:
|
||||
def __init__(self, doc, doclist):
|
||||
self.doc = doc
|
||||
self.doclist = doclist
|
||||
|
||||
def set_account_type(self):
|
||||
self.doc.account_type = self.doc.account and \
|
||||
webnotes.conn.get_value("Account", self.doc.account, "debit_or_credit").lower() or ""
|
||||
|
||||
def get_voucher_details(self):
|
||||
total_amount = webnotes.conn.sql("""select sum(%s) from `tabGL Entry`
|
||||
where voucher_type = %s and voucher_no = %s
|
||||
and account = %s""" %
|
||||
(self.doc.account_type, '%s', '%s', '%s'),
|
||||
(self.doc.voucher_type, self.doc.voucher_no, self.doc.account))
|
||||
|
||||
total_amount = total_amount and flt(total_amount[0][0]) or 0
|
||||
reconciled_payment = webnotes.conn.sql("""
|
||||
select sum(ifnull(%s, 0)) - sum(ifnull(%s, 0)) from `tabGL Entry` where
|
||||
against_voucher = %s and voucher_no != %s
|
||||
and account = %s""" %
|
||||
((self.doc.account_type == 'debit' and 'credit' or 'debit'), self.doc.account_type,
|
||||
'%s', '%s', '%s'), (self.doc.voucher_no, self.doc.voucher_no, self.doc.account))
|
||||
|
||||
reconciled_payment = reconciled_payment and flt(reconciled_payment[0][0]) or 0
|
||||
ret = {
|
||||
'total_amount': total_amount,
|
||||
'pending_amt_to_reconcile': total_amount - reconciled_payment
|
||||
}
|
||||
|
||||
return ret
|
||||
|
||||
def get_payment_entries(self):
|
||||
"""
|
||||
Get payment entries for the account and period
|
||||
Payment entry will be decided based on account type (Dr/Cr)
|
||||
"""
|
||||
|
||||
self.doclist = self.doc.clear_table(self.doclist, 'ir_payment_details')
|
||||
gle = self.get_gl_entries()
|
||||
self.create_payment_table(gle)
|
||||
|
||||
def get_gl_entries(self):
|
||||
self.validate_mandatory()
|
||||
dc = self.doc.account_type == 'debit' and 'credit' or 'debit'
|
||||
|
||||
cond = self.doc.from_date and " and t1.posting_date >= '" + self.doc.from_date + "'" or ""
|
||||
cond += self.doc.to_date and " and t1.posting_date <= '" + self.doc.to_date + "'"or ""
|
||||
|
||||
cond += self.doc.amt_greater_than and \
|
||||
' and t2.' + dc+' >= ' + self.doc.amt_greater_than or ''
|
||||
cond += self.doc.amt_less_than and \
|
||||
' and t2.' + dc+' <= ' + self.doc.amt_less_than or ''
|
||||
|
||||
gle = webnotes.conn.sql("""
|
||||
select t1.name as voucher_no, t1.posting_date, t1.total_debit as total_amt,
|
||||
sum(ifnull(t2.credit, 0)) - sum(ifnull(t2.debit, 0)) as amt_due, t1.remark,
|
||||
t2.against_account, t2.name as voucher_detail_no
|
||||
from `tabJournal Voucher` t1, `tabJournal Voucher Detail` t2
|
||||
where t1.name = t2.parent and t1.docstatus = 1 and t2.account = %s
|
||||
and ifnull(t2.against_voucher, '')='' and ifnull(t2.against_invoice, '')=''
|
||||
and ifnull(t2.against_jv, '')='' and t2.%s > 0 %s group by t1.name, t2.name """ %
|
||||
('%s', dc, cond), self.doc.account, as_dict=1)
|
||||
|
||||
return gle
|
||||
|
||||
def create_payment_table(self, gle):
|
||||
for d in gle:
|
||||
ch = addchild(self.doc, 'ir_payment_details',
|
||||
'Payment to Invoice Matching Tool Detail', self.doclist)
|
||||
ch.voucher_no = d.get('voucher_no')
|
||||
ch.posting_date = d.get('posting_date')
|
||||
ch.amt_due = self.doc.account_type == 'debit' and flt(d.get('amt_due')) \
|
||||
or -1*flt(d.get('amt_due'))
|
||||
ch.total_amt = flt(d.get('total_amt'))
|
||||
ch.against_account = d.get('against_account')
|
||||
ch.remarks = d.get('remark')
|
||||
ch.voucher_detail_no = d.get('voucher_detail_no')
|
||||
|
||||
def validate_mandatory(self):
|
||||
if not self.doc.account:
|
||||
msgprint("Please select Account first", raise_exception=1)
|
||||
|
||||
def reconcile(self):
|
||||
"""
|
||||
Links booking and payment voucher
|
||||
1. cancel payment voucher
|
||||
2. split into multiple rows if partially adjusted, assign against voucher
|
||||
3. submit payment voucher
|
||||
"""
|
||||
if not self.doc.voucher_no or not webnotes.conn.sql("""select name from `tab%s`
|
||||
where name = %s""" % (self.doc.voucher_type, '%s'), self.doc.voucher_no):
|
||||
msgprint("Please select valid Voucher No to proceed", raise_exception=1)
|
||||
|
||||
lst = []
|
||||
for d in getlist(self.doclist, 'ir_payment_details'):
|
||||
if flt(d.amt_to_be_reconciled) > 0:
|
||||
args = {
|
||||
'voucher_no' : d.voucher_no,
|
||||
'voucher_detail_no' : d.voucher_detail_no,
|
||||
'against_voucher_type' : self.doc.voucher_type,
|
||||
'against_voucher' : self.doc.voucher_no,
|
||||
'account' : self.doc.account,
|
||||
'is_advance' : 'No',
|
||||
'dr_or_cr' : self.doc.account_type=='debit' and 'credit' or 'debit',
|
||||
'unadjusted_amt' : flt(d.amt_due),
|
||||
'allocated_amt' : flt(d.amt_to_be_reconciled)
|
||||
}
|
||||
|
||||
lst.append(args)
|
||||
|
||||
if lst:
|
||||
from accounts.utils import reconcile_against_document
|
||||
reconcile_against_document(lst)
|
||||
msgprint("Successfully allocated.")
|
||||
else:
|
||||
msgprint("No amount allocated.", raise_exception=1)
|
||||
|
||||
def gl_entry_details(doctype, txt, searchfield, start, page_len, filters):
|
||||
from controllers.queries import get_match_cond
|
||||
|
||||
return webnotes.conn.sql("""select gle.voucher_no, gle.posting_date,
|
||||
gle.%(account_type)s from `tabGL Entry` gle
|
||||
where gle.account = '%(acc)s'
|
||||
and gle.voucher_type = '%(dt)s'
|
||||
and gle.voucher_no like '%(txt)s'
|
||||
and (ifnull(gle.against_voucher, '') = ''
|
||||
or ifnull(gle.against_voucher, '') = gle.voucher_no )
|
||||
and ifnull(gle.%(account_type)s, 0) > 0
|
||||
and (select ifnull(abs(sum(ifnull(debit, 0)) - sum(ifnull(credit, 0))), 0)
|
||||
from `tabGL Entry`
|
||||
where account = '%(acc)s'
|
||||
and against_voucher_type = '%(dt)s'
|
||||
and against_voucher = gle.voucher_no
|
||||
and voucher_no != gle.voucher_no)
|
||||
!= abs(ifnull(gle.debit, 0) - ifnull(gle.credit, 0))
|
||||
and if(gle.voucher_type='Sales Invoice', ifnull((select is_pos from `tabSales Invoice`
|
||||
where name=gle.voucher_no), 0), 0)=0
|
||||
%(mcond)s
|
||||
ORDER BY gle.posting_date desc, gle.voucher_no desc
|
||||
limit %(start)s, %(page_len)s""" % {
|
||||
"dt":filters["dt"],
|
||||
"acc":filters["acc"],
|
||||
"account_type": filters['account_type'],
|
||||
'mcond':get_match_cond(doctype, searchfield),
|
||||
'txt': "%%%s%%" % txt,
|
||||
"start": start,
|
||||
"page_len": page_len
|
||||
})
|
||||
@@ -1,196 +0,0 @@
|
||||
[
|
||||
{
|
||||
"creation": "2013-01-30 12:49:46",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-07-22 15:31:00",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
{
|
||||
"doctype": "DocType",
|
||||
"document_type": "Other",
|
||||
"hide_toolbar": 1,
|
||||
"icon": "icon-magic",
|
||||
"issingle": 1,
|
||||
"module": "Accounts",
|
||||
"name": "__common__"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"name": "__common__",
|
||||
"parent": "Payment to Invoice Matching Tool",
|
||||
"parentfield": "fields",
|
||||
"parenttype": "DocType",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"name": "__common__",
|
||||
"parent": "Payment to Invoice Matching Tool",
|
||||
"parentfield": "permissions",
|
||||
"parenttype": "DocType",
|
||||
"permlevel": 0,
|
||||
"read": 1,
|
||||
"report": 0,
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocType",
|
||||
"name": "Payment to Invoice Matching Tool"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "account",
|
||||
"fieldtype": "Link",
|
||||
"label": "Account",
|
||||
"options": "Account",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "account_type",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 1,
|
||||
"label": "Account Type",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "company",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 1,
|
||||
"label": "Company",
|
||||
"options": "Company",
|
||||
"print_hide": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "voucher_type",
|
||||
"fieldtype": "Select",
|
||||
"label": "Voucher Type",
|
||||
"options": "Sales Invoice\nPurchase Invoice\nJournal Voucher",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "voucher_no",
|
||||
"fieldtype": "Link",
|
||||
"label": "Voucher No",
|
||||
"options": "[Select]",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "pull_payment_entries",
|
||||
"fieldtype": "Button",
|
||||
"label": "Pull Payment Entries",
|
||||
"options": "get_payment_entries"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "column_break1",
|
||||
"fieldtype": "Column Break",
|
||||
"print_width": "50%",
|
||||
"width": "50%"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "total_amount",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Total Amount",
|
||||
"options": "Company:company:default_currency",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "pending_amt_to_reconcile",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Outstanding Amount",
|
||||
"options": "Company:company:default_currency",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "payment_entries",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Payment Entries"
|
||||
},
|
||||
{
|
||||
"description": "Update allocated amount in the above table and then click \"Allocate\" button",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "ir_payment_details",
|
||||
"fieldtype": "Table",
|
||||
"label": "Payment Entries",
|
||||
"options": "Payment to Invoice Matching Tool Detail"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "reconcile",
|
||||
"fieldtype": "Button",
|
||||
"label": "Allocate",
|
||||
"options": "reconcile"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "section_break0",
|
||||
"fieldtype": "Section Break",
|
||||
"options": "Simple"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "column_break2",
|
||||
"fieldtype": "Column Break",
|
||||
"label": "Filter By Date",
|
||||
"print_width": "50%",
|
||||
"width": "50%"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "from_date",
|
||||
"fieldtype": "Date",
|
||||
"label": "From Date"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "to_date",
|
||||
"fieldtype": "Date",
|
||||
"label": "To Date"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "help_html",
|
||||
"fieldtype": "HTML",
|
||||
"label": "Help HTML",
|
||||
"options": "Click \"Pull Payment Entries\" to refresh the table with filters."
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "column_break3",
|
||||
"fieldtype": "Column Break",
|
||||
"label": "Filter By Amount",
|
||||
"print_width": "50%",
|
||||
"width": "50%"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "amt_greater_than",
|
||||
"fieldtype": "Data",
|
||||
"label": "Amount >="
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "amt_less_than",
|
||||
"fieldtype": "Data",
|
||||
"label": "Amount <="
|
||||
},
|
||||
{
|
||||
"doctype": "DocPerm",
|
||||
"role": "Accounts Manager"
|
||||
},
|
||||
{
|
||||
"doctype": "DocPerm",
|
||||
"role": "Accounts User"
|
||||
}
|
||||
]
|
||||
@@ -1,8 +0,0 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import unittest
|
||||
import webnotes
|
||||
|
||||
test_records = []
|
||||
@@ -1 +0,0 @@
|
||||
Journal Voucher (payment) detail for matching to invoice.
|
||||
@@ -1,9 +0,0 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
class DocType:
|
||||
def __init__(self, d, dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
@@ -1,101 +0,0 @@
|
||||
[
|
||||
{
|
||||
"creation": "2013-02-22 01:27:39",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-07-10 14:54:11",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
{
|
||||
"doctype": "DocType",
|
||||
"istable": 1,
|
||||
"module": "Accounts",
|
||||
"name": "__common__"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"name": "__common__",
|
||||
"parent": "Payment to Invoice Matching Tool Detail",
|
||||
"parentfield": "fields",
|
||||
"parenttype": "DocType",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocType",
|
||||
"name": "Payment to Invoice Matching Tool Detail"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "voucher_no",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 1,
|
||||
"label": "Voucher No",
|
||||
"options": "Journal Voucher",
|
||||
"print_width": "140px",
|
||||
"read_only": 1,
|
||||
"reqd": 0,
|
||||
"width": "140px"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "amt_due",
|
||||
"fieldtype": "Currency",
|
||||
"in_list_view": 1,
|
||||
"label": "Unmatched Amount",
|
||||
"options": "Company:company:default_currency",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "amt_to_be_reconciled",
|
||||
"fieldtype": "Currency",
|
||||
"in_list_view": 1,
|
||||
"label": "Allocated Amount",
|
||||
"options": "Company:company:default_currency",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "posting_date",
|
||||
"fieldtype": "Date",
|
||||
"in_list_view": 1,
|
||||
"label": "Posting Date",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "total_amt",
|
||||
"fieldtype": "Currency",
|
||||
"in_list_view": 1,
|
||||
"label": "Total Amount",
|
||||
"options": "Company:company:default_currency",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "against_account",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
"label": "Against Account",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "remarks",
|
||||
"fieldtype": "Small Text",
|
||||
"label": "Remarks",
|
||||
"print_width": "200px",
|
||||
"read_only": 1,
|
||||
"width": "200px"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "voucher_detail_no",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 1,
|
||||
"label": "Voucher Detail No",
|
||||
"print_hide": 1,
|
||||
"read_only": 1,
|
||||
"reqd": 0
|
||||
}
|
||||
]
|
||||
@@ -1,103 +0,0 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
from webnotes.utils import cstr, flt, getdate
|
||||
from webnotes import msgprint, _
|
||||
from controllers.accounts_controller import AccountsController
|
||||
|
||||
class DocType(AccountsController):
|
||||
def __init__(self,d,dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
self.year_start_date = ''
|
||||
|
||||
def validate(self):
|
||||
self.validate_account_head()
|
||||
self.validate_posting_date()
|
||||
self.validate_pl_balances()
|
||||
|
||||
def on_submit(self):
|
||||
self.make_gl_entries()
|
||||
|
||||
def on_cancel(self):
|
||||
webnotes.conn.sql("""delete from `tabGL Entry`
|
||||
where voucher_type = 'Period Closing Voucher' and voucher_no=%s""", self.doc.name)
|
||||
|
||||
def validate_account_head(self):
|
||||
debit_or_credit, is_pl_account = webnotes.conn.get_value("Account",
|
||||
self.doc.closing_account_head, ["debit_or_credit", "is_pl_account"])
|
||||
|
||||
if debit_or_credit != 'Credit' or is_pl_account != 'No':
|
||||
webnotes.throw(_("Account") + ": " + self.doc.closing_account_head +
|
||||
_("must be a Liability account"))
|
||||
|
||||
def validate_posting_date(self):
|
||||
from accounts.utils import get_fiscal_year
|
||||
self.year_start_date = get_fiscal_year(self.doc.posting_date, self.doc.fiscal_year)[1]
|
||||
|
||||
pce = webnotes.conn.sql("""select name from `tabPeriod Closing Voucher`
|
||||
where posting_date > %s and fiscal_year = %s and docstatus = 1""",
|
||||
(self.doc.posting_date, self.doc.fiscal_year))
|
||||
if pce and pce[0][0]:
|
||||
webnotes.throw(_("Another Period Closing Entry") + ": " + cstr(pce[0][0]) +
|
||||
_("has been made after posting date") + ": " + self.doc.posting_date)
|
||||
|
||||
def validate_pl_balances(self):
|
||||
income_bal = webnotes.conn.sql("""
|
||||
select sum(ifnull(t1.debit,0))-sum(ifnull(t1.credit,0))
|
||||
from `tabGL Entry` t1, tabAccount t2
|
||||
where t1.account = t2.name and t1.posting_date between %s and %s
|
||||
and t2.debit_or_credit = 'Credit' and t2.is_pl_account = 'Yes'
|
||||
and t2.docstatus < 2 and t2.company = %s""",
|
||||
(self.year_start_date, self.doc.posting_date, self.doc.company))
|
||||
|
||||
expense_bal = webnotes.conn.sql("""
|
||||
select sum(ifnull(t1.debit,0))-sum(ifnull(t1.credit,0))
|
||||
from `tabGL Entry` t1, tabAccount t2
|
||||
where t1.account = t2.name and t1.posting_date between %s and %s
|
||||
and t2.debit_or_credit = 'Debit' and t2.is_pl_account = 'Yes'
|
||||
and t2.docstatus < 2 and t2.company=%s""",
|
||||
(self.year_start_date, self.doc.posting_date, self.doc.company))
|
||||
|
||||
income_bal = income_bal and income_bal[0][0] or 0
|
||||
expense_bal = expense_bal and expense_bal[0][0] or 0
|
||||
|
||||
if not income_bal and not expense_bal:
|
||||
webnotes.throw(_("Both Income and Expense balances are zero. \
|
||||
No Need to make Period Closing Entry."))
|
||||
|
||||
def get_pl_balances(self):
|
||||
"""Get balance for pl accounts"""
|
||||
return webnotes.conn.sql("""
|
||||
select t1.account, sum(ifnull(t1.debit,0))-sum(ifnull(t1.credit,0)) as balance
|
||||
from `tabGL Entry` t1, `tabAccount` t2
|
||||
where t1.account = t2.name and ifnull(t2.is_pl_account, 'No') = 'Yes'
|
||||
and t2.docstatus < 2 and t2.company = %s
|
||||
and t1.posting_date between %s and %s
|
||||
group by t1.account
|
||||
""", (self.doc.company, self.year_start_date, self.doc.posting_date), as_dict=1)
|
||||
|
||||
def make_gl_entries(self):
|
||||
gl_entries = []
|
||||
net_pl_balance = 0
|
||||
pl_accounts = self.get_pl_balances()
|
||||
for acc in pl_accounts:
|
||||
if flt(acc.balance):
|
||||
gl_entries.append(self.get_gl_dict({
|
||||
"account": acc.account,
|
||||
"debit": abs(flt(acc.balance)) if flt(acc.balance) < 0 else 0,
|
||||
"credit": abs(flt(acc.balance)) if flt(acc.balance) > 0 else 0,
|
||||
}))
|
||||
|
||||
net_pl_balance += flt(acc.balance)
|
||||
|
||||
if net_pl_balance:
|
||||
gl_entries.append(self.get_gl_dict({
|
||||
"account": self.doc.closing_account_head,
|
||||
"debit": abs(net_pl_balance) if net_pl_balance > 0 else 0,
|
||||
"credit": abs(net_pl_balance) if net_pl_balance < 0 else 0
|
||||
}))
|
||||
|
||||
from accounts.general_ledger import make_gl_entries
|
||||
make_gl_entries(gl_entries)
|
||||
@@ -1,141 +0,0 @@
|
||||
[
|
||||
{
|
||||
"creation": "2013-01-10 16:34:07",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-08-12 17:13:23",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "jai@webnotestech.com"
|
||||
},
|
||||
{
|
||||
"autoname": "PCE/.###",
|
||||
"doctype": "DocType",
|
||||
"icon": "icon-file-text",
|
||||
"is_submittable": 1,
|
||||
"module": "Accounts",
|
||||
"name": "__common__",
|
||||
"search_fields": "posting_date, fiscal_year"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"name": "__common__",
|
||||
"parent": "Period Closing Voucher",
|
||||
"parentfield": "fields",
|
||||
"parenttype": "DocType",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"amend": 1,
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"name": "__common__",
|
||||
"parent": "Period Closing Voucher",
|
||||
"parentfield": "permissions",
|
||||
"parenttype": "DocType",
|
||||
"permlevel": 0,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"submit": 1,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocType",
|
||||
"name": "Period Closing Voucher"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "column_break0",
|
||||
"fieldtype": "Column Break",
|
||||
"oldfieldtype": "Column Break",
|
||||
"width": "50%"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "transaction_date",
|
||||
"fieldtype": "Date",
|
||||
"label": "Transaction Date",
|
||||
"oldfieldname": "transaction_date",
|
||||
"oldfieldtype": "Date"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "posting_date",
|
||||
"fieldtype": "Date",
|
||||
"label": "Posting Date",
|
||||
"oldfieldname": "posting_date",
|
||||
"oldfieldtype": "Date",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "fiscal_year",
|
||||
"fieldtype": "Select",
|
||||
"label": "Closing Fiscal Year",
|
||||
"oldfieldname": "fiscal_year",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "link:Fiscal Year",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "amended_from",
|
||||
"fieldtype": "Data",
|
||||
"label": "Amended From",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "amended_from",
|
||||
"oldfieldtype": "Data",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "company",
|
||||
"fieldtype": "Select",
|
||||
"label": "Company",
|
||||
"oldfieldname": "company",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "link:Company",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "column_break1",
|
||||
"fieldtype": "Column Break",
|
||||
"oldfieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"description": "The account head under Liability, in which Profit/Loss will be booked",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "closing_account_head",
|
||||
"fieldtype": "Link",
|
||||
"label": "Closing Account Head",
|
||||
"oldfieldname": "closing_account_head",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Account",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "coa_help",
|
||||
"fieldtype": "HTML",
|
||||
"label": "CoA Help",
|
||||
"oldfieldtype": "HTML",
|
||||
"options": "<a href=\"#!Accounts Browser/Account\">To manage Account Head, click here</a>"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "remarks",
|
||||
"fieldtype": "Small Text",
|
||||
"label": "Remarks",
|
||||
"oldfieldname": "remarks",
|
||||
"oldfieldtype": "Small Text",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocPerm",
|
||||
"role": "System Manager"
|
||||
},
|
||||
{
|
||||
"doctype": "DocPerm",
|
||||
"role": "Accounts Manager"
|
||||
}
|
||||
]
|
||||
@@ -1,56 +0,0 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import unittest
|
||||
import webnotes
|
||||
|
||||
class TestPeriodClosingVoucher(unittest.TestCase):
|
||||
def test_closing_entry(self):
|
||||
# clear GL Entries
|
||||
webnotes.conn.sql("""delete from `tabGL Entry`""")
|
||||
|
||||
from accounts.doctype.journal_voucher.test_journal_voucher import test_records as jv_records
|
||||
jv = webnotes.bean(copy=jv_records[2])
|
||||
jv.insert()
|
||||
jv.submit()
|
||||
|
||||
jv1 = webnotes.bean(copy=jv_records[0])
|
||||
jv1.doclist[2].account = "_Test Account Cost for Goods Sold - _TC"
|
||||
jv1.doclist[2].debit = 600.0
|
||||
jv1.doclist[1].credit = 600.0
|
||||
jv1.insert()
|
||||
jv1.submit()
|
||||
|
||||
pcv = webnotes.bean(copy=test_record)
|
||||
pcv.insert()
|
||||
pcv.submit()
|
||||
|
||||
gl_entries = webnotes.conn.sql("""select account, debit, credit
|
||||
from `tabGL Entry` where voucher_type='Period Closing Voucher' and voucher_no=%s
|
||||
order by account asc, debit asc""", pcv.doc.name, as_dict=1)
|
||||
|
||||
self.assertTrue(gl_entries)
|
||||
|
||||
expected_gl_entries = sorted([
|
||||
["_Test Account Reserves and Surplus - _TC", 200.0, 0.0],
|
||||
["_Test Account Cost for Goods Sold - _TC", 0.0, 600.0],
|
||||
["Sales - _TC", 400.0, 0.0]
|
||||
])
|
||||
for i, gle in enumerate(gl_entries):
|
||||
self.assertEquals(expected_gl_entries[i][0], gle.account)
|
||||
self.assertEquals(expected_gl_entries[i][1], gle.debit)
|
||||
self.assertEquals(expected_gl_entries[i][2], gle.credit)
|
||||
|
||||
|
||||
test_dependencies = ["Customer", "Cost Center"]
|
||||
|
||||
test_record = [{
|
||||
"doctype": "Period Closing Voucher",
|
||||
"closing_account_head": "_Test Account Reserves and Surplus - _TC",
|
||||
"company": "_Test Company",
|
||||
"fiscal_year": "_Test Fiscal Year 2013",
|
||||
"posting_date": "2013-03-31",
|
||||
"remarks": "test"
|
||||
}]
|
||||
@@ -1,78 +0,0 @@
|
||||
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
// License: GNU General Public License v3. See license.txt
|
||||
|
||||
cur_frm.cscript.onload = function(doc,cdt,cdn){
|
||||
return $c_obj(make_doclist(cdt,cdn),'get_series','',function(r,rt){
|
||||
if(r.message) set_field_options('naming_series', r.message);
|
||||
});
|
||||
|
||||
cur_frm.set_query("selling_price_list", function() {
|
||||
return { filters: { selling: 1 } };
|
||||
});
|
||||
}
|
||||
|
||||
//cash bank account
|
||||
//------------------------------------
|
||||
cur_frm.fields_dict['cash_bank_account'].get_query = function(doc,cdt,cdn) {
|
||||
return{
|
||||
filters:{
|
||||
'debit_or_credit': "Debit",
|
||||
'is_pl_account': "No",
|
||||
'group_or_ledger': "Ledger",
|
||||
'company': doc.company
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Income Account
|
||||
// --------------------------------
|
||||
cur_frm.fields_dict['income_account'].get_query = function(doc,cdt,cdn) {
|
||||
return{
|
||||
filters:{
|
||||
'debit_or_credit': "Credit",
|
||||
'group_or_ledger': "Ledger",
|
||||
'company': doc.company,
|
||||
'account_type': "Income Account"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Cost Center
|
||||
// -----------------------------
|
||||
cur_frm.fields_dict['cost_center'].get_query = function(doc,cdt,cdn) {
|
||||
return{
|
||||
filters:{
|
||||
'company': doc.company,
|
||||
'group_or_ledger': "Ledger"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Expense Account
|
||||
// -----------------------------
|
||||
cur_frm.fields_dict["expense_account"].get_query = function(doc) {
|
||||
return {
|
||||
filters: {
|
||||
"is_pl_account": "Yes",
|
||||
"debit_or_credit": "Debit",
|
||||
"company": doc.company,
|
||||
"group_or_ledger": "Ledger"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------ Get Print Heading ------------------------------------
|
||||
cur_frm.fields_dict['select_print_heading'].get_query = function(doc, cdt, cdn) {
|
||||
return{
|
||||
filters:[
|
||||
['Print Heading', 'docstatus', '!=', 2]
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
cur_frm.fields_dict.user.get_query = function(doc,cdt,cdn) {
|
||||
return{ query:"core.doctype.profile.profile.profile_query"}
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
from webnotes import msgprint, _
|
||||
from webnotes.utils import cint
|
||||
|
||||
class DocType:
|
||||
def __init__(self,doc,doclist):
|
||||
self.doc, self.doclist = doc,doclist
|
||||
|
||||
def get_series(self):
|
||||
import webnotes.model.doctype
|
||||
docfield = webnotes.model.doctype.get('Sales Invoice')
|
||||
series = [d.options for d in docfield
|
||||
if d.doctype == 'DocField' and d.fieldname == 'naming_series']
|
||||
return series and series[0] or ''
|
||||
|
||||
def validate(self):
|
||||
self.check_for_duplicate()
|
||||
self.validate_expense_account()
|
||||
self.validate_all_link_fields()
|
||||
|
||||
def check_for_duplicate(self):
|
||||
res = webnotes.conn.sql("""select name, user from `tabPOS Setting`
|
||||
where ifnull(user, '') = %s and name != %s and company = %s""",
|
||||
(self.doc.user, self.doc.name, self.doc.company))
|
||||
if res:
|
||||
if res[0][1]:
|
||||
msgprint("POS Setting '%s' already created for user: '%s' and company: '%s'" %
|
||||
(res[0][0], res[0][1], self.doc.company), raise_exception=1)
|
||||
else:
|
||||
msgprint("Global POS Setting already created - %s for this company: '%s'" %
|
||||
(res[0][0], self.doc.company), raise_exception=1)
|
||||
|
||||
def validate_expense_account(self):
|
||||
if cint(webnotes.defaults.get_global_default("auto_accounting_for_stock")) \
|
||||
and not self.doc.expense_account:
|
||||
msgprint(_("Expense Account is mandatory"), raise_exception=1)
|
||||
|
||||
def validate_all_link_fields(self):
|
||||
accounts = {"Account": [self.doc.cash_bank_account, self.doc.income_account,
|
||||
self.doc.expense_account], "Cost Center": [self.doc.cost_center],
|
||||
"Warehouse": [self.doc.warehouse]}
|
||||
|
||||
for link_dt, dn_list in accounts.items():
|
||||
for link_dn in dn_list:
|
||||
if link_dn and not webnotes.conn.exists({"doctype": link_dt,
|
||||
"company": self.doc.company, "name": link_dn}):
|
||||
webnotes.throw(link_dn +_(" does not belong to ") + self.doc.company)
|
||||
|
||||
def on_update(self):
|
||||
webnotes.defaults.clear_default("is_pos")
|
||||
|
||||
pos_view_users = webnotes.conn.sql_list("""select user from `tabPOS Setting`""")
|
||||
for user in pos_view_users:
|
||||
if user:
|
||||
webnotes.defaults.set_user_default("is_pos", 1, user)
|
||||
else:
|
||||
webnotes.defaults.set_global_default("is_pos", 1)
|
||||
|
||||
def on_trash(self):
|
||||
self.on_update()
|
||||
@@ -1,242 +0,0 @@
|
||||
[
|
||||
{
|
||||
"creation": "2013-05-24 12:15:51",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-11-02 16:58:38",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
{
|
||||
"autoname": "POS/.####",
|
||||
"doctype": "DocType",
|
||||
"icon": "icon-cog",
|
||||
"module": "Accounts",
|
||||
"name": "__common__"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"name": "__common__",
|
||||
"parent": "POS Setting",
|
||||
"parentfield": "fields",
|
||||
"parenttype": "DocType",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocPerm",
|
||||
"name": "__common__",
|
||||
"parent": "POS Setting",
|
||||
"parentfield": "permissions",
|
||||
"parenttype": "DocType",
|
||||
"permlevel": 0,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"submit": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocType",
|
||||
"name": "POS Setting"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "user",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 1,
|
||||
"label": "User",
|
||||
"oldfieldname": "user",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Profile",
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"description": "<a href=\"#Sales Browser/Territory\">Add / Edit</a>",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "territory",
|
||||
"fieldtype": "Link",
|
||||
"label": "Territory",
|
||||
"oldfieldname": "territory",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Territory",
|
||||
"read_only": 0,
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "naming_series",
|
||||
"fieldtype": "Select",
|
||||
"label": "Series",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "naming_series",
|
||||
"oldfieldtype": "Select",
|
||||
"read_only": 0,
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "currency",
|
||||
"fieldtype": "Link",
|
||||
"label": "Currency",
|
||||
"oldfieldname": "currency",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "Currency",
|
||||
"read_only": 0,
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "selling_price_list",
|
||||
"fieldtype": "Link",
|
||||
"label": "Price List",
|
||||
"oldfieldname": "price_list_name",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "Price List",
|
||||
"read_only": 0,
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "company",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 1,
|
||||
"label": "Company",
|
||||
"oldfieldname": "company",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Company",
|
||||
"read_only": 0,
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "column_break0",
|
||||
"fieldtype": "Column Break",
|
||||
"oldfieldtype": "Column Break",
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"default": "1",
|
||||
"description": "Create Stock Ledger Entries when you submit a Sales Invoice",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "update_stock",
|
||||
"fieldtype": "Check",
|
||||
"label": "Update Stock",
|
||||
"reqd": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "customer",
|
||||
"fieldtype": "Link",
|
||||
"label": "Customer",
|
||||
"oldfieldname": "customer_account",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Customer",
|
||||
"read_only": 0,
|
||||
"reqd": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "cash_bank_account",
|
||||
"fieldtype": "Link",
|
||||
"label": "Cash/Bank Account",
|
||||
"oldfieldname": "cash_bank_account",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Account",
|
||||
"read_only": 0,
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "income_account",
|
||||
"fieldtype": "Link",
|
||||
"label": "Income Account",
|
||||
"oldfieldname": "income_account",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Account",
|
||||
"read_only": 0,
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:sys_defaults.auto_accounting_for_stock",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "expense_account",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"label": "Expense Account",
|
||||
"options": "Account",
|
||||
"print_hide": 1,
|
||||
"read_only": 0,
|
||||
"reqd": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "warehouse",
|
||||
"fieldtype": "Link",
|
||||
"label": "Warehouse",
|
||||
"oldfieldname": "warehouse",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Warehouse",
|
||||
"read_only": 0,
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "cost_center",
|
||||
"fieldtype": "Link",
|
||||
"label": "Cost Center",
|
||||
"oldfieldname": "cost_center",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Cost Center",
|
||||
"read_only": 0,
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "charge",
|
||||
"fieldtype": "Link",
|
||||
"label": "Charge",
|
||||
"oldfieldname": "charge",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Sales Taxes and Charges Master",
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "letter_head",
|
||||
"fieldtype": "Select",
|
||||
"label": "Letter Head",
|
||||
"oldfieldname": "letter_head",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "link:Letter Head",
|
||||
"print_hide": 1,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "tc_name",
|
||||
"fieldtype": "Link",
|
||||
"label": "Terms and Conditions",
|
||||
"oldfieldname": "tc_name",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Terms and Conditions",
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "select_print_heading",
|
||||
"fieldtype": "Select",
|
||||
"in_filter": 0,
|
||||
"label": "Print Heading",
|
||||
"oldfieldname": "select_print_heading",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "link:Print Heading",
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"role": "Accounts Manager",
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocPerm",
|
||||
"role": "Accounts User"
|
||||
}
|
||||
]
|
||||
@@ -1,19 +0,0 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
test_records = [
|
||||
[{
|
||||
"doctype": "POS Setting",
|
||||
"name": "_Test POS Setting",
|
||||
"currency": "INR",
|
||||
"selling_price_list": "_Test Price List",
|
||||
"company": "_Test Company",
|
||||
"warehouse": "_Test Warehouse - _TC",
|
||||
"territory": "_Test Territory",
|
||||
"cash_bank_account": "_Test Account Bank Account - _TC",
|
||||
"income_account": "Sales - _TC",
|
||||
"cost_center": "_Test Cost Center - _TC",
|
||||
"expense_account": "_Test Account Cost for Goods Sold - _TC",
|
||||
"naming_series": "_T-Sales Invoice-"
|
||||
}]
|
||||
]
|
||||
@@ -1,220 +0,0 @@
|
||||
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
// License: GNU General Public License v3. See license.txt
|
||||
|
||||
cur_frm.cscript.tname = "Purchase Invoice Item";
|
||||
cur_frm.cscript.fname = "entries";
|
||||
cur_frm.cscript.other_fname = "purchase_tax_details";
|
||||
|
||||
wn.provide("erpnext.accounts");
|
||||
wn.require('app/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.js');
|
||||
wn.require('app/buying/doctype/purchase_common/purchase_common.js');
|
||||
wn.require('app/accounts/doctype/sales_invoice/pos.js');
|
||||
|
||||
erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({
|
||||
onload: function() {
|
||||
this._super();
|
||||
|
||||
if(!this.frm.doc.__islocal) {
|
||||
// show credit_to in print format
|
||||
if(!this.frm.doc.supplier && this.frm.doc.credit_to) {
|
||||
this.frm.set_df_property("credit_to", "print_hide", 0);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
refresh: function(doc) {
|
||||
this._super();
|
||||
|
||||
// Show / Hide button
|
||||
if(doc.docstatus==1 && doc.outstanding_amount > 0)
|
||||
this.frm.add_custom_button(wn._('Make Payment Entry'), this.make_bank_voucher);
|
||||
|
||||
if(doc.docstatus==1) {
|
||||
cur_frm.appframe.add_button(wn._('View Ledger'), function() {
|
||||
wn.route_options = {
|
||||
"voucher_no": doc.name,
|
||||
"from_date": doc.posting_date,
|
||||
"to_date": doc.posting_date,
|
||||
"company": doc.company,
|
||||
group_by_voucher: 0
|
||||
};
|
||||
wn.set_route("query-report", "General Ledger");
|
||||
}, "icon-table");
|
||||
}
|
||||
|
||||
if(doc.docstatus===0) {
|
||||
cur_frm.add_custom_button(wn._('From Purchase Order'),
|
||||
function() {
|
||||
wn.model.map_current_doc({
|
||||
method: "buying.doctype.purchase_order.purchase_order.make_purchase_invoice",
|
||||
source_doctype: "Purchase Order",
|
||||
get_query_filters: {
|
||||
supplier: cur_frm.doc.supplier || undefined,
|
||||
docstatus: 1,
|
||||
status: ["!=", "Stopped"],
|
||||
per_billed: ["<", 99.99],
|
||||
company: cur_frm.doc.company
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
cur_frm.add_custom_button(wn._('From Purchase Receipt'),
|
||||
function() {
|
||||
wn.model.map_current_doc({
|
||||
method: "stock.doctype.purchase_receipt.purchase_receipt.make_purchase_invoice",
|
||||
source_doctype: "Purchase Receipt",
|
||||
get_query_filters: {
|
||||
supplier: cur_frm.doc.supplier || undefined,
|
||||
docstatus: 1,
|
||||
company: cur_frm.doc.company
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
this.is_opening(doc);
|
||||
},
|
||||
|
||||
credit_to: function() {
|
||||
this.supplier();
|
||||
},
|
||||
|
||||
write_off_amount: function() {
|
||||
this.calculate_outstanding_amount();
|
||||
this.frm.refresh_fields();
|
||||
},
|
||||
|
||||
allocated_amount: function() {
|
||||
this.calculate_total_advance("Purchase Invoice", "advance_allocation_details");
|
||||
this.frm.refresh_fields();
|
||||
},
|
||||
|
||||
tc_name: function() {
|
||||
this.get_terms();
|
||||
},
|
||||
|
||||
entries_add: function(doc, cdt, cdn) {
|
||||
var row = wn.model.get_doc(cdt, cdn);
|
||||
this.frm.script_manager.copy_from_first_row("entries", row, ["expense_head", "cost_center"]);
|
||||
}
|
||||
});
|
||||
|
||||
cur_frm.script_manager.make(erpnext.accounts.PurchaseInvoice);
|
||||
|
||||
cur_frm.cscript.is_opening = function(doc, dt, dn) {
|
||||
hide_field('aging_date');
|
||||
if (doc.is_opening == 'Yes') unhide_field('aging_date');
|
||||
}
|
||||
|
||||
cur_frm.cscript.make_bank_voucher = function() {
|
||||
return wn.call({
|
||||
method: "accounts.doctype.journal_voucher.journal_voucher.get_payment_entry_from_purchase_invoice",
|
||||
args: {
|
||||
"purchase_invoice": cur_frm.doc.name,
|
||||
},
|
||||
callback: function(r) {
|
||||
var doclist = wn.model.sync(r.message);
|
||||
wn.set_route("Form", doclist[0].doctype, doclist[0].name);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
cur_frm.fields_dict['supplier_address'].get_query = function(doc, cdt, cdn) {
|
||||
return{
|
||||
filters:{'supplier': doc.supplier}
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
|
||||
return{
|
||||
filters:{'supplier': doc.supplier}
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['entries'].grid.get_field("item_code").get_query = function(doc, cdt, cdn) {
|
||||
return {
|
||||
query:"controllers.queries.item_query",
|
||||
filters:{
|
||||
'is_purchase_item': 'Yes'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['credit_to'].get_query = function(doc) {
|
||||
return{
|
||||
filters:{
|
||||
'debit_or_credit': 'Credit',
|
||||
'is_pl_account': 'No',
|
||||
'group_or_ledger': 'Ledger',
|
||||
'company': doc.company
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get Print Heading
|
||||
cur_frm.fields_dict['select_print_heading'].get_query = function(doc, cdt, cdn) {
|
||||
return{
|
||||
filters:[
|
||||
['Print Heading', 'docstatus', '!=', 2]
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.set_query("expense_head", "entries", function(doc) {
|
||||
return{
|
||||
query: "accounts.doctype.purchase_invoice.purchase_invoice.get_expense_account",
|
||||
filters: {'company': doc.company}
|
||||
}
|
||||
});
|
||||
|
||||
cur_frm.cscript.expense_head = function(doc, cdt, cdn){
|
||||
var d = locals[cdt][cdn];
|
||||
if(d.idx == 1 && d.expense_head){
|
||||
var cl = getchildren('Purchase Invoice Item', doc.name, 'entries', doc.doctype);
|
||||
for(var i = 0; i < cl.length; i++){
|
||||
if(!cl[i].expense_head) cl[i].expense_head = d.expense_head;
|
||||
}
|
||||
}
|
||||
refresh_field('entries');
|
||||
}
|
||||
|
||||
cur_frm.fields_dict["entries"].grid.get_field("cost_center").get_query = function(doc) {
|
||||
return {
|
||||
filters: {
|
||||
'company': doc.company,
|
||||
'group_or_ledger': 'Ledger'
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.cscript.cost_center = function(doc, cdt, cdn){
|
||||
var d = locals[cdt][cdn];
|
||||
if(d.idx == 1 && d.cost_center){
|
||||
var cl = getchildren('Purchase Invoice Item', doc.name, 'entries', doc.doctype);
|
||||
for(var i = 0; i < cl.length; i++){
|
||||
if(!cl[i].cost_center) cl[i].cost_center = d.cost_center;
|
||||
}
|
||||
}
|
||||
refresh_field('entries');
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['entries'].grid.get_field('project_name').get_query = function(doc, cdt, cdn) {
|
||||
return{
|
||||
filters:[
|
||||
['Project', 'status', 'not in', 'Completed, Cancelled']
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
cur_frm.cscript.select_print_heading = function(doc,cdt,cdn){
|
||||
if(doc.select_print_heading){
|
||||
// print heading
|
||||
cur_frm.pformat.print_heading = doc.select_print_heading;
|
||||
}
|
||||
else
|
||||
cur_frm.pformat.print_heading = wn._("Purchase Invoice");
|
||||
}
|
||||
@@ -1,461 +0,0 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
from webnotes.utils import add_days, cint, cstr, flt, formatdate
|
||||
from webnotes.model.bean import getlist
|
||||
from webnotes.model.code import get_obj
|
||||
from webnotes import msgprint, _
|
||||
from setup.utils import get_company_currency
|
||||
|
||||
import webnotes.defaults
|
||||
|
||||
|
||||
from controllers.buying_controller import BuyingController
|
||||
class DocType(BuyingController):
|
||||
def __init__(self,d,dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
self.tname = 'Purchase Invoice Item'
|
||||
self.fname = 'entries'
|
||||
self.status_updater = [{
|
||||
'source_dt': 'Purchase Invoice Item',
|
||||
'target_dt': 'Purchase Order Item',
|
||||
'join_field': 'po_detail',
|
||||
'target_field': 'billed_amt',
|
||||
'target_parent_dt': 'Purchase Order',
|
||||
'target_parent_field': 'per_billed',
|
||||
'target_ref_field': 'import_amount',
|
||||
'source_field': 'import_amount',
|
||||
'percent_join_field': 'purchase_order',
|
||||
}]
|
||||
|
||||
def validate(self):
|
||||
super(DocType, self).validate()
|
||||
|
||||
self.po_required()
|
||||
self.pr_required()
|
||||
self.check_active_purchase_items()
|
||||
self.check_conversion_rate()
|
||||
self.validate_bill_no()
|
||||
self.validate_credit_acc()
|
||||
self.clear_unallocated_advances("Purchase Invoice Advance", "advance_allocation_details")
|
||||
self.check_for_acc_head_of_supplier()
|
||||
self.check_for_stopped_status()
|
||||
self.validate_with_previous_doc()
|
||||
self.validate_uom_is_integer("uom", "qty")
|
||||
|
||||
if not self.doc.is_opening:
|
||||
self.doc.is_opening = 'No'
|
||||
|
||||
self.set_aging_date()
|
||||
|
||||
#set against account for credit to
|
||||
self.set_against_expense_account()
|
||||
|
||||
self.validate_write_off_account()
|
||||
self.update_raw_material_cost()
|
||||
self.update_valuation_rate("entries")
|
||||
self.validate_multiple_billing("Purchase Receipt", "pr_detail", "import_amount",
|
||||
"purchase_receipt_details")
|
||||
|
||||
def get_credit_to(self):
|
||||
ret = {}
|
||||
if self.doc.supplier:
|
||||
acc_head = webnotes.conn.sql("""select name, credit_days from `tabAccount`
|
||||
where (name = %s or (master_name = %s and master_type = 'supplier'))
|
||||
and docstatus != 2 and company = %s""",
|
||||
(cstr(self.doc.supplier) + " - " + self.company_abbr,
|
||||
self.doc.supplier, self.doc.company))
|
||||
|
||||
if acc_head and acc_head[0][0]:
|
||||
ret['credit_to'] = acc_head[0][0]
|
||||
if not self.doc.due_date:
|
||||
ret['due_date'] = add_days(cstr(self.doc.posting_date),
|
||||
acc_head and cint(acc_head[0][1]) or 0)
|
||||
elif not acc_head:
|
||||
msgprint("%s does not have an Account Head in %s. \
|
||||
You must first create it from the Supplier Master" % \
|
||||
(self.doc.supplier, self.doc.company))
|
||||
return ret
|
||||
|
||||
def set_supplier_defaults(self):
|
||||
self.doc.fields.update(self.get_credit_to())
|
||||
super(DocType, self).set_supplier_defaults()
|
||||
|
||||
def get_advances(self):
|
||||
super(DocType, self).get_advances(self.doc.credit_to,
|
||||
"Purchase Invoice Advance", "advance_allocation_details", "debit")
|
||||
|
||||
def check_active_purchase_items(self):
|
||||
for d in getlist(self.doclist, 'entries'):
|
||||
if d.item_code: # extra condn coz item_code is not mandatory in PV
|
||||
valid_item = webnotes.conn.sql("select docstatus,is_purchase_item from tabItem where name = %s",d.item_code)
|
||||
if valid_item[0][0] == 2:
|
||||
msgprint("Item : '%s' is Inactive, you can restore it from Trash" %(d.item_code))
|
||||
raise Exception
|
||||
if not valid_item[0][1] == 'Yes':
|
||||
msgprint("Item : '%s' is not Purchase Item"%(d.item_code))
|
||||
raise Exception
|
||||
|
||||
def check_conversion_rate(self):
|
||||
default_currency = get_company_currency(self.doc.company)
|
||||
if not default_currency:
|
||||
msgprint('Message: Please enter default currency in Company Master')
|
||||
raise Exception
|
||||
if (self.doc.currency == default_currency and flt(self.doc.conversion_rate) != 1.00) or not self.doc.conversion_rate or (self.doc.currency != default_currency and flt(self.doc.conversion_rate) == 1.00):
|
||||
msgprint("Message: Please Enter Appropriate Conversion Rate.")
|
||||
raise Exception
|
||||
|
||||
def validate_bill_no(self):
|
||||
if self.doc.bill_no and self.doc.bill_no.lower().strip() \
|
||||
not in ['na', 'not applicable', 'none']:
|
||||
b_no = webnotes.conn.sql("""select bill_no, name, ifnull(is_opening,'') from `tabPurchase Invoice`
|
||||
where bill_no = %s and credit_to = %s and docstatus = 1 and name != %s""",
|
||||
(self.doc.bill_no, self.doc.credit_to, self.doc.name))
|
||||
if b_no and cstr(b_no[0][2]) == cstr(self.doc.is_opening):
|
||||
msgprint("Please check you have already booked expense against Bill No. %s \
|
||||
in Purchase Invoice %s" % (cstr(b_no[0][0]), cstr(b_no[0][1])),
|
||||
raise_exception=1)
|
||||
|
||||
if not self.doc.remarks and self.doc.bill_date:
|
||||
self.doc.remarks = (self.doc.remarks or '') + "\n" + ("Against Bill %s dated %s"
|
||||
% (self.doc.bill_no, formatdate(self.doc.bill_date)))
|
||||
|
||||
if not self.doc.remarks:
|
||||
self.doc.remarks = "No Remarks"
|
||||
|
||||
def validate_credit_acc(self):
|
||||
acc = webnotes.conn.sql("select debit_or_credit, is_pl_account from tabAccount where name = %s",
|
||||
self.doc.credit_to)
|
||||
if not acc:
|
||||
msgprint("Account: "+ self.doc.credit_to + "does not exist")
|
||||
raise Exception
|
||||
elif acc[0][0] and acc[0][0] != 'Credit':
|
||||
msgprint("Account: "+ self.doc.credit_to + "is not a credit account")
|
||||
raise Exception
|
||||
elif acc[0][1] and acc[0][1] != 'No':
|
||||
msgprint("Account: "+ self.doc.credit_to + "is a pl account")
|
||||
raise Exception
|
||||
|
||||
# Validate Acc Head of Supplier and Credit To Account entered
|
||||
# ------------------------------------------------------------
|
||||
def check_for_acc_head_of_supplier(self):
|
||||
if self.doc.supplier and self.doc.credit_to:
|
||||
acc_head = webnotes.conn.sql("select master_name from `tabAccount` where name = %s", self.doc.credit_to)
|
||||
|
||||
if (acc_head and cstr(acc_head[0][0]) != cstr(self.doc.supplier)) or (not acc_head and (self.doc.credit_to != cstr(self.doc.supplier) + " - " + self.company_abbr)):
|
||||
msgprint("Credit To: %s do not match with Supplier: %s for Company: %s.\n If both correctly entered, please select Master Type and Master Name in account master." %(self.doc.credit_to,self.doc.supplier,self.doc.company), raise_exception=1)
|
||||
|
||||
# Check for Stopped PO
|
||||
# ---------------------
|
||||
def check_for_stopped_status(self):
|
||||
check_list = []
|
||||
for d in getlist(self.doclist,'entries'):
|
||||
if d.purchase_order and not d.purchase_order in check_list and not d.purchase_receipt:
|
||||
check_list.append(d.purhcase_order)
|
||||
stopped = webnotes.conn.sql("select name from `tabPurchase Order` where status = 'Stopped' and name = '%s'" % d.purchase_order)
|
||||
if stopped:
|
||||
msgprint("One cannot do any transaction against 'Purchase Order' : %s, it's status is 'Stopped'" % (d.purhcase_order))
|
||||
raise Exception
|
||||
|
||||
def validate_with_previous_doc(self):
|
||||
super(DocType, self).validate_with_previous_doc(self.tname, {
|
||||
"Purchase Order": {
|
||||
"ref_dn_field": "purchase_order",
|
||||
"compare_fields": [["supplier", "="], ["company", "="], ["currency", "="]],
|
||||
},
|
||||
"Purchase Order Item": {
|
||||
"ref_dn_field": "po_detail",
|
||||
"compare_fields": [["project_name", "="], ["item_code", "="], ["uom", "="]],
|
||||
"is_child_table": True,
|
||||
"allow_duplicate_prev_row_id": True
|
||||
},
|
||||
"Purchase Receipt": {
|
||||
"ref_dn_field": "purchase_receipt",
|
||||
"compare_fields": [["supplier", "="], ["company", "="], ["currency", "="]],
|
||||
},
|
||||
"Purchase Receipt Item": {
|
||||
"ref_dn_field": "pr_detail",
|
||||
"compare_fields": [["project_name", "="], ["item_code", "="], ["uom", "="]],
|
||||
"is_child_table": True
|
||||
}
|
||||
})
|
||||
|
||||
if cint(webnotes.defaults.get_global_default('maintain_same_rate')):
|
||||
super(DocType, self).validate_with_previous_doc(self.tname, {
|
||||
"Purchase Order Item": {
|
||||
"ref_dn_field": "po_detail",
|
||||
"compare_fields": [["import_rate", "="]],
|
||||
"is_child_table": True,
|
||||
"allow_duplicate_prev_row_id": True
|
||||
},
|
||||
"Purchase Receipt Item": {
|
||||
"ref_dn_field": "pr_detail",
|
||||
"compare_fields": [["import_rate", "="]],
|
||||
"is_child_table": True
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
def set_aging_date(self):
|
||||
if self.doc.is_opening != 'Yes':
|
||||
self.doc.aging_date = self.doc.posting_date
|
||||
elif not self.doc.aging_date:
|
||||
msgprint("Aging Date is mandatory for opening entry")
|
||||
raise Exception
|
||||
|
||||
def set_against_expense_account(self):
|
||||
auto_accounting_for_stock = cint(webnotes.defaults.get_global_default("auto_accounting_for_stock"))
|
||||
|
||||
if auto_accounting_for_stock:
|
||||
stock_not_billed_account = self.get_company_default("stock_received_but_not_billed")
|
||||
|
||||
against_accounts = []
|
||||
stock_items = self.get_stock_items()
|
||||
for item in self.doclist.get({"parentfield": "entries"}):
|
||||
if auto_accounting_for_stock and item.item_code in stock_items:
|
||||
# in case of auto inventory accounting, against expense account is always
|
||||
# Stock Received But Not Billed for a stock item
|
||||
item.expense_head = stock_not_billed_account
|
||||
item.cost_center = None
|
||||
|
||||
if stock_not_billed_account not in against_accounts:
|
||||
against_accounts.append(stock_not_billed_account)
|
||||
|
||||
elif not item.expense_head:
|
||||
msgprint(_("Expense account is mandatory for item") + ": " +
|
||||
(item.item_code or item.item_name), raise_exception=1)
|
||||
|
||||
elif item.expense_head not in against_accounts:
|
||||
# if no auto_accounting_for_stock or not a stock item
|
||||
against_accounts.append(item.expense_head)
|
||||
|
||||
self.doc.against_expense_account = ",".join(against_accounts)
|
||||
|
||||
def po_required(self):
|
||||
if webnotes.conn.get_value("Buying Settings", None, "po_required") == 'Yes':
|
||||
for d in getlist(self.doclist,'entries'):
|
||||
if not d.purchase_order:
|
||||
msgprint("Purchse Order No. required against item %s"%d.item_code)
|
||||
raise Exception
|
||||
|
||||
def pr_required(self):
|
||||
if webnotes.conn.get_value("Buying Settings", None, "pr_required") == 'Yes':
|
||||
for d in getlist(self.doclist,'entries'):
|
||||
if not d.purchase_receipt:
|
||||
msgprint("Purchase Receipt No. required against item %s"%d.item_code)
|
||||
raise Exception
|
||||
|
||||
def validate_write_off_account(self):
|
||||
if self.doc.write_off_amount and not self.doc.write_off_account:
|
||||
msgprint("Please enter Write Off Account", raise_exception=1)
|
||||
|
||||
def check_prev_docstatus(self):
|
||||
for d in getlist(self.doclist,'entries'):
|
||||
if d.purchase_order:
|
||||
submitted = webnotes.conn.sql("select name from `tabPurchase Order` where docstatus = 1 and name = '%s'" % d.purchase_order)
|
||||
if not submitted:
|
||||
webnotes.throw("Purchase Order : "+ cstr(d.purchase_order) +" is not submitted")
|
||||
if d.purchase_receipt:
|
||||
submitted = webnotes.conn.sql("select name from `tabPurchase Receipt` where docstatus = 1 and name = '%s'" % d.purchase_receipt)
|
||||
if not submitted:
|
||||
webnotes.throw("Purchase Receipt : "+ cstr(d.purchase_receipt) +" is not submitted")
|
||||
|
||||
|
||||
def update_against_document_in_jv(self):
|
||||
"""
|
||||
Links invoice and advance voucher:
|
||||
1. cancel advance voucher
|
||||
2. split into multiple rows if partially adjusted, assign against voucher
|
||||
3. submit advance voucher
|
||||
"""
|
||||
|
||||
lst = []
|
||||
for d in getlist(self.doclist, 'advance_allocation_details'):
|
||||
if flt(d.allocated_amount) > 0:
|
||||
args = {
|
||||
'voucher_no' : d.journal_voucher,
|
||||
'voucher_detail_no' : d.jv_detail_no,
|
||||
'against_voucher_type' : 'Purchase Invoice',
|
||||
'against_voucher' : self.doc.name,
|
||||
'account' : self.doc.credit_to,
|
||||
'is_advance' : 'Yes',
|
||||
'dr_or_cr' : 'debit',
|
||||
'unadjusted_amt' : flt(d.advance_amount),
|
||||
'allocated_amt' : flt(d.allocated_amount)
|
||||
}
|
||||
lst.append(args)
|
||||
|
||||
if lst:
|
||||
from accounts.utils import reconcile_against_document
|
||||
reconcile_against_document(lst)
|
||||
|
||||
def on_submit(self):
|
||||
self.check_prev_docstatus()
|
||||
|
||||
get_obj('Authorization Control').validate_approving_authority(self.doc.doctype,
|
||||
self.doc.company, self.doc.grand_total)
|
||||
|
||||
# this sequence because outstanding may get -negative
|
||||
self.make_gl_entries()
|
||||
self.update_against_document_in_jv()
|
||||
self.update_prevdoc_status()
|
||||
|
||||
def make_gl_entries(self):
|
||||
auto_accounting_for_stock = \
|
||||
cint(webnotes.defaults.get_global_default("auto_accounting_for_stock"))
|
||||
|
||||
gl_entries = []
|
||||
|
||||
# parent's gl entry
|
||||
if self.doc.grand_total:
|
||||
gl_entries.append(
|
||||
self.get_gl_dict({
|
||||
"account": self.doc.credit_to,
|
||||
"against": self.doc.against_expense_account,
|
||||
"credit": self.doc.total_amount_to_pay,
|
||||
"remarks": self.doc.remarks,
|
||||
"against_voucher": self.doc.name,
|
||||
"against_voucher_type": self.doc.doctype,
|
||||
})
|
||||
)
|
||||
|
||||
# tax table gl entries
|
||||
valuation_tax = {}
|
||||
for tax in self.doclist.get({"parentfield": "purchase_tax_details"}):
|
||||
if tax.category in ("Total", "Valuation and Total") and flt(tax.tax_amount):
|
||||
gl_entries.append(
|
||||
self.get_gl_dict({
|
||||
"account": tax.account_head,
|
||||
"against": self.doc.credit_to,
|
||||
"debit": tax.add_deduct_tax == "Add" and tax.tax_amount or 0,
|
||||
"credit": tax.add_deduct_tax == "Deduct" and tax.tax_amount or 0,
|
||||
"remarks": self.doc.remarks,
|
||||
"cost_center": tax.cost_center
|
||||
})
|
||||
)
|
||||
|
||||
# accumulate valuation tax
|
||||
if tax.category in ("Valuation", "Valuation and Total") and flt(tax.tax_amount):
|
||||
if auto_accounting_for_stock and not tax.cost_center:
|
||||
webnotes.throw(_("Row %(row)s: Cost Center is mandatory \
|
||||
if tax/charges category is Valuation or Valuation and Total" %
|
||||
{"row": tax.idx}))
|
||||
valuation_tax.setdefault(tax.cost_center, 0)
|
||||
valuation_tax[tax.cost_center] += \
|
||||
(tax.add_deduct_tax == "Add" and 1 or -1) * flt(tax.tax_amount)
|
||||
|
||||
# item gl entries
|
||||
stock_item_and_auto_accounting_for_stock = False
|
||||
stock_items = self.get_stock_items()
|
||||
for item in self.doclist.get({"parentfield": "entries"}):
|
||||
if auto_accounting_for_stock and item.item_code in stock_items:
|
||||
if flt(item.valuation_rate):
|
||||
# if auto inventory accounting enabled and stock item,
|
||||
# then do stock related gl entries
|
||||
# expense will be booked in sales invoice
|
||||
stock_item_and_auto_accounting_for_stock = True
|
||||
|
||||
valuation_amt = flt(item.amount + item.item_tax_amount + item.rm_supp_cost,
|
||||
self.precision("amount", item))
|
||||
|
||||
gl_entries.append(
|
||||
self.get_gl_dict({
|
||||
"account": item.expense_head,
|
||||
"against": self.doc.credit_to,
|
||||
"debit": valuation_amt,
|
||||
"remarks": self.doc.remarks or "Accounting Entry for Stock"
|
||||
})
|
||||
)
|
||||
|
||||
elif flt(item.amount):
|
||||
# if not a stock item or auto inventory accounting disabled, book the expense
|
||||
gl_entries.append(
|
||||
self.get_gl_dict({
|
||||
"account": item.expense_head,
|
||||
"against": self.doc.credit_to,
|
||||
"debit": item.amount,
|
||||
"remarks": self.doc.remarks,
|
||||
"cost_center": item.cost_center
|
||||
})
|
||||
)
|
||||
|
||||
if stock_item_and_auto_accounting_for_stock and valuation_tax:
|
||||
# credit valuation tax amount in "Expenses Included In Valuation"
|
||||
# this will balance out valuation amount included in cost of goods sold
|
||||
expenses_included_in_valuation = \
|
||||
self.get_company_default("expenses_included_in_valuation")
|
||||
|
||||
for cost_center, amount in valuation_tax.items():
|
||||
gl_entries.append(
|
||||
self.get_gl_dict({
|
||||
"account": expenses_included_in_valuation,
|
||||
"cost_center": cost_center,
|
||||
"against": self.doc.credit_to,
|
||||
"credit": amount,
|
||||
"remarks": self.doc.remarks or "Accounting Entry for Stock"
|
||||
})
|
||||
)
|
||||
|
||||
# writeoff account includes petty difference in the invoice amount
|
||||
# and the amount that is paid
|
||||
if self.doc.write_off_account and flt(self.doc.write_off_amount):
|
||||
gl_entries.append(
|
||||
self.get_gl_dict({
|
||||
"account": self.doc.write_off_account,
|
||||
"against": self.doc.credit_to,
|
||||
"credit": flt(self.doc.write_off_amount),
|
||||
"remarks": self.doc.remarks,
|
||||
"cost_center": self.doc.write_off_cost_center
|
||||
})
|
||||
)
|
||||
|
||||
if gl_entries:
|
||||
from accounts.general_ledger import make_gl_entries
|
||||
make_gl_entries(gl_entries, cancel=(self.doc.docstatus == 2))
|
||||
|
||||
def on_cancel(self):
|
||||
from accounts.utils import remove_against_link_from_jv
|
||||
remove_against_link_from_jv(self.doc.doctype, self.doc.name, "against_voucher")
|
||||
|
||||
self.update_prevdoc_status()
|
||||
|
||||
self.make_cancel_gl_entries()
|
||||
|
||||
def on_update(self):
|
||||
pass
|
||||
|
||||
def update_raw_material_cost(self):
|
||||
if self.sub_contracted_items:
|
||||
for d in self.doclist.get({"parentfield": "entries"}):
|
||||
rm_cost = webnotes.conn.sql("""select raw_material_cost / quantity
|
||||
from `tabBOM` where item = %s and is_default = 1 and docstatus = 1
|
||||
and is_active = 1 """, (d.item_code,))
|
||||
rm_cost = rm_cost and flt(rm_cost[0][0]) or 0
|
||||
|
||||
d.conversion_factor = d.conversion_factor or flt(webnotes.conn.get_value(
|
||||
"UOM Conversion Detail", {"parent": d.item_code, "uom": d.uom},
|
||||
"conversion_factor")) or 1
|
||||
|
||||
d.rm_supp_cost = rm_cost * flt(d.qty) * flt(d.conversion_factor)
|
||||
|
||||
@webnotes.whitelist()
|
||||
def get_expense_account(doctype, txt, searchfield, start, page_len, filters):
|
||||
from controllers.queries import get_match_cond
|
||||
|
||||
# expense account can be any Debit account,
|
||||
# but can also be a Liability account with account_type='Expense Account' in special circumstances.
|
||||
# Hence the first condition is an "OR"
|
||||
return webnotes.conn.sql("""select tabAccount.name from `tabAccount`
|
||||
where (tabAccount.debit_or_credit="Debit"
|
||||
or tabAccount.account_type = "Expense Account")
|
||||
and tabAccount.group_or_ledger="Ledger"
|
||||
and tabAccount.docstatus!=2
|
||||
and ifnull(tabAccount.master_type, "")=""
|
||||
and ifnull(tabAccount.master_name, "")=""
|
||||
and tabAccount.company = '%(company)s'
|
||||
and tabAccount.%(key)s LIKE '%(txt)s'
|
||||
%(mcond)s""" % {'company': filters['company'], 'key': searchfield,
|
||||
'txt': "%%%s%%" % txt, 'mcond':get_match_cond(doctype, searchfield)})
|
||||
@@ -1,813 +0,0 @@
|
||||
[
|
||||
{
|
||||
"creation": "2013-05-21 16:16:39",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-11-22 17:15:27",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
{
|
||||
"allow_attach": 1,
|
||||
"allow_import": 1,
|
||||
"autoname": "naming_series:",
|
||||
"doctype": "DocType",
|
||||
"icon": "icon-file-text",
|
||||
"is_submittable": 1,
|
||||
"module": "Accounts",
|
||||
"name": "__common__",
|
||||
"read_only_onload": 1,
|
||||
"search_fields": "posting_date, credit_to, fiscal_year, bill_no, grand_total, outstanding_amount"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"name": "__common__",
|
||||
"parent": "Purchase Invoice",
|
||||
"parentfield": "fields",
|
||||
"parenttype": "DocType",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocPerm",
|
||||
"name": "__common__",
|
||||
"parent": "Purchase Invoice",
|
||||
"parentfield": "permissions",
|
||||
"parenttype": "DocType",
|
||||
"permlevel": 0,
|
||||
"read": 1,
|
||||
"report": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocType",
|
||||
"name": "Purchase Invoice"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "supplier_section",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Supplier",
|
||||
"options": "icon-user"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "column_break0",
|
||||
"fieldtype": "Column Break",
|
||||
"oldfieldtype": "Column Break",
|
||||
"read_only": 0,
|
||||
"width": "50%"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "naming_series",
|
||||
"fieldtype": "Select",
|
||||
"label": "Series",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "naming_series",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "BILL\nBILLJ",
|
||||
"print_hide": 1,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "supplier",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"label": "Supplier",
|
||||
"oldfieldname": "supplier",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Supplier",
|
||||
"print_hide": 1,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"depends_on": "supplier",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "supplier_name",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Name",
|
||||
"oldfieldname": "supplier_name",
|
||||
"oldfieldtype": "Data",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "address_display",
|
||||
"fieldtype": "Small Text",
|
||||
"hidden": 1,
|
||||
"label": "Address",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "contact_display",
|
||||
"fieldtype": "Small Text",
|
||||
"hidden": 1,
|
||||
"label": "Contact",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "contact_mobile",
|
||||
"fieldtype": "Text",
|
||||
"hidden": 1,
|
||||
"label": "Mobile No",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "contact_email",
|
||||
"fieldtype": "Text",
|
||||
"hidden": 1,
|
||||
"label": "Contact Email",
|
||||
"print_hide": 1,
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "column_break1",
|
||||
"fieldtype": "Column Break",
|
||||
"oldfieldtype": "Column Break",
|
||||
"read_only": 0,
|
||||
"reqd": 0,
|
||||
"width": "50%"
|
||||
},
|
||||
{
|
||||
"default": "Today",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "posting_date",
|
||||
"fieldtype": "Date",
|
||||
"in_filter": 1,
|
||||
"label": "Posting Date",
|
||||
"no_copy": 0,
|
||||
"oldfieldname": "posting_date",
|
||||
"oldfieldtype": "Date",
|
||||
"print_hide": 1,
|
||||
"read_only": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"description": "If not applicable please enter: NA",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "bill_no",
|
||||
"fieldtype": "Data",
|
||||
"in_filter": 1,
|
||||
"label": "Supplier Invoice No",
|
||||
"oldfieldname": "bill_no",
|
||||
"oldfieldtype": "Data",
|
||||
"print_hide": 1,
|
||||
"read_only": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "bill_date",
|
||||
"fieldtype": "Date",
|
||||
"in_filter": 1,
|
||||
"label": "Supplier Invoice Date",
|
||||
"oldfieldname": "bill_date",
|
||||
"oldfieldtype": "Date",
|
||||
"print_hide": 1,
|
||||
"read_only": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "amended_from",
|
||||
"fieldtype": "Link",
|
||||
"label": "Amended From",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "amended_from",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Purchase Invoice",
|
||||
"print_hide": 1,
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "company",
|
||||
"fieldtype": "Link",
|
||||
"in_filter": 1,
|
||||
"label": "Company",
|
||||
"oldfieldname": "company",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Company",
|
||||
"print_hide": 1,
|
||||
"read_only": 0,
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "currency_price_list",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Currency and Price List",
|
||||
"options": "icon-tag",
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "currency",
|
||||
"fieldtype": "Link",
|
||||
"label": "Currency",
|
||||
"oldfieldname": "currency",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "Currency",
|
||||
"print_hide": 1,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"description": "The rate at which Bill Currency is converted into company's base currency",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "conversion_rate",
|
||||
"fieldtype": "Float",
|
||||
"label": "Exchange Rate",
|
||||
"oldfieldname": "conversion_rate",
|
||||
"oldfieldtype": "Currency",
|
||||
"print_hide": 1,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "column_break2",
|
||||
"fieldtype": "Column Break",
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "buying_price_list",
|
||||
"fieldtype": "Link",
|
||||
"label": "Price List",
|
||||
"options": "Price List",
|
||||
"print_hide": 1,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "price_list_currency",
|
||||
"fieldtype": "Link",
|
||||
"label": "Price List Currency",
|
||||
"options": "Currency",
|
||||
"print_hide": 1,
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "plc_conversion_rate",
|
||||
"fieldtype": "Float",
|
||||
"label": "Price List Exchange Rate",
|
||||
"print_hide": 1,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "items",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Items",
|
||||
"oldfieldtype": "Section Break",
|
||||
"options": "icon-shopping-cart",
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 1,
|
||||
"doctype": "DocField",
|
||||
"fieldname": "entries",
|
||||
"fieldtype": "Table",
|
||||
"label": "Entries",
|
||||
"oldfieldname": "entries",
|
||||
"oldfieldtype": "Table",
|
||||
"options": "Purchase Invoice Item",
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "section_break_26",
|
||||
"fieldtype": "Section Break"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "net_total_import",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Net Total",
|
||||
"oldfieldname": "net_total_import",
|
||||
"oldfieldtype": "Currency",
|
||||
"options": "currency",
|
||||
"print_hide": 0,
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "column_break_28",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"description": "Will be calculated automatically when you enter the details",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "net_total",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Net Total (Company Currency)",
|
||||
"oldfieldname": "net_total",
|
||||
"oldfieldtype": "Currency",
|
||||
"options": "Company:company:default_currency",
|
||||
"print_hide": 1,
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "taxes",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Taxes",
|
||||
"oldfieldtype": "Section Break",
|
||||
"options": "icon-money",
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "purchase_other_charges",
|
||||
"fieldtype": "Link",
|
||||
"label": "Tax Master",
|
||||
"oldfieldname": "purchase_other_charges",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Purchase Taxes and Charges Master",
|
||||
"print_hide": 1,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "purchase_tax_details",
|
||||
"fieldtype": "Table",
|
||||
"label": "Purchase Taxes and Charges",
|
||||
"oldfieldname": "purchase_tax_details",
|
||||
"oldfieldtype": "Table",
|
||||
"options": "Purchase Taxes and Charges",
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "tax_calculation",
|
||||
"fieldtype": "HTML",
|
||||
"label": "Tax Calculation",
|
||||
"oldfieldtype": "HTML",
|
||||
"print_hide": 1,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "totals",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Totals",
|
||||
"oldfieldtype": "Section Break",
|
||||
"options": "icon-money",
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "other_charges_added_import",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Taxes and Charges Added",
|
||||
"oldfieldname": "other_charges_added_import",
|
||||
"oldfieldtype": "Currency",
|
||||
"options": "currency",
|
||||
"print_hide": 1,
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "other_charges_deducted_import",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Taxes and Charges Deducted",
|
||||
"oldfieldname": "other_charges_deducted_import",
|
||||
"oldfieldtype": "Currency",
|
||||
"options": "currency",
|
||||
"print_hide": 1,
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "grand_total_import",
|
||||
"fieldtype": "Currency",
|
||||
"in_list_view": 1,
|
||||
"label": "Grand Total",
|
||||
"oldfieldname": "grand_total_import",
|
||||
"oldfieldtype": "Currency",
|
||||
"options": "currency",
|
||||
"print_hide": 0,
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "in_words_import",
|
||||
"fieldtype": "Data",
|
||||
"label": "In Words",
|
||||
"oldfieldname": "in_words_import",
|
||||
"oldfieldtype": "Data",
|
||||
"print_hide": 0,
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "total_amount_to_pay",
|
||||
"fieldtype": "Currency",
|
||||
"hidden": 0,
|
||||
"label": "Total Amount To Pay",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "total_amount_to_pay",
|
||||
"oldfieldtype": "Currency",
|
||||
"options": "Company:company:default_currency",
|
||||
"print_hide": 1,
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "total_advance",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Total Advance",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "total_advance",
|
||||
"oldfieldtype": "Currency",
|
||||
"options": "Company:company:default_currency",
|
||||
"print_hide": 1,
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "outstanding_amount",
|
||||
"fieldtype": "Currency",
|
||||
"in_filter": 1,
|
||||
"in_list_view": 1,
|
||||
"label": "Outstanding Amount",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "outstanding_amount",
|
||||
"oldfieldtype": "Currency",
|
||||
"options": "Company:company:default_currency",
|
||||
"print_hide": 1,
|
||||
"read_only": 1,
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "column_break8",
|
||||
"fieldtype": "Column Break",
|
||||
"oldfieldtype": "Column Break",
|
||||
"print_hide": 1,
|
||||
"read_only": 0,
|
||||
"width": "50%"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "total_tax",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Total Tax (Company Currency)",
|
||||
"oldfieldname": "total_tax",
|
||||
"oldfieldtype": "Currency",
|
||||
"options": "Company:company:default_currency",
|
||||
"print_hide": 1,
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "other_charges_added",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Taxes and Charges Added (Company Currency)",
|
||||
"oldfieldname": "other_charges_added",
|
||||
"oldfieldtype": "Currency",
|
||||
"options": "Company:company:default_currency",
|
||||
"print_hide": 1,
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "other_charges_deducted",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Taxes and Charges Deducted (Company Currency)",
|
||||
"oldfieldname": "other_charges_deducted",
|
||||
"oldfieldtype": "Currency",
|
||||
"options": "Company:company:default_currency",
|
||||
"print_hide": 1,
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "grand_total",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Grand Total (Company Currency)",
|
||||
"oldfieldname": "grand_total",
|
||||
"oldfieldtype": "Currency",
|
||||
"options": "Company:company:default_currency",
|
||||
"print_hide": 1,
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"description": "In Words will be visible once you save the Purchase Invoice.",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "in_words",
|
||||
"fieldtype": "Data",
|
||||
"label": "In Words (Company Currency)",
|
||||
"oldfieldname": "in_words",
|
||||
"oldfieldtype": "Data",
|
||||
"print_hide": 1,
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "write_off_amount",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Write Off Amount",
|
||||
"no_copy": 1,
|
||||
"options": "Company:company:default_currency",
|
||||
"print_hide": 1,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:flt(doc.write_off_amount)!=0",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "write_off_account",
|
||||
"fieldtype": "Link",
|
||||
"label": "Write Off Account",
|
||||
"no_copy": 1,
|
||||
"options": "Account",
|
||||
"print_hide": 1,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:flt(doc.write_off_amount)!=0",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "write_off_cost_center",
|
||||
"fieldtype": "Link",
|
||||
"label": "Write Off Cost Center",
|
||||
"no_copy": 1,
|
||||
"options": "Cost Center",
|
||||
"print_hide": 1,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "against_expense_account",
|
||||
"fieldtype": "Small Text",
|
||||
"hidden": 1,
|
||||
"label": "Against Expense Account",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "against_expense_account",
|
||||
"oldfieldtype": "Small Text",
|
||||
"print_hide": 1,
|
||||
"read_only": 0,
|
||||
"report_hide": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "advances",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Advances",
|
||||
"oldfieldtype": "Section Break",
|
||||
"options": "icon-money",
|
||||
"print_hide": 1,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "get_advances_paid",
|
||||
"fieldtype": "Button",
|
||||
"label": "Get Advances Paid",
|
||||
"oldfieldtype": "Button",
|
||||
"options": "get_advances",
|
||||
"print_hide": 1,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "advance_allocation_details",
|
||||
"fieldtype": "Table",
|
||||
"label": "Purchase Invoice Advances",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "advance_allocation_details",
|
||||
"oldfieldtype": "Table",
|
||||
"options": "Purchase Invoice Advance",
|
||||
"print_hide": 1,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "terms_section_break",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Terms and Conditions",
|
||||
"options": "icon-legal"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "tc_name",
|
||||
"fieldtype": "Link",
|
||||
"label": "Terms",
|
||||
"options": "Terms and Conditions",
|
||||
"print_hide": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "terms",
|
||||
"fieldtype": "Text Editor",
|
||||
"label": "Terms and Conditions1"
|
||||
},
|
||||
{
|
||||
"depends_on": "supplier",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "contact_section",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Contact Info",
|
||||
"options": "icon-bullhorn",
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "supplier_address",
|
||||
"fieldtype": "Link",
|
||||
"label": "Supplier Address",
|
||||
"options": "Address",
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "col_break23",
|
||||
"fieldtype": "Column Break",
|
||||
"read_only": 0,
|
||||
"width": "50%"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "contact_person",
|
||||
"fieldtype": "Link",
|
||||
"label": "Contact Person",
|
||||
"options": "Contact",
|
||||
"print_hide": 1,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "more_info",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "More Info",
|
||||
"oldfieldtype": "Section Break",
|
||||
"options": "icon-file-text",
|
||||
"print_hide": 1,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"description": "Supplier (Payable) Account",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "credit_to",
|
||||
"fieldtype": "Link",
|
||||
"in_filter": 1,
|
||||
"label": "Credit To",
|
||||
"oldfieldname": "credit_to",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Account",
|
||||
"print_hide": 1,
|
||||
"read_only": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"default": "No",
|
||||
"description": "Considered as Opening Balance",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "is_opening",
|
||||
"fieldtype": "Select",
|
||||
"in_filter": 1,
|
||||
"label": "Is Opening",
|
||||
"oldfieldname": "is_opening",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "No\nYes",
|
||||
"print_hide": 1,
|
||||
"read_only": 0,
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"description": "Actual Invoice Date",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "aging_date",
|
||||
"fieldtype": "Date",
|
||||
"label": "Aging Date",
|
||||
"oldfieldname": "aging_date",
|
||||
"oldfieldtype": "Date",
|
||||
"print_hide": 1,
|
||||
"read_only": 0,
|
||||
"search_index": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 1,
|
||||
"doctype": "DocField",
|
||||
"fieldname": "select_print_heading",
|
||||
"fieldtype": "Link",
|
||||
"label": "Print Heading",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "select_print_heading",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Print Heading",
|
||||
"print_hide": 1,
|
||||
"read_only": 0,
|
||||
"report_hide": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "due_date",
|
||||
"fieldtype": "Date",
|
||||
"in_filter": 1,
|
||||
"label": "Due Date",
|
||||
"no_copy": 0,
|
||||
"oldfieldname": "due_date",
|
||||
"oldfieldtype": "Date",
|
||||
"print_hide": 0,
|
||||
"read_only": 0,
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "mode_of_payment",
|
||||
"fieldtype": "Select",
|
||||
"label": "Mode of Payment",
|
||||
"oldfieldname": "mode_of_payment",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "link:Mode of Payment",
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "column_break_63",
|
||||
"fieldtype": "Column Break",
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "fiscal_year",
|
||||
"fieldtype": "Select",
|
||||
"in_filter": 1,
|
||||
"label": "Fiscal Year",
|
||||
"oldfieldname": "fiscal_year",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "link:Fiscal Year",
|
||||
"print_hide": 1,
|
||||
"read_only": 0,
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "remarks",
|
||||
"fieldtype": "Small Text",
|
||||
"label": "Remarks",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "remarks",
|
||||
"oldfieldtype": "Text",
|
||||
"print_hide": 1,
|
||||
"read_only": 0,
|
||||
"reqd": 0
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"doctype": "DocPerm",
|
||||
"role": "Accounts User",
|
||||
"submit": 0,
|
||||
"write": 0
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"doctype": "DocPerm",
|
||||
"role": "Purchase User",
|
||||
"submit": 0,
|
||||
"write": 0
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"doctype": "DocPerm",
|
||||
"match": "supplier",
|
||||
"role": "Supplier",
|
||||
"submit": 0,
|
||||
"write": 0
|
||||
},
|
||||
{
|
||||
"amend": 1,
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"role": "Accounts Manager",
|
||||
"submit": 1,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"doctype": "DocPerm",
|
||||
"role": "Auditor",
|
||||
"submit": 0,
|
||||
"write": 0
|
||||
}
|
||||
]
|
||||
@@ -1,12 +0,0 @@
|
||||
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
// License: GNU General Public License v3. See license.txt
|
||||
|
||||
// render
|
||||
wn.listview_settings['Purchase Invoice'] = {
|
||||
add_fields: ["`tabPurchase Invoice`.grand_total", "`tabPurchase Invoice`.outstanding_amount"],
|
||||
add_columns: [{"content":"paid_amount", width:"10%", type:"bar-graph", label: "Paid"}],
|
||||
prepare_data: function(data) {
|
||||
data.paid_amount = flt(data.grand_total) ? (((flt(data.grand_total) -
|
||||
flt(data.outstanding_amount)) / flt(data.grand_total)) * 100) : 0;
|
||||
}
|
||||
};
|
||||
@@ -1,415 +0,0 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import unittest
|
||||
import webnotes
|
||||
import webnotes.model
|
||||
import json
|
||||
from webnotes.utils import cint
|
||||
import webnotes.defaults
|
||||
from stock.doctype.purchase_receipt.test_purchase_receipt import set_perpetual_inventory
|
||||
|
||||
test_dependencies = ["Item", "Cost Center"]
|
||||
test_ignore = ["Serial No"]
|
||||
|
||||
class TestPurchaseInvoice(unittest.TestCase):
|
||||
def test_gl_entries_without_auto_accounting_for_stock(self):
|
||||
set_perpetual_inventory(0)
|
||||
self.assertTrue(not cint(webnotes.defaults.get_global_default("auto_accounting_for_stock")))
|
||||
|
||||
wrapper = webnotes.bean(copy=test_records[0])
|
||||
wrapper.run_method("calculate_taxes_and_totals")
|
||||
wrapper.insert()
|
||||
wrapper.submit()
|
||||
wrapper.load_from_db()
|
||||
dl = wrapper.doclist
|
||||
|
||||
expected_gl_entries = {
|
||||
"_Test Supplier - _TC": [0, 1512.30],
|
||||
"_Test Account Cost for Goods Sold - _TC": [1250, 0],
|
||||
"_Test Account Shipping Charges - _TC": [100, 0],
|
||||
"_Test Account Excise Duty - _TC": [140, 0],
|
||||
"_Test Account Education Cess - _TC": [2.8, 0],
|
||||
"_Test Account S&H Education Cess - _TC": [1.4, 0],
|
||||
"_Test Account CST - _TC": [29.88, 0],
|
||||
"_Test Account VAT - _TC": [156.25, 0],
|
||||
"_Test Account Discount - _TC": [0, 168.03],
|
||||
}
|
||||
gl_entries = webnotes.conn.sql("""select account, debit, credit from `tabGL Entry`
|
||||
where voucher_type = 'Purchase Invoice' and voucher_no = %s""", dl[0].name, as_dict=1)
|
||||
for d in gl_entries:
|
||||
self.assertEqual([d.debit, d.credit], expected_gl_entries.get(d.account))
|
||||
|
||||
def test_gl_entries_with_auto_accounting_for_stock(self):
|
||||
set_perpetual_inventory(1)
|
||||
self.assertEqual(cint(webnotes.defaults.get_global_default("auto_accounting_for_stock")), 1)
|
||||
|
||||
pi = webnotes.bean(copy=test_records[1])
|
||||
pi.run_method("calculate_taxes_and_totals")
|
||||
pi.insert()
|
||||
pi.submit()
|
||||
|
||||
gl_entries = webnotes.conn.sql("""select account, debit, credit
|
||||
from `tabGL Entry` where voucher_type='Purchase Invoice' and voucher_no=%s
|
||||
order by account asc""", pi.doc.name, as_dict=1)
|
||||
self.assertTrue(gl_entries)
|
||||
|
||||
expected_values = sorted([
|
||||
["_Test Supplier - _TC", 0, 720],
|
||||
["Stock Received But Not Billed - _TC", 750.0, 0],
|
||||
["_Test Account Shipping Charges - _TC", 100.0, 0],
|
||||
["_Test Account VAT - _TC", 120.0, 0],
|
||||
["Expenses Included In Valuation - _TC", 0, 250.0],
|
||||
])
|
||||
|
||||
for i, gle in enumerate(gl_entries):
|
||||
self.assertEquals(expected_values[i][0], gle.account)
|
||||
self.assertEquals(expected_values[i][1], gle.debit)
|
||||
self.assertEquals(expected_values[i][2], gle.credit)
|
||||
|
||||
set_perpetual_inventory(0)
|
||||
|
||||
def test_gl_entries_with_aia_for_non_stock_items(self):
|
||||
set_perpetual_inventory()
|
||||
self.assertEqual(cint(webnotes.defaults.get_global_default("auto_accounting_for_stock")), 1)
|
||||
|
||||
pi = webnotes.bean(copy=test_records[1])
|
||||
pi.doclist[1].item_code = "_Test Non Stock Item"
|
||||
pi.doclist[1].expense_head = "_Test Account Cost for Goods Sold - _TC"
|
||||
pi.doclist.pop(2)
|
||||
pi.doclist.pop(3)
|
||||
pi.run_method("calculate_taxes_and_totals")
|
||||
pi.insert()
|
||||
pi.submit()
|
||||
|
||||
gl_entries = webnotes.conn.sql("""select account, debit, credit
|
||||
from `tabGL Entry` where voucher_type='Purchase Invoice' and voucher_no=%s
|
||||
order by account asc""", pi.doc.name, as_dict=1)
|
||||
self.assertTrue(gl_entries)
|
||||
|
||||
expected_values = sorted([
|
||||
["_Test Supplier - _TC", 0, 620],
|
||||
["_Test Account Cost for Goods Sold - _TC", 500.0, 0],
|
||||
["_Test Account VAT - _TC", 120.0, 0],
|
||||
])
|
||||
|
||||
for i, gle in enumerate(gl_entries):
|
||||
self.assertEquals(expected_values[i][0], gle.account)
|
||||
self.assertEquals(expected_values[i][1], gle.debit)
|
||||
self.assertEquals(expected_values[i][2], gle.credit)
|
||||
set_perpetual_inventory(0)
|
||||
|
||||
def test_purchase_invoice_calculation(self):
|
||||
wrapper = webnotes.bean(copy=test_records[0])
|
||||
wrapper.run_method("calculate_taxes_and_totals")
|
||||
wrapper.insert()
|
||||
wrapper.load_from_db()
|
||||
|
||||
expected_values = [
|
||||
["_Test Item Home Desktop 100", 90, 59],
|
||||
["_Test Item Home Desktop 200", 135, 177]
|
||||
]
|
||||
for i, item in enumerate(wrapper.doclist.get({"parentfield": "entries"})):
|
||||
self.assertEqual(item.item_code, expected_values[i][0])
|
||||
self.assertEqual(item.item_tax_amount, expected_values[i][1])
|
||||
self.assertEqual(item.valuation_rate, expected_values[i][2])
|
||||
|
||||
self.assertEqual(wrapper.doclist[0].net_total, 1250)
|
||||
|
||||
# tax amounts
|
||||
expected_values = [
|
||||
["_Test Account Shipping Charges - _TC", 100, 1350],
|
||||
["_Test Account Customs Duty - _TC", 125, 1350],
|
||||
["_Test Account Excise Duty - _TC", 140, 1490],
|
||||
["_Test Account Education Cess - _TC", 2.8, 1492.8],
|
||||
["_Test Account S&H Education Cess - _TC", 1.4, 1494.2],
|
||||
["_Test Account CST - _TC", 29.88, 1524.08],
|
||||
["_Test Account VAT - _TC", 156.25, 1680.33],
|
||||
["_Test Account Discount - _TC", 168.03, 1512.30],
|
||||
]
|
||||
|
||||
for i, tax in enumerate(wrapper.doclist.get({"parentfield": "purchase_tax_details"})):
|
||||
self.assertEqual(tax.account_head, expected_values[i][0])
|
||||
self.assertEqual(tax.tax_amount, expected_values[i][1])
|
||||
self.assertEqual(tax.total, expected_values[i][2])
|
||||
|
||||
def test_purchase_invoice_with_subcontracted_item(self):
|
||||
wrapper = webnotes.bean(copy=test_records[0])
|
||||
wrapper.doclist[1].item_code = "_Test FG Item"
|
||||
wrapper.run_method("calculate_taxes_and_totals")
|
||||
wrapper.insert()
|
||||
wrapper.load_from_db()
|
||||
|
||||
expected_values = [
|
||||
["_Test FG Item", 90, 7059],
|
||||
["_Test Item Home Desktop 200", 135, 177]
|
||||
]
|
||||
for i, item in enumerate(wrapper.doclist.get({"parentfield": "entries"})):
|
||||
self.assertEqual(item.item_code, expected_values[i][0])
|
||||
self.assertEqual(item.item_tax_amount, expected_values[i][1])
|
||||
self.assertEqual(item.valuation_rate, expected_values[i][2])
|
||||
|
||||
self.assertEqual(wrapper.doclist[0].net_total, 1250)
|
||||
|
||||
# tax amounts
|
||||
expected_values = [
|
||||
["_Test Account Shipping Charges - _TC", 100, 1350],
|
||||
["_Test Account Customs Duty - _TC", 125, 1350],
|
||||
["_Test Account Excise Duty - _TC", 140, 1490],
|
||||
["_Test Account Education Cess - _TC", 2.8, 1492.8],
|
||||
["_Test Account S&H Education Cess - _TC", 1.4, 1494.2],
|
||||
["_Test Account CST - _TC", 29.88, 1524.08],
|
||||
["_Test Account VAT - _TC", 156.25, 1680.33],
|
||||
["_Test Account Discount - _TC", 168.03, 1512.30],
|
||||
]
|
||||
|
||||
for i, tax in enumerate(wrapper.doclist.get({"parentfield": "purchase_tax_details"})):
|
||||
self.assertEqual(tax.account_head, expected_values[i][0])
|
||||
self.assertEqual(tax.tax_amount, expected_values[i][1])
|
||||
self.assertEqual(tax.total, expected_values[i][2])
|
||||
|
||||
def test_purchase_invoice_with_advance(self):
|
||||
from accounts.doctype.journal_voucher.test_journal_voucher \
|
||||
import test_records as jv_test_records
|
||||
|
||||
jv = webnotes.bean(copy=jv_test_records[1])
|
||||
jv.insert()
|
||||
jv.submit()
|
||||
|
||||
pi = webnotes.bean(copy=test_records[0])
|
||||
pi.doclist.append({
|
||||
"doctype": "Purchase Invoice Advance",
|
||||
"parentfield": "advance_allocation_details",
|
||||
"journal_voucher": jv.doc.name,
|
||||
"jv_detail_no": jv.doclist[1].name,
|
||||
"advance_amount": 400,
|
||||
"allocated_amount": 300,
|
||||
"remarks": jv.doc.remark
|
||||
})
|
||||
pi.run_method("calculate_taxes_and_totals")
|
||||
pi.insert()
|
||||
pi.submit()
|
||||
pi.load_from_db()
|
||||
|
||||
self.assertTrue(webnotes.conn.sql("""select name from `tabJournal Voucher Detail`
|
||||
where against_voucher=%s""", pi.doc.name))
|
||||
|
||||
self.assertTrue(webnotes.conn.sql("""select name from `tabJournal Voucher Detail`
|
||||
where against_voucher=%s and debit=300""", pi.doc.name))
|
||||
|
||||
self.assertEqual(pi.doc.outstanding_amount, 1212.30)
|
||||
|
||||
pi.cancel()
|
||||
|
||||
self.assertTrue(not webnotes.conn.sql("""select name from `tabJournal Voucher Detail`
|
||||
where against_voucher=%s""", pi.doc.name))
|
||||
|
||||
test_records = [
|
||||
[
|
||||
# parent
|
||||
{
|
||||
"doctype": "Purchase Invoice",
|
||||
"naming_series": "BILL",
|
||||
"supplier_name": "_Test Supplier",
|
||||
"credit_to": "_Test Supplier - _TC",
|
||||
"bill_no": "NA",
|
||||
"posting_date": "2013-02-03",
|
||||
"fiscal_year": "_Test Fiscal Year 2013",
|
||||
"company": "_Test Company",
|
||||
"currency": "INR",
|
||||
"conversion_rate": 1,
|
||||
"grand_total_import": 0 # for feed
|
||||
},
|
||||
# items
|
||||
{
|
||||
"doctype": "Purchase Invoice Item",
|
||||
"parentfield": "entries",
|
||||
"item_code": "_Test Item Home Desktop 100",
|
||||
"item_name": "_Test Item Home Desktop 100",
|
||||
"qty": 10,
|
||||
"import_rate": 50,
|
||||
"import_amount": 500,
|
||||
"rate": 50,
|
||||
"amount": 500,
|
||||
"uom": "_Test UOM",
|
||||
"item_tax_rate": json.dumps({"_Test Account Excise Duty - _TC": 10}),
|
||||
"expense_head": "_Test Account Cost for Goods Sold - _TC",
|
||||
"cost_center": "_Test Cost Center - _TC",
|
||||
"conversion_factor": 1.0,
|
||||
|
||||
},
|
||||
{
|
||||
"doctype": "Purchase Invoice Item",
|
||||
"parentfield": "entries",
|
||||
"item_code": "_Test Item Home Desktop 200",
|
||||
"item_name": "_Test Item Home Desktop 200",
|
||||
"qty": 5,
|
||||
"import_rate": 150,
|
||||
"import_amount": 750,
|
||||
"rate": 150,
|
||||
"amount": 750,
|
||||
"uom": "_Test UOM",
|
||||
"expense_head": "_Test Account Cost for Goods Sold - _TC",
|
||||
"cost_center": "_Test Cost Center - _TC",
|
||||
"conversion_factor": 1.0,
|
||||
},
|
||||
# taxes
|
||||
{
|
||||
"doctype": "Purchase Taxes and Charges",
|
||||
"parentfield": "purchase_tax_details",
|
||||
"charge_type": "Actual",
|
||||
"account_head": "_Test Account Shipping Charges - _TC",
|
||||
"cost_center": "_Test Cost Center - _TC",
|
||||
"description": "Shipping Charges",
|
||||
"category": "Valuation and Total",
|
||||
"add_deduct_tax": "Add",
|
||||
"rate": 100
|
||||
},
|
||||
{
|
||||
"doctype": "Purchase Taxes and Charges",
|
||||
"parentfield": "purchase_tax_details",
|
||||
"charge_type": "On Net Total",
|
||||
"account_head": "_Test Account Customs Duty - _TC",
|
||||
"cost_center": "_Test Cost Center - _TC",
|
||||
"description": "Customs Duty",
|
||||
"category": "Valuation",
|
||||
"add_deduct_tax": "Add",
|
||||
"rate": 10
|
||||
},
|
||||
{
|
||||
"doctype": "Purchase Taxes and Charges",
|
||||
"parentfield": "purchase_tax_details",
|
||||
"charge_type": "On Net Total",
|
||||
"account_head": "_Test Account Excise Duty - _TC",
|
||||
"cost_center": "_Test Cost Center - _TC",
|
||||
"description": "Excise Duty",
|
||||
"category": "Total",
|
||||
"add_deduct_tax": "Add",
|
||||
"rate": 12
|
||||
},
|
||||
{
|
||||
"doctype": "Purchase Taxes and Charges",
|
||||
"parentfield": "purchase_tax_details",
|
||||
"charge_type": "On Previous Row Amount",
|
||||
"account_head": "_Test Account Education Cess - _TC",
|
||||
"cost_center": "_Test Cost Center - _TC",
|
||||
"description": "Education Cess",
|
||||
"category": "Total",
|
||||
"add_deduct_tax": "Add",
|
||||
"rate": 2,
|
||||
"row_id": 3
|
||||
},
|
||||
{
|
||||
"doctype": "Purchase Taxes and Charges",
|
||||
"parentfield": "purchase_tax_details",
|
||||
"charge_type": "On Previous Row Amount",
|
||||
"account_head": "_Test Account S&H Education Cess - _TC",
|
||||
"cost_center": "_Test Cost Center - _TC",
|
||||
"description": "S&H Education Cess",
|
||||
"category": "Total",
|
||||
"add_deduct_tax": "Add",
|
||||
"rate": 1,
|
||||
"row_id": 3
|
||||
},
|
||||
{
|
||||
"doctype": "Purchase Taxes and Charges",
|
||||
"parentfield": "purchase_tax_details",
|
||||
"charge_type": "On Previous Row Total",
|
||||
"account_head": "_Test Account CST - _TC",
|
||||
"cost_center": "_Test Cost Center - _TC",
|
||||
"description": "CST",
|
||||
"category": "Total",
|
||||
"add_deduct_tax": "Add",
|
||||
"rate": 2,
|
||||
"row_id": 5
|
||||
},
|
||||
{
|
||||
"doctype": "Purchase Taxes and Charges",
|
||||
"parentfield": "purchase_tax_details",
|
||||
"charge_type": "On Net Total",
|
||||
"account_head": "_Test Account VAT - _TC",
|
||||
"cost_center": "_Test Cost Center - _TC",
|
||||
"description": "VAT",
|
||||
"category": "Total",
|
||||
"add_deduct_tax": "Add",
|
||||
"rate": 12.5
|
||||
},
|
||||
{
|
||||
"doctype": "Purchase Taxes and Charges",
|
||||
"parentfield": "purchase_tax_details",
|
||||
"charge_type": "On Previous Row Total",
|
||||
"account_head": "_Test Account Discount - _TC",
|
||||
"cost_center": "_Test Cost Center - _TC",
|
||||
"description": "Discount",
|
||||
"category": "Total",
|
||||
"add_deduct_tax": "Deduct",
|
||||
"rate": 10,
|
||||
"row_id": 7
|
||||
},
|
||||
],
|
||||
[
|
||||
# parent
|
||||
{
|
||||
"doctype": "Purchase Invoice",
|
||||
"naming_series": "_T-Purchase Invoice-",
|
||||
"supplier_name": "_Test Supplier",
|
||||
"credit_to": "_Test Supplier - _TC",
|
||||
"bill_no": "NA",
|
||||
"posting_date": "2013-02-03",
|
||||
"fiscal_year": "_Test Fiscal Year 2013",
|
||||
"company": "_Test Company",
|
||||
"currency": "INR",
|
||||
"conversion_rate": 1.0,
|
||||
"grand_total_import": 0 # for feed
|
||||
},
|
||||
# items
|
||||
{
|
||||
"doctype": "Purchase Invoice Item",
|
||||
"parentfield": "entries",
|
||||
"item_code": "_Test Item",
|
||||
"item_name": "_Test Item",
|
||||
"qty": 10.0,
|
||||
"import_rate": 50.0,
|
||||
"uom": "_Test UOM",
|
||||
"expense_head": "_Test Account Cost for Goods Sold - _TC",
|
||||
"cost_center": "_Test Cost Center - _TC",
|
||||
"conversion_factor": 1.0,
|
||||
},
|
||||
# taxes
|
||||
{
|
||||
"doctype": "Purchase Taxes and Charges",
|
||||
"parentfield": "purchase_tax_details",
|
||||
"charge_type": "Actual",
|
||||
"account_head": "_Test Account Shipping Charges - _TC",
|
||||
"cost_center": "_Test Cost Center - _TC",
|
||||
"description": "Shipping Charges",
|
||||
"category": "Valuation and Total",
|
||||
"add_deduct_tax": "Add",
|
||||
"rate": 100.0
|
||||
},
|
||||
{
|
||||
"doctype": "Purchase Taxes and Charges",
|
||||
"parentfield": "purchase_tax_details",
|
||||
"charge_type": "Actual",
|
||||
"account_head": "_Test Account VAT - _TC",
|
||||
"cost_center": "_Test Cost Center - _TC",
|
||||
"description": "VAT",
|
||||
"category": "Total",
|
||||
"add_deduct_tax": "Add",
|
||||
"rate": 120.0
|
||||
},
|
||||
{
|
||||
"doctype": "Purchase Taxes and Charges",
|
||||
"parentfield": "purchase_tax_details",
|
||||
"charge_type": "Actual",
|
||||
"account_head": "_Test Account Customs Duty - _TC",
|
||||
"cost_center": "_Test Cost Center - _TC",
|
||||
"description": "Customs Duty",
|
||||
"category": "Valuation",
|
||||
"add_deduct_tax": "Add",
|
||||
"rate": 150.0
|
||||
},
|
||||
]
|
||||
]
|
||||
@@ -1,9 +0,0 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
class DocType:
|
||||
def __init__(self, d, dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
@@ -1,92 +0,0 @@
|
||||
[
|
||||
{
|
||||
"creation": "2013-03-08 15:36:46",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-07-10 14:54:12",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
{
|
||||
"doctype": "DocType",
|
||||
"istable": 1,
|
||||
"module": "Accounts",
|
||||
"name": "__common__"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"name": "__common__",
|
||||
"no_copy": 1,
|
||||
"parent": "Purchase Invoice Advance",
|
||||
"parentfield": "fields",
|
||||
"parenttype": "DocType",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocType",
|
||||
"name": "Purchase Invoice Advance"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "journal_voucher",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 1,
|
||||
"label": "Journal Voucher",
|
||||
"oldfieldname": "journal_voucher",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Journal Voucher",
|
||||
"print_width": "180px",
|
||||
"read_only": 1,
|
||||
"width": "180px"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "jv_detail_no",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 1,
|
||||
"in_list_view": 0,
|
||||
"label": "Journal Voucher Detail No",
|
||||
"oldfieldname": "jv_detail_no",
|
||||
"oldfieldtype": "Date",
|
||||
"print_hide": 1,
|
||||
"print_width": "80px",
|
||||
"read_only": 1,
|
||||
"width": "80px"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "advance_amount",
|
||||
"fieldtype": "Currency",
|
||||
"in_list_view": 1,
|
||||
"label": "Advance Amount",
|
||||
"oldfieldname": "advance_amount",
|
||||
"oldfieldtype": "Currency",
|
||||
"options": "Company:company:default_currency",
|
||||
"print_width": "100px",
|
||||
"read_only": 1,
|
||||
"width": "100px"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "allocated_amount",
|
||||
"fieldtype": "Currency",
|
||||
"in_list_view": 1,
|
||||
"label": "Allocated Amount",
|
||||
"oldfieldname": "allocated_amount",
|
||||
"oldfieldtype": "Currency",
|
||||
"options": "Company:company:default_currency",
|
||||
"print_width": "100px",
|
||||
"width": "100px"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "remarks",
|
||||
"fieldtype": "Small Text",
|
||||
"in_list_view": 1,
|
||||
"label": "Remarks",
|
||||
"oldfieldname": "remarks",
|
||||
"oldfieldtype": "Small Text",
|
||||
"print_width": "150px",
|
||||
"read_only": 1,
|
||||
"width": "150px"
|
||||
}
|
||||
]
|
||||
@@ -1,9 +0,0 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
class DocType:
|
||||
def __init__(self, d, dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
@@ -1,394 +0,0 @@
|
||||
[
|
||||
{
|
||||
"creation": "2013-05-22 12:43:10",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-11-02 19:41:17",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
{
|
||||
"autoname": "EVD.######",
|
||||
"doctype": "DocType",
|
||||
"istable": 1,
|
||||
"module": "Accounts",
|
||||
"name": "__common__"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"name": "__common__",
|
||||
"parent": "Purchase Invoice Item",
|
||||
"parentfield": "fields",
|
||||
"parenttype": "DocType",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocType",
|
||||
"name": "Purchase Invoice Item"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "item_code",
|
||||
"fieldtype": "Link",
|
||||
"in_filter": 1,
|
||||
"in_list_view": 0,
|
||||
"label": "Item",
|
||||
"oldfieldname": "item_code",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Item",
|
||||
"print_hide": 1,
|
||||
"read_only": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "item_name",
|
||||
"fieldtype": "Data",
|
||||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Item Name",
|
||||
"oldfieldname": "item_name",
|
||||
"oldfieldtype": "Data",
|
||||
"read_only": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "description",
|
||||
"fieldtype": "Text",
|
||||
"in_list_view": 1,
|
||||
"label": "Description",
|
||||
"oldfieldname": "description",
|
||||
"oldfieldtype": "Text",
|
||||
"print_width": "300px",
|
||||
"read_only": 0,
|
||||
"width": "300px"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "quantity_and_rate",
|
||||
"fieldtype": "Section Break",
|
||||
"in_list_view": 0,
|
||||
"label": "Quantity and Rate"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "qty",
|
||||
"fieldtype": "Float",
|
||||
"in_list_view": 1,
|
||||
"label": "Qty",
|
||||
"oldfieldname": "qty",
|
||||
"oldfieldtype": "Currency",
|
||||
"print_hide": 0,
|
||||
"read_only": 0,
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "uom",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 0,
|
||||
"label": "UOM",
|
||||
"options": "UOM",
|
||||
"print_hide": 1,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "import_ref_rate",
|
||||
"fieldtype": "Currency",
|
||||
"in_list_view": 0,
|
||||
"label": "Price List Rate",
|
||||
"options": "currency",
|
||||
"print_hide": 1,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "discount_rate",
|
||||
"fieldtype": "Float",
|
||||
"in_list_view": 0,
|
||||
"label": "Discount %",
|
||||
"print_hide": 0,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "import_rate",
|
||||
"fieldtype": "Currency",
|
||||
"in_list_view": 1,
|
||||
"label": "Rate ",
|
||||
"oldfieldname": "import_rate",
|
||||
"oldfieldtype": "Currency",
|
||||
"options": "currency",
|
||||
"print_hide": 0,
|
||||
"read_only": 0,
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "import_amount",
|
||||
"fieldtype": "Currency",
|
||||
"in_list_view": 1,
|
||||
"label": "Amount",
|
||||
"oldfieldname": "import_amount",
|
||||
"oldfieldtype": "Currency",
|
||||
"options": "currency",
|
||||
"read_only": 1,
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "purchase_ref_rate",
|
||||
"fieldtype": "Currency",
|
||||
"in_list_view": 0,
|
||||
"label": "Price List Rate (Company Currency)",
|
||||
"options": "Company:company:default_currency",
|
||||
"print_hide": 1,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "rate",
|
||||
"fieldtype": "Currency",
|
||||
"in_list_view": 0,
|
||||
"label": "Rate (Company Currency)",
|
||||
"oldfieldname": "rate",
|
||||
"oldfieldtype": "Currency",
|
||||
"options": "Company:company:default_currency",
|
||||
"print_hide": 1,
|
||||
"read_only": 0,
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "amount",
|
||||
"fieldtype": "Currency",
|
||||
"in_list_view": 0,
|
||||
"label": "Amount (Company Currency)",
|
||||
"oldfieldname": "amount",
|
||||
"oldfieldtype": "Currency",
|
||||
"options": "Company:company:default_currency",
|
||||
"print_hide": 1,
|
||||
"read_only": 1,
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "accounting",
|
||||
"fieldtype": "Section Break",
|
||||
"in_list_view": 0,
|
||||
"label": "Accounting"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "expense_head",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 0,
|
||||
"label": "Expense Head",
|
||||
"oldfieldname": "expense_head",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Account",
|
||||
"print_hide": 1,
|
||||
"print_width": "120px",
|
||||
"read_only": 0,
|
||||
"reqd": 0,
|
||||
"width": "120px"
|
||||
},
|
||||
{
|
||||
"default": ":Company",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "cost_center",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 0,
|
||||
"label": "Cost Center",
|
||||
"oldfieldname": "cost_center",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Cost Center",
|
||||
"print_hide": 1,
|
||||
"print_width": "120px",
|
||||
"read_only": 0,
|
||||
"width": "120px"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "reference",
|
||||
"fieldtype": "Section Break",
|
||||
"in_list_view": 0,
|
||||
"label": "Reference"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "project_name",
|
||||
"fieldtype": "Link",
|
||||
"in_filter": 1,
|
||||
"in_list_view": 0,
|
||||
"label": "Project Name",
|
||||
"options": "Project",
|
||||
"print_hide": 1,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "brand",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 1,
|
||||
"in_list_view": 0,
|
||||
"label": "Brand",
|
||||
"oldfieldname": "brand",
|
||||
"oldfieldtype": "Data",
|
||||
"print_hide": 1,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"description": "<a href=\"#Sales Browser/Item Group\">Add / Edit</a>",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "item_group",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 1,
|
||||
"in_filter": 1,
|
||||
"in_list_view": 0,
|
||||
"label": "Item Group",
|
||||
"oldfieldname": "item_group",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Item Group",
|
||||
"print_hide": 1,
|
||||
"read_only": 1,
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "purchase_order",
|
||||
"fieldtype": "Link",
|
||||
"in_filter": 1,
|
||||
"in_list_view": 0,
|
||||
"label": "Purchase Order",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "purchase_order",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Purchase Order",
|
||||
"print_hide": 1,
|
||||
"read_only": 1,
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "po_detail",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 1,
|
||||
"in_filter": 1,
|
||||
"in_list_view": 0,
|
||||
"label": "Purchase Order Item",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "po_detail",
|
||||
"oldfieldtype": "Data",
|
||||
"print_hide": 1,
|
||||
"read_only": 1,
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "purchase_receipt",
|
||||
"fieldtype": "Link",
|
||||
"in_filter": 1,
|
||||
"in_list_view": 0,
|
||||
"label": "Purchase Receipt",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "purchase_receipt",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Purchase Receipt",
|
||||
"print_hide": 1,
|
||||
"read_only": 1,
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "pr_detail",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 1,
|
||||
"in_filter": 1,
|
||||
"in_list_view": 0,
|
||||
"label": "PR Detail",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "pr_detail",
|
||||
"oldfieldtype": "Data",
|
||||
"print_hide": 1,
|
||||
"read_only": 1,
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"description": "Tax detail table fetched from item master as a string and stored in this field.\nUsed for Taxes and Charges",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "item_tax_rate",
|
||||
"fieldtype": "Small Text",
|
||||
"hidden": 1,
|
||||
"in_list_view": 0,
|
||||
"label": "Item Tax Rate",
|
||||
"oldfieldname": "item_tax_rate",
|
||||
"oldfieldtype": "Small Text",
|
||||
"print_hide": 1,
|
||||
"read_only": 1,
|
||||
"report_hide": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "item_tax_amount",
|
||||
"fieldtype": "Currency",
|
||||
"hidden": 1,
|
||||
"in_list_view": 0,
|
||||
"label": "Item Tax Amount",
|
||||
"no_copy": 1,
|
||||
"options": "Company:company:default_currency",
|
||||
"print_hide": 1,
|
||||
"print_width": "150px",
|
||||
"read_only": 1,
|
||||
"search_index": 0,
|
||||
"width": "150px"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "valuation_rate",
|
||||
"fieldtype": "Currency",
|
||||
"hidden": 1,
|
||||
"in_list_view": 0,
|
||||
"label": "Valuation Rate",
|
||||
"no_copy": 1,
|
||||
"options": "Company:company:default_currency",
|
||||
"print_hide": 1,
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "conversion_factor",
|
||||
"fieldtype": "Float",
|
||||
"in_list_view": 0,
|
||||
"label": "Conversion Factor",
|
||||
"print_hide": 1,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "rm_supp_cost",
|
||||
"fieldtype": "Currency",
|
||||
"hidden": 1,
|
||||
"in_list_view": 0,
|
||||
"label": "Raw Materials Supplied Cost",
|
||||
"no_copy": 1,
|
||||
"options": "Company:company:default_currency",
|
||||
"print_hide": 1,
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 1,
|
||||
"doctype": "DocField",
|
||||
"fieldname": "page_break",
|
||||
"fieldtype": "Check",
|
||||
"in_list_view": 0,
|
||||
"label": "Page Break",
|
||||
"no_copy": 1,
|
||||
"print_hide": 1,
|
||||
"read_only": 0,
|
||||
"report_hide": 1
|
||||
}
|
||||
]
|
||||
@@ -1,9 +0,0 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
class DocType:
|
||||
def __init__(self, d, dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
@@ -1,169 +0,0 @@
|
||||
[
|
||||
{
|
||||
"creation": "2013-05-21 16:16:04",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-07-10 14:54:18",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
{
|
||||
"autoname": "PVTD.######",
|
||||
"doctype": "DocType",
|
||||
"hide_heading": 1,
|
||||
"istable": 1,
|
||||
"module": "Accounts",
|
||||
"name": "__common__"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"name": "__common__",
|
||||
"parent": "Purchase Taxes and Charges",
|
||||
"parentfield": "fields",
|
||||
"parenttype": "DocType",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocType",
|
||||
"name": "Purchase Taxes and Charges"
|
||||
},
|
||||
{
|
||||
"default": "Valuation and Total",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "category",
|
||||
"fieldtype": "Select",
|
||||
"in_list_view": 1,
|
||||
"label": "Consider Tax or Charge for",
|
||||
"oldfieldname": "category",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "Valuation and Total\nValuation\nTotal",
|
||||
"read_only": 0,
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "charge_type",
|
||||
"fieldtype": "Select",
|
||||
"in_list_view": 1,
|
||||
"label": "Type",
|
||||
"oldfieldname": "charge_type",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "\nActual\nOn Net Total\nOn Previous Row Amount\nOn Previous Row Total",
|
||||
"read_only": 0,
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "account_head",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 1,
|
||||
"label": "Account Head",
|
||||
"oldfieldname": "account_head",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Account",
|
||||
"read_only": 0,
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"default": ":Company",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "cost_center",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 1,
|
||||
"label": "Cost Center",
|
||||
"oldfieldname": "cost_center",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Cost Center",
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "description",
|
||||
"fieldtype": "Small Text",
|
||||
"in_list_view": 1,
|
||||
"label": "Description",
|
||||
"oldfieldname": "description",
|
||||
"oldfieldtype": "Small Text",
|
||||
"print_width": "300px",
|
||||
"read_only": 0,
|
||||
"reqd": 1,
|
||||
"width": "300px"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "rate",
|
||||
"fieldtype": "Float",
|
||||
"in_list_view": 1,
|
||||
"label": "Rate",
|
||||
"oldfieldname": "rate",
|
||||
"oldfieldtype": "Currency",
|
||||
"read_only": 0,
|
||||
"reqd": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "tax_amount",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Amount",
|
||||
"oldfieldname": "tax_amount",
|
||||
"oldfieldtype": "Currency",
|
||||
"options": "Company:company:default_currency",
|
||||
"read_only": 1,
|
||||
"reqd": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "total",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Total",
|
||||
"oldfieldname": "total",
|
||||
"oldfieldtype": "Currency",
|
||||
"options": "Company:company:default_currency",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "row_id",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"label": "Enter Row",
|
||||
"oldfieldname": "row_id",
|
||||
"oldfieldtype": "Data",
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"default": "Add",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "add_deduct_tax",
|
||||
"fieldtype": "Select",
|
||||
"label": "Add or Deduct",
|
||||
"oldfieldname": "add_deduct_tax",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "Add\nDeduct",
|
||||
"read_only": 0,
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "item_wise_tax_detail",
|
||||
"fieldtype": "Small Text",
|
||||
"hidden": 1,
|
||||
"label": "Item Wise Tax Detail ",
|
||||
"oldfieldname": "item_wise_tax_detail",
|
||||
"oldfieldtype": "Small Text",
|
||||
"print_hide": 1,
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "parenttype",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 1,
|
||||
"in_filter": 1,
|
||||
"label": "Parenttype",
|
||||
"oldfieldname": "parenttype",
|
||||
"oldfieldtype": "Data",
|
||||
"print_hide": 1,
|
||||
"read_only": 0,
|
||||
"search_index": 0
|
||||
}
|
||||
]
|
||||
@@ -1,182 +0,0 @@
|
||||
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
// License: GNU General Public License v3. See license.txt
|
||||
|
||||
//
|
||||
|
||||
//--------- ONLOAD -------------
|
||||
wn.require("app/js/controllers/accounts.js");
|
||||
|
||||
cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
||||
|
||||
}
|
||||
|
||||
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
||||
cur_frm.set_footnote(wn.markdown(cur_frm.meta.description));
|
||||
}
|
||||
|
||||
// For customizing print
|
||||
cur_frm.pformat.net_total_import = function(doc) {
|
||||
return '';
|
||||
}
|
||||
|
||||
cur_frm.pformat.grand_total_import = function(doc) {
|
||||
return '';
|
||||
}
|
||||
|
||||
cur_frm.pformat.in_words_import = function(doc) {
|
||||
return '';
|
||||
}
|
||||
|
||||
cur_frm.pformat.purchase_tax_details= function(doc){
|
||||
|
||||
//function to make row of table
|
||||
var make_row = function(title,val,bold){
|
||||
var bstart = '<b>'; var bend = '</b>';
|
||||
return '<tr><td style="width:50%;">'+(bold?bstart:'')+title+(bold?bend:'')+'</td>'
|
||||
+'<td style="width:25%;text-align:right;"></td>'
|
||||
+'<td style="width:25%;text-align:right;">'+format_currency(val, doc.currency)+'</td>'
|
||||
+'</tr>'
|
||||
}
|
||||
|
||||
function convert_rate(val){
|
||||
var new_val = flt(val)/flt(doc.conversion_rate);
|
||||
return new_val;
|
||||
}
|
||||
|
||||
function print_hide(fieldname) {
|
||||
var doc_field = wn.meta.get_docfield(doc.doctype, fieldname, doc.name);
|
||||
return doc_field.print_hide;
|
||||
}
|
||||
|
||||
var cl = getchildren('Purchase Taxes and Charges',doc.name,'purchase_tax_details');
|
||||
|
||||
// outer table
|
||||
var out='<div><table class="noborder" style="width:100%">\
|
||||
<tr><td style="width: 60%"></td><td>';
|
||||
|
||||
// main table
|
||||
out +='<table class="noborder" style="width:100%">';
|
||||
if(!print_hide('net_total_import')) {
|
||||
out += make_row('Net Total', doc.net_total_import, 1);
|
||||
}
|
||||
|
||||
// add rows
|
||||
if(cl.length){
|
||||
for(var i=0;i<cl.length;i++){
|
||||
out += make_row(cl[i].description,convert_rate(cl[i].tax_amount),0);
|
||||
}
|
||||
}
|
||||
// grand total
|
||||
if(!print_hide('grand_total_import')) {
|
||||
out += make_row('Grand Total', doc.grand_total_import, 1);
|
||||
}
|
||||
if(doc.in_words_import && !print_hide('in_words_import')){
|
||||
out +='</table></td></tr>';
|
||||
out += '<tr><td colspan = "2">';
|
||||
out += '<table><tr><td style="width:25%;"><b>In Words</b></td>';
|
||||
out+= '<td style="width:50%;">'+doc.in_words_import+'</td></tr>';
|
||||
}
|
||||
out +='</table></td></tr></table></div>';
|
||||
return out;
|
||||
}
|
||||
|
||||
cur_frm.cscript.add_deduct_tax = function(doc, cdt, cdn) {
|
||||
var d = locals[cdt][cdn];
|
||||
if(!d.category && d.add_deduct_tax){
|
||||
alert(wn._("Please select Category first"));
|
||||
d.add_deduct_tax = '';
|
||||
}
|
||||
else if(d.category != 'Total' && d.add_deduct_tax == 'Deduct') {
|
||||
console.log([d.category, d.add_deduct_tax]);
|
||||
msgprint(wn._("You cannot deduct when category is for 'Valuation' or 'Valuation and Total'"));
|
||||
d.add_deduct_tax = '';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
cur_frm.cscript.charge_type = function(doc, cdt, cdn) {
|
||||
var d = locals[cdt][cdn];
|
||||
if(!d.category && d.charge_type){
|
||||
alert(wn._("Please select Category first"));
|
||||
d.charge_type = '';
|
||||
}
|
||||
else if(d.idx == 1 && (d.charge_type == 'On Previous Row Amount' || d.charge_type == 'On Previous Row Total')){
|
||||
alert(wn._("You cannot select Charge Type as 'On Previous Row Amount' or 'On Previous Row Total' for first row"));
|
||||
d.charge_type = '';
|
||||
}
|
||||
else if((d.category == 'Valuation' || d.category == 'Valuation and Total') && (d.charge_type == 'On Previous Row Amount' || d.charge_type == 'On Previous Row Total')){
|
||||
alert(wn._("You cannot select charge type as 'On Previous Row Amount' or 'On Previous Row Total' for valuation. You can select only 'Total' option for previous row amount or previous row total"))
|
||||
d.charge_type = '';
|
||||
}
|
||||
validated = false;
|
||||
refresh_field('charge_type',d.name,'purchase_tax_details');
|
||||
|
||||
cur_frm.cscript.row_id(doc, cdt, cdn);
|
||||
cur_frm.cscript.rate(doc, cdt, cdn);
|
||||
cur_frm.cscript.tax_amount(doc, cdt, cdn);
|
||||
}
|
||||
|
||||
|
||||
cur_frm.cscript.row_id = function(doc, cdt, cdn) {
|
||||
var d = locals[cdt][cdn];
|
||||
if(!d.charge_type && d.row_id){
|
||||
alert(wn._("Please select Charge Type first"));
|
||||
d.row_id = '';
|
||||
}
|
||||
else if((d.charge_type == 'Actual' || d.charge_type == 'On Net Total') && d.row_id) {
|
||||
alert(wn._("You can Enter Row only if your Charge Type is 'On Previous Row Amount' or ' Previous Row Total'"));
|
||||
d.row_id = '';
|
||||
}
|
||||
else if((d.charge_type == 'On Previous Row Amount' || d.charge_type == 'On Previous Row Total') && d.row_id){
|
||||
if(d.row_id >= d.idx){
|
||||
alert(wn._("You cannot Enter Row no. greater than or equal to current row no. for this Charge type"));
|
||||
d.row_id = '';
|
||||
}
|
||||
}
|
||||
validated = false;
|
||||
refresh_field('row_id',d.name,'purchase_tax_details');
|
||||
}
|
||||
|
||||
cur_frm.set_query("account_head", "purchase_tax_details", function(doc) {
|
||||
return {
|
||||
query: "controllers.queries.tax_account_query",
|
||||
filters: {
|
||||
"account_type": ["Tax", "Chargeable", "Expense Account"],
|
||||
"debit_or_credit": "Debit",
|
||||
"company": doc.company
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
cur_frm.fields_dict['purchase_tax_details'].grid.get_field("cost_center").get_query = function(doc) {
|
||||
return {
|
||||
filters: {
|
||||
'company': doc.company,
|
||||
'group_or_ledger': "Ledger"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.cscript.rate = function(doc, cdt, cdn) {
|
||||
var d = locals[cdt][cdn];
|
||||
if(!d.charge_type && d.rate) {
|
||||
alert(wn._("Please select Charge Type first"));
|
||||
d.rate = '';
|
||||
}
|
||||
validated = false;
|
||||
refresh_field('rate',d.name,'purchase_tax_details');
|
||||
}
|
||||
|
||||
cur_frm.cscript.tax_amount = function(doc, cdt, cdn) {
|
||||
var d = locals[cdt][cdn];
|
||||
if(!d.charge_type && d.tax_amount){
|
||||
alert(wn._("Please select Charge Type first"));
|
||||
d.tax_amount = '';
|
||||
}
|
||||
else if(d.charge_type && d.tax_amount) {
|
||||
alert(wn._("You cannot directly enter Amount and if your Charge Type is Actual enter your amount in Rate"));
|
||||
d.tax_amount = '';
|
||||
}
|
||||
validated = false;
|
||||
refresh_field('tax_amount',d.name,'purchase_tax_details');
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
from webnotes.model import db_exists
|
||||
from webnotes.model.bean import copy_doclist
|
||||
from webnotes.model.code import get_obj
|
||||
|
||||
|
||||
|
||||
|
||||
class DocType:
|
||||
def __init__(self, doc, doclist=[]):
|
||||
self.doc = doc
|
||||
self.doclist = doclist
|
||||
@@ -1,91 +0,0 @@
|
||||
[
|
||||
{
|
||||
"creation": "2013-01-10 16:34:08",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-07-22 15:22:25",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "wasim@webnotestech.com"
|
||||
},
|
||||
{
|
||||
"autoname": "field:title",
|
||||
"description": "Standard tax template that can be applied to all Purchase Transactions. This template can contain list of tax heads and also other expense heads like \"Shipping\", \"Insurance\", \"Handling\" etc.\n\n#### Note\n\nThe tax rate you define here will be the standard tax rate for all **Items**. If there are **Items** that have different rates, they must be added in the **Item Tax** table in the **Item** master.\n\n#### Description of Columns\n\n1. Calculation Type: \n - This can be on **Net Total** (that is the sum of basic amount).\n - **On Previous Row Total / Amount** (for cumulative taxes or charges). If you select this option, the tax will be applied as a percentage of the previous row (in the tax table) amount or total.\n - **Actual** (as mentioned).\n2. Account Head: The Account ledger under which this tax will be booked\n3. Cost Center: If the tax / charge is an income (like shipping) or expense it needs to be booked against a Cost Center.\n4. Description: Description of the tax (that will be printed in invoices / quotes).\n5. Rate: Tax rate.\n6. Amount: Tax amount.\n7. Total: Cumulative total to this point.\n8. Enter Row: If based on \"Previous Row Total\" you can select the row number which will be taken as a base for this calculation (default is the previous row).\n9. Consider Tax or Charge for: In this section you can specify if the tax / charge is only for valuation (not a part of total) or only for total (does not add value to the item) or for both.\n10. Add or Deduct: Whether you want to add or deduct the tax.",
|
||||
"doctype": "DocType",
|
||||
"document_type": "Master",
|
||||
"icon": "icon-money",
|
||||
"module": "Accounts",
|
||||
"name": "__common__"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"name": "__common__",
|
||||
"parent": "Purchase Taxes and Charges Master",
|
||||
"parentfield": "fields",
|
||||
"parenttype": "DocType",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocPerm",
|
||||
"name": "__common__",
|
||||
"parent": "Purchase Taxes and Charges Master",
|
||||
"parentfield": "permissions",
|
||||
"parenttype": "DocType",
|
||||
"permlevel": 0,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"submit": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocType",
|
||||
"name": "Purchase Taxes and Charges Master"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "title",
|
||||
"fieldtype": "Data",
|
||||
"in_filter": 1,
|
||||
"label": "Title",
|
||||
"oldfieldname": "title",
|
||||
"oldfieldtype": "Data",
|
||||
"reqd": 1,
|
||||
"search_index": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "is_default",
|
||||
"fieldtype": "Check",
|
||||
"label": "Default"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "company",
|
||||
"fieldtype": "Link",
|
||||
"in_filter": 1,
|
||||
"label": "Company",
|
||||
"options": "Company",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "purchase_tax_details",
|
||||
"fieldtype": "Table",
|
||||
"label": "Purchase Taxes and Charges",
|
||||
"oldfieldname": "purchase_tax_details",
|
||||
"oldfieldtype": "Table",
|
||||
"options": "Purchase Taxes and Charges"
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"doctype": "DocPerm",
|
||||
"role": "Purchase Manager",
|
||||
"write": 0
|
||||
},
|
||||
{
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"role": "Purchase Master Manager",
|
||||
"write": 1
|
||||
}
|
||||
]
|
||||
@@ -1,581 +0,0 @@
|
||||
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
// License: GNU General Public License v3. See license.txt
|
||||
|
||||
erpnext.POS = Class.extend({
|
||||
init: function(wrapper, frm) {
|
||||
this.wrapper = wrapper;
|
||||
this.frm = frm;
|
||||
this.wrapper.html('<div class="container">\
|
||||
<div class="row" style="margin: -9px 0px 10px -30px; border-bottom: 1px solid #c7c7c7;">\
|
||||
<div class="party-area col-sm-3 col-xs-6"></div>\
|
||||
<div class="barcode-area col-sm-3 col-xs-6"></div>\
|
||||
<div class="search-area col-sm-3 col-xs-6"></div>\
|
||||
<div class="item-group-area col-sm-3 col-xs-6"></div>\
|
||||
</div>\
|
||||
<div class="row">\
|
||||
<div class="col-sm-6">\
|
||||
<div class="pos-bill">\
|
||||
<div class="item-cart">\
|
||||
<table class="table table-condensed table-hover" id="cart" style="table-layout: fixed;">\
|
||||
<thead>\
|
||||
<tr>\
|
||||
<th style="width: 40%">Item</th>\
|
||||
<th style="width: 9%"></th>\
|
||||
<th style="width: 17%; text-align: right;">Qty</th>\
|
||||
<th style="width: 9%"></th>\
|
||||
<th style="width: 25%; text-align: right;">Rate</th>\
|
||||
</tr>\
|
||||
</thead>\
|
||||
<tbody>\
|
||||
</tbody>\
|
||||
</table>\
|
||||
</div>\
|
||||
<br>\
|
||||
<div class="totals-area" style="margin-left: 40%;">\
|
||||
<table class="table table-condensed">\
|
||||
<tr>\
|
||||
<td><b>Net Total</b></td>\
|
||||
<td style="text-align: right;" class="net-total"></td>\
|
||||
</tr>\
|
||||
</table>\
|
||||
<div class="tax-table" style="display: none;">\
|
||||
<table class="table table-condensed">\
|
||||
<thead>\
|
||||
<tr>\
|
||||
<th style="width: 60%">Taxes</th>\
|
||||
<th style="width: 40%; text-align: right;"></th>\
|
||||
</tr>\
|
||||
</thead>\
|
||||
<tbody>\
|
||||
</tbody>\
|
||||
</table>\
|
||||
</div>\
|
||||
<div class="grand-total-area">\
|
||||
<table class="table table-condensed">\
|
||||
<tr>\
|
||||
<td style="vertical-align: middle;"><b>Grand Total</b></td>\
|
||||
<td style="text-align: right; font-size: 200%; \
|
||||
font-size: bold;" class="grand-total"></td>\
|
||||
</tr>\
|
||||
</table>\
|
||||
</div>\
|
||||
</div>\
|
||||
</div>\
|
||||
<br><br>\
|
||||
<div class="row">\
|
||||
<div class="col-sm-9">\
|
||||
<button class="btn btn-success btn-lg make-payment">\
|
||||
<i class="icon-money"></i> Make Payment</button>\
|
||||
</div>\
|
||||
<div class="col-sm-3">\
|
||||
<button class="btn btn-default btn-lg remove-items" style="display: none;">\
|
||||
<i class="icon-trash"></i> Del</button>\
|
||||
</div>\
|
||||
</div>\
|
||||
<br><br>\
|
||||
</div>\
|
||||
<div class="col-sm-6">\
|
||||
<div class="item-list-area">\
|
||||
<div class="col-sm-12">\
|
||||
<div class="row item-list"></div></div>\
|
||||
</div>\
|
||||
</div>\
|
||||
</div></div>');
|
||||
|
||||
this.check_transaction_type();
|
||||
this.make();
|
||||
|
||||
var me = this;
|
||||
$(this.frm.wrapper).on("refresh-fields", function() {
|
||||
me.refresh();
|
||||
});
|
||||
|
||||
this.call_function("remove-items", function() {me.remove_selected_items();});
|
||||
this.call_function("make-payment", function() {me.make_payment();});
|
||||
},
|
||||
check_transaction_type: function() {
|
||||
var me = this;
|
||||
|
||||
// Check whether the transaction is "Sales" or "Purchase"
|
||||
if (wn.meta.has_field(cur_frm.doc.doctype, "customer")) {
|
||||
this.set_transaction_defaults("Customer", "export");
|
||||
}
|
||||
else if (wn.meta.has_field(cur_frm.doc.doctype, "supplier")) {
|
||||
this.set_transaction_defaults("Supplier", "import");
|
||||
}
|
||||
},
|
||||
set_transaction_defaults: function(party, export_or_import) {
|
||||
var me = this;
|
||||
this.party = party;
|
||||
this.price_list = (party == "Customer" ?
|
||||
this.frm.doc.selling_price_list : this.frm.doc.buying_price_list);
|
||||
this.sales_or_purchase = (party == "Customer" ? "Sales" : "Purchase");
|
||||
this.net_total = "net_total_" + export_or_import;
|
||||
this.grand_total = "grand_total_" + export_or_import;
|
||||
this.amount = export_or_import + "_amount";
|
||||
this.rate = export_or_import + "_rate";
|
||||
},
|
||||
call_function: function(class_name, fn, event_name) {
|
||||
this.wrapper.find("." + class_name).on(event_name || "click", fn);
|
||||
},
|
||||
make: function() {
|
||||
this.make_party();
|
||||
this.make_item_group();
|
||||
this.make_search();
|
||||
this.make_barcode();
|
||||
this.make_item_list();
|
||||
},
|
||||
make_party: function() {
|
||||
var me = this;
|
||||
this.party_field = wn.ui.form.make_control({
|
||||
df: {
|
||||
"fieldtype": "Link",
|
||||
"options": this.party,
|
||||
"label": this.party,
|
||||
"fieldname": "pos_party",
|
||||
"placeholder": this.party
|
||||
},
|
||||
parent: this.wrapper.find(".party-area"),
|
||||
only_input: true,
|
||||
});
|
||||
this.party_field.make_input();
|
||||
this.party_field.$input.on("change", function() {
|
||||
if(!me.party_field.autocomplete_open)
|
||||
wn.model.set_value(me.frm.doctype, me.frm.docname,
|
||||
me.party.toLowerCase(), this.value);
|
||||
});
|
||||
},
|
||||
make_item_group: function() {
|
||||
var me = this;
|
||||
this.item_group = wn.ui.form.make_control({
|
||||
df: {
|
||||
"fieldtype": "Link",
|
||||
"options": "Item Group",
|
||||
"label": "Item Group",
|
||||
"fieldname": "pos_item_group",
|
||||
"placeholder": "Item Group"
|
||||
},
|
||||
parent: this.wrapper.find(".item-group-area"),
|
||||
only_input: true,
|
||||
});
|
||||
this.item_group.make_input();
|
||||
this.item_group.$input.on("change", function() {
|
||||
if(!me.item_group.autocomplete_open)
|
||||
me.make_item_list();
|
||||
});
|
||||
},
|
||||
make_search: function() {
|
||||
var me = this;
|
||||
this.search = wn.ui.form.make_control({
|
||||
df: {
|
||||
"fieldtype": "Data",
|
||||
"label": "Item",
|
||||
"fieldname": "pos_item",
|
||||
"placeholder": "Search Item"
|
||||
},
|
||||
parent: this.wrapper.find(".search-area"),
|
||||
only_input: true,
|
||||
});
|
||||
this.search.make_input();
|
||||
this.search.$input.on("keypress", function() {
|
||||
if(!me.search.autocomplete_open)
|
||||
if(me.item_timeout)
|
||||
clearTimeout(me.item_timeout);
|
||||
me.item_timeout = setTimeout(function() { me.make_item_list(); }, 1000);
|
||||
});
|
||||
},
|
||||
make_barcode: function() {
|
||||
var me = this;
|
||||
this.barcode = wn.ui.form.make_control({
|
||||
df: {
|
||||
"fieldtype": "Data",
|
||||
"label": "Barcode",
|
||||
"fieldname": "pos_barcode",
|
||||
"placeholder": "Barcode / Serial No"
|
||||
},
|
||||
parent: this.wrapper.find(".barcode-area"),
|
||||
only_input: true,
|
||||
});
|
||||
this.barcode.make_input();
|
||||
this.barcode.$input.on("keypress", function() {
|
||||
if(me.barcode_timeout)
|
||||
clearTimeout(me.barcode_timeout);
|
||||
me.barcode_timeout = setTimeout(function() { me.add_item_thru_barcode(); }, 1000);
|
||||
});
|
||||
},
|
||||
make_item_list: function() {
|
||||
var me = this;
|
||||
me.item_timeout = null;
|
||||
wn.call({
|
||||
method: 'accounts.doctype.sales_invoice.pos.get_items',
|
||||
args: {
|
||||
sales_or_purchase: this.sales_or_purchase,
|
||||
price_list: this.price_list,
|
||||
item_group: this.item_group.$input.val(),
|
||||
item: this.search.$input.val()
|
||||
},
|
||||
callback: function(r) {
|
||||
var $wrap = me.wrapper.find(".item-list");
|
||||
me.wrapper.find(".item-list").empty();
|
||||
if (r.message) {
|
||||
$.each(r.message, function(index, obj) {
|
||||
if (obj.image)
|
||||
image = '<img src="' + obj.image + '" class="img-responsive" \
|
||||
style="border:1px solid #eee; max-height: 140px;">';
|
||||
else
|
||||
image = '<div class="missing-image"><i class="icon-camera"></i></div>';
|
||||
|
||||
$(repl('<div class="col-xs-3 pos-item" data-item_code="%(item_code)s">\
|
||||
<div style="height: 140px; overflow: hidden;">%(item_image)s</div>\
|
||||
<div class="small">%(item_code)s</div>\
|
||||
<div class="small">%(item_name)s</div>\
|
||||
<div class="small">%(item_price)s</div>\
|
||||
</div>',
|
||||
{
|
||||
item_code: obj.name,
|
||||
item_price: format_currency(obj.ref_rate, obj.currency),
|
||||
item_name: obj.name===obj.item_name ? "" : obj.item_name,
|
||||
item_image: image
|
||||
})).appendTo($wrap);
|
||||
});
|
||||
}
|
||||
|
||||
// if form is local then allow this function
|
||||
$(me.wrapper).find("div.pos-item").on("click", function() {
|
||||
if(me.frm.doc.docstatus==0) {
|
||||
if(!me.frm.doc[me.party.toLowerCase()] && ((me.frm.doctype == "Quotation" &&
|
||||
me.frm.doc.quotation_to == "Customer")
|
||||
|| me.frm.doctype != "Quotation")) {
|
||||
msgprint("Please select " + me.party + " first.");
|
||||
return;
|
||||
}
|
||||
else
|
||||
me.add_to_cart($(this).attr("data-item_code"));
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
add_to_cart: function(item_code, serial_no) {
|
||||
var me = this;
|
||||
var caught = false;
|
||||
|
||||
// get no_of_items
|
||||
var no_of_items = me.wrapper.find("#cart tbody tr").length;
|
||||
|
||||
// check whether the item is already added
|
||||
if (no_of_items != 0) {
|
||||
$.each(wn.model.get_children(this.frm.doctype + " Item", this.frm.doc.name,
|
||||
this.frm.cscript.fname, this.frm.doctype), function(i, d) {
|
||||
if (d.item_code == item_code) {
|
||||
caught = true;
|
||||
if (serial_no) {
|
||||
d.serial_no += '\n' + serial_no;
|
||||
me.frm.script_manager.trigger("serial_no", d.doctype, d.name);
|
||||
}
|
||||
else {
|
||||
d.qty += 1;
|
||||
me.frm.script_manager.trigger("qty", d.doctype, d.name);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// if item not found then add new item
|
||||
if (!caught) {
|
||||
this.add_new_item_to_grid(item_code, serial_no);
|
||||
}
|
||||
|
||||
this.refresh();
|
||||
this.refresh_search_box();
|
||||
},
|
||||
add_new_item_to_grid: function(item_code, serial_no) {
|
||||
var me = this;
|
||||
|
||||
var child = wn.model.add_child(me.frm.doc, this.frm.doctype + " Item",
|
||||
this.frm.cscript.fname);
|
||||
child.item_code = item_code;
|
||||
|
||||
if (serial_no)
|
||||
child.serial_no = serial_no;
|
||||
|
||||
this.frm.script_manager.trigger("item_code", child.doctype, child.name);
|
||||
},
|
||||
refresh_search_box: function() {
|
||||
var me = this;
|
||||
|
||||
// Clear Item Box and remake item list
|
||||
if (this.search.$input.val()) {
|
||||
this.search.set_input("");
|
||||
this.make_item_list();
|
||||
}
|
||||
},
|
||||
update_qty: function(item_code, qty) {
|
||||
var me = this;
|
||||
$.each(wn.model.get_children(this.frm.doctype + " Item", this.frm.doc.name,
|
||||
this.frm.cscript.fname, this.frm.doctype), function(i, d) {
|
||||
if (d.item_code == item_code) {
|
||||
if (qty == 0) {
|
||||
wn.model.clear_doc(d.doctype, d.name);
|
||||
me.refresh_grid();
|
||||
} else {
|
||||
d.qty = qty;
|
||||
me.frm.script_manager.trigger("qty", d.doctype, d.name);
|
||||
}
|
||||
}
|
||||
});
|
||||
me.refresh();
|
||||
},
|
||||
refresh: function() {
|
||||
var me = this;
|
||||
this.party_field.set_input(this.frm.doc[this.party.toLowerCase()]);
|
||||
this.barcode.set_input("");
|
||||
|
||||
this.show_items_in_item_cart();
|
||||
this.show_taxes();
|
||||
this.set_totals();
|
||||
|
||||
// if form is local then only run all these functions
|
||||
if (this.frm.doc.docstatus===0) {
|
||||
this.call_when_local();
|
||||
}
|
||||
|
||||
this.disable_text_box_and_button();
|
||||
this.hide_payment_button();
|
||||
|
||||
// If quotation to is not Customer then remove party
|
||||
if (this.frm.doctype == "Quotation") {
|
||||
this.party_field.$wrapper.remove();
|
||||
if (this.frm.doc.quotation_to == "Customer")
|
||||
this.make_party();
|
||||
}
|
||||
},
|
||||
show_items_in_item_cart: function() {
|
||||
var me = this;
|
||||
var $items = this.wrapper.find("#cart tbody").empty();
|
||||
|
||||
$.each(wn.model.get_children(this.frm.doctype + " Item", this.frm.doc.name,
|
||||
this.frm.cscript.fname, this.frm.doctype), function(i, d) {
|
||||
|
||||
$(repl('<tr id="%(item_code)s" data-selected="false">\
|
||||
<td>%(item_code)s%(item_name)s</td>\
|
||||
<td style="vertical-align:middle;" align="right">\
|
||||
<div class="decrease-qty" style="cursor:pointer;">\
|
||||
<i class="icon-minus-sign icon-large text-danger"></i>\
|
||||
</div>\
|
||||
</td>\
|
||||
<td style="vertical-align:middle;"><input type="text" value="%(qty)s" \
|
||||
class="form-control qty" style="text-align: right;"></td>\
|
||||
<td style="vertical-align:middle;cursor:pointer;">\
|
||||
<div class="increase-qty" style="cursor:pointer;">\
|
||||
<i class="icon-plus-sign icon-large text-success"></i>\
|
||||
</div>\
|
||||
</td>\
|
||||
<td style="text-align: right;"><b>%(amount)s</b><br>%(rate)s</td>\
|
||||
</tr>',
|
||||
{
|
||||
item_code: d.item_code,
|
||||
item_name: d.item_name===d.item_code ? "" : ("<br>" + d.item_name),
|
||||
qty: d.qty,
|
||||
rate: format_currency(d[me.rate], me.frm.doc.currency),
|
||||
amount: format_currency(d[me.amount], me.frm.doc.currency)
|
||||
}
|
||||
)).appendTo($items);
|
||||
});
|
||||
|
||||
this.wrapper.find(".increase-qty, .decrease-qty").on("click", function() {
|
||||
var item_code = $(this).closest("tr").attr("id");
|
||||
me.selected_item_qty_operation(item_code, $(this).attr("class"));
|
||||
});
|
||||
},
|
||||
show_taxes: function() {
|
||||
var me = this;
|
||||
var taxes = wn.model.get_children(this.sales_or_purchase + " Taxes and Charges",
|
||||
this.frm.doc.name, this.frm.cscript.other_fname, this.frm.doctype);
|
||||
$(this.wrapper).find(".tax-table")
|
||||
.toggle((taxes && taxes.length) ? true : false)
|
||||
.find("tbody").empty();
|
||||
|
||||
$.each(taxes, function(i, d) {
|
||||
if (d.tax_amount) {
|
||||
$(repl('<tr>\
|
||||
<td>%(description)s %(rate)s</td>\
|
||||
<td style="text-align: right;">%(tax_amount)s</td>\
|
||||
<tr>', {
|
||||
description: d.description,
|
||||
rate: ((d.charge_type == "Actual") ? '' : ("(" + d.rate + "%)")),
|
||||
tax_amount: format_currency(flt(d.tax_amount)/flt(me.frm.doc.conversion_rate),
|
||||
me.frm.doc.currency)
|
||||
})).appendTo(".tax-table tbody");
|
||||
}
|
||||
});
|
||||
},
|
||||
set_totals: function() {
|
||||
var me = this;
|
||||
this.wrapper.find(".net-total").text(format_currency(this.frm.doc[this.net_total],
|
||||
me.frm.doc.currency));
|
||||
this.wrapper.find(".grand-total").text(format_currency(this.frm.doc[this.grand_total],
|
||||
me.frm.doc.currency));
|
||||
},
|
||||
call_when_local: function() {
|
||||
var me = this;
|
||||
|
||||
// append quantity to the respective item after change from input box
|
||||
$(this.wrapper).find("input.qty").on("change", function() {
|
||||
var item_code = $(this).closest("tr")[0].id;
|
||||
me.update_qty(item_code, $(this).val());
|
||||
});
|
||||
|
||||
// on td click toggle the highlighting of row
|
||||
$(this.wrapper).find("#cart tbody tr td").on("click", function() {
|
||||
var row = $(this).closest("tr");
|
||||
if (row.attr("data-selected") == "false") {
|
||||
row.attr("class", "warning");
|
||||
row.attr("data-selected", "true");
|
||||
}
|
||||
else {
|
||||
row.prop("class", null);
|
||||
row.attr("data-selected", "false");
|
||||
}
|
||||
me.refresh_delete_btn();
|
||||
});
|
||||
|
||||
me.refresh_delete_btn();
|
||||
this.barcode.$input.focus();
|
||||
},
|
||||
disable_text_box_and_button: function() {
|
||||
var me = this;
|
||||
// if form is submitted & cancelled then disable all input box & buttons
|
||||
if (this.frm.doc.docstatus>=1) {
|
||||
$(this.wrapper).find('input, button').each(function () {
|
||||
$(this).prop('disabled', true);
|
||||
});
|
||||
$(this.wrapper).find(".remove-items").hide();
|
||||
$(this.wrapper).find(".make-payment").hide();
|
||||
}
|
||||
else {
|
||||
$(this.wrapper).find('input, button').each(function () {
|
||||
$(this).prop('disabled', false);
|
||||
});
|
||||
$(this.wrapper).find(".make-payment").show();
|
||||
}
|
||||
},
|
||||
hide_payment_button: function() {
|
||||
var me = this;
|
||||
// Show Make Payment button only in Sales Invoice
|
||||
if (this.frm.doctype != "Sales Invoice")
|
||||
$(this.wrapper).find(".make-payment").hide();
|
||||
},
|
||||
refresh_delete_btn: function() {
|
||||
$(this.wrapper).find(".remove-items").toggle($(".item-cart .warning").length ? true : false);
|
||||
},
|
||||
add_item_thru_barcode: function() {
|
||||
var me = this;
|
||||
me.barcode_timeout = null;
|
||||
wn.call({
|
||||
method: 'accounts.doctype.sales_invoice.pos.get_item_code',
|
||||
args: {barcode_serial_no: this.barcode.$input.val()},
|
||||
callback: function(r) {
|
||||
if (r.message) {
|
||||
if (r.message[1] == "serial_no")
|
||||
me.add_to_cart(r.message[0][0].item_code, r.message[0][0].name);
|
||||
else
|
||||
me.add_to_cart(r.message[0][0].name);
|
||||
}
|
||||
else
|
||||
msgprint(wn._("Invalid Barcode"));
|
||||
|
||||
me.refresh();
|
||||
}
|
||||
});
|
||||
},
|
||||
remove_selected_items: function() {
|
||||
var me = this;
|
||||
var selected_items = [];
|
||||
var no_of_items = $(this.wrapper).find("#cart tbody tr").length;
|
||||
for(var x=0; x<=no_of_items - 1; x++) {
|
||||
var row = $(this.wrapper).find("#cart tbody tr:eq(" + x + ")");
|
||||
if(row.attr("data-selected") == "true") {
|
||||
selected_items.push(row.attr("id"));
|
||||
}
|
||||
}
|
||||
|
||||
var child = wn.model.get_children(this.frm.doctype + " Item", this.frm.doc.name,
|
||||
this.frm.cscript.fname, this.frm.doctype);
|
||||
|
||||
$.each(child, function(i, d) {
|
||||
for (var i in selected_items) {
|
||||
if (d.item_code == selected_items[i]) {
|
||||
wn.model.clear_doc(d.doctype, d.name);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this.refresh_grid();
|
||||
},
|
||||
refresh_grid: function() {
|
||||
this.frm.fields_dict[this.frm.cscript.fname].grid.refresh();
|
||||
this.frm.script_manager.trigger("calculate_taxes_and_totals");
|
||||
this.refresh();
|
||||
},
|
||||
selected_item_qty_operation: function(item_code, operation) {
|
||||
var me = this;
|
||||
var child = wn.model.get_children(this.frm.doctype + " Item", this.frm.doc.name,
|
||||
this.frm.cscript.fname, this.frm.doctype);
|
||||
|
||||
$.each(child, function(i, d) {
|
||||
if (d.item_code == item_code) {
|
||||
if (operation == "increase-qty")
|
||||
d.qty += 1;
|
||||
else if (operation == "decrease-qty")
|
||||
d.qty != 1 ? d.qty -= 1 : d.qty = 1;
|
||||
|
||||
me.refresh();
|
||||
}
|
||||
});
|
||||
},
|
||||
make_payment: function() {
|
||||
var me = this;
|
||||
var no_of_items = $(this.wrapper).find("#cart tbody tr").length;
|
||||
var mode_of_payment = [];
|
||||
|
||||
if (no_of_items == 0)
|
||||
msgprint(wn._("Payment cannot be made for empty cart"));
|
||||
else {
|
||||
wn.call({
|
||||
method: 'accounts.doctype.sales_invoice.pos.get_mode_of_payment',
|
||||
callback: function(r) {
|
||||
for (x=0; x<=r.message.length - 1; x++) {
|
||||
mode_of_payment.push(r.message[x].name);
|
||||
}
|
||||
|
||||
// show payment wizard
|
||||
var dialog = new wn.ui.Dialog({
|
||||
width: 400,
|
||||
title: 'Payment',
|
||||
fields: [
|
||||
{fieldtype:'Data', fieldname:'total_amount', label:'Total Amount', read_only:1},
|
||||
{fieldtype:'Select', fieldname:'mode_of_payment', label:'Mode of Payment',
|
||||
options:mode_of_payment.join('\n'), reqd: 1},
|
||||
{fieldtype:'Button', fieldname:'pay', label:'Pay'}
|
||||
]
|
||||
});
|
||||
dialog.set_values({
|
||||
"total_amount": $(".grand-total").text()
|
||||
});
|
||||
dialog.show();
|
||||
dialog.get_input("total_amount").prop("disabled", true);
|
||||
|
||||
dialog.fields_dict.pay.input.onclick = function() {
|
||||
me.frm.set_value("mode_of_payment", dialog.get_values().mode_of_payment);
|
||||
me.frm.set_value("paid_amount", dialog.get_values().total_amount);
|
||||
me.frm.cscript.mode_of_payment(me.frm.doc);
|
||||
me.frm.save();
|
||||
dialog.hide();
|
||||
me.refresh();
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
@@ -1,52 +0,0 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
@webnotes.whitelist()
|
||||
def get_items(price_list, sales_or_purchase, item=None, item_group=None):
|
||||
condition = ""
|
||||
args = {"price_list": price_list}
|
||||
|
||||
if sales_or_purchase == "Sales":
|
||||
condition = "i.is_sales_item='Yes'"
|
||||
else:
|
||||
condition = "i.is_purchase_item='Yes'"
|
||||
|
||||
if item_group and item_group != "All Item Groups":
|
||||
condition += " and i.item_group='%s'" % item_group
|
||||
|
||||
if item:
|
||||
condition += " and CONCAT(i.name, i.item_name) like %(name)s"
|
||||
args["name"] = "%%%s%%" % item
|
||||
|
||||
return webnotes.conn.sql("""select i.name, i.item_name, i.image,
|
||||
item_det.ref_rate, item_det.currency
|
||||
from `tabItem` i LEFT JOIN
|
||||
(select item_code, ref_rate, currency from
|
||||
`tabItem Price` where price_list=%s) item_det
|
||||
ON
|
||||
item_det.item_code=i.name
|
||||
where
|
||||
%s""" % ('%(price_list)s', condition), args, as_dict=1)
|
||||
|
||||
@webnotes.whitelist()
|
||||
def get_item_code(barcode_serial_no):
|
||||
input_via = "serial_no"
|
||||
item_code = webnotes.conn.sql("""select name, item_code from `tabSerial No` where
|
||||
name=%s""", (barcode_serial_no), as_dict=1)
|
||||
|
||||
if not item_code:
|
||||
input_via = "barcode"
|
||||
item_code = webnotes.conn.sql("""select name from `tabItem` where barcode=%s""",
|
||||
(barcode_serial_no), as_dict=1)
|
||||
|
||||
if item_code:
|
||||
return item_code, input_via
|
||||
else:
|
||||
webnotes.throw("Invalid Barcode / Serial No")
|
||||
|
||||
@webnotes.whitelist()
|
||||
def get_mode_of_payment():
|
||||
return webnotes.conn.sql("""select name from `tabMode of Payment`""", as_dict=1)
|
||||
@@ -1,427 +0,0 @@
|
||||
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
// License: GNU General Public License v3. See license.txt
|
||||
|
||||
cur_frm.cscript.tname = "Sales Invoice Item";
|
||||
cur_frm.cscript.fname = "entries";
|
||||
cur_frm.cscript.other_fname = "other_charges";
|
||||
cur_frm.cscript.sales_team_fname = "sales_team";
|
||||
|
||||
// print heading
|
||||
cur_frm.pformat.print_heading = 'Invoice';
|
||||
|
||||
wn.require('app/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js');
|
||||
wn.require('app/utilities/doctype/sms_control/sms_control.js');
|
||||
wn.require('app/selling/sales_common.js');
|
||||
wn.require('app/accounts/doctype/sales_invoice/pos.js');
|
||||
|
||||
wn.provide("erpnext.accounts");
|
||||
erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.extend({
|
||||
onload: function() {
|
||||
this._super();
|
||||
|
||||
if(!this.frm.doc.__islocal && !this.frm.doc.customer && this.frm.doc.debit_to) {
|
||||
// show debit_to in print format
|
||||
this.frm.set_df_property("debit_to", "print_hide", 0);
|
||||
}
|
||||
|
||||
// toggle to pos view if is_pos is 1 in user_defaults
|
||||
if ((cint(wn.defaults.get_user_defaults("is_pos"))===1 || cur_frm.doc.is_pos)) {
|
||||
if(this.frm.doc.__islocal && !this.frm.doc.amended_from && !this.frm.doc.customer) {
|
||||
this.frm.set_value("is_pos", 1);
|
||||
this.is_pos(function() {
|
||||
if (cint(wn.defaults.get_user_defaults("fs_pos_view"))===1)
|
||||
cur_frm.cscript.toggle_pos(true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// if document is POS then change default print format to "POS Invoice"
|
||||
if(cur_frm.doc.is_pos && cur_frm.doc.docstatus===1) {
|
||||
locals.DocType[cur_frm.doctype].default_print_format = "POS Invoice";
|
||||
cur_frm.setup_print_layout();
|
||||
}
|
||||
},
|
||||
|
||||
refresh: function(doc, dt, dn) {
|
||||
this._super();
|
||||
|
||||
cur_frm.cscript.is_opening(doc, dt, dn);
|
||||
cur_frm.dashboard.reset();
|
||||
|
||||
if(doc.docstatus==1) {
|
||||
cur_frm.appframe.add_button('View Ledger', function() {
|
||||
wn.route_options = {
|
||||
"voucher_no": doc.name,
|
||||
"from_date": doc.posting_date,
|
||||
"to_date": doc.posting_date,
|
||||
"company": doc.company,
|
||||
group_by_voucher: 0
|
||||
};
|
||||
wn.set_route("query-report", "General Ledger");
|
||||
}, "icon-table");
|
||||
|
||||
var percent_paid = cint(flt(doc.grand_total - doc.outstanding_amount) / flt(doc.grand_total) * 100);
|
||||
cur_frm.dashboard.add_progress(percent_paid + "% Paid", percent_paid);
|
||||
|
||||
cur_frm.appframe.add_button(wn._('Send SMS'), cur_frm.cscript.send_sms, 'icon-mobile-phone');
|
||||
|
||||
if(cint(doc.update_stock)!=1) {
|
||||
// show Make Delivery Note button only if Sales Invoice is not created from Delivery Note
|
||||
var from_delivery_note = false;
|
||||
from_delivery_note = cur_frm.get_doclist({parentfield: "entries"})
|
||||
.some(function(item) {
|
||||
return item.delivery_note ? true : false;
|
||||
});
|
||||
|
||||
if(!from_delivery_note)
|
||||
cur_frm.appframe.add_primary_action(wn._('Make Delivery'), cur_frm.cscript['Make Delivery Note'])
|
||||
}
|
||||
|
||||
if(doc.outstanding_amount!=0)
|
||||
cur_frm.appframe.add_primary_action(wn._('Make Payment Entry'), cur_frm.cscript.make_bank_voucher);
|
||||
}
|
||||
|
||||
// Show buttons only when pos view is active
|
||||
if (doc.docstatus===0 && !this.pos_active) {
|
||||
cur_frm.cscript.sales_order_btn();
|
||||
cur_frm.cscript.delivery_note_btn();
|
||||
}
|
||||
},
|
||||
|
||||
sales_order_btn: function() {
|
||||
this.$sales_order_btn = cur_frm.appframe.add_primary_action(wn._('From Sales Order'),
|
||||
function() {
|
||||
wn.model.map_current_doc({
|
||||
method: "selling.doctype.sales_order.sales_order.make_sales_invoice",
|
||||
source_doctype: "Sales Order",
|
||||
get_query_filters: {
|
||||
docstatus: 1,
|
||||
status: ["!=", "Stopped"],
|
||||
per_billed: ["<", 99.99],
|
||||
customer: cur_frm.doc.customer || undefined,
|
||||
company: cur_frm.doc.company
|
||||
}
|
||||
})
|
||||
});
|
||||
},
|
||||
|
||||
delivery_note_btn: function() {
|
||||
this.$delivery_note_btn = cur_frm.appframe.add_primary_action(wn._('From Delivery Note'),
|
||||
function() {
|
||||
wn.model.map_current_doc({
|
||||
method: "stock.doctype.delivery_note.delivery_note.make_sales_invoice",
|
||||
source_doctype: "Delivery Note",
|
||||
get_query: function() {
|
||||
var filters = {
|
||||
company: cur_frm.doc.company
|
||||
};
|
||||
if(cur_frm.doc.customer) filters["customer"] = cur_frm.doc.customer;
|
||||
return {
|
||||
query: "controllers.queries.get_delivery_notes_to_be_billed",
|
||||
filters: filters
|
||||
};
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
tc_name: function() {
|
||||
this.get_terms();
|
||||
},
|
||||
|
||||
is_pos: function(callback_fn) {
|
||||
cur_frm.cscript.hide_fields(this.frm.doc);
|
||||
if(cint(this.frm.doc.is_pos)) {
|
||||
if(!this.frm.doc.company) {
|
||||
this.frm.set_value("is_pos", 0);
|
||||
msgprint(wn._("Please specify Company to proceed"));
|
||||
} else {
|
||||
var me = this;
|
||||
return this.frm.call({
|
||||
doc: me.frm.doc,
|
||||
method: "set_missing_values",
|
||||
callback: function(r) {
|
||||
if(!r.exc) {
|
||||
me.frm.script_manager.trigger("update_stock");
|
||||
me.set_default_values();
|
||||
me.set_dynamic_labels();
|
||||
me.calculate_taxes_and_totals();
|
||||
|
||||
if(callback_fn) callback_fn()
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
debit_to: function() {
|
||||
this.customer();
|
||||
},
|
||||
|
||||
allocated_amount: function() {
|
||||
this.calculate_total_advance("Sales Invoice", "advance_adjustment_details");
|
||||
this.frm.refresh_fields();
|
||||
},
|
||||
|
||||
write_off_outstanding_amount_automatically: function() {
|
||||
if(cint(this.frm.doc.write_off_outstanding_amount_automatically)) {
|
||||
wn.model.round_floats_in(this.frm.doc, ["grand_total", "paid_amount"]);
|
||||
// this will make outstanding amount 0
|
||||
this.frm.set_value("write_off_amount",
|
||||
flt(this.frm.doc.grand_total - this.frm.doc.paid_amount), precision("write_off_amount"));
|
||||
}
|
||||
|
||||
this.frm.script_manager.trigger("write_off_amount");
|
||||
},
|
||||
|
||||
write_off_amount: function() {
|
||||
this.calculate_outstanding_amount();
|
||||
this.frm.refresh_fields();
|
||||
},
|
||||
|
||||
paid_amount: function() {
|
||||
this.write_off_outstanding_amount_automatically();
|
||||
},
|
||||
|
||||
entries_add: function(doc, cdt, cdn) {
|
||||
var row = wn.model.get_doc(cdt, cdn);
|
||||
this.frm.script_manager.copy_from_first_row("entries", row, ["income_account", "cost_center"]);
|
||||
},
|
||||
|
||||
set_dynamic_labels: function() {
|
||||
this._super();
|
||||
this.hide_fields(this.frm.doc);
|
||||
},
|
||||
|
||||
entries_on_form_rendered: function(doc, grid_row) {
|
||||
erpnext.setup_serial_no(grid_row)
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// for backward compatibility: combine new and previous states
|
||||
$.extend(cur_frm.cscript, new erpnext.accounts.SalesInvoiceController({frm: cur_frm}));
|
||||
|
||||
// Hide Fields
|
||||
// ------------
|
||||
cur_frm.cscript.hide_fields = function(doc) {
|
||||
par_flds = ['project_name', 'due_date', 'is_opening', 'source', 'total_advance', 'gross_profit',
|
||||
'gross_profit_percent', 'get_advances_received',
|
||||
'advance_adjustment_details', 'sales_partner', 'commission_rate',
|
||||
'total_commission', 'advances'];
|
||||
|
||||
item_flds_normal = ['sales_order', 'delivery_note']
|
||||
|
||||
if(cint(doc.is_pos) == 1) {
|
||||
hide_field(par_flds);
|
||||
unhide_field('payments_section');
|
||||
cur_frm.fields_dict['entries'].grid.set_column_disp(item_flds_normal, false);
|
||||
} else {
|
||||
hide_field('payments_section');
|
||||
for (i in par_flds) {
|
||||
var docfield = wn.meta.docfield_map[doc.doctype][par_flds[i]];
|
||||
if(!docfield.hidden) unhide_field(par_flds[i]);
|
||||
}
|
||||
cur_frm.fields_dict['entries'].grid.set_column_disp(item_flds_normal, true);
|
||||
}
|
||||
|
||||
item_flds_stock = ['serial_no', 'batch_no', 'actual_qty', 'expense_account', 'warehouse']
|
||||
cur_frm.fields_dict['entries'].grid.set_column_disp(item_flds_stock,
|
||||
(cint(doc.update_stock)==1 ? true : false));
|
||||
|
||||
// India related fields
|
||||
var cp = wn.control_panel;
|
||||
if (cp.country == 'India') unhide_field(['c_form_applicable', 'c_form_no']);
|
||||
else hide_field(['c_form_applicable', 'c_form_no']);
|
||||
|
||||
cur_frm.refresh_fields();
|
||||
}
|
||||
|
||||
|
||||
cur_frm.cscript.mode_of_payment = function(doc) {
|
||||
return cur_frm.call({
|
||||
method: "get_bank_cash_account",
|
||||
args: { mode_of_payment: doc.mode_of_payment }
|
||||
});
|
||||
}
|
||||
|
||||
cur_frm.cscript.update_stock = function(doc, dt, dn) {
|
||||
cur_frm.cscript.hide_fields(doc, dt, dn);
|
||||
}
|
||||
|
||||
cur_frm.cscript.is_opening = function(doc, dt, dn) {
|
||||
hide_field('aging_date');
|
||||
if (doc.is_opening == 'Yes') unhide_field('aging_date');
|
||||
}
|
||||
|
||||
//Make Delivery Note Button
|
||||
//-----------------------------
|
||||
|
||||
cur_frm.cscript['Make Delivery Note'] = function() {
|
||||
wn.model.open_mapped_doc({
|
||||
method: "accounts.doctype.sales_invoice.sales_invoice.make_delivery_note",
|
||||
source_name: cur_frm.doc.name
|
||||
})
|
||||
}
|
||||
|
||||
cur_frm.cscript.make_bank_voucher = function() {
|
||||
return wn.call({
|
||||
method: "accounts.doctype.journal_voucher.journal_voucher.get_payment_entry_from_sales_invoice",
|
||||
args: {
|
||||
"sales_invoice": cur_frm.doc.name
|
||||
},
|
||||
callback: function(r) {
|
||||
var doclist = wn.model.sync(r.message);
|
||||
wn.set_route("Form", doclist[0].doctype, doclist[0].name);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
cur_frm.fields_dict.debit_to.get_query = function(doc) {
|
||||
return{
|
||||
filters: {
|
||||
'debit_or_credit': 'Debit',
|
||||
'is_pl_account': 'No',
|
||||
'group_or_ledger': 'Ledger',
|
||||
'company': doc.company
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.fields_dict.cash_bank_account.get_query = function(doc) {
|
||||
return{
|
||||
filters: {
|
||||
'debit_or_credit': 'Debit',
|
||||
'is_pl_account': 'No',
|
||||
'group_or_ledger': 'Ledger',
|
||||
'company': doc.company
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.fields_dict.write_off_account.get_query = function(doc) {
|
||||
return{
|
||||
filters:{
|
||||
'debit_or_credit': 'Debit',
|
||||
'is_pl_account': 'Yes',
|
||||
'group_or_ledger': 'Ledger',
|
||||
'company': doc.company
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Write off cost center
|
||||
//-----------------------
|
||||
cur_frm.fields_dict.write_off_cost_center.get_query = function(doc) {
|
||||
return{
|
||||
filters:{
|
||||
'group_or_ledger': 'Ledger',
|
||||
'company': doc.company
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//project name
|
||||
//--------------------------
|
||||
cur_frm.fields_dict['project_name'].get_query = function(doc, cdt, cdn) {
|
||||
return{
|
||||
query: "controllers.queries.get_project_name",
|
||||
filters: {'customer': doc.customer}
|
||||
}
|
||||
}
|
||||
|
||||
// Income Account in Details Table
|
||||
// --------------------------------
|
||||
cur_frm.set_query("income_account", "entries", function(doc) {
|
||||
return{
|
||||
query: "accounts.doctype.sales_invoice.sales_invoice.get_income_account",
|
||||
filters: {'company': doc.company}
|
||||
}
|
||||
});
|
||||
|
||||
// expense account
|
||||
if (sys_defaults.auto_accounting_for_stock) {
|
||||
cur_frm.fields_dict['entries'].grid.get_field('expense_account').get_query = function(doc) {
|
||||
return {
|
||||
filters: {
|
||||
'is_pl_account': 'Yes',
|
||||
'debit_or_credit': 'Debit',
|
||||
'company': doc.company,
|
||||
'group_or_ledger': 'Ledger'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// warehouse in detail table
|
||||
//----------------------------
|
||||
cur_frm.fields_dict['entries'].grid.get_field('warehouse').get_query = function(doc, cdt, cdn) {
|
||||
var d = locals[cdt][cdn];
|
||||
return{
|
||||
filters:[
|
||||
['Bin', 'item_code', '=', d.item_code],
|
||||
['Bin', 'actual_qty', '>', 0]
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
// Cost Center in Details Table
|
||||
// -----------------------------
|
||||
cur_frm.fields_dict["entries"].grid.get_field("cost_center").get_query = function(doc) {
|
||||
return {
|
||||
filters: {
|
||||
'company': doc.company,
|
||||
'group_or_ledger': 'Ledger'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.cscript.income_account = function(doc, cdt, cdn) {
|
||||
cur_frm.cscript.copy_account_in_all_row(doc, cdt, cdn, "income_account");
|
||||
}
|
||||
|
||||
cur_frm.cscript.expense_account = function(doc, cdt, cdn) {
|
||||
cur_frm.cscript.copy_account_in_all_row(doc, cdt, cdn, "expense_account");
|
||||
}
|
||||
|
||||
cur_frm.cscript.cost_center = function(doc, cdt, cdn) {
|
||||
cur_frm.cscript.copy_account_in_all_row(doc, cdt, cdn, "cost_center");
|
||||
}
|
||||
|
||||
cur_frm.cscript.on_submit = function(doc, cdt, cdn) {
|
||||
if(cint(wn.boot.notification_settings.sales_invoice)) {
|
||||
cur_frm.email_doc(wn.boot.notification_settings.sales_invoice_message);
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.cscript.convert_into_recurring_invoice = function(doc, dt, dn) {
|
||||
// set default values for recurring invoices
|
||||
if(doc.convert_into_recurring_invoice) {
|
||||
var owner_email = doc.owner=="Administrator"
|
||||
? wn.user_info("Administrator").email
|
||||
: doc.owner;
|
||||
|
||||
doc.notification_email_address = $.map([cstr(owner_email),
|
||||
cstr(doc.contact_email)], function(v) { return v || null; }).join(", ");
|
||||
doc.repeat_on_day_of_month = wn.datetime.str_to_obj(doc.posting_date).getDate();
|
||||
}
|
||||
|
||||
refresh_many(["notification_email_address", "repeat_on_day_of_month"]);
|
||||
}
|
||||
|
||||
cur_frm.cscript.invoice_period_from_date = function(doc, dt, dn) {
|
||||
// set invoice_period_to_date
|
||||
if(doc.invoice_period_from_date) {
|
||||
var recurring_type_map = {'Monthly': 1, 'Quarterly': 3, 'Half-yearly': 6,
|
||||
'Yearly': 12};
|
||||
|
||||
var months = recurring_type_map[doc.recurring_type];
|
||||
if(months) {
|
||||
var to_date = wn.datetime.add_months(doc.invoice_period_from_date,
|
||||
months);
|
||||
doc.invoice_period_to_date = wn.datetime.add_days(to_date, -1);
|
||||
refresh_field('invoice_period_to_date');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,969 +0,0 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
import webnotes.defaults
|
||||
|
||||
from webnotes.utils import add_days, cint, cstr, date_diff, flt, getdate, nowdate, \
|
||||
get_first_day, get_last_day
|
||||
|
||||
from webnotes.utils.email_lib import sendmail
|
||||
from webnotes.utils import comma_and, get_url
|
||||
from webnotes.model.doc import make_autoname
|
||||
from webnotes.model.bean import getlist
|
||||
from webnotes.model.code import get_obj
|
||||
from webnotes import _, msgprint
|
||||
|
||||
month_map = {'Monthly': 1, 'Quarterly': 3, 'Half-yearly': 6, 'Yearly': 12}
|
||||
|
||||
from controllers.selling_controller import SellingController
|
||||
|
||||
class DocType(SellingController):
|
||||
def __init__(self,d,dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
self.log = []
|
||||
self.tname = 'Sales Invoice Item'
|
||||
self.fname = 'entries'
|
||||
self.status_updater = [{
|
||||
'source_dt': 'Sales Invoice Item',
|
||||
'target_field': 'billed_amt',
|
||||
'target_ref_field': 'export_amount',
|
||||
'target_dt': 'Sales Order Item',
|
||||
'join_field': 'so_detail',
|
||||
'target_parent_dt': 'Sales Order',
|
||||
'target_parent_field': 'per_billed',
|
||||
'source_field': 'export_amount',
|
||||
'join_field': 'so_detail',
|
||||
'percent_join_field': 'sales_order',
|
||||
'status_field': 'billing_status',
|
||||
'keyword': 'Billed'
|
||||
}]
|
||||
|
||||
|
||||
def validate(self):
|
||||
super(DocType, self).validate()
|
||||
self.validate_posting_time()
|
||||
self.so_dn_required()
|
||||
self.validate_proj_cust()
|
||||
self.validate_with_previous_doc()
|
||||
self.validate_uom_is_integer("stock_uom", "qty")
|
||||
self.check_stop_sales_order("sales_order")
|
||||
self.validate_customer_account()
|
||||
self.validate_debit_acc()
|
||||
self.validate_fixed_asset_account()
|
||||
self.clear_unallocated_advances("Sales Invoice Advance", "advance_adjustment_details")
|
||||
self.add_remarks()
|
||||
|
||||
if cint(self.doc.is_pos):
|
||||
self.validate_pos()
|
||||
self.validate_write_off_account()
|
||||
|
||||
if cint(self.doc.update_stock):
|
||||
self.validate_item_code()
|
||||
self.update_current_stock()
|
||||
self.validate_delivery_note()
|
||||
|
||||
if not self.doc.is_opening:
|
||||
self.doc.is_opening = 'No'
|
||||
|
||||
self.set_aging_date()
|
||||
self.set_against_income_account()
|
||||
self.validate_c_form()
|
||||
self.validate_time_logs_are_submitted()
|
||||
self.validate_recurring_invoice()
|
||||
self.validate_multiple_billing("Delivery Note", "dn_detail", "export_amount",
|
||||
"delivery_note_details")
|
||||
|
||||
def on_submit(self):
|
||||
if cint(self.doc.update_stock) == 1:
|
||||
self.update_stock_ledger()
|
||||
else:
|
||||
# Check for Approving Authority
|
||||
if not self.doc.recurring_id:
|
||||
get_obj('Authorization Control').validate_approving_authority(self.doc.doctype,
|
||||
self.doc.company, self.doc.grand_total, self)
|
||||
|
||||
self.check_prev_docstatus()
|
||||
|
||||
self.update_status_updater_args()
|
||||
self.update_prevdoc_status()
|
||||
|
||||
# this sequence because outstanding may get -ve
|
||||
self.make_gl_entries()
|
||||
self.check_credit_limit(self.doc.debit_to)
|
||||
|
||||
if not cint(self.doc.is_pos) == 1:
|
||||
self.update_against_document_in_jv()
|
||||
|
||||
self.update_c_form()
|
||||
self.update_time_log_batch(self.doc.name)
|
||||
self.convert_to_recurring()
|
||||
|
||||
def before_cancel(self):
|
||||
self.update_time_log_batch(None)
|
||||
|
||||
def on_cancel(self):
|
||||
if cint(self.doc.update_stock) == 1:
|
||||
self.update_stock_ledger()
|
||||
|
||||
self.check_stop_sales_order("sales_order")
|
||||
|
||||
from accounts.utils import remove_against_link_from_jv
|
||||
remove_against_link_from_jv(self.doc.doctype, self.doc.name, "against_invoice")
|
||||
|
||||
self.update_status_updater_args()
|
||||
self.update_prevdoc_status()
|
||||
|
||||
self.make_cancel_gl_entries()
|
||||
|
||||
def update_status_updater_args(self):
|
||||
if cint(self.doc.update_stock):
|
||||
self.status_updater.append({
|
||||
'source_dt':'Sales Invoice Item',
|
||||
'target_dt':'Sales Order Item',
|
||||
'target_parent_dt':'Sales Order',
|
||||
'target_parent_field':'per_delivered',
|
||||
'target_field':'delivered_qty',
|
||||
'target_ref_field':'qty',
|
||||
'source_field':'qty',
|
||||
'join_field':'so_detail',
|
||||
'percent_join_field':'sales_order',
|
||||
'status_field':'delivery_status',
|
||||
'keyword':'Delivered',
|
||||
'second_source_dt': 'Delivery Note Item',
|
||||
'second_source_field': 'qty',
|
||||
'second_join_field': 'prevdoc_detail_docname'
|
||||
})
|
||||
|
||||
def on_update_after_submit(self):
|
||||
self.validate_recurring_invoice()
|
||||
self.convert_to_recurring()
|
||||
|
||||
def get_portal_page(self):
|
||||
return "invoice" if self.doc.docstatus==1 else None
|
||||
|
||||
def set_missing_values(self, for_validate=False):
|
||||
self.set_pos_fields(for_validate)
|
||||
|
||||
if not self.doc.debit_to:
|
||||
self.doc.debit_to = self.get_customer_account()
|
||||
if not self.doc.due_date:
|
||||
self.doc.due_date = self.get_due_date()
|
||||
|
||||
super(DocType, self).set_missing_values(for_validate)
|
||||
|
||||
def set_customer_defaults(self):
|
||||
# TODO cleanup these methods
|
||||
if self.doc.customer:
|
||||
self.doc.debit_to = self.get_customer_account()
|
||||
elif self.doc.debit_to:
|
||||
self.doc.customer = webnotes.conn.get_value('Account', self.doc.debit_to, 'master_name')
|
||||
|
||||
self.doc.due_date = self.get_due_date()
|
||||
|
||||
super(DocType, self).set_customer_defaults()
|
||||
|
||||
def update_time_log_batch(self, sales_invoice):
|
||||
for d in self.doclist.get({"doctype":"Sales Invoice Item"}):
|
||||
if d.time_log_batch:
|
||||
tlb = webnotes.bean("Time Log Batch", d.time_log_batch)
|
||||
tlb.doc.sales_invoice = sales_invoice
|
||||
tlb.update_after_submit()
|
||||
|
||||
def validate_time_logs_are_submitted(self):
|
||||
for d in self.doclist.get({"doctype":"Sales Invoice Item"}):
|
||||
if d.time_log_batch:
|
||||
status = webnotes.conn.get_value("Time Log Batch", d.time_log_batch, "status")
|
||||
if status!="Submitted":
|
||||
webnotes.msgprint(_("Time Log Batch status must be 'Submitted'") + ":" + d.time_log_batch,
|
||||
raise_exception=True)
|
||||
|
||||
def set_pos_fields(self, for_validate=False):
|
||||
"""Set retail related fields from pos settings"""
|
||||
if cint(self.doc.is_pos) != 1:
|
||||
return
|
||||
|
||||
from selling.utils import get_pos_settings, apply_pos_settings
|
||||
pos = get_pos_settings(self.doc.company)
|
||||
|
||||
if pos:
|
||||
if not for_validate and not self.doc.customer:
|
||||
self.doc.customer = pos.customer
|
||||
self.set_customer_defaults()
|
||||
|
||||
for fieldname in ('territory', 'naming_series', 'currency', 'charge', 'letter_head', 'tc_name',
|
||||
'selling_price_list', 'company', 'select_print_heading', 'cash_bank_account'):
|
||||
if (not for_validate) or (for_validate and not self.doc.fields.get(fieldname)):
|
||||
self.doc.fields[fieldname] = pos.get(fieldname)
|
||||
|
||||
if not for_validate:
|
||||
self.doc.update_stock = cint(pos.get("update_stock"))
|
||||
|
||||
# set pos values in items
|
||||
for item in self.doclist.get({"parentfield": "entries"}):
|
||||
if item.fields.get('item_code'):
|
||||
for fieldname, val in apply_pos_settings(pos, item.fields).items():
|
||||
if (not for_validate) or (for_validate and not item.fields.get(fieldname)):
|
||||
item.fields[fieldname] = val
|
||||
|
||||
# fetch terms
|
||||
if self.doc.tc_name and not self.doc.terms:
|
||||
self.doc.terms = webnotes.conn.get_value("Terms and Conditions", self.doc.tc_name, "terms")
|
||||
|
||||
# fetch charges
|
||||
if self.doc.charge and not len(self.doclist.get({"parentfield": "other_charges"})):
|
||||
self.set_taxes("other_charges", "charge")
|
||||
|
||||
def get_customer_account(self):
|
||||
"""Get Account Head to which amount needs to be Debited based on Customer"""
|
||||
if not self.doc.company:
|
||||
msgprint("Please select company first and re-select the customer after doing so",
|
||||
raise_exception=1)
|
||||
if self.doc.customer:
|
||||
acc_head = webnotes.conn.sql("""select name from `tabAccount`
|
||||
where (name = %s or (master_name = %s and master_type = 'customer'))
|
||||
and docstatus != 2 and company = %s""",
|
||||
(cstr(self.doc.customer) + " - " + self.get_company_abbr(),
|
||||
self.doc.customer, self.doc.company))
|
||||
|
||||
if acc_head and acc_head[0][0]:
|
||||
return acc_head[0][0]
|
||||
else:
|
||||
msgprint("%s does not have an Account Head in %s. \
|
||||
You must first create it from the Customer Master" %
|
||||
(self.doc.customer, self.doc.company))
|
||||
|
||||
def get_due_date(self):
|
||||
"""Set Due Date = Posting Date + Credit Days"""
|
||||
due_date = None
|
||||
if self.doc.posting_date:
|
||||
credit_days = 0
|
||||
if self.doc.debit_to:
|
||||
credit_days = webnotes.conn.get_value("Account", self.doc.debit_to, "credit_days")
|
||||
if self.doc.customer and not credit_days:
|
||||
credit_days = webnotes.conn.get_value("Customer", self.doc.customer, "credit_days")
|
||||
if self.doc.company and not credit_days:
|
||||
credit_days = webnotes.conn.get_value("Company", self.doc.company, "credit_days")
|
||||
|
||||
if credit_days:
|
||||
due_date = add_days(self.doc.posting_date, credit_days)
|
||||
else:
|
||||
due_date = self.doc.posting_date
|
||||
|
||||
return due_date
|
||||
|
||||
def get_advances(self):
|
||||
super(DocType, self).get_advances(self.doc.debit_to,
|
||||
"Sales Invoice Advance", "advance_adjustment_details", "credit")
|
||||
|
||||
def get_company_abbr(self):
|
||||
return webnotes.conn.sql("select abbr from tabCompany where name=%s", self.doc.company)[0][0]
|
||||
|
||||
def update_against_document_in_jv(self):
|
||||
"""
|
||||
Links invoice and advance voucher:
|
||||
1. cancel advance voucher
|
||||
2. split into multiple rows if partially adjusted, assign against voucher
|
||||
3. submit advance voucher
|
||||
"""
|
||||
|
||||
lst = []
|
||||
for d in getlist(self.doclist, 'advance_adjustment_details'):
|
||||
if flt(d.allocated_amount) > 0:
|
||||
args = {
|
||||
'voucher_no' : d.journal_voucher,
|
||||
'voucher_detail_no' : d.jv_detail_no,
|
||||
'against_voucher_type' : 'Sales Invoice',
|
||||
'against_voucher' : self.doc.name,
|
||||
'account' : self.doc.debit_to,
|
||||
'is_advance' : 'Yes',
|
||||
'dr_or_cr' : 'credit',
|
||||
'unadjusted_amt' : flt(d.advance_amount),
|
||||
'allocated_amt' : flt(d.allocated_amount)
|
||||
}
|
||||
lst.append(args)
|
||||
|
||||
if lst:
|
||||
from accounts.utils import reconcile_against_document
|
||||
reconcile_against_document(lst)
|
||||
|
||||
def validate_customer_account(self):
|
||||
"""Validates Debit To Account and Customer Matches"""
|
||||
if self.doc.customer and self.doc.debit_to and not cint(self.doc.is_pos):
|
||||
acc_head = webnotes.conn.sql("select master_name from `tabAccount` where name = %s and docstatus != 2", self.doc.debit_to)
|
||||
|
||||
if (acc_head and cstr(acc_head[0][0]) != cstr(self.doc.customer)) or \
|
||||
(not acc_head and (self.doc.debit_to != cstr(self.doc.customer) + " - " + self.get_company_abbr())):
|
||||
msgprint("Debit To: %s do not match with Customer: %s for Company: %s.\n If both correctly entered, please select Master Type \
|
||||
and Master Name in account master." %(self.doc.debit_to, self.doc.customer,self.doc.company), raise_exception=1)
|
||||
|
||||
|
||||
def validate_debit_acc(self):
|
||||
acc = webnotes.conn.sql("select debit_or_credit, is_pl_account from tabAccount where name = '%s' and docstatus != 2" % self.doc.debit_to)
|
||||
if not acc:
|
||||
msgprint("Account: "+ self.doc.debit_to + " does not exist")
|
||||
raise Exception
|
||||
elif acc[0][0] and acc[0][0] != 'Debit':
|
||||
msgprint("Account: "+ self.doc.debit_to + " is not a debit account")
|
||||
raise Exception
|
||||
elif acc[0][1] and acc[0][1] != 'No':
|
||||
msgprint("Account: "+ self.doc.debit_to + " is a pl account")
|
||||
raise Exception
|
||||
|
||||
|
||||
def validate_fixed_asset_account(self):
|
||||
"""Validate Fixed Asset Account and whether Income Account Entered Exists"""
|
||||
for d in getlist(self.doclist,'entries'):
|
||||
item = webnotes.conn.sql("select name,is_asset_item,is_sales_item from `tabItem` where name = '%s' and (ifnull(end_of_life,'')='' or end_of_life = '0000-00-00' or end_of_life > now())"% d.item_code)
|
||||
acc = webnotes.conn.sql("select account_type from `tabAccount` where name = '%s' and docstatus != 2" % d.income_account)
|
||||
if not acc:
|
||||
msgprint("Account: "+d.income_account+" does not exist in the system")
|
||||
raise Exception
|
||||
elif item and item[0][1] == 'Yes' and not acc[0][0] == 'Fixed Asset Account':
|
||||
msgprint("Please select income head with account type 'Fixed Asset Account' as Item %s is an asset item" % d.item_code)
|
||||
raise Exception
|
||||
|
||||
|
||||
def validate_with_previous_doc(self):
|
||||
super(DocType, self).validate_with_previous_doc(self.tname, {
|
||||
"Sales Order": {
|
||||
"ref_dn_field": "sales_order",
|
||||
"compare_fields": [["customer", "="], ["company", "="], ["project_name", "="],
|
||||
["currency", "="]],
|
||||
},
|
||||
"Delivery Note": {
|
||||
"ref_dn_field": "delivery_note",
|
||||
"compare_fields": [["customer", "="], ["company", "="], ["project_name", "="],
|
||||
["currency", "="]],
|
||||
},
|
||||
})
|
||||
|
||||
if cint(webnotes.defaults.get_global_default('maintain_same_sales_rate')):
|
||||
super(DocType, self).validate_with_previous_doc(self.tname, {
|
||||
"Sales Order Item": {
|
||||
"ref_dn_field": "so_detail",
|
||||
"compare_fields": [["export_rate", "="]],
|
||||
"is_child_table": True,
|
||||
"allow_duplicate_prev_row_id": True
|
||||
},
|
||||
"Delivery Note Item": {
|
||||
"ref_dn_field": "dn_detail",
|
||||
"compare_fields": [["export_rate", "="]],
|
||||
"is_child_table": True
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
def set_aging_date(self):
|
||||
if self.doc.is_opening != 'Yes':
|
||||
self.doc.aging_date = self.doc.posting_date
|
||||
elif not self.doc.aging_date:
|
||||
msgprint("Aging Date is mandatory for opening entry")
|
||||
raise Exception
|
||||
|
||||
|
||||
def set_against_income_account(self):
|
||||
"""Set against account for debit to account"""
|
||||
against_acc = []
|
||||
for d in getlist(self.doclist, 'entries'):
|
||||
if d.income_account not in against_acc:
|
||||
against_acc.append(d.income_account)
|
||||
self.doc.against_income_account = ','.join(against_acc)
|
||||
|
||||
|
||||
def add_remarks(self):
|
||||
if not self.doc.remarks: self.doc.remarks = 'No Remarks'
|
||||
|
||||
|
||||
def so_dn_required(self):
|
||||
"""check in manage account if sales order / delivery note required or not."""
|
||||
dic = {'Sales Order':'so_required','Delivery Note':'dn_required'}
|
||||
for i in dic:
|
||||
if webnotes.conn.get_value('Selling Settings', None, dic[i]) == 'Yes':
|
||||
for d in getlist(self.doclist,'entries'):
|
||||
if webnotes.conn.get_value('Item', d.item_code, 'is_stock_item') == 'Yes' \
|
||||
and not d.fields[i.lower().replace(' ','_')]:
|
||||
msgprint("%s is mandatory for stock item which is not mentioed against item: %s"%(i,d.item_code), raise_exception=1)
|
||||
|
||||
|
||||
def validate_proj_cust(self):
|
||||
"""check for does customer belong to same project as entered.."""
|
||||
if self.doc.project_name and self.doc.customer:
|
||||
res = webnotes.conn.sql("select name from `tabProject` where name = '%s' and (customer = '%s' or ifnull(customer,'')='')"%(self.doc.project_name, self.doc.customer))
|
||||
if not res:
|
||||
msgprint("Customer - %s does not belong to project - %s. \n\nIf you want to use project for multiple customers then please make customer details blank in that project."%(self.doc.customer,self.doc.project_name))
|
||||
raise Exception
|
||||
|
||||
def validate_pos(self):
|
||||
if not self.doc.cash_bank_account and flt(self.doc.paid_amount):
|
||||
msgprint("Cash/Bank Account is mandatory for POS, for making payment entry")
|
||||
raise Exception
|
||||
if flt(self.doc.paid_amount) + flt(self.doc.write_off_amount) \
|
||||
- flt(self.doc.grand_total) > 1/(10**(self.precision("grand_total") + 1)):
|
||||
webnotes.throw(_("""(Paid amount + Write Off Amount) can not be \
|
||||
greater than Grand Total"""))
|
||||
|
||||
|
||||
def validate_item_code(self):
|
||||
for d in getlist(self.doclist, 'entries'):
|
||||
if not d.item_code:
|
||||
msgprint("Please enter Item Code at line no : %s to update stock or remove check from Update Stock in Basic Info Tab." % (d.idx),
|
||||
raise_exception=True)
|
||||
|
||||
def validate_delivery_note(self):
|
||||
for d in self.doclist.get({"parentfield": "entries"}):
|
||||
if d.delivery_note:
|
||||
msgprint("""Stock update can not be made against Delivery Note""", raise_exception=1)
|
||||
|
||||
|
||||
def validate_write_off_account(self):
|
||||
if flt(self.doc.write_off_amount) and not self.doc.write_off_account:
|
||||
msgprint("Please enter Write Off Account", raise_exception=1)
|
||||
|
||||
|
||||
def validate_c_form(self):
|
||||
""" Blank C-form no if C-form applicable marked as 'No'"""
|
||||
if self.doc.amended_from and self.doc.c_form_applicable == 'No' and self.doc.c_form_no:
|
||||
webnotes.conn.sql("""delete from `tabC-Form Invoice Detail` where invoice_no = %s
|
||||
and parent = %s""", (self.doc.amended_from, self.doc.c_form_no))
|
||||
|
||||
webnotes.conn.set(self.doc, 'c_form_no', '')
|
||||
|
||||
def update_current_stock(self):
|
||||
for d in getlist(self.doclist, 'entries'):
|
||||
if d.item_code and d.warehouse:
|
||||
bin = webnotes.conn.sql("select actual_qty from `tabBin` where item_code = %s and warehouse = %s", (d.item_code, d.warehouse), as_dict = 1)
|
||||
d.actual_qty = bin and flt(bin[0]['actual_qty']) or 0
|
||||
|
||||
for d in getlist(self.doclist, 'packing_details'):
|
||||
bin = webnotes.conn.sql("select actual_qty, projected_qty from `tabBin` where item_code = %s and warehouse = %s", (d.item_code, d.warehouse), as_dict = 1)
|
||||
d.actual_qty = bin and flt(bin[0]['actual_qty']) or 0
|
||||
d.projected_qty = bin and flt(bin[0]['projected_qty']) or 0
|
||||
|
||||
|
||||
def get_warehouse(self):
|
||||
w = webnotes.conn.sql("select warehouse from `tabPOS Setting` where ifnull(user,'') = '%s' and company = '%s'" % (webnotes.session['user'], self.doc.company))
|
||||
w = w and w[0][0] or ''
|
||||
if not w:
|
||||
ps = webnotes.conn.sql("select name, warehouse from `tabPOS Setting` where ifnull(user,'') = '' and company = '%s'" % self.doc.company)
|
||||
if not ps:
|
||||
msgprint("To make POS entry, please create POS Setting from Accounts --> POS Setting page and refresh the system.", raise_exception=True)
|
||||
elif not ps[0][1]:
|
||||
msgprint("Please enter warehouse in POS Setting")
|
||||
else:
|
||||
w = ps[0][1]
|
||||
return w
|
||||
|
||||
def on_update(self):
|
||||
if cint(self.doc.update_stock) == 1:
|
||||
# Set default warehouse from pos setting
|
||||
if cint(self.doc.is_pos) == 1:
|
||||
w = self.get_warehouse()
|
||||
if w:
|
||||
for d in getlist(self.doclist, 'entries'):
|
||||
if not d.warehouse:
|
||||
d.warehouse = cstr(w)
|
||||
|
||||
from stock.doctype.packed_item.packed_item import make_packing_list
|
||||
make_packing_list(self, 'entries')
|
||||
else:
|
||||
self.doclist = self.doc.clear_table(self.doclist, 'packing_details')
|
||||
|
||||
if cint(self.doc.is_pos) == 1:
|
||||
if flt(self.doc.paid_amount) == 0:
|
||||
if self.doc.cash_bank_account:
|
||||
webnotes.conn.set(self.doc, 'paid_amount',
|
||||
(flt(self.doc.grand_total) - flt(self.doc.write_off_amount)))
|
||||
else:
|
||||
# show message that the amount is not paid
|
||||
webnotes.conn.set(self.doc,'paid_amount',0)
|
||||
webnotes.msgprint("Note: Payment Entry will not be created since 'Cash/Bank Account' was not specified.")
|
||||
else:
|
||||
webnotes.conn.set(self.doc,'paid_amount',0)
|
||||
|
||||
def check_prev_docstatus(self):
|
||||
for d in getlist(self.doclist,'entries'):
|
||||
if d.sales_order:
|
||||
submitted = webnotes.conn.sql("select name from `tabSales Order` where docstatus = 1 and name = '%s'" % d.sales_order)
|
||||
if not submitted:
|
||||
msgprint("Sales Order : "+ cstr(d.sales_order) +" is not submitted")
|
||||
raise Exception , "Validation Error."
|
||||
|
||||
if d.delivery_note:
|
||||
submitted = webnotes.conn.sql("select name from `tabDelivery Note` where docstatus = 1 and name = '%s'" % d.delivery_note)
|
||||
if not submitted:
|
||||
msgprint("Delivery Note : "+ cstr(d.delivery_note) +" is not submitted")
|
||||
raise Exception , "Validation Error."
|
||||
|
||||
def update_stock_ledger(self):
|
||||
sl_entries = []
|
||||
for d in self.get_item_list():
|
||||
if webnotes.conn.get_value("Item", d.item_code, "is_stock_item") == "Yes" \
|
||||
and d.warehouse:
|
||||
sl_entries.append(self.get_sl_entries(d, {
|
||||
"actual_qty": -1*flt(d.qty),
|
||||
"stock_uom": webnotes.conn.get_value("Item", d.item_code, "stock_uom")
|
||||
}))
|
||||
|
||||
self.make_sl_entries(sl_entries)
|
||||
|
||||
def make_gl_entries(self, update_gl_entries_after=True):
|
||||
gl_entries = self.get_gl_entries()
|
||||
|
||||
if gl_entries:
|
||||
from accounts.general_ledger import make_gl_entries
|
||||
|
||||
update_outstanding = cint(self.doc.is_pos) and self.doc.write_off_account \
|
||||
and 'No' or 'Yes'
|
||||
make_gl_entries(gl_entries, cancel=(self.doc.docstatus == 2),
|
||||
update_outstanding=update_outstanding, merge_entries=False)
|
||||
|
||||
if update_gl_entries_after and cint(self.doc.update_stock) \
|
||||
and cint(webnotes.defaults.get_global_default("auto_accounting_for_stock")):
|
||||
self.update_gl_entries_after()
|
||||
|
||||
def get_gl_entries(self, warehouse_account=None):
|
||||
from accounts.general_ledger import merge_similar_entries
|
||||
|
||||
gl_entries = []
|
||||
|
||||
self.make_customer_gl_entry(gl_entries)
|
||||
|
||||
self.make_tax_gl_entries(gl_entries)
|
||||
|
||||
self.make_item_gl_entries(gl_entries)
|
||||
|
||||
# merge gl entries before adding pos entries
|
||||
gl_entries = merge_similar_entries(gl_entries)
|
||||
|
||||
self.make_pos_gl_entries(gl_entries)
|
||||
|
||||
return gl_entries
|
||||
|
||||
def make_customer_gl_entry(self, gl_entries):
|
||||
if self.doc.grand_total:
|
||||
gl_entries.append(
|
||||
self.get_gl_dict({
|
||||
"account": self.doc.debit_to,
|
||||
"against": self.doc.against_income_account,
|
||||
"debit": self.doc.grand_total,
|
||||
"remarks": self.doc.remarks,
|
||||
"against_voucher": self.doc.name,
|
||||
"against_voucher_type": self.doc.doctype,
|
||||
})
|
||||
)
|
||||
|
||||
def make_tax_gl_entries(self, gl_entries):
|
||||
for tax in self.doclist.get({"parentfield": "other_charges"}):
|
||||
if flt(tax.tax_amount):
|
||||
gl_entries.append(
|
||||
self.get_gl_dict({
|
||||
"account": tax.account_head,
|
||||
"against": self.doc.debit_to,
|
||||
"credit": flt(tax.tax_amount),
|
||||
"remarks": self.doc.remarks,
|
||||
"cost_center": tax.cost_center
|
||||
})
|
||||
)
|
||||
|
||||
def make_item_gl_entries(self, gl_entries):
|
||||
# income account gl entries
|
||||
for item in self.doclist.get({"parentfield": "entries"}):
|
||||
if flt(item.amount):
|
||||
gl_entries.append(
|
||||
self.get_gl_dict({
|
||||
"account": item.income_account,
|
||||
"against": self.doc.debit_to,
|
||||
"credit": item.amount,
|
||||
"remarks": self.doc.remarks,
|
||||
"cost_center": item.cost_center
|
||||
})
|
||||
)
|
||||
|
||||
# expense account gl entries
|
||||
if cint(webnotes.defaults.get_global_default("auto_accounting_for_stock")) \
|
||||
and cint(self.doc.update_stock):
|
||||
gl_entries += super(DocType, self).get_gl_entries()
|
||||
|
||||
def make_pos_gl_entries(self, gl_entries):
|
||||
if cint(self.doc.is_pos) and self.doc.cash_bank_account and self.doc.paid_amount:
|
||||
# POS, make payment entries
|
||||
gl_entries.append(
|
||||
self.get_gl_dict({
|
||||
"account": self.doc.debit_to,
|
||||
"against": self.doc.cash_bank_account,
|
||||
"credit": self.doc.paid_amount,
|
||||
"remarks": self.doc.remarks,
|
||||
"against_voucher": self.doc.name,
|
||||
"against_voucher_type": self.doc.doctype,
|
||||
})
|
||||
)
|
||||
gl_entries.append(
|
||||
self.get_gl_dict({
|
||||
"account": self.doc.cash_bank_account,
|
||||
"against": self.doc.debit_to,
|
||||
"debit": self.doc.paid_amount,
|
||||
"remarks": self.doc.remarks,
|
||||
})
|
||||
)
|
||||
# write off entries, applicable if only pos
|
||||
if self.doc.write_off_account and self.doc.write_off_amount:
|
||||
gl_entries.append(
|
||||
self.get_gl_dict({
|
||||
"account": self.doc.debit_to,
|
||||
"against": self.doc.write_off_account,
|
||||
"credit": self.doc.write_off_amount,
|
||||
"remarks": self.doc.remarks,
|
||||
"against_voucher": self.doc.name,
|
||||
"against_voucher_type": self.doc.doctype,
|
||||
})
|
||||
)
|
||||
gl_entries.append(
|
||||
self.get_gl_dict({
|
||||
"account": self.doc.write_off_account,
|
||||
"against": self.doc.debit_to,
|
||||
"debit": self.doc.write_off_amount,
|
||||
"remarks": self.doc.remarks,
|
||||
"cost_center": self.doc.write_off_cost_center
|
||||
})
|
||||
)
|
||||
|
||||
def update_c_form(self):
|
||||
"""Update amended id in C-form"""
|
||||
if self.doc.c_form_no and self.doc.amended_from:
|
||||
webnotes.conn.sql("""update `tabC-Form Invoice Detail` set invoice_no = %s,
|
||||
invoice_date = %s, territory = %s, net_total = %s,
|
||||
grand_total = %s where invoice_no = %s and parent = %s""",
|
||||
(self.doc.name, self.doc.amended_from, self.doc.c_form_no))
|
||||
|
||||
@property
|
||||
def meta(self):
|
||||
if not hasattr(self, "_meta"):
|
||||
self._meta = webnotes.get_doctype(self.doc.doctype)
|
||||
return self._meta
|
||||
|
||||
def validate_recurring_invoice(self):
|
||||
if self.doc.convert_into_recurring_invoice:
|
||||
self.validate_notification_email_id()
|
||||
|
||||
if not self.doc.recurring_type:
|
||||
msgprint(_("Please select: ") + self.meta.get_label("recurring_type"),
|
||||
raise_exception=1)
|
||||
|
||||
elif not (self.doc.invoice_period_from_date and \
|
||||
self.doc.invoice_period_to_date):
|
||||
msgprint(comma_and([self.meta.get_label("invoice_period_from_date"),
|
||||
self.meta.get_label("invoice_period_to_date")])
|
||||
+ _(": Mandatory for a Recurring Invoice."),
|
||||
raise_exception=True)
|
||||
|
||||
def convert_to_recurring(self):
|
||||
if self.doc.convert_into_recurring_invoice:
|
||||
if not self.doc.recurring_id:
|
||||
webnotes.conn.set(self.doc, "recurring_id",
|
||||
make_autoname("RECINV/.#####"))
|
||||
|
||||
self.set_next_date()
|
||||
|
||||
elif self.doc.recurring_id:
|
||||
webnotes.conn.sql("""update `tabSales Invoice`
|
||||
set convert_into_recurring_invoice = 0
|
||||
where recurring_id = %s""", (self.doc.recurring_id,))
|
||||
|
||||
def validate_notification_email_id(self):
|
||||
if self.doc.notification_email_address:
|
||||
email_list = filter(None, [cstr(email).strip() for email in
|
||||
self.doc.notification_email_address.replace("\n", "").split(",")])
|
||||
|
||||
from webnotes.utils import validate_email_add
|
||||
for email in email_list:
|
||||
if not validate_email_add(email):
|
||||
msgprint(self.meta.get_label("notification_email_address") \
|
||||
+ " - " + _("Invalid Email Address") + ": \"%s\"" % email,
|
||||
raise_exception=1)
|
||||
|
||||
else:
|
||||
msgprint("Notification Email Addresses not specified for recurring invoice",
|
||||
raise_exception=1)
|
||||
|
||||
def set_next_date(self):
|
||||
""" Set next date on which auto invoice will be created"""
|
||||
if not self.doc.repeat_on_day_of_month:
|
||||
msgprint("""Please enter 'Repeat on Day of Month' field value.
|
||||
The day of the month on which auto invoice
|
||||
will be generated e.g. 05, 28 etc.""", raise_exception=1)
|
||||
|
||||
next_date = get_next_date(self.doc.posting_date,
|
||||
month_map[self.doc.recurring_type], cint(self.doc.repeat_on_day_of_month))
|
||||
|
||||
webnotes.conn.set(self.doc, 'next_date', next_date)
|
||||
|
||||
def get_next_date(dt, mcount, day=None):
|
||||
dt = getdate(dt)
|
||||
|
||||
from dateutil.relativedelta import relativedelta
|
||||
dt += relativedelta(months=mcount, day=day)
|
||||
|
||||
return dt
|
||||
|
||||
def manage_recurring_invoices(next_date=None, commit=True):
|
||||
"""
|
||||
Create recurring invoices on specific date by copying the original one
|
||||
and notify the concerned people
|
||||
"""
|
||||
next_date = next_date or nowdate()
|
||||
recurring_invoices = webnotes.conn.sql("""select name, recurring_id
|
||||
from `tabSales Invoice` where ifnull(convert_into_recurring_invoice, 0)=1
|
||||
and docstatus=1 and next_date=%s
|
||||
and next_date <= ifnull(end_date, '2199-12-31')""", next_date)
|
||||
|
||||
exception_list = []
|
||||
for ref_invoice, recurring_id in recurring_invoices:
|
||||
if not webnotes.conn.sql("""select name from `tabSales Invoice`
|
||||
where posting_date=%s and recurring_id=%s and docstatus=1""",
|
||||
(next_date, recurring_id)):
|
||||
try:
|
||||
ref_wrapper = webnotes.bean('Sales Invoice', ref_invoice)
|
||||
new_invoice_wrapper = make_new_invoice(ref_wrapper, next_date)
|
||||
send_notification(new_invoice_wrapper)
|
||||
if commit:
|
||||
webnotes.conn.commit()
|
||||
except:
|
||||
if commit:
|
||||
webnotes.conn.rollback()
|
||||
|
||||
webnotes.conn.begin()
|
||||
webnotes.conn.sql("update `tabSales Invoice` set \
|
||||
convert_into_recurring_invoice = 0 where name = %s", ref_invoice)
|
||||
notify_errors(ref_invoice, ref_wrapper.doc.owner)
|
||||
webnotes.conn.commit()
|
||||
|
||||
exception_list.append(webnotes.getTraceback())
|
||||
finally:
|
||||
if commit:
|
||||
webnotes.conn.begin()
|
||||
|
||||
if exception_list:
|
||||
exception_message = "\n\n".join([cstr(d) for d in exception_list])
|
||||
raise Exception, exception_message
|
||||
|
||||
def make_new_invoice(ref_wrapper, posting_date):
|
||||
from webnotes.model.bean import clone
|
||||
from accounts.utils import get_fiscal_year
|
||||
new_invoice = clone(ref_wrapper)
|
||||
|
||||
mcount = month_map[ref_wrapper.doc.recurring_type]
|
||||
|
||||
invoice_period_from_date = get_next_date(ref_wrapper.doc.invoice_period_from_date, mcount)
|
||||
|
||||
# get last day of the month to maintain period if the from date is first day of its own month
|
||||
# and to date is the last day of its own month
|
||||
if (cstr(get_first_day(ref_wrapper.doc.invoice_period_from_date)) == \
|
||||
cstr(ref_wrapper.doc.invoice_period_from_date)) and \
|
||||
(cstr(get_last_day(ref_wrapper.doc.invoice_period_to_date)) == \
|
||||
cstr(ref_wrapper.doc.invoice_period_to_date)):
|
||||
invoice_period_to_date = get_last_day(get_next_date(ref_wrapper.doc.invoice_period_to_date,
|
||||
mcount))
|
||||
else:
|
||||
invoice_period_to_date = get_next_date(ref_wrapper.doc.invoice_period_to_date, mcount)
|
||||
|
||||
new_invoice.doc.fields.update({
|
||||
"posting_date": posting_date,
|
||||
"aging_date": posting_date,
|
||||
"due_date": add_days(posting_date, cint(date_diff(ref_wrapper.doc.due_date,
|
||||
ref_wrapper.doc.posting_date))),
|
||||
"invoice_period_from_date": invoice_period_from_date,
|
||||
"invoice_period_to_date": invoice_period_to_date,
|
||||
"fiscal_year": get_fiscal_year(posting_date)[0],
|
||||
"owner": ref_wrapper.doc.owner,
|
||||
})
|
||||
|
||||
new_invoice.submit()
|
||||
|
||||
return new_invoice
|
||||
|
||||
def send_notification(new_rv):
|
||||
"""Notify concerned persons about recurring invoice generation"""
|
||||
subject = "Invoice : " + new_rv.doc.name
|
||||
|
||||
com = new_rv.doc.company
|
||||
|
||||
hd = '''<div><h2>%s</h2></div>
|
||||
<div><h3>Invoice: %s</h3></div>
|
||||
<table cellspacing= "5" cellpadding="5" width = "100%%">
|
||||
<tr>
|
||||
<td width = "50%%"><b>Customer</b><br>%s<br>%s</td>
|
||||
<td width = "50%%">Invoice Date : %s<br>Invoice Period : %s to %s <br>Due Date : %s</td>
|
||||
</tr>
|
||||
</table>
|
||||
''' % (com, new_rv.doc.name, new_rv.doc.customer_name, new_rv.doc.address_display, getdate(new_rv.doc.posting_date).strftime("%d-%m-%Y"), \
|
||||
getdate(new_rv.doc.invoice_period_from_date).strftime("%d-%m-%Y"), getdate(new_rv.doc.invoice_period_to_date).strftime("%d-%m-%Y"),\
|
||||
getdate(new_rv.doc.due_date).strftime("%d-%m-%Y"))
|
||||
|
||||
|
||||
tbl = '''<table border="1px solid #CCC" width="100%%" cellpadding="0px" cellspacing="0px">
|
||||
<tr>
|
||||
<td width = "15%%" bgcolor="#CCC" align="left"><b>Item</b></td>
|
||||
<td width = "40%%" bgcolor="#CCC" align="left"><b>Description</b></td>
|
||||
<td width = "15%%" bgcolor="#CCC" align="center"><b>Qty</b></td>
|
||||
<td width = "15%%" bgcolor="#CCC" align="center"><b>Rate</b></td>
|
||||
<td width = "15%%" bgcolor="#CCC" align="center"><b>Amount</b></td>
|
||||
</tr>
|
||||
'''
|
||||
for d in getlist(new_rv.doclist, 'entries'):
|
||||
tbl += '<tr><td>' + cstr(d.item_code) +'</td><td>' + cstr(d.description) + \
|
||||
'</td><td>' + cstr(d.qty) +'</td><td>' + cstr(d.basic_rate) + \
|
||||
'</td><td>' + cstr(d.amount) +'</td></tr>'
|
||||
tbl += '</table>'
|
||||
|
||||
totals ='''<table cellspacing= "5" cellpadding="5" width = "100%%">
|
||||
<tr>
|
||||
<td width = "50%%"></td>
|
||||
<td width = "50%%">
|
||||
<table width = "100%%">
|
||||
<tr>
|
||||
<td width = "50%%">Net Total: </td><td>%s </td>
|
||||
</tr><tr>
|
||||
<td width = "50%%">Total Tax: </td><td>%s </td>
|
||||
</tr><tr>
|
||||
<td width = "50%%">Grand Total: </td><td>%s</td>
|
||||
</tr><tr>
|
||||
<td width = "50%%">In Words: </td><td>%s</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td>Terms and Conditions:</td></tr>
|
||||
<tr><td>%s</td></tr>
|
||||
</table>
|
||||
''' % (new_rv.doc.net_total,
|
||||
new_rv.doc.other_charges_total,new_rv.doc.grand_total,
|
||||
new_rv.doc.in_words,new_rv.doc.terms)
|
||||
|
||||
|
||||
msg = hd + tbl + totals
|
||||
|
||||
sendmail(new_rv.doc.notification_email_address, subject=subject, msg = msg)
|
||||
|
||||
def notify_errors(inv, owner):
|
||||
import webnotes
|
||||
|
||||
exception_msg = """
|
||||
Dear User,
|
||||
|
||||
An error occured while creating recurring invoice from %s (at %s).
|
||||
|
||||
May be there are some invalid email ids mentioned in the invoice.
|
||||
|
||||
To stop sending repetitive error notifications from the system, we have unchecked
|
||||
"Convert into Recurring" field in the invoice %s.
|
||||
|
||||
|
||||
Please correct the invoice and make the invoice recurring again.
|
||||
|
||||
<b>It is necessary to take this action today itself for the above mentioned recurring invoice \
|
||||
to be generated. If delayed, you will have to manually change the "Repeat on Day of Month" field \
|
||||
of this invoice for generating the recurring invoice.</b>
|
||||
|
||||
Regards,
|
||||
Administrator
|
||||
|
||||
""" % (inv, get_url(), inv)
|
||||
subj = "[Urgent] Error while creating recurring invoice from %s" % inv
|
||||
|
||||
from webnotes.profile import get_system_managers
|
||||
recipients = get_system_managers()
|
||||
owner_email = webnotes.conn.get_value("Profile", owner, "email")
|
||||
if not owner_email in recipients:
|
||||
recipients.append(owner_email)
|
||||
|
||||
assign_task_to_owner(inv, exception_msg, recipients)
|
||||
sendmail(recipients, subject=subj, msg = exception_msg)
|
||||
|
||||
def assign_task_to_owner(inv, msg, users):
|
||||
for d in users:
|
||||
from webnotes.widgets.form import assign_to
|
||||
args = {
|
||||
'assign_to' : d,
|
||||
'doctype' : 'Sales Invoice',
|
||||
'name' : inv,
|
||||
'description' : msg,
|
||||
'priority' : 'Urgent'
|
||||
}
|
||||
assign_to.add(args)
|
||||
|
||||
@webnotes.whitelist()
|
||||
def get_bank_cash_account(mode_of_payment):
|
||||
val = webnotes.conn.get_value("Mode of Payment", mode_of_payment, "default_account")
|
||||
if not val:
|
||||
webnotes.msgprint("Default Bank / Cash Account not set in Mode of Payment: %s. Please add a Default Account in Mode of Payment master." % mode_of_payment)
|
||||
return {
|
||||
"cash_bank_account": val
|
||||
}
|
||||
|
||||
@webnotes.whitelist()
|
||||
def get_income_account(doctype, txt, searchfield, start, page_len, filters):
|
||||
from controllers.queries import get_match_cond
|
||||
|
||||
# income account can be any Credit account,
|
||||
# but can also be a Asset account with account_type='Income Account' in special circumstances.
|
||||
# Hence the first condition is an "OR"
|
||||
return webnotes.conn.sql("""select tabAccount.name from `tabAccount`
|
||||
where (tabAccount.debit_or_credit="Credit"
|
||||
or tabAccount.account_type = "Income Account")
|
||||
and tabAccount.group_or_ledger="Ledger"
|
||||
and tabAccount.docstatus!=2
|
||||
and ifnull(tabAccount.master_type, "")=""
|
||||
and ifnull(tabAccount.master_name, "")=""
|
||||
and tabAccount.company = '%(company)s'
|
||||
and tabAccount.%(key)s LIKE '%(txt)s'
|
||||
%(mcond)s""" % {'company': filters['company'], 'key': searchfield,
|
||||
'txt': "%%%s%%" % txt, 'mcond':get_match_cond(doctype, searchfield)})
|
||||
|
||||
|
||||
@webnotes.whitelist()
|
||||
def make_delivery_note(source_name, target_doclist=None):
|
||||
from webnotes.model.mapper import get_mapped_doclist
|
||||
|
||||
def set_missing_values(source, target):
|
||||
bean = webnotes.bean(target)
|
||||
bean.run_method("onload_post_render")
|
||||
|
||||
def update_item(source_doc, target_doc, source_parent):
|
||||
target_doc.amount = (flt(source_doc.qty) - flt(source_doc.delivered_qty)) * \
|
||||
flt(source_doc.basic_rate)
|
||||
target_doc.export_amount = (flt(source_doc.qty) - flt(source_doc.delivered_qty)) * \
|
||||
flt(source_doc.export_rate)
|
||||
target_doc.qty = flt(source_doc.qty) - flt(source_doc.delivered_qty)
|
||||
|
||||
doclist = get_mapped_doclist("Sales Invoice", source_name, {
|
||||
"Sales Invoice": {
|
||||
"doctype": "Delivery Note",
|
||||
"validation": {
|
||||
"docstatus": ["=", 1]
|
||||
}
|
||||
},
|
||||
"Sales Invoice Item": {
|
||||
"doctype": "Delivery Note Item",
|
||||
"field_map": {
|
||||
"name": "prevdoc_detail_docname",
|
||||
"parent": "against_sales_invoice",
|
||||
"serial_no": "serial_no"
|
||||
},
|
||||
"postprocess": update_item
|
||||
},
|
||||
"Sales Taxes and Charges": {
|
||||
"doctype": "Sales Taxes and Charges",
|
||||
"add_if_empty": True
|
||||
},
|
||||
"Sales Team": {
|
||||
"doctype": "Sales Team",
|
||||
"field_map": {
|
||||
"incentives": "incentives"
|
||||
},
|
||||
"add_if_empty": True
|
||||
}
|
||||
}, target_doclist, set_missing_values)
|
||||
|
||||
return [d.fields for d in doclist]
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,13 +0,0 @@
|
||||
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
// License: GNU General Public License v3. See license.txt
|
||||
|
||||
// render
|
||||
wn.listview_settings['Sales Invoice'] = {
|
||||
add_fields: ["`tabSales Invoice`.grand_total", "`tabSales Invoice`.outstanding_amount"],
|
||||
add_columns: [{"content":"Percent Paid", width:"10%", type:"bar-graph",
|
||||
label: "Payment Received"}],
|
||||
prepare_data: function(data) {
|
||||
data["Percent Paid"] = flt(data.grand_total) ? (((flt(data.grand_total) -
|
||||
flt(data.outstanding_amount)) / flt(data.grand_total)) * 100) : 0;
|
||||
}
|
||||
};
|
||||
@@ -1,19 +0,0 @@
|
||||
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
// License: GNU General Public License v3. See license.txt
|
||||
|
||||
wn.model.map_info["Sales Invoice"] = {
|
||||
"Time Log Batch": {
|
||||
table_map: {
|
||||
"Sales Invoice Item": "Time Log Batch",
|
||||
},
|
||||
field_map: {
|
||||
"Sales Invoice Item": {
|
||||
"basic_rate": "rate",
|
||||
"time_log_batch": "name",
|
||||
"qty": "total_hours",
|
||||
"stock_uom": "=Hour",
|
||||
"description": "=via Time Logs"
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
{% extends "app/portal/templates/sale.html" %}
|
||||
|
||||
{% block status -%}
|
||||
{% if doc.status %}{{ doc.status }}{% endif %}
|
||||
{%- endblock %}
|
||||
@@ -1,30 +0,0 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
from webnotes import _
|
||||
from webnotes.utils import flt, fmt_money
|
||||
|
||||
no_cache = True
|
||||
|
||||
def get_context():
|
||||
from portal.utils import get_transaction_context
|
||||
context = get_transaction_context("Sales Invoice", webnotes.form_dict.name)
|
||||
modify_status(context.get("doc"))
|
||||
context.update({
|
||||
"parent_link": "invoices",
|
||||
"parent_title": "Invoices"
|
||||
})
|
||||
return context
|
||||
|
||||
def modify_status(doc):
|
||||
doc.status = ""
|
||||
if flt(doc.outstanding_amount):
|
||||
doc.status = '<span class="label %s"><i class="icon-fixed-width %s"></i> %s</span>' % \
|
||||
("label-warning", "icon-exclamation-sign",
|
||||
_("To Pay") + " = " + fmt_money(doc.outstanding_amount, currency=doc.currency))
|
||||
else:
|
||||
doc.status = '<span class="label %s"><i class="icon-fixed-width %s"></i> %s</span>' % \
|
||||
("label-success", "icon-ok", _("Paid"))
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
{% extends "app/portal/templates/sales_transactions.html" %}
|
||||
@@ -1,28 +0,0 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
no_cache = True
|
||||
|
||||
def get_context():
|
||||
from portal.utils import get_currency_context
|
||||
context = get_currency_context()
|
||||
context.update({
|
||||
"title": "Invoices",
|
||||
"method": "accounts.doctype.sales_invoice.templates.pages.invoices.get_invoices",
|
||||
"icon": "icon-file-text",
|
||||
"empty_list_message": "No Invoices Found",
|
||||
"page": "invoice"
|
||||
})
|
||||
return context
|
||||
|
||||
@webnotes.whitelist()
|
||||
def get_invoices(start=0):
|
||||
from portal.utils import get_transaction_list
|
||||
from accounts.doctype.sales_invoice.templates.pages.invoice import modify_status
|
||||
invoices = get_transaction_list("Sales Invoice", start, ["outstanding_amount"])
|
||||
for d in invoices:
|
||||
modify_status(d)
|
||||
return invoices
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,9 +0,0 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
class DocType:
|
||||
def __init__(self, d, dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user