Compare commits
741 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
65652071ff | ||
|
|
79dc8ac9cc | ||
|
|
15e7646edd | ||
|
|
d1b87ba41c | ||
|
|
a5576f5b21 | ||
|
|
8976ad5ca1 | ||
|
|
c7f8b82fff | ||
|
|
6b62b86bbf | ||
|
|
8fbf856618 | ||
|
|
7d6d678e8d | ||
|
|
c22ba2ec26 | ||
|
|
0cf0ebf08b | ||
|
|
0ff35a852a | ||
|
|
e04431ea5c | ||
|
|
fafc277666 | ||
|
|
fe1e4a41e6 | ||
|
|
7a8c5b0c2c | ||
|
|
056ecdca6a | ||
|
|
3b281a0a1b | ||
|
|
a60ab1af75 | ||
|
|
550fc695f1 | ||
|
|
013493de7a | ||
|
|
b3737c812a | ||
|
|
6d5a29af6a | ||
|
|
20d8c52d2a | ||
|
|
e11f299b21 | ||
|
|
68000c66fc | ||
|
|
3cc77b52e7 | ||
|
|
bd4348db10 | ||
|
|
4fd1cebf95 | ||
|
|
b892cc8b02 | ||
|
|
8652bce9e3 | ||
|
|
4e372a30fa | ||
|
|
df327f2974 | ||
|
|
3ccbb8f8b7 | ||
|
|
0d931e1d7d | ||
|
|
431b4fba72 | ||
|
|
fba985d49d | ||
|
|
4bd562d669 | ||
|
|
bb88e964a4 | ||
|
|
5f79479bd0 | ||
|
|
12b4096e68 | ||
|
|
1ef72c0b66 | ||
|
|
648191b9e8 | ||
|
|
624927bf0b | ||
|
|
3df2639a32 | ||
|
|
d982e8fcda | ||
|
|
af497ef669 | ||
|
|
79f3ea4094 | ||
|
|
e0a47aeb2f | ||
|
|
1516b8d54a | ||
|
|
e33047250e | ||
|
|
c4e38ffd4d | ||
|
|
be7703387d | ||
|
|
b800382abf | ||
|
|
e689a903d8 | ||
|
|
ecc6af9d2a | ||
|
|
5c5688b374 | ||
|
|
80f30094fb | ||
|
|
6fb2117767 | ||
|
|
0631aed3d9 | ||
|
|
88b0a1305f | ||
|
|
9e98fdfc6e | ||
|
|
cd6b955b99 | ||
|
|
bfd26b7084 | ||
|
|
18960c7757 | ||
|
|
9a7838265d | ||
|
|
57d3c93e6b | ||
|
|
a0b846fb88 | ||
|
|
8356d4b892 | ||
|
|
ba62013cbb | ||
|
|
59de1dae6a | ||
|
|
91cecf8eac | ||
|
|
6ec558bd59 | ||
|
|
11dd3ffdb5 | ||
|
|
f0ef673498 | ||
|
|
57d07d6b8e | ||
|
|
fc682c86c6 | ||
|
|
15f52e7b71 | ||
|
|
26bfede116 | ||
|
|
86217ca96c | ||
|
|
ae4ff5a403 | ||
|
|
0452b405f4 | ||
|
|
dc7004e083 | ||
|
|
ebdefade9b | ||
|
|
e9afbfde76 | ||
|
|
086da451ca | ||
|
|
91d2ace9bb | ||
|
|
91a9ee5179 | ||
|
|
11137850cb | ||
|
|
584153a1b1 | ||
|
|
eed0a4e2df | ||
|
|
f5cc1bd44c | ||
|
|
cc56ff5c37 | ||
|
|
20d3bef3c3 | ||
|
|
1f4c263a63 | ||
|
|
d0a2b1619b | ||
|
|
0fe6ced99d | ||
|
|
e50e0e4b30 | ||
|
|
cd717e422f | ||
|
|
6b862fcae5 | ||
|
|
a22e0d0c99 | ||
|
|
8ca5940f76 | ||
|
|
6c46b4edc4 | ||
|
|
8395a7ad6f | ||
|
|
6863b03790 | ||
|
|
a76067eea1 | ||
|
|
216f9373c9 | ||
|
|
5fe88ea93e | ||
|
|
fbeab5bf73 | ||
|
|
a3e070bc6b | ||
|
|
3ffe89659a | ||
|
|
5c3b69476d | ||
|
|
da17ceea73 | ||
|
|
2d84945839 | ||
|
|
8dc4c945dc | ||
|
|
cc9c7d5e2a | ||
|
|
07d0e9a2b2 | ||
|
|
f38d6d9c44 | ||
|
|
07bb1811af | ||
|
|
f07462860b | ||
|
|
720b06495c | ||
|
|
83ad646af4 | ||
|
|
8179bcbabd | ||
|
|
6be8bea934 | ||
|
|
0b9129e519 | ||
|
|
778e06d0ee | ||
|
|
3f5e80ebe3 | ||
|
|
ea943c6fe4 | ||
|
|
82a9fde921 | ||
|
|
b35721029b | ||
|
|
f403031449 | ||
|
|
25f36489b3 | ||
|
|
5005e467a0 | ||
|
|
68a148e293 | ||
|
|
205eae322b | ||
|
|
935f4a474b | ||
|
|
aa62a62bb0 | ||
|
|
104f62090d | ||
|
|
3ff7f79cc7 | ||
|
|
89e7f8b387 | ||
|
|
2fbc8509f5 | ||
|
|
67d87e29e3 | ||
|
|
55cf6c5f7e | ||
|
|
f3cf15fa0d | ||
|
|
d53d2ed791 | ||
|
|
34aeefc0a1 | ||
|
|
d8031d1a53 | ||
|
|
1098755d26 | ||
|
|
774f676a25 | ||
|
|
1629393618 | ||
|
|
4cf46edabc | ||
|
|
e6498996fa | ||
|
|
98b7bb5679 | ||
|
|
99017b173d | ||
|
|
42f2d1a7a8 | ||
|
|
a125a6199c | ||
|
|
ba1cdc6c57 | ||
|
|
875c941f3d | ||
|
|
8eeb5694ba | ||
|
|
0bef91c241 | ||
|
|
ae02209b6a | ||
|
|
e0adb6bbd6 | ||
|
|
efa191c72e | ||
|
|
40fe3a2cdf | ||
|
|
ed77429496 | ||
|
|
c7afbea708 | ||
|
|
dd8fba6783 | ||
|
|
8e74df09a4 | ||
|
|
3d73a6f7f2 | ||
|
|
46c8ccc6a8 | ||
|
|
5d0674a23a | ||
|
|
a831868d02 | ||
|
|
943dc09f29 | ||
|
|
ea7533fa75 | ||
|
|
b9399d8781 | ||
|
|
8cd0f67b25 | ||
|
|
32a118d68c | ||
|
|
a02d5d1104 | ||
|
|
36cd433999 | ||
|
|
6ff3a094e2 | ||
|
|
50d8c4a10f | ||
|
|
7c088ff623 | ||
|
|
7cf01e7c75 | ||
|
|
fc03a0463c | ||
|
|
5ecc26bf15 | ||
|
|
c1cf495a93 | ||
|
|
ce642d73cb | ||
|
|
2fa057e4ad | ||
|
|
7e0e85912b | ||
|
|
defecd3785 | ||
|
|
fccf7f2a68 | ||
|
|
cce7189b4f | ||
|
|
31a96d2a3f | ||
|
|
39c0add5a2 | ||
|
|
58200182b4 | ||
|
|
c2c73ae96a | ||
|
|
ae95a8aa15 | ||
|
|
b9f54ca946 | ||
|
|
a8c6ec27c0 | ||
|
|
3c1b153cdb | ||
|
|
06f91e2dc1 | ||
|
|
13f39eb821 | ||
|
|
a8fb2db001 | ||
|
|
27cf190269 | ||
|
|
7ad556cd4c | ||
|
|
475729cefe | ||
|
|
f7713ebfa7 | ||
|
|
92640cc899 | ||
|
|
826f020862 | ||
|
|
93a186aa11 | ||
|
|
742d3e5549 | ||
|
|
bcbe32ce7c | ||
|
|
b434f2687e | ||
|
|
a752eca82c | ||
|
|
37da7d7d05 | ||
|
|
b5d9b38dee | ||
|
|
11e2a9ac90 | ||
|
|
1275ea5123 | ||
|
|
812224e56e | ||
|
|
8f17281011 | ||
|
|
8233cb11ed | ||
|
|
984a7a7e61 | ||
|
|
b5cc946771 | ||
|
|
65dd1f6b4c | ||
|
|
7c9a6eba3f | ||
|
|
f2ccde0454 | ||
|
|
9e4889d756 | ||
|
|
b81ece9ddf | ||
|
|
2f822476dd | ||
|
|
dcfe19d868 | ||
|
|
4f40b2dca5 | ||
|
|
1b48fde986 | ||
|
|
33db332eca | ||
|
|
257e18b640 | ||
|
|
292f46fec0 | ||
|
|
78a0be666f | ||
|
|
ce4f520908 | ||
|
|
29160441bb | ||
|
|
1b18bba04a | ||
|
|
f8c26bb778 | ||
|
|
ccd0617e19 | ||
|
|
bf10d0f98b | ||
|
|
dbb67fb4fd | ||
|
|
404f39d373 | ||
|
|
bbee9b6cc4 | ||
|
|
69b0535e10 | ||
|
|
7f63c1ad7c | ||
|
|
ebe1ebead2 | ||
|
|
f2b3307136 | ||
|
|
9d215c2d9b | ||
|
|
3cf0d51e65 | ||
|
|
9fc5ddc26e | ||
|
|
0ff31f0ebf | ||
|
|
40349f4b00 | ||
|
|
b36517158b | ||
|
|
3b9720f0be | ||
|
|
cf26b2ca1c | ||
|
|
02a40e9d7b | ||
|
|
ea199f9cd9 | ||
|
|
161f35a687 | ||
|
|
fcb984b294 | ||
|
|
723fe8fb1b | ||
|
|
47c0c8ba49 | ||
|
|
3e0a937cb8 | ||
|
|
bd63f0056a | ||
|
|
55daa9cd24 | ||
|
|
764b9bfeba | ||
|
|
62b985d405 | ||
|
|
ed393d1025 | ||
|
|
ed376cacc8 | ||
|
|
7461806b1c | ||
|
|
bb7c5ac0f8 | ||
|
|
0272fc05bf | ||
|
|
4f6b68fef2 | ||
|
|
eae2ddac69 | ||
|
|
99be9d17d5 | ||
|
|
5df63e36d4 | ||
|
|
bd99606a14 | ||
|
|
b0a46f397a | ||
|
|
53c9b63c0b | ||
|
|
9b2078feab | ||
|
|
30304e68ff | ||
|
|
6bc500bffa | ||
|
|
8be895091e | ||
|
|
f5f8a1f288 | ||
|
|
c925a38f79 | ||
|
|
c23230faea | ||
|
|
6855b87f76 | ||
|
|
07d030208f | ||
|
|
47f6e32920 | ||
|
|
7bd1453f8f | ||
|
|
bf416cfbf8 | ||
|
|
67918fff32 | ||
|
|
132dac9712 | ||
|
|
57914f140e | ||
|
|
ede0af97cd | ||
|
|
ad4ede0e23 | ||
|
|
cfcf9b3832 | ||
|
|
d2065ce3bf | ||
|
|
31edddace6 | ||
|
|
8f29159fb7 | ||
|
|
d9f1b539dc | ||
|
|
60bd383a25 | ||
|
|
c0ec3c3f7b | ||
|
|
60aa1170d5 | ||
|
|
9630aa3d7f | ||
|
|
aa6576c0ea | ||
|
|
fa5ecb066e | ||
|
|
c36524ec54 | ||
|
|
cba3570cf6 | ||
|
|
5b7503c074 | ||
|
|
8441dd9184 | ||
|
|
78869f1e77 | ||
|
|
ff8f1bc88e | ||
|
|
91b0dce4d8 | ||
|
|
59f7b8c4a1 | ||
|
|
2476a8aab9 | ||
|
|
46ffbb74ff | ||
|
|
492aff2a8b | ||
|
|
c3fbc04aab | ||
|
|
5b866db6bc | ||
|
|
9fbb8192e1 | ||
|
|
ea1408f2e0 | ||
|
|
f2a941b1a4 | ||
|
|
ca1cfd91ea | ||
|
|
c3d43e672b | ||
|
|
e141fdcfcc | ||
|
|
7cb8f890bc | ||
|
|
d6aadef395 | ||
|
|
11c899bc1f | ||
|
|
00efeb26f4 | ||
|
|
1129ac711e | ||
|
|
2ea593bdd8 | ||
|
|
02fd6f56d6 | ||
|
|
098b444f6f | ||
|
|
e72bde5159 | ||
|
|
c10e106f8f | ||
|
|
2c111b7b14 | ||
|
|
f92fcdbac4 | ||
|
|
1ff9e0432a | ||
|
|
c0f149a3be | ||
|
|
2ae6cfda5f | ||
|
|
22d9f0a4aa | ||
|
|
aa7cddef5c | ||
|
|
3d2b3d37d4 | ||
|
|
821222653b | ||
|
|
adddb15380 | ||
|
|
5fd79f7f77 | ||
|
|
2505c74d64 | ||
|
|
d5f9ebd008 | ||
|
|
d021e45301 | ||
|
|
e9ca5e81d2 | ||
|
|
a7f5589564 | ||
|
|
a8df73c263 | ||
|
|
40a5a3063c | ||
|
|
d17c24f969 | ||
|
|
0289ad285f | ||
|
|
562227db8f | ||
|
|
9c1cac80fe | ||
|
|
03016e5000 | ||
|
|
9240eaa0a6 | ||
|
|
618940b5c9 | ||
|
|
ccf2b7b08b | ||
|
|
1e989b35ad | ||
|
|
cae2723920 | ||
|
|
badc855400 | ||
|
|
a4502c4f6b | ||
|
|
1f02c62339 | ||
|
|
ef770b593a | ||
|
|
a9c90c96a9 | ||
|
|
c5d222253a | ||
|
|
94769d81a8 | ||
|
|
edd63a178f | ||
|
|
ace68cd283 | ||
|
|
d3bd151c30 | ||
|
|
0794816527 | ||
|
|
7041a45294 | ||
|
|
a6746407e5 | ||
|
|
e3407083fe | ||
|
|
63e40b52af | ||
|
|
2e203e53c6 | ||
|
|
c0201877dd | ||
|
|
745292ce98 | ||
|
|
00279f27f3 | ||
|
|
f620dae8ca | ||
|
|
9d7fe1f7cd | ||
|
|
ba4f32be5c | ||
|
|
85f63a3866 | ||
|
|
149f7ee875 | ||
|
|
c9a1eb1081 | ||
|
|
2e560cb25d | ||
|
|
651b612909 | ||
|
|
398eac3f4c | ||
|
|
f3025f1596 | ||
|
|
0712013960 | ||
|
|
3fdda7a9b7 | ||
|
|
9bcadf8126 | ||
|
|
492de67d7b | ||
|
|
80a9f523d5 | ||
|
|
e3f0412570 | ||
|
|
23fa8893a8 | ||
|
|
a3714e1678 | ||
|
|
0f6c35d63f | ||
|
|
93779c21a7 | ||
|
|
e010ddf65f | ||
|
|
969c8aaf52 | ||
|
|
c711445b91 | ||
|
|
2b88ac948e | ||
|
|
c672530210 | ||
|
|
c5b061834b | ||
|
|
8a8966ce9b | ||
|
|
54f3a0f7c6 | ||
|
|
ecc4fdd3ef | ||
|
|
60da37b502 | ||
|
|
2777fd4332 | ||
|
|
9602bf4ba3 | ||
|
|
5042dd32da | ||
|
|
4d347b1ca0 | ||
|
|
3d85951c1f | ||
|
|
7b91042ae6 | ||
|
|
633a39144d | ||
|
|
94b41ea4f6 | ||
|
|
d8f7de9946 | ||
|
|
b2d318ec48 | ||
|
|
60200eaf0d | ||
|
|
1e4cfb4bf5 | ||
|
|
70abac0061 | ||
|
|
d7f32e492f | ||
|
|
6c09297bcd | ||
|
|
363cedde76 | ||
|
|
f5ad339cae | ||
|
|
c8c733bc54 | ||
|
|
7acc8cb747 | ||
|
|
9a398b4742 | ||
|
|
56882033bf | ||
|
|
74c817e7f9 | ||
|
|
d98a6d81eb | ||
|
|
baac05955b | ||
|
|
89346967da | ||
|
|
97e890d0b3 | ||
|
|
95763bc233 | ||
|
|
96f4b22589 | ||
|
|
13460f023d | ||
|
|
3907eae83f | ||
|
|
04f50be306 | ||
|
|
b34ab7549a | ||
|
|
aa54d934b8 | ||
|
|
2c7a6e6b43 | ||
|
|
58797481f0 | ||
|
|
12aa4265ff | ||
|
|
69d9f51dbb | ||
|
|
3dea6589d7 | ||
|
|
096d136460 | ||
|
|
c3889d85a1 | ||
|
|
052333ea63 | ||
|
|
aadd30d194 | ||
|
|
22e6f8d4c2 | ||
|
|
acd3479269 | ||
|
|
a32e57ae82 | ||
|
|
a3a63177a1 | ||
|
|
1643cce479 | ||
|
|
bb42e3b411 | ||
|
|
586e9400b1 | ||
|
|
668ec25d19 | ||
|
|
f0543a9765 | ||
|
|
36b4faab48 | ||
|
|
2b59a851c4 | ||
|
|
857d4f7a0b | ||
|
|
12d7bfb658 | ||
|
|
ca6e223694 | ||
|
|
343ba85e3a | ||
|
|
16c324f699 | ||
|
|
1fa992564a | ||
|
|
a65b28772f | ||
|
|
ba6003ece7 | ||
|
|
491ce05b8d | ||
|
|
2cfcbf933d | ||
|
|
2550180a05 | ||
|
|
5fd7b3bb80 | ||
|
|
35b665cb26 | ||
|
|
a6a4e86dc8 | ||
|
|
0eb8bb2511 | ||
|
|
67cfa81de2 | ||
|
|
a942722619 | ||
|
|
c10bbd6aa7 | ||
|
|
4badb45ee5 | ||
|
|
855d843e55 | ||
|
|
0df95fa781 | ||
|
|
6578bc11b6 | ||
|
|
f68dc69078 | ||
|
|
502af4dd67 | ||
|
|
db9fa78ee8 | ||
|
|
a645f36b2b | ||
|
|
332a17ee86 | ||
|
|
a310cc7156 | ||
|
|
3b43c0d160 | ||
|
|
96002c28bd | ||
|
|
91fc1a8fbe | ||
|
|
f1755fb5b1 | ||
|
|
be841ccc53 | ||
|
|
51dfba749b | ||
|
|
3799f8bec9 | ||
|
|
3edc101957 | ||
|
|
127c61e930 | ||
|
|
e55831a89c | ||
|
|
4ff4d185f7 | ||
|
|
d54953e419 | ||
|
|
339426c926 | ||
|
|
489ff6e21c | ||
|
|
d12fb58c12 | ||
|
|
82048cf3ce | ||
|
|
4d76269eeb | ||
|
|
d5b2e39f45 | ||
|
|
dd0fc1084e | ||
|
|
d283ee73f3 | ||
|
|
93f138eece | ||
|
|
2b2cf13408 | ||
|
|
7f49b57aaa | ||
|
|
00330f52bd | ||
|
|
6b69fc7e5d | ||
|
|
d8cd54dfd0 | ||
|
|
2949e9c5dc | ||
|
|
15bd3167a8 | ||
|
|
9b530fb2cb | ||
|
|
06bace9089 | ||
|
|
c15978fca0 | ||
|
|
cb2264e0b4 | ||
|
|
7d862276af | ||
|
|
e4fe2d9603 | ||
|
|
23a2b65576 | ||
|
|
0bde9e11c7 | ||
|
|
09d56754ea | ||
|
|
e9166d7c19 | ||
|
|
9a64d4371e | ||
|
|
d4491d361f | ||
|
|
09acb779d7 | ||
|
|
67f74414c4 | ||
|
|
8a77a0e1e4 | ||
|
|
bc5515651b | ||
|
|
f65afac353 | ||
|
|
2fbb4923a7 | ||
|
|
554f2de23d | ||
|
|
a5003f8f5b | ||
|
|
6c5d7986ab | ||
|
|
5448318146 | ||
|
|
174a18399c | ||
|
|
ec23a6f0eb | ||
|
|
33b2614377 | ||
|
|
b95ecd7fcd | ||
|
|
cc98d40ff7 | ||
|
|
103c4e9b92 | ||
|
|
5a947f38ab | ||
|
|
0acb63a938 | ||
|
|
db6f0848e3 | ||
|
|
ca166eaae5 | ||
|
|
a13b177908 | ||
|
|
0500ce445f | ||
|
|
351dc08576 | ||
|
|
8e675ebbe2 | ||
|
|
d53b149828 | ||
|
|
5a91989665 | ||
|
|
62d6593fe7 | ||
|
|
ed35a296ab | ||
|
|
6a7495dbc8 | ||
|
|
6e90f49a35 | ||
|
|
6e7e70c977 | ||
|
|
0aeeb7e02c | ||
|
|
caccd2289d | ||
|
|
45ac31ab93 | ||
|
|
7477899d2e | ||
|
|
13afef2f72 | ||
|
|
cab73b8a02 | ||
|
|
c7a9e3424b | ||
|
|
a884bd9c6a | ||
|
|
37b2aa2b11 | ||
|
|
f4211c4a52 | ||
|
|
c1f982a9bb | ||
|
|
4d250585a6 | ||
|
|
6041f5cb8c | ||
|
|
144c9977a2 | ||
|
|
f1fa338999 | ||
|
|
f7717b9ec2 | ||
|
|
1a4d77a962 | ||
|
|
056c1709c6 | ||
|
|
b553b7a69d | ||
|
|
0725eab858 | ||
|
|
67d6dc1ac6 | ||
|
|
33f967d97c | ||
|
|
9a5037193f | ||
|
|
80423de611 | ||
|
|
b4693c6957 | ||
|
|
ba31369764 | ||
|
|
e8d22bb999 | ||
|
|
cce29fabf4 | ||
|
|
0f5c18ca81 | ||
|
|
a4c40e0fd6 | ||
|
|
59aca770c1 | ||
|
|
9d2f04139c | ||
|
|
41c47e3ffa | ||
|
|
cf6360d825 | ||
|
|
2c95ab3897 | ||
|
|
171e5af995 | ||
|
|
5df64d84a1 | ||
|
|
a829d5a4d5 | ||
|
|
91c5e4c429 | ||
|
|
cae13bf048 | ||
|
|
2aba97bff1 | ||
|
|
d4359faa31 | ||
|
|
c830344ca7 | ||
|
|
d85247cd7a | ||
|
|
b9ce104b09 | ||
|
|
82fa04ce32 | ||
|
|
32a5f38595 | ||
|
|
4990cf7783 | ||
|
|
8f38a17c14 | ||
|
|
bff1971bb2 | ||
|
|
4e05f02038 | ||
|
|
7918b92d95 | ||
|
|
29c8142678 | ||
|
|
df1653827f | ||
|
|
fc05cc4e70 | ||
|
|
4dc329f5ea | ||
|
|
e37e5d6134 | ||
|
|
dea99cc3a8 | ||
|
|
bc640fe6a6 | ||
|
|
dba5e7645b | ||
|
|
927d13fadb | ||
|
|
0f75a022f2 | ||
|
|
4eae6c985c | ||
|
|
b9e8b917b6 | ||
|
|
2f4854ad1a | ||
|
|
585254456e | ||
|
|
ce5b93ca77 | ||
|
|
32c2c474fd | ||
|
|
f3d30c5bb9 | ||
|
|
8df20f6501 | ||
|
|
f7a4d4221b | ||
|
|
406d449e12 | ||
|
|
e2021252d9 | ||
|
|
373066e0ca | ||
|
|
52beb77539 | ||
|
|
e1e690541c | ||
|
|
86c7ede321 | ||
|
|
7e033aae11 | ||
|
|
5bf77beb83 | ||
|
|
1e1b2364ab | ||
|
|
4d50fac869 | ||
|
|
05eed01eec | ||
|
|
cfa9d1adb7 | ||
|
|
c7c1defe64 | ||
|
|
c14f1f145b | ||
|
|
186bea6e95 | ||
|
|
794ecda618 | ||
|
|
8985077652 | ||
|
|
bfa898ff9b | ||
|
|
0a33a359ca | ||
|
|
f9b5c74871 | ||
|
|
4c58299eb0 | ||
|
|
fc318ebeff | ||
|
|
3574c96c8c | ||
|
|
5743ce2b6b | ||
|
|
84f7727432 | ||
|
|
549c196beb | ||
|
|
1bf4015567 | ||
|
|
cadd31cb0c | ||
|
|
46c82c45e0 | ||
|
|
2c8ce5a717 | ||
|
|
6c3289dbcd | ||
|
|
381d452b78 | ||
|
|
769874d0e9 | ||
|
|
6cc10104f0 | ||
|
|
5b67f4d953 | ||
|
|
4b9a55b0ef | ||
|
|
c8399fd093 | ||
|
|
266e66cd1b | ||
|
|
f3a452850e | ||
|
|
57df096725 | ||
|
|
db2d02a3e3 | ||
|
|
dfae11bcee | ||
|
|
d78e6e04ea | ||
|
|
3959aeb848 | ||
|
|
51293390e4 | ||
|
|
63f4da4402 | ||
|
|
a137fe82a1 | ||
|
|
e2b31085a7 | ||
|
|
a54815fd9d | ||
|
|
4f927ac3e8 | ||
|
|
b9f678b350 | ||
|
|
fb4caff0b2 | ||
|
|
e72915847c | ||
|
|
1d93bd50eb | ||
|
|
8e998875a5 | ||
|
|
c87a3370cd | ||
|
|
c4c2bf0bfb | ||
|
|
39adc8f85f | ||
|
|
8676590cfe | ||
|
|
cf7b6511ba | ||
|
|
bc94914338 | ||
|
|
f83f6aae22 | ||
|
|
6a81acfddf | ||
|
|
edef642794 | ||
|
|
93344dff26 | ||
|
|
03adf84a8d | ||
|
|
0e61b52022 | ||
|
|
0efd7934b8 | ||
|
|
16cde58821 | ||
|
|
e1815f0989 | ||
|
|
c59d52d073 | ||
|
|
7b605a628e | ||
|
|
2f3ad64bd6 | ||
|
|
86cbde9057 | ||
|
|
65a669c81e | ||
|
|
39e0d1b7d6 | ||
|
|
de420322b5 | ||
|
|
c8e016522d | ||
|
|
5c4f52ccf1 | ||
|
|
95adb60a8f | ||
|
|
c6d5611408 | ||
|
|
bd47abdc9a | ||
|
|
00e547d319 | ||
|
|
f1b098e03c | ||
|
|
a7bcf6791e | ||
|
|
f76fb50685 | ||
|
|
da941af687 | ||
|
|
91fd29a963 | ||
|
|
230805b016 | ||
|
|
60febc5465 | ||
|
|
4d4ce3e5cf | ||
|
|
052b51ab20 | ||
|
|
2bfa1803e9 | ||
|
|
b44ef0b249 | ||
|
|
dfb1646a16 | ||
|
|
d40bfeb7d3 | ||
|
|
af7df6ba50 | ||
|
|
f18cd2eaf7 | ||
|
|
a2426fcc9e | ||
|
|
184491bbbe | ||
|
|
eec0f7fd6b | ||
|
|
e04aedadcd | ||
|
|
e88f928f0f |
68
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
68
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
|
||||
---
|
||||
|
||||
Issue: Bug report
|
||||
|
||||
Our project, as you've probably heard, is getting really popular and truth is we're getting a bit overwhelmed by the activity surrounding it. There are just too many issues for us to manage properly.
|
||||
|
||||
**Do the checklist before filing an issue:**
|
||||
- [ ] Have a usage question? Ask your question on [Discuss Forum](https://discuss.erpnext.com). We use [Discuss Forum](https://discuss.erpnext.com) for usage question and GitHub for bugs.
|
||||
- [ ] Can you replicate the issue?
|
||||
- [ ] Is this something you can debug and fix? Send a pull request! Bug fixes and documentation fixes are welcome
|
||||
|
||||
**Describe the bug** :chart_with_downwards_trend:
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**To Reproduce** :page_with_curl:
|
||||
Steps to reproduce the behavior:
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
|
||||
**Expected behavior** :chart_with_upwards_trend:
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Screenshots** :crystal_ball:
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
**Desktop (please complete the following information):** :cyclone:
|
||||
- OS:
|
||||
- [ ] Linux
|
||||
- [ ] macOS
|
||||
- [ ] Windows
|
||||
- [ ] Others? Please mention:
|
||||
- Browser:
|
||||
- [ ] Safari
|
||||
- [ ] Chrome
|
||||
- [ ] Firefox
|
||||
- [ ] Other? Please mention:
|
||||
|
||||
**Smartphone (please complete the following information):** :iphone: :computer:
|
||||
- Device:
|
||||
- [ ] iPhone
|
||||
- [ ] Android
|
||||
- Browser:
|
||||
- [ ] Safari
|
||||
- [ ] Chrome
|
||||
- [ ] Firefox
|
||||
- [ ] Other? Please mention:
|
||||
|
||||
**Version Information**
|
||||
- Which branch are you on?
|
||||
- [ ] `master` :star2:
|
||||
- [ ] `develop` :fire:
|
||||
- Frappe Version:
|
||||
- ERPNext Version:
|
||||
|
||||
**Additional context** :page_facing_up:
|
||||
Add any other context about the problem here.
|
||||
|
||||
**Possible Solution** :bookmark_tabs:
|
||||
Any idea what might be causing the issue. Or if you have a proposed solution to the problem,
|
||||
|
||||
**Please don't be intimidated by the long list of options you've fill. Try to fill out as much as you can. Remember, the more the information the easier it is for us to replicate and fix the issue** :grin:
|
||||
|
||||
21
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
21
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
|
||||
---
|
||||
|
||||
Issue: Feature Request
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots about the feature request here.
|
||||
|
||||
|
||||
28
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
28
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
Pull-Request
|
||||
|
||||
- [ ] Have you followed the guidelines in our Contributing document?
|
||||
- [ ] Have you checked to ensure there aren't other open [Pull Requests](../pulls) for the same update/change?
|
||||
- [ ] Have you lint your code locally prior to submission?
|
||||
- [ ] Have you successfully run tests with your changes locally?
|
||||
- [ ] Does your commit message have an explanation for your changes and why you'd like us to include them?
|
||||
- [ ] Docs have been added / updated
|
||||
- [ ] Tests for the changes have been added (for bug fixes / features)
|
||||
- [ ] Did you modify the existing test cases? If yes, why?
|
||||
|
||||
---
|
||||
|
||||
What type of a PR is this?
|
||||
|
||||
- [ ] Changes to Existing Features
|
||||
- [ ] New Feature Submissions
|
||||
- [ ] Bug Fix
|
||||
- [ ] Breaking Change
|
||||
|
||||
---
|
||||
|
||||
- Motivation and Context (What existing problem does the pull request solve):
|
||||
- Related Issue:
|
||||
- Screenshots (if applicable, remember, a picture tells a thousand words):
|
||||
|
||||
**Please don't be intimidated by the long list of options you've fill. Try to fill out as much as you can. Remember, the more the information the easier it is for us to test and get your pull request merged** :grin:
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -8,3 +8,4 @@ latest_updates.json
|
||||
*.egg-info
|
||||
dist/
|
||||
erpnext/docs/current
|
||||
*.swp
|
||||
|
||||
36
.travis.yml
36
.travis.yml
@@ -1,13 +1,6 @@
|
||||
language: python
|
||||
dist: trusty
|
||||
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- google-chrome
|
||||
packages:
|
||||
- google-chrome-stable
|
||||
|
||||
python:
|
||||
- "2.7"
|
||||
|
||||
@@ -18,6 +11,7 @@ install:
|
||||
- pip install flake8==3.3.0
|
||||
- flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics
|
||||
- sudo rm /etc/apt/sources.list.d/docker.list
|
||||
- sudo apt-get install hhvm && rm -rf /home/travis/.kiex/
|
||||
- sudo apt-get purge -y mysql-common mysql-server mysql-client
|
||||
- nvm install v7.10.0
|
||||
- wget https://raw.githubusercontent.com/frappe/bench/master/playbooks/install.py
|
||||
@@ -29,15 +23,6 @@ install:
|
||||
- cp -r $TRAVIS_BUILD_DIR/test_sites/test_site ~/frappe-bench/sites/
|
||||
|
||||
before_script:
|
||||
- wget http://chromedriver.storage.googleapis.com/2.33/chromedriver_linux64.zip
|
||||
- unzip chromedriver_linux64.zip
|
||||
- sudo apt-get install libnss3
|
||||
- sudo apt-get --only-upgrade install google-chrome-stable
|
||||
- sudo cp chromedriver /usr/local/bin/.
|
||||
- sudo chmod +x /usr/local/bin/chromedriver
|
||||
- export DISPLAY=:99.0
|
||||
- sh -e /etc/init.d/xvfb start
|
||||
- sleep 3
|
||||
- mysql -u root -ptravis -e 'create database test_frappe'
|
||||
- echo "USE mysql;\nCREATE USER 'test_frappe'@'localhost' IDENTIFIED BY 'test_frappe';\nFLUSH PRIVILEGES;\n" | mysql -u root -ptravis
|
||||
- echo "USE mysql;\nGRANT ALL PRIVILEGES ON \`test_frappe\`.* TO 'test_frappe'@'localhost';\n" | mysql -u root -ptravis
|
||||
@@ -48,6 +33,7 @@ before_script:
|
||||
- bench reinstall --yes
|
||||
- bench build
|
||||
- bench scheduler disable
|
||||
- sed -i 's/9000/9001/g' sites/common_site_config.json
|
||||
- bench start &
|
||||
- sleep 10
|
||||
|
||||
@@ -58,24 +44,6 @@ jobs:
|
||||
- set -e
|
||||
- bench run-tests
|
||||
env: Server Side Test
|
||||
- # stage
|
||||
script:
|
||||
- bench --verbose run-setup-wizard-ui-test
|
||||
- bench execute erpnext.setup.utils.enable_all_roles_and_domains
|
||||
- bench run-ui-tests --app erpnext
|
||||
env: Client Side Test
|
||||
- # stage
|
||||
script:
|
||||
- bench --verbose run-setup-wizard-ui-test
|
||||
- bench execute erpnext.setup.utils.enable_all_roles_and_domains
|
||||
- bench run-ui-tests --app erpnext --test-list erpnext/tests/ui/tests2.txt
|
||||
env: Client Side Test - 2
|
||||
- # stage
|
||||
script:
|
||||
- bench --verbose run-setup-wizard-ui-test
|
||||
- bench execute erpnext.setup.utils.enable_all_roles_and_domains
|
||||
- bench run-ui-tests --app erpnext --test-list erpnext/tests/ui/agriculture.txt
|
||||
env: Agriculture Client Side Test
|
||||
- # stage
|
||||
script:
|
||||
- wget http://build.erpnext.com/20171108_190013_955977f8_database.sql.gz
|
||||
|
||||
@@ -5,7 +5,7 @@ import frappe
|
||||
from erpnext.hooks import regional_overrides
|
||||
from frappe.utils import getdate
|
||||
|
||||
__version__ = '10.0.8'
|
||||
__version__ = '10.1.55'
|
||||
|
||||
def get_default_company(user=None):
|
||||
'''Get default company for user'''
|
||||
|
||||
@@ -49,10 +49,16 @@ frappe.ui.form.on('Account', {
|
||||
}
|
||||
|
||||
if(!frm.doc.__islocal) {
|
||||
frm.add_custom_button(__('Update Account Number'), function () {
|
||||
frm.add_custom_button(__('Update Account Name / Number'), function () {
|
||||
frm.trigger("update_account_number");
|
||||
});
|
||||
}
|
||||
|
||||
if(!frm.doc.__islocal) {
|
||||
frm.add_custom_button(__('Merge Account'), function () {
|
||||
frm.trigger("merge_account");
|
||||
});
|
||||
}
|
||||
},
|
||||
account_type: function (frm) {
|
||||
if (frm.doc.is_group == 0) {
|
||||
@@ -98,20 +104,65 @@ frappe.ui.form.on('Account', {
|
||||
}
|
||||
},
|
||||
|
||||
update_account_number: function(frm) {
|
||||
merge_account: function(frm) {
|
||||
var d = new frappe.ui.Dialog({
|
||||
title: __('Update Account Number'),
|
||||
title: __('Merge with Existing Account'),
|
||||
fields: [
|
||||
{
|
||||
"label": "Account Number",
|
||||
"fieldname": "account_number",
|
||||
"label" : "Name",
|
||||
"fieldname": "name",
|
||||
"fieldtype": "Data",
|
||||
"reqd": 1
|
||||
"reqd": 1,
|
||||
"default": frm.doc.name
|
||||
}
|
||||
],
|
||||
primary_action: function() {
|
||||
var data = d.get_values();
|
||||
if(data.account_number === frm.doc.account_number) {
|
||||
frappe.call({
|
||||
method: "erpnext.accounts.doctype.account.account.merge_account",
|
||||
args: {
|
||||
old: frm.doc.name,
|
||||
new: data.name,
|
||||
is_group: frm.doc.is_group,
|
||||
root_type: frm.doc.root_type,
|
||||
company: frm.doc.company
|
||||
},
|
||||
callback: function(r) {
|
||||
if(!r.exc) {
|
||||
if(r.message) {
|
||||
frappe.set_route("Form", "Account", r.message);
|
||||
}
|
||||
d.hide();
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
primary_action_label: __('Merge')
|
||||
});
|
||||
d.show();
|
||||
},
|
||||
|
||||
update_account_number: function(frm) {
|
||||
var d = new frappe.ui.Dialog({
|
||||
title: __('Update Account Number / Name'),
|
||||
fields: [
|
||||
{
|
||||
"label": "Account Name",
|
||||
"fieldname": "account_name",
|
||||
"fieldtype": "Data",
|
||||
"reqd": 1,
|
||||
"default": frm.doc.account_name
|
||||
},
|
||||
{
|
||||
"label": "Account Number",
|
||||
"fieldname": "account_number",
|
||||
"fieldtype": "Data",
|
||||
"default": frm.doc.account_number
|
||||
}
|
||||
],
|
||||
primary_action: function() {
|
||||
var data = d.get_values();
|
||||
if(data.account_number === frm.doc.account_number && data.account_name === frm.doc.account_name) {
|
||||
d.hide();
|
||||
return;
|
||||
}
|
||||
@@ -120,6 +171,7 @@ frappe.ui.form.on('Account', {
|
||||
method: "erpnext.accounts.doctype.account.account.update_account_number",
|
||||
args: {
|
||||
account_number: data.account_number,
|
||||
account_name: data.account_name,
|
||||
name: frm.doc.name
|
||||
},
|
||||
callback: function(r) {
|
||||
@@ -128,6 +180,7 @@ frappe.ui.form.on('Account', {
|
||||
frappe.set_route("Form", "Account", r.message);
|
||||
} else {
|
||||
frm.set_value("account_number", data.account_number);
|
||||
frm.set_value("account_name", data.account_name);
|
||||
}
|
||||
d.hide();
|
||||
}
|
||||
@@ -138,4 +191,4 @@ frappe.ui.form.on('Account', {
|
||||
});
|
||||
d.show();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"allow_copy": 1,
|
||||
"allow_guest_to_view": 0,
|
||||
"allow_import": 1,
|
||||
"allow_rename": 1,
|
||||
"allow_rename": 0,
|
||||
"beta": 0,
|
||||
"creation": "2013-01-30 12:49:46",
|
||||
"custom": 0,
|
||||
@@ -40,6 +40,7 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@@ -68,6 +69,7 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0,
|
||||
"width": "50%"
|
||||
},
|
||||
@@ -100,6 +102,7 @@
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@@ -130,6 +133,7 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@@ -161,6 +165,7 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@@ -193,6 +198,7 @@
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@@ -223,6 +229,7 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@@ -253,6 +260,7 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@@ -285,6 +293,7 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@@ -313,6 +322,7 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0,
|
||||
"width": "50%"
|
||||
},
|
||||
@@ -346,6 +356,7 @@
|
||||
"reqd": 1,
|
||||
"search_index": 1,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@@ -379,6 +390,7 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@@ -411,6 +423,7 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@@ -444,6 +457,7 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@@ -474,6 +488,7 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@@ -503,6 +518,7 @@
|
||||
"reqd": 0,
|
||||
"search_index": 1,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@@ -532,6 +548,7 @@
|
||||
"reqd": 0,
|
||||
"search_index": 1,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@@ -561,6 +578,7 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
}
|
||||
],
|
||||
@@ -575,7 +593,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2017-08-22 17:39:10.711343",
|
||||
"modified": "2018-07-08 09:47:04.287841",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Account",
|
||||
|
||||
@@ -165,53 +165,6 @@ class Account(NestedSet):
|
||||
|
||||
super(Account, self).on_trash(True)
|
||||
|
||||
def before_rename(self, old, new, merge=False):
|
||||
# Add company abbr if not provided
|
||||
from erpnext.setup.doctype.company.company import get_name_with_abbr
|
||||
new_account = get_name_with_abbr(new, self.company)
|
||||
new_account = get_name_with_number(new_account, self.account_number)
|
||||
|
||||
# Validate properties before merging
|
||||
if merge:
|
||||
if not frappe.db.exists("Account", new):
|
||||
throw(_("Account {0} does not exist").format(new))
|
||||
|
||||
val = list(frappe.db.get_value("Account", new_account,
|
||||
["is_group", "root_type", "company"]))
|
||||
|
||||
if val != [self.is_group, self.root_type, self.company]:
|
||||
throw(_("""Merging is only possible if following properties are same in both records. Is Group, Root Type, Company"""))
|
||||
|
||||
if self.is_group and frappe.db.get_value("Account", new, "parent_account") == old:
|
||||
frappe.db.set_value("Account", new, "parent_account",
|
||||
frappe.db.get_value("Account", old, "parent_account"))
|
||||
|
||||
return new_account
|
||||
|
||||
def after_rename(self, old, new, merge=False):
|
||||
super(Account, self).after_rename(old, new, merge)
|
||||
|
||||
if not merge:
|
||||
new_acc = frappe.db.get_value("Account", new, ["account_name", "account_number"], as_dict=1)
|
||||
|
||||
# exclude company abbr
|
||||
new_parts = new.split(" - ")[:-1]
|
||||
# update account number and remove from parts
|
||||
if new_parts[0][0].isdigit():
|
||||
# if account number is separate by space, split using space
|
||||
if len(new_parts) == 1:
|
||||
new_parts = new.split(" ")
|
||||
if new_acc.account_number != new_parts[0]:
|
||||
self.account_number = new_parts[0]
|
||||
self.db_set("account_number", new_parts[0])
|
||||
new_parts = new_parts[1:]
|
||||
|
||||
# update account name
|
||||
account_name = " - ".join(new_parts)
|
||||
if new_acc.account_name != account_name:
|
||||
self.account_name = account_name
|
||||
self.db_set("account_name", account_name)
|
||||
|
||||
def get_parent_account(doctype, txt, searchfield, start, page_len, filters):
|
||||
return frappe.db.sql("""select name from tabAccount
|
||||
where is_group = 1 and docstatus != 2 and company = %s
|
||||
@@ -252,25 +205,38 @@ def validate_account_number(name, account_number, company):
|
||||
.format(account_number, account_with_same_number))
|
||||
|
||||
@frappe.whitelist()
|
||||
def update_account_number(name, account_number):
|
||||
account = frappe.db.get_value("Account", name, ["account_name", "company"], as_dict=True)
|
||||
def update_account_number(name, account_name, account_number=None):
|
||||
|
||||
account = frappe.db.get_value("Account", name, "company", as_dict=True)
|
||||
if not account: return
|
||||
validate_account_number(name, account_number, account.company)
|
||||
|
||||
frappe.db.set_value("Account", name, "account_number", account_number)
|
||||
|
||||
account_name = account.account_name
|
||||
if account_name[0].isdigit():
|
||||
separator = " - " if " - " in account_name else " "
|
||||
account_name = account_name.split(separator, 1)[1]
|
||||
frappe.db.set_value("Account", name, "account_name", account_name)
|
||||
if account_number:
|
||||
frappe.db.set_value("Account", name, "account_number", account_number.strip())
|
||||
else:
|
||||
frappe.db.set_value("Account", name, "account_number", "")
|
||||
frappe.db.set_value("Account", name, "account_name", account_name.strip())
|
||||
|
||||
new_name = get_account_autoname(account_number, account_name, account.company)
|
||||
if name != new_name:
|
||||
frappe.rename_doc("Account", name, new_name)
|
||||
frappe.rename_doc("Account", name, new_name, ignore_permissions=1)
|
||||
return new_name
|
||||
|
||||
def get_name_with_number(new_account, account_number):
|
||||
if account_number and not new_account[0].isdigit():
|
||||
new_account = account_number + " - " + new_account
|
||||
return new_account
|
||||
@frappe.whitelist()
|
||||
def merge_account(old, new, is_group, root_type, company):
|
||||
# Validate properties before merging
|
||||
if not frappe.db.exists("Account", new):
|
||||
throw(_("Account {0} does not exist").format(new))
|
||||
|
||||
val = list(frappe.db.get_value("Account", new,
|
||||
["is_group", "root_type", "company"]))
|
||||
|
||||
if val != [cint(is_group), root_type, company]:
|
||||
throw(_("""Merging is only possible if following properties are same in both records. Is Group, Root Type, Company"""))
|
||||
|
||||
if is_group and frappe.db.get_value("Account", new, "parent_account") == old:
|
||||
frappe.db.set_value("Account", new, "parent_account",
|
||||
frappe.db.get_value("Account", old, "parent_account"))
|
||||
|
||||
frappe.rename_doc("Account", old, new, merge=1, ignore_permissions=1)
|
||||
|
||||
return new
|
||||
|
||||
@@ -71,7 +71,7 @@ frappe.treeview_settings["Account"] = {
|
||||
|
||||
// financial statements
|
||||
for (let report of ['Trial Balance', 'General Ledger', 'Balance Sheet',
|
||||
'Profit and Loss', 'Cash Flow Statement', 'Accounts Payable', 'Accounts Receivable']) {
|
||||
'Profit and Loss Statement', 'Cash Flow Statement', 'Accounts Payable', 'Accounts Receivable']) {
|
||||
treeview.page.add_inner_button(__(report), function() {
|
||||
frappe.set_route('query-report', report, {company: get_company()});
|
||||
}, __('Financial Statements'));
|
||||
|
||||
@@ -165,7 +165,7 @@ def build_account_tree(tree, parent, all_accounts):
|
||||
tree[child.account_name] = {}
|
||||
|
||||
# assign account_type and root_type
|
||||
if child.account_type:
|
||||
if child.account_number:
|
||||
tree[child.account_name]["account_number"] = child.account_number
|
||||
if child.account_type:
|
||||
tree[child.account_name]["account_type"] = child.account_type
|
||||
@@ -175,4 +175,4 @@ def build_account_tree(tree, parent, all_accounts):
|
||||
tree[child.account_name]["root_type"] = child.root_type
|
||||
|
||||
# call recursively to build a subtree for current account
|
||||
build_account_tree(tree[child.account_name], child, all_accounts)
|
||||
build_account_tree(tree[child.account_name], child, all_accounts)
|
||||
|
||||
@@ -176,7 +176,7 @@
|
||||
"Eingeforderte Nachsch\u00fcsse (gegenkonto 2929)": {}
|
||||
},
|
||||
"Eingeforderte- noch ausstehende Kapitaleinlagen": {
|
||||
"Ausstehende Einlagen auf das gezeichnete Kapital- eingefordert (Forderungen- nicht eingeforderte ausstehende Einlagen s. Konto 2910)": {}
|
||||
"Ausstehende Einlagen auf das gezeichnete Kapital- eingefordert": {}
|
||||
},
|
||||
"Forderungen aus Lieferungen und Leistungen H-Saldo": {
|
||||
"Einzelwertberechtigungen zu Forderungen mit einer Restlaufzeit bis zu 1 Jahr": {},
|
||||
@@ -685,7 +685,6 @@
|
||||
"Umsatzsteuer aus innergemeinschaftlichem Erwerb 16%": {},
|
||||
"Umsatzsteuer aus innergemeinschaftlichem Erwerb 19%": {},
|
||||
"Umsatzsteuer aus innergemeinschaftlichem Erwerb ohne Vorsteuerabzug": {},
|
||||
"Umsatzsteuer aus innergemeinschaftlichem Erwerb von Neufahrzeugen von Lieferanten ohne Umsatzsteuer-Identifikationsnummer": {},
|
||||
"Umsatzsteuer fr\u00fchere Jahre": {},
|
||||
"Umsatzsteuer laufendes Jahr": {},
|
||||
"Umsatzsteuer nach \u00a713b UStG": {},
|
||||
@@ -747,7 +746,7 @@
|
||||
"Verbindlichkeiten gegen\u00fcber Kreditinstituten ": {
|
||||
"Gegenkonto 3159-3209 bei Aufteilung der Konten 3210-3248": {}
|
||||
},
|
||||
"Verbindlichkeiten gegen\u00fcber Kreditinstituten oder Kassenbestand- Bundesbankguthaben- Guthaben bei Kreditinstituten und Schecks": {
|
||||
"Verbindlichkeiten gegen\u00fcber Kreditinstituten - Bundesbankguthaben- Guthaben bei Kreditinstituten und Schecks": {
|
||||
"Verbindlichkeiten gegen\u00fcber Kreditinstituten 1": {
|
||||
"(frei- in Bilanz kein Restlaufzeit vermerkt) 1": {},
|
||||
"Verbindlichkeiten gegen\u00fcber Kreditinstituten Restlaufzeit 1 bis 5 Jahre": {},
|
||||
@@ -778,8 +777,8 @@
|
||||
},
|
||||
"Gewinn u. Verlust - Aufwendungen": {
|
||||
"Betriebliche Aufwendungen": {
|
||||
"Abschreibungen a. Verm\u00f6gensgeg. d. Umlaufverm\u00f6gens- soweit diese die in der Kapitalgesellschaft \u00fcblichen Abschreibungen \u00fcberschreiten": {
|
||||
"Abschreibungen a. Verm\u00f6gensgeg. d. Umlaufverm\u00f6gens- soweit diese die in der Kapitalgesellschaft \u00fcblichen Abschreibungen \u00fcberschreiten": {
|
||||
"Abschreibungen a. Verm\u00f6gensgeg. d. Umlaufverm\u00f6gens- soweit diese die in der Abschreibungen \u00fcberschreiten": {
|
||||
"Abschreibungen a. Verm\u00f6gensgeg. d. Umlaufverm\u00f6gens- soweit diese die in der Abschreibungen \u00fcberschreiten": {
|
||||
"Abschreibungen auf Umlaufverm\u00f6gen- steuerrechtlich bedingt (soweit un\u00fcblich hoch)": {},
|
||||
"Abschreibungen auf Verm\u00f6gensgegenst\u00e4nde des Umlaufverm\u00f6gens (soweit un\u00fcblich hoch)": {},
|
||||
"Forderungsverluste (soweit un\u00fcblich hoch)": {},
|
||||
@@ -852,7 +851,7 @@
|
||||
"Sonstige betriebliche Aufwendungen 3": {
|
||||
"Sonstige betriebliche Aufwendungen 4": {
|
||||
"Abgaben f\u00fcr betrieblich genutzten Grundbesitz": {},
|
||||
"Abgang von Wirtschaftsg\u00fctern des Umlaufverm\u00f6gens 100% / 50% nicht abzugsf\u00e4hig (inlandische Kap. Ges.) nach \u00a7 4 Abs. 3 Satz 4 EStG": {},
|
||||
"Abgang von Wirtschaftsg\u00fctern des Umlaufverm\u00f6gens 100% / 50% nicht abzugsf\u00e4hig (inlandische Kap. Ges.) nach": {},
|
||||
"Abgang von Wirtschaftsg\u00fctern des Umlaufverm\u00f6gens nach \u00a7 4 Abs. 3 Satz 4 EStG": {},
|
||||
"Abschluss- und Pr\u00fcfungskosten": {},
|
||||
"Abschreibung auf Umlaufverm\u00f6gen au\u00dfer Vorr\u00e4te und Wertpapieren des UV (\u00fcbliche H\u00f6he)": {},
|
||||
@@ -867,7 +866,7 @@
|
||||
"Aufwendungen aus Anteilen an Kapitalgesellschaften 100% / 50% nicht abzugsf\u00e4hig (inlandische Kap. Ges.)": {},
|
||||
"Aufwendungen aus Bewertung Finanzmittelfonds": {},
|
||||
"Aufwendungen aus Kursdifferenzen": {},
|
||||
"Aufwendungen aus der Ver\u00e4u\u00dferung von Anteilen an Kapitalgesellschaften 100% / 50% nicht abzugsf\u00e4hig (inl\u00e4ndische Kap. Ges.)": {},
|
||||
"Aufwendungen aus der Ver\u00e4u\u00dferung von Anteilen an Kapitalgesellschaften 100% / 50% nicht abzugsf\u00e4hig": {},
|
||||
"Aufwendungen aus der Zuschreibung von steuertlich niedriger bewerteten R\u00fcckstellungen": {},
|
||||
"Aufwendungen aus der Zuschreibung von steuertlich niedriger bewerteten Verbindlichkeiten": {},
|
||||
"Aufwendungen f\u00fcr Abraum- und Abfallbeseitigung": {},
|
||||
@@ -987,9 +986,9 @@
|
||||
"Verg\u00fctungen an Mitunternehmer \u00a7 15 EStG": {},
|
||||
"Verkaufsprovisionen": {},
|
||||
"Verluste aus dem Abgang von Gegenst\u00e4nden des Anlageverm\u00f6gens": {},
|
||||
"Verluste aus dem Abgang von Gegenst\u00e4nden des Umlaufverm\u00f6gens (au\u00dfer Vorr\u00e4te) 100% / 50% nicht anzugsf\u00e4hig (inlandische Kap. Ges.)": {},
|
||||
"Verluste aus dem Abgang von Gegenst\u00e4nden des Umlaufverm\u00f6gens (au\u00dfer Vorr\u00e4te) 100%/50% nicht anzugsf\u00e4hig": {},
|
||||
"Verluste aus dem Abgang von Gegenst\u00e4nden des Umlaufverm\u00f6gens au\u00dfer Vorr\u00e4te": {},
|
||||
"Verluste aus der Ver\u00e4u\u00dferung von Anteilen an Kapitalgesellschaften 100% / 50% nicht abzugsf\u00e4hig (inl\u00e4ndische Kap. Ges.)": {},
|
||||
"Verluste aus der Ver\u00e4u\u00dferung von Anteilen an Kapitalgesellschaften 100% / 50% nicht abzugsf\u00e4hig": {},
|
||||
"Verpackungsmaterial": {},
|
||||
"Versicherungen": {},
|
||||
"Versicherungen f\u00fcr Geb\u00e4ude": {},
|
||||
@@ -1020,10 +1019,10 @@
|
||||
},
|
||||
"Abschreibungen auf Finanzanlagen 100% / 50% nicht abzugsf\u00e4hig (inl\u00e4ndische Kap. Ges.)": {},
|
||||
"Abschreibungen auf Finanzanlagen auf Grund steuerlicher Sondervorschriften": {},
|
||||
"Abschreibungen auf Finanzanlagen auf Grund steuerlicher Sondervorschriften 100% / 50% nicht abzugsf\u00e4hig (inl\u00e4ndische Kap. Ges.)": {},
|
||||
"Abschreibungen auf Finanzanlagen auf Grund steuerlicher Sondervorschriften 100% / 50% nicht abzugsf\u00e4hig": {},
|
||||
"Abschreibungen auf Grund von Verlustanteilen an Mitunternehmerschaften \u00a7 8 GewStG": {},
|
||||
"Abschreibungen auf Wertpapiere des Umlaufverm\u00f6gens": {},
|
||||
"Abschreibungen auf Wertpapiere des Umlaufverm\u00f6gens 100% / 50% nicht abzugsf\u00e4hig (inl\u00e4ndische Kap. Ges.)": {},
|
||||
"Abschreibungen auf Wertpapiere des Umlaufverm\u00f6gens 100% / 50% nicht abzugsf\u00e4hig": {},
|
||||
"Vorwegnahme k\u00fcnftiger Wertschwankungen bei Wertpapieren des Umlaufverm\u00f6gens": {}
|
||||
},
|
||||
"account_type": "Depreciation"
|
||||
@@ -1123,15 +1122,15 @@
|
||||
}
|
||||
},
|
||||
"Erh\u00f6hung oder Verminderung des Bestands an fertigen und unfertige Erzeugnissen": {
|
||||
"Erh\u00f6hung des Bestands an fertigen und unfertigen Erzeugnissen oder Verminderung des Bestands an fertigen und unfertigen Erzeugnissen": {
|
||||
"Erh\u00f6hung / Verminderung des Bestands an fertigen und unfertigen Erzeugnissen": {
|
||||
"Bestandsver\u00e4nderungen - fertige Erzeugnisse": {},
|
||||
"Bestandsver\u00e4nderungen - unfertige Erzeugnisse": {},
|
||||
"Bestandsver\u00e4nderungen - unfertige Leistungen": {}
|
||||
},
|
||||
"Erh\u00f6hung des Bestands in Arbeit befindlicher Auftr\u00e4ge oder Verminderung des Bestands in Arbeit befindlicher Auftr\u00e4ge": {
|
||||
"Erh\u00f6hung / Verminderung des Bestands in Arbeit befindlicher Auftr\u00e4ge": {
|
||||
"Bestandsver\u00e4nderungen in Arbeit befindlicher Auftr\u00e4ge": {}
|
||||
},
|
||||
"Erh\u00f6hung des Bestands in Ausf\u00fchrung befindlicher Bauaftr\u00e4ge oder Verminderung des Bestands in Ausf\u00fchrung befindlicher Bauauftr\u00e4ge": {
|
||||
"Erh\u00f6hung / Verminderung des Bestands in Ausf\u00fchrung befindlicher Bauaftr\u00e4ge": {
|
||||
"Bestandsver\u00e4nderungen in Ausf\u00fchrung befindliche Bauauftr\u00e4ge": {}
|
||||
}
|
||||
},
|
||||
@@ -1384,8 +1383,8 @@
|
||||
"Sonstige Zinsen und \u00e4hnliche Ertr\u00e4ge 1": {
|
||||
"Diskontertr\u00e4ge": {},
|
||||
"Diskontertr\u00e4ge aus verbundenen Unternehmen": {},
|
||||
"Laufende Ertr\u00e4ge aus Anteilen an Kapitalgesellschaften (Umlaufverm\u00f6gen) 100% / 50% steuerfrei (inl\u00e4ndische Kap. Ges.)": {},
|
||||
"Laufende Ertr\u00e4ge aus Anteilen an Kapitalgesellschaften (verbundene Unternehmen) 100% / 50% steuerfrei (inl\u00e4ndische Kap. Ges.)": {},
|
||||
"Laufende Ertr\u00e4ge aus Anteilen an Kapitalgesellschaften 100% / 50% steuerfrei": {},
|
||||
"Laufende Ertr\u00e4ge aus Anteilen an Kapitalgesellschaften 100% / 50% steuerfrei": {},
|
||||
"Sonstige Zinsen und \u00e4hnliche Ertr\u00e4ge 2": {},
|
||||
"Sonstige Zinsen und \u00e4hnliche Ertr\u00e4ge aus verbundenen Unternehmen": {},
|
||||
"Sonstige Zinsertr\u00e4ge": {},
|
||||
|
||||
@@ -588,7 +588,6 @@
|
||||
"5592. Munk\u00e1ltat\u00f3 \u00e1ltal \u00f6nk\u00e9ntes p\u00e9nzt\u00e1rba befizetett munk\u00e1ltat\u00f3i tagd\u00edj hozz\u00e1j\u00e1rul\u00e1s": {},
|
||||
"5593. Munk\u00e1ltat\u00f3t terhel\u0151 szem\u00e9lyi j\u00f6vedelemad\u00f3": {},
|
||||
"5594. Munk\u00e1ltat\u00f3i hozz\u00e1j\u00e1rul\u00e1s a korengedm\u00e9nyes nyugd\u00edj ig\u00e9nybev\u00e9tel\u00e9hez": {},
|
||||
"5595. Tal\u00e1lm\u00e1nyi d\u00edj, szabadalom v\u00e9tel\u00e1ra \u00e9s hasznos\u00edt\u00e1si d\u00edja, az \u00faj\u00edt\u00e1si d\u00edj \u00e9s ezekkel kapcsolatos k\u00f6zrem\u0171k\u00f6d\u00e9si d\u00edjak": {},
|
||||
"5596. Fizetett szerz\u0151i, \u00edr\u00f3i \u00e9s m\u00e1s jogv\u00e9delmet \u00e9lvez\u0151 munk\u00e1k d\u00edjai \u00e9s ezekkel kapcsolatos k\u00f6zrem\u0171k\u00f6d\u0151i d\u00edjak": {},
|
||||
"5597. Fizetett \u00f6szt\u00f6nd\u00edjak": {},
|
||||
"5598. Reprezent\u00e1ci\u00f3s k\u00f6lts\u00e9gek, \u00e9tkez\u00e9si hozz\u00e1j\u00e1rul\u00e1s": {},
|
||||
@@ -731,7 +730,7 @@
|
||||
"8684. K\u00f6vetel\u00e9sek \u00e9rt\u00e9kveszt\u00e9se": {}
|
||||
},
|
||||
"869. K\u00fcl\u00f6nf\u00e9le egy\u00e9b r\u00e1ford\u00edt\u00e1sok": {
|
||||
"8691. T\u00e1rsas\u00e1gba bevitt, \u00e9rt\u00e9kpap\u00edrnak vagy r\u00e9szesed\u00e9snek nem min\u0151s\u00fcl\u0151 vagyont. k\u00f6nyv szerinti \u00e9s l\u00e9t. okir. meghat. veszt. k\u00fcl\u00f6nb\u00f6zet": {},
|
||||
"8691. T\u00e1rsas\u00e1gba bevitt, \u00e9rt\u00e9kpap\u00edrnak vagy r\u00e9szesed\u00e9snek nem min\u0151s\u00fcl\u0151 vagyont.": {},
|
||||
"8692. Ellent\u00e9telez\u00e9s n\u00e9lk\u00fcl \u00e1tv\u00e1llalt k\u00f6telezetts\u00e9g szerz\u0151d\u00e9s szerinti \u00f6sszege": {},
|
||||
"8693. T\u00e9r\u00edt\u00e9s n\u00e9lk\u00fcl \u00e1tadott, r\u00e9szesed\u00e9snek vagy \u00e9rt\u00e9kpap\u00edrnak nem min\u0151s\u00fcl\u0151 eszk\u00f6z\u00f6k nyilv\u00e1ntart\u00e1s szerinti \u00e9rt\u00e9ke": {},
|
||||
"8694. T\u00e9r\u00edt\u00e9s n\u00e9lk\u00fcl ny\u00fajtott szolg\u00e1ltat\u00e1sok beker\u00fcl\u00e9si \u00e9rt\u00e9ke": {},
|
||||
@@ -813,12 +812,7 @@
|
||||
"9684. R\u00e9szesed\u00e9sek \u00e9rt\u00e9kveszt\u00e9s\u00e9nek vissza\u00edr\u00e1sa": {}
|
||||
},
|
||||
"969. K\u00fcl\u00f6nf\u00e9le egy\u00e9b bev\u00e9telek": {
|
||||
"9691. Gazdas\u00e1gi t\u00e1rsas\u00e1gba bevitt, \u00e9rt\u00e9kp. vagy r\u00e9szesed\u00e9snek nem min\u0151s\u00fcl\u0151 vagyont. \u00e9rt\u00e9ke \u00e9s l\u00e9tes\u00edt\u0151 okir. \u00e9rt. nyer. jell . k\u00fcl\u00f6nb.": {},
|
||||
"9692. El\u00e9v\u00fclt k\u00f6telezetts\u00e9g k\u00f6nyv szerinti \u00e9rt\u00e9ke": {},
|
||||
"9693. T\u00e9r\u00edt\u00e9s n\u00e9lk\u00fcl \u00e1tvett, aj\u00e1nd\u00e9kk\u00e9nt, hagyat\u00e9kk\u00e9nt kapott, fellelt eszk\u00f6z\u00f6k piaci vagy jogszab\u00e1ly szerinti \u00e9rt\u00e9ke": {},
|
||||
"9694. T\u00e9r\u00edt\u00e9s n\u00e9lk\u00fcl kapott szolg\u00e1ltat\u00e1sok piaci vagy jogszab\u00e1ly szerinti \u00e9rt\u00e9ke": {},
|
||||
"9695. Elengedett \u00e9s ellent\u00e9telez\u00e9s n\u00e9lk\u00fcl \u00e1tv\u00e1llalt k\u00f6telezetts\u00e9g \u00e9rt\u00e9ke": {},
|
||||
"9696. Egy\u00e9b, vagyonn\u00f6veked\u00e9ssel j\u00e1r\u00f3 bev\u00e9telek": {}
|
||||
"is_group": 1
|
||||
}
|
||||
},
|
||||
"97. P\u00c9NZ\u00dcGYI M\u0170VELETEK BEV\u00c9TELEI": {
|
||||
|
||||
@@ -5,6 +5,8 @@ from __future__ import unicode_literals
|
||||
import unittest
|
||||
import frappe
|
||||
from erpnext.stock import get_warehouse_account, get_company_default_inventory_account
|
||||
from erpnext.accounts.doctype.account.account import update_account_number
|
||||
from erpnext.accounts.doctype.account.account import merge_account
|
||||
|
||||
class TestAccount(unittest.TestCase):
|
||||
def test_rename_account(self):
|
||||
@@ -21,21 +23,79 @@ class TestAccount(unittest.TestCase):
|
||||
self.assertEqual(account_number, "1210")
|
||||
self.assertEqual(account_name, "Debtors")
|
||||
|
||||
frappe.rename_doc("Account", "1210 - Debtors - _TC", "1211 - Debtors 1 - _TC")
|
||||
new_account_number = "1211-11-4 - 6 - "
|
||||
new_account_name = "Debtors 1 - Test - "
|
||||
|
||||
new_acc = frappe.db.get_value("Account", "1211 - Debtors 1 - _TC",
|
||||
update_account_number("1210 - Debtors - _TC", new_account_name, new_account_number)
|
||||
|
||||
new_acc = frappe.db.get_value("Account", "1211-11-4 - 6 - - Debtors 1 - Test - - _TC",
|
||||
["account_name", "account_number"], as_dict=1)
|
||||
self.assertEqual(new_acc.account_name, "Debtors 1")
|
||||
self.assertEqual(new_acc.account_number, "1211")
|
||||
|
||||
frappe.rename_doc("Account", "1211 - Debtors 1 - _TC", "Debtors 2")
|
||||
self.assertEqual(new_acc.account_name, "Debtors 1 - Test -")
|
||||
self.assertEqual(new_acc.account_number, "1211-11-4 - 6 -")
|
||||
|
||||
new_acc = frappe.db.get_value("Account", "1211 - Debtors 2 - _TC",
|
||||
["account_name", "account_number"], as_dict=1)
|
||||
self.assertEqual(new_acc.account_name, "Debtors 2")
|
||||
self.assertEqual(new_acc.account_number, "1211")
|
||||
frappe.delete_doc("Account", "1211-11-4 - 6 - Debtors 1 - Test - - _TC")
|
||||
|
||||
frappe.delete_doc("Account", "1211 - Debtors 2 - _TC")
|
||||
def test_merge_account(self):
|
||||
if not frappe.db.exists("Account", "Current Assets - _TC"):
|
||||
acc = frappe.new_doc("Account")
|
||||
acc.account_name = "Current Assets"
|
||||
acc.is_group = 1
|
||||
acc.parent_account = "Application of Funds (Assets) - _TC"
|
||||
acc.company = "_Test Company"
|
||||
acc.insert()
|
||||
if not frappe.db.exists("Account", "Securities and Deposits - _TC"):
|
||||
acc = frappe.new_doc("Account")
|
||||
acc.account_name = "Securities and Deposits"
|
||||
acc.parent_account = "Current Assets - _TC"
|
||||
acc.is_group = 1
|
||||
acc.company = "_Test Company"
|
||||
acc.insert()
|
||||
if not frappe.db.exists("Account", "Earnest Money - _TC"):
|
||||
acc = frappe.new_doc("Account")
|
||||
acc.account_name = "Earnest Money"
|
||||
acc.parent_account = "Securities and Deposits - _TC"
|
||||
acc.company = "_Test Company"
|
||||
acc.insert()
|
||||
if not frappe.db.exists("Account", "Cash In Hand - _TC"):
|
||||
acc = frappe.new_doc("Account")
|
||||
acc.account_name = "Cash In Hand"
|
||||
acc.is_group = 1
|
||||
acc.parent_account = "Current Assets - _TC"
|
||||
acc.company = "_Test Company"
|
||||
acc.insert()
|
||||
if not frappe.db.exists("Account", "Accumulated Depreciation - _TC"):
|
||||
acc = frappe.new_doc("Account")
|
||||
acc.account_name = "Accumulated Depreciation"
|
||||
acc.parent_account = "Fixed Assets - _TC"
|
||||
acc.company = "_Test Company"
|
||||
acc.insert()
|
||||
|
||||
doc = frappe.get_doc("Account", "Securities and Deposits - _TC")
|
||||
parent = frappe.db.get_value("Account", "Earnest Money - _TC", "parent_account")
|
||||
|
||||
self.assertEqual(parent, "Securities and Deposits - _TC")
|
||||
|
||||
merge_account("Securities and Deposits - _TC", "Cash In Hand - _TC", doc.is_group, doc.root_type, doc.company)
|
||||
parent = frappe.db.get_value("Account", "Earnest Money - _TC", "parent_account")
|
||||
|
||||
# Parent account of the child account changes after merging
|
||||
self.assertEqual(parent, "Cash In Hand - _TC")
|
||||
|
||||
# Old account doesn't exist after merging
|
||||
self.assertFalse(frappe.db.exists("Account", "Securities and Deposits - _TC"))
|
||||
|
||||
doc = frappe.get_doc("Account", "Current Assets - _TC")
|
||||
|
||||
# Raise error as is_group property doesn't match
|
||||
self.assertRaises(frappe.ValidationError, merge_account, "Current Assets - _TC",\
|
||||
"Accumulated Depreciation - _TC", doc.is_group, doc.root_type, doc.company)
|
||||
|
||||
doc = frappe.get_doc("Account", "Capital Stock - _TC")
|
||||
|
||||
# Raise error as root_type property doesn't match
|
||||
self.assertRaises(frappe.ValidationError, merge_account, "Capital Stock - _TC",\
|
||||
"Softwares - _TC", doc.is_group, doc.root_type, doc.company)
|
||||
|
||||
def _make_test_records(verbose):
|
||||
from frappe.test_runner import make_test_objects
|
||||
|
||||
@@ -159,6 +159,36 @@
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "include_pos_transactions",
|
||||
"fieldtype": "Check",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Include POS Transactions",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
@@ -292,7 +322,7 @@
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": 0,
|
||||
"modified": "2017-04-21 16:58:26.902732",
|
||||
"modified": "2018-03-07 18:58:48.658687",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Bank Reconciliation",
|
||||
|
||||
@@ -53,10 +53,26 @@ class BankReconciliation(Document):
|
||||
posting_date ASC, name DESC
|
||||
""".format(condition),
|
||||
{"account":self.bank_account, "from":self.from_date, "to":self.to_date}, as_dict=1)
|
||||
|
||||
entries = sorted(list(payment_entries)+list(journal_entries),
|
||||
|
||||
pos_entries = []
|
||||
if self.include_pos_transactions:
|
||||
pos_entries = frappe.db.sql("""
|
||||
select
|
||||
"Sales Invoice Payment" as payment_document, sip.name as payment_entry, sip.amount as debit,
|
||||
si.posting_date, si.debit_to as against_account, sip.clearance_date,
|
||||
account.account_currency, 0 as credit
|
||||
from `tabSales Invoice Payment` sip, `tabSales Invoice` si, `tabAccount` account
|
||||
where
|
||||
sip.account=%(account)s and si.docstatus=1 and sip.parent = si.name
|
||||
and account.name = sip.account and si.posting_date >= %(from)s and si.posting_date <= %(to)s {0}
|
||||
order by
|
||||
si.posting_date ASC, si.name DESC
|
||||
""".format(condition),
|
||||
{"account":self.bank_account, "from":self.from_date, "to":self.to_date}, as_dict=1)
|
||||
|
||||
entries = sorted(list(payment_entries)+list(journal_entries+list(pos_entries)),
|
||||
key=lambda k: k['posting_date'] or getdate(nowdate()))
|
||||
|
||||
|
||||
self.set('payment_entries', [])
|
||||
self.total_amount = 0.0
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# See license.txt
|
||||
from __future__ import unicode_literals
|
||||
import unittest
|
||||
|
||||
class TestBankReconciliation(unittest.TestCase):
|
||||
pass
|
||||
@@ -27,13 +27,21 @@ class Budget(Document):
|
||||
def validate_duplicate(self):
|
||||
budget_against_field = frappe.scrub(self.budget_against)
|
||||
budget_against = self.get(budget_against_field)
|
||||
existing_budget = frappe.db.get_value("Budget", {budget_against_field: budget_against,
|
||||
"fiscal_year": self.fiscal_year, "company": self.company,
|
||||
"name": ["!=", self.name], "docstatus": ["!=", 2]})
|
||||
if existing_budget:
|
||||
frappe.throw(_("Another Budget record '{0}' already exists against {1} '{2}' for fiscal year {3}")
|
||||
.format(existing_budget, self.budget_against, budget_against, self.fiscal_year), DuplicateBudgetError)
|
||||
|
||||
|
||||
accounts = [d.account for d in self.accounts] or []
|
||||
existing_budget = frappe.db.sql("""
|
||||
select
|
||||
b.name, ba.account from `tabBudget` b, `tabBudget Account` ba
|
||||
where
|
||||
ba.parent = b.name and b.docstatus < 2 and b.company = %s and %s=%s and
|
||||
b.fiscal_year=%s and b.name != %sand ba.account in (%s) """
|
||||
% ('%s', budget_against_field, '%s', '%s', '%s', ','.join(['%s'] * len(accounts))),
|
||||
(self.company, budget_against, self.fiscal_year, self.name) + tuple(accounts), as_dict=1)
|
||||
|
||||
for d in existing_budget:
|
||||
frappe.throw(_("Another Budget record '{0}' already exists against {1} '{2}' and account '{3}' for fiscal year {4}")
|
||||
.format(d.name, self.budget_against, budget_against, d.account, self.fiscal_year), DuplicateBudgetError)
|
||||
|
||||
def validate_accounts(self):
|
||||
account_list = []
|
||||
for d in self.get('accounts'):
|
||||
|
||||
@@ -27,22 +27,32 @@ def create_or_update_cheque_print_format(template_name):
|
||||
doc = frappe.get_doc("Cheque Print Template", template_name)
|
||||
|
||||
cheque_print.html = """
|
||||
<style>
|
||||
.print-format {
|
||||
padding: 0px;
|
||||
}
|
||||
@media screen {
|
||||
.print-format {
|
||||
padding: 0in;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<div style="position: relative; top:%(starting_position_from_top_edge)scm">
|
||||
<div style="width:%(cheque_width)scm;height:%(cheque_height)scm;">
|
||||
<span style="top: {{ %(acc_pay_dist_from_top_edge)s }}cm; left: {{ %(acc_pay_dist_from_left_edge)s }}cm;
|
||||
border-bottom: solid 1px;border-top:solid 1px; position: absolute;">
|
||||
<span style="top:%(acc_pay_dist_from_top_edge)scm; left:%(acc_pay_dist_from_left_edge)scm;
|
||||
border-bottom: solid 1px;border-top:solid 1px; width:2cm;text-align: center; position: absolute;">
|
||||
%(message_to_show)s
|
||||
</span>
|
||||
<span style="top:%(date_dist_from_top_edge)s cm; left:%(date_dist_from_left_edge)scm;
|
||||
<span style="top:%(date_dist_from_top_edge)scm; left:%(date_dist_from_left_edge)scm;
|
||||
position: absolute;">
|
||||
{{ frappe.utils.formatdate(doc.reference_date) or '' }}
|
||||
</span>
|
||||
<span style="top:%(acc_no_dist_from_top_edge)scm;left:%(acc_no_dist_from_left_edge)scm;
|
||||
position: absolute;">
|
||||
position: absolute; min-width: 6cm;">
|
||||
{{ doc.account_no or '' }}
|
||||
</span>
|
||||
<span style="top:%(payer_name_from_top_edge)scm;left: %(payer_name_from_left_edge)scm;
|
||||
position: absolute;">
|
||||
position: absolute; min-width: 6cm;">
|
||||
{{doc.party_name}}
|
||||
</span>
|
||||
<span style="top:%(amt_in_words_from_top_edge)scm; left:%(amt_in_words_from_left_edge)scm;
|
||||
@@ -51,11 +61,11 @@ def create_or_update_cheque_print_format(template_name):
|
||||
{{frappe.utils.money_in_words(doc.base_paid_amount or doc.base_received_amount)}}
|
||||
</span>
|
||||
<span style="top:%(amt_in_figures_from_top_edge)scm;left: %(amt_in_figures_from_left_edge)scm;
|
||||
position: absolute;">
|
||||
position: absolute; min-width: 4cm;">
|
||||
{{doc.get_formatted("base_paid_amount") or doc.get_formatted("base_received_amount")}}
|
||||
</span>
|
||||
<span style="top:%(signatory_from_top_edge)scm;left: %(signatory_from_left_edge)scm;
|
||||
position: absolute;">
|
||||
position: absolute; min-width: 6cm;">
|
||||
{{doc.company}}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -48,5 +48,10 @@ frappe.treeview_settings["Cost Center"] = {
|
||||
}, __('Budget'));
|
||||
|
||||
},
|
||||
onrender: function(node) {
|
||||
if(node.is_root){
|
||||
node.hide_add = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -132,7 +132,7 @@
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"search_index": 1,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
@@ -702,7 +702,7 @@
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"search_index": 1,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
}
|
||||
@@ -718,7 +718,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2017-12-20 12:40:09.611951",
|
||||
"modified": "2018-08-10 16:16:53.019380",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "GL Entry",
|
||||
@@ -794,4 +794,4 @@
|
||||
"sort_order": "DESC",
|
||||
"track_changes": 0,
|
||||
"track_seen": 0
|
||||
}
|
||||
}
|
||||
@@ -3,9 +3,8 @@
|
||||
"allow_guest_to_view": 0,
|
||||
"allow_import": 0,
|
||||
"allow_rename": 0,
|
||||
"autoname": "field:hub_category_name",
|
||||
"beta": 0,
|
||||
"creation": "2017-08-22 11:31:10.410322",
|
||||
"creation": "2018-01-02 15:48:58.768352",
|
||||
"custom": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "DocType",
|
||||
@@ -19,8 +18,8 @@
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "hub_category_name",
|
||||
"fieldtype": "Data",
|
||||
"fieldname": "company",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
@@ -28,9 +27,10 @@
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Category Name",
|
||||
"label": "Company",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Company",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
@@ -49,19 +49,19 @@
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "parent_hub_category",
|
||||
"fieldname": "cgst_account",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Parent Category",
|
||||
"label": "CGST Account",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Hub Category",
|
||||
"options": "Account",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
@@ -69,7 +69,7 @@
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
@@ -80,18 +80,19 @@
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "is_group",
|
||||
"fieldtype": "Check",
|
||||
"fieldname": "sgst_account",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Is Group",
|
||||
"label": "SGST Account",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Account",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
@@ -99,7 +100,7 @@
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
@@ -110,18 +111,19 @@
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "description",
|
||||
"fieldtype": "Text Editor",
|
||||
"fieldname": "igst_account",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Description",
|
||||
"label": "IGST Account",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Account",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
@@ -129,7 +131,7 @@
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
@@ -140,78 +142,19 @@
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "lft",
|
||||
"fieldtype": "Int",
|
||||
"fieldname": "cess_account",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Left",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "rgt",
|
||||
"fieldtype": "Int",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Right",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "old_parent",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Old Parent",
|
||||
"label": "CESS Account",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Account",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
@@ -233,43 +176,21 @@
|
||||
"in_create": 0,
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"istable": 1,
|
||||
"max_attachments": 0,
|
||||
"modified": "2017-09-03 22:04:22.958831",
|
||||
"modified": "2018-01-02 15:52:22.335988",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Hub Node",
|
||||
"name": "Hub Category",
|
||||
"module": "Accounts",
|
||||
"name": "GST Account",
|
||||
"name_case": "",
|
||||
"owner": "Administrator",
|
||||
"permissions": [
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "System Manager",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"permissions": [],
|
||||
"quick_entry": 1,
|
||||
"read_only": 0,
|
||||
"read_only_onload": 0,
|
||||
"show_name_in_global_search": 0,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"title_field": "hub_category_name",
|
||||
"track_changes": 1,
|
||||
"track_seen": 0
|
||||
}
|
||||
@@ -1,11 +1,10 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
|
||||
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe.utils.nestedset import NestedSet
|
||||
from frappe.model.document import Document
|
||||
|
||||
class HubCategory(NestedSet):
|
||||
class GSTAccount(Document):
|
||||
pass
|
||||
@@ -82,8 +82,8 @@ erpnext.accounts.JournalEntry = frappe.ui.form.Controller.extend({
|
||||
$.each(this.frm.doc.accounts || [], function(i, jvd) {
|
||||
frappe.model.set_default_values(jvd);
|
||||
});
|
||||
|
||||
if(!this.frm.doc.amended_from) this.frm.doc.posting_date = this.frm.posting_date || frappe.datetime.get_today();
|
||||
var posting_date = this.frm.posting_date;
|
||||
if(!this.frm.doc.amended_from) this.frm.set_value('posting_date', posting_date || frappe.datetime.get_today());
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -381,7 +381,7 @@
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"search_index": 1,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
@@ -1443,7 +1443,7 @@
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": 0,
|
||||
"modified": "2017-08-31 11:21:09.442695",
|
||||
"modified": "2018-08-10 16:35:31.361030",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Journal Entry",
|
||||
|
||||
@@ -82,7 +82,7 @@ class JournalEntry(AccountsController):
|
||||
d.reference_type = ''
|
||||
d.reference_name = ''
|
||||
d.db_update()
|
||||
|
||||
|
||||
def unlink_asset_reference(self):
|
||||
for d in self.get("accounts"):
|
||||
if d.reference_type=="Asset" and d.reference_name:
|
||||
@@ -125,7 +125,7 @@ class JournalEntry(AccountsController):
|
||||
if (d.party_type == 'Customer' and flt(d.credit) > 0) or \
|
||||
(d.party_type == 'Supplier' and flt(d.debit) > 0):
|
||||
if d.is_advance=="No":
|
||||
msgprint(_("Row {0}: Please check 'Is Advance' against Account {1} if this is an advance entry.").format(d.idx, d.account))
|
||||
msgprint(_("Row {0}: Please check 'Is Advance' against Account {1} if this is an advance entry.").format(d.idx, d.account), alert=1)
|
||||
elif d.reference_type in ("Sales Order", "Purchase Order") and d.is_advance != "Yes":
|
||||
frappe.throw(_("Row {0}: Payment against Sales/Purchase Order should always be marked as advance").format(d.idx))
|
||||
|
||||
|
||||
@@ -199,7 +199,7 @@
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"search_index": 1,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
@@ -661,7 +661,7 @@
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
@@ -795,7 +795,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 1,
|
||||
"max_attachments": 0,
|
||||
"modified": "2017-12-07 19:54:19.851534",
|
||||
"modified": "2018-08-10 16:35:42.833549",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Journal Entry Account",
|
||||
|
||||
@@ -138,7 +138,8 @@ class OpeningInvoiceCreationTool(Document):
|
||||
income_expense_account_field = "expense_account"
|
||||
|
||||
item = get_item_dict()
|
||||
return frappe._dict({
|
||||
|
||||
args = frappe._dict({
|
||||
"items": [item],
|
||||
"is_opening": "Yes",
|
||||
"set_posting_time": 1,
|
||||
@@ -150,6 +151,11 @@ class OpeningInvoiceCreationTool(Document):
|
||||
"currency": frappe.db.get_value("Company", self.company, "default_currency")
|
||||
})
|
||||
|
||||
if self.invoice_type == "Sales":
|
||||
args["is_pos"] = 0
|
||||
|
||||
return args
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_temporary_opening_account(company=None):
|
||||
if not company:
|
||||
|
||||
@@ -145,13 +145,13 @@ frappe.ui.form.on('Payment Entry', {
|
||||
frm.doc.paid_amount : frm.doc.received_amount;
|
||||
|
||||
frm.toggle_display("write_off_difference_amount", (frm.doc.difference_amount && frm.doc.party &&
|
||||
(frm.doc.paid_from_account_currency == frm.doc.paid_to_account_currency) &&
|
||||
(frm.doc.total_allocated_amount > party_amount)));
|
||||
|
||||
frm.toggle_display("set_exchange_gain_loss",
|
||||
(frm.doc.paid_amount && frm.doc.received_amount && frm.doc.difference_amount &&
|
||||
(frm.doc.paid_from_account_currency != company_currency ||
|
||||
frm.doc.paid_to_account_currency != company_currency)));
|
||||
((frm.doc.paid_from_account_currency != company_currency ||
|
||||
frm.doc.paid_to_account_currency != company_currency) &&
|
||||
frm.doc.paid_from_account_currency != frm.doc.paid_to_account_currency)));
|
||||
|
||||
frm.refresh_fields();
|
||||
},
|
||||
@@ -300,7 +300,15 @@ frappe.ui.form.on('Payment Entry', {
|
||||
if(frm.doc.payment_type == "Pay") {
|
||||
frm.events.get_outstanding_documents(frm);
|
||||
} else if (frm.doc.payment_type == "Receive") {
|
||||
frm.events.received_amount(frm);
|
||||
if(frm.doc.paid_from_account_currency == frm.doc.paid_to_account_currency) {
|
||||
if(frm.doc.source_exchange_rate) {
|
||||
frm.set_value("target_exchange_rate", frm.doc.source_exchange_rate);
|
||||
}
|
||||
frm.set_value("received_amount", frm.doc.paid_amount);
|
||||
|
||||
} else {
|
||||
frm.events.received_amount(frm);
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -317,26 +325,31 @@ frappe.ui.form.on('Payment Entry', {
|
||||
},
|
||||
callback: function(r, rt) {
|
||||
if(r.message) {
|
||||
frm.set_value(currency_field, r.message['account_currency']);
|
||||
frm.set_value(balance_field, r.message['account_balance']);
|
||||
frappe.run_serially([
|
||||
() => frm.set_value(currency_field, r.message['account_currency']),
|
||||
() => {
|
||||
frm.set_value(balance_field, r.message['account_balance']);
|
||||
|
||||
if(frm.doc.payment_type=="Receive" && currency_field=="paid_to_account_currency") {
|
||||
frm.toggle_reqd(["reference_no", "reference_date"],
|
||||
(r.message['account_type'] == "Bank" ? 1 : 0));
|
||||
if(!frm.doc.received_amount && frm.doc.paid_amount)
|
||||
frm.events.paid_amount(frm);
|
||||
} else if(frm.doc.payment_type=="Pay" && currency_field=="paid_from_account_currency") {
|
||||
frm.toggle_reqd(["reference_no", "reference_date"],
|
||||
(r.message['account_type'] == "Bank" ? 1 : 0));
|
||||
if(frm.doc.payment_type=="Receive" && currency_field=="paid_to_account_currency") {
|
||||
frm.toggle_reqd(["reference_no", "reference_date"],
|
||||
(r.message['account_type'] == "Bank" ? 1 : 0));
|
||||
if(!frm.doc.received_amount && frm.doc.paid_amount)
|
||||
frm.events.paid_amount(frm);
|
||||
} else if(frm.doc.payment_type=="Pay" && currency_field=="paid_from_account_currency") {
|
||||
frm.toggle_reqd(["reference_no", "reference_date"],
|
||||
(r.message['account_type'] == "Bank" ? 1 : 0));
|
||||
|
||||
if(!frm.doc.paid_amount && frm.doc.received_amount)
|
||||
frm.events.received_amount(frm);
|
||||
}
|
||||
if(!frm.doc.paid_amount && frm.doc.received_amount)
|
||||
frm.events.received_amount(frm);
|
||||
}
|
||||
},
|
||||
() => {
|
||||
if(callback_function) callback_function(frm);
|
||||
|
||||
if(callback_function) callback_function(frm);
|
||||
|
||||
frm.events.hide_unhide_fields(frm);
|
||||
frm.events.set_dynamic_labels(frm);
|
||||
frm.events.hide_unhide_fields(frm);
|
||||
frm.events.set_dynamic_labels(frm);
|
||||
}
|
||||
]);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -405,7 +418,7 @@ frappe.ui.form.on('Payment Entry', {
|
||||
frm.set_value("base_received_amount", frm.doc.base_paid_amount);
|
||||
}
|
||||
|
||||
frm.events.set_difference_amount(frm);
|
||||
frm.events.set_unallocated_amount(frm);
|
||||
}
|
||||
|
||||
// Make read only if Accounts Settings doesn't allow stale rates
|
||||
@@ -425,7 +438,7 @@ frappe.ui.form.on('Payment Entry', {
|
||||
frm.set_value("base_paid_amount", frm.doc.base_received_amount);
|
||||
}
|
||||
|
||||
frm.events.set_difference_amount(frm);
|
||||
frm.events.set_unallocated_amount(frm);
|
||||
}
|
||||
frm.set_paid_amount_based_on_received_amount = false;
|
||||
|
||||
@@ -456,7 +469,7 @@ frappe.ui.form.on('Payment Entry', {
|
||||
if(frm.doc.payment_type == "Pay")
|
||||
frm.events.allocate_party_amount_against_ref_docs(frm, frm.doc.received_amount);
|
||||
else
|
||||
frm.events.set_difference_amount(frm);
|
||||
frm.events.set_unallocated_amount(frm);
|
||||
|
||||
frm.set_paid_amount_based_on_received_amount = false;
|
||||
},
|
||||
@@ -476,7 +489,7 @@ frappe.ui.form.on('Payment Entry', {
|
||||
if(frm.doc.payment_type == "Receive")
|
||||
frm.events.allocate_party_amount_against_ref_docs(frm, frm.doc.paid_amount);
|
||||
else
|
||||
frm.events.set_difference_amount(frm);
|
||||
frm.events.set_unallocated_amount(frm);
|
||||
},
|
||||
|
||||
get_outstanding_documents: function(frm) {
|
||||
@@ -565,13 +578,20 @@ frappe.ui.form.on('Payment Entry', {
|
||||
if(frm.doc.references.length == 0){
|
||||
frm.events.get_outstanding_documents(frm);
|
||||
}
|
||||
|
||||
frm.events.allocate_party_amount_against_ref_docs(frm, frm.doc.received_amount);
|
||||
if(frm.doc.payment_type == 'Internal Transfer') {
|
||||
frm.events.allocate_party_amount_against_ref_docs(frm, frm.doc.paid_amount);
|
||||
} else {
|
||||
frm.events.allocate_party_amount_against_ref_docs(frm, frm.doc.received_amount);
|
||||
}
|
||||
},
|
||||
|
||||
allocate_party_amount_against_ref_docs: function(frm, paid_amount) {
|
||||
var total_positive_outstanding_including_order = 0;
|
||||
var total_negative_outstanding = 0;
|
||||
var total_deductions = frappe.utils.sum($.map(frm.doc.deductions || [],
|
||||
function(d) { return flt(d.amount) }));
|
||||
|
||||
paid_amount -= total_deductions;
|
||||
|
||||
$.each(frm.doc.references || [], function(i, row) {
|
||||
if(flt(row.outstanding_amount) > 0)
|
||||
@@ -651,28 +671,32 @@ frappe.ui.form.on('Payment Entry', {
|
||||
frm.set_value("total_allocated_amount", Math.abs(total_allocated_amount));
|
||||
frm.set_value("base_total_allocated_amount", Math.abs(base_total_allocated_amount));
|
||||
|
||||
frm.events.set_difference_amount(frm);
|
||||
frm.events.set_unallocated_amount(frm);
|
||||
},
|
||||
|
||||
set_difference_amount: function(frm) {
|
||||
set_unallocated_amount: function(frm) {
|
||||
var unallocated_amount = 0;
|
||||
var total_deductions = frappe.utils.sum($.map(frm.doc.deductions || [],
|
||||
function(d) { return flt(d.amount) }));
|
||||
|
||||
if(frm.doc.party) {
|
||||
var party_amount = frm.doc.payment_type=="Receive" ?
|
||||
frm.doc.paid_amount : frm.doc.received_amount;
|
||||
|
||||
if(frm.doc.total_allocated_amount < party_amount) {
|
||||
if(frm.doc.payment_type == "Receive") {
|
||||
unallocated_amount = party_amount - (frm.doc.total_allocated_amount - total_deductions);
|
||||
} else {
|
||||
unallocated_amount = party_amount - (frm.doc.total_allocated_amount + total_deductions);
|
||||
}
|
||||
if(frm.doc.payment_type == "Receive"
|
||||
&& frm.doc.base_total_allocated_amount < frm.doc.base_received_amount + total_deductions
|
||||
&& frm.doc.total_allocated_amount < frm.doc.paid_amount + (total_deductions / frm.doc.source_exchange_rate)) {
|
||||
unallocated_amount = (frm.doc.base_received_amount + total_deductions
|
||||
- frm.doc.base_total_allocated_amount) / frm.doc.source_exchange_rate;
|
||||
} else if (frm.doc.payment_type == "Pay"
|
||||
&& frm.doc.base_total_allocated_amount < frm.doc.base_paid_amount - total_deductions
|
||||
&& frm.doc.total_allocated_amount < frm.doc.received_amount + (total_deductions / frm.doc.target_exchange_rate)) {
|
||||
unallocated_amount = (frm.doc.base_paid_amount - (total_deductions
|
||||
+ frm.doc.base_total_allocated_amount)) / frm.doc.target_exchange_rate;
|
||||
}
|
||||
}
|
||||
frm.set_value("unallocated_amount", unallocated_amount);
|
||||
|
||||
frm.trigger("set_difference_amount");
|
||||
},
|
||||
|
||||
set_difference_amount: function(frm) {
|
||||
var difference_amount = 0;
|
||||
var base_unallocated_amount = flt(frm.doc.unallocated_amount) *
|
||||
(frm.doc.payment_type=="Receive" ? frm.doc.source_exchange_rate : frm.doc.target_exchange_rate);
|
||||
@@ -687,11 +711,18 @@ frappe.ui.form.on('Payment Entry', {
|
||||
difference_amount = flt(frm.doc.base_paid_amount) - flt(frm.doc.base_received_amount);
|
||||
}
|
||||
|
||||
var total_deductions = frappe.utils.sum($.map(frm.doc.deductions || [],
|
||||
function(d) { return flt(d.amount) }));
|
||||
|
||||
frm.set_value("difference_amount", difference_amount - total_deductions);
|
||||
|
||||
frm.events.hide_unhide_fields(frm);
|
||||
},
|
||||
|
||||
unallocated_amount: function(frm) {
|
||||
frm.trigger("set_difference_amount");
|
||||
},
|
||||
|
||||
check_mandatory_to_fetch: function(frm) {
|
||||
$.each(["Company", "Party Type", "Party", "payment_type"], function(i, field) {
|
||||
if(!frm.doc[frappe.model.scrub(field)]) {
|
||||
@@ -771,7 +802,7 @@ frappe.ui.form.on('Payment Entry', {
|
||||
row.amount = flt(row.amount) + flt(frm.doc.difference_amount);
|
||||
refresh_field("deductions");
|
||||
|
||||
frm.events.set_difference_amount(frm);
|
||||
frm.events.set_unallocated_amount(frm);
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -788,23 +819,30 @@ frappe.ui.form.on('Payment Entry Reference', {
|
||||
|
||||
reference_name: function(frm, cdt, cdn) {
|
||||
var row = locals[cdt][cdn];
|
||||
return frappe.call({
|
||||
method: "erpnext.accounts.doctype.payment_entry.payment_entry.get_reference_details",
|
||||
args: {
|
||||
reference_doctype: row.reference_doctype,
|
||||
reference_name: row.reference_name,
|
||||
party_account_currency: frm.doc.payment_type=="Receive" ?
|
||||
frm.doc.paid_from_account_currency : frm.doc.paid_to_account_currency
|
||||
},
|
||||
callback: function(r, rt) {
|
||||
if(r.message) {
|
||||
$.each(r.message, function(field, value) {
|
||||
frappe.model.set_value(cdt, cdn, field, value);
|
||||
})
|
||||
frm.refresh_fields();
|
||||
if (row.reference_name && row.reference_doctype) {
|
||||
return frappe.call({
|
||||
method: "erpnext.accounts.doctype.payment_entry.payment_entry.get_reference_details",
|
||||
args: {
|
||||
reference_doctype: row.reference_doctype,
|
||||
reference_name: row.reference_name,
|
||||
party_account_currency: frm.doc.payment_type=="Receive" ?
|
||||
frm.doc.paid_from_account_currency : frm.doc.paid_to_account_currency
|
||||
},
|
||||
callback: function(r, rt) {
|
||||
if(r.message) {
|
||||
$.each(r.message, function(field, value) {
|
||||
frappe.model.set_value(cdt, cdn, field, value);
|
||||
})
|
||||
|
||||
let allocated_amount = frm.doc.unallocated_amount > row.outstanding_amount ?
|
||||
row.outstanding_amount : frm.doc.unallocated_amount;
|
||||
|
||||
frappe.model.set_value(cdt, cdn, 'allocated_amount', allocated_amount);
|
||||
frm.refresh_fields();
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
allocated_amount: function(frm) {
|
||||
@@ -818,10 +856,10 @@ frappe.ui.form.on('Payment Entry Reference', {
|
||||
|
||||
frappe.ui.form.on('Payment Entry Deduction', {
|
||||
amount: function(frm) {
|
||||
frm.events.set_difference_amount(frm);
|
||||
frm.events.set_unallocated_amount(frm);
|
||||
},
|
||||
|
||||
deductions_remove: function(frm) {
|
||||
frm.events.set_difference_amount(frm);
|
||||
frm.events.set_unallocated_amount(frm);
|
||||
}
|
||||
})
|
||||
|
||||
@@ -286,7 +286,7 @@
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"search_index": 1,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
@@ -1188,7 +1188,7 @@
|
||||
"precision": "",
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -1439,7 +1439,7 @@
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"search_index": 1,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
@@ -1555,7 +1555,7 @@
|
||||
"in_standard_filter": 0,
|
||||
"label": "Remarks",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"no_copy": 1,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
@@ -1791,7 +1791,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2017-08-31 11:20:37.578469",
|
||||
"modified": "2018-08-10 16:34:46.771275",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Payment Entry",
|
||||
|
||||
@@ -20,6 +20,11 @@ class InvalidPaymentEntry(ValidationError):
|
||||
|
||||
|
||||
class PaymentEntry(AccountsController):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(PaymentEntry, self).__init__(*args, **kwargs)
|
||||
if not self.is_new():
|
||||
self.setup_party_account_field()
|
||||
|
||||
def setup_party_account_field(self):
|
||||
self.party_account_field = None
|
||||
self.party_account = None
|
||||
@@ -58,16 +63,21 @@ class PaymentEntry(AccountsController):
|
||||
if self.difference_amount:
|
||||
frappe.throw(_("Difference Amount must be zero"))
|
||||
self.make_gl_entries()
|
||||
self.update_outstanding_amounts()
|
||||
self.update_advance_paid()
|
||||
self.update_expense_claim()
|
||||
|
||||
def on_cancel(self):
|
||||
self.setup_party_account_field()
|
||||
self.make_gl_entries(cancel=1)
|
||||
self.update_outstanding_amounts()
|
||||
self.update_advance_paid()
|
||||
self.update_expense_claim()
|
||||
self.delink_advance_entry_references()
|
||||
|
||||
def update_outstanding_amounts(self):
|
||||
self.set_missing_ref_details(force=True)
|
||||
|
||||
def validate_duplicate_entry(self):
|
||||
reference_names = []
|
||||
for d in self.get("references"):
|
||||
@@ -129,14 +139,14 @@ class PaymentEntry(AccountsController):
|
||||
|
||||
self.set_missing_ref_details()
|
||||
|
||||
def set_missing_ref_details(self):
|
||||
def set_missing_ref_details(self, force=False):
|
||||
for d in self.get("references"):
|
||||
if d.allocated_amount:
|
||||
ref_details = get_reference_details(d.reference_doctype,
|
||||
d.reference_name, self.party_account_currency)
|
||||
|
||||
for field, value in ref_details.items():
|
||||
if not d.get(field):
|
||||
if not d.get(field) or force:
|
||||
d.set(field, value)
|
||||
|
||||
def validate_payment_type(self):
|
||||
@@ -281,17 +291,19 @@ class PaymentEntry(AccountsController):
|
||||
self.base_total_allocated_amount = abs(base_total_allocated_amount)
|
||||
|
||||
def set_unallocated_amount(self):
|
||||
self.unallocated_amount = 0;
|
||||
self.unallocated_amount = 0
|
||||
if self.party:
|
||||
party_amount = self.paid_amount if self.payment_type=="Receive" else self.received_amount
|
||||
|
||||
total_deductions = sum([flt(d.amount) for d in self.get("deductions")])
|
||||
|
||||
if self.total_allocated_amount < party_amount:
|
||||
if self.payment_type == "Receive":
|
||||
self.unallocated_amount = party_amount - (self.total_allocated_amount - total_deductions)
|
||||
else:
|
||||
self.unallocated_amount = party_amount - (self.total_allocated_amount + total_deductions)
|
||||
if self.payment_type == "Receive" \
|
||||
and self.base_total_allocated_amount < self.base_received_amount + total_deductions \
|
||||
and self.total_allocated_amount < self.paid_amount + (total_deductions / self.source_exchange_rate):
|
||||
self.unallocated_amount = (self.base_received_amount + total_deductions -
|
||||
self.base_total_allocated_amount) / self.source_exchange_rate
|
||||
elif self.payment_type == "Pay" \
|
||||
and self.base_total_allocated_amount < (self.base_paid_amount - total_deductions) \
|
||||
and self.total_allocated_amount < self.received_amount + (total_deductions / self.target_exchange_rate):
|
||||
self.unallocated_amount = (self.base_paid_amount - (total_deductions +
|
||||
self.base_total_allocated_amount)) / self.target_exchange_rate
|
||||
|
||||
def set_difference_amount(self):
|
||||
base_unallocated_amount = flt(self.unallocated_amount) * (flt(self.source_exchange_rate)
|
||||
@@ -325,14 +337,15 @@ class PaymentEntry(AccountsController):
|
||||
total_negative_outstanding = sum([abs(flt(d.outstanding_amount))
|
||||
for d in self.get("references") if flt(d.outstanding_amount) < 0])
|
||||
|
||||
party_amount = self.paid_amount if self.payment_type=="Receive" else self.received_amount
|
||||
paid_amount = self.paid_amount if self.payment_type=="Receive" else self.received_amount
|
||||
additional_charges = sum([flt(d.amount) for d in self.deductions])
|
||||
|
||||
if not total_negative_outstanding:
|
||||
frappe.throw(_("Cannot {0} {1} {2} without any negative outstanding invoice")
|
||||
.format(self.payment_type, ("to" if self.party_type=="Customer" else "from"),
|
||||
self.party_type), InvalidPaymentEntry)
|
||||
|
||||
elif party_amount > total_negative_outstanding:
|
||||
elif paid_amount - additional_charges > total_negative_outstanding:
|
||||
frappe.throw(_("Paid Amount cannot be greater than total negative outstanding amount {0}")
|
||||
.format(total_negative_outstanding), InvalidPaymentEntry)
|
||||
|
||||
@@ -660,6 +673,24 @@ def get_company_defaults(company):
|
||||
return ret
|
||||
|
||||
|
||||
def get_outstanding_on_journal_entry(name):
|
||||
res = frappe.db.sql(
|
||||
'SELECT '
|
||||
'CASE WHEN party_type IN ("Customer", "Student") '
|
||||
'THEN ifnull(sum(debit_in_account_currency - credit_in_account_currency), 0) '
|
||||
'ELSE ifnull(sum(credit_in_account_currency - debit_in_account_currency), 0) '
|
||||
'END as outstanding_amount '
|
||||
'FROM `tabGL Entry` WHERE (voucher_no=%s OR against_voucher=%s) '
|
||||
'AND party_type IS NOT NULL '
|
||||
'AND party_type != ""',
|
||||
(name, name), as_dict=1
|
||||
)
|
||||
|
||||
outstanding_amount = res[0].get('outstanding_amount', 0) if res else 0
|
||||
|
||||
return outstanding_amount
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_reference_details(reference_doctype, reference_name, party_account_currency):
|
||||
total_amount = outstanding_amount = exchange_rate = None
|
||||
@@ -670,6 +701,13 @@ def get_reference_details(reference_doctype, reference_name, party_account_curre
|
||||
total_amount = ref_doc.get("grand_total")
|
||||
exchange_rate = 1
|
||||
outstanding_amount = ref_doc.get("outstanding_amount")
|
||||
elif reference_doctype == "Journal Entry" and ref_doc.docstatus == 1:
|
||||
total_amount = ref_doc.get("total_amount")
|
||||
if ref_doc.multi_currency:
|
||||
exchange_rate = get_exchange_rate(party_account_currency, company_currency, ref_doc.posting_date)
|
||||
else:
|
||||
exchange_rate = 1
|
||||
outstanding_amount = get_outstanding_on_journal_entry(reference_name)
|
||||
elif reference_doctype != "Journal Entry":
|
||||
if party_account_currency == company_currency:
|
||||
if ref_doc.doctype == "Expense Claim":
|
||||
@@ -687,8 +725,11 @@ def get_reference_details(reference_doctype, reference_name, party_account_curre
|
||||
exchange_rate = ref_doc.get("conversion_rate") or \
|
||||
get_exchange_rate(party_account_currency, company_currency, ref_doc.posting_date)
|
||||
|
||||
if reference_doctype in ("Sales Invoice", "Purchase Invoice", "Expense Claim"):
|
||||
if reference_doctype in ("Sales Invoice", "Purchase Invoice"):
|
||||
outstanding_amount = ref_doc.get("outstanding_amount")
|
||||
elif reference_doctype == "Expense Claim":
|
||||
outstanding_amount = flt(ref_doc.get("total_sanctioned_amount")) \
|
||||
- flt(ref_doc.get("total_amount+reimbursed")) - flt(ref_doc.get("total_advance_amount"))
|
||||
elif reference_doctype == "Employee Advance":
|
||||
outstanding_amount = ref_doc.advance_amount - flt(ref_doc.paid_amount)
|
||||
else:
|
||||
@@ -731,6 +772,8 @@ def get_payment_entry(dt, dn, party_amount=None, bank_account=None, bank_amount=
|
||||
party_account = doc.receivable_account
|
||||
elif dt == "Employee Advance":
|
||||
party_account = doc.advance_account
|
||||
elif dt == "Expense Claim":
|
||||
party_account = doc.payable_account
|
||||
else:
|
||||
party_account = get_party_account(party_type, doc.get(party_type.lower()), doc.company)
|
||||
|
||||
|
||||
@@ -141,7 +141,6 @@ class TestPaymentEntry(unittest.TestCase):
|
||||
def test_payment_entry_retrieves_last_exchange_rate(self):
|
||||
from erpnext.setup.doctype.currency_exchange.test_currency_exchange import test_records, save_new_records
|
||||
|
||||
test_records = test_records
|
||||
save_new_records(test_records)
|
||||
|
||||
pe = frappe.new_doc("Payment Entry")
|
||||
@@ -151,6 +150,7 @@ class TestPaymentEntry(unittest.TestCase):
|
||||
pe.paid_from = "_Test Bank USD - _TC"
|
||||
pe.paid_to = "_Test Bank - _TC"
|
||||
pe.paid_amount = 100
|
||||
pe.received_amount = 100
|
||||
pe.reference_no = "3"
|
||||
pe.reference_date = "2016-01-10"
|
||||
pe.party_type = "Supplier"
|
||||
|
||||
@@ -98,7 +98,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 1,
|
||||
"max_attachments": 0,
|
||||
"modified": "2016-07-11 03:28:03.420683",
|
||||
"modified": "2018-02-21 03:28:03.420683",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Payment Entry Deduction",
|
||||
|
||||
@@ -3,9 +3,26 @@
|
||||
|
||||
frappe.provide("erpnext.accounts");
|
||||
|
||||
frappe.ui.form.on("Payment Reconciliation Payment", {
|
||||
invoice_number: function(frm, cdt, cdn) {
|
||||
var row = locals[cdt][cdn];
|
||||
if(row.invoice_number) {
|
||||
var parts = row.invoice_number.split(' | ');
|
||||
var invoice_type = parts[0];
|
||||
var invoice_number = parts[1];
|
||||
|
||||
var invoice_amount = frm.doc.invoices.filter(function(d) {
|
||||
return d.invoice_type === invoice_type && d.invoice_number === invoice_number;
|
||||
})[0].outstanding_amount;
|
||||
|
||||
frappe.model.set_value(cdt, cdn, "allocated_amount", Math.min(invoice_amount, row.amount));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
erpnext.accounts.PaymentReconciliationController = frappe.ui.form.Controller.extend({
|
||||
onload: function() {
|
||||
var me = this
|
||||
var me = this;
|
||||
this.frm.set_query("party_type", function() {
|
||||
return{
|
||||
query: "erpnext.setup.doctype.party_type.party_type.get_party_type"
|
||||
|
||||
@@ -55,6 +55,7 @@ class PaymentReconciliation(Document):
|
||||
THEN 1=1
|
||||
ELSE {bank_account_condition}
|
||||
END)
|
||||
order by t1.posting_date
|
||||
""".format(**{
|
||||
"dr_or_cr": dr_or_cr,
|
||||
"bank_account_condition": bank_account_condition,
|
||||
|
||||
@@ -78,6 +78,9 @@ class PaymentRequest(Document):
|
||||
controller = get_payment_gateway_controller(self.payment_gateway)
|
||||
controller.validate_transaction_currency(self.currency)
|
||||
|
||||
if hasattr(controller, 'validate_minimum_transaction_amount'):
|
||||
controller.validate_minimum_transaction_amount(self.currency, self.grand_total)
|
||||
|
||||
return controller.get_payment_url(**{
|
||||
"amount": flt(self.grand_total, self.precision("grand_total")),
|
||||
"title": data.company.encode("utf-8"),
|
||||
|
||||
@@ -61,13 +61,11 @@ class TestPaymentRequest(unittest.TestCase):
|
||||
self.assertEquals(pr.currency, "USD")
|
||||
|
||||
def test_payment_entry(self):
|
||||
frappe.db.set_value("Company", "_Test Company",
|
||||
frappe.db.set_value("Company", "_Test Company",
|
||||
"exchange_gain_loss_account", "_Test Exchange Gain/Loss - _TC")
|
||||
frappe.db.set_value("Company", "_Test Company",
|
||||
"write_off_account", "_Test Write Off - _TC")
|
||||
frappe.db.set_value("Company", "_Test Company",
|
||||
"cost_center", "_Test Cost Center - _TC")
|
||||
|
||||
frappe.db.set_value("Company", "_Test Company", "write_off_account", "_Test Write Off - _TC")
|
||||
frappe.db.set_value("Company", "_Test Company", "cost_center", "_Test Cost Center - _TC")
|
||||
|
||||
so_inr = make_sales_order(currency="INR")
|
||||
pr = make_payment_request(dt="Sales Order", dn=so_inr.name, recipient_id="saurabh@erpnext.com",
|
||||
mute_email=1, submit_doc=1, return_doc=1)
|
||||
@@ -82,15 +80,15 @@ class TestPaymentRequest(unittest.TestCase):
|
||||
|
||||
pr = make_payment_request(dt="Sales Invoice", dn=si_usd.name, recipient_id="saurabh@erpnext.com",
|
||||
mute_email=1, payment_gateway="_Test Gateway - USD", submit_doc=1, return_doc=1)
|
||||
|
||||
|
||||
pe = pr.set_as_paid()
|
||||
|
||||
|
||||
expected_gle = dict((d[0], d) for d in [
|
||||
["_Test Receivable USD - _TC", 0, 5000, si_usd.name],
|
||||
[pr.payment_account, 6290.0, 0, None],
|
||||
["_Test Exchange Gain/Loss - _TC", 0, 1290, None]
|
||||
])
|
||||
|
||||
|
||||
gl_entries = frappe.db.sql("""select account, debit, credit, against_voucher
|
||||
from `tabGL Entry` where voucher_type='Payment Entry' and voucher_no=%s
|
||||
order by account asc""", pe.name, as_dict=1)
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"allow_copy": 0,
|
||||
"allow_guest_to_view": 0,
|
||||
"allow_import": 0,
|
||||
"allow_rename": 0,
|
||||
"allow_import": 1,
|
||||
"allow_rename": 1,
|
||||
"autoname": "field:payment_term_name",
|
||||
"beta": 0,
|
||||
"creation": "2017-08-10 15:24:54.876365",
|
||||
@@ -265,7 +265,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2017-08-10 16:26:03.581501",
|
||||
"modified": "2018-01-24 11:13:42.800048",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Payment Term",
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"allow_copy": 0,
|
||||
"allow_guest_to_view": 0,
|
||||
"allow_import": 0,
|
||||
"allow_rename": 0,
|
||||
"allow_import": 1,
|
||||
"allow_rename": 1,
|
||||
"autoname": "field:template_name",
|
||||
"beta": 0,
|
||||
"creation": "2017-08-10 15:34:28.058054",
|
||||
@@ -85,7 +85,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2017-08-10 15:46:33.877884",
|
||||
"modified": "2018-01-24 11:13:31.158613",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Payment Terms Template",
|
||||
|
||||
@@ -254,6 +254,36 @@
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "allow_user_to_edit_discount",
|
||||
"fieldtype": "Check",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Allow user to edit Discount",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
@@ -1476,7 +1506,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2018-01-03 17:30:45.198147",
|
||||
"modified": "2018-01-31 19:33:11.765731",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "POS Profile",
|
||||
|
||||
@@ -32,7 +32,7 @@ class POSProfile(Document):
|
||||
.format(res[0][0], row.user), raise_exception=1)
|
||||
elif not row.default and not res:
|
||||
msgprint(_("User {0} doesn't have any default POS Profile. Check Default at Row {1} for this User.")
|
||||
.format(row.user, row.idx), raise_exception=1)
|
||||
.format(row.user, row.idx))
|
||||
|
||||
def validate_all_link_fields(self):
|
||||
accounts = {"Account": [self.income_account,
|
||||
|
||||
@@ -111,8 +111,8 @@ def apply_pricing_rule(args):
|
||||
|
||||
item_list = args.get("items")
|
||||
args.pop("items")
|
||||
|
||||
set_serial_nos_based_on_fifo = frappe.db.get_single_value("Stock Settings",
|
||||
|
||||
set_serial_nos_based_on_fifo = frappe.db.get_single_value("Stock Settings",
|
||||
"automatically_set_serial_nos_based_on_fifo")
|
||||
|
||||
for item in item_list:
|
||||
@@ -122,7 +122,7 @@ def apply_pricing_rule(args):
|
||||
if set_serial_nos_based_on_fifo and not args.get('is_return'):
|
||||
out.append(get_serial_no_for_item(args_copy))
|
||||
return out
|
||||
|
||||
|
||||
def get_serial_no_for_item(args):
|
||||
from erpnext.stock.get_item_details import get_serial_no
|
||||
|
||||
@@ -131,7 +131,7 @@ def get_serial_no_for_item(args):
|
||||
"name": args.name,
|
||||
"serial_no": args.serial_no
|
||||
})
|
||||
if args.get("parenttype") in ("Sales Invoice", "Delivery Note") and args.stock_qty > 0:
|
||||
if args.get("parenttype") in ("Sales Invoice", "Delivery Note") and flt(args.stock_qty) > 0:
|
||||
item_details.serial_no = get_serial_no(args)
|
||||
return item_details
|
||||
|
||||
@@ -143,7 +143,7 @@ def get_pricing_rule_for_item(args):
|
||||
"name": args.name,
|
||||
"pricing_rule": None
|
||||
})
|
||||
|
||||
|
||||
if args.ignore_pricing_rule or not args.item_code:
|
||||
if frappe.db.exists(args.doctype, args.name) and args.get("pricing_rule"):
|
||||
item_details = remove_pricing_rule_for_item(args.get("pricing_rule"), item_details)
|
||||
@@ -180,7 +180,7 @@ def get_pricing_rule_for_item(args):
|
||||
item_details.margin_rate_or_amount = pricing_rule.margin_rate_or_amount
|
||||
if pricing_rule.price_or_discount == "Price":
|
||||
item_details.update({
|
||||
"price_list_rate": (pricing_rule.price/flt(args.conversion_rate)) * args.conversion_factor or 1.0 \
|
||||
"price_list_rate": (pricing_rule.price/flt(args.conversion_rate)) * (args.conversion_factor or 1.0) \
|
||||
if args.conversion_rate else 0.0,
|
||||
"discount_percentage": 0.0
|
||||
})
|
||||
@@ -192,7 +192,7 @@ def get_pricing_rule_for_item(args):
|
||||
return item_details
|
||||
|
||||
def remove_pricing_rule_for_item(pricing_rule, item_details):
|
||||
pricing_rule = frappe.db.get_value('Pricing Rule', pricing_rule,
|
||||
pricing_rule = frappe.db.get_value('Pricing Rule', pricing_rule,
|
||||
['price_or_discount', 'margin_type'], as_dict=1)
|
||||
if pricing_rule and pricing_rule.price_or_discount == 'Discount Percentage':
|
||||
item_details.discount_percentage = 0.0
|
||||
@@ -209,14 +209,14 @@ def remove_pricing_rule_for_item(pricing_rule, item_details):
|
||||
def remove_pricing_rules(item_list):
|
||||
if isinstance(item_list, basestring):
|
||||
item_list = json.loads(item_list)
|
||||
|
||||
out = []
|
||||
|
||||
out = []
|
||||
for item in item_list:
|
||||
item = frappe._dict(item)
|
||||
out.append(remove_pricing_rule_for_item(item.get("pricing_rule"), item))
|
||||
|
||||
|
||||
return out
|
||||
|
||||
|
||||
def get_pricing_rules(args):
|
||||
def _get_tree_conditions(parenttype, allow_blank=True):
|
||||
field = frappe.scrub(parenttype)
|
||||
|
||||
@@ -8,6 +8,10 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({
|
||||
setup: function(doc) {
|
||||
this.setup_posting_date_time_check();
|
||||
this._super(doc);
|
||||
|
||||
// formatter for material request item
|
||||
this.frm.set_indicator_formatter('item_code',
|
||||
function(doc) { return (doc.qty<=doc.received_qty) ? "green" : "orange" })
|
||||
},
|
||||
onload: function() {
|
||||
this._super();
|
||||
@@ -17,13 +21,7 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({
|
||||
if(!this.frm.doc.supplier && this.frm.doc.credit_to) {
|
||||
this.frm.set_df_property("credit_to", "print_hide", 0);
|
||||
}
|
||||
} else {
|
||||
this.frm.set_value("disable_rounded_total", frappe.sys_defaults.disable_rounded_total);
|
||||
}
|
||||
|
||||
// formatter for material request item
|
||||
this.frm.set_indicator_formatter('item_code',
|
||||
function(doc) { return (doc.qty<=doc.received_qty) ? "green" : "orange" })
|
||||
},
|
||||
|
||||
refresh: function(doc) {
|
||||
|
||||
@@ -1239,7 +1239,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_bulk_edit": 1,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -3410,6 +3410,65 @@
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "group_same_items",
|
||||
"fieldtype": "Check",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Group same items",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "column_break_112",
|
||||
"fieldtype": "Column Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 1,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "select_print_heading",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
@@ -3914,7 +3973,7 @@
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": 0,
|
||||
"modified": "2017-12-20 17:49:51.230092",
|
||||
"modified": "2018-07-06 02:38:40.310899",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Purchase Invoice",
|
||||
|
||||
@@ -96,7 +96,7 @@ class PurchaseInvoice(BuyingController):
|
||||
if not self.credit_to:
|
||||
self.credit_to = get_party_account("Supplier", self.supplier, self.company)
|
||||
if not self.due_date:
|
||||
self.due_date = get_due_date(self.posting_date, "Supplier", self.supplier)
|
||||
self.due_date = get_due_date(self.posting_date, "Supplier", self.supplier, self.company)
|
||||
|
||||
super(PurchaseInvoice, self).set_missing_values(for_validate)
|
||||
|
||||
@@ -350,7 +350,6 @@ class PurchaseInvoice(BuyingController):
|
||||
self.negative_expense_to_be_booked = 0.0
|
||||
gl_entries = []
|
||||
|
||||
|
||||
self.make_supplier_gl_entry(gl_entries)
|
||||
self.make_item_gl_entries(gl_entries)
|
||||
self.make_tax_gl_entries(gl_entries)
|
||||
@@ -389,16 +388,20 @@ class PurchaseInvoice(BuyingController):
|
||||
expenses_included_in_valuation = self.get_company_default("expenses_included_in_valuation")
|
||||
warehouse_account = get_warehouse_account_map()
|
||||
|
||||
voucher_wise_stock_value = {}
|
||||
if self.update_stock:
|
||||
for d in frappe.get_all('Stock Ledger Entry',
|
||||
fields = ["voucher_detail_no", "stock_value_difference"], filters={'voucher_no': self.name}):
|
||||
voucher_wise_stock_value.setdefault(d.voucher_detail_no, d.stock_value_difference)
|
||||
|
||||
for item in self.get("items"):
|
||||
if flt(item.base_net_amount):
|
||||
account_currency = get_account_currency(item.expense_account)
|
||||
|
||||
if self.update_stock and self.auto_accounting_for_stock and item.item_code in stock_items:
|
||||
val_rate_db_precision = 6 if cint(item.precision("valuation_rate")) <= 6 else 9
|
||||
|
||||
# warehouse account
|
||||
warehouse_debit_amount = flt(flt(item.valuation_rate, val_rate_db_precision)
|
||||
* flt(item.qty) * flt(item.conversion_factor), item.precision("base_net_amount"))
|
||||
warehouse_debit_amount = self.make_stock_adjustment_entry(gl_entries,
|
||||
item, voucher_wise_stock_value, account_currency)
|
||||
|
||||
gl_entries.append(
|
||||
self.get_gl_dict({
|
||||
@@ -424,7 +427,10 @@ class PurchaseInvoice(BuyingController):
|
||||
|
||||
# sub-contracting warehouse
|
||||
if flt(item.rm_supp_cost):
|
||||
supplier_warehouse_account = warehouse_account[self.supplier_warehouse]["name"]
|
||||
supplier_warehouse_account = warehouse_account[self.supplier_warehouse]["account"]
|
||||
if not supplier_warehouse_account:
|
||||
frappe.throw(_("Please set account in Warehouse {0}")
|
||||
.format(self.supplier_warehouse))
|
||||
gl_entries.append(self.get_gl_dict({
|
||||
"account": supplier_warehouse_account,
|
||||
"against": item.expense_account,
|
||||
@@ -467,6 +473,36 @@ class PurchaseInvoice(BuyingController):
|
||||
self.negative_expense_to_be_booked += flt(item.item_tax_amount, \
|
||||
item.precision("item_tax_amount"))
|
||||
|
||||
def make_stock_adjustment_entry(self, gl_entries, item, voucher_wise_stock_value, account_currency):
|
||||
net_amt_precision = item.precision("base_net_amount")
|
||||
val_rate_db_precision = 6 if cint(item.precision("valuation_rate")) <= 6 else 9
|
||||
|
||||
warehouse_debit_amount = flt(flt(item.valuation_rate, val_rate_db_precision)
|
||||
* flt(item.qty) * flt(item.conversion_factor), net_amt_precision)
|
||||
|
||||
# Stock ledger value is not matching with the warehouse amount
|
||||
if (self.update_stock and voucher_wise_stock_value.get(item.name) and
|
||||
warehouse_debit_amount != flt(voucher_wise_stock_value.get(item.name), net_amt_precision)):
|
||||
|
||||
cost_of_goods_sold_account = self.get_company_default("default_expense_account")
|
||||
stock_amount = flt(voucher_wise_stock_value.get(item.name), net_amt_precision)
|
||||
stock_adjustment_amt = warehouse_debit_amount - stock_amount
|
||||
|
||||
gl_entries.append(
|
||||
self.get_gl_dict({
|
||||
"account": cost_of_goods_sold_account,
|
||||
"against": item.expense_account,
|
||||
"debit": stock_adjustment_amt,
|
||||
"remarks": self.get("remarks") or _("Stock Adjustment"),
|
||||
"cost_center": item.cost_center,
|
||||
"project": item.project
|
||||
}, account_currency)
|
||||
)
|
||||
|
||||
warehouse_debit_amount = stock_amount
|
||||
|
||||
return warehouse_debit_amount
|
||||
|
||||
def make_tax_gl_entries(self, gl_entries):
|
||||
# tax table gl entries
|
||||
valuation_tax = {}
|
||||
|
||||
@@ -585,6 +585,38 @@
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"depends_on": "discount_percentage",
|
||||
"fieldname": "discount_amount",
|
||||
"fieldtype": "Currency",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Discount Amount",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "currency",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
@@ -2156,7 +2188,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 1,
|
||||
"max_attachments": 0,
|
||||
"modified": "2017-11-30 14:21:00.962126",
|
||||
"modified": "2018-08-06 05:17:38.205356",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Purchase Invoice Item",
|
||||
|
||||
@@ -506,6 +506,7 @@ def save_invoice(doc, name, name_list):
|
||||
frappe.db.commit()
|
||||
name_list.append(name)
|
||||
except Exception:
|
||||
frappe.db.rollback()
|
||||
frappe.log_error(frappe.get_traceback())
|
||||
|
||||
return name_list
|
||||
|
||||
@@ -106,6 +106,10 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
|
||||
on_submit: function(doc, dt, dn) {
|
||||
var me = this;
|
||||
|
||||
if (frappe.get_route()[0] != 'Form') {
|
||||
return
|
||||
}
|
||||
|
||||
$.each(doc["items"], function(i, row) {
|
||||
if(row.delivery_note) frappe.model.clear_doc("Delivery Note", row.delivery_note)
|
||||
})
|
||||
@@ -315,6 +319,7 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
|
||||
},
|
||||
|
||||
pos_profile: function() {
|
||||
this.frm.doc.taxes = []
|
||||
this.set_pos_data();
|
||||
},
|
||||
|
||||
|
||||
@@ -639,6 +639,186 @@
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "column_break_21",
|
||||
"fieldtype": "Column Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"depends_on": "eval: doc.is_return && doc.return_against",
|
||||
"fieldname": "update_billed_amount_in_sales_order",
|
||||
"fieldtype": "Check",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Update Billed Amount in Sales Order",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 1,
|
||||
"collapsible_depends_on": "po_no",
|
||||
"columns": 0,
|
||||
"fieldname": "customer_po_details",
|
||||
"fieldtype": "Section Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Customer PO Details",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 1,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "po_no",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Customer's Purchase Order",
|
||||
"length": 0,
|
||||
"no_copy": 1,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "column_break_23",
|
||||
"fieldtype": "Column Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 1,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "po_date",
|
||||
"fieldtype": "Date",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Customer's Purchase Order Date",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
@@ -1339,7 +1519,7 @@
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_bulk_edit": 1,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -3622,12 +3802,12 @@
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"allow_on_submit": 1,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "language",
|
||||
"fieldtype": "Data",
|
||||
"fieldname": "group_same_items",
|
||||
"fieldtype": "Check",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
@@ -3635,14 +3815,14 @@
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Print Language",
|
||||
"label": "Group same items",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -3711,6 +3891,36 @@
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "language",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Print Language",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
@@ -4563,7 +4773,7 @@
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": 0,
|
||||
"modified": "2017-12-20 17:36:05.216046",
|
||||
"modified": "2018-07-17 13:46:52.449142",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Sales Invoice",
|
||||
@@ -4654,7 +4864,7 @@
|
||||
"quick_entry": 1,
|
||||
"read_only": 0,
|
||||
"read_only_onload": 1,
|
||||
"search_fields": "posting_date, due_date, customer, base_grand_total, outstanding_amount",
|
||||
"search_fields": "posting_date,due_date,customer,base_grand_total,outstanding_amount",
|
||||
"show_name_in_global_search": 1,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
|
||||
@@ -101,6 +101,8 @@ class SalesInvoice(SellingController):
|
||||
self.set_billing_hours_and_amount()
|
||||
self.update_timesheet_billing_for_project()
|
||||
self.set_status()
|
||||
if self.is_pos and not self.is_return:
|
||||
self.verify_payment_amount_is_positive()
|
||||
|
||||
def before_save(self):
|
||||
set_account_for_mode_of_payment(self)
|
||||
@@ -114,7 +116,7 @@ class SalesInvoice(SellingController):
|
||||
|
||||
self.check_prev_docstatus()
|
||||
|
||||
if self.is_return:
|
||||
if self.is_return and not self.update_billed_amount_in_sales_order:
|
||||
# NOTE status updating bypassed for is_return
|
||||
self.status_updater = []
|
||||
|
||||
@@ -142,7 +144,7 @@ class SalesInvoice(SellingController):
|
||||
|
||||
self.update_time_sheet(self.name)
|
||||
|
||||
self.update_current_month_sales()
|
||||
update_company_current_month_sales(self.company)
|
||||
self.update_project()
|
||||
|
||||
def validate_pos_paid_amount(self):
|
||||
@@ -159,7 +161,7 @@ class SalesInvoice(SellingController):
|
||||
if frappe.db.get_single_value('Accounts Settings', 'unlink_payment_on_cancellation_of_invoice'):
|
||||
unlink_ref_doc_from_payment_entries(self)
|
||||
|
||||
if self.is_return:
|
||||
if self.is_return and not self.update_billed_amount_in_sales_order:
|
||||
# NOTE status updating bypassed for is_return
|
||||
self.status_updater = []
|
||||
|
||||
@@ -181,16 +183,9 @@ class SalesInvoice(SellingController):
|
||||
self.make_gl_entries_on_cancel()
|
||||
frappe.db.set(self, 'status', 'Cancelled')
|
||||
|
||||
self.update_current_month_sales()
|
||||
update_company_current_month_sales(self.company)
|
||||
self.update_project()
|
||||
|
||||
def update_current_month_sales(self):
|
||||
if frappe.flags.in_test:
|
||||
update_company_current_month_sales(self.company)
|
||||
else:
|
||||
frappe.enqueue('erpnext.setup.doctype.company.company.update_company_current_month_sales',
|
||||
company=self.company)
|
||||
|
||||
def update_status_updater_args(self):
|
||||
if cint(self.update_stock):
|
||||
self.status_updater.extend([{
|
||||
@@ -231,12 +226,17 @@ class SalesInvoice(SellingController):
|
||||
from erpnext.selling.doctype.customer.customer import check_credit_limit
|
||||
|
||||
validate_against_credit_limit = False
|
||||
bypass_credit_limit_check_at_sales_order = cint(frappe.db.get_value("Customer", self.customer,
|
||||
"bypass_credit_limit_check_at_sales_order"))
|
||||
if bypass_credit_limit_check_at_sales_order:
|
||||
validate_against_credit_limit = True
|
||||
|
||||
for d in self.get("items"):
|
||||
if not (d.sales_order or d.delivery_note):
|
||||
validate_against_credit_limit = True
|
||||
break
|
||||
if validate_against_credit_limit:
|
||||
check_credit_limit(self.customer, self.company)
|
||||
check_credit_limit(self.customer, self.company, bypass_credit_limit_check_at_sales_order)
|
||||
|
||||
def set_missing_values(self, for_validate=False):
|
||||
pos = self.set_pos_fields(for_validate)
|
||||
@@ -244,12 +244,16 @@ class SalesInvoice(SellingController):
|
||||
if not self.debit_to:
|
||||
self.debit_to = get_party_account("Customer", self.customer, self.company)
|
||||
if not self.due_date and self.customer:
|
||||
self.due_date = get_due_date(self.posting_date, "Customer", self.customer)
|
||||
self.due_date = get_due_date(self.posting_date, "Customer", self.customer, self.company)
|
||||
|
||||
super(SalesInvoice, self).set_missing_values(for_validate)
|
||||
|
||||
if pos:
|
||||
return {"print_format": pos.get("print_format_for_online") }
|
||||
return {
|
||||
"print_format": pos.get("print_format_for_online"),
|
||||
"allow_edit_rate": pos.get("allow_user_to_edit_rate"),
|
||||
"allow_edit_discount": pos.get("allow_user_to_edit_discount")
|
||||
}
|
||||
|
||||
def update_time_sheet(self, sales_invoice):
|
||||
for d in self.timesheets:
|
||||
@@ -314,6 +318,7 @@ class SalesInvoice(SellingController):
|
||||
if not for_validate and not self.customer:
|
||||
self.customer = pos.customer
|
||||
|
||||
self.ignore_pricing_rule = pos.ignore_pricing_rule
|
||||
if pos.get('account_for_change_amount'):
|
||||
self.account_for_change_amount = pos.get('account_for_change_amount')
|
||||
|
||||
@@ -330,7 +335,7 @@ class SalesInvoice(SellingController):
|
||||
for item in self.get("items"):
|
||||
if item.get('item_code'):
|
||||
for fname, val in get_pos_profile_item_details(pos,
|
||||
frappe._dict(item.as_dict()), pos).items():
|
||||
frappe._dict(item.as_dict()), pos, True).items():
|
||||
|
||||
if (not for_validate) or (for_validate and not item.get(fname)):
|
||||
item.set(fname, val)
|
||||
@@ -675,28 +680,28 @@ class SalesInvoice(SellingController):
|
||||
# income account gl entries
|
||||
for item in self.get("items"):
|
||||
if flt(item.base_net_amount):
|
||||
account_currency = get_account_currency(item.income_account)
|
||||
gl_entries.append(
|
||||
self.get_gl_dict({
|
||||
"account": item.income_account,
|
||||
"against": self.customer,
|
||||
"credit": item.base_net_amount,
|
||||
"credit_in_account_currency": item.base_net_amount \
|
||||
if account_currency==self.company_currency else item.net_amount,
|
||||
"cost_center": item.cost_center
|
||||
}, account_currency)
|
||||
)
|
||||
|
||||
if item.is_fixed_asset:
|
||||
asset = frappe.get_doc("Asset", item.asset)
|
||||
|
||||
fixed_asset_gl_entries = get_gl_entries_on_asset_disposal(asset, is_sale=True)
|
||||
fixed_asset_gl_entries = get_gl_entries_on_asset_disposal(asset, item.base_net_amount)
|
||||
for gle in fixed_asset_gl_entries:
|
||||
gle["against"] = self.customer
|
||||
gl_entries.append(self.get_gl_dict(gle))
|
||||
|
||||
asset.db_set("disposal_date", self.posting_date)
|
||||
asset.set_status("Sold" if self.docstatus==1 else None)
|
||||
else:
|
||||
account_currency = get_account_currency(item.income_account)
|
||||
gl_entries.append(
|
||||
self.get_gl_dict({
|
||||
"account": item.income_account,
|
||||
"against": self.customer,
|
||||
"credit": item.base_net_amount,
|
||||
"credit_in_account_currency": item.base_net_amount \
|
||||
if account_currency==self.company_currency else item.net_amount,
|
||||
"cost_center": item.cost_center
|
||||
}, account_currency)
|
||||
)
|
||||
|
||||
# expense account gl entries
|
||||
if cint(self.update_stock) and \
|
||||
@@ -901,6 +906,11 @@ class SalesInvoice(SellingController):
|
||||
project.update_billed_amount()
|
||||
project.save()
|
||||
|
||||
def verify_payment_amount_is_positive(self):
|
||||
for entry in self.payments:
|
||||
if entry.amount < 0:
|
||||
frappe.throw(_("Row #{0} (Payment Table): Amount must be positive").format(entry.idx))
|
||||
|
||||
def get_list_context(context=None):
|
||||
from erpnext.controllers.website_list_for_contact import get_list_context
|
||||
list_context = get_list_context(context)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -227,6 +227,36 @@
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "clearance_date",
|
||||
"fieldtype": "Date",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Clearance Date",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
}
|
||||
],
|
||||
"has_web_view": 0,
|
||||
@@ -239,7 +269,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 1,
|
||||
"max_attachments": 0,
|
||||
"modified": "2017-07-24 17:25:03.765856",
|
||||
"modified": "2018-03-07 18:34:39.552769",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Sales Invoice Payment",
|
||||
|
||||
@@ -232,6 +232,8 @@ def get_next_date(dt, mcount, day=None):
|
||||
def send_notification(new_rv, subscription_doc, print_format='Standard'):
|
||||
"""Notify concerned persons about recurring document generation"""
|
||||
print_format = print_format
|
||||
subject = subscription_doc.subject or ''
|
||||
message = subscription_doc.message or ''
|
||||
|
||||
if not subscription_doc.subject:
|
||||
subject = _("New {0}: #{1}").format(new_rv.doctype, new_rv.name)
|
||||
|
||||
@@ -39,18 +39,20 @@ frappe.ui.form.on("Tax Rule", "customer", function(frm) {
|
||||
});
|
||||
|
||||
frappe.ui.form.on("Tax Rule", "supplier", function(frm) {
|
||||
frappe.call({
|
||||
method:"erpnext.accounts.doctype.tax_rule.tax_rule.get_party_details",
|
||||
args: {
|
||||
"party": frm.doc.supplier,
|
||||
"party_type": "supplier"
|
||||
},
|
||||
callback: function(r) {
|
||||
if(!r.exc) {
|
||||
$.each(r.message, function(k, v) {
|
||||
frm.set_value(k, v);
|
||||
});
|
||||
if(frm.doc.supplier) {
|
||||
frappe.call({
|
||||
method:"erpnext.accounts.doctype.tax_rule.tax_rule.get_party_details",
|
||||
args: {
|
||||
"party": frm.doc.supplier,
|
||||
"party_type": "supplier"
|
||||
},
|
||||
callback: function(r) {
|
||||
if(!r.exc) {
|
||||
$.each(r.message, function(k, v) {
|
||||
frm.set_value(k, v);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -130,8 +130,8 @@ def get_party_details(party, party_type, args=None):
|
||||
def get_tax_template(posting_date, args):
|
||||
"""Get matching tax rule"""
|
||||
args = frappe._dict(args)
|
||||
conditions = ["""(from_date is null or from_date = '' or from_date <= '{0}')
|
||||
and (to_date is null or to_date = '' or to_date >= '{0}')""".format(posting_date)]
|
||||
conditions = ["""(from_date is null or from_date <= '{0}')
|
||||
and (to_date is null or to_date >= '{0}')""".format(posting_date)]
|
||||
|
||||
for key, value in args.iteritems():
|
||||
if key=="use_for_shopping_cart":
|
||||
|
||||
@@ -191,8 +191,9 @@ def delete_gl_entries(gl_entries=None, voucher_type=None, voucher_no=None,
|
||||
for entry in gl_entries:
|
||||
validate_frozen_account(entry["account"], adv_adj)
|
||||
validate_balance_type(entry["account"], adv_adj)
|
||||
validate_expense_against_budget(entry)
|
||||
if not adv_adj:
|
||||
validate_expense_against_budget(entry)
|
||||
|
||||
if entry.get("against_voucher") and update_outstanding == 'Yes':
|
||||
if entry.get("against_voucher") and update_outstanding == 'Yes' and not adv_adj:
|
||||
update_outstanding_amt(entry["account"], entry.get("party_type"), entry.get("party"), entry.get("against_voucher_type"),
|
||||
entry.get("against_voucher"), on_cancel=True)
|
||||
|
||||
@@ -15,6 +15,7 @@ frappe.pages['pos'].on_page_load = function (wrapper) {
|
||||
cur_pos = wrapper.pos;
|
||||
} else {
|
||||
// online
|
||||
frappe.flags.is_online = true
|
||||
frappe.set_route('point-of-sale');
|
||||
}
|
||||
});
|
||||
@@ -24,6 +25,10 @@ frappe.pages['pos'].refresh = function (wrapper) {
|
||||
window.onbeforeunload = function () {
|
||||
return wrapper.pos.beforeunload()
|
||||
}
|
||||
|
||||
if (frappe.flags.is_online) {
|
||||
frappe.set_route('point-of-sale');
|
||||
}
|
||||
}
|
||||
|
||||
erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
||||
@@ -388,7 +393,8 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
||||
this.frm = {}
|
||||
this.frm.doc = this.doc
|
||||
this.set_transaction_defaults("Customer");
|
||||
this.frm.doc["allow_user_to_edit_rate"] = this.pos_profile_data["allow_user_to_edit_rate"] ? true : false,
|
||||
this.frm.doc["allow_user_to_edit_rate"] = this.pos_profile_data["allow_user_to_edit_rate"] ? true : false;
|
||||
this.frm.doc["allow_user_to_edit_discount"] = this.pos_profile_data["allow_user_to_edit_discount"] ? true : false;
|
||||
this.wrapper.html(frappe.render_template("pos", this.frm.doc));
|
||||
this.make_search();
|
||||
this.make_customer();
|
||||
@@ -1172,8 +1178,17 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
||||
$(this.wrapper).on("change", ".pos-item-disc", function () {
|
||||
var item_code = $(this).parents(".pos-selected-item-action").attr("data-item-code");
|
||||
var discount = $(this).val();
|
||||
me.update_discount(item_code, discount)
|
||||
me.update_value()
|
||||
if(discount > 100){
|
||||
discount = $(this).val('');
|
||||
frappe.show_alert({
|
||||
indicator: 'red',
|
||||
message: __('Discount amount cannot be greater than 100%')
|
||||
});
|
||||
me.update_discount(item_code, discount);
|
||||
}else{
|
||||
me.update_discount(item_code, discount);
|
||||
me.update_value();
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
@@ -1242,6 +1257,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
||||
$(this.wrapper).find('.selected-item').empty();
|
||||
if(this.child_doc.length) {
|
||||
this.child_doc[0]["allow_user_to_edit_rate"] = this.pos_profile_data["allow_user_to_edit_rate"] ? true : false,
|
||||
this.child_doc[0]["allow_user_to_edit_discount"] = this.pos_profile_data["allow_user_to_edit_discount"] ? true : false;
|
||||
this.selected_row = $(frappe.render_template("pos_selected_item", this.child_doc[0]))
|
||||
$(this.wrapper).find('.selected-item').html(this.selected_row)
|
||||
}
|
||||
@@ -1669,7 +1685,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
||||
setInterval(function () {
|
||||
me.freeze_screen = false;
|
||||
me.sync_sales_invoice()
|
||||
}, 60000)
|
||||
}, 180000)
|
||||
},
|
||||
|
||||
sync_sales_invoice: function () {
|
||||
@@ -2001,4 +2017,4 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
||||
frappe.throw(__("LocalStorage is full , did not save"))
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
@@ -4,12 +4,11 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
import datetime
|
||||
from frappe import _, msgprint, scrub
|
||||
from frappe.defaults import get_user_permissions
|
||||
from frappe.model.utils import get_fetch_values
|
||||
from frappe.utils import (add_days, getdate, formatdate, get_first_day, date_diff,
|
||||
add_years, get_timestamp, nowdate, flt, add_months, get_last_day)
|
||||
from frappe.utils import (add_days, getdate, formatdate, date_diff,
|
||||
add_years, get_timestamp, nowdate, flt, add_months, get_last_day)
|
||||
from frappe.contacts.doctype.address.address import (get_address_display,
|
||||
get_default_address, get_company_address)
|
||||
from frappe.contacts.doctype.contact.contact import get_contact_details, get_default_contact
|
||||
@@ -21,8 +20,8 @@ from erpnext import get_default_currency, get_company_currency
|
||||
class DuplicatePartyAccountError(frappe.ValidationError): pass
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_party_details(party=None, account=None, party_type="Customer", company=None,
|
||||
posting_date=None, price_list=None, currency=None, doctype=None, ignore_permissions=False):
|
||||
def get_party_details(party=None, account=None, party_type="Customer", company=None, posting_date=None,
|
||||
price_list=None, currency=None, doctype=None, ignore_permissions=False, fetch_payment_terms_template=True):
|
||||
|
||||
if not party:
|
||||
return {}
|
||||
@@ -31,10 +30,10 @@ def get_party_details(party=None, account=None, party_type="Customer", company=N
|
||||
frappe.throw(_("{0}: {1} does not exists").format(party_type, party))
|
||||
|
||||
return _get_party_details(party, account, party_type,
|
||||
company, posting_date, price_list, currency, doctype, ignore_permissions)
|
||||
company, posting_date, price_list, currency, doctype, ignore_permissions, fetch_payment_terms_template)
|
||||
|
||||
def _get_party_details(party=None, account=None, party_type="Customer", company=None,
|
||||
posting_date=None, price_list=None, currency=None, doctype=None, ignore_permissions=False):
|
||||
def _get_party_details(party=None, account=None, party_type="Customer", company=None, posting_date=None,
|
||||
price_list=None, currency=None, doctype=None, ignore_permissions=False, fetch_payment_terms_template=True):
|
||||
|
||||
out = frappe._dict(set_account_and_due_date(party, account, party_type, company, posting_date, doctype))
|
||||
|
||||
@@ -51,7 +50,9 @@ def _get_party_details(party=None, account=None, party_type="Customer", company=
|
||||
set_other_values(out, party, party_type)
|
||||
set_price_list(out, party, party_type, price_list)
|
||||
out["taxes_and_charges"] = set_taxes(party.name, party_type, posting_date, company, out.customer_group, out.supplier_type)
|
||||
out["payment_terms_template"] = get_pyt_term_template(party.name, party_type)
|
||||
|
||||
if fetch_payment_terms_template:
|
||||
out["payment_terms_template"] = get_pyt_term_template(party.name, party_type, company)
|
||||
|
||||
if not out.get("currency"):
|
||||
out["currency"] = currency
|
||||
@@ -164,7 +165,7 @@ def set_account_and_due_date(party, account, party_type, company, posting_date,
|
||||
out = {
|
||||
party_type.lower(): party,
|
||||
account_fieldname : account,
|
||||
"due_date": get_due_date(posting_date, party_type, party)
|
||||
"due_date": get_due_date(posting_date, party_type, party, company)
|
||||
}
|
||||
return out
|
||||
|
||||
@@ -267,12 +268,13 @@ def validate_party_accounts(doc):
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_due_date(posting_date, party_type, party):
|
||||
def get_due_date(posting_date, party_type, party, company=None):
|
||||
"""Get due date from `Payment Terms Template`"""
|
||||
due_date = None
|
||||
if posting_date and party:
|
||||
due_date = posting_date
|
||||
template_name = get_pyt_term_template(party, party_type)
|
||||
template_name = get_pyt_term_template(party, party_type, company)
|
||||
|
||||
if template_name:
|
||||
due_date = get_due_date_from_template(template_name, posting_date).strftime("%Y-%m-%d")
|
||||
else:
|
||||
@@ -305,12 +307,13 @@ def get_due_date_from_template(template_name, posting_date):
|
||||
|
||||
return due_date
|
||||
|
||||
|
||||
def validate_due_date(posting_date, due_date, party_type, party):
|
||||
def validate_due_date(posting_date, due_date, party_type, party, company=None, template_name=None):
|
||||
if getdate(due_date) < getdate(posting_date):
|
||||
frappe.throw(_("Due Date cannot be before Posting Date"))
|
||||
else:
|
||||
default_due_date = get_due_date(posting_date, party_type, party)
|
||||
if not template_name: return
|
||||
|
||||
default_due_date = get_due_date_from_template(template_name, posting_date).strftime("%Y-%m-%d")
|
||||
if not default_due_date:
|
||||
return
|
||||
|
||||
@@ -360,14 +363,32 @@ def set_taxes(party, party_type, posting_date, company, customer_group=None, sup
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_pyt_term_template(party_name, party_type):
|
||||
def get_pyt_term_template(party_name, party_type, company=None):
|
||||
if party_type not in ("Customer", "Supplier"):
|
||||
return
|
||||
|
||||
template = None
|
||||
if party_type in ('Customer', 'Supplier'):
|
||||
template = frappe.db.get_value(party_type, party_name, fieldname='payment_terms')
|
||||
if party_type == 'Customer':
|
||||
customer = frappe.db.get_value("Customer", party_name,
|
||||
fieldname=['payment_terms', "customer_group"], as_dict=1)
|
||||
template = customer.payment_terms
|
||||
|
||||
if not template and customer.customer_group:
|
||||
template = frappe.db.get_value("Customer Group",
|
||||
customer.customer_group, fieldname='payment_terms')
|
||||
else:
|
||||
supplier = frappe.db.get_value("Supplier", party_name,
|
||||
fieldname=['payment_terms', "supplier_type"], as_dict=1)
|
||||
template = supplier.payment_terms
|
||||
|
||||
if not template and supplier.supplier_type:
|
||||
template = frappe.db.get_value("Supplier Type", supplier.supplier_type, fieldname='payment_terms')
|
||||
|
||||
if not template and company:
|
||||
template = frappe.db.get_value("Company", company, fieldname='payment_terms')
|
||||
|
||||
return template
|
||||
|
||||
|
||||
def validate_party_frozen_disabled(party_type, party_name):
|
||||
if party_type and party_name:
|
||||
if party_type in ("Customer", "Supplier"):
|
||||
@@ -388,10 +409,21 @@ def get_timeline_data(doctype, name):
|
||||
from frappe.desk.form.load import get_communication_data
|
||||
|
||||
out = {}
|
||||
fields = 'date(creation), count(name)'
|
||||
after = add_years(None, -1).strftime('%Y-%m-%d')
|
||||
group_by='group by date(creation)'
|
||||
|
||||
data = get_communication_data(doctype, name,
|
||||
fields = 'date(creation), count(name)',
|
||||
after = add_years(None, -1).strftime('%Y-%m-%d'),
|
||||
group_by='group by date(creation)', as_dict=False)
|
||||
fields=fields, after=after, group_by=group_by, as_dict=False)
|
||||
|
||||
# fetch and append data from Activity Log
|
||||
data += frappe.db.sql("""select {fields}
|
||||
from `tabActivity Log`
|
||||
where reference_doctype="{doctype}" and reference_name="{name}"
|
||||
and status!='Success' and creation > {after}
|
||||
{group_by} order by creation desc
|
||||
""".format(doctype=frappe.db.escape(doctype), name=frappe.db.escape(name), fields=fields,
|
||||
group_by=group_by, after=after), as_dict=False)
|
||||
|
||||
timeline_items = dict(data)
|
||||
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
"docstatus": 0,
|
||||
"doctype": "Print Format",
|
||||
"font": "Default",
|
||||
"html": "<style>\n\t.print-format table, .print-format tr, \n\t.print-format td, .print-format div, .print-format p {\n\t\tfont-family: Monospace;\n\t\tline-height: 200%;\n\t\tvertical-align: middle;\n\t}\n\t@media screen {\n\t\t.print-format {\n\t\t\twidth: 4in;\n\t\t\tpadding: 0.25in;\n\t\t\tmin-height: 8in;\n\t\t}\n\t}\n</style>\n\n<p class=\"text-center\">\n\t{{ doc.company }}<br>\n\t{% if doc.company_address_display %}\n\t\t{% set company_address = doc.company_address_display.replace(\"\\n\", \" \").replace(\"<br>\", \" \") %}\n\t\t{% if \"GSTIN\" not in company_address %}\n\t\t\t{{ company_address }}\n\t\t\t<b>{{ _(\"GSTIN\") }}:</b>{{ doc.company_gstin }}\n\t\t{% else %}\n\t\t\t{{ company_address.replace(\"GSTIN\", \"<br>GSTIN\") }}\n\t\t{% endif %}\n\t{% endif %}\n\t<br>\n\t<b>{{ doc.select_print_heading or _(\"Invoice\") }}</b><br>\n</p>\n<p>\n\t<b>{{ _(\"Receipt No\") }}:</b> {{ doc.name }}<br>\n\t<b>{{ _(\"Date\") }}:</b> {{ doc.get_formatted(\"posting_date\") }}<br>\n\t{% if doc.grand_total > 50000 %}\n\t\t{% set customer_address = doc.address_display.replace(\"\\n\", \" \").replace(\"<br>\", \" \") %}\n\t\t<b>{{ _(\"Customer\") }}:</b><br>\n\t\t{{ doc.customer_name }}<br>\n\t\t{{ customer_address }}\n\t{% endif %}\n</p>\n\n<hr>\n<table class=\"table table-condensed cart no-border\">\n\t<thead>\n\t\t<tr>\n\t\t\t<th width=\"40%\">{{ _(\"Item\") }}</b></th>\n\t\t\t<th width=\"30%\" class=\"text-right\">{{ _(\"Qty\") }}</th>\n\t\t\t<th width=\"30%\" class=\"text-right\">{{ _(\"Amount\") }}</th>\n\t\t</tr>\n\t</thead>\n\t<tbody>\n\t\t{%- for item in doc.items -%}\n\t\t<tr>\n\t\t\t<td>\n\t\t\t\t{{ item.item_code }}\n\t\t\t\t{%- if item.item_name != item.item_code -%}\n\t\t\t\t\t<br>{{ item.item_name }}\n\t\t\t\t{%- endif -%}\n\t\t\t\t{%- if item.gst_hsn_code -%}\n\t\t\t\t\t<br><b>{{ _(\"HSN/SAC\") }}:</b> {{ item.gst_hsn_code }}\n\t\t\t\t{%- endif -%}\n\t\t\t\t{%- if item.serial_no -%}\n\t\t\t\t\t<br><b>{{ _(\"Serial No\") }}:</b> {{ item.serial_no }}\n\t\t\t\t{%- endif -%}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">{{ item.qty }}<br>@ {{ item.rate }}</td>\n\t\t\t<td class=\"text-right\">{{ item.get_formatted(\"amount\") }}</td>\n\t\t</tr>\n\t\t{%- endfor -%}\n\t</tbody>\n</table>\n<table class=\"table table-condensed no-border\">\n\t<tbody>\n\t\t<tr>\n\t\t\t{% if doc.flags.show_inclusive_tax_in_print %}\n\t\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t\t{{ _(\"Total Excl. Tax\") }}\n\t\t\t\t</td>\n\t\t\t\t<td class=\"text-right\">\n\t\t\t\t\t{{ doc.get_formatted(\"net_total\", doc) }}\n\t\t\t\t</td>\n\t\t\t{% else %}\n\t\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t\t{{ _(\"Total\") }}\n\t\t\t\t</td>\n\t\t\t\t<td class=\"text-right\">\n\t\t\t\t\t{{ doc.get_formatted(\"total\", doc) }}\n\t\t\t\t</td>\n\t\t\t{% endif %}\n\t\t</tr>\n\t\t{%- for row in doc.taxes -%}\n\t\t {%- if not row.included_in_print_rate or doc.flags.show_inclusive_tax_in_print -%}\n\t\t\t<tr>\n\t\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t\t{{ row.description }}\n\t\t\t\t</td>\n\t\t\t\t<td class=\"text-right\">\n\t\t\t\t\t{{ row.get_formatted(\"tax_amount\", doc) }}\n\t\t\t\t</td>\n\t\t\t<tr>\n\t\t {%- endif -%}\n\t\t{%- endfor -%}\n\t\t{%- if doc.discount_amount -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t{{ _(\"Discount\") }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"discount_amount\") }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{%- endif -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t<b>{{ _(\"Grand Total\") }}</b>\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"grand_total\") }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{%- if doc.rounded_total -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t<b>{{ _(\"Rounded Total\") }}</b>\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"rounded_total\") }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{%- endif -%}\n\t</tbody>\n</table>\n<p><b>Tax Breakup:</b></p>\n<div style=\"font-size: 8px\">\n\t{{ doc.other_charges_calculation }}\n</div>\n<p>{{ doc.terms or \"\" }}</p>\n<p class=\"text-center\">{{ _(\"Thank you, please visit again.\") }}</p>",
|
||||
"html": "<style>\n\t.print-format table, .print-format tr, \n\t.print-format td, .print-format div, .print-format p {\n\t\tfont-family: Monospace;\n\t\tline-height: 200%;\n\t\tvertical-align: middle;\n\t}\n\t@media screen {\n\t\t.print-format {\n\t\t\twidth: 4in;\n\t\t\tpadding: 0.25in;\n\t\t\tmin-height: 8in;\n\t\t}\n\t}\n</style>\n\n<p class=\"text-center\">\n\t{{ doc.company }}<br>\n\t{% if doc.company_address_display %}\n\t\t{% set company_address = doc.company_address_display.replace(\"\\n\", \" \").replace(\"<br>\", \" \") %}\n\t\t{% if \"GSTIN\" not in company_address %}\n\t\t\t{{ company_address }}\n\t\t\t<b>{{ _(\"GSTIN\") }}:</b>{{ doc.company_gstin }}\n\t\t{% else %}\n\t\t\t{{ company_address.replace(\"GSTIN\", \"<br>GSTIN\") }}\n\t\t{% endif %}\n\t{% endif %}\n\t<br>\n\t<b>{{ doc.select_print_heading or _(\"Invoice\") }}</b><br>\n</p>\n<p>\n\t<b>{{ _(\"Receipt No\") }}:</b> {{ doc.name }}<br>\n\t<b>{{ _(\"Date\") }}:</b> {{ doc.get_formatted(\"posting_date\") }}<br>\n\t{% if doc.grand_total > 50000 %}\n\t\t{% set customer_address = doc.address_display.replace(\"\\n\", \" \").replace(\"<br>\", \" \") %}\n\t\t<b>{{ _(\"Customer\") }}:</b><br>\n\t\t{{ doc.customer_name }}<br>\n\t\t{{ customer_address }}\n\t{% endif %}\n</p>\n\n<hr>\n<table class=\"table table-condensed cart no-border\">\n\t<thead>\n\t\t<tr>\n\t\t\t<th width=\"40%\">{{ _(\"Item\") }}</b></th>\n\t\t\t<th width=\"30%\" class=\"text-right\">{{ _(\"Qty\") }}</th>\n\t\t\t<th width=\"30%\" class=\"text-right\">{{ _(\"Amount\") }}</th>\n\t\t</tr>\n\t</thead>\n\t<tbody>\n\t\t{%- for item in doc.items -%}\n\t\t<tr>\n\t\t\t<td>\n\t\t\t\t{{ item.item_code }}\n\t\t\t\t{%- if item.item_name != item.item_code -%}\n\t\t\t\t\t<br>{{ item.item_name }}\n\t\t\t\t{%- endif -%}\n\t\t\t\t{%- if item.gst_hsn_code -%}\n\t\t\t\t\t<br><b>{{ _(\"HSN/SAC\") }}:</b> {{ item.gst_hsn_code }}\n\t\t\t\t{%- endif -%}\n\t\t\t\t{%- if item.serial_no -%}\n\t\t\t\t\t<br><b>{{ _(\"Serial No\") }}:</b> {{ item.serial_no }}\n\t\t\t\t{%- endif -%}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">{{ item.qty }}<br>@ {{ item.rate }}</td>\n\t\t\t<td class=\"text-right\">{{ item.get_formatted(\"amount\") }}</td>\n\t\t</tr>\n\t\t{%- endfor -%}\n\t</tbody>\n</table>\n<table class=\"table table-condensed no-border\">\n\t<tbody>\n\t\t<tr>\n\t\t\t{% if doc.flags.show_inclusive_tax_in_print %}\n\t\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t\t{{ _(\"Total Excl. Tax\") }}\n\t\t\t\t</td>\n\t\t\t\t<td class=\"text-right\">\n\t\t\t\t\t{{ doc.get_formatted(\"net_total\", doc) }}\n\t\t\t\t</td>\n\t\t\t{% else %}\n\t\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t\t{{ _(\"Total\") }}\n\t\t\t\t</td>\n\t\t\t\t<td class=\"text-right\">\n\t\t\t\t\t{{ doc.get_formatted(\"total\", doc) }}\n\t\t\t\t</td>\n\t\t\t{% endif %}\n\t\t</tr>\n\t\t{%- for row in doc.taxes -%}\n\t\t {%- if not row.included_in_print_rate or doc.flags.show_inclusive_tax_in_print -%}\n\t\t\t<tr>\n\t\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t\t{{ row.description }}\n\t\t\t\t</td>\n\t\t\t\t<td class=\"text-right\">\n\t\t\t\t\t{{ row.get_formatted(\"tax_amount\", doc) }}\n\t\t\t\t</td>\n\t\t\t<tr>\n\t\t {%- endif -%}\n\t\t{%- endfor -%}\n\t\t{%- if doc.discount_amount -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t{{ _(\"Discount\") }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"discount_amount\") }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{%- endif -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t<b>{{ _(\"Grand Total\") }}</b>\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"grand_total\") }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{%- if doc.rounded_total -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t<b>{{ _(\"Rounded Total\") }}</b>\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"rounded_total\") }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{%- endif -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t<b>{{ _(\"Paid Amount\") }}</b>\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"paid_amount\") }}\n\t\t\t</td>\n\t\t</tr>\n\t{%- if doc.change_amount -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t<b>{{ _(\"Change Amount\") }}</b>\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"change_amount\") }}\n\t\t\t</td>\n\t\t</tr>\n\t{%- endif -%}\n\t</tbody>\n</table>\n<p><b>Tax Breakup:</b></p>\n<div style=\"font-size: 8px\">\n\t{{ doc.other_charges_calculation }}\n</div>\n<p>{{ doc.terms or \"\" }}</p>\n<p class=\"text-center\">{{ _(\"Thank you, please visit again.\") }}</p>",
|
||||
"idx": 0,
|
||||
"line_breaks": 0,
|
||||
"modified": "2018-01-12 11:19:17.432600",
|
||||
"modified": "2018-03-20 14:24:08.167930",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "GST POS Invoice",
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
"doc_type": "Sales Invoice",
|
||||
"docstatus": 0,
|
||||
"doctype": "Print Format",
|
||||
"html": "<style>\n\t.print-format table, .print-format tr, \n\t.print-format td, .print-format div, .print-format p {\n\t\tfont-family: Monospace;\n\t\tline-height: 200%;\n\t\tvertical-align: middle;\n\t}\n\t@media screen {\n\t\t.print-format {\n\t\t\twidth: 4in;\n\t\t\tpadding: 0.25in;\n\t\t\tmin-height: 8in;\n\t\t}\n\t}\n</style>\n\n<p class=\"text-center\">\n\t{{ doc.company }}<br>\n\t{{ doc.select_print_heading or _(\"Invoice\") }}<br>\n</p>\n<p>\n\t<b>{{ _(\"Receipt No\") }}:</b> {{ doc.name }}<br>\n\t<b>{{ _(\"Date\") }}:</b> {{ doc.get_formatted(\"posting_date\") }}<br>\n\t<b>{{ _(\"Customer\") }}:</b> {{ doc.customer_name }}\n</p>\n\n<hr>\n<table class=\"table table-condensed cart no-border\">\n\t<thead>\n\t\t<tr>\n\t\t\t<th width=\"50%\">{{ _(\"Item\") }}</b></th>\n\t\t\t<th width=\"25%\" class=\"text-right\">{{ _(\"Qty\") }}</th>\n\t\t\t<th width=\"25%\" class=\"text-right\">{{ _(\"Amount\") }}</th>\n\t\t</tr>\n\t</thead>\n\t<tbody>\n\t\t{%- for item in doc.items -%}\n\t\t<tr>\n\t\t\t<td>\n\t\t\t\t{{ item.item_code }}\n\t\t\t\t{%- if item.item_name != item.item_code -%}\n\t\t\t\t\t<br>{{ item.item_name }}{%- endif -%}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">{{ item.qty }}<br>@ {{ item.get_formatted(\"rate\") }}</td>\n\t\t\t<td class=\"text-right\">{{ item.get_formatted(\"amount\") }}</td>\n\t\t</tr>\n\t\t{%- endfor -%}\n\t</tbody>\n</table>\n<table class=\"table table-condensed no-border\">\n\t<tbody>\n\t\t<tr>\n\t\t\t{% if doc.flags.show_inclusive_tax_in_print %}\n\t\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t\t{{ _(\"Total Excl. Tax\") }}\n\t\t\t\t</td>\n\t\t\t\t<td class=\"text-right\">\n\t\t\t\t\t{{ doc.get_formatted(\"net_total\", doc) }}\n\t\t\t\t</td>\n\t\t\t{% else %}\n\t\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t\t{{ _(\"Total\") }}\n\t\t\t\t</td>\n\t\t\t\t<td class=\"text-right\">\n\t\t\t\t\t{{ doc.get_formatted(\"total\", doc) }}\n\t\t\t\t</td>\n\t\t\t{% endif %}\n\t\t</tr>\n\t\t{%- for row in doc.taxes -%}\n\t\t {%- if not row.included_in_print_rate or doc.flags.show_inclusive_tax_in_print -%}\n\t\t\t<tr>\n\t\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t\t{{ row.description }}\n\t\t\t\t</td>\n\t\t\t\t<td class=\"text-right\">\n\t\t\t\t\t{{ row.get_formatted(\"tax_amount\", doc) }}\n\t\t\t\t</td>\n\t\t\t<tr>\n\t\t {%- endif -%}\n\t\t{%- endfor -%}\n\n\t\t{%- if doc.discount_amount -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t{{ _(\"Discount\") }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"discount_amount\") }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{%- endif -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t<b>{{ _(\"Grand Total\") }}</b>\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"grand_total\") }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{%- if doc.rounded_total -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t<b>{{ _(\"Rounded Total\") }}</b>\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"rounded_total\") }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{%- endif -%}\n\t</tbody>\n</table>\n<hr>\n<p>{{ doc.terms or \"\" }}</p>\n<p class=\"text-center\">{{ _(\"Thank you, please visit again.\") }}</p>",
|
||||
"html": "<style>\n\t.print-format table, .print-format tr, \n\t.print-format td, .print-format div, .print-format p {\n\t\tfont-family: Monospace;\n\t\tline-height: 200%;\n\t\tvertical-align: middle;\n\t}\n\t@media screen {\n\t\t.print-format {\n\t\t\twidth: 4in;\n\t\t\tpadding: 0.25in;\n\t\t\tmin-height: 8in;\n\t\t}\n\t}\n</style>\n\n<p class=\"text-center\">\n\t{{ doc.company }}<br>\n\t{{ doc.select_print_heading or _(\"Invoice\") }}<br>\n</p>\n<p>\n\t<b>{{ _(\"Receipt No\") }}:</b> {{ doc.name }}<br>\n\t<b>{{ _(\"Date\") }}:</b> {{ doc.get_formatted(\"posting_date\") }}<br>\n\t<b>{{ _(\"Customer\") }}:</b> {{ doc.customer_name }}\n</p>\n\n<hr>\n<table class=\"table table-condensed cart no-border\">\n\t<thead>\n\t\t<tr>\n\t\t\t<th width=\"50%\">{{ _(\"Item\") }}</b></th>\n\t\t\t<th width=\"25%\" class=\"text-right\">{{ _(\"Qty\") }}</th>\n\t\t\t<th width=\"25%\" class=\"text-right\">{{ _(\"Amount\") }}</th>\n\t\t</tr>\n\t</thead>\n\t<tbody>\n\t\t{%- for item in doc.items -%}\n\t\t<tr>\n\t\t\t<td>\n\t\t\t\t{{ item.item_code }}\n\t\t\t\t{%- if item.item_name != item.item_code -%}\n\t\t\t\t\t<br>{{ item.item_name }}{%- endif -%}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">{{ item.qty }}<br>@ {{ item.get_formatted(\"rate\") }}</td>\n\t\t\t<td class=\"text-right\">{{ item.get_formatted(\"amount\") }}</td>\n\t\t</tr>\n\t\t{%- endfor -%}\n\t</tbody>\n</table>\n<table class=\"table table-condensed no-border\">\n\t<tbody>\n\t\t<tr>\n\t\t\t{% if doc.flags.show_inclusive_tax_in_print %}\n\t\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t\t{{ _(\"Total Excl. Tax\") }}\n\t\t\t\t</td>\n\t\t\t\t<td class=\"text-right\">\n\t\t\t\t\t{{ doc.get_formatted(\"net_total\", doc) }}\n\t\t\t\t</td>\n\t\t\t{% else %}\n\t\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t\t{{ _(\"Total\") }}\n\t\t\t\t</td>\n\t\t\t\t<td class=\"text-right\">\n\t\t\t\t\t{{ doc.get_formatted(\"total\", doc) }}\n\t\t\t\t</td>\n\t\t\t{% endif %}\n\t\t</tr>\n\t\t{%- for row in doc.taxes -%}\n\t\t {%- if not row.included_in_print_rate or doc.flags.show_inclusive_tax_in_print -%}\n\t\t\t<tr>\n\t\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t\t{{ row.description }}\n\t\t\t\t</td>\n\t\t\t\t<td class=\"text-right\">\n\t\t\t\t\t{{ row.get_formatted(\"tax_amount\", doc) }}\n\t\t\t\t</td>\n\t\t\t<tr>\n\t\t {%- endif -%}\n\t\t{%- endfor -%}\n\n\t\t{%- if doc.discount_amount -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t{{ _(\"Discount\") }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"discount_amount\") }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{%- endif -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t<b>{{ _(\"Grand Total\") }}</b>\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"grand_total\") }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{%- if doc.rounded_total -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t<b>{{ _(\"Rounded Total\") }}</b>\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"rounded_total\") }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{%- endif -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t<b>{{ _(\"Paid Amount\") }}</b>\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"paid_amount\") }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{%- if doc.change_amount -%}\n\t\t\t<tr>\n\t\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t\t<b>{{ _(\"Change Amount\") }}</b>\n\t\t\t\t</td>\n\t\t\t\t<td class=\"text-right\">\n\t\t\t\t\t{{ doc.get_formatted(\"change_amount\") }}\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t{%- endif -%}\n\t</tbody>\n</table>\n<hr>\n<p>{{ doc.terms or \"\" }}</p>\n<p class=\"text-center\">{{ _(\"Thank you, please visit again.\") }}</p>",
|
||||
"idx": 1,
|
||||
"line_breaks": 0,
|
||||
"modified": "2018-01-12 11:18:54.229254",
|
||||
"modified": "2018-03-20 14:24:12.394354",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "POS Invoice",
|
||||
|
||||
@@ -14,7 +14,13 @@ frappe.query_reports["Accounts Payable"] = {
|
||||
"fieldname":"supplier",
|
||||
"label": __("Supplier"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Supplier"
|
||||
"options": "Supplier",
|
||||
on_change: () => {
|
||||
var supplier = frappe.query_report_filters_by_name.supplier.get_value();
|
||||
frappe.db.get_value('Supplier', supplier, "tax_id", function(value) {
|
||||
frappe.query_report_filters_by_name.tax_id.set_value(value["tax_id"]);
|
||||
});
|
||||
}
|
||||
},
|
||||
{
|
||||
"fieldname":"report_date",
|
||||
@@ -26,7 +32,7 @@ frappe.query_reports["Accounts Payable"] = {
|
||||
"fieldname":"ageing_based_on",
|
||||
"label": __("Ageing Based On"),
|
||||
"fieldtype": "Select",
|
||||
"options": 'Posting Date\nDue Date',
|
||||
"options": 'Posting Date\nDue Date\nSupplier Invoice Date',
|
||||
"default": "Posting Date"
|
||||
},
|
||||
{
|
||||
@@ -52,6 +58,12 @@ frappe.query_reports["Accounts Payable"] = {
|
||||
"fieldtype": "Int",
|
||||
"default": "90",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname":"tax_id",
|
||||
"label": __("Tax Id"),
|
||||
"fieldtype": "Data",
|
||||
"hidden": 1
|
||||
}
|
||||
],
|
||||
onload: function(report) {
|
||||
|
||||
@@ -1,22 +1,129 @@
|
||||
{% if(filters.show_pdc_in_print) { %}
|
||||
<style>
|
||||
@media screen {
|
||||
.print-format {
|
||||
padding: 4mm;
|
||||
font-size: 8.0pt !important;
|
||||
font-family: Tahoma, sans-serif;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
{% } %}
|
||||
<style>
|
||||
.print-format {
|
||||
padding: 4mm;
|
||||
font-size: 8.0pt !important;
|
||||
font-family: Tahoma, sans-serif;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
<h2 class="text-center">{%= __(report.report_name) %}</h2>
|
||||
<h4 class="text-center">{%= filters.customer || filters.supplier %} </h4>
|
||||
<h4 class="text-center">
|
||||
{% if (filters.customer_name) { %}
|
||||
{%= filters.customer_name %}
|
||||
{% } else { %}
|
||||
{%= filters.customer || filters.supplier %}
|
||||
{% } %}
|
||||
</h4>
|
||||
<h6 class="text-center">
|
||||
{% if (filters.tax_id) { %}
|
||||
{%= __("Tax Id: ")%} {%= filters.tax_id %}
|
||||
{% } %}
|
||||
</h6>
|
||||
<h5 class="text-center">
|
||||
{%= __(filters.ageing_based_on) %}
|
||||
{%= __("Until") %}
|
||||
{%= dateutil.str_to_user(filters.report_date) %}
|
||||
</h5>
|
||||
<hr>
|
||||
{% if(filters.show_pdc_in_print) { %}
|
||||
{% var balance_row = data.slice(-1).pop();
|
||||
var range1 = report.columns[11].label;
|
||||
var range2 = report.columns[12].label;
|
||||
var range3 = report.columns[13].label;
|
||||
var range4 = report.columns[14].label;
|
||||
%}
|
||||
{% if(balance_row) { %}
|
||||
<table class="table table-bordered table-condensed">
|
||||
<caption class="text-right">(Amount in {%= data[0][__("currency")] || "" %})</caption>
|
||||
<colgroup>
|
||||
<col style="width: 30mm;">
|
||||
<col style="width: 18mm;">
|
||||
<col style="width: 18mm;">
|
||||
<col style="width: 18mm;">
|
||||
<col style="width: 18mm;">
|
||||
<col style="width: 18mm;">
|
||||
<col style="width: 18mm;">
|
||||
</colgroup>
|
||||
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{%= __(" ") %}</th>
|
||||
<th>{%= __(range1) %}</th>
|
||||
<th>{%= __(range2) %}</th>
|
||||
<th>{%= __(range3) %}</th>
|
||||
<th>{%= __(range4) %}</th>
|
||||
<th>{%= __("Total") %}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>{%= __("Total Outstanding") %}</td>
|
||||
<td class="text-right">{%= format_currency(balance_row[range1]) %}</td>
|
||||
<td class="text-right">{%= format_currency(balance_row[range2]) %}</td>
|
||||
<td class="text-right">{%= format_currency(balance_row[range3]) %}</td>
|
||||
<td class="text-right">{%= format_currency(balance_row[range4]) %}</td>
|
||||
<td class="text-right">
|
||||
{%= format_currency(flt(balance_row[__("Outstanding Amount")]), data[data.length-1]["currency"]) %}
|
||||
</td>
|
||||
</tr>
|
||||
<td>{%= __("PDC/LC") %}</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td class="text-right">
|
||||
{%= format_currency(flt(balance_row[__("PDC/LC Amount")]), data[data.length-1]["currency"]) %}
|
||||
</td>
|
||||
<tr class="cvs-footer">
|
||||
<th class="text-left">{%= __("Cheques Required") %}</th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th class="text-right">
|
||||
{%= format_currency(flt(balance_row[__("Outstanding Amount")]-balance_row[__("PDC/LC Amount")]), data[data.length-1]["currency"]) %}</th>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
{% } %}
|
||||
{% } %}
|
||||
<table class="table table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
{% if(report.report_name === "Accounts Receivable" || report.report_name === "Accounts Payable") { %}
|
||||
<th style="width: 14%">{%= __("Date") %}</th>
|
||||
<th style="width: 16%">{%= __("Ref") %}</th>
|
||||
<th style="width: 30%">{%= (filters.customer || filters.supplier) ? __("Remarks"): __("Party") %}</th>
|
||||
<th style="width: 18%">{%= __("Date") %}</th>
|
||||
<th style="width: 17%">{%= __("Reference") %}</th>
|
||||
{% if(!filters.show_pdc_in_print) { %}
|
||||
<th style="width: 20%">{%= (filters.customer || filters.supplier) ? __("Remarks"): __("Party") %}</th>
|
||||
{% } %}
|
||||
<th style="width: 10%">{%= __("Invoiced Amount") %}</th>
|
||||
<th style="width: 10%">{%= __("Paid Amount") %}</th>
|
||||
<th style="width: 10%">{%= report.report_name === "Accounts Receivable" ? __('Credit Note') : __('Debit Note') %}</th>
|
||||
<th style="width: 10%">{%= __("Outstanding Amount") %}</th>
|
||||
{% if(!filters.show_pdc_in_print) { %}
|
||||
<th style="width: 10%">{%= __("Paid Amount") %}</th>
|
||||
<th style="width: 10%">{%= report.report_name === "Accounts Receivable" ? __('Credit Note') : __('Debit Note') %}</th>
|
||||
{% } %}
|
||||
<th style="width: 15%">{%= __("Outstanding Amount") %}</th>
|
||||
{% if(filters.show_pdc_in_print) { %}
|
||||
{% if(report.report_name === "Accounts Receivable") { %}
|
||||
<th style="width: 10%">{%= __("Customer LPO No.") %}</th>
|
||||
{% } %}
|
||||
<th style="width: 10%">{%= __("PDC/LC Date") %}</th>
|
||||
<th style="width: 10%">{%= __("PDC/LC Ref") %}</th>
|
||||
<th style="width: 10%">{%= __("PDC/LC Amount") %}</th>
|
||||
<th style="width: 10%">{%= __("Remaining Balance") %}</th>
|
||||
{% } %}
|
||||
{% } else { %}
|
||||
<th style="width: 40%">{%= (filters.customer || filters.supplier) ? __("Remarks"): __("Party") %}</th>
|
||||
<th style="width: 15%">{%= __("Total Invoiced Amount") %}</th>
|
||||
@@ -31,9 +138,15 @@
|
||||
<tr>
|
||||
{% if(report.report_name === "Accounts Receivable" || report.report_name === "Accounts Payable") { %}
|
||||
{% if(data[i][__("Customer")] || data[i][__("Supplier")]) { %}
|
||||
<td>{%= dateutil.str_to_user(data[i][__("Posting Date")]) %}</td>
|
||||
<td>{%= data[i][__("Voucher Type")] %}
|
||||
<br>{%= data[i][__("Voucher No")] %}</td>
|
||||
<td>{%= dateutil.str_to_user(data[i]["posting_date"]) %}</td>
|
||||
<td>
|
||||
{% if(!filters.show_pdc_in_print) { %}
|
||||
{%= data[i]["voucher_type"] %}
|
||||
<br>
|
||||
{% } %}
|
||||
{%= data[i]["voucher_no"] %}
|
||||
</td>
|
||||
{% if(!filters.show_pdc_in_print) { %}
|
||||
<td>
|
||||
{% if(!(filters.customer || filters.supplier)) { %}
|
||||
{%= data[i][__("Customer")] || data[i][__("Supplier")] %}
|
||||
@@ -46,25 +159,56 @@
|
||||
<br>{%= __("Remarks") %}:
|
||||
{%= data[i][__("Remarks")] %}
|
||||
</td>
|
||||
{% } %}
|
||||
<td style="text-align: right">
|
||||
{%= format_currency(data[i]["Invoiced Amount"], data[i]["currency"]) %}</td>
|
||||
<td style="text-align: right">
|
||||
{%= format_currency(data[i]["Paid Amount"], data[i]["currency"]) %}</td>
|
||||
<td style="text-align: right">
|
||||
{%= report.report_name === "Accounts Receivable" ? format_currency(data[i]["Credit Note"], data[i]["currency"]) : format_currency(data[i]["Debit Note"], data[i]["currency"]) %}</td>
|
||||
|
||||
{% if(!filters.show_pdc_in_print) { %}
|
||||
<td style="text-align: right">
|
||||
{%= format_currency(data[i]["Paid Amount"], data[i]["currency"]) %}</td>
|
||||
<td style="text-align: right">
|
||||
{%= report.report_name === "Accounts Receivable" ? format_currency(data[i]["Credit Note"], data[i]["currency"]) : format_currency(data[i]["Debit Note"], data[i]["currency"]) %}</td>
|
||||
{% } %}
|
||||
<td style="text-align: right">
|
||||
{%= format_currency(data[i]["Outstanding Amount"], data[i]["currency"]) %}</td>
|
||||
|
||||
{% if(filters.show_pdc_in_print) { %}
|
||||
{% if(report.report_name === "Accounts Receivable") { %}
|
||||
<td style="text-align: right">
|
||||
{%= data[i][__("Customer LPO")] %}</td>
|
||||
{% } %}
|
||||
<td style="text-align: right">{%= frappe.datetime.str_to_user(data[i][__("PDC/LC Date")]) %}</td>
|
||||
<td style="text-align: right">{%= data[i][__("PDC/LC Ref")] %}</td>
|
||||
<td style="text-align: right">{%= format_currency(data[i][__("PDC/LC Amount")], data[i]["currency"]) %}</td>
|
||||
<td style="text-align: right">{%= format_currency(data[i][__("Remaining Balance")], data[i]["currency"]) %}</td>
|
||||
{% } %}
|
||||
{% } else { %}
|
||||
<td></td>
|
||||
{% if(!filters.show_pdc_in_print) { %}
|
||||
<td></td>
|
||||
{% } %}
|
||||
<td><b>{%= __("Total") %}</b></td>
|
||||
<td style="text-align: right">
|
||||
{%= format_currency(data[i]["Invoiced Amount"], data[i]["currency"] ) %}</td>
|
||||
<td style="text-align: right">
|
||||
{%= format_currency(data[i]["Paid Amount"], data[i]["currency"]) %}</td>
|
||||
<td style="text-align: right">{%= report.report_name === "Accounts Receivable" ? format_currency(data[i]["Credit Note"], data[i]["currency"]) : format_currency(data[i]["Debit Note"], data[i]["currency"]) %} </td>
|
||||
|
||||
{% if(!filters.show_pdc_in_print) { %}
|
||||
<td style="text-align: right">
|
||||
{%= format_currency(data[i]["Paid Amount"], data[i]["currency"]) %}</td>
|
||||
<td style="text-align: right">{%= report.report_name === "Accounts Receivable" ? format_currency(data[i]["Credit Note"], data[i]["currency"]) : format_currency(data[i]["Debit Note"], data[i]["currency"]) %} </td>
|
||||
{% } %}
|
||||
<td style="text-align: right">
|
||||
{%= format_currency(data[i]["Outstanding Amount"], data[i]["currency"]) %}</td>
|
||||
|
||||
{% if(filters.show_pdc_in_print) { %}
|
||||
{% if(report.report_name === "Accounts Receivable") { %}
|
||||
<td style="text-align: right">
|
||||
{%= data[i][__("Customer LPO")] %}</td>
|
||||
{% } %}
|
||||
<td style="text-align: right">{%= frappe.datetime.str_to_user(data[i][__("PDC/LC Date")]) %}</td>
|
||||
<td style="text-align: right">{%= data[i][__("PDC/LC Ref")] %}</td>
|
||||
<td style="text-align: right">{%= format_currency(data[i][__("PDC/LC Amount")], data[i]["currency"]) %}</td>
|
||||
<td style="text-align: right">{%= format_currency(data[i][__("Remaining Balance")], data[i]["currency"]) %}</td>
|
||||
{% } %}
|
||||
{% } %}
|
||||
{% } else { %}
|
||||
{% if(data[i][__("Customer")] || data[i][__("Supplier")]|| " ") { %}
|
||||
@@ -94,4 +238,4 @@
|
||||
{% } %}
|
||||
</tbody>
|
||||
</table>
|
||||
<p class="text-right text-muted">{{ __("Printed On") }}{%= dateutil.str_to_user(dateutil.get_datetime_as_string()) %}</p>
|
||||
<p class="text-right text-muted">{{ __("Printed On ") }}{%= dateutil.str_to_user(dateutil.get_datetime_as_string()) %}</p>
|
||||
@@ -14,7 +14,14 @@ frappe.query_reports["Accounts Receivable"] = {
|
||||
"fieldname":"customer",
|
||||
"label": __("Customer"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Customer"
|
||||
"options": "Customer",
|
||||
on_change: () => {
|
||||
var customer = frappe.query_report_filters_by_name.customer.get_value();
|
||||
frappe.db.get_value('Customer', customer, ["tax_id", "customer_name"], function(value) {
|
||||
frappe.query_report_filters_by_name.tax_id.set_value(value["tax_id"]);
|
||||
frappe.query_report_filters_by_name.customer_name.set_value(value["customer_name"]);
|
||||
});
|
||||
}
|
||||
},
|
||||
{
|
||||
"fieldname":"customer_group",
|
||||
@@ -64,6 +71,23 @@ frappe.query_reports["Accounts Receivable"] = {
|
||||
"fieldtype": "Int",
|
||||
"default": "90",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname":"show_pdc_in_print",
|
||||
"label": __("Show PDC in Print"),
|
||||
"fieldtype": "Check",
|
||||
},
|
||||
{
|
||||
"fieldname":"tax_id",
|
||||
"label": __("Tax Id"),
|
||||
"fieldtype": "Data",
|
||||
"hidden": 1
|
||||
},
|
||||
{
|
||||
"fieldname":"customer_name",
|
||||
"label": __("Customer Name"),
|
||||
"fieldtype": "Data",
|
||||
"hidden": 1
|
||||
}
|
||||
],
|
||||
|
||||
|
||||
@@ -22,13 +22,35 @@ class ReceivablePayableReport(object):
|
||||
return columns, data, None, chart
|
||||
|
||||
def get_columns(self, party_naming_by, args):
|
||||
columns = [_("Posting Date") + ":Date:80", _(args.get("party_type")) + ":Link/" + args.get("party_type") + ":200"]
|
||||
columns = []
|
||||
columns.append({
|
||||
"label": _("Posting Date"),
|
||||
"fieldtype": "Date",
|
||||
"fieldname": "posting_date",
|
||||
"width": 90
|
||||
})
|
||||
|
||||
columns += [_(args.get("party_type")) + ":Link/" + args.get("party_type") + ":200"]
|
||||
|
||||
if party_naming_by == "Naming Series":
|
||||
columns += [args.get("party_type") + " Name::110"]
|
||||
|
||||
columns += [_("Voucher Type") + "::110", _("Voucher No") + ":Dynamic Link/"+_("Voucher Type")+":120",
|
||||
_("Due Date") + ":Date:80"]
|
||||
columns.append({
|
||||
"label": _("Voucher Type"),
|
||||
"fieldtype": "Data",
|
||||
"fieldname": "voucher_type",
|
||||
"width": 110
|
||||
})
|
||||
|
||||
columns.append({
|
||||
"label": _("Voucher No"),
|
||||
"fieldtype": "Dynamic Link",
|
||||
"fieldname": "voucher_no",
|
||||
"width": 110,
|
||||
"options": "voucher_type",
|
||||
})
|
||||
|
||||
columns += [_("Due Date") + ":Date:80"]
|
||||
|
||||
if args.get("party_type") == "Supplier":
|
||||
columns += [_("Bill No") + "::80", _("Bill Date") + ":Date:80"]
|
||||
@@ -72,6 +94,18 @@ class ReceivablePayableReport(object):
|
||||
"options": "Currency",
|
||||
"width": 100
|
||||
})
|
||||
|
||||
columns += [
|
||||
_("PDC/LC Date") + ":Date:110",
|
||||
_("PDC/LC Ref") + ":Data:110",
|
||||
_("PDC/LC Amount") + ":Currency/currency:130",
|
||||
_("Remaining Balance") + ":Currency/currency:130"
|
||||
]
|
||||
|
||||
if args.get('party_type') == 'Customer':
|
||||
columns += [_("Customer LPO") + ":Data:100"]
|
||||
columns += [_("Delivery Note") + ":Data:100"]
|
||||
|
||||
if args.get("party_type") == "Customer":
|
||||
columns += [
|
||||
_("Territory") + ":Link/Territory:80",
|
||||
@@ -89,8 +123,6 @@ class ReceivablePayableReport(object):
|
||||
currency_precision = get_currency_precision() or 2
|
||||
dr_or_cr = "debit" if args.get("party_type") == "Customer" else "credit"
|
||||
|
||||
voucher_details = self.get_voucher_details(args.get("party_type"))
|
||||
|
||||
future_vouchers = self.get_entries_after(self.filters.report_date, args.get("party_type"))
|
||||
|
||||
if not self.filters.get("company"):
|
||||
@@ -101,7 +133,16 @@ class ReceivablePayableReport(object):
|
||||
return_entries = self.get_return_entries(args.get("party_type"))
|
||||
|
||||
data = []
|
||||
for gle in self.get_entries_till(self.filters.report_date, args.get("party_type")):
|
||||
pdc_details = get_pdc_details(args.get("party_type"), self.filters.report_date)
|
||||
|
||||
gl_entries_data = self.get_entries_till(self.filters.report_date, args.get("party_type"))
|
||||
|
||||
if gl_entries_data:
|
||||
voucher_nos = [d.voucher_no for d in gl_entries_data] or []
|
||||
dn_details = get_dn_details(args.get("party_type"), voucher_nos)
|
||||
voucher_details = get_voucher_details(args.get("party_type"), voucher_nos, dn_details)
|
||||
|
||||
for gle in gl_entries_data:
|
||||
if self.is_receivable_or_payable(gle, dr_or_cr, future_vouchers):
|
||||
outstanding_amount, credit_note_amount = self.get_outstanding_amount(gle,
|
||||
self.filters.report_date, dr_or_cr, return_entries, currency_precision)
|
||||
@@ -114,6 +155,7 @@ class ReceivablePayableReport(object):
|
||||
|
||||
# get due date
|
||||
due_date = voucher_details.get(gle.voucher_no, {}).get("due_date", "")
|
||||
bill_date = voucher_details.get(gle.voucher_no, {}).get("bill_date", "")
|
||||
|
||||
row += [gle.voucher_type, gle.voucher_no, due_date]
|
||||
|
||||
@@ -130,20 +172,43 @@ class ReceivablePayableReport(object):
|
||||
row += [invoiced_amount, paid_amt, credit_note_amount, outstanding_amount]
|
||||
|
||||
# ageing data
|
||||
entry_date = due_date if self.filters.ageing_based_on == "Due Date" else gle.posting_date
|
||||
if self.filters.ageing_based_on == "Due Date":
|
||||
entry_date = due_date
|
||||
elif self.filters.ageing_based_on == "Supplier Invoice Date":
|
||||
entry_date = bill_date
|
||||
else:
|
||||
entry_date = gle.posting_date
|
||||
row += get_ageing_data(cint(self.filters.range1), cint(self.filters.range2),
|
||||
cint(self.filters.range3), self.age_as_on, entry_date, outstanding_amount)
|
||||
|
||||
|
||||
# issue 6371-Ageing buckets should not have amounts if due date is not reached
|
||||
if self.filters.ageing_based_on == "Due Date" \
|
||||
and getdate(due_date) > getdate(self.filters.report_date):
|
||||
row[-1]=row[-2]=row[-3]=row[-4]=0
|
||||
|
||||
if self.filters.ageing_based_on == "Supplier Invoice Date" \
|
||||
and getdate(bill_date) > getdate(self.filters.report_date):
|
||||
row[-1]=row[-2]=row[-3]=row[-4]=0
|
||||
|
||||
if self.filters.get(scrub(args.get("party_type"))):
|
||||
row.append(gle.account_currency)
|
||||
else:
|
||||
row.append(company_currency)
|
||||
|
||||
pdc = pdc_details.get((gle.voucher_no, gle.party), {})
|
||||
|
||||
remaining_balance = outstanding_amount - flt(pdc.get("pdc_amount"))
|
||||
row += [pdc.get("pdc_date"), pdc.get("pdc_ref"),
|
||||
flt(pdc.get("pdc_amount")), remaining_balance]
|
||||
|
||||
if args.get('party_type') == 'Customer':
|
||||
# customer LPO
|
||||
row += [voucher_details.get(gle.voucher_no, {}).get("po_no")]
|
||||
|
||||
# Delivery Note
|
||||
row += [voucher_details.get(gle.voucher_no, {}).get("delivery_note")]
|
||||
|
||||
# customer territory / supplier type
|
||||
if args.get("party_type") == "Customer":
|
||||
row += [self.get_territory(gle.party), self.get_customer_group(gle.party)]
|
||||
@@ -157,12 +222,11 @@ class ReceivablePayableReport(object):
|
||||
|
||||
def get_entries_after(self, report_date, party_type):
|
||||
# returns a distinct list
|
||||
return list(set([(e.voucher_type, e.voucher_no) for e in self.get_gl_entries(party_type)
|
||||
if getdate(e.posting_date) > report_date]))
|
||||
return list(set([(e.voucher_type, e.voucher_no) for e in self.get_gl_entries(party_type, report_date, for_future=True)]))
|
||||
|
||||
def get_entries_till(self, report_date, party_type):
|
||||
# returns a generator
|
||||
return (e for e in self.get_gl_entries(party_type) if getdate(e.posting_date) <= report_date)
|
||||
return self.get_gl_entries(party_type, report_date)
|
||||
|
||||
def is_receivable_or_payable(self, gle, dr_or_cr, future_vouchers):
|
||||
return (
|
||||
@@ -189,14 +253,16 @@ class ReceivablePayableReport(object):
|
||||
|
||||
for e in self.get_gl_entries_for(gle.party, gle.party_type, gle.voucher_type, gle.voucher_no):
|
||||
if getdate(e.posting_date) <= report_date and e.name!=gle.name:
|
||||
amount = flt(e.get(reverse_dr_or_cr)) - flt(e.get(dr_or_cr))
|
||||
amount = flt(e.get(reverse_dr_or_cr), currency_precision) - flt(e.get(dr_or_cr), currency_precision)
|
||||
if e.voucher_no not in return_entries:
|
||||
payment_amount += amount
|
||||
else:
|
||||
credit_note_amount += amount
|
||||
|
||||
outstanding_amount = flt((flt(gle.get(dr_or_cr)) - flt(gle.get(reverse_dr_or_cr)) \
|
||||
- payment_amount - credit_note_amount), currency_precision)
|
||||
outstanding_amount = (flt((flt(gle.get(dr_or_cr), currency_precision)
|
||||
- flt(gle.get(reverse_dr_or_cr), currency_precision)
|
||||
- payment_amount - credit_note_amount), currency_precision))
|
||||
|
||||
credit_note_amount = flt(credit_note_amount, currency_precision)
|
||||
|
||||
return outstanding_amount, credit_note_amount
|
||||
@@ -225,38 +291,31 @@ class ReceivablePayableReport(object):
|
||||
|
||||
return self.party_map
|
||||
|
||||
def get_voucher_details(self, party_type):
|
||||
voucher_details = frappe._dict()
|
||||
def get_gl_entries(self, party_type, date=None, for_future=False):
|
||||
conditions, values = self.prepare_conditions(party_type)
|
||||
|
||||
if party_type == "Customer":
|
||||
for si in frappe.db.sql("""select name, due_date
|
||||
from `tabSales Invoice` where docstatus=1""", as_dict=1):
|
||||
voucher_details.setdefault(si.name, si)
|
||||
if self.filters.get(scrub(party_type)):
|
||||
select_fields = "sum(debit_in_account_currency) as debit, sum(credit_in_account_currency) as credit"
|
||||
else:
|
||||
select_fields = "sum(debit) as debit, sum(credit) as credit"
|
||||
|
||||
if party_type == "Supplier":
|
||||
for pi in frappe.db.sql("""select name, due_date, bill_no, bill_date
|
||||
from `tabPurchase Invoice` where docstatus=1""", as_dict=1):
|
||||
voucher_details.setdefault(pi.name, pi)
|
||||
if date and not for_future:
|
||||
conditions += " and posting_date <= '%s'" % date
|
||||
|
||||
return voucher_details
|
||||
if date and for_future:
|
||||
conditions += " and posting_date > '%s'" % date
|
||||
|
||||
def get_gl_entries(self, party_type):
|
||||
if not hasattr(self, "gl_entries"):
|
||||
conditions, values = self.prepare_conditions(party_type)
|
||||
|
||||
if self.filters.get(scrub(party_type)):
|
||||
select_fields = "sum(debit_in_account_currency) as debit, sum(credit_in_account_currency) as credit"
|
||||
else:
|
||||
select_fields = "sum(debit) as debit, sum(credit) as credit"
|
||||
|
||||
self.gl_entries = frappe.db.sql("""select name, posting_date, account, party_type, party,
|
||||
voucher_type, voucher_no, against_voucher_type, against_voucher,
|
||||
account_currency, remarks, {0}
|
||||
from `tabGL Entry`
|
||||
where docstatus < 2 and party_type=%s and (party is not null and party != '') {1}
|
||||
self.gl_entries = frappe.db.sql("""
|
||||
select
|
||||
name, posting_date, account, party_type, party, voucher_type, voucher_no,
|
||||
against_voucher_type, against_voucher, account_currency, remarks, {0}
|
||||
from
|
||||
`tabGL Entry`
|
||||
where
|
||||
docstatus < 2 and party_type=%s and (party is not null and party != '') {1}
|
||||
group by voucher_type, voucher_no, against_voucher_type, against_voucher, party
|
||||
order by posting_date, party"""
|
||||
.format(select_fields, conditions), values, as_dict=True)
|
||||
.format(select_fields, conditions), values, as_dict=True)
|
||||
|
||||
return self.gl_entries
|
||||
|
||||
@@ -347,3 +406,102 @@ def get_ageing_data(first_range, second_range, third_range, age_as_on, entry_dat
|
||||
outstanding_range[index] = outstanding_amount
|
||||
|
||||
return [age] + outstanding_range
|
||||
|
||||
def get_pdc_details(party_type, report_date):
|
||||
pdc_details = frappe._dict()
|
||||
|
||||
for pdc in frappe.db.sql("""
|
||||
select
|
||||
pref.reference_name as invoice_no, pent.party, pent.party_type,
|
||||
max(pent.reference_date) as pdc_date, sum(ifnull(pref.allocated_amount,0)) as pdc_amount,
|
||||
GROUP_CONCAT(pent.reference_no SEPARATOR ', ') as pdc_ref
|
||||
from
|
||||
`tabPayment Entry` as pent inner join `tabPayment Entry Reference` as pref
|
||||
on
|
||||
(pref.parent = pent.name)
|
||||
where
|
||||
pent.docstatus < 2 and pent.reference_date >= %s
|
||||
and pent.party_type = %s
|
||||
group by pent.party, pref.reference_name""", (report_date, party_type), as_dict=1):
|
||||
pdc_details.setdefault((pdc.invoice_no, pdc.party), pdc)
|
||||
|
||||
if scrub(party_type):
|
||||
amount_field = ("jea.debit_in_account_currency"
|
||||
if party_type == 'Supplier' else "jea.credit_in_account_currency")
|
||||
else:
|
||||
amount_field = "jea.debit + jea.credit"
|
||||
|
||||
for pdc in frappe.db.sql("""
|
||||
select
|
||||
jea.reference_name as invoice_no, jea.party, jea.party_type,
|
||||
max(je.cheque_date) as pdc_date, sum(ifnull({0},0)) as pdc_amount,
|
||||
GROUP_CONCAT(je.cheque_no SEPARATOR ', ') as pdc_ref
|
||||
from
|
||||
`tabJournal Entry` as je inner join `tabJournal Entry Account` as jea
|
||||
on
|
||||
(jea.parent = je.name)
|
||||
where
|
||||
je.docstatus < 2 and je.cheque_date >= %s
|
||||
and jea.party_type = %s
|
||||
group by jea.party, jea.reference_name""".format(amount_field), (report_date, party_type), as_dict=1):
|
||||
if (pdc.invoice_no, pdc.party) in pdc_details:
|
||||
pdc_details[(pdc.invoice_no, pdc.party)]["pdc_amount"] += pdc.pdc_amount
|
||||
else:
|
||||
pdc_details.setdefault((pdc.invoice_no, pdc.party), pdc)
|
||||
|
||||
return pdc_details
|
||||
|
||||
def get_dn_details(party_type, voucher_nos):
|
||||
dn_details = frappe._dict()
|
||||
|
||||
if party_type == "Customer":
|
||||
for si in frappe.db.sql("""
|
||||
select
|
||||
parent, GROUP_CONCAT(delivery_note SEPARATOR ', ') as dn
|
||||
from
|
||||
`tabSales Invoice Item`
|
||||
where
|
||||
docstatus=1 and delivery_note is not null and delivery_note != ''
|
||||
and parent in (%s) group by parent
|
||||
""" %(','.join(['%s'] * len(voucher_nos))), tuple(voucher_nos) , as_dict=1):
|
||||
dn_details.setdefault(si.parent, si.dn)
|
||||
|
||||
for si in frappe.db.sql("""
|
||||
select
|
||||
against_sales_invoice as parent, GROUP_CONCAT(parent SEPARATOR ', ') as dn
|
||||
from
|
||||
`tabDelivery Note Item`
|
||||
where
|
||||
docstatus=1 and against_sales_invoice is not null and against_sales_invoice != ''
|
||||
and against_sales_invoice in (%s)
|
||||
group by against_sales_invoice
|
||||
""" %(','.join(['%s'] * len(voucher_nos))), tuple(voucher_nos) , as_dict=1):
|
||||
if si.parent in dn_details:
|
||||
dn_details[si.parent] += ', %s' %(si.dn)
|
||||
else:
|
||||
dn_details.setdefault(si.parent, si.dn)
|
||||
|
||||
return dn_details
|
||||
|
||||
def get_voucher_details(party_type, voucher_nos, dn_details):
|
||||
voucher_details = frappe._dict()
|
||||
|
||||
if party_type == "Customer":
|
||||
for si in frappe.db.sql("""select name, due_date, po_no
|
||||
from `tabSales Invoice` where docstatus=1 and name in (%s)
|
||||
""" %(','.join(['%s'] *len(voucher_nos))), (tuple(voucher_nos)), as_dict=1):
|
||||
si['delivery_note'] = dn_details.get(si.name)
|
||||
voucher_details.setdefault(si.name, si)
|
||||
|
||||
if party_type == "Supplier":
|
||||
for pi in frappe.db.sql("""select name, due_date, bill_no, bill_date
|
||||
from `tabPurchase Invoice` where docstatus = 1 and name in (%s)
|
||||
""" %(','.join(['%s'] *len(voucher_nos))), (tuple(voucher_nos)), as_dict=1):
|
||||
voucher_details.setdefault(pi.name, pi)
|
||||
|
||||
for pi in frappe.db.sql("""select name, due_date, bill_no, bill_date from
|
||||
`tabJournal Entry` where docstatus = 1 and bill_no is not NULL and name in (%s)
|
||||
""" %(','.join(['%s'] *len(voucher_nos))), (tuple(voucher_nos)), as_dict=1):
|
||||
voucher_details.setdefault(pi.name, pi)
|
||||
|
||||
return voucher_details
|
||||
|
||||
@@ -23,10 +23,10 @@ frappe.query_reports["Accounts Receivable Summary"] = {
|
||||
"options": "Customer Group"
|
||||
},
|
||||
{
|
||||
"fieldname":"credit_days_based_on",
|
||||
"label": __("Credit Days Based On"),
|
||||
"fieldtype": "Select",
|
||||
"options": "\nFixed Days\nLast Day of the Next Month"
|
||||
"fieldname":"payment_terms_template",
|
||||
"label": __("Payment Terms Template"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Payment Terms Template"
|
||||
},
|
||||
{
|
||||
"fieldtype": "Break",
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe import _
|
||||
from frappe.utils import flt
|
||||
from erpnext.accounts.report.accounts_receivable.accounts_receivable import ReceivablePayableReport
|
||||
|
||||
class AccountsReceivableSummary(ReceivablePayableReport):
|
||||
@@ -88,7 +89,8 @@ class AccountsReceivableSummary(ReceivablePayableReport):
|
||||
})
|
||||
)
|
||||
for k in party_total[d.party].keys():
|
||||
party_total[d.party][k] += d.get(k, 0)
|
||||
if k != "currency":
|
||||
party_total[d.party][k] += flt(d.get(k, 0))
|
||||
|
||||
party_total[d.party].currency = d.currency
|
||||
|
||||
|
||||
@@ -3,47 +3,75 @@
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe.utils import flt
|
||||
from frappe import _
|
||||
|
||||
def execute(filters=None):
|
||||
columns, data = get_columns(), get_data(filters)
|
||||
return columns, data
|
||||
|
||||
|
||||
def get_data(filters):
|
||||
data = frappe.db.sql("""
|
||||
select
|
||||
a.name as asset, a.asset_category, a.status,
|
||||
a.depreciation_method, a.purchase_date, a.gross_purchase_amount,
|
||||
ds.schedule_date as depreciation_date, ds.depreciation_amount,
|
||||
ds.accumulated_depreciation_amount,
|
||||
(a.gross_purchase_amount - ds.accumulated_depreciation_amount) as amount_after_depreciation,
|
||||
ds.journal_entry as depreciation_entry
|
||||
from
|
||||
`tabAsset` a, `tabDepreciation Schedule` ds
|
||||
where
|
||||
a.name = ds.parent
|
||||
and a.docstatus=1
|
||||
and ifnull(ds.journal_entry, '') != ''
|
||||
and ds.schedule_date between %(from_date)s and %(to_date)s
|
||||
and a.company = %(company)s
|
||||
{conditions}
|
||||
order by
|
||||
a.name asc, ds.schedule_date asc
|
||||
""".format(conditions=get_filter_conditions(filters)), filters, as_dict=1)
|
||||
|
||||
return data
|
||||
|
||||
def get_filter_conditions(filters):
|
||||
conditions = ""
|
||||
|
||||
data = []
|
||||
depreciation_accounts = frappe.db.sql_list(""" select name from tabAccount
|
||||
where ifnull(account_type, '') = 'Depreciation' """)
|
||||
|
||||
filters_data = [["company", "=", filters.get('company')],
|
||||
["posting_date", ">=", filters.get('from_date')],
|
||||
["posting_date", "<=", filters.get('to_date')],
|
||||
["against_voucher_type", "=", "Asset"],
|
||||
["account", "in", depreciation_accounts]]
|
||||
|
||||
if filters.get("asset"):
|
||||
conditions += " and a.name = %(asset)s"
|
||||
|
||||
filters_data.append(["against_voucher", "=", filters.get("asset")])
|
||||
|
||||
if filters.get("asset_category"):
|
||||
conditions += " and a.asset_category = %(asset_category)s"
|
||||
|
||||
return conditions
|
||||
assets = frappe.db.sql_list("""select name from tabAsset
|
||||
where asset_category = %s and docstatus=1""", filters.get("asset_category"))
|
||||
|
||||
filters_data.append(["against_voucher", "in", assets])
|
||||
|
||||
gl_entries = frappe.get_all('GL Entry',
|
||||
filters= filters_data,
|
||||
fields = ["against_voucher", "debit_in_account_currency as debit", "voucher_no", "posting_date"],
|
||||
order_by= "against_voucher, posting_date")
|
||||
|
||||
if not gl_entries:
|
||||
return data
|
||||
|
||||
assets = [d.against_voucher for d in gl_entries]
|
||||
assets_details = get_assets_details(assets)
|
||||
|
||||
for d in gl_entries:
|
||||
asset_data = assets_details.get(d.against_voucher)
|
||||
if not asset_data.get("accumulated_depreciation_amount"):
|
||||
asset_data.accumulated_depreciation_amount = d.debit
|
||||
else:
|
||||
asset_data.accumulated_depreciation_amount += d.debit
|
||||
|
||||
row = frappe._dict(asset_data)
|
||||
row.update({
|
||||
"depreciation_amount": d.debit,
|
||||
"depreciation_date": d.posting_date,
|
||||
"amount_after_depreciation": (flt(row.gross_purchase_amount) -
|
||||
flt(row.accumulated_depreciation_amount)),
|
||||
"depreciation_entry": d.voucher_no
|
||||
})
|
||||
|
||||
data.append(row)
|
||||
|
||||
return data
|
||||
|
||||
def get_assets_details(assets):
|
||||
assets_details = {}
|
||||
|
||||
fields = ["name as asset", "gross_purchase_amount",
|
||||
"asset_category", "status", "depreciation_method", "purchase_date"]
|
||||
|
||||
for d in frappe.get_all("Asset", fields = fields, filters = {'name': ('in', assets)}):
|
||||
assets_details.setdefault(d.asset, d)
|
||||
|
||||
return assets_details
|
||||
|
||||
def get_columns():
|
||||
return [
|
||||
{
|
||||
|
||||
@@ -28,5 +28,10 @@ frappe.query_reports["Bank Reconciliation Statement"] = {
|
||||
"default": frappe.datetime.get_today(),
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname":"include_pos_transactions",
|
||||
"label": __("Include POS Transactions"),
|
||||
"fieldtype": "Check"
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -138,7 +138,23 @@ def get_entries(filters):
|
||||
and ifnull(clearance_date, '4000-01-01') > %(report_date)s
|
||||
""", filters, as_dict=1)
|
||||
|
||||
return sorted(list(payment_entries)+list(journal_entries),
|
||||
pos_entries = []
|
||||
if filters.include_pos_transactions:
|
||||
pos_entries = frappe.db.sql("""
|
||||
select
|
||||
"Sales Invoice Payment" as payment_document, sip.name as payment_entry, sip.amount as debit,
|
||||
si.posting_date, si.debit_to as against_account, sip.clearance_date,
|
||||
account.account_currency, 0 as credit
|
||||
from `tabSales Invoice Payment` sip, `tabSales Invoice` si, `tabAccount` account
|
||||
where
|
||||
sip.account=%(account)s and si.docstatus=1 and sip.parent = si.name
|
||||
and account.name = sip.account and si.posting_date <= %(report_date)s and
|
||||
ifnull(sip.clearance_date, '4000-01-01') > %(report_date)s
|
||||
order by
|
||||
si.posting_date ASC, si.name DESC
|
||||
""", filters, as_dict=1)
|
||||
|
||||
return sorted(list(payment_entries)+list(journal_entries+list(pos_entries)),
|
||||
key=lambda k: k['posting_date'] or getdate(nowdate()))
|
||||
|
||||
def get_amounts_not_reflected_in_system(filters):
|
||||
|
||||
@@ -39,6 +39,12 @@ frappe.query_reports["Budget Variance Report"] = {
|
||||
options: ["Cost Center", "Project"],
|
||||
default: "Cost Center",
|
||||
reqd: 1
|
||||
}
|
||||
},
|
||||
{
|
||||
fieldname: "cost_center",
|
||||
label: __("Cost Center"),
|
||||
fieldtype: "Link",
|
||||
options: "Cost Center"
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
@@ -10,9 +10,13 @@ from erpnext.controllers.trends import get_period_date_ranges, get_period_month_
|
||||
|
||||
def execute(filters=None):
|
||||
if not filters: filters = {}
|
||||
|
||||
validate_filters(filters)
|
||||
columns = get_columns(filters)
|
||||
cost_centers = get_cost_centers(filters)
|
||||
if filters.get("cost_center"):
|
||||
cost_centers = [filters.get("cost_center")]
|
||||
else:
|
||||
cost_centers = get_cost_centers(filters)
|
||||
|
||||
period_month_ranges = get_period_month_ranges(filters["period"], filters["fiscal_year"])
|
||||
cam_map = get_cost_center_account_month_map(filters)
|
||||
|
||||
@@ -39,6 +43,10 @@ def execute(filters=None):
|
||||
|
||||
return columns, data
|
||||
|
||||
def validate_filters(filters):
|
||||
if filters.get("budget_against")=="Project" and filters.get("cost_center"):
|
||||
frappe.throw(_("Filter based on Cost Center is only applicable if Budget Against is selected as Cost Center"))
|
||||
|
||||
def get_columns(filters):
|
||||
columns = [_(filters.get("budget_against")) + ":Link/%s:120"%(filters.get("budget_against")), _("Account") + ":Link/Account:120"]
|
||||
|
||||
@@ -66,12 +74,16 @@ def get_cost_centers(filters):
|
||||
|
||||
#Get cost center & target details
|
||||
def get_cost_center_target_details(filters):
|
||||
cond = ""
|
||||
if filters.get("cost_center"):
|
||||
cond += " and b.cost_center='%s'" % frappe.db.escape(filters.get("cost_center"))
|
||||
|
||||
return frappe.db.sql("""
|
||||
select b.{budget_against} as budget_against, b.monthly_distribution, ba.account, ba.budget_amount
|
||||
from `tabBudget` b, `tabBudget Account` ba
|
||||
where b.name=ba.parent and b.docstatus = 1 and b.fiscal_year=%s
|
||||
and b.budget_against = %s and b.company=%s
|
||||
""".format(budget_against=filters.get("budget_against").replace(" ", "_").lower()),
|
||||
and b.budget_against = %s and b.company=%s {cond}
|
||||
""".format(budget_against=filters.get("budget_against").replace(" ", "_").lower(), cond=cond),
|
||||
(filters.fiscal_year, filters.budget_against, filters.company), as_dict=True)
|
||||
|
||||
#Get target distribution details of accounts of cost center
|
||||
|
||||
@@ -185,14 +185,15 @@ def prepare_data(accounts, balance_must_be, period_list, company_currency):
|
||||
has_value = False
|
||||
total = 0
|
||||
row = frappe._dict({
|
||||
"account_name": _(d.account_name),
|
||||
"account": _(d.name),
|
||||
"parent_account": _(d.parent_account),
|
||||
"indent": flt(d.indent),
|
||||
"year_start_date": year_start_date,
|
||||
"year_end_date": year_end_date,
|
||||
"currency": company_currency,
|
||||
"opening_balance": d.get("opening_balance", 0.0) * (1 if balance_must_be=="Debit" else -1)
|
||||
"opening_balance": d.get("opening_balance", 0.0) * (1 if balance_must_be=="Debit" else -1),
|
||||
"account_name": ('{} - {}'.format(_(d.account_number), _(d.account_name))
|
||||
if d.account_number else _(d.account_name))
|
||||
})
|
||||
for period in period_list:
|
||||
if d.get(period.key) and balance_must_be=="Credit":
|
||||
@@ -253,7 +254,7 @@ def add_total_row(out, root_type, balance_must_be, period_list, company_currency
|
||||
out.append({})
|
||||
|
||||
def get_accounts(company, root_type):
|
||||
return frappe.db.sql("""select name, parent_account, lft, rgt, root_type, report_type, account_name from `tabAccount`
|
||||
return frappe.db.sql("""select name, account_number, parent_account, lft, rgt, root_type, report_type, account_name from `tabAccount`
|
||||
where company=%s and root_type=%s order by lft""", (company, root_type), as_dict=True)
|
||||
|
||||
def filter_accounts(accounts, depth=10):
|
||||
|
||||
@@ -8,6 +8,13 @@
|
||||
{%= filters.account %}
|
||||
{% } %}
|
||||
</h4>
|
||||
|
||||
<h6 class="text-center">
|
||||
{% if (filters.tax_id) { %}
|
||||
{%= __("Tax Id: ")%} {%= filters.tax_id %}
|
||||
{% } %}
|
||||
</h6>
|
||||
|
||||
<h5 class="text-center">
|
||||
{%= dateutil.str_to_user(filters.from_date) %}
|
||||
{%= __("to") %}
|
||||
@@ -17,38 +24,70 @@
|
||||
<table class="table table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 15%">{%= __("Date") %}</th>
|
||||
<th style="width: 12%">{%= __("Date") %}</th>
|
||||
<th style="width: 15%">{%= __("Ref") %}</th>
|
||||
<th style="width: 40%">{%= __("Party") %}</th>
|
||||
<th style="width: 25%">{%= __("Party") %}</th>
|
||||
<th style="width: 15%">{%= __("Debit") %}</th>
|
||||
<th style="width: 15%">{%= __("Credit") %}</th>
|
||||
<th style="width: 18%">{%= __("Balance (Dr - Cr)") %}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for(var i=0, l=data.length; i<l; i++) { %}
|
||||
<tr>
|
||||
{% if(data[i][__("Posting Date")]) { %}
|
||||
<td>{%= dateutil.str_to_user(data[i][__("Posting Date")]) %}</td>
|
||||
<td>{%= data[i][__("Voucher Type")] %}
|
||||
<br>{%= data[i][__("Voucher No")] %}</td>
|
||||
{% if(data[i].posting_date) { %}
|
||||
<td>{%= dateutil.str_to_user(data[i].posting_date) %}</td>
|
||||
<td>{%= data[i].voucher_type %}
|
||||
<br>{%= data[i].voucher_no %}</td>
|
||||
<td>
|
||||
{% if(!(filters.party || filters.account)) { %}
|
||||
{%= data[i][__("Party")] || data[i][__("Account")] %}
|
||||
{%= data[i].party || data[i].account %}
|
||||
<br>
|
||||
{% } %}
|
||||
|
||||
{{ __("Against") }}: {%= data[i][__("Against Account")] %}
|
||||
<br>{%= __("Remarks") %}: {%= data[i][__("Remarks")] %}</td>
|
||||
<td style="text-align: right">{%= format_currency(data[i][__("Debit")]) %}</td>
|
||||
<td style="text-align: right">{%= format_currency(data[i][__("Credit")]) %}</td>
|
||||
{{ __("Against") }}: {%= data[i].against %}
|
||||
<br>{%= __("Remarks") %}: {%= data[i].remarks %}
|
||||
{% if(data[i].bill_no) { %}
|
||||
<br>{%= __("Supplier Invoice No") %}: {%= data[i].bill_no %}
|
||||
{% } %}
|
||||
</td>
|
||||
{% if(filters.print_in_account_currency) { %}
|
||||
<td style="text-align: right">
|
||||
{%= format_currency(data[i].debit_in_account_currency, data[i].account_currency) %}
|
||||
</td>
|
||||
<td style="text-align: right">
|
||||
{%= format_currency(data[i].credit_in_account_currency, data[i].account_currency) %}
|
||||
</td>
|
||||
{% } else { %}
|
||||
<td style="text-align: right">
|
||||
{%= format_currency(data[i].debit) %}</td>
|
||||
<td style="text-align: right">
|
||||
{%= format_currency(data[i].credit) %}</td>
|
||||
{% } %}
|
||||
{% } else { %}
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td><b>{%= frappe.format(data[i][__("Account")], {fieldtype: "Link"}) || " " %}</b></td>
|
||||
<td><b>{%= frappe.format(data[i].account, {fieldtype: "Link"}) || " " %}</b></td>
|
||||
{% if(filters.print_in_account_currency) { %}
|
||||
<td style="text-align: right">
|
||||
{%= data[i].account && format_currency(data[i].debit_in_account_currency, data[i].account_currency) %}</td>
|
||||
<td style="text-align: right">
|
||||
{%= data[i].account && format_currency(data[i].credit_in_account_currency, data[i].account_currency) %}</td>
|
||||
{% } else { %}
|
||||
<td style="text-align: right">
|
||||
{%= data[i].account && format_currency(data[i].debit) %}
|
||||
</td>
|
||||
<td style="text-align: right">
|
||||
{%= data[i].account && format_currency(data[i].credit) %}
|
||||
</td>
|
||||
{% } %}
|
||||
{% } %}
|
||||
{% if(filters.print_in_account_currency) { %}
|
||||
<td style="text-align: right">
|
||||
{%= data[i][__("Account")] && format_currency(data[i][__("Debit")]) %}</td>
|
||||
<td style="text-align: right">
|
||||
{%= data[i][__("Account")] && format_currency(data[i][__("Credit")]) %}</td>
|
||||
{%= format_currency(data[i].balance_in_account_currency, data[i].account_currency) %}
|
||||
</td>
|
||||
{% } else { %}
|
||||
<td style="text-align: right">{%= format_currency(data[i].balance) %}</td>
|
||||
{% } %}
|
||||
</tr>
|
||||
{% } %}
|
||||
|
||||
@@ -61,7 +61,10 @@ frappe.query_reports["General Ledger"] = {
|
||||
"label": __("Party Type"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Party Type",
|
||||
"default": ""
|
||||
"default": "",
|
||||
on_change: function() {
|
||||
frappe.query_report_filters_by_name.party.set_value("");
|
||||
}
|
||||
},
|
||||
{
|
||||
"fieldname":"party",
|
||||
@@ -82,11 +85,16 @@ frappe.query_reports["General Ledger"] = {
|
||||
frappe.query_report_filters_by_name.party_name.set_value("");
|
||||
return;
|
||||
}
|
||||
|
||||
var fieldname = frappe.scrub(party_type) + "_name";
|
||||
var fieldname = erpnext.utils.get_party_name(party_type) || "name";
|
||||
frappe.db.get_value(party_type, party, fieldname, function(value) {
|
||||
frappe.query_report_filters_by_name.party_name.set_value(value[fieldname]);
|
||||
});
|
||||
|
||||
if (party_type === "Customer" || party_type === "Supplier") {
|
||||
frappe.db.get_value(party_type, party, "tax_id", function(value) {
|
||||
frappe.query_report_filters_by_name.tax_id.set_value(value["tax_id"]);
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -95,6 +103,12 @@ frappe.query_reports["General Ledger"] = {
|
||||
"fieldtype": "Data",
|
||||
"hidden": 1
|
||||
},
|
||||
{
|
||||
"fieldname":"tax_id",
|
||||
"label": __("Tax Id"),
|
||||
"fieldtype": "Data",
|
||||
"hidden": 1
|
||||
},
|
||||
{
|
||||
"fieldname":"group_by_voucher",
|
||||
"label": __("Group by Voucher"),
|
||||
@@ -105,6 +119,11 @@ frappe.query_reports["General Ledger"] = {
|
||||
"fieldname":"group_by_account",
|
||||
"label": __("Group by Account"),
|
||||
"fieldtype": "Check",
|
||||
},
|
||||
{
|
||||
"fieldname":"print_in_account_currency",
|
||||
"label": __("Print in Account Currency"),
|
||||
"fieldtype": "Check",
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -3,12 +3,17 @@
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe.utils import getdate, cstr, flt
|
||||
from frappe.utils import getdate, cstr, flt, fmt_money
|
||||
from frappe import _, _dict
|
||||
from erpnext.accounts.utils import get_account_currency
|
||||
|
||||
def execute(filters=None):
|
||||
account_details = {}
|
||||
|
||||
if filters and filters.get('print_in_account_currency') and \
|
||||
not filters.get('account'):
|
||||
frappe.throw(_("Select an account to print in account currency"))
|
||||
|
||||
for acc in frappe.db.sql("""select name, is_group from tabAccount""", as_dict=1):
|
||||
account_details.setdefault(acc.name, acc)
|
||||
|
||||
@@ -66,8 +71,8 @@ def set_account_currency(filters):
|
||||
if gle_currency:
|
||||
account_currency = gle_currency
|
||||
else:
|
||||
account_currency = None if filters.party_type == "Employee" else \
|
||||
frappe.db.get_value(filters.party_type, filters.party, "default_currency")
|
||||
account_currency = (None if filters.party_type in ["Employee", "Student", "Shareholder", "Member"] else
|
||||
frappe.db.get_value(filters.party_type, filters.party, "default_currency"))
|
||||
|
||||
filters["account_currency"] = account_currency or filters.company_currency
|
||||
|
||||
@@ -76,28 +81,6 @@ def set_account_currency(filters):
|
||||
|
||||
return filters
|
||||
|
||||
def get_columns(filters):
|
||||
columns = [
|
||||
_("Posting Date") + ":Date:90", _("Account") + ":Link/Account:200",
|
||||
_("Debit") + ":Float:100", _("Credit") + ":Float:100"
|
||||
]
|
||||
|
||||
if filters.get("show_in_account_currency"):
|
||||
columns += [
|
||||
_("Debit") + " (" + filters.account_currency + ")" + ":Float:100",
|
||||
_("Credit") + " (" + filters.account_currency + ")" + ":Float:100"
|
||||
]
|
||||
|
||||
columns += [
|
||||
_("Voucher Type") + "::120", _("Voucher No") + ":Dynamic Link/"+_("Voucher Type")+":160",
|
||||
_("Against Account") + "::120", _("Party Type") + "::80", _("Party") + "::150",
|
||||
_("Project") + ":Link/Project:100", _("Cost Center") + ":Link/Cost Center:100",
|
||||
_("Against Voucher Type") + "::120", _("Against Voucher") + ":Dynamic Link/"+_("Against Voucher Type")+":160",
|
||||
_("Remarks") + "::400"
|
||||
]
|
||||
|
||||
return columns
|
||||
|
||||
def get_result(filters, account_details):
|
||||
gl_entries = get_gl_entries(filters)
|
||||
|
||||
@@ -193,24 +176,6 @@ def get_data_with_opening_closing(filters, account_details, gl_entries):
|
||||
# closing
|
||||
data.append(totals.closing)
|
||||
|
||||
#total closing
|
||||
total_closing = totals.total_closing
|
||||
total_debit = totals.closing.get('debit', 0)
|
||||
total_credit = totals.closing.get('credit', 0)
|
||||
debit_in_account_currency = totals.closing.get('debit_in_account_currency', 0)
|
||||
credit_in_account_currency = totals.closing.get('credit_in_account_currency', 0)
|
||||
|
||||
total_amount = total_debit - total_credit
|
||||
|
||||
if total_amount > 0:
|
||||
total_closing['debit'] = total_amount
|
||||
total_closing['debit_in_account_currency'] = debit_in_account_currency - credit_in_account_currency
|
||||
else:
|
||||
total_closing['credit'] = abs(total_amount)
|
||||
total_closing['credit_in_account_currency'] = abs(debit_in_account_currency - credit_in_account_currency)
|
||||
|
||||
data.append(totals.total_closing)
|
||||
|
||||
return data
|
||||
|
||||
def get_totals_dict():
|
||||
@@ -225,8 +190,7 @@ def get_totals_dict():
|
||||
return _dict(
|
||||
opening = _get_debit_credit_dict(_('Opening')),
|
||||
total = _get_debit_credit_dict(_('Total')),
|
||||
closing = _get_debit_credit_dict(_('Closing (Opening + Total)')),
|
||||
total_closing = _get_debit_credit_dict(_('Closing Balance (Dr - Cr)'))
|
||||
closing = _get_debit_credit_dict(_('Closing (Opening + Total)'))
|
||||
)
|
||||
|
||||
def initialize_gle_map(gl_entries):
|
||||
@@ -270,17 +234,163 @@ def get_accountwise_gle(filters, gl_entries, gle_map):
|
||||
return totals, entries
|
||||
|
||||
def get_result_as_list(data, filters):
|
||||
result = []
|
||||
balance, balance_in_account_currency = 0, 0
|
||||
inv_details = get_supplier_invoice_details()
|
||||
|
||||
for d in data:
|
||||
row = [d.get("posting_date"), d.get("account"), d.get("debit"), d.get("credit")]
|
||||
if not d.get('posting_date'):
|
||||
balance, balance_in_account_currency = 0, 0
|
||||
|
||||
balance = get_balance(d, balance, 'debit', 'credit')
|
||||
d['balance'] = balance
|
||||
|
||||
if filters.get("show_in_account_currency"):
|
||||
row += [d.get("debit_in_account_currency"), d.get("credit_in_account_currency")]
|
||||
balance_in_account_currency = get_balance(d, balance_in_account_currency,
|
||||
'debit_in_account_currency', 'credit_in_account_currency')
|
||||
d['balance_in_account_currency'] = balance_in_account_currency
|
||||
else:
|
||||
d['debit_in_account_currency'] = d.get('debit', 0)
|
||||
d['credit_in_account_currency'] = d.get('credit', 0)
|
||||
d['balance_in_account_currency'] = d.get('balance')
|
||||
|
||||
row += [d.get("voucher_type"), d.get("voucher_no"), d.get("against"),
|
||||
d.get("party_type"), d.get("party"), d.get("project"), d.get("cost_center"), d.get("against_voucher_type"), d.get("against_voucher"), d.get("remarks")
|
||||
]
|
||||
d['account_currency'] = filters.account_currency
|
||||
d['bill_no'] = inv_details.get(d.get('against_voucher'), '')
|
||||
|
||||
result.append(row)
|
||||
return data
|
||||
|
||||
return result
|
||||
def get_supplier_invoice_details():
|
||||
inv_details = {}
|
||||
for d in frappe.db.sql(""" select name, bill_no from `tabPurchase Invoice`
|
||||
where docstatus = 1 and bill_no is not null and bill_no != '' """, as_dict=1):
|
||||
inv_details[d.name] = d.bill_no
|
||||
|
||||
return inv_details
|
||||
|
||||
def get_balance(row, balance, debit_field, credit_field):
|
||||
balance += (row.get(debit_field, 0) - row.get(credit_field, 0))
|
||||
|
||||
return balance
|
||||
|
||||
def get_columns(filters):
|
||||
columns = [
|
||||
{
|
||||
"label": _("Posting Date"),
|
||||
"fieldname": "posting_date",
|
||||
"fieldtype": "Date",
|
||||
"width": 90
|
||||
},
|
||||
{
|
||||
"label": _("Account"),
|
||||
"fieldname": "account",
|
||||
"fieldtype": "Link",
|
||||
"options": "Account",
|
||||
"width": 180
|
||||
},
|
||||
{
|
||||
"label": _("Debit"),
|
||||
"fieldname": "debit",
|
||||
"fieldtype": "Float",
|
||||
"width": 100
|
||||
},
|
||||
{
|
||||
"label": _("Credit"),
|
||||
"fieldname": "credit",
|
||||
"fieldtype": "Float",
|
||||
"width": 100
|
||||
},
|
||||
{
|
||||
"label": _("Balance (Dr - Cr)"),
|
||||
"fieldname": "balance",
|
||||
"fieldtype": "Float",
|
||||
"width": 130
|
||||
}
|
||||
]
|
||||
|
||||
if filters.get("show_in_account_currency"):
|
||||
columns.extend([
|
||||
{
|
||||
"label": _("Debit") + " (" + filters.account_currency + ")",
|
||||
"fieldname": "debit_in_account_currency",
|
||||
"fieldtype": "Float",
|
||||
"width": 100
|
||||
},
|
||||
{
|
||||
"label": _("Credit") + " (" + filters.account_currency + ")",
|
||||
"fieldname": "credit_in_account_currency",
|
||||
"fieldtype": "Float",
|
||||
"width": 100
|
||||
},
|
||||
{
|
||||
"label": _("Balance") + " (" + filters.account_currency + ")",
|
||||
"fieldname": "balance_in_account_currency",
|
||||
"fieldtype": "Data",
|
||||
"width": 100
|
||||
}
|
||||
])
|
||||
|
||||
columns.extend([
|
||||
{
|
||||
"label": _("Voucher Type"),
|
||||
"fieldname": "voucher_type",
|
||||
"width": 120
|
||||
},
|
||||
{
|
||||
"label": _("Voucher No"),
|
||||
"fieldname": "voucher_no",
|
||||
"fieldtype": "Dynamic Link",
|
||||
"options": "voucher_type",
|
||||
"width": 180
|
||||
},
|
||||
{
|
||||
"label": _("Against Account"),
|
||||
"fieldname": "against",
|
||||
"width": 120
|
||||
},
|
||||
{
|
||||
"label": _("Party Type"),
|
||||
"fieldname": "party_type",
|
||||
"width": 100
|
||||
},
|
||||
{
|
||||
"label": _("Party"),
|
||||
"fieldname": "party",
|
||||
"width": 100
|
||||
},
|
||||
{
|
||||
"label": _("Project"),
|
||||
"options": "Project",
|
||||
"fieldname": "project",
|
||||
"width": 100
|
||||
},
|
||||
{
|
||||
"label": _("Cost Center"),
|
||||
"options": "Cost Center",
|
||||
"fieldname": "cost_center",
|
||||
"width": 100
|
||||
},
|
||||
{
|
||||
"label": _("Against Voucher Type"),
|
||||
"fieldname": "against_voucher_type",
|
||||
"width": 100
|
||||
},
|
||||
{
|
||||
"label": _("Against Voucher"),
|
||||
"fieldname": "against_voucher",
|
||||
"fieldtype": "Dynamic Link",
|
||||
"options": "against_voucher_type",
|
||||
"width": 100
|
||||
},
|
||||
{
|
||||
"label": _("Supplier Invoice No"),
|
||||
"fieldname": "bill_no",
|
||||
"fieldtype": "Data",
|
||||
"width": 100
|
||||
},
|
||||
{
|
||||
"label": _("Remarks"),
|
||||
"fieldname": "remarks",
|
||||
"width": 400
|
||||
}
|
||||
])
|
||||
|
||||
return columns
|
||||
|
||||
@@ -6,7 +6,6 @@ import frappe
|
||||
from frappe import _, scrub
|
||||
from erpnext.stock.utils import get_incoming_rate
|
||||
from erpnext.controllers.queries import get_match_cond
|
||||
from erpnext.stock.stock_ledger import get_valuation_rate
|
||||
from frappe.utils import flt
|
||||
|
||||
|
||||
@@ -172,7 +171,7 @@ class GrossProfitGenerator(object):
|
||||
row.qty += returned_item_row.qty
|
||||
row.base_amount += returned_item_row.base_amount
|
||||
row.buying_amount = row.qty * row.buying_rate
|
||||
if row.qty:
|
||||
if row.qty or row.base_amount:
|
||||
row = self.set_average_rate(row)
|
||||
self.grouped_data.append(row)
|
||||
|
||||
@@ -248,6 +247,7 @@ class GrossProfitGenerator(object):
|
||||
return 0.0
|
||||
|
||||
def get_average_buying_rate(self, row, item_code):
|
||||
args = row
|
||||
if not item_code in self.average_buying_rate:
|
||||
if item_code in self.non_stock_items:
|
||||
self.average_buying_rate[item_code] = flt(frappe.db.sql("""
|
||||
@@ -255,14 +255,14 @@ class GrossProfitGenerator(object):
|
||||
from `tabPurchase Invoice Item`
|
||||
where item_code = %s and docstatus=1""", item_code)[0][0])
|
||||
else:
|
||||
row.voucher_type = row.parenttype
|
||||
row.voucher_no = row.parent
|
||||
average_buying_rate = get_incoming_rate(row)
|
||||
if not average_buying_rate:
|
||||
average_buying_rate = get_valuation_rate(item_code, row.warehouse,
|
||||
row.parenttype, row.parent, allow_zero_rate=row.allow_zero_valuation,
|
||||
currency=self.filters.currency, company=self.filters.company)
|
||||
args.update({
|
||||
'voucher_type': row.parenttype,
|
||||
'voucher_no': row.parent,
|
||||
'allow_zero_valuation': True,
|
||||
'company': self.filters.company
|
||||
})
|
||||
|
||||
average_buying_rate = get_incoming_rate(args)
|
||||
self.average_buying_rate[item_code] = flt(average_buying_rate)
|
||||
|
||||
return self.average_buying_rate[item_code]
|
||||
@@ -311,8 +311,7 @@ class GrossProfitGenerator(object):
|
||||
`tabSales Invoice Item`.brand, `tabSales Invoice Item`.dn_detail,
|
||||
`tabSales Invoice Item`.delivery_note, `tabSales Invoice Item`.stock_qty as qty,
|
||||
`tabSales Invoice Item`.base_net_rate, `tabSales Invoice Item`.base_net_amount,
|
||||
`tabSales Invoice Item`.name as "item_row", `tabSales Invoice`.is_return,
|
||||
`tabSales Invoice Item`.allow_zero_valuation_rate as "allow_zero_valuation"
|
||||
`tabSales Invoice Item`.name as "item_row", `tabSales Invoice`.is_return
|
||||
{sales_person_cols}
|
||||
from
|
||||
`tabSales Invoice` inner join `tabSales Invoice Item`
|
||||
|
||||
@@ -49,7 +49,7 @@ def _execute(filters=None, additional_table_columns=None, additional_query_colum
|
||||
|
||||
row += [
|
||||
d.credit_to, d.mode_of_payment, d.project, d.company, d.purchase_order,
|
||||
purchase_receipt, expense_account, d.stock_qty, d.stock_uom, d.base_net_rate, d.base_net_amount
|
||||
purchase_receipt, expense_account, d.stock_qty, d.stock_uom, d.base_net_amount / d.stock_qty, d.base_net_amount
|
||||
]
|
||||
|
||||
total_tax = 0
|
||||
@@ -120,8 +120,7 @@ def get_items(filters, additional_query_columns):
|
||||
`tabPurchase Invoice Item`.`project`, `tabPurchase Invoice Item`.`purchase_order`,
|
||||
`tabPurchase Invoice Item`.`purchase_receipt`, `tabPurchase Invoice Item`.`po_detail`,
|
||||
`tabPurchase Invoice Item`.`expense_account`, `tabPurchase Invoice Item`.`stock_qty`,
|
||||
`tabPurchase Invoice Item`.`stock_uom`, `tabPurchase Invoice Item`.`base_net_rate`,
|
||||
`tabPurchase Invoice Item`.`base_net_amount`,
|
||||
`tabPurchase Invoice Item`.`stock_uom`, `tabPurchase Invoice Item`.`base_net_amount`,
|
||||
`tabPurchase Invoice`.supplier_name, `tabPurchase Invoice`.mode_of_payment {0}
|
||||
from `tabPurchase Invoice`, `tabPurchase Invoice Item`
|
||||
where `tabPurchase Invoice`.name = `tabPurchase Invoice Item`.`parent` and
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
// License: GNU General Public License v3. See license.txt
|
||||
|
||||
frappe.query_reports["Item-wise Sales Register"] = frappe.query_reports["Sales Register"] = {
|
||||
frappe.query_reports["Item-wise Sales Register"] = {
|
||||
"filters": [
|
||||
{
|
||||
"fieldname":"from_date",
|
||||
|
||||
@@ -50,10 +50,12 @@ def _execute(filters=None, additional_table_columns=None, additional_query_colum
|
||||
row += [
|
||||
d.customer_group, d.debit_to, ", ".join(mode_of_payments.get(d.parent, [])),
|
||||
d.territory, d.project, d.company, d.sales_order,
|
||||
delivery_note, d.income_account, d.cost_center, d.stock_qty, d.stock_uom,
|
||||
d.base_net_rate, d.base_net_amount
|
||||
delivery_note, d.income_account, d.cost_center, d.stock_qty, d.stock_uom
|
||||
]
|
||||
|
||||
row += [(d.base_net_rate * d.qty)/d.stock_qty, d.base_net_amount] \
|
||||
if d.stock_uom != d.uom else [d.base_net_rate, d.base_net_amount]
|
||||
|
||||
total_tax = 0
|
||||
for tax in tax_columns:
|
||||
item_tax = itemised_tax.get(d.name, {}).get(tax, {})
|
||||
@@ -103,7 +105,7 @@ def get_conditions(filters):
|
||||
|
||||
if filters.get("mode_of_payment"):
|
||||
conditions += """ and exists(select name from `tabSales Invoice Payment`
|
||||
where parent=si.name
|
||||
where parent=`tabSales Invoice`.name
|
||||
and ifnull(`tabSales Invoice Payment`.mode_of_payment, '') = %(mode_of_payment)s)"""
|
||||
|
||||
return conditions
|
||||
@@ -131,7 +133,7 @@ def get_items(filters, additional_query_columns):
|
||||
`tabSales Invoice Item`.stock_uom, `tabSales Invoice Item`.base_net_rate,
|
||||
`tabSales Invoice Item`.base_net_amount, `tabSales Invoice`.customer_name,
|
||||
`tabSales Invoice`.customer_group, `tabSales Invoice Item`.so_detail,
|
||||
`tabSales Invoice`.update_stock {0}
|
||||
`tabSales Invoice`.update_stock, `tabSales Invoice Item`.uom, `tabSales Invoice Item`.qty {0}
|
||||
from `tabSales Invoice`, `tabSales Invoice Item`
|
||||
where `tabSales Invoice`.name = `tabSales Invoice Item`.parent
|
||||
and `tabSales Invoice`.docstatus = 1 %s %s
|
||||
@@ -155,6 +157,9 @@ def get_delivery_notes_against_sales_order(item_list):
|
||||
|
||||
return so_dn_map
|
||||
|
||||
def get_deducted_taxes():
|
||||
return frappe.db.sql_list("select name from `tabPurchase Taxes and Charges` where add_deduct_tax = 'Deduct'")
|
||||
|
||||
def get_tax_accounts(item_list, columns, company_currency,
|
||||
doctype="Sales Invoice", tax_doctype="Sales Taxes and Charges"):
|
||||
import json
|
||||
@@ -168,15 +173,16 @@ def get_tax_accounts(item_list, columns, company_currency,
|
||||
|
||||
for d in item_list:
|
||||
invoice_item_row.setdefault(d.parent, []).append(d)
|
||||
item_row_map.setdefault(d.parent, {}).setdefault(d.item_code, []).append(d)
|
||||
item_row_map.setdefault(d.parent, {}).setdefault(d.item_code or d.item_name, []).append(d)
|
||||
|
||||
conditions = ""
|
||||
if doctype == "Purchase Invoice":
|
||||
conditions = " and category in ('Total', 'Valuation and Total')"
|
||||
conditions = " and category in ('Total', 'Valuation and Total') and base_tax_amount_after_discount_amount != 0"
|
||||
|
||||
deducted_tax = get_deducted_taxes()
|
||||
tax_details = frappe.db.sql("""
|
||||
select
|
||||
parent, description, item_wise_tax_detail,
|
||||
name, parent, description, item_wise_tax_detail,
|
||||
charge_type, base_tax_amount_after_discount_amount
|
||||
from `tab%s`
|
||||
where
|
||||
@@ -188,7 +194,7 @@ def get_tax_accounts(item_list, columns, company_currency,
|
||||
""" % (tax_doctype, '%s', ', '.join(['%s']*len(invoice_item_row)), conditions),
|
||||
tuple([doctype] + invoice_item_row.keys()))
|
||||
|
||||
for parent, description, item_wise_tax_detail, charge_type, tax_amount in tax_details:
|
||||
for name, parent, description, item_wise_tax_detail, charge_type, tax_amount in tax_details:
|
||||
description = handle_html(description)
|
||||
if description not in tax_columns and tax_amount:
|
||||
# as description is text editor earlier and markup can break the column convention in reports
|
||||
@@ -217,9 +223,13 @@ def get_tax_accounts(item_list, columns, company_currency,
|
||||
item_tax_amount = flt((tax_amount * d.base_net_amount) / item_net_amount) \
|
||||
if item_net_amount else 0
|
||||
if item_tax_amount:
|
||||
tax_value = flt(item_tax_amount, tax_amount_precision)
|
||||
tax_value = (tax_value * -1
|
||||
if (doctype == 'Purchase Invoice' and name in deducted_tax) else tax_value)
|
||||
|
||||
itemised_tax.setdefault(d.name, {})[description] = frappe._dict({
|
||||
"tax_rate": tax_rate,
|
||||
"tax_amount": flt(item_tax_amount, tax_amount_precision)
|
||||
"tax_amount": tax_value
|
||||
})
|
||||
|
||||
except ValueError:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"add_total_row": 0,
|
||||
"add_total_row": 1,
|
||||
"apply_user_permissions": 1,
|
||||
"creation": "2013-06-13 18:46:55",
|
||||
"disabled": 0,
|
||||
@@ -7,7 +7,7 @@
|
||||
"doctype": "Report",
|
||||
"idx": 3,
|
||||
"is_standard": "Yes",
|
||||
"modified": "2017-02-24 20:16:25.027061",
|
||||
"modified": "2018-02-21 01:28:31.261299",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Purchase Invoice Trends",
|
||||
|
||||
@@ -43,7 +43,7 @@ def _execute(filters=None, additional_table_columns=None, additional_query_colum
|
||||
|
||||
row += [
|
||||
supplier_details.get(inv.supplier), # supplier_type
|
||||
inv.credit_to, inv.mode_of_payment, ", ".join(project),
|
||||
inv.tax_id, inv.credit_to, inv.mode_of_payment, ", ".join(project),
|
||||
inv.bill_no, inv.bill_date, inv.remarks,
|
||||
", ".join(purchase_order), ", ".join(purchase_receipt), company_currency
|
||||
]
|
||||
@@ -83,7 +83,7 @@ def get_columns(invoice_list, additional_table_columns):
|
||||
columns += additional_table_columns
|
||||
|
||||
columns += [
|
||||
_("Supplier Type") + ":Link/Supplier Type:120", _("Payable Account") + ":Link/Account:120",
|
||||
_("Supplier Type") + ":Link/Supplier Type:120", _("Tax Id") + "::80", _("Payable Account") + ":Link/Account:120",
|
||||
_("Mode of Payment") + ":Link/Mode of Payment:80", _("Project") + ":Link/Project:80",
|
||||
_("Bill No") + "::120", _("Bill Date") + ":Date:80", _("Remarks") + "::150",
|
||||
_("Purchase Order") + ":Link/Purchase Order:100",
|
||||
@@ -143,7 +143,7 @@ def get_invoices(filters, additional_query_columns):
|
||||
conditions = get_conditions(filters)
|
||||
return frappe.db.sql("""
|
||||
select
|
||||
name, posting_date, credit_to, supplier, supplier_name, bill_no, bill_date,
|
||||
name, posting_date, credit_to, supplier, supplier_name, tax_id, bill_no, bill_date,
|
||||
remarks, base_net_total, base_grand_total, outstanding_amount,
|
||||
mode_of_payment {0}
|
||||
from `tabPurchase Invoice`
|
||||
@@ -172,6 +172,7 @@ def get_invoice_tax_map(invoice_list, invoice_expense_map, expense_accounts):
|
||||
else sum(base_tax_amount_after_discount_amount) * -1 end as tax_amount
|
||||
from `tabPurchase Taxes and Charges`
|
||||
where parent in (%s) and category in ('Total', 'Valuation and Total')
|
||||
and base_tax_amount_after_discount_amount != 0
|
||||
group by parent, account_head, add_deduct_tax
|
||||
""" % ', '.join(['%s']*len(invoice_list)), tuple([inv.name for inv in invoice_list]), as_dict=1)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"add_total_row": 0,
|
||||
"add_total_row": 1,
|
||||
"apply_user_permissions": 1,
|
||||
"creation": "2013-06-13 18:44:21",
|
||||
"disabled": 0,
|
||||
@@ -7,7 +7,7 @@
|
||||
"doctype": "Report",
|
||||
"idx": 3,
|
||||
"is_standard": "Yes",
|
||||
"modified": "2017-02-24 20:15:12.885723",
|
||||
"modified": "2018-02-21 01:28:03.622485",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Sales Invoice Trends",
|
||||
|
||||
@@ -33,8 +33,13 @@ frappe.query_reports["Sales Payment Summary"] = {
|
||||
},
|
||||
{
|
||||
"fieldname":"is_pos",
|
||||
"label": __("POS?"),
|
||||
"label": __("Show only POS"),
|
||||
"fieldtype": "Check"
|
||||
}
|
||||
},
|
||||
{
|
||||
"fieldname":"payment_detail",
|
||||
"label": __("Show Payment Details"),
|
||||
"fieldtype": "Check"
|
||||
},
|
||||
]
|
||||
};
|
||||
@@ -14,30 +14,46 @@ def execute(filters=None):
|
||||
def get_columns():
|
||||
return [
|
||||
_("Date") + ":Date:80",
|
||||
_("Owner") + "::150",
|
||||
_("Payment Mode") + "::140",
|
||||
_("Owner") + ":Data:200",
|
||||
_("Payment Mode") + ":Data:240",
|
||||
_("Sales and Returns") + ":Currency/currency:120",
|
||||
_("Taxes") + ":Currency/currency:120",
|
||||
_("Payments") + ":Currency/currency:120",
|
||||
_("Outstanding Amount") + ":Currency/currency:150",
|
||||
_("Payments") + ":Currency/currency:120"
|
||||
]
|
||||
|
||||
def get_sales_payment_data(filters, columns):
|
||||
sales_invoice_data = get_sales_invoice_data(filters)
|
||||
data = []
|
||||
show_payment_detail = False
|
||||
|
||||
sales_invoice_data = get_sales_invoice_data(filters)
|
||||
mode_of_payments = get_mode_of_payments(filters)
|
||||
mode_of_payment_details = get_mode_of_payment_details(filters)
|
||||
|
||||
if filters.get("payment_detail"):
|
||||
show_payment_detail = True
|
||||
else:
|
||||
show_payment_detail = False
|
||||
|
||||
for inv in sales_invoice_data:
|
||||
mode_of_payment = inv["owner"]+cstr(inv["posting_date"])
|
||||
row = [inv.posting_date, inv.owner,", ".join(mode_of_payments.get(mode_of_payment, [])),
|
||||
inv.net_total,
|
||||
inv.total_taxes, (inv.net_total + inv.total_taxes - inv.outstanding_amount),
|
||||
inv.outstanding_amount]
|
||||
data.append(row)
|
||||
owner_posting_date = inv["owner"]+cstr(inv["posting_date"])
|
||||
if show_payment_detail:
|
||||
row = [inv.posting_date, inv.owner," ",inv.net_total,inv.total_taxes, 0]
|
||||
data.append(row)
|
||||
for mop_detail in mode_of_payment_details.get(owner_posting_date,[]):
|
||||
row = [inv.posting_date, inv.owner,mop_detail[0],0,0,mop_detail[1],0]
|
||||
data.append(row)
|
||||
else:
|
||||
total_payment = 0
|
||||
for mop_detail in mode_of_payment_details.get(owner_posting_date,[]):
|
||||
total_payment = total_payment + mop_detail[1]
|
||||
row = [inv.posting_date, inv.owner,", ".join(mode_of_payments.get(owner_posting_date, [])),
|
||||
inv.net_total,inv.total_taxes,total_payment]
|
||||
data.append(row)
|
||||
return data
|
||||
|
||||
def get_conditions(filters):
|
||||
conditions = ""
|
||||
if filters.get("from_date"): conditions += "a.posting_date >= %(from_date)s"
|
||||
conditions = "1=1"
|
||||
if filters.get("from_date"): conditions += " and a.posting_date >= %(from_date)s"
|
||||
if filters.get("to_date"): conditions += " and a.posting_date <= %(to_date)s"
|
||||
if filters.get("company"): conditions += " and a.company=%(company)s"
|
||||
if filters.get("customer"): conditions += " and a.customer = %(customer)s"
|
||||
@@ -73,9 +89,17 @@ def get_mode_of_payments(filters):
|
||||
union
|
||||
select a.owner,a.posting_date, ifnull(b.mode_of_payment, '') as mode_of_payment
|
||||
from `tabSales Invoice` a, `tabPayment Entry` b,`tabPayment Entry Reference` c
|
||||
where a.name = c.reference_name
|
||||
where a.name = c.reference_name
|
||||
and b.name = c.parent
|
||||
and a.name in ({invoice_list_names})
|
||||
union
|
||||
select a.owner, a.posting_date,
|
||||
ifnull(a.voucher_type,'') as mode_of_payment
|
||||
from `tabJournal Entry` a, `tabJournal Entry Account` b
|
||||
where a.name = b.parent
|
||||
and a.docstatus = 1
|
||||
and b.reference_type = "Sales Invoice"
|
||||
and b.reference_name in ({invoice_list_names})
|
||||
""".format(invoice_list_names=invoice_list_names), as_dict=1)
|
||||
for d in inv_mop:
|
||||
mode_of_payments.setdefault(d["owner"]+cstr(d["posting_date"]), []).append(d.mode_of_payment)
|
||||
@@ -86,4 +110,37 @@ def get_invoices(filters):
|
||||
return frappe.db.sql("""select a.name
|
||||
from `tabSales Invoice` a
|
||||
where a.docstatus = 1 and {conditions}""".format(conditions=conditions),
|
||||
filters, as_dict=1)
|
||||
filters, as_dict=1)
|
||||
|
||||
def get_mode_of_payment_details(filters):
|
||||
mode_of_payment_details = {}
|
||||
invoice_list = get_invoices(filters)
|
||||
invoice_list_names = ",".join(['"' + invoice['name'] + '"' for invoice in invoice_list])
|
||||
if invoice_list:
|
||||
inv_mop_detail = frappe.db.sql("""select a.owner, a.posting_date,
|
||||
ifnull(b.mode_of_payment, '') as mode_of_payment, sum(b.base_amount) as paid_amount
|
||||
from `tabSales Invoice` a, `tabSales Invoice Payment` b
|
||||
where a.name = b.parent
|
||||
and a.name in ({invoice_list_names})
|
||||
group by a.owner, a.posting_date, mode_of_payment
|
||||
union
|
||||
select a.owner,a.posting_date,
|
||||
ifnull(b.mode_of_payment, '') as mode_of_payment, sum(b.base_paid_amount) as paid_amount
|
||||
from `tabSales Invoice` a, `tabPayment Entry` b,`tabPayment Entry Reference` c
|
||||
where a.name = c.reference_name
|
||||
and b.name = c.parent
|
||||
and a.name in ({invoice_list_names})
|
||||
group by a.owner, a.posting_date, mode_of_payment
|
||||
union
|
||||
select a.owner, a.posting_date,
|
||||
ifnull(a.voucher_type,'') as mode_of_payment, sum(b.credit)
|
||||
from `tabJournal Entry` a, `tabJournal Entry Account` b
|
||||
where a.name = b.parent
|
||||
and a.docstatus = 1
|
||||
and b.reference_type = "Sales Invoice"
|
||||
and b.reference_name in ({invoice_list_names})
|
||||
group by a.owner, a.posting_date, mode_of_payment
|
||||
""".format(invoice_list_names=invoice_list_names), as_dict=1)
|
||||
for d in inv_mop_detail:
|
||||
mode_of_payment_details.setdefault(d["owner"]+cstr(d["posting_date"]), []).append((d.mode_of_payment,d.paid_amount))
|
||||
return mode_of_payment_details
|
||||
@@ -25,8 +25,6 @@ def _execute(filters, additional_table_columns=None, additional_query_columns=No
|
||||
#Cost Center & Warehouse Map
|
||||
invoice_cc_wh_map = get_invoice_cc_wh_map(invoice_list)
|
||||
invoice_so_dn_map = get_invoice_so_dn_map(invoice_list)
|
||||
customers = list(set([inv.customer for inv in invoice_list]))
|
||||
customer_map = get_customer_details(customers)
|
||||
company_currency = frappe.db.get_value("Company", filters.get("company"), "default_currency")
|
||||
mode_of_payments = get_mode_of_payments([inv.name for inv in invoice_list])
|
||||
|
||||
@@ -38,7 +36,6 @@ def _execute(filters, additional_table_columns=None, additional_query_columns=No
|
||||
cost_center = list(set(invoice_cc_wh_map.get(inv.name, {}).get("cost_center", [])))
|
||||
warehouse = list(set(invoice_cc_wh_map.get(inv.name, {}).get("warehouse", [])))
|
||||
|
||||
customer_details = customer_map.get(inv.customer, {})
|
||||
row = [
|
||||
inv.name, inv.posting_date, inv.customer, inv.customer_name
|
||||
]
|
||||
@@ -48,8 +45,9 @@ def _execute(filters, additional_table_columns=None, additional_query_columns=No
|
||||
row.append(inv.get(col))
|
||||
|
||||
row +=[
|
||||
customer_details.get("customer_group"),
|
||||
customer_details.get("territory"),
|
||||
inv.get("customer_group"),
|
||||
inv.get("territory"),
|
||||
inv.get("tax_id"),
|
||||
inv.debit_to, ", ".join(mode_of_payments.get(inv.name, [])),
|
||||
inv.project, inv.owner, inv.remarks,
|
||||
", ".join(sales_order), ", ".join(delivery_note),", ".join(cost_center),
|
||||
@@ -92,7 +90,7 @@ def get_columns(invoice_list, additional_table_columns):
|
||||
|
||||
columns +=[
|
||||
_("Customer Group") + ":Link/Customer Group:120", _("Territory") + ":Link/Territory:80",
|
||||
_("Receivable Account") + ":Link/Account:120", _("Mode of Payment") + "::120",
|
||||
_("Tax Id") + "::80", _("Receivable Account") + ":Link/Account:120", _("Mode of Payment") + "::120",
|
||||
_("Project") +":Link/Project:80", _("Owner") + "::150", _("Remarks") + "::150",
|
||||
_("Sales Order") + ":Link/Sales Order:100", _("Delivery Note") + ":Link/Delivery Note:100",
|
||||
_("Cost Center") + ":Link/Cost Center:100", _("Warehouse") + ":Link/Warehouse:100",
|
||||
@@ -162,7 +160,9 @@ def get_invoices(filters, additional_query_columns):
|
||||
additional_query_columns = ', ' + ', '.join(additional_query_columns)
|
||||
|
||||
conditions = get_conditions(filters)
|
||||
return frappe.db.sql("""select name, posting_date, debit_to, project, customer, customer_name, owner, remarks,
|
||||
return frappe.db.sql("""
|
||||
select name, posting_date, debit_to, project, customer,
|
||||
customer_name, owner, remarks, territory, tax_id, customer_group,
|
||||
base_net_total, base_grand_total, base_rounded_total, outstanding_amount {0}
|
||||
from `tabSales Invoice`
|
||||
where docstatus = 1 %s order by posting_date desc, name desc""".format(additional_query_columns or '') %
|
||||
@@ -241,15 +241,6 @@ def get_invoice_cc_wh_map(invoice_list):
|
||||
|
||||
return invoice_cc_wh_map
|
||||
|
||||
def get_customer_details(customers):
|
||||
customer_map = {}
|
||||
for cust in frappe.db.sql("""select name, territory, customer_group from `tabCustomer`
|
||||
where name in (%s)""" % ", ".join(["%s"]*len(customers)), tuple(customers), as_dict=1):
|
||||
customer_map.setdefault(cust.name, cust)
|
||||
|
||||
return customer_map
|
||||
|
||||
|
||||
def get_mode_of_payments(invoice_list):
|
||||
mode_of_payments = {}
|
||||
if invoice_list:
|
||||
|
||||
@@ -51,7 +51,7 @@ def validate_filters(filters):
|
||||
filters.to_date = filters.year_end_date
|
||||
|
||||
def get_data(filters):
|
||||
accounts = frappe.db.sql("""select name, parent_account, account_name, root_type, report_type, lft, rgt
|
||||
accounts = frappe.db.sql("""select name, account_number, parent_account, account_name, root_type, report_type, lft, rgt
|
||||
from `tabAccount` where company=%s order by lft""", filters.company, as_dict=True)
|
||||
company_currency = erpnext.get_company_currency(filters.company)
|
||||
|
||||
@@ -162,8 +162,6 @@ def calculate_values(accounts, gl_entries_by_account, opening_balances, filters,
|
||||
total_row["credit"] += d["credit"]
|
||||
total_row["opening_debit"] += d["opening_debit"]
|
||||
total_row["opening_credit"] += d["opening_credit"]
|
||||
total_row["closing_debit"] += (d["opening_debit"] + d["debit"])
|
||||
total_row["closing_credit"] += (d["opening_credit"] + d["credit"])
|
||||
|
||||
return total_row
|
||||
|
||||
@@ -176,16 +174,19 @@ def accumulate_values_into_parents(accounts, accounts_by_name):
|
||||
def prepare_data(accounts, filters, total_row, parent_children_map, company_currency):
|
||||
data = []
|
||||
|
||||
total_row["closing_debit"] = total_row["closing_credit"] = 0
|
||||
|
||||
for d in accounts:
|
||||
has_value = False
|
||||
row = {
|
||||
"account_name": d.account_name,
|
||||
"account": d.name,
|
||||
"parent_account": d.parent_account,
|
||||
"indent": d.indent,
|
||||
"from_date": filters.from_date,
|
||||
"to_date": filters.to_date,
|
||||
"currency": company_currency
|
||||
"currency": company_currency,
|
||||
"account_name": ('{} - {}'.format(d.account_number, d.account_name)
|
||||
if d.account_number else d.account_name)
|
||||
}
|
||||
|
||||
prepare_opening_and_closing(d)
|
||||
@@ -200,6 +201,10 @@ def prepare_data(accounts, filters, total_row, parent_children_map, company_curr
|
||||
row["has_value"] = has_value
|
||||
data.append(row)
|
||||
|
||||
if not d.parent_account:
|
||||
total_row["closing_debit"] += (d["debit"] - d["credit"]) if (d["debit"] - d["credit"]) > 0 else 0
|
||||
total_row["closing_credit"] += abs(d["debit"] - d["credit"]) if (d["debit"] - d["credit"]) < 0 else 0
|
||||
|
||||
data.extend([{},total_row])
|
||||
|
||||
return data
|
||||
|
||||
@@ -252,7 +252,7 @@ def add_ac(args=None):
|
||||
if not ac.parent_account:
|
||||
ac.parent_account = args.get("parent")
|
||||
|
||||
if ac.is_root:
|
||||
if getattr(ac, 'is_root', None):
|
||||
ac.parent_account=''
|
||||
|
||||
ac.old_parent = ""
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe.model.document import Document
|
||||
from frappe import _
|
||||
|
||||
class Crop(Document):
|
||||
def validate(self):
|
||||
@@ -12,7 +13,7 @@ class Crop(Document):
|
||||
for task in self.agriculture_task:
|
||||
# validate start_day is not > end_day
|
||||
if task.start_day > task.end_day:
|
||||
frappe.throw("Start day is greater than end day in task '{0}'".format(task.subject))
|
||||
frappe.throw(_("Start day is greater than end day in task '{0}'").format(task.task_name))
|
||||
# to calculate the period of the Crop Cycle
|
||||
if task.end_day > max_period: max_period = task.end_day
|
||||
if max_period > self.period: self.period = max_period
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe.model.document import Document
|
||||
from frappe import _
|
||||
|
||||
class Disease(Document):
|
||||
def validate(self):
|
||||
@@ -12,7 +13,7 @@ class Disease(Document):
|
||||
for task in self.treatment_task:
|
||||
# validate start_day is not > end_day
|
||||
if task.start_day > task.end_day:
|
||||
frappe.throw("Start day is greater than end day in task '{0}'".format(task.task_name))
|
||||
frappe.throw(_("Start day is greater than end day in task '{0}'").format(task.task_name))
|
||||
# to calculate the period of the Crop Cycle
|
||||
if task.end_day > max_period: max_period = task.end_day
|
||||
self.treatment_period = max_period
|
||||
@@ -6,6 +6,7 @@ from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe.model.document import Document
|
||||
from frappe.utils import flt, cint
|
||||
from frappe import _
|
||||
|
||||
class SoilTexture(Document):
|
||||
soil_edit_order = [2, 1, 0]
|
||||
@@ -20,9 +21,9 @@ class SoilTexture(Document):
|
||||
self.update_soil_edit('sand_composition')
|
||||
for soil_type in self.soil_types:
|
||||
if self.get(soil_type) > 100 or self.get(soil_type) < 0:
|
||||
frappe.throw("{0} should be a value between 0 and 100".format(soil_type))
|
||||
frappe.throw(_("{0} should be a value between 0 and 100").format(soil_type))
|
||||
if sum(self.get(soil_type) for soil_type in self.soil_types) != 100:
|
||||
frappe.throw('Soil compositions do not add up to 100')
|
||||
frappe.throw(_('Soil compositions do not add up to 100'))
|
||||
|
||||
def update_soil_edit(self, soil_type):
|
||||
self.soil_edit_order[self.soil_types.index(soil_type)] = max(self.soil_edit_order)+1
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe.model.document import Document
|
||||
from frappe import _
|
||||
|
||||
class WaterAnalysis(Document):
|
||||
def load_contents(self):
|
||||
@@ -18,6 +19,6 @@ class WaterAnalysis(Document):
|
||||
|
||||
def validate(self):
|
||||
if self.collection_datetime > self.laboratory_testing_datetime:
|
||||
frappe.throw('Lab testing datetime cannot be before collection datetime')
|
||||
frappe.throw(_('Lab testing datetime cannot be before collection datetime'))
|
||||
if self.laboratory_testing_datetime > self.result_datetime:
|
||||
frappe.throw('Lab result datetime cannot be before testing datetime')
|
||||
frappe.throw(_('Lab result datetime cannot be before testing datetime'))
|
||||
@@ -23,6 +23,14 @@ frappe.ui.form.on('Asset', {
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
frm.set_query("cost_center", function() {
|
||||
return {
|
||||
"filters": {
|
||||
"company": frm.doc.company,
|
||||
}
|
||||
};
|
||||
});
|
||||
},
|
||||
|
||||
refresh: function(frm) {
|
||||
@@ -59,11 +67,33 @@ frappe.ui.form.on('Asset', {
|
||||
frm.trigger("create_asset_maintenance");
|
||||
}, __("Make"));
|
||||
}
|
||||
|
||||
if (!frm.doc.calculate_depreciation) {
|
||||
frm.add_custom_button(__("Depreciation Entry"), function() {
|
||||
frm.trigger("make_journal_entry");
|
||||
}, __("Make"));
|
||||
}
|
||||
|
||||
frm.page.set_inner_btn_group_as_primary(__("Make"));
|
||||
frm.trigger("setup_chart");
|
||||
}
|
||||
},
|
||||
|
||||
make_journal_entry: function(frm) {
|
||||
frappe.call({
|
||||
method: "erpnext.assets.doctype.asset.asset.make_journal_entry",
|
||||
args: {
|
||||
asset_name: frm.doc.name
|
||||
},
|
||||
callback: function(r) {
|
||||
if (r.message) {
|
||||
var doclist = frappe.model.sync(r.message);
|
||||
frappe.set_route("Form", doclist[0].doctype, doclist[0].name);
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
setup_chart: function(frm) {
|
||||
var x_intervals = [frm.doc.purchase_date];
|
||||
var asset_values = [frm.doc.gross_purchase_amount];
|
||||
|
||||
@@ -415,6 +415,37 @@
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "cost_center",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Cost Center",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Cost Center",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
@@ -1221,7 +1252,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2017-12-19 12:58:44.137460",
|
||||
"modified": "2018-07-17 06:30:25.506194",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Assets",
|
||||
"name": "Asset",
|
||||
|
||||
@@ -51,9 +51,6 @@ class Asset(Document):
|
||||
if not self.get(field):
|
||||
self.set(field, value)
|
||||
|
||||
self.value_after_depreciation = (flt(self.gross_purchase_amount) -
|
||||
flt(self.opening_accumulated_depreciation))
|
||||
|
||||
def validate_asset_values(self):
|
||||
if flt(self.expected_value_after_useful_life) >= flt(self.gross_purchase_amount):
|
||||
frappe.throw(_("Expected Value After Useful Life must be less than Gross Purchase Amount"))
|
||||
@@ -61,7 +58,10 @@ class Asset(Document):
|
||||
if not flt(self.gross_purchase_amount):
|
||||
frappe.throw(_("Gross Purchase Amount is mandatory"), frappe.MandatoryError)
|
||||
|
||||
if not self.is_existing_asset and self.calculate_depreciation:
|
||||
if not self.calculate_depreciation:
|
||||
return
|
||||
|
||||
if not self.is_existing_asset:
|
||||
self.opening_accumulated_depreciation = 0
|
||||
self.number_of_depreciations_booked = 0
|
||||
if not self.next_depreciation_date:
|
||||
@@ -81,6 +81,9 @@ class Asset(Document):
|
||||
if cint(self.number_of_depreciations_booked) > cint(self.total_number_of_depreciations):
|
||||
frappe.throw(_("Number of Depreciations Booked cannot be greater than Total Number of Depreciations"))
|
||||
|
||||
self.value_after_depreciation = (flt(self.gross_purchase_amount) -
|
||||
flt(self.opening_accumulated_depreciation))
|
||||
|
||||
if self.next_depreciation_date and getdate(self.next_depreciation_date) < getdate(nowdate()):
|
||||
frappe.msgprint(_("Next Depreciation Date is entered as past date"), title=_('Warning'), indicator='red')
|
||||
|
||||
@@ -106,12 +109,13 @@ class Asset(Document):
|
||||
n * cint(self.frequency_of_depreciation))
|
||||
|
||||
depreciation_amount = self.get_depreciation_amount(value_after_depreciation)
|
||||
value_after_depreciation -= flt(depreciation_amount)
|
||||
if depreciation_amount:
|
||||
value_after_depreciation -= flt(depreciation_amount)
|
||||
|
||||
self.append("schedules", {
|
||||
"schedule_date": schedule_date,
|
||||
"depreciation_amount": depreciation_amount
|
||||
})
|
||||
self.append("schedules", {
|
||||
"schedule_date": schedule_date,
|
||||
"depreciation_amount": depreciation_amount
|
||||
})
|
||||
|
||||
def set_accumulated_depreciation(self):
|
||||
accumulated_depreciation = flt(self.opening_accumulated_depreciation)
|
||||
@@ -279,3 +283,34 @@ def get_item_details(item_code):
|
||||
})
|
||||
|
||||
return ret
|
||||
|
||||
@frappe.whitelist()
|
||||
def make_journal_entry(asset_name):
|
||||
asset = frappe.get_doc("Asset", asset_name)
|
||||
fixed_asset_account, accumulated_depreciation_account, depreciation_expense_account = \
|
||||
get_depreciation_accounts(asset)
|
||||
|
||||
depreciation_cost_center, depreciation_series = frappe.db.get_value("Company", asset.company,
|
||||
["depreciation_cost_center", "series_for_depreciation_entry"])
|
||||
depreciation_cost_center = asset.cost_center or depreciation_cost_center
|
||||
|
||||
je = frappe.new_doc("Journal Entry")
|
||||
je.voucher_type = "Depreciation Entry"
|
||||
je.naming_series = depreciation_series
|
||||
je.company = asset.company
|
||||
je.remark = "Depreciation Entry against asset {0}".format(asset_name)
|
||||
|
||||
je.append("accounts", {
|
||||
"account": depreciation_expense_account,
|
||||
"reference_type": "Asset",
|
||||
"reference_name": asset.name,
|
||||
"cost_center": depreciation_cost_center
|
||||
})
|
||||
|
||||
je.append("accounts", {
|
||||
"account": accumulated_depreciation_account,
|
||||
"reference_type": "Asset",
|
||||
"reference_name": asset.name
|
||||
})
|
||||
|
||||
return je
|
||||
@@ -5,13 +5,13 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe import _
|
||||
from frappe.utils import flt, today, getdate
|
||||
from frappe.utils import flt, today, getdate, cint
|
||||
|
||||
def post_depreciation_entries(date=None):
|
||||
# Return if automatic booking of asset depreciation is disabled
|
||||
if not frappe.db.get_value("Accounts Settings", None, "book_asset_depreciation_entry_automatically"):
|
||||
if not cint(frappe.db.get_value("Accounts Settings", None, "book_asset_depreciation_entry_automatically")):
|
||||
return
|
||||
|
||||
|
||||
if not date:
|
||||
date = today()
|
||||
for asset in get_depreciable_assets(date):
|
||||
@@ -38,7 +38,7 @@ def make_depreciation_entry(asset_name, date=None):
|
||||
|
||||
depreciation_cost_center, depreciation_series = frappe.db.get_value("Company", asset.company,
|
||||
["depreciation_cost_center", "series_for_depreciation_entry"])
|
||||
|
||||
depreciation_cost_center = asset.cost_center or depreciation_cost_center
|
||||
|
||||
for d in asset.get("schedules"):
|
||||
if not d.journal_entry and getdate(d.schedule_date) <= getdate(date):
|
||||
@@ -151,13 +151,12 @@ def restore_asset(asset_name):
|
||||
asset.set_status()
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_gl_entries_on_asset_disposal(asset, is_sale=False):
|
||||
def get_gl_entries_on_asset_disposal(asset, selling_amount=0):
|
||||
fixed_asset_account, accumulated_depr_account, depr_expense_account = get_depreciation_accounts(asset)
|
||||
accumulated_depr_amount = flt(asset.gross_purchase_amount) - flt(asset.value_after_depreciation)
|
||||
disposal_account, depreciation_cost_center = get_disposal_account_and_cost_center(asset.company)
|
||||
depreciation_cost_center = asset.cost_center or depreciation_cost_center
|
||||
|
||||
expense_account, cost_center = get_disposal_account_and_cost_center(asset.company)
|
||||
if is_sale:
|
||||
expense_account = depr_expense_account
|
||||
accumulated_depr_amount = flt(asset.gross_purchase_amount) - flt(asset.value_after_depreciation)
|
||||
|
||||
gl_entries = [
|
||||
{
|
||||
@@ -172,12 +171,14 @@ def get_gl_entries_on_asset_disposal(asset, is_sale=False):
|
||||
}
|
||||
]
|
||||
|
||||
if flt(asset.value_after_depreciation):
|
||||
profit_amount = flt(selling_amount) - flt(asset.value_after_depreciation)
|
||||
if profit_amount:
|
||||
debit_or_credit = "debit" if profit_amount < 0 else "credit"
|
||||
gl_entries.append({
|
||||
"account": expense_account,
|
||||
"cost_center": cost_center,
|
||||
"debit": flt(asset.value_after_depreciation),
|
||||
"debit_in_account_currency": flt(asset.value_after_depreciation)
|
||||
"account": disposal_account,
|
||||
"cost_center": depreciation_cost_center,
|
||||
debit_or_credit: abs(profit_amount),
|
||||
debit_or_credit + "_in_account_currency": abs(profit_amount)
|
||||
})
|
||||
|
||||
return gl_entries
|
||||
|
||||
@@ -234,9 +234,8 @@ class TestAsset(unittest.TestCase):
|
||||
|
||||
expected_gle = (
|
||||
("_Test Accumulated Depreciations - _TC", 30000.0, 0.0),
|
||||
("_Test Depreciations - _TC", 70000.0, 0.0),
|
||||
("_Test Fixed Asset - _TC", 0.0, 100000.0),
|
||||
("_Test Gain/Loss on Asset Disposal - _TC", 0.0, 25000.0),
|
||||
("_Test Gain/Loss on Asset Disposal - _TC", 45000.0, 0.0),
|
||||
("Debtors - _TC", 25000.0, 0.0)
|
||||
)
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ frappe.ui.form.on('Asset Category', {
|
||||
var d = locals[cdt][cdn];
|
||||
return {
|
||||
"filters": {
|
||||
"root_type": "Asset",
|
||||
"account_type": "Accumulated Depreciation",
|
||||
"is_group": 0,
|
||||
"company": d.company_name
|
||||
}
|
||||
@@ -41,4 +41,4 @@ frappe.ui.form.on('Asset Category', {
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"allow_guest_to_view": 0,
|
||||
"allow_import": 0,
|
||||
"allow_rename": 0,
|
||||
"autoname": "field:maintenance_task",
|
||||
"autoname": "",
|
||||
"beta": 0,
|
||||
"creation": "2017-10-20 07:10:55.903571",
|
||||
"custom": 0,
|
||||
@@ -42,7 +42,7 @@
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 1
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
@@ -625,7 +625,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 1,
|
||||
"max_attachments": 0,
|
||||
"modified": "2017-11-28 12:22:34.151430",
|
||||
"modified": "2018-06-18 16:12:04.330021",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Assets",
|
||||
"name": "Asset Maintenance Task",
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user