mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-18 04:12:37 +00:00
Compare commits
1140 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
47e786ef62 | ||
|
|
f10be395c1 | ||
|
|
14018b3dea | ||
|
|
91f2cfb999 | ||
|
|
c0a0331570 | ||
|
|
4ceba43e43 | ||
|
|
5d2ad7fc38 | ||
|
|
3347473aa1 | ||
|
|
7f951b5595 | ||
|
|
e0912e4fcc | ||
|
|
4d12f8acab | ||
|
|
c856cb85d9 | ||
|
|
35e8d1e1d7 | ||
|
|
cd3976f7d2 | ||
|
|
f37a46edea | ||
|
|
fa42999314 | ||
|
|
7af153da50 | ||
|
|
150c44b350 | ||
|
|
225d38e797 | ||
|
|
a831848074 | ||
|
|
eed30c6d8c | ||
|
|
9db9edca2c | ||
|
|
3f854fce2e | ||
|
|
a998978415 | ||
|
|
87c6718d90 | ||
|
|
d995609ffa | ||
|
|
6424416886 | ||
|
|
28a7ce9a50 | ||
|
|
16f6ca12a7 | ||
|
|
c74c5d5644 | ||
|
|
0a23e1aea5 | ||
|
|
74bbcb539f | ||
|
|
f1e6387fab | ||
|
|
d545f6fb6b | ||
|
|
cf55c9c6da | ||
|
|
c9e8a1bf96 | ||
|
|
e942f99897 | ||
|
|
ec082754b4 | ||
|
|
d69d0e3046 | ||
|
|
fc3b924d4d | ||
|
|
5503b6cff5 | ||
|
|
73616d6b33 | ||
|
|
95a6320459 | ||
|
|
1ad2d4a962 | ||
|
|
9ffa9d4a64 | ||
|
|
af7fe1937e | ||
|
|
3e515e704d | ||
|
|
94565d69d1 | ||
|
|
732d6afad5 | ||
|
|
d064505ebe | ||
|
|
ba8fc21594 | ||
|
|
3a72cb46bc | ||
|
|
082bfb8cb3 | ||
|
|
5ea4328359 | ||
|
|
4d27b50437 | ||
|
|
ffbfaf7099 | ||
|
|
06c8129574 | ||
|
|
d00c59830e | ||
|
|
010714757c | ||
|
|
4fa6194009 | ||
|
|
29a2e16f62 | ||
|
|
3cc3b57926 | ||
|
|
2689acfc8e | ||
|
|
39152f935c | ||
|
|
001ee5ee1b | ||
|
|
a227b9a9a6 | ||
|
|
8b2223ae5f | ||
|
|
f997b443e1 | ||
|
|
4c7ac65db1 | ||
|
|
88de00fb94 | ||
|
|
06c6f7cfd3 | ||
|
|
d3ed499854 | ||
|
|
32936024a0 | ||
|
|
8bd2d4d35e | ||
|
|
df75b7693a | ||
|
|
2f44480d69 | ||
|
|
090f9a3dc9 | ||
|
|
b81942404d | ||
|
|
d36c6068b2 | ||
|
|
e93dc9f1cd | ||
|
|
7a23057eab | ||
|
|
7aef9f3b43 | ||
|
|
a839510b33 | ||
|
|
62fbf37eb4 | ||
|
|
4a6c723310 | ||
|
|
015285c42f | ||
|
|
b455318f01 | ||
|
|
628701f1a5 | ||
|
|
bac50bc295 | ||
|
|
28c6a0aeb1 | ||
|
|
15382a6f71 | ||
|
|
52d888de42 | ||
|
|
e37a67245e | ||
|
|
1c44bb0982 | ||
|
|
36520ef951 | ||
|
|
edba06038e | ||
|
|
a5776d16b4 | ||
|
|
7508896bfb | ||
|
|
a709ae894c | ||
|
|
02b9472152 | ||
|
|
1beed7db72 | ||
|
|
d743583bf4 | ||
|
|
0c12eded05 | ||
|
|
f67833f249 | ||
|
|
6a50c92087 | ||
|
|
e123ec6b45 | ||
|
|
01c19d3b93 | ||
|
|
dec5bead9c | ||
|
|
f527713b89 | ||
|
|
57f2dce682 | ||
|
|
730c8a145d | ||
|
|
167aa7655d | ||
|
|
05710804cf | ||
|
|
50b6976c67 | ||
|
|
7e2b030052 | ||
|
|
7091a2102c | ||
|
|
b565e9ba64 | ||
|
|
475d8e3cdc | ||
|
|
0bcf8b64f6 | ||
|
|
1bb5d01192 | ||
|
|
ebf46120ba | ||
|
|
c82aed0718 | ||
|
|
9378aacbe5 | ||
|
|
3cbd70a1d9 | ||
|
|
2ec7acb592 | ||
|
|
28710cdf99 | ||
|
|
45c18b3184 | ||
|
|
519ca54f53 | ||
|
|
77e4cf89f8 | ||
|
|
4a1d000c33 | ||
|
|
81c217584a | ||
|
|
a11e738801 | ||
|
|
7e9b90ad06 | ||
|
|
450da16dc2 | ||
|
|
139c20a736 | ||
|
|
1e754b161c | ||
|
|
8ed6772727 | ||
|
|
ad04d442a1 | ||
|
|
99c8245512 | ||
|
|
6bd6039496 | ||
|
|
c02cb6ca94 | ||
|
|
1545ee914a | ||
|
|
7b6ab9738d | ||
|
|
d8b64cd199 | ||
|
|
2e01573a40 | ||
|
|
fac4eb919b | ||
|
|
e0348c9ec8 | ||
|
|
66e5e16a2e | ||
|
|
d38f5374cb | ||
|
|
83c7b5b44b | ||
|
|
7638788c2f | ||
|
|
486a8f67a4 | ||
|
|
5c9d92eabf | ||
|
|
afa03fd654 | ||
|
|
d8abac3278 | ||
|
|
c8333d4b41 | ||
|
|
07b74533fe | ||
|
|
e127d937f7 | ||
|
|
da5bf5a7c4 | ||
|
|
be5c6e7aec | ||
|
|
0f0d6ce25c | ||
|
|
d0003408c4 | ||
|
|
846c03889e | ||
|
|
d2d0100c9a | ||
|
|
abbc08cb48 | ||
|
|
2a72d1fee4 | ||
|
|
b051fa37df | ||
|
|
bcf107b9f7 | ||
|
|
118f2c7d64 | ||
|
|
702f9f929b | ||
|
|
4f7885f1aa | ||
|
|
3270ba6d8c | ||
|
|
8728e94dbd | ||
|
|
379f38e1cd | ||
|
|
fba7cae2c9 | ||
|
|
88d2c97391 | ||
|
|
07b908c0c5 | ||
|
|
3dbef9de74 | ||
|
|
8916916a03 | ||
|
|
9942fcc8cb | ||
|
|
83b58352ce | ||
|
|
a8358f0342 | ||
|
|
8e7bb002e2 | ||
|
|
5e14660dda | ||
|
|
53794a9029 | ||
|
|
0c0604b7ee | ||
|
|
e6f86c934d | ||
|
|
07ae3abf34 | ||
|
|
970788c64e | ||
|
|
ce5200d700 | ||
|
|
9f483c1fa9 | ||
|
|
213785e6d5 | ||
|
|
8f67ef8a75 | ||
|
|
09a6868ccd | ||
|
|
e1f95c0529 | ||
|
|
8c1b88f156 | ||
|
|
7bdc612013 | ||
|
|
6d9a300a85 | ||
|
|
758635ab91 | ||
|
|
233c0bc779 | ||
|
|
5d0362669d | ||
|
|
1da236fdd2 | ||
|
|
962f4eb96c | ||
|
|
d5166861de | ||
|
|
d9e27b727f | ||
|
|
275f3f8b91 | ||
|
|
3f96306986 | ||
|
|
5ff377e2bb | ||
|
|
799f8d4f93 | ||
|
|
36c97c3128 | ||
|
|
453ad3c155 | ||
|
|
85c028b60d | ||
|
|
ee5f0f7c30 | ||
|
|
8522fdc99c | ||
|
|
2f63529029 | ||
|
|
e89d4e2b7f | ||
|
|
bd6b1806cd | ||
|
|
d8ddd1e2ec | ||
|
|
b5bd3f3abf | ||
|
|
ce77c4ac4c | ||
|
|
22bc0a929b | ||
|
|
bebbc6371b | ||
|
|
d583e412c9 | ||
|
|
bdc899857c | ||
|
|
b7e9e2a1a5 | ||
|
|
eaff541349 | ||
|
|
a324be86d2 | ||
|
|
e22ca23b81 | ||
|
|
ed8e3b3786 | ||
|
|
974f04be24 | ||
|
|
ad71307a5e | ||
|
|
ce5c2d8682 | ||
|
|
cdebd400ec | ||
|
|
48eff90d1f | ||
|
|
c58d7d8a98 | ||
|
|
fbae893f07 | ||
|
|
432b03572a | ||
|
|
4f4e490d53 | ||
|
|
dfc10bb5ae | ||
|
|
dd893254be | ||
|
|
f2d37a7280 | ||
|
|
8232bd01d6 | ||
|
|
49a46f08de | ||
|
|
75c5c89909 | ||
|
|
cdf15222e1 | ||
|
|
6208755d54 | ||
|
|
4821f38d25 | ||
|
|
717ad388be | ||
|
|
dc694597f0 | ||
|
|
9474b90fda | ||
|
|
721c381df3 | ||
|
|
305ec78c93 | ||
|
|
737ec6b26e | ||
|
|
871193eb62 | ||
|
|
02279dff31 | ||
|
|
43b22b4473 | ||
|
|
c8d9a5305b | ||
|
|
06ace23a32 | ||
|
|
979b042675 | ||
|
|
0d7359a826 | ||
|
|
55eff16760 | ||
|
|
dcb9c2031b | ||
|
|
d02b026a4d | ||
|
|
8750caa8e3 | ||
|
|
83740de636 | ||
|
|
d389ee457c | ||
|
|
a77f534f7c | ||
|
|
5f4b6d267c | ||
|
|
7084f07dab | ||
|
|
1675181e49 | ||
|
|
01f8a4966a | ||
|
|
c41e44d964 | ||
|
|
a32618dff4 | ||
|
|
8aa0a280b2 | ||
|
|
3db65ef7e8 | ||
|
|
441720df75 | ||
|
|
c269c68727 | ||
|
|
3af9ea8d7d | ||
|
|
e2bb950012 | ||
|
|
a20fb650fe | ||
|
|
f935e37925 | ||
|
|
66072fec5a | ||
|
|
19070621af | ||
|
|
a113861b0c | ||
|
|
cf24191fe5 | ||
|
|
74dc3c99de | ||
|
|
0bb99c15e5 | ||
|
|
adc1529567 | ||
|
|
3f2c5c2319 | ||
|
|
683a89a415 | ||
|
|
4ed9b45fb8 | ||
|
|
86870b0aa6 | ||
|
|
a0c162c2d6 | ||
|
|
8e937e9640 | ||
|
|
66762380ed | ||
|
|
1d781f13b2 | ||
|
|
29a5756f87 | ||
|
|
285344eb0e | ||
|
|
f067447d9c | ||
|
|
39d9cbc43d | ||
|
|
2d064ee67a | ||
|
|
eba3a8e802 | ||
|
|
0fde204074 | ||
|
|
a54b7542f1 | ||
|
|
d8cbbc7d65 | ||
|
|
6c8fe5ae02 | ||
|
|
9cf818d347 | ||
|
|
a1de447662 | ||
|
|
a6e53410b0 | ||
|
|
4494d46020 | ||
|
|
95161a0df4 | ||
|
|
ccad0a4cf9 | ||
|
|
c10064ae2c | ||
|
|
38ac7f7350 | ||
|
|
a00c98bea7 | ||
|
|
3cc41634c5 | ||
|
|
d5e9cd72df | ||
|
|
75397b441f | ||
|
|
fe5890b828 | ||
|
|
817443c5dd | ||
|
|
16b8e7c432 | ||
|
|
01aca675ef | ||
|
|
484e1fb218 | ||
|
|
2caf32d421 | ||
|
|
d5067b4d73 | ||
|
|
41a6548acb | ||
|
|
ba2faecdc7 | ||
|
|
8b741cfefb | ||
|
|
894604201b | ||
|
|
9351313186 | ||
|
|
ea70c6f696 | ||
|
|
4723da0251 | ||
|
|
f4245a2d9c | ||
|
|
be8f6f0d65 | ||
|
|
045ca33692 | ||
|
|
91c17a6f14 | ||
|
|
c18b54fc08 | ||
|
|
c5a6e9da15 | ||
|
|
80ed98c87a | ||
|
|
2985cffc52 | ||
|
|
2935751f75 | ||
|
|
23c916c0d6 | ||
|
|
509dcd9ad0 | ||
|
|
039679cad1 | ||
|
|
5dfc74c851 | ||
|
|
9d26c69c4a | ||
|
|
20194c4cc5 | ||
|
|
d463c346fe | ||
|
|
25e043766a | ||
|
|
905573700b | ||
|
|
37f4316df0 | ||
|
|
de15cc1387 | ||
|
|
8d889ef80e | ||
|
|
b54f0fb388 | ||
|
|
1da81d8755 | ||
|
|
b093ea1f0a | ||
|
|
ed1cc18ab5 | ||
|
|
147af15268 | ||
|
|
1f512b36c5 | ||
|
|
ebc0e1ca8a | ||
|
|
bf09fbe6b9 | ||
|
|
5c036d9aaf | ||
|
|
5aa8743024 | ||
|
|
c6b7695ab5 | ||
|
|
c8ad8bb7aa | ||
|
|
09f4e0b19c | ||
|
|
a9aac02b90 | ||
|
|
e64bdcd12b | ||
|
|
f380b215b2 | ||
|
|
201bcaf2ca | ||
|
|
7d6f52f4ab | ||
|
|
d8763d7d65 | ||
|
|
46831c4c20 | ||
|
|
32b587b3a0 | ||
|
|
21abc3aa50 | ||
|
|
4c3f0b94a4 | ||
|
|
fcb6edf571 | ||
|
|
d23c9987ed | ||
|
|
60b852bb12 | ||
|
|
c86cdd609e | ||
|
|
91aa671a23 | ||
|
|
6bd4509923 | ||
|
|
34326470b8 | ||
|
|
38794c0ca1 | ||
|
|
b874922404 | ||
|
|
296bf9ef42 | ||
|
|
7b1b3f0fa8 | ||
|
|
3564ac7c88 | ||
|
|
5ef26b42a8 | ||
|
|
6edce82aef | ||
|
|
e19e16fbf1 | ||
|
|
2a10b02c68 | ||
|
|
25ab1e41df | ||
|
|
77f22635f2 | ||
|
|
119c976ad1 | ||
|
|
8f7ed71e9e | ||
|
|
83b0b2adec | ||
|
|
9a8549a361 | ||
|
|
a01ebe0a54 | ||
|
|
001edb4464 | ||
|
|
a9ff4f6688 | ||
|
|
d095acdad5 | ||
|
|
8781dc8ca3 | ||
|
|
f82ea857a0 | ||
|
|
54becbb33a | ||
|
|
a877115ff4 | ||
|
|
e7f67592a8 | ||
|
|
ed004018d6 | ||
|
|
d138633c5b | ||
|
|
23d7b09389 | ||
|
|
132323462c | ||
|
|
2064dfc5a9 | ||
|
|
1e6e1dd451 | ||
|
|
c6b548b5b2 | ||
|
|
fed5788c50 | ||
|
|
824376a045 | ||
|
|
451d1a1744 | ||
|
|
c15cc8fc28 | ||
|
|
6211a5bc3b | ||
|
|
946f68f7f0 | ||
|
|
e9affd97ac | ||
|
|
3f1444e410 | ||
|
|
3bd15d3aaa | ||
|
|
a51a304cf0 | ||
|
|
786d7bd3d4 | ||
|
|
d9e9d562f8 | ||
|
|
2e7419d78f | ||
|
|
fdad33309b | ||
|
|
5a61880e6a | ||
|
|
5dcf2c669f | ||
|
|
8dd4699f10 | ||
|
|
e18f7b91c3 | ||
|
|
2c60f6419e | ||
|
|
462d9cb331 | ||
|
|
a44e8afe71 | ||
|
|
5888efbb4e | ||
|
|
0c665e5638 | ||
|
|
1f9a84f165 | ||
|
|
30f3354a7a | ||
|
|
c16fb9eb9d | ||
|
|
6bbc834f8f | ||
|
|
8590112faa | ||
|
|
6daab3ca89 | ||
|
|
51eabfe352 | ||
|
|
231472bc20 | ||
|
|
68a4c70b72 | ||
|
|
28d182af15 | ||
|
|
8a097c8627 | ||
|
|
1ba83427e5 | ||
|
|
cef75a5987 | ||
|
|
d793e39b6d | ||
|
|
b9c1dad2e6 | ||
|
|
aeaf416d6d | ||
|
|
780fb8a4e5 | ||
|
|
d019d28bc9 | ||
|
|
50e591b815 | ||
|
|
4f96ec1b6c | ||
|
|
0816c0bd5e | ||
|
|
c1930fa64d | ||
|
|
9e4f674fb9 | ||
|
|
627a3dcd6d | ||
|
|
af2eac4334 | ||
|
|
f9069a9873 | ||
|
|
7563bdf6f8 | ||
|
|
ad5fc07652 | ||
|
|
6b9b92afb0 | ||
|
|
094612dc02 | ||
|
|
4fe67236ed | ||
|
|
c5c3860c5c | ||
|
|
6de526ff42 | ||
|
|
5d41e3848d | ||
|
|
abd434f656 | ||
|
|
bc001d2d9a | ||
|
|
b50b5095ad | ||
|
|
bac4b93639 | ||
|
|
76df782006 | ||
|
|
dce04b7335 | ||
|
|
7e8e4783a1 | ||
|
|
bb5f99a34d | ||
|
|
40c5bf9e94 | ||
|
|
8beca68948 | ||
|
|
2818b5bbe7 | ||
|
|
8cc2f83bd5 | ||
|
|
57835f0a37 | ||
|
|
72dcb51177 | ||
|
|
a2a9b39794 | ||
|
|
c2a9b14c96 | ||
|
|
4432a874de | ||
|
|
74fdfff5b5 | ||
|
|
87000977d5 | ||
|
|
a9435cc6b0 | ||
|
|
5bd8562b5a | ||
|
|
4a323463f7 | ||
|
|
9c3fd8dbc3 | ||
|
|
3d433efdfe | ||
|
|
93a9c08116 | ||
|
|
b3c732daf5 | ||
|
|
f8899827e0 | ||
|
|
6996c2d17d | ||
|
|
755020843b | ||
|
|
72949e7f73 | ||
|
|
e4f8bda1ea | ||
|
|
cdce6c746f | ||
|
|
d51f7af9ab | ||
|
|
3b0ec48b0c | ||
|
|
a5dfe0725f | ||
|
|
a3095c987a | ||
|
|
a656151ee9 | ||
|
|
504e52ff46 | ||
|
|
b1604a24ed | ||
|
|
e3ef56804c | ||
|
|
cd38ba4833 | ||
|
|
1d1858a8b0 | ||
|
|
ff09b412f4 | ||
|
|
7bcb24efbf | ||
|
|
bb736248a2 | ||
|
|
e919388ee6 | ||
|
|
358a01a226 | ||
|
|
bf7e012bde | ||
|
|
a035428d43 | ||
|
|
d2315e5c5c | ||
|
|
a2fd1f22da | ||
|
|
bcda12f4bb | ||
|
|
e851346b4c | ||
|
|
88e8688a4b | ||
|
|
0254217314 | ||
|
|
1853a83453 | ||
|
|
d312d11062 | ||
|
|
69aeff15ef | ||
|
|
89d3bc0b54 | ||
|
|
cbcede79b1 | ||
|
|
32eccb8fb2 | ||
|
|
632fc6af79 | ||
|
|
f43825e4dd | ||
|
|
5f59c2ae75 | ||
|
|
fd312be79f | ||
|
|
fb7c7b53ba | ||
|
|
d2f22b52a5 | ||
|
|
ffc4f8f2a5 | ||
|
|
cdcff6c26d | ||
|
|
e352fb754b | ||
|
|
5ae40a9500 | ||
|
|
40dbb63042 | ||
|
|
594918bd3a | ||
|
|
5343631708 | ||
|
|
366451fc62 | ||
|
|
a14ee7f1fe | ||
|
|
c5588a9b93 | ||
|
|
21a4f82f69 | ||
|
|
3b366c30a8 | ||
|
|
8e67a3a8a8 | ||
|
|
4726fc4893 | ||
|
|
c69cc13c85 | ||
|
|
ddfbb07c3b | ||
|
|
d30f87bbdf | ||
|
|
4ce38059ac | ||
|
|
bbc1b5cdcf | ||
|
|
ac0c1edd23 | ||
|
|
a93b665427 | ||
|
|
ede7050afe | ||
|
|
0906bc8430 | ||
|
|
ac2b5ed84f | ||
|
|
b847731482 | ||
|
|
b5bd91417d | ||
|
|
6298da4458 | ||
|
|
cffe577028 | ||
|
|
48d1463825 | ||
|
|
c257ce82c5 | ||
|
|
867ac10ffd | ||
|
|
d114c8f88f | ||
|
|
1d1427de60 | ||
|
|
91596f2467 | ||
|
|
a7d448dcba | ||
|
|
77da3b4347 | ||
|
|
9d77e9f719 | ||
|
|
c901d6322c | ||
|
|
7496548c39 | ||
|
|
f1fab871b8 | ||
|
|
5aaf15d145 | ||
|
|
16a7ec95dc | ||
|
|
607a21e02a | ||
|
|
b03fa8a441 | ||
|
|
f4fde51bba | ||
|
|
c78c86663d | ||
|
|
7834a0182b | ||
|
|
1e0b0da7ad | ||
|
|
a2db94761a | ||
|
|
805b8634da | ||
|
|
1635967c4e | ||
|
|
a5907e17d5 | ||
|
|
0252c1478e | ||
|
|
f5bece1afa | ||
|
|
e46c56bfe8 | ||
|
|
561a2e966e | ||
|
|
a9b0c55bcb | ||
|
|
93bad51659 | ||
|
|
1e2dc2c8f1 | ||
|
|
2691991d9a | ||
|
|
e8b1c82531 | ||
|
|
67e4186360 | ||
|
|
3f8f8d36b7 | ||
|
|
a70e2bdbc9 | ||
|
|
1ab75db0ac | ||
|
|
e85c320501 | ||
|
|
cb44f3a7c3 | ||
|
|
c174e4d01a | ||
|
|
7fa3f3fe98 | ||
|
|
4bcc221ee3 | ||
|
|
cf901da25d | ||
|
|
496f8e966f | ||
|
|
4dd8895133 | ||
|
|
8666ecc26f | ||
|
|
152360d999 | ||
|
|
e7c7a0e648 | ||
|
|
4d553b7a84 | ||
|
|
fffdb6f575 | ||
|
|
063144c514 | ||
|
|
402d82b4c5 | ||
|
|
711d1acffd | ||
|
|
81472e4c08 | ||
|
|
b8f23c2657 | ||
|
|
f33dfc2121 | ||
|
|
e26b55265f | ||
|
|
26dfd5b314 | ||
|
|
e31c6964f3 | ||
|
|
fd85b1689d | ||
|
|
4a8710ef75 | ||
|
|
58e6b67886 | ||
|
|
f268562256 | ||
|
|
86720deeae | ||
|
|
ae587dbd83 | ||
|
|
72bea0dff4 | ||
|
|
736b5e07cc | ||
|
|
ca58fde552 | ||
|
|
bb3cec1556 | ||
|
|
42d0da8f5a | ||
|
|
dbc69da409 | ||
|
|
e3bb247868 | ||
|
|
f856b3b559 | ||
|
|
89433b4bea | ||
|
|
bcfec77e2c | ||
|
|
744b92d233 | ||
|
|
0eed0a9abe | ||
|
|
b3e5d11e1d | ||
|
|
0df38891a1 | ||
|
|
f75481fa23 | ||
|
|
5e84ce55ae | ||
|
|
effe53d4ae | ||
|
|
88885184dc | ||
|
|
9641edc562 | ||
|
|
9b42682575 | ||
|
|
dcd5be0d07 | ||
|
|
c059bc3e36 | ||
|
|
52c61904c8 | ||
|
|
a6ab00162e | ||
|
|
9e4282e130 | ||
|
|
13c7e183a6 | ||
|
|
5755d2d32f | ||
|
|
79525327f0 | ||
|
|
3e11338ed5 | ||
|
|
233ee277ef | ||
|
|
36b30911a8 | ||
|
|
acd00df8fb | ||
|
|
ed1ec82d2f | ||
|
|
232b5dab81 | ||
|
|
dbe8dab3ce | ||
|
|
f5b2db76cb | ||
|
|
1c29c520bd | ||
|
|
2f322609d7 | ||
|
|
74c7b04b29 | ||
|
|
c20e66e0be | ||
|
|
445a93e5f5 | ||
|
|
66f2bc69a6 | ||
|
|
55a2699f4c | ||
|
|
354d0af44e | ||
|
|
f455c92d02 | ||
|
|
b654dc0e28 | ||
|
|
d03d8204ab | ||
|
|
1707c3da95 | ||
|
|
b606d4d2ad | ||
|
|
9fa5dbd6e4 | ||
|
|
1cf7270049 | ||
|
|
be0ae7a430 | ||
|
|
0aeccbf4b2 | ||
|
|
8f32ac0edd | ||
|
|
a5b78f3c0d | ||
|
|
671c20ec56 | ||
|
|
17d3de1821 | ||
|
|
cfec328c74 | ||
|
|
c5e0838890 | ||
|
|
974ac3e6ad | ||
|
|
dc675b1eb0 | ||
|
|
9057239c3c | ||
|
|
d6be8989e4 | ||
|
|
8ac2a2f0c4 | ||
|
|
1c538b9b43 | ||
|
|
ba6fe6cde5 | ||
|
|
7243e774c2 | ||
|
|
db3bb793e9 | ||
|
|
8de8a78235 | ||
|
|
5dd1b50802 | ||
|
|
00f9930fbf | ||
|
|
457da47dba | ||
|
|
2b9e256002 | ||
|
|
a1aa85712b | ||
|
|
05f243590d | ||
|
|
94d7096c8c | ||
|
|
ecc801d3d8 | ||
|
|
be9f4ea487 | ||
|
|
a1dc152695 | ||
|
|
9209570937 | ||
|
|
d8c262fd5c | ||
|
|
fe579c2efd | ||
|
|
d94a389dd3 | ||
|
|
98b86ecbc2 | ||
|
|
dc0fb08ec7 | ||
|
|
a7ab51c5ba | ||
|
|
59432418c6 | ||
|
|
6e7b9b5cb7 | ||
|
|
8b4d604cfd | ||
|
|
4affe4b939 | ||
|
|
c890401fec | ||
|
|
7f94a58bf1 | ||
|
|
f3d78dd29c | ||
|
|
23b5f4ec99 | ||
|
|
bdfd69a2fe | ||
|
|
56d03a456b | ||
|
|
680e098b87 | ||
|
|
db88476f8b | ||
|
|
88ee7d8dbe | ||
|
|
6689ed543a | ||
|
|
f2798eab50 | ||
|
|
210317c0b5 | ||
|
|
362c89ca73 | ||
|
|
687b1a5b1f | ||
|
|
8d55f81baa | ||
|
|
7ff82fccf3 | ||
|
|
cd25d6dc7f | ||
|
|
c1f25ff9e3 | ||
|
|
447134d308 | ||
|
|
224d857928 | ||
|
|
a23fc327df | ||
|
|
ec92486377 | ||
|
|
a6c6e02c49 | ||
|
|
298d38cde3 | ||
|
|
81f20891c1 | ||
|
|
109a07b834 | ||
|
|
5619db28cb | ||
|
|
bcb0f6038e | ||
|
|
e9e0c0e7d4 | ||
|
|
e84de50147 | ||
|
|
c6e02e2a74 | ||
|
|
ea97a6cb5b | ||
|
|
da2a623e38 | ||
|
|
6affeaa9c1 | ||
|
|
d79a16c9f3 | ||
|
|
d36ff39498 | ||
|
|
9f4dc3fcd4 | ||
|
|
128f5dbff1 | ||
|
|
576f51d89e | ||
|
|
eab5be1110 | ||
|
|
c9b6c9bb61 | ||
|
|
6d549b03f1 | ||
|
|
128db172f0 | ||
|
|
dd63b656c7 | ||
|
|
5f2c030ddc | ||
|
|
9e6abc4948 | ||
|
|
cb38cc96c3 | ||
|
|
79414a8d36 | ||
|
|
5cdda19494 | ||
|
|
16dda1a991 | ||
|
|
5124b2806d | ||
|
|
060ff62178 | ||
|
|
1a090432d9 | ||
|
|
a251267dd7 | ||
|
|
9ef7d5edaf | ||
|
|
5d3dee206f | ||
|
|
1583925080 | ||
|
|
becb89213f | ||
|
|
1008e6e450 | ||
|
|
09ddc84c3a | ||
|
|
33b392ac2b | ||
|
|
3965451c7a | ||
|
|
0487ad5515 | ||
|
|
e2acc748c8 | ||
|
|
4645727163 | ||
|
|
7d288437d8 | ||
|
|
c80e5fe7a1 | ||
|
|
5efedd7a60 | ||
|
|
960a1cbd8f | ||
|
|
6450be5e58 | ||
|
|
669cff88d1 | ||
|
|
19c3cb0d5b | ||
|
|
bc5712a1b3 | ||
|
|
0df513434e | ||
|
|
d5e5e22adb | ||
|
|
77ec3cf402 | ||
|
|
0a2ed6da37 | ||
|
|
6e80cbfd1e | ||
|
|
ac3579d2c6 | ||
|
|
8d0b6f9a60 | ||
|
|
42d9298318 | ||
|
|
4b71d9ca9f | ||
|
|
ec1fe9e2ca | ||
|
|
182f4def00 | ||
|
|
2fb6bc9867 | ||
|
|
98a6e5cb6c | ||
|
|
c5d41af10f | ||
|
|
dbb44c8950 | ||
|
|
ae2a0fb4c7 | ||
|
|
2e1d7cbdc2 | ||
|
|
ca55af836b | ||
|
|
3a42631e65 | ||
|
|
107b2768fd | ||
|
|
760b078dc9 | ||
|
|
2c5dcbe819 | ||
|
|
06ce1f5a40 | ||
|
|
4454630549 | ||
|
|
612b0ff9cd | ||
|
|
de20b083a0 | ||
|
|
17166a5662 | ||
|
|
e6013fb02d | ||
|
|
c29f594fc1 | ||
|
|
5fe44f906d | ||
|
|
df4edaa0fd | ||
|
|
02522a0df5 | ||
|
|
e4e7468972 | ||
|
|
904cbef4dc | ||
|
|
33d00bfeae | ||
|
|
4d7a0aaee1 | ||
|
|
dab5b1f319 | ||
|
|
8b9b77959d | ||
|
|
d2f13fe0a6 | ||
|
|
469e430d38 | ||
|
|
64a962ce97 | ||
|
|
1a2600c9ea | ||
|
|
7df50b6ec7 | ||
|
|
80afee04a4 | ||
|
|
bd2e7c0e53 | ||
|
|
3234f0d299 | ||
|
|
9002a6c195 | ||
|
|
9eda500dbc | ||
|
|
fb23773935 | ||
|
|
037caf096b | ||
|
|
f81b6c7cfb | ||
|
|
1c728a7cf8 | ||
|
|
af969d664f | ||
|
|
ebf38c5ebd | ||
|
|
c97ffaeac3 | ||
|
|
8363a6e585 | ||
|
|
214815eb62 | ||
|
|
43dc351209 | ||
|
|
9db6471fae | ||
|
|
4b28b3216b | ||
|
|
c36abbcda3 | ||
|
|
e6b076cb34 | ||
|
|
0b711d1f8a | ||
|
|
3f7a757e80 | ||
|
|
d4edd284e6 | ||
|
|
b282f1f154 | ||
|
|
3fbfac64c2 | ||
|
|
12fbecf48b | ||
|
|
59a6821299 | ||
|
|
4583100537 | ||
|
|
ca5fdeb9bb | ||
|
|
208eb05519 | ||
|
|
7c7e9ecfcd | ||
|
|
8d4b04e719 | ||
|
|
e173d54054 | ||
|
|
261d132f3a | ||
|
|
0184c981ee | ||
|
|
e047de854b | ||
|
|
86f3310ac1 | ||
|
|
f94d183297 | ||
|
|
224c2ddaf4 | ||
|
|
3662ed50d2 | ||
|
|
7e818067eb | ||
|
|
44b906a43d | ||
|
|
429bfcfd83 | ||
|
|
99c26e068d | ||
|
|
bafc89f439 | ||
|
|
f3a5188bec | ||
|
|
9bc4232af6 | ||
|
|
5cbe6160ca | ||
|
|
f2bf76a2ef | ||
|
|
065e8f3650 | ||
|
|
afae8a0c46 | ||
|
|
472050bb8a | ||
|
|
c7716f0bbc | ||
|
|
3623452839 | ||
|
|
6276f1adc5 | ||
|
|
cab8e9be89 | ||
|
|
0c699f0726 | ||
|
|
9f4b270116 | ||
|
|
4ca82f9308 | ||
|
|
207f218db3 | ||
|
|
89d8a0b6fd | ||
|
|
f6f849226e | ||
|
|
7d3f1fef1c | ||
|
|
314647572c | ||
|
|
6bed870dfa | ||
|
|
f281f00d43 | ||
|
|
e4abaa7cdd | ||
|
|
d9fa83b196 | ||
|
|
043f70e9a6 | ||
|
|
9983d90e24 | ||
|
|
0957480305 | ||
|
|
833afea3e3 | ||
|
|
31c5c1e562 | ||
|
|
f9fb92ebb0 | ||
|
|
a3d5200194 | ||
|
|
cfb899451f | ||
|
|
fb5aa43e77 | ||
|
|
a7eaa4de14 | ||
|
|
06a0afa039 | ||
|
|
d66396f4e9 | ||
|
|
35c4b78e66 | ||
|
|
7668cd7053 | ||
|
|
b656529818 | ||
|
|
4d38a5043f | ||
|
|
93e46310b8 | ||
|
|
4b3b358ac6 | ||
|
|
6fd3a86012 | ||
|
|
7d7e4534dd | ||
|
|
c7abc025ff | ||
|
|
dc53e8ebb0 | ||
|
|
c6857e562b | ||
|
|
3f31a56fb3 | ||
|
|
c154e57603 | ||
|
|
c57328669a | ||
|
|
b35c0410b1 | ||
|
|
fc04d334da | ||
|
|
a7dc3735ae | ||
|
|
4be00502cc | ||
|
|
8704bc6f39 | ||
|
|
e06f486aee | ||
|
|
bb7a2dbb6a | ||
|
|
0c1dbb116f | ||
|
|
fbcc56536b | ||
|
|
fa9111ebe2 | ||
|
|
8fb600162e | ||
|
|
5eac8703da | ||
|
|
d301d26fda | ||
|
|
f9c0ef3eb3 | ||
|
|
72d03464dc | ||
|
|
14fb1600ec | ||
|
|
341f7733d1 | ||
|
|
e260e8239f | ||
|
|
55ab31314c | ||
|
|
36c724d7b5 | ||
|
|
9ad10cb425 | ||
|
|
62daa43a4c | ||
|
|
a55e4e2c03 | ||
|
|
4c652396d0 | ||
|
|
8d00ee4f81 | ||
|
|
7e20324776 | ||
|
|
ec421df4e4 | ||
|
|
27bdba49d4 | ||
|
|
d43764c8e5 | ||
|
|
6a43f6718a | ||
|
|
a65ad10c62 | ||
|
|
4fce891241 | ||
|
|
9443e8e85f | ||
|
|
ce63b1f669 | ||
|
|
af19347376 | ||
|
|
64f174fcaa | ||
|
|
e87fbcc286 | ||
|
|
941e21092c | ||
|
|
c391d65dc3 | ||
|
|
0162d0a2ea | ||
|
|
ad89b029c2 | ||
|
|
15154d4bd0 | ||
|
|
dda6b5cd53 | ||
|
|
aa92df4ddc | ||
|
|
0ce2afc9bc | ||
|
|
41a1cd954c | ||
|
|
b124aff0bb | ||
|
|
703fc08467 | ||
|
|
6dd5f74671 | ||
|
|
ada1ac8013 | ||
|
|
efd6307bc4 | ||
|
|
0ec747f57c | ||
|
|
059c568f08 | ||
|
|
641e8fea02 | ||
|
|
cd645de4f9 | ||
|
|
96eec7e2cd | ||
|
|
1e82638ae8 | ||
|
|
ff79463e36 | ||
|
|
6bc2988623 | ||
|
|
0f072d7d40 | ||
|
|
0ae786adec | ||
|
|
6a5b7f751c | ||
|
|
a630a24040 | ||
|
|
fdb395c977 | ||
|
|
dac46ed6e1 | ||
|
|
6002fd7820 | ||
|
|
4b680178be | ||
|
|
5542af9be8 | ||
|
|
1de45877b1 | ||
|
|
13919440a7 | ||
|
|
543996652b | ||
|
|
6f978d2497 | ||
|
|
97ad6352af | ||
|
|
6e2fa02c56 | ||
|
|
6f025e7b4f | ||
|
|
8005022508 | ||
|
|
06ca6f7705 | ||
|
|
ac185989ff | ||
|
|
306a410b77 | ||
|
|
c49d45497c | ||
|
|
828699f26a | ||
|
|
7204bcb932 | ||
|
|
5ca3e83a00 | ||
|
|
f56284b0c1 | ||
|
|
3b31800533 | ||
|
|
b1f3e0224c | ||
|
|
0505135f90 | ||
|
|
14600e6a3e | ||
|
|
0576ad5ef9 | ||
|
|
778b4926bf | ||
|
|
20e1a3e199 | ||
|
|
bcfbc792b4 | ||
|
|
ed4f8cf65d | ||
|
|
bb1be2e2ee | ||
|
|
48d9cfe304 | ||
|
|
a19d1d6926 | ||
|
|
fd1d4c2927 | ||
|
|
08c02287dd | ||
|
|
d9cc84892b | ||
|
|
f6cf58fa8c | ||
|
|
3877b5407c | ||
|
|
1e9a6e6b7e | ||
|
|
4177ecb6b2 | ||
|
|
cbc22e6369 | ||
|
|
29e9f14f95 | ||
|
|
55ca054cb4 | ||
|
|
4bf65dd0d9 | ||
|
|
06b56adc71 | ||
|
|
6824838ab0 | ||
|
|
9eb091162a | ||
|
|
82cfccab2f | ||
|
|
4a7f370b15 | ||
|
|
2295921821 | ||
|
|
e7d277d51e | ||
|
|
f5dd494716 | ||
|
|
6ecbd97fbe | ||
|
|
581d931031 | ||
|
|
d43d19acfd | ||
|
|
ca872381a1 | ||
|
|
32371c8755 | ||
|
|
1dc124cf75 | ||
|
|
59cee369ce | ||
|
|
80fb0bf520 | ||
|
|
8d19faa598 | ||
|
|
0d4db95d99 | ||
|
|
bd999b0908 | ||
|
|
439313e524 | ||
|
|
12a2b21465 | ||
|
|
0426636a32 | ||
|
|
1db0fc91a5 | ||
|
|
fefdac432c | ||
|
|
24fbe23c8d | ||
|
|
87adaed933 | ||
|
|
4e1b60d401 | ||
|
|
e3a3306b30 | ||
|
|
283d2c5ca2 | ||
|
|
b16d395a8f | ||
|
|
e4d03bf0d0 | ||
|
|
368a974368 | ||
|
|
86e0f4c617 | ||
|
|
c7b9ae9c5e | ||
|
|
b840ba4407 | ||
|
|
00c607116b | ||
|
|
f13243a92e | ||
|
|
3863fc5fb2 | ||
|
|
050f65beb4 | ||
|
|
351f4d53a0 | ||
|
|
62011c9dc4 | ||
|
|
afa1dc4ffa | ||
|
|
c5385e141b | ||
|
|
95e5d812fe | ||
|
|
91e62f575e | ||
|
|
2124d9884b | ||
|
|
aafb5cb6f6 | ||
|
|
ded33a7e2e | ||
|
|
7cc6a67c18 | ||
|
|
8f47bffa0e | ||
|
|
ae4228aed4 | ||
|
|
9d6151d200 | ||
|
|
c6d6adcbf3 | ||
|
|
61bb236cfa | ||
|
|
35786c0067 | ||
|
|
6f69bbe1d7 | ||
|
|
7fbaef5de3 | ||
|
|
c9a4111f4d | ||
|
|
705b7dc9c2 | ||
|
|
71cdcb3593 | ||
|
|
24248f687b | ||
|
|
45197965d7 | ||
|
|
d751281fa7 | ||
|
|
e7d307e6bf | ||
|
|
2417c93d0e | ||
|
|
c99f644ffe | ||
|
|
7a7f4bd822 | ||
|
|
9e3b688333 | ||
|
|
f3926d0fcb | ||
|
|
45cf02308e | ||
|
|
8ef81870bb | ||
|
|
5ba17c87e5 | ||
|
|
afb0c4aa43 | ||
|
|
f8f02c508d | ||
|
|
50037f8609 | ||
|
|
6ba9a128e7 | ||
|
|
964deaca96 | ||
|
|
201aeeb20d | ||
|
|
170b8dded8 | ||
|
|
9bb4b8e8b2 | ||
|
|
cf8f4bda8f | ||
|
|
783bd89413 | ||
|
|
5448edff2c | ||
|
|
01490f1560 | ||
|
|
5ad83c06c2 | ||
|
|
679371e397 | ||
|
|
2b421c39b5 | ||
|
|
1de990b2ac | ||
|
|
5e2b067107 | ||
|
|
0abf5d340c | ||
|
|
d01863707c | ||
|
|
70cf4a6796 | ||
|
|
99c9cfaaed | ||
|
|
4badca54af | ||
|
|
0c0bfb1ef0 | ||
|
|
d6c5b6320f | ||
|
|
e46d3a87ea | ||
|
|
c28d2e4b2a | ||
|
|
bd3b3ea12c | ||
|
|
7c6b6eae5b | ||
|
|
1208ca6a36 | ||
|
|
c182a5687e | ||
|
|
fd53c64d5d |
47
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
47
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Report a bug encountered while using ERPNext
|
||||
labels: bug
|
||||
---
|
||||
|
||||
<!--
|
||||
Welcome to ERPNext issue tracker! Before creating an issue, please heed the following:
|
||||
|
||||
1. This tracker should only be used to report bugs and request features / enhancements to ERPNext
|
||||
- For questions and general support, checkout the manual https://erpnext.com/docs/user/manual/en or use https://discuss.erpnext.com
|
||||
- For documentation issues, refer to https://github.com/frappe/erpnext_com
|
||||
2. Use the search function before creating a new issue. Duplicates will be closed and directed to
|
||||
the original discussion.
|
||||
3. When making a bug report, make sure you provide all required information. The easier it is for
|
||||
maintainers to reproduce, the faster it'll be fixed.
|
||||
4. If you think you know what the reason for the bug is, share it with us. Maybe put in a PR 😉
|
||||
-->
|
||||
|
||||
## Description of the issue
|
||||
|
||||
## Context information (for bug reports)
|
||||
|
||||
**Output of `bench version`**
|
||||
```
|
||||
(paste here)
|
||||
```
|
||||
|
||||
## Steps to reproduce the issue
|
||||
|
||||
1.
|
||||
2.
|
||||
3.
|
||||
|
||||
### Observed result
|
||||
|
||||
### Expected result
|
||||
|
||||
### Stacktrace / full error message
|
||||
|
||||
```
|
||||
(paste here)
|
||||
```
|
||||
|
||||
## Additional information
|
||||
|
||||
OS version / distribution, `ERPNext` install method, etc.
|
||||
28
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
28
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea to improve ERPNext
|
||||
labels: feature-request
|
||||
---
|
||||
|
||||
<!--
|
||||
Welcome to ERPNext issue tracker! Before creating an issue, please heed the following:
|
||||
|
||||
1. This tracker should only be used to report bugs and request features / enhancements to ERPNext
|
||||
- For questions and general support, checkout the manual https://erpnext.com/docs/user/manual/en or use https://discuss.erpnext.com
|
||||
- For documentation issues, refer to https://github.com/frappe/erpnext_com
|
||||
2. Use the search function before creating a new issue. Duplicates will be closed and directed to
|
||||
the original discussion.
|
||||
3. When making a feature request, make sure to be as verbose as possible. The better you convey your message, the greater the drive to make it happen.
|
||||
-->
|
||||
|
||||
**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.
|
||||
17
.github/ISSUE_TEMPLATE/question-about-using-erpnext.md
vendored
Normal file
17
.github/ISSUE_TEMPLATE/question-about-using-erpnext.md
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
---
|
||||
name: Question about using ERPNext
|
||||
about: This is not the appropriate channel
|
||||
labels: invalid
|
||||
---
|
||||
|
||||
Please post on our forums:
|
||||
|
||||
for questions about using `ERPNext`: https://discuss.erpnext.com
|
||||
|
||||
for questions about using the `Frappe Framework`: https://discuss.frappe.io
|
||||
|
||||
for questions about using `bench`, probably the best place to start is the [bench repo](https://github.com/frappe/bench)
|
||||
|
||||
For documentation issues, use the [ERPNext Documentation](https://erpnext.com/docs/) or [Frappe Framework Documentation](https://frappe.io/docs/user/en) or the [developer cheetsheet](https://github.com/frappe/frappe/wiki/Developer-Cheatsheet)
|
||||
|
||||
> **Posts that are not bug reports or feature requests will not be addressed on this issue tracker.**
|
||||
33
.github/PULL_REQUEST_TEMPLATE.md
vendored
33
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -1,2 +1,33 @@
|
||||
Please read the pull request checklist to make sure your changes are merged: https://github.com/frappe/erpnext/wiki/Pull-Request-Checklist
|
||||
<!--
|
||||
|
||||
Some key notes before you open a PR:
|
||||
|
||||
1. Select which branch should this PR be merged in?
|
||||
2. PR name follows [convention](http://karma-runner.github.io/4.0/dev/git-commit-msg.html)
|
||||
3. All tests pass locally, UI and Unit tests
|
||||
4. All business logic and validations must be on the server-side
|
||||
5. Update necessary Documentation
|
||||
6. Put `closes #XXXX` in your comment to auto-close the issue that your PR fixes
|
||||
|
||||
|
||||
Also, if you're new here
|
||||
|
||||
- Documentation Guidelines => https://github.com/frappe/erpnext/wiki/Updating-Documentation
|
||||
|
||||
- Contribution Guide => https://github.com/frappe/erpnext/blob/develop/.github/CONTRIBUTING.md
|
||||
|
||||
- Pull Request Checklist => https://github.com/frappe/erpnext/wiki/Pull-Request-Checklist
|
||||
|
||||
-->
|
||||
|
||||
> Please provide enough information so that others can review your pull request:
|
||||
|
||||
<!-- You can skip this if you're fixing a typo or updating existing documentation -->
|
||||
|
||||
> Explain the **details** for making this change. What existing problem does the pull request solve?
|
||||
|
||||
<!-- Example: When "Adding a function to do X", explain why it is necessary to have a way to do X. -->
|
||||
|
||||
> Screenshots/GIFs
|
||||
|
||||
<!-- Add images/recordings to better visualize the change: expected/current behviour -->
|
||||
|
||||
7
SECURITY.md
Normal file
7
SECURITY.md
Normal file
@@ -0,0 +1,7 @@
|
||||
# Security Policy
|
||||
|
||||
The ERPNext team and community take security issues seriously. To report a security issue, fill out the form at [https://erpnext.com/security/report](https://erpnext.com/security/report).
|
||||
|
||||
You can help us make ERPNext and all it's users more secure by following the [Reporting guidelines](https://erpnext.com/security).
|
||||
|
||||
We appreciate your efforts to responsibly disclose your findings. We'll endeavor to respond quickly, and will keep you updated throughout the process.
|
||||
@@ -5,7 +5,7 @@ import frappe
|
||||
from erpnext.hooks import regional_overrides
|
||||
from frappe.utils import getdate
|
||||
|
||||
__version__ = '12.0.7'
|
||||
__version__ = '12.2.2'
|
||||
|
||||
def get_default_company(user=None):
|
||||
'''Get default company for user'''
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe, json
|
||||
from frappe import _
|
||||
from frappe.utils import add_to_date, date_diff, getdate, nowdate, get_last_day, formatdate
|
||||
from erpnext.accounts.report.general_ledger.general_ledger import execute
|
||||
from frappe.core.page.dashboard.dashboard import cache_source, get_from_date_from_timespan
|
||||
@@ -12,15 +13,26 @@ from frappe.utils.nestedset import get_descendants_of
|
||||
|
||||
@frappe.whitelist()
|
||||
@cache_source
|
||||
def get(chart_name=None, from_date = None, to_date = None):
|
||||
chart = frappe.get_doc('Dashboard Chart', chart_name)
|
||||
def get(chart_name = None, chart = None, no_cache = None, from_date = None, to_date = None):
|
||||
if chart_name:
|
||||
chart = frappe.get_doc('Dashboard Chart', chart_name)
|
||||
else:
|
||||
chart = frappe._dict(frappe.parse_json(chart))
|
||||
timespan = chart.timespan
|
||||
|
||||
if chart.timespan == 'Select Date Range':
|
||||
from_date = chart.from_date
|
||||
to_date = chart.to_date
|
||||
|
||||
timegrain = chart.time_interval
|
||||
filters = json.loads(chart.filters_json)
|
||||
filters = frappe.parse_json(chart.filters_json)
|
||||
|
||||
account = filters.get("account")
|
||||
company = filters.get("company")
|
||||
|
||||
if not account and chart:
|
||||
frappe.throw(_("Account is not set for the dashboard chart {0}").format(chart))
|
||||
|
||||
if not to_date:
|
||||
to_date = nowdate()
|
||||
if not from_date:
|
||||
@@ -81,7 +93,8 @@ def get_gl_entries(account, to_date):
|
||||
fields = ['posting_date', 'debit', 'credit'],
|
||||
filters = [
|
||||
dict(posting_date = ('<', to_date)),
|
||||
dict(account = ('in', child_accounts))
|
||||
dict(account = ('in', child_accounts)),
|
||||
dict(voucher_type = ('!=', 'Period Closing Voucher'))
|
||||
],
|
||||
order_by = 'posting_date asc')
|
||||
|
||||
|
||||
@@ -174,6 +174,8 @@ def make_gl_entries(doc, credit_account, debit_account, against,
|
||||
# GL Entry for crediting the amount in the deferred expense
|
||||
from erpnext.accounts.general_ledger import make_gl_entries
|
||||
|
||||
if amount == 0: return
|
||||
|
||||
gl_entries = []
|
||||
gl_entries.append(
|
||||
doc.get_gl_dict({
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -100,7 +100,10 @@ class Account(NestedSet):
|
||||
if ancestors:
|
||||
if frappe.get_value("Company", self.company, "allow_account_creation_against_child_company"):
|
||||
return
|
||||
frappe.throw(_("Please add the account to root level Company - %s" % ancestors[0]))
|
||||
|
||||
if not frappe.db.get_value("Account",
|
||||
{'account_name': self.account_name, 'company': ancestors[0]}, 'name'):
|
||||
frappe.throw(_("Please add the account to root level Company - %s" % ancestors[0]))
|
||||
else:
|
||||
descendants = get_descendants_of('Company', self.company)
|
||||
if not descendants: return
|
||||
@@ -114,23 +117,7 @@ class Account(NestedSet):
|
||||
|
||||
if not parent_acc_name_map: return
|
||||
|
||||
for company in descendants:
|
||||
if not parent_acc_name_map.get(company):
|
||||
frappe.throw(_("While creating account for child Company {0}, parent account {1} not found. Please create the parent account in corresponding COA")
|
||||
.format(company, parent_acc_name))
|
||||
|
||||
doc = frappe.copy_doc(self)
|
||||
doc.flags.ignore_root_company_validation = True
|
||||
doc.update({
|
||||
"company": company,
|
||||
# parent account's currency should be passed down to child account's curreny
|
||||
# if it is None, it picks it up from default company currency, which might be unintended
|
||||
"account_currency": self.account_currency,
|
||||
"parent_account": parent_acc_name_map[company]
|
||||
})
|
||||
doc.save()
|
||||
frappe.msgprint(_("Account {0} is added in the child company {1}")
|
||||
.format(doc.name, company))
|
||||
self.create_account_for_child_company(parent_acc_name_map, descendants, parent_acc_name)
|
||||
|
||||
def validate_group_or_ledger(self):
|
||||
if self.get("__islocal"):
|
||||
@@ -172,6 +159,49 @@ class Account(NestedSet):
|
||||
if frappe.db.get_value("GL Entry", {"account": self.name}):
|
||||
frappe.throw(_("Currency can not be changed after making entries using some other currency"))
|
||||
|
||||
def create_account_for_child_company(self, parent_acc_name_map, descendants, parent_acc_name):
|
||||
for company in descendants:
|
||||
if not parent_acc_name_map.get(company):
|
||||
frappe.throw(_("While creating account for child Company {0}, parent account {1} not found. Please create the parent account in corresponding COA")
|
||||
.format(company, parent_acc_name))
|
||||
|
||||
filters = {
|
||||
"account_name": self.account_name,
|
||||
"company": company
|
||||
}
|
||||
|
||||
if self.account_number:
|
||||
filters["account_number"] = self.account_number
|
||||
|
||||
child_account = frappe.db.get_value("Account", filters, 'name')
|
||||
|
||||
if not child_account:
|
||||
doc = frappe.copy_doc(self)
|
||||
doc.flags.ignore_root_company_validation = True
|
||||
doc.update({
|
||||
"company": company,
|
||||
# parent account's currency should be passed down to child account's curreny
|
||||
# if it is None, it picks it up from default company currency, which might be unintended
|
||||
"account_currency": self.account_currency,
|
||||
"parent_account": parent_acc_name_map[company]
|
||||
})
|
||||
|
||||
doc.save()
|
||||
frappe.msgprint(_("Account {0} is added in the child company {1}")
|
||||
.format(doc.name, company))
|
||||
elif child_account:
|
||||
# update the parent company's value in child companies
|
||||
doc = frappe.get_doc("Account", child_account)
|
||||
parent_value_changed = False
|
||||
for field in ['account_type', 'account_currency',
|
||||
'freeze_account', 'balance_must_be']:
|
||||
if doc.get(field) != self.get(field):
|
||||
parent_value_changed = True
|
||||
doc.set(field, self.get(field))
|
||||
|
||||
if parent_value_changed:
|
||||
doc.save()
|
||||
|
||||
def convert_group_to_ledger(self):
|
||||
if self.check_if_child_exists():
|
||||
throw(_("Account with child nodes cannot be converted to ledger"))
|
||||
|
||||
@@ -123,7 +123,8 @@ frappe.treeview_settings["Account"] = {
|
||||
if(frappe.boot.user.can_read.indexOf("GL Entry") !== -1){
|
||||
|
||||
// show Dr if positive since balance is calculated as debit - credit else show Cr
|
||||
let dr_or_cr = node.data.balance_in_account_currency > 0 ? "Dr": "Cr";
|
||||
let balance = node.data.balance_in_account_currency || node.data.balance;
|
||||
let dr_or_cr = balance > 0 ? "Dr": "Cr";
|
||||
|
||||
if (node.data && node.data.balance!==undefined) {
|
||||
$('<span class="balance-area pull-right text-muted small">'
|
||||
|
||||
@@ -406,7 +406,11 @@
|
||||
"is_group": 1,
|
||||
"Bewertungskorrektur zu Forderungen aus Lieferungen und Leistungen": {
|
||||
"account_number": "9960"
|
||||
},
|
||||
},
|
||||
"Debitoren": {
|
||||
"is_group": 1,
|
||||
"account_number": "10000"
|
||||
},
|
||||
"Forderungen aus Lieferungen und Leistungen": {
|
||||
"account_number": "1200",
|
||||
"account_type": "Receivable"
|
||||
@@ -1077,7 +1081,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"C - Verb.": {
|
||||
"C - Verbindlichkeiten": {
|
||||
"account_type": "Payable",
|
||||
"1 - Anleihen": {
|
||||
"is_group": 1,
|
||||
@@ -1193,7 +1197,15 @@
|
||||
"is_group": 1,
|
||||
"Bewertungskorrektur zu Verb. aus Lieferungen und Leistungen": {
|
||||
"account_number": "9964"
|
||||
},
|
||||
},
|
||||
"Kreditoren": {
|
||||
"account_number": "70000",
|
||||
"is_group": 1,
|
||||
"Wareneingangs-Verrechnungskonto" : {
|
||||
"account_number": "70001",
|
||||
"account_type": "Stock Received But Not Billed"
|
||||
}
|
||||
},
|
||||
"Verb. aus Lieferungen und Leistungen": {
|
||||
"account_number": "3300",
|
||||
"account_type": "Payable"
|
||||
@@ -1682,90 +1694,6 @@
|
||||
"account_type": "Income Account"
|
||||
}
|
||||
},
|
||||
"Erl\u00f6sschm\u00e4lerungen (Gruppe)": {
|
||||
"is_group": 1,
|
||||
"Erl\u00f6sschm\u00e4lerungen": {
|
||||
"account_number": "4700"
|
||||
},
|
||||
"Erl\u00f6sschm\u00e4lerungen aus steuerfreien Ums\u00e4tzen \u00a7 4 Nr. 1a UStG": {
|
||||
"account_number": "4705"
|
||||
},
|
||||
"Erl\u00f6sschm\u00e4lerungen 7 % USt": {
|
||||
"account_number": "4710"
|
||||
},
|
||||
"Erl\u00f6sschm\u00e4lerungen 19 % USt": {
|
||||
"account_number": "4720"
|
||||
},
|
||||
"Erl\u00f6sschm\u00e4lerungen 16 % USt": {
|
||||
"account_number": "4723"
|
||||
},
|
||||
"Erl\u00f6sschm\u00e4lerungen aus steuerfreien innergem. Lieferungen": {
|
||||
"account_number": "4724"
|
||||
},
|
||||
"Erl\u00f6sschm\u00e4lerungen aus im Inland steuerpfl. EU-Lieferungen 7 % USt": {
|
||||
"account_number": "4725"
|
||||
},
|
||||
"Erl\u00f6sschm\u00e4lerungen aus im Inland steuerpfl. EU-Lieferungen 19 % USt": {
|
||||
"account_number": "4726"
|
||||
},
|
||||
"Erl\u00f6sschm\u00e4lerungen aus im anderen EU-Land steuerpfl. Lieferungen": {
|
||||
"account_number": "4727"
|
||||
},
|
||||
"Erl\u00f6sschm\u00e4lerungen aus im Inland steuerpfl. EU-Lieferungen 16 % USt": {
|
||||
"account_number": "4729"
|
||||
},
|
||||
"Gew\u00e4hrte Skonti (Gruppe)": {
|
||||
"is_group": 1,
|
||||
"Gew. Skonti": {
|
||||
"account_number": "4730"
|
||||
},
|
||||
"Gew. Skonti 7 % USt": {
|
||||
"account_number": "4731"
|
||||
},
|
||||
"Gew. Skonti 19 % USt": {
|
||||
"account_number": "4736"
|
||||
},
|
||||
"Gew. Skonti aus Lieferungen von Mobilfunkger./Schaltkr., f. die der Leistungsempf. die Ust. schuldet": {
|
||||
"account_number": "4738"
|
||||
},
|
||||
"Gew. Skonti aus Leistungen, f. die der Leistungsempf. die Umsatzsteuer nach \u00a7 13b UStG schuldet": {
|
||||
"account_number": "4741"
|
||||
},
|
||||
"Gew. Skonti aus Erl\u00f6sen aus im anderen EU-Land steuerpfl. Leistungen, f. die der Leistungsempf. die Ust. schuldet": {
|
||||
"account_number": "4742"
|
||||
},
|
||||
"Gew. Skonti aus steuerfreien innergem. Lieferungen \u00a7 4 Nr. 1b UStG": {
|
||||
"account_number": "4743"
|
||||
},
|
||||
"Gew. Skonti aus im Inland steuerpfl. EU-Lieferungen": {
|
||||
"account_number": "4745"
|
||||
},
|
||||
"Gew. Skonti aus im Inland steuerpfl. EU-Lieferungen 7% USt": {
|
||||
"account_number": "4746"
|
||||
},
|
||||
"Gew. Skonti aus im Inland steuerpfl. EU-Lieferungen 19% USt": {
|
||||
"account_number": "4748"
|
||||
}
|
||||
},
|
||||
"Gew\u00e4hrte Boni 7 % USt": {
|
||||
"account_number": "4750"
|
||||
},
|
||||
"Gew\u00e4hrte Boni 19 % USt": {
|
||||
"account_number": "4760"
|
||||
},
|
||||
"Gew\u00e4hrte Boni": {
|
||||
"account_number": "4769"
|
||||
},
|
||||
"Gew\u00e4hrte Rabatte": {
|
||||
"account_number": "4770"
|
||||
},
|
||||
"Gew\u00e4hrte Rabatte 7 % USt": {
|
||||
"account_number": "4780"
|
||||
},
|
||||
"Gew\u00e4hrte Rabatte 19 % USt": {
|
||||
"account_number": "4790"
|
||||
}
|
||||
},
|
||||
"Grundst\u00fccksertr\u00e4ge (Gruppe)": {
|
||||
"is_group": 1,
|
||||
"Grundst\u00fccksertr\u00e4ge": {
|
||||
@@ -2049,48 +1977,6 @@
|
||||
"Erh. Skonti aus Erwerb Waren als letzter Abnehmer innerh. Dreiecksgesch. 19% Vorst. u. 19% Ust.": {
|
||||
"account_number": "5793"
|
||||
}
|
||||
},
|
||||
"Erhaltene Boni (Gruppe)": {
|
||||
"is_group": 1,
|
||||
"Erhaltene Boni 7 % Vorsteuer": {
|
||||
"account_number": "5750"
|
||||
},
|
||||
"Erhaltene Boni aus Einkauf Roh-, Hilfs- und Betriebsstoffe": {
|
||||
"account_number": "5753"
|
||||
},
|
||||
"Erhaltene Boni aus Einkauf Roh-, Hilfs- und Betriebsstoffe 7% Vorsteuer": {
|
||||
"account_number": "5754"
|
||||
},
|
||||
"Erhaltene Boni aus Einkauf Roh-, Hilfs- und Betriebsstoffe 19% Vorsteuer": {
|
||||
"account_number": "5755"
|
||||
},
|
||||
"Erhaltene Boni 19 % Vorsteuer": {
|
||||
"account_number": "5760"
|
||||
},
|
||||
"Erhaltene Boni": {
|
||||
"account_number": "5769"
|
||||
}
|
||||
},
|
||||
"Erhaltene Rabatte (Gruppe)": {
|
||||
"is_group": 1,
|
||||
"Erhaltene Rabatte": {
|
||||
"account_number": "5770"
|
||||
},
|
||||
"Erhaltene Rabatte 7 % Vorsteuer": {
|
||||
"account_number": "5780"
|
||||
},
|
||||
"Erhaltene Rabatte aus Einkauf Roh-, Hilfs- und Betriebsstoffe": {
|
||||
"account_number": "5783"
|
||||
},
|
||||
"Erhaltene Rabatte aus Einkauf Roh-, Hilfs- und Betriebsstoffe 7% Vorsteuer": {
|
||||
"account_number": "5784"
|
||||
},
|
||||
"Erhaltene Rabatte aus Einkauf Roh-, Hilfs- und Betriebsstoffe 19% Vorsteuer": {
|
||||
"account_number": "5785"
|
||||
},
|
||||
"Erhaltene Rabatte 19 % Vorsteuer": {
|
||||
"account_number": "5790"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Bezugsnebenkosten (Gruppe)": {
|
||||
@@ -2409,7 +2295,49 @@
|
||||
},
|
||||
"6 - sonstige betriebliche Ertr\u00e4ge": {
|
||||
"root_type": "Income",
|
||||
"is_group": 1,
|
||||
"is_group": 1,
|
||||
"Erhaltene Boni (Gruppe)": {
|
||||
"is_group": 1,
|
||||
"Erhaltene Boni 7 % Vorsteuer": {
|
||||
"account_number": "5750"
|
||||
},
|
||||
"Erhaltene Boni aus Einkauf Roh-, Hilfs- und Betriebsstoffe": {
|
||||
"account_number": "5753"
|
||||
},
|
||||
"Erhaltene Boni aus Einkauf Roh-, Hilfs- und Betriebsstoffe 7% Vorsteuer": {
|
||||
"account_number": "5754"
|
||||
},
|
||||
"Erhaltene Boni aus Einkauf Roh-, Hilfs- und Betriebsstoffe 19% Vorsteuer": {
|
||||
"account_number": "5755"
|
||||
},
|
||||
"Erhaltene Boni 19 % Vorsteuer": {
|
||||
"account_number": "5760"
|
||||
},
|
||||
"Erhaltene Boni": {
|
||||
"account_number": "5769"
|
||||
}
|
||||
},
|
||||
"Erhaltene Rabatte (Gruppe)": {
|
||||
"is_group": 1,
|
||||
"Erhaltene Rabatte": {
|
||||
"account_number": "5770"
|
||||
},
|
||||
"Erhaltene Rabatte 7 % Vorsteuer": {
|
||||
"account_number": "5780"
|
||||
},
|
||||
"Erhaltene Rabatte aus Einkauf Roh-, Hilfs- und Betriebsstoffe": {
|
||||
"account_number": "5783"
|
||||
},
|
||||
"Erhaltene Rabatte aus Einkauf Roh-, Hilfs- und Betriebsstoffe 7% Vorsteuer": {
|
||||
"account_number": "5784"
|
||||
},
|
||||
"Erhaltene Rabatte aus Einkauf Roh-, Hilfs- und Betriebsstoffe 19% Vorsteuer": {
|
||||
"account_number": "5785"
|
||||
},
|
||||
"Erhaltene Rabatte 19 % Vorsteuer": {
|
||||
"account_number": "5790"
|
||||
}
|
||||
},
|
||||
"Andere aktivierte Eigenleistungen": {
|
||||
"account_number": "4820"
|
||||
},
|
||||
@@ -2732,7 +2660,91 @@
|
||||
},
|
||||
"7 - sonstige betriebliche Aufwendungen": {
|
||||
"root_type": "Expense",
|
||||
"is_group": 1,
|
||||
"is_group": 1,
|
||||
"Erl\u00f6sschm\u00e4lerungen (Gruppe)": {
|
||||
"is_group": 1,
|
||||
"Erl\u00f6sschm\u00e4lerungen": {
|
||||
"account_number": "4700"
|
||||
},
|
||||
"Erl\u00f6sschm\u00e4lerungen aus steuerfreien Ums\u00e4tzen \u00a7 4 Nr. 1a UStG": {
|
||||
"account_number": "4705"
|
||||
},
|
||||
"Erl\u00f6sschm\u00e4lerungen 7 % USt": {
|
||||
"account_number": "4710"
|
||||
},
|
||||
"Erl\u00f6sschm\u00e4lerungen 19 % USt": {
|
||||
"account_number": "4720"
|
||||
},
|
||||
"Erl\u00f6sschm\u00e4lerungen 16 % USt": {
|
||||
"account_number": "4723"
|
||||
},
|
||||
"Erl\u00f6sschm\u00e4lerungen aus steuerfreien innergem. Lieferungen": {
|
||||
"account_number": "4724"
|
||||
},
|
||||
"Erl\u00f6sschm\u00e4lerungen aus im Inland steuerpfl. EU-Lieferungen 7 % USt": {
|
||||
"account_number": "4725"
|
||||
},
|
||||
"Erl\u00f6sschm\u00e4lerungen aus im Inland steuerpfl. EU-Lieferungen 19 % USt": {
|
||||
"account_number": "4726"
|
||||
},
|
||||
"Erl\u00f6sschm\u00e4lerungen aus im anderen EU-Land steuerpfl. Lieferungen": {
|
||||
"account_number": "4727"
|
||||
},
|
||||
"Erl\u00f6sschm\u00e4lerungen aus im Inland steuerpfl. EU-Lieferungen 16 % USt": {
|
||||
"account_number": "4729"
|
||||
},
|
||||
"Gew\u00e4hrte Skonti (Gruppe)": {
|
||||
"is_group": 1,
|
||||
"Gew. Skonti": {
|
||||
"account_number": "4730"
|
||||
},
|
||||
"Gew. Skonti 7 % USt": {
|
||||
"account_number": "4731"
|
||||
},
|
||||
"Gew. Skonti 19 % USt": {
|
||||
"account_number": "4736"
|
||||
},
|
||||
"Gew. Skonti aus Lieferungen von Mobilfunkger./Schaltkr., f. die der Leistungsempf. die Ust. schuldet": {
|
||||
"account_number": "4738"
|
||||
},
|
||||
"Gew. Skonti aus Leistungen, f. die der Leistungsempf. die Umsatzsteuer nach \u00a7 13b UStG schuldet": {
|
||||
"account_number": "4741"
|
||||
},
|
||||
"Gew. Skonti aus Erl\u00f6sen aus im anderen EU-Land steuerpfl. Leistungen, f. die der Leistungsempf. die Ust. schuldet": {
|
||||
"account_number": "4742"
|
||||
},
|
||||
"Gew. Skonti aus steuerfreien innergem. Lieferungen \u00a7 4 Nr. 1b UStG": {
|
||||
"account_number": "4743"
|
||||
},
|
||||
"Gew. Skonti aus im Inland steuerpfl. EU-Lieferungen": {
|
||||
"account_number": "4745"
|
||||
},
|
||||
"Gew. Skonti aus im Inland steuerpfl. EU-Lieferungen 7% USt": {
|
||||
"account_number": "4746"
|
||||
},
|
||||
"Gew. Skonti aus im Inland steuerpfl. EU-Lieferungen 19% USt": {
|
||||
"account_number": "4748"
|
||||
}
|
||||
},
|
||||
"Gew\u00e4hrte Boni 7 % USt": {
|
||||
"account_number": "4750"
|
||||
},
|
||||
"Gew\u00e4hrte Boni 19 % USt": {
|
||||
"account_number": "4760"
|
||||
},
|
||||
"Gew\u00e4hrte Boni": {
|
||||
"account_number": "4769"
|
||||
},
|
||||
"Gew\u00e4hrte Rabatte": {
|
||||
"account_number": "4770"
|
||||
},
|
||||
"Gew\u00e4hrte Rabatte 7 % USt": {
|
||||
"account_number": "4780"
|
||||
},
|
||||
"Gew\u00e4hrte Rabatte 19 % USt": {
|
||||
"account_number": "4790"
|
||||
}
|
||||
},
|
||||
"Sonstige betriebliche Aufwendungen": {
|
||||
"account_number": "6300"
|
||||
},
|
||||
@@ -3609,18 +3621,6 @@
|
||||
"Ertr\u00e4ge aus der Aufl\u00f6sung von R\u00fcckstellungen f. sonstige Steuern": {
|
||||
"account_number": "7694"
|
||||
}
|
||||
},
|
||||
"Debitoren": {
|
||||
"root_type": "Asset",
|
||||
"is_group": 1
|
||||
},
|
||||
"Kreditoren": {
|
||||
"root_type": "Liability",
|
||||
"is_group": 1,
|
||||
"Wareneingangs-Verrechnungskonto" : {
|
||||
"account_number": "70001",
|
||||
"account_type": "Stock Received But Not Billed"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,809 @@
|
||||
{
|
||||
"country_code": "sv",
|
||||
"name": "El Salvador Standard",
|
||||
"tree": {
|
||||
"100000 - ACTIVOS - xmC": {
|
||||
"11000000 - ACTIVOS CORRIENTES - xmC": {
|
||||
"11010000 - EFECTIVO Y EQUIVALENTES AL EFECTIVO - xmC": {
|
||||
"11010100 - Caja general - xmC": {
|
||||
"account_number": "11010100",
|
||||
"account_type": "Cash"
|
||||
},
|
||||
"Caja chica": {
|
||||
"account_number": "11010200",
|
||||
"account_type": "Cash",
|
||||
"is_group": 1
|
||||
},
|
||||
"Efectivo en bancos": {
|
||||
"account_number": "11010300",
|
||||
"account_type": "Bank",
|
||||
"is_group": 1
|
||||
},
|
||||
"account_number": "11010000",
|
||||
"account_type": "Cash"
|
||||
},
|
||||
"CUENTAS POR COBRAR ARRENDAMIENTOS FINANCIEROS": {
|
||||
"Arrendamientos financieros por cobrar": {
|
||||
"account_number": "11040100",
|
||||
"is_group": 1
|
||||
},
|
||||
"Estimaci\u00f3n para cuentas de cobro dudoso (CR)": {
|
||||
"account_number": "11040200",
|
||||
"is_group": 1
|
||||
},
|
||||
"account_number": "11040000"
|
||||
},
|
||||
"DEUDORES COMERCIALES Y OTRAS CUENTAS POR COBRAR": {
|
||||
"11030100 - Deudores comerciales - xmC": {
|
||||
"account_number": "11030100",
|
||||
"account_type": "Receivable"
|
||||
},
|
||||
"Estimaci\u00f3n para cuentas de cobro dudoso (CR)": {
|
||||
"account_number": "11030200",
|
||||
"account_type": "Receivable",
|
||||
"is_group": 1
|
||||
},
|
||||
"Otras cuentas por cobrar no comerciales": {
|
||||
"account_number": "11030300",
|
||||
"account_type": "Receivable",
|
||||
"is_group": 1
|
||||
},
|
||||
"account_number": "11030000",
|
||||
"account_type": "Receivable"
|
||||
},
|
||||
"GASTOS PAGADOS POR ANTICIPADO": {
|
||||
"Adelantos a empleados": {
|
||||
"account_number": "110904",
|
||||
"account_type": "Temporary",
|
||||
"is_group": 1
|
||||
},
|
||||
"Papeler\u00eda y \u00fatiles en existencia": {
|
||||
"account_number": "11090300",
|
||||
"account_type": "Temporary",
|
||||
"is_group": 1
|
||||
},
|
||||
"Primas de seguros aun no vendidas": {
|
||||
"account_number": "11090100",
|
||||
"account_type": "Temporary",
|
||||
"is_group": 1
|
||||
},
|
||||
"Rentas aun no corridas por los inmuebles": {
|
||||
"account_number": "11090200",
|
||||
"account_type": "Temporary",
|
||||
"is_group": 1
|
||||
},
|
||||
"account_number": "11090000",
|
||||
"account_type": "Temporary"
|
||||
},
|
||||
"INVENTARIOS": {
|
||||
"11050100 - Inventarios en bodega al costo - xmC": {
|
||||
"account_number": "11050100",
|
||||
"account_type": "Stock"
|
||||
},
|
||||
"11050300 - Pedidos en transito - xmC": {
|
||||
"account_number": "11050300",
|
||||
"account_type": "Stock Received But Not Billed"
|
||||
},
|
||||
"Estimaci\u00f3n para obsolescencia de inventarios o de lento movimiento (CR)": {
|
||||
"account_number": "11050200",
|
||||
"account_type": "Stock",
|
||||
"is_group": 1
|
||||
},
|
||||
"Mercader\u00edas en consignaci\u00f3n": {
|
||||
"account_number": "11050400",
|
||||
"account_type": "Stock",
|
||||
"is_group": 1
|
||||
},
|
||||
"account_number": "11050000",
|
||||
"account_type": "Stock"
|
||||
},
|
||||
"INVERSIONES TEMPORALES": {
|
||||
"Acciones": {
|
||||
"account_number": "11020100",
|
||||
"account_type": "Temporary",
|
||||
"is_group": 1
|
||||
},
|
||||
"Bonos": {
|
||||
"account_number": "11020200",
|
||||
"account_type": "Temporary",
|
||||
"is_group": 1
|
||||
},
|
||||
"C\u00e9dulas hipotecarias": {
|
||||
"account_number": "11020300",
|
||||
"account_type": "Temporary",
|
||||
"is_group": 1
|
||||
},
|
||||
"account_number": "11020000",
|
||||
"account_type": "Temporary"
|
||||
},
|
||||
"IVA CREDITO FISCAL": {
|
||||
"IVA compras locales": {
|
||||
"account_number": "11060100",
|
||||
"account_type": "Tax",
|
||||
"is_group": 1,
|
||||
"tax_rate": 13.0
|
||||
},
|
||||
"IVA importaciones": {
|
||||
"account_number": "11060200",
|
||||
"account_type": "Tax",
|
||||
"is_group": 1,
|
||||
"tax_rate": 13.0
|
||||
},
|
||||
"account_number": "11060000",
|
||||
"account_type": "Tax",
|
||||
"tax_rate": 13.0
|
||||
},
|
||||
"IVA PERCIBIDO": {
|
||||
"account_number": "IVA PERCIBIDO",
|
||||
"account_type": "Tax",
|
||||
"is_group": 1,
|
||||
"tax_rate": 1.0
|
||||
},
|
||||
"IVA RETENIDO": {
|
||||
"account_number": "11070000",
|
||||
"account_type": "Tax",
|
||||
"is_group": 1,
|
||||
"tax_rate": 1.0
|
||||
},
|
||||
"account_number": "11000000"
|
||||
},
|
||||
"12000000 - ACTIVOS NO CORRIENTES - xmC": {
|
||||
"ACTIVOS INTANGIBLES": {
|
||||
"Concesiones y franquicias": {
|
||||
"account_number": "12080300",
|
||||
"account_type": "Fixed Asset",
|
||||
"is_group": 1
|
||||
},
|
||||
"Derechos de llave": {
|
||||
"account_number": "12080100",
|
||||
"account_type": "Fixed Asset",
|
||||
"is_group": 1
|
||||
},
|
||||
"Patentes y marcas de fabrica": {
|
||||
"account_number": "12080200",
|
||||
"account_type": "Fixed Asset",
|
||||
"is_group": 1
|
||||
},
|
||||
"Software": {
|
||||
"account_number": "12080400",
|
||||
"account_type": "Fixed Asset",
|
||||
"is_group": 1
|
||||
},
|
||||
"account_number": "12080000",
|
||||
"account_type": "Fixed Asset"
|
||||
},
|
||||
"CUENTAS POR COBRAR ARRENDAMIENTOS FINANCIEROS A LARGO PLAZO": {
|
||||
"Arrendamientos financieros por cobrar a largo plazo": {
|
||||
"account_number": "12060100",
|
||||
"account_type": "Receivable",
|
||||
"is_group": 1
|
||||
},
|
||||
"Estimaci\u00f3n para cuentas de cobro dudoso a largo plazo (CR)": {
|
||||
"account_number": "12060200",
|
||||
"account_type": "Receivable",
|
||||
"is_group": 1
|
||||
},
|
||||
"account_number": "12060000",
|
||||
"account_type": "Receivable"
|
||||
},
|
||||
"DEPRECIACION ACUMULUDA (CR)": {
|
||||
"12030100 - Deprec. acumulada de propiedades, planta y equipo propio al costo - xmC": {
|
||||
"account_number": "12030100",
|
||||
"account_type": "Accumulated Depreciation"
|
||||
},
|
||||
"Deprec. acumulada de prop., planta y equipo bajo arrend. Financiero": {
|
||||
"account_number": "12030200",
|
||||
"account_type": "Accumulated Depreciation",
|
||||
"is_group": 1
|
||||
},
|
||||
"Deprec. acumulada de revaluaos de propiedades, planta y equipo": {
|
||||
"account_number": "12030300",
|
||||
"account_type": "Accumulated Depreciation",
|
||||
"is_group": 1
|
||||
},
|
||||
"account_number": "12030000",
|
||||
"account_type": "Accumulated Depreciation"
|
||||
},
|
||||
"DEUDORES COMERCIALES Y OTRAS CUENTAS POR COBRAR A LARGO PLAZO": {
|
||||
"12050100 - Deudores comerciales a largo plazo - xmC": {
|
||||
"account_number": "12050100",
|
||||
"account_type": "Receivable",
|
||||
"is_group": 1
|
||||
},
|
||||
"Cuentas por cobrar no comerciales a largo plazo": {
|
||||
"account_number": "12050300",
|
||||
"account_type": "Receivable",
|
||||
"is_group": 1
|
||||
},
|
||||
"Estimaci\u00f3n para cuentas de cobro dudoso a largo plazo (CR)": {
|
||||
"account_number": "12050200",
|
||||
"account_type": "Receivable",
|
||||
"is_group": 1
|
||||
},
|
||||
"account_number": "12050000",
|
||||
"account_type": "Receivable"
|
||||
},
|
||||
"IMPUESTO SOBRE LA RENTA DIFERIDO-ACTIVO": {
|
||||
"12070200 - Pago anticipados de impuestos sobre la renta - xmC": {
|
||||
"account_number": "12070200",
|
||||
"account_type": "Temporary",
|
||||
"is_group": 1
|
||||
},
|
||||
"Cr\u00e9dito impuestos sobre la renta de a\u00f1os anteriores": {
|
||||
"account_number": "12070100",
|
||||
"account_type": "Tax",
|
||||
"is_group": 1
|
||||
},
|
||||
"account_number": "12070000",
|
||||
"account_type": "Tax"
|
||||
},
|
||||
"INVERSIONES PERMANENTES": {
|
||||
"Inversiones en asociadas": {
|
||||
"account_number": "12040200",
|
||||
"account_type": "Fixed Asset",
|
||||
"is_group": 1
|
||||
},
|
||||
"Inversiones en negocios conjuntos": {
|
||||
"account_number": "12040300",
|
||||
"account_type": "Fixed Asset",
|
||||
"is_group": 1
|
||||
},
|
||||
"Inversiones en subsidiarias": {
|
||||
"account_number": "12040100",
|
||||
"account_type": "Fixed Asset",
|
||||
"is_group": 1
|
||||
},
|
||||
"account_number": "12040000",
|
||||
"account_type": "Fixed Asset"
|
||||
},
|
||||
"PROPIEDADES, PLANTA Y EQUIPO": {
|
||||
"12010300 - Maquinarias y equipos - xmC": {
|
||||
"account_number": "12010300",
|
||||
"account_type": "Fixed Asset"
|
||||
},
|
||||
"Edificios": {
|
||||
"account_number": "12010200",
|
||||
"account_type": "Fixed Asset",
|
||||
"is_group": 1
|
||||
},
|
||||
"Mobiliario y equipo": {
|
||||
"account_number": "12010400",
|
||||
"account_type": "Fixed Asset",
|
||||
"is_group": 1
|
||||
},
|
||||
"Terrenos": {
|
||||
"account_number": "12010100",
|
||||
"account_type": "Fixed Asset",
|
||||
"is_group": 1
|
||||
},
|
||||
"Veh\u00edculos": {
|
||||
"account_number": "12010500",
|
||||
"account_type": "Fixed Asset",
|
||||
"is_group": 1
|
||||
},
|
||||
"account_number": "12010000",
|
||||
"account_type": "Fixed Asset"
|
||||
},
|
||||
"REVALUACIONES DE PROPIEDADES, PLANTA Y EQUIPO": {
|
||||
"Revaluaci\u00f3n de edificios": {
|
||||
"account_number": "12020200",
|
||||
"account_type": "Fixed Asset",
|
||||
"is_group": 1
|
||||
},
|
||||
"Revaluaci\u00f3n de maquinarias y equipo": {
|
||||
"account_number": "12020300",
|
||||
"account_type": "Fixed Asset",
|
||||
"is_group": 1
|
||||
},
|
||||
"Revaluaci\u00f3n de mobiliario y equipo": {
|
||||
"account_number": "12020400",
|
||||
"account_type": "Fixed Asset",
|
||||
"is_group": 1
|
||||
},
|
||||
"Revaluaci\u00f3n de terrenos": {
|
||||
"account_number": "12020100",
|
||||
"account_type": "Fixed Asset",
|
||||
"is_group": 1
|
||||
},
|
||||
"Revaluaci\u00f3n de veh\u00edculos": {
|
||||
"account_number": "12020500",
|
||||
"account_type": "Fixed Asset",
|
||||
"is_group": 1
|
||||
},
|
||||
"account_number": "12020000",
|
||||
"account_type": "Fixed Asset"
|
||||
},
|
||||
"account_number": "12000000",
|
||||
"account_type": "Fixed Asset"
|
||||
},
|
||||
"account_number": "100000",
|
||||
"root_type": "Asset"
|
||||
},
|
||||
"20000000 - PASIVOS - xmC": {
|
||||
"PASIVOS CORRIENTES": {
|
||||
"ACREEDORES COMERCIALES Y OTRAS CUENTAS POR PAGAR": {
|
||||
"21020100 - Cuentas por pagar comerciales - xmC": {
|
||||
"account_number": "21020100",
|
||||
"account_type": "Payable"
|
||||
},
|
||||
"Documentos por pagar comerciales": {
|
||||
"account_number": "21020200",
|
||||
"account_type": "Payable",
|
||||
"is_group": 1
|
||||
},
|
||||
"account_number": "21020000",
|
||||
"account_type": "Payable"
|
||||
},
|
||||
"BENEFICIOS A EMPLEADOS POR PAGAR": {
|
||||
"Beneficios a corto plazo por pagar": {
|
||||
"account_number": "21050100",
|
||||
"account_type": "Payable",
|
||||
"is_group": 1
|
||||
},
|
||||
"Beneficios post empleo por pagar": {
|
||||
"account_number": "21050200",
|
||||
"account_type": "Payable",
|
||||
"is_group": 1
|
||||
},
|
||||
"account_number": "21050000",
|
||||
"account_type": "Payable"
|
||||
},
|
||||
"DIVIDENDOS POR PAGAR": {
|
||||
"account_number": "21080000",
|
||||
"account_type": "Payable",
|
||||
"is_group": 1
|
||||
},
|
||||
"IMPUESTO SOBRE LA RENTA CORRIENTE POR PAGAR": {
|
||||
"account_number": "21070000",
|
||||
"account_type": "Tax",
|
||||
"is_group": 1
|
||||
},
|
||||
"IVA DEBITOS FISCALES": {
|
||||
"Por ventas a consumidores": {
|
||||
"account_number": "21060200",
|
||||
"account_type": "Tax",
|
||||
"is_group": 1
|
||||
},
|
||||
"Por ventas a contribuyentes": {
|
||||
"account_number": "21060100",
|
||||
"account_type": "Tax",
|
||||
"is_group": 1
|
||||
},
|
||||
"account_number": "21060000",
|
||||
"account_type": "Tax"
|
||||
},
|
||||
"OBLIGACIONES BAJO ARRENDAMIENTOS FINANCIEROS PORCION CORRIENTE": {
|
||||
"Contratos bajo arrendamientos financieros": {
|
||||
"account_number": "21030100",
|
||||
"account_type": "Payable",
|
||||
"is_group": 1
|
||||
},
|
||||
"account_number": "21030000",
|
||||
"account_type": "Payable"
|
||||
},
|
||||
"OTROS ACREEDORES, RETENCIONES Y DESCUENTOS": {
|
||||
"Cuentas por pagar a accionistas": {
|
||||
"account_number": "21040400",
|
||||
"account_type": "Payable",
|
||||
"is_group": 1
|
||||
},
|
||||
"Descuentos": {
|
||||
"account_number": "21040300",
|
||||
"account_type": "Payable",
|
||||
"is_group": 1
|
||||
},
|
||||
"Otros acreedores": {
|
||||
"account_number": "21040100",
|
||||
"account_type": "Payable",
|
||||
"is_group": 1
|
||||
},
|
||||
"Retenciones": {
|
||||
"account_number": "21040200",
|
||||
"account_type": "Payable",
|
||||
"is_group": 1
|
||||
},
|
||||
"account_number": "21040000",
|
||||
"account_type": "Payable"
|
||||
},
|
||||
"PRESTAMOS Y SOBREGIROS BANCARIOS": {
|
||||
"Porci\u00f3n corriente de prestamos bancarios a largo plazo": {
|
||||
"account_number": "21010300",
|
||||
"is_group": 1
|
||||
},
|
||||
"Prestamos bancarios a corto plazo": {
|
||||
"account_number": "21010100",
|
||||
"is_group": 1
|
||||
},
|
||||
"Sobregiros bancarios": {
|
||||
"account_number": "21010200",
|
||||
"is_group": 1
|
||||
},
|
||||
"account_number": "21010000"
|
||||
},
|
||||
"account_number": "21000000"
|
||||
},
|
||||
"PASIVOS NO CORRIENTES": {
|
||||
"ANTICIPOS Y GARANTIAS DE CLIENTES": {
|
||||
"Anticipos de clientes": {
|
||||
"account_number": "22040100",
|
||||
"account_type": "Temporary",
|
||||
"is_group": 1
|
||||
},
|
||||
"Garant\u00edas de clientes": {
|
||||
"account_number": "22040200",
|
||||
"account_type": "Temporary",
|
||||
"is_group": 1
|
||||
},
|
||||
"account_number": "22040000",
|
||||
"account_type": "Temporary"
|
||||
},
|
||||
"INTERES MINOTARIO": {
|
||||
"Inter\u00e9s de accionista minotarios": {
|
||||
"account_number": "22050100",
|
||||
"is_group": 1
|
||||
},
|
||||
"account_number": "22050000"
|
||||
},
|
||||
"OBLIGACIONES BAJO ARRENDAMIENTOS FINANCIEROS A LARGO PLAZO": {
|
||||
"Contratos bajo arrendamientos financieros": {
|
||||
"account_number": "22030100",
|
||||
"is_group": 1
|
||||
},
|
||||
"account_number": "22030000"
|
||||
},
|
||||
"OTROS PRESTAMOS A LARGO PLAZO": {
|
||||
"account_number": "22020000",
|
||||
"is_group": 1
|
||||
},
|
||||
"PRESTAMOS BANCARIOS A LARGO PLAZO": {
|
||||
"account_number": "22010000",
|
||||
"is_group": 1
|
||||
},
|
||||
"account_number": "22000000"
|
||||
},
|
||||
"PROVISIONES": {
|
||||
"IMPUESTOS SOBRE LA RENTA COMPLEMENTARIO": {
|
||||
"Ejercicios anteriores": {
|
||||
"account_number": "23010100",
|
||||
"account_type": "Tax",
|
||||
"is_group": 1
|
||||
},
|
||||
"account_number": "23010000",
|
||||
"account_type": "Tax"
|
||||
},
|
||||
"PROVISION PARA OBLIGACIONES LABORALES": {
|
||||
"Indemnizaci\u00f3n": {
|
||||
"account_number": "23020100",
|
||||
"is_group": 1
|
||||
},
|
||||
"account_number": "23020000"
|
||||
},
|
||||
"account_number": "23000000"
|
||||
},
|
||||
"account_number": "20000000",
|
||||
"root_type": "Liability"
|
||||
},
|
||||
"30000000 - PATRIMONIO - xmC": {
|
||||
"CAPITAL, RESERVAS Y RESULTADOS": {
|
||||
"CAPITAL SOCIAL": {
|
||||
"Capital Social M\u00ednimo": {
|
||||
"Capital Social M\u00ednimo NO Pagado": {
|
||||
"account_number": "31010102",
|
||||
"account_type": "Equity",
|
||||
"is_group": 1
|
||||
},
|
||||
"Capital Social M\u00ednimo Suscrito": {
|
||||
"account_number": "31010101",
|
||||
"account_type": "Equity",
|
||||
"is_group": 1
|
||||
},
|
||||
"account_number": "31010100",
|
||||
"account_type": "Equity"
|
||||
},
|
||||
"Capital Social Variable": {
|
||||
"Capital Social Variable NO Pagado": {
|
||||
"account_number": "31010202",
|
||||
"account_type": "Equity",
|
||||
"is_group": 1
|
||||
},
|
||||
"Capital Social Variable Suscrito": {
|
||||
"account_number": "31010201",
|
||||
"account_type": "Equity",
|
||||
"is_group": 1
|
||||
},
|
||||
"account_number": "31010200",
|
||||
"account_type": "Equity"
|
||||
},
|
||||
"account_number": "31010000",
|
||||
"account_type": "Equity"
|
||||
},
|
||||
"DIVIDENDOS PAGADOS": {
|
||||
"account_number": "31060000",
|
||||
"account_type": "Equity",
|
||||
"is_group": 1
|
||||
},
|
||||
"GANANCIAS NO DISTRIBUIDAS": {
|
||||
"De ejercicios anteriores": {
|
||||
"account_number": "31020100",
|
||||
"account_type": "Equity",
|
||||
"is_group": 1
|
||||
},
|
||||
"Del presente ejercicio": {
|
||||
"account_number": "31020200",
|
||||
"account_type": "Equity",
|
||||
"is_group": 1
|
||||
},
|
||||
"account_number": "31020000",
|
||||
"account_type": "Equity"
|
||||
},
|
||||
"GANANCIAS RESTRINGIDAS": {
|
||||
"Reserva legal": {
|
||||
"account_number": "31030100",
|
||||
"account_type": "Equity",
|
||||
"is_group": 1
|
||||
},
|
||||
"account_number": "31030000",
|
||||
"account_type": "Equity"
|
||||
},
|
||||
"PERDIDAS ACUMULADAS (CR)": {
|
||||
"De ejercicios anteriores": {
|
||||
"account_number": "31050100",
|
||||
"account_type": "Equity",
|
||||
"is_group": 1
|
||||
},
|
||||
"Del presente ejercicio": {
|
||||
"account_number": "31050200",
|
||||
"account_type": "Equity",
|
||||
"is_group": 1
|
||||
},
|
||||
"account_number": "31050000",
|
||||
"account_type": "Equity"
|
||||
},
|
||||
"SUPERAVIT POR REVALUACIONES": {
|
||||
"Super\u00e1vit por revaluaci\u00f3n de activos": {
|
||||
"account_number": "31040100",
|
||||
"account_type": "Equity",
|
||||
"is_group": 1
|
||||
},
|
||||
"account_number": "31040000",
|
||||
"account_type": "Equity"
|
||||
},
|
||||
"account_number": "31000000",
|
||||
"account_type": "Equity"
|
||||
},
|
||||
"account_number": "30000000",
|
||||
"root_type": "Equity"
|
||||
},
|
||||
"40000000 - CUENTAS DE RESULTADO DEUDORAS - xmC": {
|
||||
"COSTOS Y GASTOS DE OPERACI\u00d3N": {
|
||||
"41010000 - COSTO DE LAS VENTAS - xmC": {
|
||||
"account_number": "41010000",
|
||||
"account_type": "Cost of Goods Sold"
|
||||
},
|
||||
"GASTOS DE DEPARTAMENTO DE OPERACIONES": {
|
||||
"41020600 - Depreciaciones y amortizaciones - xmC": {
|
||||
"account_number": "41020600",
|
||||
"account_type": "Depreciation"
|
||||
},
|
||||
"41020900 - Redondeos - xmC": {
|
||||
"account_number": "41020900",
|
||||
"account_type": "Round Off"
|
||||
},
|
||||
"Gastos operativos": {
|
||||
"account_number": "41020700",
|
||||
"account_type": "Chargeable",
|
||||
"is_group": 1
|
||||
},
|
||||
"Mantenimientos": {
|
||||
"account_number": "41020400",
|
||||
"account_type": "Chargeable",
|
||||
"is_group": 1
|
||||
},
|
||||
"Materiales y suministros": {
|
||||
"Ajustes de Inventario": {
|
||||
"account_number": "41020201",
|
||||
"account_type": "Stock Adjustment"
|
||||
},
|
||||
"account_number": "41020200",
|
||||
"account_type": "Chargeable"
|
||||
},
|
||||
"Seguros": {
|
||||
"account_number": "41020500",
|
||||
"account_type": "Chargeable",
|
||||
"is_group": 1
|
||||
},
|
||||
"Servicios b\u00e1sicos": {
|
||||
"account_number": "41020300",
|
||||
"account_type": "Chargeable",
|
||||
"is_group": 1
|
||||
},
|
||||
"Servicios y honorarios profesionales": {
|
||||
"account_number": "41020800",
|
||||
"account_type": "Chargeable",
|
||||
"is_group": 1
|
||||
},
|
||||
"Sueldos y prestaciones laborales": {
|
||||
"account_number": "41020100",
|
||||
"account_type": "Chargeable",
|
||||
"is_group": 1
|
||||
},
|
||||
"account_number": "41020000",
|
||||
"account_type": "Expense Account"
|
||||
},
|
||||
"GASTOS DE VENTAS Y DISTRIBUCION": {
|
||||
"Depreciaciones y amortizaciones": {
|
||||
"account_number": "41030600",
|
||||
"account_type": "Chargeable",
|
||||
"is_group": 1
|
||||
},
|
||||
"Gastos operativos": {
|
||||
"account_number": "41030700",
|
||||
"account_type": "Chargeable",
|
||||
"is_group": 1
|
||||
},
|
||||
"Mantenimientos": {
|
||||
"account_number": "41030400",
|
||||
"account_type": "Chargeable",
|
||||
"is_group": 1
|
||||
},
|
||||
"Materiales y suministros": {
|
||||
"account_number": "41030200",
|
||||
"account_type": "Chargeable",
|
||||
"is_group": 1
|
||||
},
|
||||
"Seguros": {
|
||||
"account_number": "41030500",
|
||||
"account_type": "Chargeable",
|
||||
"is_group": 1
|
||||
},
|
||||
"Servicios b\u00e1sicos": {
|
||||
"account_number": "41030300",
|
||||
"account_type": "Chargeable",
|
||||
"is_group": 1
|
||||
},
|
||||
"Servicios y honorarios profesionales": {
|
||||
"account_number": "41030800",
|
||||
"account_type": "Chargeable",
|
||||
"is_group": 1
|
||||
},
|
||||
"Sueldos y prestaciones laborales": {
|
||||
"account_number": "41030100",
|
||||
"account_type": "Chargeable",
|
||||
"is_group": 1
|
||||
},
|
||||
"account_number": "41030000",
|
||||
"account_type": "Expense Account"
|
||||
},
|
||||
"account_number": "41000000",
|
||||
"account_type": "Expense Account"
|
||||
},
|
||||
"GASTOS DE IMPUESTO SOBRE LA RENTA": {
|
||||
"GASTOS DE IMPUESTO SOBRE LA RENTA CORRIENTE": {
|
||||
"account_number": "43010000",
|
||||
"account_type": "Expense Account",
|
||||
"is_group": 1
|
||||
},
|
||||
"account_number": "43000000",
|
||||
"account_type": "Expense Account"
|
||||
},
|
||||
"GASTOS DE NO OPERACI\u00d3N": {
|
||||
"42020000 - GASTOS NO DEDUCIBLES - xmC": {
|
||||
"Garant\u00eda por venta de productos": {
|
||||
"account_number": "42020200",
|
||||
"account_type": "Expense Account",
|
||||
"is_group": 1
|
||||
},
|
||||
"Impuesto sobre la renta complementario": {
|
||||
"account_number": "42020100",
|
||||
"account_type": "Tax",
|
||||
"is_group": 1
|
||||
},
|
||||
"account_number": "42020000",
|
||||
"account_type": "Expense Account"
|
||||
},
|
||||
"GASTOS FINANCIEROS": {
|
||||
"42010100 - Intereses - xmC": {
|
||||
"account_number": "42010100",
|
||||
"account_type": "Expense Account",
|
||||
"is_group": 1
|
||||
},
|
||||
"42010300 - Diferenciales cambiarios - xmC": {
|
||||
"account_number": "42010300",
|
||||
"account_type": "Expense Account",
|
||||
"is_group": 1
|
||||
},
|
||||
"Comisiones bancarias": {
|
||||
"account_number": "42010200",
|
||||
"account_type": "Expense Account",
|
||||
"is_group": 1
|
||||
},
|
||||
"account_number": "42010000",
|
||||
"account_type": "Expense Account"
|
||||
},
|
||||
"account_number": "42000000",
|
||||
"account_type": "Expense Account"
|
||||
},
|
||||
"account_number": "40000000",
|
||||
"root_type": "Expense"
|
||||
},
|
||||
"50000000 - CUENTAS DE RESULTADO ACREEDORAS - xmC": {
|
||||
"INGRESOS DE NO OPERACI\u00d3N": {
|
||||
"DIVIDENDOS GANADOS": {
|
||||
"Dividendos devengados por inversiones": {
|
||||
"account_number": "52020100",
|
||||
"account_type": "Income Account",
|
||||
"is_group": 1
|
||||
},
|
||||
"account_number": "52020000",
|
||||
"account_type": "Income Account"
|
||||
},
|
||||
"INGRESOS FINANCIEROS": {
|
||||
"Comisiones": {
|
||||
"account_number": "52010200",
|
||||
"account_type": "Income Account",
|
||||
"is_group": 1
|
||||
},
|
||||
"Diferenciales cambiarios": {
|
||||
"account_number": "52010300",
|
||||
"account_type": "Income Account",
|
||||
"is_group": 1
|
||||
},
|
||||
"Intereses": {
|
||||
"account_number": "52010100",
|
||||
"account_type": "Income Account",
|
||||
"is_group": 1
|
||||
},
|
||||
"account_number": "52010000",
|
||||
"account_type": "Income Account"
|
||||
},
|
||||
"OTROS INGRESOS": {
|
||||
"Ingresos por activos dados en arrendamientos financieros": {
|
||||
"account_number": "52030200",
|
||||
"account_type": "Income Account",
|
||||
"is_group": 1
|
||||
},
|
||||
"Ingresos por conversi\u00f3n": {
|
||||
"account_number": "52030100",
|
||||
"account_type": "Income Account",
|
||||
"is_group": 1
|
||||
},
|
||||
"Reintegros de seguros": {
|
||||
"account_number": "52030300",
|
||||
"account_type": "Income Account",
|
||||
"is_group": 1
|
||||
},
|
||||
"account_number": "52030000",
|
||||
"account_type": "Income Account"
|
||||
},
|
||||
"account_number": "52000000",
|
||||
"account_type": "Income Account"
|
||||
},
|
||||
"INGRESOS POR OPERACIONES CONTINUAS": {
|
||||
"51010000 - VENTAS DE BIENES - xmC": {
|
||||
"account_number": "51010000",
|
||||
"account_type": "Income Account"
|
||||
},
|
||||
"VENTAS DE SERVICIOS": {
|
||||
"account_number": "51020000",
|
||||
"account_type": "Income Account",
|
||||
"is_group": 1
|
||||
},
|
||||
"account_number": "51000000",
|
||||
"account_type": "Income Account"
|
||||
},
|
||||
"account_number": "50000000",
|
||||
"root_type": "Income"
|
||||
},
|
||||
"60000000 - CUENTA LIQUIDADORA DE RESULTADOS - xmC": {
|
||||
"CUENTA DE CIERRE": {
|
||||
"PERDIDAS Y GANANCIAS": {
|
||||
"account_number": "61010000",
|
||||
"is_group": 1
|
||||
},
|
||||
"account_number": "61000000"
|
||||
},
|
||||
"account_number": "60000000",
|
||||
"root_type": "Income"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -160,7 +160,7 @@ def _make_test_records(verbose):
|
||||
["_Test Payable USD", "Current Liabilities", 0, "Payable", "USD"]
|
||||
]
|
||||
|
||||
for company, abbr in [["_Test Company", "_TC"], ["_Test Company 1", "_TC1"]]:
|
||||
for company, abbr in [["_Test Company", "_TC"], ["_Test Company 1", "_TC1"], ["_Test Company with perpetual inventory", "TCP1"]]:
|
||||
test_objects = make_test_objects("Account", [{
|
||||
"doctype": "Account",
|
||||
"account_name": account_name,
|
||||
|
||||
@@ -5,9 +5,13 @@ frappe.ui.form.on('Accounting Dimension', {
|
||||
|
||||
refresh: function(frm) {
|
||||
frm.set_query('document_type', () => {
|
||||
let invalid_doctypes = frappe.model.core_doctypes_list;
|
||||
invalid_doctypes.push('Accounting Dimension', 'Project',
|
||||
'Cost Center', 'Accounting Dimension Detail');
|
||||
|
||||
return {
|
||||
filters: {
|
||||
name: ['not in', ['Accounting Dimension', 'Project', 'Cost Center', 'Accounting Dimension Detail']]
|
||||
name: ['not in', invalid_doctypes]
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
@@ -11,10 +11,25 @@ from frappe.custom.doctype.custom_field.custom_field import create_custom_field
|
||||
from frappe import scrub
|
||||
from frappe.utils import cstr
|
||||
from frappe.utils.background_jobs import enqueue
|
||||
from frappe.model import core_doctypes_list
|
||||
|
||||
class AccountingDimension(Document):
|
||||
def before_insert(self):
|
||||
self.set_fieldname_and_label()
|
||||
|
||||
def validate(self):
|
||||
if self.document_type in core_doctypes_list + ('Accounting Dimension', 'Project',
|
||||
'Cost Center', 'Accounting Dimension Detail') :
|
||||
|
||||
msg = _("Not allowed to create accounting dimension for {0}").format(self.document_type)
|
||||
frappe.throw(msg)
|
||||
|
||||
exists = frappe.db.get_value("Accounting Dimension", {'document_type': self.document_type}, ['name'])
|
||||
|
||||
if exists and self.is_new():
|
||||
frappe.throw("Document Type already used as a dimension")
|
||||
|
||||
def after_insert(self):
|
||||
if frappe.flags.in_test:
|
||||
make_dimension_in_accounting_doctypes(doc=self)
|
||||
else:
|
||||
@@ -50,7 +65,8 @@ def make_dimension_in_accounting_doctypes(doc):
|
||||
"label": doc.label,
|
||||
"fieldtype": "Link",
|
||||
"options": doc.document_type,
|
||||
"insert_after": insert_after_field
|
||||
"insert_after": insert_after_field,
|
||||
"owner": "Administrator"
|
||||
}
|
||||
|
||||
if doctype == "Budget":
|
||||
@@ -164,7 +180,7 @@ def get_accounting_dimensions(as_list=True):
|
||||
return accounting_dimensions
|
||||
|
||||
def get_checks_for_pl_and_bs_accounts():
|
||||
dimensions = frappe.db.sql("""SELECT p.label, p.disabled, p.fieldname, c.company, c.mandatory_for_pl, c.mandatory_for_bs
|
||||
dimensions = frappe.db.sql("""SELECT p.label, p.disabled, p.fieldname, c.default_dimension, c.company, c.mandatory_for_pl, c.mandatory_for_bs
|
||||
FROM `tabAccounting Dimension`p ,`tabAccounting Dimension Detail` c
|
||||
WHERE p.name = c.parent""", as_dict=1)
|
||||
|
||||
|
||||
@@ -17,8 +17,7 @@
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 1,
|
||||
"label": "Company",
|
||||
"options": "Company",
|
||||
"reqd": 1
|
||||
"options": "Company"
|
||||
},
|
||||
{
|
||||
"fieldname": "reference_document",
|
||||
@@ -34,8 +33,7 @@
|
||||
"fieldtype": "Dynamic Link",
|
||||
"in_list_view": 1,
|
||||
"label": "Default Dimension",
|
||||
"options": "reference_document",
|
||||
"reqd": 1
|
||||
"options": "reference_document"
|
||||
},
|
||||
{
|
||||
"columns": 3,
|
||||
@@ -55,7 +53,7 @@
|
||||
}
|
||||
],
|
||||
"istable": 1,
|
||||
"modified": "2019-07-17 23:34:33.026883",
|
||||
"modified": "2019-08-15 11:59:09.389891",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Accounting Dimension Detail",
|
||||
|
||||
@@ -15,8 +15,8 @@ class AccountsSettings(Document):
|
||||
frappe.clear_cache()
|
||||
|
||||
def validate(self):
|
||||
for f in ["add_taxes_from_item_tax_template"]:
|
||||
frappe.db.set_default(f, self.get(f, ""))
|
||||
frappe.db.set_default("add_taxes_from_item_tax_template",
|
||||
self.get("add_taxes_from_item_tax_template", 0))
|
||||
|
||||
self.validate_stale_days()
|
||||
self.enable_payment_schedule_in_print()
|
||||
|
||||
@@ -8,7 +8,7 @@ def get_data():
|
||||
'fieldname': 'bank',
|
||||
'transactions': [
|
||||
{
|
||||
'label': _('Bank Deatils'),
|
||||
'label': _('Bank Details'),
|
||||
'items': ['Bank Account', 'Bank Guarantee']
|
||||
}
|
||||
]
|
||||
|
||||
@@ -20,7 +20,7 @@ frappe.ui.form.on('Bank Account', {
|
||||
},
|
||||
refresh: function(frm) {
|
||||
frappe.dynamic_link = { doc: frm.doc, fieldname: 'name', doctype: 'Bank Account' }
|
||||
|
||||
|
||||
frm.toggle_display(['address_html','contact_html'], !frm.doc.__islocal);
|
||||
|
||||
if (frm.doc.__islocal) {
|
||||
@@ -37,5 +37,9 @@ frappe.ui.form.on('Bank Account', {
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
is_company_account: function(frm) {
|
||||
frm.set_df_property('account', 'reqd', frm.doc.is_company_account);
|
||||
}
|
||||
});
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -9,12 +9,11 @@ def get_data():
|
||||
'non_standard_fieldnames': {
|
||||
'Customer': 'default_bank_account',
|
||||
'Supplier': 'default_bank_account',
|
||||
'Journal Entry': 'bank_account_no'
|
||||
},
|
||||
'transactions': [
|
||||
{
|
||||
'label': _('Payments'),
|
||||
'items': ['Payment Entry', 'Payment Request', 'Payment Order']
|
||||
'items': ['Payment Entry', 'Payment Request', 'Payment Order', 'Payroll Entry']
|
||||
},
|
||||
{
|
||||
'label': _('Party'),
|
||||
|
||||
@@ -50,7 +50,7 @@ class BankTransaction(StatusUpdater):
|
||||
if paid_amount and allocated_amount:
|
||||
if flt(allocated_amount[0]["allocated_amount"]) > flt(paid_amount):
|
||||
frappe.throw(_("The total allocated amount ({0}) is greated than the paid amount ({1}).".format(flt(allocated_amount[0]["allocated_amount"]), flt(paid_amount))))
|
||||
elif flt(allocated_amount[0]["allocated_amount"]) == flt(paid_amount):
|
||||
else:
|
||||
if payment_entry.payment_document in ["Payment Entry", "Journal Entry", "Purchase Invoice", "Expense Claim"]:
|
||||
self.clear_simple_entry(payment_entry)
|
||||
|
||||
|
||||
@@ -11,32 +11,32 @@ from erpnext.buying.doctype.purchase_order.test_purchase_order import create_pur
|
||||
from erpnext.accounts.doctype.budget.budget import get_actual_expense, BudgetError
|
||||
from erpnext.accounts.doctype.journal_entry.test_journal_entry import make_journal_entry
|
||||
|
||||
class TestBudget(unittest.TestCase):
|
||||
class TestBudget(unittest.TestCase):
|
||||
def test_monthly_budget_crossed_ignore(self):
|
||||
set_total_expense_zero("2013-02-28", "Cost Center")
|
||||
|
||||
budget = make_budget(budget_against="Cost Center")
|
||||
|
||||
|
||||
jv = make_journal_entry("_Test Account Cost for Goods Sold - _TC",
|
||||
"_Test Bank - _TC", 40000, "_Test Cost Center - _TC", posting_date="2013-02-28", submit=True)
|
||||
|
||||
self.assertTrue(frappe.db.get_value("GL Entry",
|
||||
{"voucher_type": "Journal Entry", "voucher_no": jv.name}))
|
||||
|
||||
|
||||
budget.cancel()
|
||||
|
||||
def test_monthly_budget_crossed_stop1(self):
|
||||
set_total_expense_zero("2013-02-28", "Cost Center")
|
||||
|
||||
budget = make_budget(budget_against="Cost Center")
|
||||
|
||||
|
||||
frappe.db.set_value("Budget", budget.name, "action_if_accumulated_monthly_budget_exceeded", "Stop")
|
||||
|
||||
jv = make_journal_entry("_Test Account Cost for Goods Sold - _TC",
|
||||
"_Test Bank - _TC", 40000, "_Test Cost Center - _TC", posting_date="2013-02-28")
|
||||
|
||||
self.assertRaises(BudgetError, jv.submit)
|
||||
|
||||
|
||||
budget.load_from_db()
|
||||
budget.cancel()
|
||||
|
||||
@@ -46,7 +46,7 @@ class TestBudget(unittest.TestCase):
|
||||
budget = make_budget(budget_against="Cost Center")
|
||||
|
||||
frappe.db.set_value("Budget", budget.name, "action_if_accumulated_monthly_budget_exceeded", "Stop")
|
||||
|
||||
|
||||
jv = make_journal_entry("_Test Account Cost for Goods Sold - _TC",
|
||||
"_Test Bank - _TC", 40000, "_Test Cost Center - _TC", posting_date="2013-03-02")
|
||||
|
||||
@@ -117,14 +117,14 @@ class TestBudget(unittest.TestCase):
|
||||
set_total_expense_zero("2013-02-28", "Project")
|
||||
|
||||
budget = make_budget(budget_against="Project")
|
||||
|
||||
|
||||
frappe.db.set_value("Budget", budget.name, "action_if_accumulated_monthly_budget_exceeded", "Stop")
|
||||
|
||||
jv = make_journal_entry("_Test Account Cost for Goods Sold - _TC",
|
||||
"_Test Bank - _TC", 40000, "_Test Cost Center - _TC", project="_Test Project", posting_date="2013-02-28")
|
||||
|
||||
self.assertRaises(BudgetError, jv.submit)
|
||||
|
||||
|
||||
budget.load_from_db()
|
||||
budget.cancel()
|
||||
|
||||
@@ -132,31 +132,31 @@ class TestBudget(unittest.TestCase):
|
||||
set_total_expense_zero("2013-02-28", "Cost Center")
|
||||
|
||||
budget = make_budget(budget_against="Cost Center")
|
||||
|
||||
|
||||
jv = make_journal_entry("_Test Account Cost for Goods Sold - _TC",
|
||||
"_Test Bank - _TC", 150000, "_Test Cost Center - _TC", posting_date="2013-03-28")
|
||||
|
||||
self.assertRaises(BudgetError, jv.submit)
|
||||
|
||||
|
||||
budget.cancel()
|
||||
|
||||
def test_yearly_budget_crossed_stop2(self):
|
||||
set_total_expense_zero("2013-02-28", "Project")
|
||||
|
||||
budget = make_budget(budget_against="Project")
|
||||
|
||||
|
||||
jv = make_journal_entry("_Test Account Cost for Goods Sold - _TC",
|
||||
"_Test Bank - _TC", 150000, "_Test Cost Center - _TC", project="_Test Project", posting_date="2013-03-28")
|
||||
|
||||
self.assertRaises(BudgetError, jv.submit)
|
||||
|
||||
|
||||
budget.cancel()
|
||||
|
||||
def test_monthly_budget_on_cancellation1(self):
|
||||
set_total_expense_zero("2013-02-28", "Cost Center")
|
||||
|
||||
budget = make_budget(budget_against="Cost Center")
|
||||
|
||||
|
||||
jv1 = make_journal_entry("_Test Account Cost for Goods Sold - _TC",
|
||||
"_Test Bank - _TC", 20000, "_Test Cost Center - _TC", posting_date="2013-02-28", submit=True)
|
||||
|
||||
@@ -170,9 +170,9 @@ class TestBudget(unittest.TestCase):
|
||||
{"voucher_type": "Journal Entry", "voucher_no": jv2.name}))
|
||||
|
||||
frappe.db.set_value("Budget", budget.name, "action_if_accumulated_monthly_budget_exceeded", "Stop")
|
||||
|
||||
|
||||
self.assertRaises(BudgetError, jv1.cancel)
|
||||
|
||||
|
||||
budget.load_from_db()
|
||||
budget.cancel()
|
||||
|
||||
@@ -180,7 +180,7 @@ class TestBudget(unittest.TestCase):
|
||||
set_total_expense_zero("2013-02-28", "Project")
|
||||
|
||||
budget = make_budget(budget_against="Project")
|
||||
|
||||
|
||||
jv1 = make_journal_entry("_Test Account Cost for Goods Sold - _TC",
|
||||
"_Test Bank - _TC", 20000, "_Test Cost Center - _TC", posting_date="2013-02-28", submit=True, project="_Test Project")
|
||||
|
||||
@@ -194,16 +194,16 @@ class TestBudget(unittest.TestCase):
|
||||
{"voucher_type": "Journal Entry", "voucher_no": jv2.name}))
|
||||
|
||||
frappe.db.set_value("Budget", budget.name, "action_if_accumulated_monthly_budget_exceeded", "Stop")
|
||||
|
||||
|
||||
self.assertRaises(BudgetError, jv1.cancel)
|
||||
|
||||
|
||||
budget.load_from_db()
|
||||
budget.cancel()
|
||||
|
||||
def test_monthly_budget_against_group_cost_center(self):
|
||||
set_total_expense_zero("2013-02-28", "Cost Center")
|
||||
set_total_expense_zero("2013-02-28", "Cost Center", "_Test Cost Center 2 - _TC")
|
||||
|
||||
|
||||
budget = make_budget(budget_against="Cost Center", cost_center="_Test Company - _TC")
|
||||
frappe.db.set_value("Budget", budget.name, "action_if_accumulated_monthly_budget_exceeded", "Stop")
|
||||
|
||||
@@ -211,7 +211,7 @@ class TestBudget(unittest.TestCase):
|
||||
"_Test Bank - _TC", 40000, "_Test Cost Center 2 - _TC", posting_date="2013-02-28")
|
||||
|
||||
self.assertRaises(BudgetError, jv.submit)
|
||||
|
||||
|
||||
budget.load_from_db()
|
||||
budget.cancel()
|
||||
|
||||
@@ -239,8 +239,6 @@ class TestBudget(unittest.TestCase):
|
||||
budget.cancel()
|
||||
jv.cancel()
|
||||
|
||||
frappe.delete_doc('Journal Entry', jv.name)
|
||||
frappe.delete_doc('Cost Center', cost_center)
|
||||
|
||||
def set_total_expense_zero(posting_date, budget_against_field=None, budget_against_CC=None):
|
||||
if budget_against_field == "Project":
|
||||
@@ -256,7 +254,7 @@ def set_total_expense_zero(posting_date, budget_against_field=None, budget_again
|
||||
"budget_against_field": budget_against_field,
|
||||
"budget_against": budget_against
|
||||
}))
|
||||
|
||||
|
||||
if existing_expense:
|
||||
if budget_against_field == "Cost Center":
|
||||
make_journal_entry("_Test Account Cost for Goods Sold - _TC",
|
||||
@@ -281,13 +279,13 @@ def make_budget(**args):
|
||||
frappe.db.sql("delete from `tabBudget Account` where parent = %(name)s", d)
|
||||
|
||||
budget = frappe.new_doc("Budget")
|
||||
|
||||
|
||||
if budget_against == "Project":
|
||||
budget.project = "_Test Project"
|
||||
else:
|
||||
budget.cost_center =cost_center or "_Test Cost Center - _TC"
|
||||
|
||||
|
||||
|
||||
|
||||
budget.fiscal_year = "_Test Fiscal Year 2013"
|
||||
budget.monthly_distribution = "_Test Distribution"
|
||||
budget.company = "_Test Company"
|
||||
@@ -299,7 +297,7 @@ def make_budget(**args):
|
||||
"account": "_Test Account Cost for Goods Sold - _TC",
|
||||
"budget_amount": 100000
|
||||
})
|
||||
|
||||
|
||||
if args.applicable_on_material_request:
|
||||
budget.applicable_on_material_request = 1
|
||||
budget.action_if_annual_budget_exceeded_on_mr = args.action_if_annual_budget_exceeded_on_mr or 'Warn'
|
||||
|
||||
@@ -150,7 +150,7 @@ def validate_accounts(file_name):
|
||||
accounts_dict = {}
|
||||
for account in accounts:
|
||||
accounts_dict.setdefault(account["account_name"], account)
|
||||
if account["parent_account"] and accounts_dict[account["parent_account"]]:
|
||||
if account["parent_account"] and accounts_dict.get(account["parent_account"]):
|
||||
accounts_dict[account["parent_account"]]["is_group"] = 1
|
||||
|
||||
message = validate_root(accounts_dict)
|
||||
|
||||
@@ -1,457 +1,170 @@
|
||||
{
|
||||
"allow_copy": 1,
|
||||
"allow_guest_to_view": 0,
|
||||
"allow_import": 1,
|
||||
"allow_rename": 1,
|
||||
"autoname": "field:cost_center_name",
|
||||
"beta": 0,
|
||||
"creation": "2013-01-23 19:57:17",
|
||||
"custom": 0,
|
||||
"description": "Track separate Income and Expense for product verticals or divisions.",
|
||||
"docstatus": 0,
|
||||
"doctype": "DocType",
|
||||
"document_type": "Setup",
|
||||
"editable_grid": 0,
|
||||
"allow_copy": 1,
|
||||
"allow_import": 1,
|
||||
"allow_rename": 1,
|
||||
"creation": "2013-01-23 19:57:17",
|
||||
"description": "Track separate Income and Expense for product verticals or divisions.",
|
||||
"doctype": "DocType",
|
||||
"document_type": "Setup",
|
||||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
"sb0",
|
||||
"cost_center_name",
|
||||
"cost_center_number",
|
||||
"parent_cost_center",
|
||||
"company",
|
||||
"cb0",
|
||||
"is_group",
|
||||
"disabled",
|
||||
"lft",
|
||||
"rgt",
|
||||
"old_parent"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "sb0",
|
||||
"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": "",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"fieldname": "sb0",
|
||||
"fieldtype": "Section Break"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "cost_center_name",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Cost Center Name",
|
||||
"length": 0,
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "cost_center_name",
|
||||
"oldfieldtype": "Data",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"fieldname": "cost_center_name",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
"label": "Cost Center Name",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "cost_center_name",
|
||||
"oldfieldtype": "Data",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "cost_center_number",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 1,
|
||||
"label": "Cost Center Number",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"fieldname": "cost_center_number",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 1,
|
||||
"label": "Cost Center Number",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "parent_cost_center",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 1,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Parent Cost Center",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"oldfieldname": "parent_cost_center",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Cost Center",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"fieldname": "parent_cost_center",
|
||||
"fieldtype": "Link",
|
||||
"ignore_user_permissions": 1,
|
||||
"in_list_view": 1,
|
||||
"label": "Parent Cost Center",
|
||||
"oldfieldname": "parent_cost_center",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Cost Center",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "company",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 1,
|
||||
"label": "Company",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"oldfieldname": "company_name",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Company",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 1,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"fieldname": "company",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 1,
|
||||
"label": "Company",
|
||||
"oldfieldname": "company_name",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Company",
|
||||
"remember_last_selected_value": 1,
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "cb0",
|
||||
"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,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0,
|
||||
"fieldname": "cb0",
|
||||
"fieldtype": "Column Break",
|
||||
"width": "50%"
|
||||
},
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"default": "0",
|
||||
"fieldname": "is_group",
|
||||
"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": "Is Group",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"default": "0",
|
||||
"fieldname": "is_group",
|
||||
"fieldtype": "Check",
|
||||
"label": "Is Group"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "lft",
|
||||
"fieldtype": "Int",
|
||||
"hidden": 1,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "lft",
|
||||
"length": 0,
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "lft",
|
||||
"oldfieldtype": "Int",
|
||||
"permlevel": 0,
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 1,
|
||||
"reqd": 0,
|
||||
"search_index": 1,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"fieldname": "lft",
|
||||
"fieldtype": "Int",
|
||||
"hidden": 1,
|
||||
"label": "lft",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "lft",
|
||||
"oldfieldtype": "Int",
|
||||
"print_hide": 1,
|
||||
"report_hide": 1,
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "rgt",
|
||||
"fieldtype": "Int",
|
||||
"hidden": 1,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "rgt",
|
||||
"length": 0,
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "rgt",
|
||||
"oldfieldtype": "Int",
|
||||
"permlevel": 0,
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 1,
|
||||
"reqd": 0,
|
||||
"search_index": 1,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"fieldname": "rgt",
|
||||
"fieldtype": "Int",
|
||||
"hidden": 1,
|
||||
"label": "rgt",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "rgt",
|
||||
"oldfieldtype": "Int",
|
||||
"print_hide": 1,
|
||||
"report_hide": 1,
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "old_parent",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 1,
|
||||
"ignore_user_permissions": 1,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "old_parent",
|
||||
"length": 0,
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "old_parent",
|
||||
"oldfieldtype": "Data",
|
||||
"options": "Cost Center",
|
||||
"permlevel": 0,
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 1,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
"fieldname": "old_parent",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 1,
|
||||
"ignore_user_permissions": 1,
|
||||
"label": "old_parent",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "old_parent",
|
||||
"oldfieldtype": "Data",
|
||||
"options": "Cost Center",
|
||||
"print_hide": 1,
|
||||
"report_hide": 1
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"fieldname": "disabled",
|
||||
"fieldtype": "Check",
|
||||
"label": "Disabled"
|
||||
}
|
||||
],
|
||||
"has_web_view": 0,
|
||||
"hide_heading": 0,
|
||||
"hide_toolbar": 0,
|
||||
"icon": "fa fa-money",
|
||||
"idx": 1,
|
||||
"image_view": 0,
|
||||
"in_create": 0,
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": 0,
|
||||
"modified": "2018-04-26 15:26:25.325778",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Cost Center",
|
||||
"owner": "Administrator",
|
||||
],
|
||||
"icon": "fa fa-money",
|
||||
"idx": 1,
|
||||
"modified": "2019-09-16 14:44:17.103548",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Cost Center",
|
||||
"owner": "Administrator",
|
||||
"permissions": [
|
||||
{
|
||||
"amend": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 0,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Accounts Manager",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 0,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Accounts Manager",
|
||||
"share": 1,
|
||||
"write": 1
|
||||
},
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
"email": 0,
|
||||
"export": 1,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"permlevel": 0,
|
||||
"print": 0,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Auditor",
|
||||
"set_user_permissions": 0,
|
||||
"share": 0,
|
||||
"submit": 0,
|
||||
"write": 0
|
||||
},
|
||||
"export": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Auditor"
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
"email": 1,
|
||||
"export": 0,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Accounts User",
|
||||
"set_user_permissions": 0,
|
||||
"share": 0,
|
||||
"submit": 0,
|
||||
"write": 0
|
||||
},
|
||||
"email": 1,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Accounts User"
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
"email": 0,
|
||||
"export": 0,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"permlevel": 0,
|
||||
"print": 0,
|
||||
"read": 1,
|
||||
"report": 0,
|
||||
"role": "Sales User",
|
||||
"set_user_permissions": 0,
|
||||
"share": 0,
|
||||
"submit": 0,
|
||||
"write": 0
|
||||
},
|
||||
"read": 1,
|
||||
"role": "Sales User"
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
"email": 0,
|
||||
"export": 0,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"permlevel": 0,
|
||||
"print": 0,
|
||||
"read": 1,
|
||||
"report": 0,
|
||||
"role": "Purchase User",
|
||||
"set_user_permissions": 0,
|
||||
"share": 0,
|
||||
"submit": 0,
|
||||
"write": 0
|
||||
"read": 1,
|
||||
"role": "Purchase User"
|
||||
}
|
||||
],
|
||||
"quick_entry": 1,
|
||||
"read_only": 0,
|
||||
"read_only_onload": 0,
|
||||
"search_fields": "parent_cost_center, is_group",
|
||||
"show_name_in_global_search": 1,
|
||||
"sort_order": "ASC",
|
||||
"track_changes": 0,
|
||||
"track_seen": 0
|
||||
],
|
||||
"quick_entry": 1,
|
||||
"search_fields": "parent_cost_center, is_group",
|
||||
"show_name_in_global_search": 1,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "ASC"
|
||||
}
|
||||
44
erpnext/accounts/doctype/coupon_code/coupon_code.js
Normal file
44
erpnext/accounts/doctype/coupon_code/coupon_code.js
Normal file
@@ -0,0 +1,44 @@
|
||||
// Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and contributors
|
||||
// For license information, please see license.txt
|
||||
|
||||
frappe.ui.form.on('Coupon Code', {
|
||||
setup: function(frm) {
|
||||
frm.set_query("pricing_rule", function() {
|
||||
return {
|
||||
filters: [
|
||||
["Pricing Rule","coupon_code_based", "=", "1"]
|
||||
]
|
||||
};
|
||||
});
|
||||
},
|
||||
coupon_name:function(frm){
|
||||
if (frm.doc.__islocal===1) {
|
||||
frm.trigger("make_coupon_code");
|
||||
}
|
||||
},
|
||||
coupon_type:function(frm){
|
||||
if (frm.doc.__islocal===1) {
|
||||
frm.trigger("make_coupon_code");
|
||||
}
|
||||
},
|
||||
make_coupon_code: function(frm) {
|
||||
var coupon_name=frm.doc.coupon_name;
|
||||
var coupon_code;
|
||||
if (frm.doc.coupon_type=='Gift Card') {
|
||||
coupon_code=Math.random().toString(12).substring(2, 12).toUpperCase();
|
||||
}
|
||||
else if(frm.doc.coupon_type=='Promotional'){
|
||||
coupon_name=coupon_name.replace(/\s/g,'');
|
||||
coupon_code=coupon_name.toUpperCase().slice(0,8);
|
||||
}
|
||||
frm.doc.coupon_code=coupon_code;
|
||||
frm.refresh_field('coupon_code');
|
||||
},
|
||||
refresh: function(frm) {
|
||||
if (frm.doc.pricing_rule) {
|
||||
frm.add_custom_button(__("Add/Edit Coupon Conditions"), function(){
|
||||
frappe.set_route("Form", "Pricing Rule", frm.doc.pricing_rule);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
177
erpnext/accounts/doctype/coupon_code/coupon_code.json
Normal file
177
erpnext/accounts/doctype/coupon_code/coupon_code.json
Normal file
@@ -0,0 +1,177 @@
|
||||
{
|
||||
"allow_import": 1,
|
||||
"autoname": "field:coupon_name",
|
||||
"creation": "2018-01-22 14:34:39.701832",
|
||||
"doctype": "DocType",
|
||||
"document_type": "Other",
|
||||
"editable_grid": 1,
|
||||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
"coupon_name",
|
||||
"coupon_type",
|
||||
"customer",
|
||||
"column_break_4",
|
||||
"coupon_code",
|
||||
"pricing_rule",
|
||||
"uses",
|
||||
"valid_from",
|
||||
"valid_upto",
|
||||
"maximum_use",
|
||||
"used",
|
||||
"column_break_11",
|
||||
"description",
|
||||
"amended_from"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
"description": "e.g. \"Summer Holiday 2019 Offer 20\"",
|
||||
"fieldname": "coupon_name",
|
||||
"fieldtype": "Data",
|
||||
"label": "Coupon Name",
|
||||
"reqd": 1,
|
||||
"unique": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "coupon_type",
|
||||
"fieldtype": "Select",
|
||||
"in_list_view": 1,
|
||||
"label": "Coupon Type",
|
||||
"options": "Promotional\nGift Card",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"depends_on": "eval: doc.coupon_type == \"Gift Card\"",
|
||||
"fieldname": "customer",
|
||||
"fieldtype": "Link",
|
||||
"label": "Customer",
|
||||
"options": "Customer"
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_4",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"description": "unique e.g. SAVE20 To be used to get discount",
|
||||
"fieldname": "coupon_code",
|
||||
"fieldtype": "Data",
|
||||
"label": "Coupon Code",
|
||||
"no_copy": 1,
|
||||
"set_only_once": 1,
|
||||
"unique": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "pricing_rule",
|
||||
"fieldtype": "Link",
|
||||
"label": "Pricing Rule",
|
||||
"options": "Pricing Rule",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "uses",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Validity and Usage"
|
||||
},
|
||||
{
|
||||
"fieldname": "valid_from",
|
||||
"fieldtype": "Date",
|
||||
"in_list_view": 1,
|
||||
"label": "Valid From"
|
||||
},
|
||||
{
|
||||
"fieldname": "valid_upto",
|
||||
"fieldtype": "Date",
|
||||
"label": "Valid Upto"
|
||||
},
|
||||
{
|
||||
"depends_on": "eval: doc.coupon_type == \"Promotional\"",
|
||||
"fieldname": "maximum_use",
|
||||
"fieldtype": "Int",
|
||||
"label": "Maximum Use"
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"fieldname": "used",
|
||||
"fieldtype": "Int",
|
||||
"label": "Used",
|
||||
"no_copy": 1,
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_11",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"fieldname": "description",
|
||||
"fieldtype": "Text Editor",
|
||||
"label": "Coupon Description"
|
||||
},
|
||||
{
|
||||
"fieldname": "amended_from",
|
||||
"fieldtype": "Link",
|
||||
"label": "Amended From",
|
||||
"no_copy": 1,
|
||||
"options": "Coupon Code",
|
||||
"print_hide": 1,
|
||||
"read_only": 1
|
||||
}
|
||||
],
|
||||
"modified": "2019-10-19 14:48:14.602481",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Coupon Code",
|
||||
"owner": "Administrator",
|
||||
"permissions": [
|
||||
{
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "System Manager",
|
||||
"share": 1,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Accounts User",
|
||||
"share": 1,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Sales Manager",
|
||||
"share": 1,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Website Manager",
|
||||
"share": 1,
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"title_field": "coupon_name",
|
||||
"track_changes": 1
|
||||
}
|
||||
25
erpnext/accounts/doctype/coupon_code/coupon_code.py
Normal file
25
erpnext/accounts/doctype/coupon_code/coupon_code.py
Normal file
@@ -0,0 +1,25 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe import _
|
||||
from frappe.model.document import Document
|
||||
from frappe.utils import (strip)
|
||||
class CouponCode(Document):
|
||||
def autoname(self):
|
||||
self.coupon_name = strip(self.coupon_name)
|
||||
self.name = self.coupon_name
|
||||
|
||||
if not self.coupon_code:
|
||||
if self.coupon_type == "Promotional":
|
||||
self.coupon_code =''.join([i for i in self.coupon_name if not i.isdigit()])[0:8].upper()
|
||||
elif self.coupon_type == "Gift Card":
|
||||
self.coupon_code = frappe.generate_hash()[:10].upper()
|
||||
|
||||
def validate(self):
|
||||
if self.coupon_type == "Gift Card":
|
||||
self.maximum_use = 1
|
||||
if not self.customer:
|
||||
frappe.throw(_("Please select the customer."))
|
||||
@@ -2,15 +2,15 @@
|
||||
// rename this file from _test_[name] to test_[name] to activate
|
||||
// and remove above this line
|
||||
|
||||
QUnit.test("test: Asset Settings", function (assert) {
|
||||
QUnit.test("test: Coupon Code", function (assert) {
|
||||
let done = assert.async();
|
||||
|
||||
// number of asserts
|
||||
assert.expect(1);
|
||||
|
||||
frappe.run_serially([
|
||||
// insert a new Asset Settings
|
||||
() => frappe.tests.make('Asset Settings', [
|
||||
// insert a new Coupon Code
|
||||
() => frappe.tests.make('Coupon Code', [
|
||||
// values to be set
|
||||
{key: 'value'}
|
||||
]),
|
||||
132
erpnext/accounts/doctype/coupon_code/test_coupon_code.py
Normal file
132
erpnext/accounts/doctype/coupon_code/test_coupon_code.py
Normal file
@@ -0,0 +1,132 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
import unittest
|
||||
from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order
|
||||
from erpnext.stock.get_item_details import get_item_details
|
||||
from frappe.test_runner import make_test_objects
|
||||
|
||||
def test_create_test_data():
|
||||
frappe.set_user("Administrator")
|
||||
# create test item
|
||||
if not frappe.db.exists("Item","_Test Tesla Car"):
|
||||
item = frappe.get_doc({
|
||||
"description": "_Test Tesla Car",
|
||||
"doctype": "Item",
|
||||
"has_batch_no": 0,
|
||||
"has_serial_no": 0,
|
||||
"inspection_required": 0,
|
||||
"is_stock_item": 1,
|
||||
"opening_stock":100,
|
||||
"is_sub_contracted_item": 0,
|
||||
"item_code": "_Test Tesla Car",
|
||||
"item_group": "_Test Item Group",
|
||||
"item_name": "_Test Tesla Car",
|
||||
"apply_warehouse_wise_reorder_level": 0,
|
||||
"warehouse":"_Test Warehouse - _TC",
|
||||
"gst_hsn_code": "999800",
|
||||
"valuation_rate": 5000,
|
||||
"standard_rate":5000,
|
||||
"item_defaults": [{
|
||||
"company": "_Test Company",
|
||||
"default_warehouse": "_Test Warehouse - _TC",
|
||||
"default_price_list":"_Test Price List",
|
||||
"expense_account": "_Test Account Cost for Goods Sold - _TC",
|
||||
"buying_cost_center": "_Test Cost Center - _TC",
|
||||
"selling_cost_center": "_Test Cost Center - _TC",
|
||||
"income_account": "Sales - _TC"
|
||||
}],
|
||||
"show_in_website": 1,
|
||||
"route":"-test-tesla-car",
|
||||
"website_warehouse": "_Test Warehouse - _TC"
|
||||
})
|
||||
item.insert()
|
||||
# create test item price
|
||||
item_price = frappe.get_list('Item Price', filters={'item_code': '_Test Tesla Car', 'price_list': '_Test Price List'}, fields=['name'])
|
||||
if len(item_price)==0:
|
||||
item_price = frappe.get_doc({
|
||||
"doctype": "Item Price",
|
||||
"item_code": "_Test Tesla Car",
|
||||
"price_list": "_Test Price List",
|
||||
"price_list_rate": 5000
|
||||
})
|
||||
item_price.insert()
|
||||
# create test item pricing rule
|
||||
if not frappe.db.exists("Pricing Rule","_Test Pricing Rule for _Test Item"):
|
||||
item_pricing_rule = frappe.get_doc({
|
||||
"doctype": "Pricing Rule",
|
||||
"title": "_Test Pricing Rule for _Test Item",
|
||||
"apply_on": "Item Code",
|
||||
"items": [{
|
||||
"item_code": "_Test Tesla Car"
|
||||
}],
|
||||
"warehouse":"_Test Warehouse - _TC",
|
||||
"coupon_code_based":1,
|
||||
"selling": 1,
|
||||
"rate_or_discount": "Discount Percentage",
|
||||
"discount_percentage": 30,
|
||||
"company": "_Test Company",
|
||||
"currency":"INR",
|
||||
"for_price_list":"_Test Price List"
|
||||
})
|
||||
item_pricing_rule.insert()
|
||||
# create test item sales partner
|
||||
if not frappe.db.exists("Sales Partner","_Test Coupon Partner"):
|
||||
sales_partner = frappe.get_doc({
|
||||
"doctype": "Sales Partner",
|
||||
"partner_name":"_Test Coupon Partner",
|
||||
"commission_rate":2,
|
||||
"referral_code": "COPART"
|
||||
})
|
||||
sales_partner.insert()
|
||||
# create test item coupon code
|
||||
if not frappe.db.exists("Coupon Code","SAVE30"):
|
||||
coupon_code = frappe.get_doc({
|
||||
"doctype": "Coupon Code",
|
||||
"coupon_name":"SAVE30",
|
||||
"coupon_code":"SAVE30",
|
||||
"pricing_rule": "_Test Pricing Rule for _Test Item",
|
||||
"valid_from": "2014-01-01",
|
||||
"maximum_use":1,
|
||||
"used":0
|
||||
})
|
||||
coupon_code.insert()
|
||||
|
||||
|
||||
class TestCouponCode(unittest.TestCase):
|
||||
def setUp(self):
|
||||
test_create_test_data()
|
||||
|
||||
def tearDown(self):
|
||||
frappe.set_user("Administrator")
|
||||
|
||||
def test_1_check_coupon_code_used_before_so(self):
|
||||
coupon_code = frappe.get_doc("Coupon Code", frappe.db.get_value("Coupon Code", {"coupon_name":"SAVE30"}))
|
||||
# reset used coupon code count
|
||||
coupon_code.used=0
|
||||
coupon_code.save()
|
||||
# check no coupon code is used before sales order is made
|
||||
self.assertEqual(coupon_code.get("used"),0)
|
||||
|
||||
def test_2_sales_order_with_coupon_code(self):
|
||||
so = make_sales_order(customer="_Test Customer",selling_price_list="_Test Price List",item_code="_Test Tesla Car", rate=5000,qty=1, do_not_submit=True)
|
||||
so = frappe.get_doc('Sales Order', so.name)
|
||||
# check item price before coupon code is applied
|
||||
self.assertEqual(so.items[0].rate, 5000)
|
||||
so.coupon_code='SAVE30'
|
||||
so.sales_partner='_Test Coupon Partner'
|
||||
so.save()
|
||||
# check item price after coupon code is applied
|
||||
self.assertEqual(so.items[0].rate, 3500)
|
||||
so.submit()
|
||||
|
||||
def test_3_check_coupon_code_used_after_so(self):
|
||||
doc = frappe.get_doc("Coupon Code", frappe.db.get_value("Coupon Code", {"coupon_name":"SAVE30"}))
|
||||
# check no coupon code is used before sales order is made
|
||||
self.assertEqual(doc.get("used"),1)
|
||||
|
||||
|
||||
|
||||
@@ -8,7 +8,8 @@
|
||||
"customer",
|
||||
"column_break_3",
|
||||
"posting_date",
|
||||
"outstanding_amount"
|
||||
"outstanding_amount",
|
||||
"debit_to"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
@@ -37,21 +38,29 @@
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"fetch_from": "sales_invoice.grand_total",
|
||||
"fetch_from": "sales_invoice.outstanding_amount",
|
||||
"fetch_if_empty": 1,
|
||||
"fieldname": "outstanding_amount",
|
||||
"fieldtype": "Currency",
|
||||
"in_list_view": 1,
|
||||
"label": "Outstanding Amount",
|
||||
"options": "Company:company:default_currency",
|
||||
"read_only": 1
|
||||
"options": "Company:company:default_currency"
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_3",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"fetch_from": "sales_invoice.debit_to",
|
||||
"fieldname": "debit_to",
|
||||
"fieldtype": "Link",
|
||||
"label": "Debit to",
|
||||
"options": "Account",
|
||||
"read_only": 1
|
||||
}
|
||||
],
|
||||
"istable": 1,
|
||||
"modified": "2019-05-30 19:27:29.436153",
|
||||
"modified": "2019-09-26 11:05:36.016772",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Discounted Invoice",
|
||||
|
||||
@@ -13,41 +13,57 @@ frappe.ui.form.on('Invoice Discounting', {
|
||||
};
|
||||
});
|
||||
|
||||
frm.events.filter_accounts("bank_account", frm, {"account_type": "Bank"});
|
||||
frm.events.filter_accounts("bank_charges_account", frm, {"root_type": "Expense"});
|
||||
frm.events.filter_accounts("short_term_loan", frm, {"root_type": "Liability"});
|
||||
frm.events.filter_accounts("accounts_receivable_credit", frm, {"account_type": "Receivable"});
|
||||
frm.events.filter_accounts("accounts_receivable_discounted", frm, {"account_type": "Receivable"});
|
||||
frm.events.filter_accounts("accounts_receivable_unpaid", frm, {"account_type": "Receivable"});
|
||||
|
||||
frm.events.filter_accounts("bank_account", frm, [["account_type", "=", "Bank"]]);
|
||||
frm.events.filter_accounts("bank_charges_account", frm, [["root_type", "=", "Expense"]]);
|
||||
frm.events.filter_accounts("short_term_loan", frm, [["root_type", "=", "Liability"]]);
|
||||
frm.events.filter_accounts("accounts_receivable_discounted", frm, [["account_type", "=", "Receivable"]]);
|
||||
frm.events.filter_accounts("accounts_receivable_credit", frm, [["account_type", "=", "Receivable"]]);
|
||||
frm.events.filter_accounts("accounts_receivable_unpaid", frm, [["account_type", "=", "Receivable"]]);
|
||||
|
||||
},
|
||||
|
||||
filter_accounts: (fieldname, frm, addl_filters) => {
|
||||
let filters = {
|
||||
"company": frm.doc.company,
|
||||
"is_group": 0
|
||||
};
|
||||
if(addl_filters) Object.assign(filters, addl_filters);
|
||||
let filters = [
|
||||
["company", "=", frm.doc.company],
|
||||
["is_group", "=", 0]
|
||||
];
|
||||
if(addl_filters){
|
||||
filters = $.merge(filters , addl_filters);
|
||||
}
|
||||
|
||||
frm.set_query(fieldname, () => { return { "filters": filters }; });
|
||||
},
|
||||
|
||||
refresh_filters: (frm) =>{
|
||||
let invoice_accounts = Object.keys(frm.doc.invoices).map(function(key) {
|
||||
return frm.doc.invoices[key].debit_to;
|
||||
});
|
||||
let filters = [
|
||||
["account_type", "=", "Receivable"],
|
||||
["name", "not in", invoice_accounts]
|
||||
];
|
||||
frm.events.filter_accounts("accounts_receivable_credit", frm, filters);
|
||||
frm.events.filter_accounts("accounts_receivable_discounted", frm, filters);
|
||||
frm.events.filter_accounts("accounts_receivable_unpaid", frm, filters);
|
||||
},
|
||||
|
||||
refresh: (frm) => {
|
||||
frm.events.show_general_ledger(frm);
|
||||
|
||||
if(frm.doc.docstatus === 0) {
|
||||
if (frm.doc.docstatus === 0) {
|
||||
frm.add_custom_button(__('Get Invoices'), function() {
|
||||
frm.events.get_invoices(frm);
|
||||
});
|
||||
}
|
||||
|
||||
if(frm.doc.docstatus === 1 && frm.doc.status !== "Settled") {
|
||||
if(frm.doc.status == "Sanctioned") {
|
||||
if (frm.doc.docstatus === 1 && frm.doc.status !== "Settled") {
|
||||
if (frm.doc.status == "Sanctioned") {
|
||||
frm.add_custom_button(__('Disburse Loan'), function() {
|
||||
frm.events.create_disbursement_entry(frm);
|
||||
}).addClass("btn-primary");
|
||||
}
|
||||
if(frm.doc.status == "Disbursed") {
|
||||
if (frm.doc.status == "Disbursed") {
|
||||
frm.add_custom_button(__('Close Loan'), function() {
|
||||
frm.events.close_loan(frm);
|
||||
}).addClass("btn-primary");
|
||||
@@ -64,7 +80,7 @@ frappe.ui.form.on('Invoice Discounting', {
|
||||
},
|
||||
|
||||
set_end_date: (frm) => {
|
||||
if(frm.doc.loan_start_date && frm.doc.loan_period) {
|
||||
if (frm.doc.loan_start_date && frm.doc.loan_period) {
|
||||
let end_date = frappe.datetime.add_days(frm.doc.loan_start_date, frm.doc.loan_period);
|
||||
frm.set_value("loan_end_date", end_date);
|
||||
}
|
||||
@@ -81,7 +97,6 @@ frappe.ui.form.on('Invoice Discounting', {
|
||||
}
|
||||
frm.set_value("total_amount", total_amount);
|
||||
},
|
||||
|
||||
get_invoices: (frm) => {
|
||||
var d = new frappe.ui.Dialog({
|
||||
title: __('Get Invoices based on Filters'),
|
||||
@@ -132,6 +147,7 @@ frappe.ui.form.on('Invoice Discounting', {
|
||||
frm.doc.invoices = frm.doc.invoices.filter(row => row.sales_invoice);
|
||||
let row = frm.add_child("invoices");
|
||||
$.extend(row, v);
|
||||
frm.events.refresh_filters(frm);
|
||||
});
|
||||
refresh_field("invoices");
|
||||
}
|
||||
@@ -190,8 +206,10 @@ frappe.ui.form.on('Invoice Discounting', {
|
||||
frappe.ui.form.on('Discounted Invoice', {
|
||||
sales_invoice: (frm) => {
|
||||
frm.events.calculate_total_amount(frm);
|
||||
frm.events.refresh_filters(frm);
|
||||
},
|
||||
invoices_remove: (frm) => {
|
||||
frm.events.calculate_total_amount(frm);
|
||||
frm.events.refresh_filters(frm);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -12,6 +12,7 @@ from erpnext.accounts.general_ledger import make_gl_entries
|
||||
class InvoiceDiscounting(AccountsController):
|
||||
def validate(self):
|
||||
self.validate_mandatory()
|
||||
self.validate_invoices()
|
||||
self.calculate_total_amount()
|
||||
self.set_status()
|
||||
self.set_end_date()
|
||||
@@ -24,6 +25,21 @@ class InvoiceDiscounting(AccountsController):
|
||||
if self.docstatus == 1 and not (self.loan_start_date and self.loan_period):
|
||||
frappe.throw(_("Loan Start Date and Loan Period are mandatory to save the Invoice Discounting"))
|
||||
|
||||
def validate_invoices(self):
|
||||
discounted_invoices = [record.sales_invoice for record in
|
||||
frappe.get_all("Discounted Invoice",fields=["sales_invoice"], filters={"docstatus":1})]
|
||||
|
||||
for record in self.invoices:
|
||||
if record.sales_invoice in discounted_invoices:
|
||||
frappe.throw(_("Row({0}): {1} is already discounted in {2}")
|
||||
.format(record.idx, frappe.bold(record.sales_invoice), frappe.bold(record.parent)))
|
||||
|
||||
actual_outstanding = frappe.db.get_value("Sales Invoice", record.sales_invoice,"outstanding_amount")
|
||||
if record.outstanding_amount > actual_outstanding :
|
||||
frappe.throw(_
|
||||
("Row({0}): Outstanding Amount cannot be greater than actual Outstanding Amount {1} in {2}").format(
|
||||
record.idx, frappe.bold(actual_outstanding), frappe.bold(record.sales_invoice)))
|
||||
|
||||
def calculate_total_amount(self):
|
||||
self.total_amount = sum([flt(d.outstanding_amount) for d in self.invoices])
|
||||
|
||||
@@ -212,7 +228,8 @@ def get_invoices(filters):
|
||||
name as sales_invoice,
|
||||
customer,
|
||||
posting_date,
|
||||
outstanding_amount
|
||||
outstanding_amount,
|
||||
debit_to
|
||||
from `tabSales Invoice` si
|
||||
where
|
||||
docstatus = 1
|
||||
|
||||
@@ -7,7 +7,7 @@ frappe.provide("erpnext.journal_entry");
|
||||
|
||||
frappe.ui.form.on("Journal Entry", {
|
||||
setup: function(frm) {
|
||||
frm.add_fetch("bank_account_no", "account", "account");
|
||||
frm.add_fetch("bank_account", "account", "account");
|
||||
},
|
||||
|
||||
refresh: function(frm) {
|
||||
@@ -570,7 +570,7 @@ $.extend(erpnext.journal_entry, {
|
||||
},
|
||||
{fieldtype: "Date", fieldname: "posting_date", label: __("Date"), reqd: 1,
|
||||
default: frm.doc.posting_date},
|
||||
{fieldtype: "Small Text", fieldname: "user_remark", label: __("User Remark"), reqd: 1},
|
||||
{fieldtype: "Small Text", fieldname: "user_remark", label: __("User Remark")},
|
||||
{fieldtype: "Select", fieldname: "naming_series", label: __("Series"), reqd: 1,
|
||||
options: naming_series_options, default: naming_series_default},
|
||||
]
|
||||
@@ -608,15 +608,9 @@ $.extend(erpnext.journal_entry, {
|
||||
},
|
||||
|
||||
account_query: function(frm) {
|
||||
var inter_company = 0;
|
||||
if (frm.doc.voucher_type == "Inter Company Journal Entry") {
|
||||
inter_company = 1;
|
||||
}
|
||||
|
||||
var filters = {
|
||||
company: frm.doc.company,
|
||||
is_group: 0,
|
||||
inter_company_account: inter_company
|
||||
is_group: 0
|
||||
};
|
||||
if(!frm.doc.multi_currency) {
|
||||
$.extend(filters, {
|
||||
|
||||
@@ -827,10 +827,10 @@ def get_opening_accounts(company):
|
||||
accounts = frappe.db.sql_list("""select
|
||||
name from tabAccount
|
||||
where
|
||||
is_group=0 and report_type='Balance Sheet' and company=%s and
|
||||
name not in(select distinct account from tabWarehouse where
|
||||
is_group=0 and report_type='Balance Sheet' and company={0} and
|
||||
name not in (select distinct account from tabWarehouse where
|
||||
account is not null and account != '')
|
||||
order by name asc""", frappe.db.escape(company))
|
||||
order by name asc""".format(frappe.db.escape(company)))
|
||||
|
||||
return [{"account": a, "balance": get_balance_on(a)} for a in accounts]
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
"account_type",
|
||||
"balance",
|
||||
"col_break1",
|
||||
"bank_account_no",
|
||||
"bank_account",
|
||||
"party_type",
|
||||
"party",
|
||||
"party_balance",
|
||||
@@ -40,7 +40,7 @@
|
||||
"fields": [
|
||||
{
|
||||
"bold": 1,
|
||||
"columns": 3,
|
||||
"columns": 2,
|
||||
"fieldname": "account",
|
||||
"fieldtype": "Link",
|
||||
"in_global_search": 1,
|
||||
@@ -90,20 +90,16 @@
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"fieldname": "bank_account_no",
|
||||
"fieldtype": "Link",
|
||||
"label": "Bank Account No",
|
||||
"options": "Bank Account"
|
||||
},
|
||||
{
|
||||
"default": "Customer",
|
||||
"fieldname": "party_type",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 1,
|
||||
"label": "Party Type",
|
||||
"options": "DocType",
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"columns": 3,
|
||||
"columns": 2,
|
||||
"fieldname": "party",
|
||||
"fieldtype": "Dynamic Link",
|
||||
"in_list_view": 1,
|
||||
@@ -266,11 +262,17 @@
|
||||
{
|
||||
"fieldname": "dimension_col_break",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"fieldname": "bank_account",
|
||||
"fieldtype": "Link",
|
||||
"label": "Bank Account",
|
||||
"options": "Bank Account"
|
||||
}
|
||||
],
|
||||
"idx": 1,
|
||||
"istable": 1,
|
||||
"modified": "2019-07-16 17:12:08.238334",
|
||||
"modified": "2019-10-02 12:23:21.693443",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Journal Entry Account",
|
||||
|
||||
@@ -8,10 +8,12 @@ import unittest
|
||||
from frappe.utils import today, cint, flt, getdate
|
||||
from erpnext.accounts.doctype.loyalty_program.loyalty_program import get_loyalty_program_details_with_points
|
||||
from erpnext.accounts.party import get_dashboard_info
|
||||
from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import set_perpetual_inventory
|
||||
|
||||
class TestLoyaltyProgram(unittest.TestCase):
|
||||
@classmethod
|
||||
def setUpClass(self):
|
||||
set_perpetual_inventory(0)
|
||||
# create relevant item, customer, loyalty program, etc
|
||||
create_records()
|
||||
|
||||
@@ -49,7 +51,6 @@ class TestLoyaltyProgram(unittest.TestCase):
|
||||
# cancel and delete
|
||||
for d in [si_redeem, si_original]:
|
||||
d.cancel()
|
||||
frappe.delete_doc('Sales Invoice', d.name)
|
||||
|
||||
def test_loyalty_points_earned_multiple_tier(self):
|
||||
frappe.db.set_value("Customer", "Test Loyalty Customer", "loyalty_program", "Test Multiple Loyalty")
|
||||
@@ -91,7 +92,6 @@ class TestLoyaltyProgram(unittest.TestCase):
|
||||
# cancel and delete
|
||||
for d in [si_redeem, si_original]:
|
||||
d.cancel()
|
||||
frappe.delete_doc('Sales Invoice', d.name)
|
||||
|
||||
def test_cancel_sales_invoice(self):
|
||||
''' cancelling the sales invoice should cancel the earned points'''
|
||||
@@ -143,7 +143,6 @@ class TestLoyaltyProgram(unittest.TestCase):
|
||||
d.cancel()
|
||||
except frappe.TimestampMismatchError:
|
||||
frappe.get_doc('Sales Invoice', d.name).cancel()
|
||||
frappe.delete_doc('Sales Invoice', d.name)
|
||||
|
||||
def test_loyalty_points_for_dashboard(self):
|
||||
doc = frappe.get_doc('Customer', 'Test Loyalty Customer')
|
||||
|
||||
@@ -1,171 +1,74 @@
|
||||
{
|
||||
"allow_copy": 0,
|
||||
"allow_import": 1,
|
||||
"allow_rename": 1,
|
||||
"autoname": "field:mode_of_payment",
|
||||
"beta": 0,
|
||||
"creation": "2012-12-04 17:49:20",
|
||||
"custom": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "DocType",
|
||||
"document_type": "Setup",
|
||||
"editable_grid": 0,
|
||||
"engine": "InnoDB",
|
||||
"allow_import": 1,
|
||||
"allow_rename": 1,
|
||||
"autoname": "field:mode_of_payment",
|
||||
"creation": "2012-12-04 17:49:20",
|
||||
"doctype": "DocType",
|
||||
"document_type": "Setup",
|
||||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
"mode_of_payment",
|
||||
"enabled",
|
||||
"type",
|
||||
"accounts"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "mode_of_payment",
|
||||
"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": "Mode of Payment",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"oldfieldname": "mode_of_payment",
|
||||
"oldfieldtype": "Data",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"fieldname": "mode_of_payment",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
"label": "Mode of Payment",
|
||||
"oldfieldname": "mode_of_payment",
|
||||
"oldfieldtype": "Data",
|
||||
"reqd": 1,
|
||||
"unique": 1
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "type",
|
||||
"fieldtype": "Select",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 1,
|
||||
"label": "Type",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Cash\nBank\nGeneral",
|
||||
"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
|
||||
},
|
||||
"fieldname": "type",
|
||||
"fieldtype": "Select",
|
||||
"in_standard_filter": 1,
|
||||
"label": "Type",
|
||||
"options": "Cash\nBank\nGeneral"
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "accounts",
|
||||
"fieldtype": "Table",
|
||||
"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": "Accounts",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Mode of Payment Account",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
"fieldname": "accounts",
|
||||
"fieldtype": "Table",
|
||||
"label": "Accounts",
|
||||
"options": "Mode of Payment Account"
|
||||
},
|
||||
{
|
||||
"default": "1",
|
||||
"fieldname": "enabled",
|
||||
"fieldtype": "Check",
|
||||
"label": "Enabled"
|
||||
}
|
||||
],
|
||||
"hide_heading": 0,
|
||||
"hide_toolbar": 0,
|
||||
"icon": "fa fa-credit-card",
|
||||
"idx": 1,
|
||||
"image_view": 0,
|
||||
"in_create": 0,
|
||||
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2017-02-17 16:31:34.207683",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Mode of Payment",
|
||||
"owner": "harshada@webnotestech.com",
|
||||
],
|
||||
"icon": "fa fa-credit-card",
|
||||
"idx": 1,
|
||||
"modified": "2019-08-14 14:58:42.079115",
|
||||
"modified_by": "sammish.thundiyil@gmail.com",
|
||||
"module": "Accounts",
|
||||
"name": "Mode of Payment",
|
||||
"owner": "harshada@webnotestech.com",
|
||||
"permissions": [
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 0,
|
||||
"email": 1,
|
||||
"export": 0,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Accounts Manager",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 0,
|
||||
"create": 1,
|
||||
"email": 1,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Accounts Manager",
|
||||
"share": 1,
|
||||
"write": 1
|
||||
},
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
"email": 0,
|
||||
"export": 0,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"permlevel": 0,
|
||||
"print": 0,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Accounts User",
|
||||
"set_user_permissions": 0,
|
||||
"share": 0,
|
||||
"submit": 0,
|
||||
"write": 0
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Accounts User"
|
||||
}
|
||||
],
|
||||
"quick_entry": 1,
|
||||
"read_only": 0,
|
||||
"read_only_onload": 0,
|
||||
"show_name_in_global_search": 1,
|
||||
"sort_order": "ASC",
|
||||
"track_changes": 0,
|
||||
"track_seen": 0
|
||||
],
|
||||
"quick_entry": 1,
|
||||
"show_name_in_global_search": 1,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "ASC"
|
||||
}
|
||||
@@ -32,8 +32,10 @@ class OpeningInvoiceCreationTool(Document):
|
||||
})
|
||||
invoices_summary.update({company: _summary})
|
||||
|
||||
paid_amount.append(invoice.paid_amount)
|
||||
outstanding_amount.append(invoice.outstanding_amount)
|
||||
if invoice.paid_amount:
|
||||
paid_amount.append(invoice.paid_amount)
|
||||
if invoice.outstanding_amount:
|
||||
outstanding_amount.append(invoice.outstanding_amount)
|
||||
|
||||
if paid_amount or outstanding_amount:
|
||||
max_count.update({
|
||||
|
||||
@@ -308,7 +308,7 @@ frappe.ui.form.on('Payment Entry', {
|
||||
() => {
|
||||
frm.set_party_account_based_on_party = false;
|
||||
if (r.message.bank_account) {
|
||||
frm.set_value("bank_account", r.message.bank_account);
|
||||
frm.set_value("party_bank_account", r.message.bank_account);
|
||||
}
|
||||
}
|
||||
]);
|
||||
@@ -554,7 +554,7 @@ frappe.ui.form.on('Payment Entry', {
|
||||
frappe.flags.allocate_payment_amount = true;
|
||||
frm.events.validate_filters_data(frm, filters);
|
||||
frm.events.get_outstanding_documents(frm, filters);
|
||||
}, __("Filters"), __("Get Outstanding Invoices"));
|
||||
}, __("Filters"), __("Get Outstanding Documents"));
|
||||
},
|
||||
|
||||
validate_filters_data: function(frm, filters) {
|
||||
@@ -720,7 +720,7 @@ frappe.ui.form.on('Payment Entry', {
|
||||
|
||||
$.each(frm.doc.references || [], function(i, row) {
|
||||
row.allocated_amount = 0 //If allocate payment amount checkbox is unchecked, set zero to allocate amount
|
||||
if(frappe.flags.allocate_payment_amount){
|
||||
if(frappe.flags.allocate_payment_amount != 0){
|
||||
if(row.outstanding_amount > 0 && allocated_positive_outstanding > 0) {
|
||||
if(row.outstanding_amount >= allocated_positive_outstanding) {
|
||||
row.allocated_amount = allocated_positive_outstanding;
|
||||
|
||||
@@ -62,6 +62,7 @@
|
||||
"dimension_col_break",
|
||||
"cost_center",
|
||||
"section_break_12",
|
||||
"status",
|
||||
"remarks",
|
||||
"column_break_16",
|
||||
"letter_head",
|
||||
@@ -563,10 +564,18 @@
|
||||
{
|
||||
"fieldname": "dimension_col_break",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"default": "Draft",
|
||||
"fieldname": "status",
|
||||
"fieldtype": "Select",
|
||||
"label": "Status",
|
||||
"options": "\nDraft\nSubmitted\nCancelled",
|
||||
"read_only": 1
|
||||
}
|
||||
],
|
||||
"is_submittable": 1,
|
||||
"modified": "2019-05-27 15:53:21.108857",
|
||||
"modified": "2019-11-06 12:59:43.151721",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Payment Entry",
|
||||
|
||||
@@ -61,6 +61,7 @@ class PaymentEntry(AccountsController):
|
||||
self.validate_duplicate_entry()
|
||||
self.validate_allocated_amount()
|
||||
self.ensure_supplier_is_not_blocked()
|
||||
self.set_status()
|
||||
|
||||
def on_submit(self):
|
||||
self.setup_party_account_field()
|
||||
@@ -70,6 +71,7 @@ class PaymentEntry(AccountsController):
|
||||
self.update_outstanding_amounts()
|
||||
self.update_advance_paid()
|
||||
self.update_expense_claim()
|
||||
self.set_status()
|
||||
|
||||
|
||||
def on_cancel(self):
|
||||
@@ -79,6 +81,7 @@ class PaymentEntry(AccountsController):
|
||||
self.update_advance_paid()
|
||||
self.update_expense_claim()
|
||||
self.delink_advance_entry_references()
|
||||
self.set_status()
|
||||
|
||||
def update_outstanding_amounts(self):
|
||||
self.set_missing_ref_details(force=True)
|
||||
@@ -126,7 +129,7 @@ class PaymentEntry(AccountsController):
|
||||
if not self.party:
|
||||
frappe.throw(_("Party is mandatory"))
|
||||
|
||||
_party_name = "title" if self.party_type == "Student" else self.party_type.lower() + "_name"
|
||||
_party_name = "title" if self.party_type in ("Student", "Shareholder") else self.party_type.lower() + "_name"
|
||||
self.party_name = frappe.db.get_value(self.party_type, self.party, _party_name)
|
||||
|
||||
if self.party:
|
||||
@@ -275,6 +278,14 @@ class PaymentEntry(AccountsController):
|
||||
frappe.throw(_("Against Journal Entry {0} does not have any unmatched {1} entry")
|
||||
.format(d.reference_name, dr_or_cr))
|
||||
|
||||
def set_status(self):
|
||||
if self.docstatus == 2:
|
||||
self.status = 'Cancelled'
|
||||
elif self.docstatus == 1:
|
||||
self.status = 'Submitted'
|
||||
else:
|
||||
self.status = 'Draft'
|
||||
|
||||
def set_amounts(self):
|
||||
self.set_amounts_in_company_currency()
|
||||
self.set_total_allocated_amount()
|
||||
@@ -624,8 +635,8 @@ def get_outstanding_reference_documents(args):
|
||||
data = negative_outstanding_invoices + outstanding_invoices + orders_to_be_billed
|
||||
|
||||
if not data:
|
||||
frappe.msgprint(_("No outstanding invoices found for the {0} <b>{1}</b> which qualify the filters you have specified")
|
||||
.format(args.get("party_type").lower(), args.get("party")))
|
||||
frappe.msgprint(_("No outstanding invoices found for the {0} {1} which qualify the filters you have specified.")
|
||||
.format(args.get("party_type").lower(), frappe.bold(args.get("party"))))
|
||||
|
||||
return data
|
||||
|
||||
@@ -683,8 +694,8 @@ def get_orders_to_be_billed(posting_date, party_type, party,
|
||||
|
||||
order_list = []
|
||||
for d in orders:
|
||||
if not (d.outstanding_amount >= filters.get("outstanding_amt_greater_than")
|
||||
and d.outstanding_amount <= filters.get("outstanding_amt_less_than")):
|
||||
if not (flt(d.outstanding_amount) >= flt(filters.get("outstanding_amt_greater_than"))
|
||||
and flt(d.outstanding_amount) <= flt(filters.get("outstanding_amt_less_than"))):
|
||||
continue
|
||||
|
||||
d["voucher_type"] = voucher_type
|
||||
@@ -761,9 +772,23 @@ def get_party_details(company, party_type, party, date, cost_center=None):
|
||||
@frappe.whitelist()
|
||||
def get_account_details(account, date, cost_center=None):
|
||||
frappe.has_permission('Payment Entry', throw=True)
|
||||
|
||||
# to check if the passed account is accessible under reference doctype Payment Entry
|
||||
account_list = frappe.get_list('Account', {
|
||||
'name': account
|
||||
}, reference_doctype='Payment Entry', limit=1)
|
||||
|
||||
# There might be some user permissions which will allow account under certain doctypes
|
||||
# except for Payment Entry, only in such case we should throw permission error
|
||||
if not account_list:
|
||||
frappe.throw(_('Account: {0} is not permitted under Payment Entry').format(account))
|
||||
|
||||
account_balance = get_balance_on(account, date, cost_center=cost_center,
|
||||
ignore_account_permission=True)
|
||||
|
||||
return frappe._dict({
|
||||
"account_currency": get_account_currency(account),
|
||||
"account_balance": get_balance_on(account, date, cost_center=cost_center),
|
||||
"account_balance": account_balance,
|
||||
"account_type": frappe.db.get_value("Account", account, "account_type")
|
||||
})
|
||||
|
||||
@@ -926,6 +951,10 @@ def get_payment_entry(dt, dn, party_amount=None, bank_account=None, bank_amount=
|
||||
bank = get_default_bank_cash_account(doc.company, "Bank", mode_of_payment=doc.get("mode_of_payment"),
|
||||
account=bank_account)
|
||||
|
||||
if not bank:
|
||||
bank = get_default_bank_cash_account(doc.company, "Cash", mode_of_payment=doc.get("mode_of_payment"),
|
||||
account=bank_account)
|
||||
|
||||
paid_amount = received_amount = 0
|
||||
if party_account_currency == bank.account_currency:
|
||||
paid_amount = received_amount = abs(outstanding_amount)
|
||||
@@ -933,10 +962,15 @@ def get_payment_entry(dt, dn, party_amount=None, bank_account=None, bank_amount=
|
||||
paid_amount = abs(outstanding_amount)
|
||||
if bank_amount:
|
||||
received_amount = bank_amount
|
||||
else:
|
||||
received_amount = paid_amount * doc.conversion_rate
|
||||
else:
|
||||
received_amount = abs(outstanding_amount)
|
||||
if bank_amount:
|
||||
paid_amount = bank_amount
|
||||
else:
|
||||
# if party account currency and bank currency is different then populate paid amount as well
|
||||
paid_amount = received_amount * doc.conversion_rate
|
||||
|
||||
pe = frappe.new_doc("Payment Entry")
|
||||
pe.payment_type = payment_type
|
||||
@@ -1022,7 +1056,7 @@ def make_payment_order(source_name, target_doc=None):
|
||||
|
||||
def update_item(source_doc, target_doc, source_parent):
|
||||
target_doc.bank_account = source_parent.party_bank_account
|
||||
target_doc.amount = source_parent.base_paid_amount
|
||||
target_doc.amount = source_doc.allocated_amount
|
||||
target_doc.account = source_parent.paid_to
|
||||
target_doc.payment_entry = source_parent.name
|
||||
target_doc.supplier = source_parent.party
|
||||
|
||||
@@ -66,10 +66,10 @@ frappe.ui.form.on('Payment Order', {
|
||||
get_query_filters: {
|
||||
bank: frm.doc.bank,
|
||||
docstatus: 1,
|
||||
payment_type: ("!=", "Receive"),
|
||||
payment_type: ["!=", "Receive"],
|
||||
bank_account: frm.doc.company_bank_account,
|
||||
paid_from: frm.doc.account,
|
||||
payment_order_status: ["=", "Initiated"],
|
||||
payment_order_status: ["=", "Initiated"]
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
frappe.ui.form.on('Payment Order', {
|
||||
refresh: function(frm) {
|
||||
if (frm.doc.docstatus==1 && frm.doc.payment_order_type==='Payment Entry') {
|
||||
frm.add_custom_button(__('Generate Text File'), function() {
|
||||
frm.trigger("generate_text_and_download_file");
|
||||
});
|
||||
}
|
||||
},
|
||||
generate_text_and_download_file: (frm) => {
|
||||
return frappe.call({
|
||||
method: "erpnext.regional.india.bank_remittance.generate_report",
|
||||
args: {
|
||||
name: frm.doc.name
|
||||
},
|
||||
freeze: true,
|
||||
callback: function(r) {
|
||||
{
|
||||
frm.reload_doc();
|
||||
const a = document.createElement('a');
|
||||
let file_obj = r.message;
|
||||
a.href = file_obj.file_url;
|
||||
a.target = '_blank';
|
||||
a.download = file_obj.file_name;
|
||||
a.click();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -90,7 +90,8 @@ class PaymentReconciliation(Document):
|
||||
FROM `tab{doc}`, `tabGL Entry`
|
||||
WHERE
|
||||
(`tab{doc}`.name = `tabGL Entry`.against_voucher or `tab{doc}`.name = `tabGL Entry`.voucher_no)
|
||||
and `tab{doc}`.is_return = 1 and `tabGL Entry`.against_voucher_type = %(voucher_type)s
|
||||
and `tab{doc}`.is_return = 1 and `tab{doc}`.return_against IS NULL
|
||||
and `tabGL Entry`.against_voucher_type = %(voucher_type)s
|
||||
and `tab{doc}`.docstatus = 1 and `tabGL Entry`.party = %(party)s
|
||||
and `tabGL Entry`.party_type = %(party_type)s and `tabGL Entry`.account = %(account)s
|
||||
GROUP BY `tab{doc}`.name
|
||||
@@ -257,11 +258,8 @@ def reconcile_dr_cr_note(dr_cr_notes):
|
||||
voucher_type = ('Credit Note'
|
||||
if d.voucher_type == 'Sales Invoice' else 'Debit Note')
|
||||
|
||||
dr_or_cr = ('credit_in_account_currency'
|
||||
if d.reference_type == 'Sales Invoice' else 'debit_in_account_currency')
|
||||
|
||||
reconcile_dr_or_cr = ('debit_in_account_currency'
|
||||
if dr_or_cr == 'credit_in_account_currency' else 'credit_in_account_currency')
|
||||
if d.dr_or_cr == 'credit_in_account_currency' else 'credit_in_account_currency')
|
||||
|
||||
jv = frappe.get_doc({
|
||||
"doctype": "Journal Entry",
|
||||
@@ -272,8 +270,7 @@ def reconcile_dr_cr_note(dr_cr_notes):
|
||||
'account': d.account,
|
||||
'party': d.party,
|
||||
'party_type': d.party_type,
|
||||
reconcile_dr_or_cr: (abs(d.allocated_amount)
|
||||
if abs(d.unadjusted_amount) > abs(d.allocated_amount) else abs(d.unadjusted_amount)),
|
||||
d.dr_or_cr: abs(d.allocated_amount),
|
||||
'reference_type': d.against_voucher_type,
|
||||
'reference_name': d.against_voucher
|
||||
},
|
||||
@@ -281,7 +278,8 @@ def reconcile_dr_cr_note(dr_cr_notes):
|
||||
'account': d.account,
|
||||
'party': d.party,
|
||||
'party_type': d.party_type,
|
||||
dr_or_cr: abs(d.allocated_amount),
|
||||
reconcile_dr_or_cr: (abs(d.allocated_amount)
|
||||
if abs(d.unadjusted_amount) > abs(d.allocated_amount) else abs(d.unadjusted_amount)),
|
||||
'reference_type': d.voucher_type,
|
||||
'reference_name': d.voucher_no
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
cur_frm.add_fetch("payment_gateway", "payment_account", "payment_account")
|
||||
cur_frm.add_fetch("payment_gateway", "payment_gateway", "payment_gateway")
|
||||
cur_frm.add_fetch("payment_gateway", "message", "message")
|
||||
cur_frm.add_fetch("payment_gateway", "payment_url_message", "payment_url_message")
|
||||
cur_frm.add_fetch("payment_gateway_account", "payment_account", "payment_account")
|
||||
cur_frm.add_fetch("payment_gateway_account", "payment_gateway", "payment_gateway")
|
||||
cur_frm.add_fetch("payment_gateway_account", "message", "message")
|
||||
|
||||
frappe.ui.form.on("Payment Request", "onload", function(frm, dt, dn){
|
||||
if (frm.doc.reference_doctype) {
|
||||
|
||||
@@ -20,7 +20,7 @@ class PaymentRequest(Document):
|
||||
if self.get("__islocal"):
|
||||
self.status = 'Draft'
|
||||
self.validate_reference_document()
|
||||
self.validate_payment_request()
|
||||
self.validate_payment_request_amount()
|
||||
self.validate_currency()
|
||||
self.validate_subscription_details()
|
||||
|
||||
@@ -28,10 +28,19 @@ class PaymentRequest(Document):
|
||||
if not self.reference_doctype or not self.reference_name:
|
||||
frappe.throw(_("To create a Payment Request reference document is required"))
|
||||
|
||||
def validate_payment_request(self):
|
||||
if frappe.db.get_value("Payment Request", {"reference_name": self.reference_name,
|
||||
"name": ("!=", self.name), "status": ("not in", ["Initiated", "Paid"]), "docstatus": 1}, "name"):
|
||||
frappe.throw(_("Payment Request already exists {0}".format(self.reference_name)))
|
||||
def validate_payment_request_amount(self):
|
||||
existing_payment_request_amount = \
|
||||
get_existing_payment_request_amount(self.reference_doctype, self.reference_name)
|
||||
|
||||
if existing_payment_request_amount:
|
||||
ref_doc = frappe.get_doc(self.reference_doctype, self.reference_name)
|
||||
if (hasattr(ref_doc, "order_type") \
|
||||
and getattr(ref_doc, "order_type") != "Shopping Cart"):
|
||||
ref_amount = get_amount(ref_doc)
|
||||
|
||||
if existing_payment_request_amount + flt(self.grand_total)> ref_amount:
|
||||
frappe.throw(_("Total Payment Request amount cannot be greater than {0} amount"
|
||||
.format(self.reference_doctype)))
|
||||
|
||||
def validate_currency(self):
|
||||
ref_doc = frappe.get_doc(self.reference_doctype, self.reference_name)
|
||||
@@ -271,7 +280,7 @@ def make_payment_request(**args):
|
||||
args = frappe._dict(args)
|
||||
|
||||
ref_doc = frappe.get_doc(args.dt, args.dn)
|
||||
grand_total = get_amount(ref_doc, args.dt)
|
||||
grand_total = get_amount(ref_doc)
|
||||
if args.loyalty_points and args.dt == "Sales Order":
|
||||
from erpnext.accounts.doctype.loyalty_program.loyalty_program import validate_loyalty_points
|
||||
loyalty_amount = validate_loyalty_points(ref_doc, int(args.loyalty_points))
|
||||
@@ -281,17 +290,25 @@ def make_payment_request(**args):
|
||||
|
||||
gateway_account = get_gateway_details(args) or frappe._dict()
|
||||
|
||||
existing_payment_request = frappe.db.get_value("Payment Request",
|
||||
{"reference_doctype": args.dt, "reference_name": args.dn, "docstatus": ["!=", 2]})
|
||||
|
||||
bank_account = (get_party_bank_account(args.get('party_type'), args.get('party'))
|
||||
if args.get('party_type') else '')
|
||||
|
||||
existing_payment_request = None
|
||||
if args.order_type == "Shopping Cart":
|
||||
existing_payment_request = frappe.db.get_value("Payment Request",
|
||||
{"reference_doctype": args.dt, "reference_name": args.dn, "docstatus": ("!=", 2)})
|
||||
|
||||
if existing_payment_request:
|
||||
frappe.db.set_value("Payment Request", existing_payment_request, "grand_total", grand_total, update_modified=False)
|
||||
pr = frappe.get_doc("Payment Request", existing_payment_request)
|
||||
|
||||
else:
|
||||
if args.order_type != "Shopping Cart":
|
||||
existing_payment_request_amount = \
|
||||
get_existing_payment_request_amount(args.dt, args.dn)
|
||||
|
||||
if existing_payment_request_amount:
|
||||
grand_total -= existing_payment_request_amount
|
||||
|
||||
pr = frappe.new_doc("Payment Request")
|
||||
pr.update({
|
||||
"payment_gateway_account": gateway_account.get("name"),
|
||||
@@ -327,8 +344,9 @@ def make_payment_request(**args):
|
||||
|
||||
return pr.as_dict()
|
||||
|
||||
def get_amount(ref_doc, dt):
|
||||
def get_amount(ref_doc):
|
||||
"""get amount based on doctype"""
|
||||
dt = ref_doc.doctype
|
||||
if dt in ["Sales Order", "Purchase Order"]:
|
||||
grand_total = flt(ref_doc.grand_total) - flt(ref_doc.advance_paid)
|
||||
|
||||
@@ -347,6 +365,17 @@ def get_amount(ref_doc, dt):
|
||||
else:
|
||||
frappe.throw(_("Payment Entry is already created"))
|
||||
|
||||
def get_existing_payment_request_amount(ref_dt, ref_dn):
|
||||
existing_payment_request_amount = frappe.db.sql("""
|
||||
select sum(grand_total)
|
||||
from `tabPayment Request`
|
||||
where
|
||||
reference_doctype = %s
|
||||
and reference_name = %s
|
||||
and docstatus = 1
|
||||
""", (ref_dt, ref_dn))
|
||||
return flt(existing_payment_request_amount[0][0]) if existing_payment_request_amount else 0
|
||||
|
||||
def get_gateway_details(args):
|
||||
"""return gateway and payment account of default payment gateway"""
|
||||
if args.get("payment_gateway"):
|
||||
|
||||
@@ -37,12 +37,12 @@ class TestPaymentRequest(unittest.TestCase):
|
||||
def setUp(self):
|
||||
if not frappe.db.get_value("Payment Gateway", payment_gateway["gateway"], "name"):
|
||||
frappe.get_doc(payment_gateway).insert(ignore_permissions=True)
|
||||
|
||||
|
||||
for method in payment_method:
|
||||
if not frappe.db.get_value("Payment Gateway Account", {"payment_gateway": method["payment_gateway"],
|
||||
if not frappe.db.get_value("Payment Gateway Account", {"payment_gateway": method["payment_gateway"],
|
||||
"currency": method["currency"]}, "name"):
|
||||
frappe.get_doc(method).insert(ignore_permissions=True)
|
||||
|
||||
|
||||
def test_payment_request_linkings(self):
|
||||
so_inr = make_sales_order(currency="INR")
|
||||
pr = make_payment_request(dt="Sales Order", dn=so_inr.name, recipient_id="saurabh@erpnext.com")
|
||||
@@ -100,3 +100,23 @@ class TestPaymentRequest(unittest.TestCase):
|
||||
self.assertEqual(expected_gle[gle.account][1], gle.debit)
|
||||
self.assertEqual(expected_gle[gle.account][2], gle.credit)
|
||||
self.assertEqual(expected_gle[gle.account][3], gle.against_voucher)
|
||||
|
||||
def test_multiple_payment_entries_against_sales_order(self):
|
||||
# Make Sales Order, grand_total = 1000
|
||||
so = make_sales_order()
|
||||
|
||||
# Payment Request amount = 200
|
||||
pr1 = make_payment_request(dt="Sales Order", dn=so.name,
|
||||
recipient_id="nabin@erpnext.com", return_doc=1)
|
||||
pr1.grand_total = 200
|
||||
pr1.submit()
|
||||
|
||||
# Make a 2nd Payment Request
|
||||
pr2 = make_payment_request(dt="Sales Order", dn=so.name,
|
||||
recipient_id="nabin@erpnext.com", return_doc=1)
|
||||
|
||||
self.assertEqual(pr2.grand_total, 800)
|
||||
|
||||
# Try to make Payment Request more than SO amount, should give validation
|
||||
pr2.grand_total = 900
|
||||
self.assertRaises(frappe.ValidationError, pr2.save)
|
||||
File diff suppressed because it is too large
Load Diff
@@ -249,6 +249,9 @@ def get_pricing_rule_for_item(args, price_list_rate=0, doc=None):
|
||||
if pricing_rule.mixed_conditions or pricing_rule.apply_rule_on_other:
|
||||
continue
|
||||
|
||||
if pricing_rule.coupon_code_based==1 and args.coupon_code==None:
|
||||
return item_details
|
||||
|
||||
if (not pricing_rule.validate_applied_rule and
|
||||
pricing_rule.price_or_product_discount == "Price"):
|
||||
apply_price_discount_pricing_rule(pricing_rule, item_details, args)
|
||||
|
||||
@@ -531,4 +531,32 @@ def validate_pricing_rule_for_different_cond(doc):
|
||||
for d in doc.get("items"):
|
||||
validate_pricing_rule_on_items(doc, d, True)
|
||||
|
||||
return doc
|
||||
return doc
|
||||
|
||||
def validate_coupon_code(coupon_name):
|
||||
from frappe.utils import today,getdate
|
||||
coupon=frappe.get_doc("Coupon Code",coupon_name)
|
||||
if coupon.valid_from:
|
||||
if coupon.valid_from > getdate(today()) :
|
||||
frappe.throw(_("Sorry,coupon code validity has not started"))
|
||||
elif coupon.valid_upto:
|
||||
if coupon.valid_upto < getdate(today()) :
|
||||
frappe.throw(_("Sorry,coupon code validity has expired"))
|
||||
elif coupon.used>=coupon.maximum_use:
|
||||
frappe.throw(_("Sorry,coupon code are exhausted"))
|
||||
else:
|
||||
return
|
||||
|
||||
def update_coupon_code_count(coupon_name,transaction_type):
|
||||
coupon=frappe.get_doc("Coupon Code",coupon_name)
|
||||
if coupon:
|
||||
if transaction_type=='used':
|
||||
if coupon.used<coupon.maximum_use:
|
||||
coupon.used=coupon.used+1
|
||||
coupon.save(ignore_permissions=True)
|
||||
else:
|
||||
frappe.throw(_("{0} Coupon used are {1}. Allowed quantity is exhausted").format(coupon.coupon_code,coupon.used))
|
||||
elif transaction_type=='cancelled':
|
||||
if coupon.used>0:
|
||||
coupon.used=coupon.used-1
|
||||
coupon.save(ignore_permissions=True)
|
||||
@@ -330,23 +330,6 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({
|
||||
frm: cur_frm
|
||||
})
|
||||
},
|
||||
|
||||
asset: function(frm, cdt, cdn) {
|
||||
var row = locals[cdt][cdn];
|
||||
if(row.asset) {
|
||||
frappe.call({
|
||||
method: "erpnext.assets.doctype.asset_category.asset_category.get_asset_category_account",
|
||||
args: {
|
||||
"asset": row.asset,
|
||||
"fieldname": "fixed_asset_account",
|
||||
"account": row.expense_account
|
||||
},
|
||||
callback: function(r, rt) {
|
||||
frappe.model.set_value(cdt, cdn, "expense_account", r.message);
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
cur_frm.script_manager.make(erpnext.accounts.PurchaseInvoice);
|
||||
@@ -430,19 +413,7 @@ cur_frm.fields_dict['select_print_heading'].get_query = function(doc, cdt, cdn)
|
||||
cur_frm.set_query("expense_account", "items", function(doc) {
|
||||
return {
|
||||
query: "erpnext.controllers.queries.get_expense_account",
|
||||
filters: {'company': doc.company}
|
||||
}
|
||||
});
|
||||
|
||||
cur_frm.set_query("asset", "items", function(doc, cdt, cdn) {
|
||||
var d = locals[cdt][cdn];
|
||||
return {
|
||||
filters: {
|
||||
'item_code': d.item_code,
|
||||
'docstatus': 1,
|
||||
'company': doc.company,
|
||||
'status': 'Submitted'
|
||||
}
|
||||
filters: {'company': doc.company }
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -18,13 +18,14 @@ from erpnext.accounts.general_ledger import make_gl_entries, merge_similar_entri
|
||||
from erpnext.accounts.doctype.gl_entry.gl_entry import update_outstanding_amt
|
||||
from erpnext.buying.utils import check_on_hold_or_closed_status
|
||||
from erpnext.accounts.general_ledger import get_round_off_account_and_cost_center
|
||||
from erpnext.assets.doctype.asset.asset import get_asset_account, is_cwip_accounting_disabled
|
||||
from erpnext.assets.doctype.asset.asset import get_asset_account, is_cwip_accounting_enabled
|
||||
from frappe.model.mapper import get_mapped_doc
|
||||
from six import iteritems
|
||||
from erpnext.accounts.doctype.sales_invoice.sales_invoice import validate_inter_company_party, update_linked_doc,\
|
||||
unlink_inter_company_doc
|
||||
from erpnext.accounts.doctype.tax_withholding_category.tax_withholding_category import get_party_tax_withholding_details
|
||||
from erpnext.accounts.deferred_revenue import validate_service_stop_date
|
||||
from erpnext.stock.doctype.purchase_receipt.purchase_receipt import get_item_account_wise_additional_cost
|
||||
|
||||
form_grid_templates = {
|
||||
"items": "templates/form_grid/item_grid.html"
|
||||
@@ -97,7 +98,6 @@ class PurchaseInvoice(BuyingController):
|
||||
self.set_against_expense_account()
|
||||
self.validate_write_off_account()
|
||||
self.validate_multiple_billing("Purchase Receipt", "pr_detail", "amount", "items")
|
||||
self.validate_fixed_asset()
|
||||
self.create_remarks()
|
||||
self.set_status()
|
||||
self.validate_purchase_receipt_if_update_stock()
|
||||
@@ -225,6 +225,8 @@ class PurchaseInvoice(BuyingController):
|
||||
# in case of auto inventory accounting,
|
||||
# expense account is always "Stock Received But Not Billed" for a stock item
|
||||
# except epening entry, drop-ship entry and fixed asset items
|
||||
if item.item_code:
|
||||
asset_category = frappe.get_cached_value("Item", item.item_code, "asset_category")
|
||||
|
||||
if auto_accounting_for_stock and item.item_code in stock_items \
|
||||
and self.is_opening == 'No' and not item.is_fixed_asset \
|
||||
@@ -235,12 +237,8 @@ class PurchaseInvoice(BuyingController):
|
||||
item.expense_account = warehouse_account[item.warehouse]["account"]
|
||||
else:
|
||||
item.expense_account = stock_not_billed_account
|
||||
elif item.is_fixed_asset and is_cwip_accounting_disabled():
|
||||
if not item.asset:
|
||||
frappe.throw(_("Row {0}: asset is required for item {1}")
|
||||
.format(item.idx, item.item_code))
|
||||
|
||||
item.expense_account = get_asset_category_account(item.asset, 'fixed_asset_account',
|
||||
elif item.is_fixed_asset and not is_cwip_accounting_enabled(asset_category):
|
||||
item.expense_account = get_asset_category_account('fixed_asset_account', item=item.item_code,
|
||||
company = self.company)
|
||||
elif item.is_fixed_asset and item.pr_detail:
|
||||
item.expense_account = asset_received_but_not_billed
|
||||
@@ -364,7 +362,7 @@ class PurchaseInvoice(BuyingController):
|
||||
update_outstanding = "No" if (cint(self.is_paid) or self.write_off_account) else "Yes"
|
||||
|
||||
make_gl_entries(gl_entries, cancel=(self.docstatus == 2),
|
||||
update_outstanding=update_outstanding, merge_entries=False)
|
||||
update_outstanding=update_outstanding, merge_entries=False, from_repost=from_repost)
|
||||
|
||||
if update_outstanding == "No":
|
||||
update_outstanding_amt(self.credit_to, "Supplier", self.supplier,
|
||||
@@ -391,7 +389,8 @@ class PurchaseInvoice(BuyingController):
|
||||
|
||||
self.make_supplier_gl_entry(gl_entries)
|
||||
self.make_item_gl_entries(gl_entries)
|
||||
if not is_cwip_accounting_disabled():
|
||||
|
||||
if self.check_asset_cwip_enabled():
|
||||
self.get_asset_gl_entry(gl_entries)
|
||||
|
||||
self.make_tax_gl_entries(gl_entries)
|
||||
@@ -404,6 +403,15 @@ class PurchaseInvoice(BuyingController):
|
||||
|
||||
return gl_entries
|
||||
|
||||
def check_asset_cwip_enabled(self):
|
||||
# Check if there exists any item with cwip accounting enabled in it's asset category
|
||||
for item in self.get("items"):
|
||||
if item.item_code and item.is_fixed_asset:
|
||||
asset_category = frappe.get_cached_value("Item", item.item_code, "asset_category")
|
||||
if is_cwip_accounting_enabled(asset_category):
|
||||
return 1
|
||||
return 0
|
||||
|
||||
def make_supplier_gl_entry(self, gl_entries):
|
||||
# Checked both rounding_adjustment and rounded_total
|
||||
# because rounded_total had value even before introcution of posting GLE based on rounded total
|
||||
@@ -436,15 +444,23 @@ class PurchaseInvoice(BuyingController):
|
||||
if self.update_stock and self.auto_accounting_for_stock:
|
||||
warehouse_account = get_warehouse_account_map(self.company)
|
||||
|
||||
landed_cost_entries = get_item_account_wise_additional_cost(self.name)
|
||||
|
||||
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)
|
||||
|
||||
valuation_tax_accounts = [d.account_head for d in self.get("taxes")
|
||||
if d.category in ('Valuation', 'Total and Valuation')
|
||||
and flt(d.base_tax_amount_after_discount_amount)]
|
||||
|
||||
for item in self.get("items"):
|
||||
if flt(item.base_net_amount):
|
||||
account_currency = get_account_currency(item.expense_account)
|
||||
if item.item_code:
|
||||
asset_category = frappe.get_cached_value("Item", item.item_code, "asset_category")
|
||||
|
||||
if self.update_stock and self.auto_accounting_for_stock and item.item_code in stock_items:
|
||||
# warehouse account
|
||||
@@ -463,15 +479,16 @@ class PurchaseInvoice(BuyingController):
|
||||
)
|
||||
|
||||
# Amount added through landed-cost-voucher
|
||||
if flt(item.landed_cost_voucher_amount):
|
||||
gl_entries.append(self.get_gl_dict({
|
||||
"account": expenses_included_in_valuation,
|
||||
"against": item.expense_account,
|
||||
"cost_center": item.cost_center,
|
||||
"remarks": self.get("remarks") or _("Accounting Entry for Stock"),
|
||||
"credit": flt(item.landed_cost_voucher_amount),
|
||||
"project": item.project
|
||||
}, item=item))
|
||||
if landed_cost_entries:
|
||||
for account, amount in iteritems(landed_cost_entries[(item.item_code, item.name)]):
|
||||
gl_entries.append(self.get_gl_dict({
|
||||
"account": account,
|
||||
"against": item.expense_account,
|
||||
"cost_center": item.cost_center,
|
||||
"remarks": self.get("remarks") or _("Accounting Entry for Stock"),
|
||||
"credit": flt(amount),
|
||||
"project": item.project
|
||||
}, item=item))
|
||||
|
||||
# sub-contracting warehouse
|
||||
if flt(item.rm_supp_cost):
|
||||
@@ -486,31 +503,61 @@ class PurchaseInvoice(BuyingController):
|
||||
"remarks": self.get("remarks") or _("Accounting Entry for Stock"),
|
||||
"credit": flt(item.rm_supp_cost)
|
||||
}, warehouse_account[self.supplier_warehouse]["account_currency"], item=item))
|
||||
elif not item.is_fixed_asset or (item.is_fixed_asset and is_cwip_accounting_disabled()):
|
||||
|
||||
elif not item.is_fixed_asset or (item.is_fixed_asset and not is_cwip_accounting_enabled(asset_category)):
|
||||
expense_account = (item.expense_account
|
||||
if (not item.enable_deferred_expense or self.is_return) else item.deferred_expense_account)
|
||||
|
||||
gl_entries.append(
|
||||
self.get_gl_dict({
|
||||
if not item.is_fixed_asset:
|
||||
amount = flt(item.base_net_amount, item.precision("base_net_amount"))
|
||||
else:
|
||||
amount = flt(item.base_net_amount + item.item_tax_amount, item.precision("base_net_amount"))
|
||||
|
||||
gl_entries.append(self.get_gl_dict({
|
||||
"account": expense_account,
|
||||
"against": self.supplier,
|
||||
"debit": flt(item.base_net_amount, item.precision("base_net_amount")),
|
||||
"debit_in_account_currency": (flt(item.base_net_amount,
|
||||
item.precision("base_net_amount")) if account_currency==self.company_currency
|
||||
else flt(item.net_amount, item.precision("net_amount"))),
|
||||
"debit": amount,
|
||||
"cost_center": item.cost_center,
|
||||
"project": item.project
|
||||
}, account_currency, item=item)
|
||||
)
|
||||
}, account_currency, item=item))
|
||||
|
||||
# If asset is bought through this document and not linked to PR
|
||||
if self.update_stock and item.landed_cost_voucher_amount:
|
||||
expenses_included_in_asset_valuation = self.get_company_default("expenses_included_in_asset_valuation")
|
||||
# Amount added through landed-cost-voucher
|
||||
gl_entries.append(self.get_gl_dict({
|
||||
"account": expenses_included_in_asset_valuation,
|
||||
"against": expense_account,
|
||||
"cost_center": item.cost_center,
|
||||
"remarks": self.get("remarks") or _("Accounting Entry for Stock"),
|
||||
"credit": flt(item.landed_cost_voucher_amount),
|
||||
"project": item.project
|
||||
}, item=item))
|
||||
|
||||
gl_entries.append(self.get_gl_dict({
|
||||
"account": expense_account,
|
||||
"against": expenses_included_in_asset_valuation,
|
||||
"cost_center": item.cost_center,
|
||||
"remarks": self.get("remarks") or _("Accounting Entry for Stock"),
|
||||
"debit": flt(item.landed_cost_voucher_amount),
|
||||
"project": item.project
|
||||
}, item=item))
|
||||
|
||||
# update gross amount of asset bought through this document
|
||||
assets = frappe.db.get_all('Asset',
|
||||
filters={ 'purchase_invoice': self.name, 'item_code': item.item_code }
|
||||
)
|
||||
for asset in assets:
|
||||
frappe.db.set_value("Asset", asset.name, "gross_purchase_amount", flt(item.valuation_rate))
|
||||
frappe.db.set_value("Asset", asset.name, "purchase_receipt_amount", flt(item.valuation_rate))
|
||||
|
||||
if self.auto_accounting_for_stock and self.is_opening == "No" and \
|
||||
item.item_code in stock_items and item.item_tax_amount:
|
||||
# Post reverse entry for Stock-Received-But-Not-Billed if it is booked in Purchase Receipt
|
||||
if item.purchase_receipt:
|
||||
if item.purchase_receipt and valuation_tax_accounts:
|
||||
negative_expense_booked_in_pr = frappe.db.sql("""select name from `tabGL Entry`
|
||||
where voucher_type='Purchase Receipt' and voucher_no=%s and account=%s""",
|
||||
(item.purchase_receipt, self.expenses_included_in_valuation))
|
||||
where voucher_type='Purchase Receipt' and voucher_no=%s and account in %s""",
|
||||
(item.purchase_receipt, valuation_tax_accounts))
|
||||
|
||||
if not negative_expense_booked_in_pr:
|
||||
gl_entries.append(
|
||||
@@ -527,27 +574,27 @@ class PurchaseInvoice(BuyingController):
|
||||
item.precision("item_tax_amount"))
|
||||
|
||||
def get_asset_gl_entry(self, gl_entries):
|
||||
arbnb_account = self.get_company_default("asset_received_but_not_billed")
|
||||
eiiav_account = self.get_company_default("expenses_included_in_asset_valuation")
|
||||
|
||||
for item in self.get("items"):
|
||||
if item.is_fixed_asset:
|
||||
eiiav_account = self.get_company_default("expenses_included_in_asset_valuation")
|
||||
|
||||
asset_amount = flt(item.net_amount) + flt(item.item_tax_amount/self.conversion_rate)
|
||||
base_asset_amount = flt(item.base_net_amount + item.item_tax_amount)
|
||||
|
||||
if (not item.expense_account or frappe.db.get_value('Account',
|
||||
item.expense_account, 'account_type') not in ['Asset Received But Not Billed', 'Fixed Asset']):
|
||||
arbnb_account = self.get_company_default("asset_received_but_not_billed")
|
||||
item_exp_acc_type = frappe.db.get_value('Account', item.expense_account, 'account_type')
|
||||
if (not item.expense_account or item_exp_acc_type not in ['Asset Received But Not Billed', 'Fixed Asset']):
|
||||
item.expense_account = arbnb_account
|
||||
|
||||
if not self.update_stock:
|
||||
asset_rbnb_currency = get_account_currency(item.expense_account)
|
||||
arbnb_currency = get_account_currency(item.expense_account)
|
||||
gl_entries.append(self.get_gl_dict({
|
||||
"account": item.expense_account,
|
||||
"against": self.supplier,
|
||||
"remarks": self.get("remarks") or _("Accounting Entry for Asset"),
|
||||
"debit": base_asset_amount,
|
||||
"debit_in_account_currency": (base_asset_amount
|
||||
if asset_rbnb_currency == self.company_currency else asset_amount),
|
||||
if arbnb_currency == self.company_currency else asset_amount),
|
||||
"cost_center": item.cost_center
|
||||
}, item=item))
|
||||
|
||||
@@ -564,8 +611,7 @@ class PurchaseInvoice(BuyingController):
|
||||
item.item_tax_amount / self.conversion_rate)
|
||||
}, item=item))
|
||||
else:
|
||||
cwip_account = get_asset_account("capital_work_in_progress_account",
|
||||
item.asset, company = self.company)
|
||||
cwip_account = get_asset_account("capital_work_in_progress_account", company = self.company)
|
||||
|
||||
cwip_account_currency = get_account_currency(cwip_account)
|
||||
gl_entries.append(self.get_gl_dict({
|
||||
@@ -591,6 +637,36 @@ class PurchaseInvoice(BuyingController):
|
||||
item.item_tax_amount / self.conversion_rate)
|
||||
}, item=item))
|
||||
|
||||
# When update stock is checked
|
||||
# Assets are bought through this document then it will be linked to this document
|
||||
if self.update_stock:
|
||||
if flt(item.landed_cost_voucher_amount):
|
||||
gl_entries.append(self.get_gl_dict({
|
||||
"account": eiiav_account,
|
||||
"against": cwip_account,
|
||||
"cost_center": item.cost_center,
|
||||
"remarks": self.get("remarks") or _("Accounting Entry for Stock"),
|
||||
"credit": flt(item.landed_cost_voucher_amount),
|
||||
"project": item.project
|
||||
}, item=item))
|
||||
|
||||
gl_entries.append(self.get_gl_dict({
|
||||
"account": cwip_account,
|
||||
"against": eiiav_account,
|
||||
"cost_center": item.cost_center,
|
||||
"remarks": self.get("remarks") or _("Accounting Entry for Stock"),
|
||||
"debit": flt(item.landed_cost_voucher_amount),
|
||||
"project": item.project
|
||||
}, item=item))
|
||||
|
||||
# update gross amount of assets bought through this document
|
||||
assets = frappe.db.get_all('Asset',
|
||||
filters={ 'purchase_invoice': self.name, 'item_code': item.item_code }
|
||||
)
|
||||
for asset in assets:
|
||||
frappe.db.set_value("Asset", asset.name, "gross_purchase_amount", flt(item.valuation_rate))
|
||||
frappe.db.set_value("Asset", asset.name, "purchase_receipt_amount", flt(item.valuation_rate))
|
||||
|
||||
return gl_entries
|
||||
|
||||
def make_stock_adjustment_entry(self, gl_entries, item, voucher_wise_stock_value, account_currency):
|
||||
@@ -641,14 +717,14 @@ class PurchaseInvoice(BuyingController):
|
||||
if account_currency==self.company_currency \
|
||||
else tax.tax_amount_after_discount_amount,
|
||||
"cost_center": tax.cost_center
|
||||
}, account_currency)
|
||||
}, account_currency, item=tax)
|
||||
)
|
||||
# accumulate valuation tax
|
||||
if self.is_opening == "No" and tax.category in ("Valuation", "Valuation and Total") and flt(tax.base_tax_amount_after_discount_amount):
|
||||
if self.auto_accounting_for_stock and not tax.cost_center:
|
||||
frappe.throw(_("Cost Center is required in row {0} in Taxes table for type {1}").format(tax.idx, _(tax.category)))
|
||||
valuation_tax.setdefault(tax.cost_center, 0)
|
||||
valuation_tax[tax.cost_center] += \
|
||||
valuation_tax.setdefault(tax.name, 0)
|
||||
valuation_tax[tax.name] += \
|
||||
(tax.add_deduct_tax == "Add" and 1 or -1) * flt(tax.base_tax_amount_after_discount_amount)
|
||||
|
||||
if self.is_opening == "No" and self.negative_expense_to_be_booked and valuation_tax:
|
||||
@@ -658,36 +734,38 @@ class PurchaseInvoice(BuyingController):
|
||||
total_valuation_amount = sum(valuation_tax.values())
|
||||
amount_including_divisional_loss = self.negative_expense_to_be_booked
|
||||
i = 1
|
||||
for cost_center, amount in iteritems(valuation_tax):
|
||||
if i == len(valuation_tax):
|
||||
applicable_amount = amount_including_divisional_loss
|
||||
else:
|
||||
applicable_amount = self.negative_expense_to_be_booked * (amount / total_valuation_amount)
|
||||
amount_including_divisional_loss -= applicable_amount
|
||||
for tax in self.get("taxes"):
|
||||
if valuation_tax.get(tax.name):
|
||||
if i == len(valuation_tax):
|
||||
applicable_amount = amount_including_divisional_loss
|
||||
else:
|
||||
applicable_amount = self.negative_expense_to_be_booked * (valuation_tax[tax.name] / total_valuation_amount)
|
||||
amount_including_divisional_loss -= applicable_amount
|
||||
|
||||
gl_entries.append(
|
||||
self.get_gl_dict({
|
||||
"account": self.expenses_included_in_valuation,
|
||||
"cost_center": cost_center,
|
||||
"against": self.supplier,
|
||||
"credit": applicable_amount,
|
||||
"remarks": self.remarks or "Accounting Entry for Stock"
|
||||
})
|
||||
)
|
||||
gl_entries.append(
|
||||
self.get_gl_dict({
|
||||
"account": tax.account_head,
|
||||
"cost_center": tax.cost_center,
|
||||
"against": self.supplier,
|
||||
"credit": applicable_amount,
|
||||
"remarks": self.remarks or _("Accounting Entry for Stock"),
|
||||
}, item=tax)
|
||||
)
|
||||
|
||||
i += 1
|
||||
i += 1
|
||||
|
||||
if self.auto_accounting_for_stock and self.update_stock and valuation_tax:
|
||||
for cost_center, amount in iteritems(valuation_tax):
|
||||
gl_entries.append(
|
||||
self.get_gl_dict({
|
||||
"account": self.expenses_included_in_valuation,
|
||||
"cost_center": cost_center,
|
||||
"against": self.supplier,
|
||||
"credit": amount,
|
||||
"remarks": self.remarks or "Accounting Entry for Stock"
|
||||
})
|
||||
)
|
||||
for tax in self.get("taxes"):
|
||||
if valuation_tax.get(tax.name):
|
||||
gl_entries.append(
|
||||
self.get_gl_dict({
|
||||
"account": tax.account_head,
|
||||
"cost_center": tax.cost_center,
|
||||
"against": self.supplier,
|
||||
"credit": valuation_tax[tax.name],
|
||||
"remarks": self.remarks or "Accounting Entry for Stock"
|
||||
}, item=tax)
|
||||
)
|
||||
|
||||
def make_payment_gl_entries(self, gl_entries):
|
||||
# Make Cash GL Entries
|
||||
@@ -752,7 +830,11 @@ class PurchaseInvoice(BuyingController):
|
||||
)
|
||||
|
||||
def make_gle_for_rounding_adjustment(self, gl_entries):
|
||||
if self.rounding_adjustment:
|
||||
# if rounding adjustment in small and conversion rate is also small then
|
||||
# base_rounding_adjustment may become zero due to small precision
|
||||
# eg: rounding_adjustment = 0.01 and exchange rate = 0.05 and precision of base_rounding_adjustment is 2
|
||||
# then base_rounding_adjustment becomes zero and error is thrown in GL Entry
|
||||
if self.rounding_adjustment and self.base_rounding_adjustment:
|
||||
round_off_account, round_off_cost_center = \
|
||||
get_round_off_account_and_cost_center(self.company)
|
||||
|
||||
@@ -880,6 +962,17 @@ class PurchaseInvoice(BuyingController):
|
||||
# calculate totals again after applying TDS
|
||||
self.calculate_taxes_and_totals()
|
||||
|
||||
def get_list_context(context=None):
|
||||
from erpnext.controllers.website_list_for_contact import get_list_context
|
||||
list_context = get_list_context(context)
|
||||
list_context.update({
|
||||
'show_sidebar': True,
|
||||
'show_search': True,
|
||||
'no_breadcrumbs': True,
|
||||
'title': _('Purchase Invoices'),
|
||||
})
|
||||
return list_context
|
||||
|
||||
@frappe.whitelist()
|
||||
def make_debit_note(source_name, target_doc=None):
|
||||
from erpnext.controllers.sales_and_purchase_return import make_return_doc
|
||||
|
||||
@@ -6,8 +6,8 @@ frappe.listview_settings['Purchase Invoice'] = {
|
||||
add_fields: ["supplier", "supplier_name", "base_grand_total", "outstanding_amount", "due_date", "company",
|
||||
"currency", "is_return", "release_date", "on_hold"],
|
||||
get_indicator: function(doc) {
|
||||
if(flt(doc.outstanding_amount) < 0 && doc.docstatus == 1) {
|
||||
return [__("Debit Note Issued"), "darkgrey", "outstanding_amount,<,0"]
|
||||
if( (flt(doc.outstanding_amount) <= 0) && doc.docstatus == 1 && doc.status == 'Debit Note Issued') {
|
||||
return [__("Debit Note Issued"), "darkgrey", "outstanding_amount,<=,0"];
|
||||
} else if(flt(doc.outstanding_amount) > 0 && doc.docstatus==1) {
|
||||
if(cint(doc.on_hold) && !doc.release_date) {
|
||||
return [__("On Hold"), "darkgrey"];
|
||||
|
||||
@@ -10,7 +10,7 @@ from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_ent
|
||||
from frappe.utils import cint, flt, today, nowdate, add_days
|
||||
import frappe.defaults
|
||||
from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import set_perpetual_inventory, \
|
||||
test_records as pr_test_records
|
||||
test_records as pr_test_records, make_purchase_receipt, get_taxes
|
||||
from erpnext.controllers.accounts_controller import get_payment_terms
|
||||
from erpnext.exceptions import InvalidCurrency
|
||||
from erpnext.stock.doctype.stock_entry.test_stock_entry import get_qty_after_transaction
|
||||
@@ -57,16 +57,11 @@ class TestPurchaseInvoice(unittest.TestCase):
|
||||
self.assertEqual([d.debit, d.credit], expected_gl_entries.get(d.account))
|
||||
|
||||
def test_gl_entries_with_perpetual_inventory(self):
|
||||
pi = frappe.copy_doc(test_records[1])
|
||||
set_perpetual_inventory(1, pi.company)
|
||||
pi = make_purchase_invoice(company="_Test Company with perpetual inventory", supplier_warehouse="Work In Progress - TCP1", warehouse= "Stores - TCP1", cost_center = "Main - TCP1", expense_account ="_Test Account Cost for Goods Sold - TCP1", get_taxes_and_charges=True, qty=10)
|
||||
self.assertTrue(cint(erpnext.is_perpetual_inventory_enabled(pi.company)), 1)
|
||||
pi.insert()
|
||||
pi.submit()
|
||||
|
||||
self.check_gle_for_pi(pi.name)
|
||||
|
||||
set_perpetual_inventory(0, pi.company)
|
||||
|
||||
def test_terms_added_after_save(self):
|
||||
pi = frappe.copy_doc(test_records[1])
|
||||
pi.insert()
|
||||
@@ -196,32 +191,33 @@ class TestPurchaseInvoice(unittest.TestCase):
|
||||
self.assertEqual(pi.on_hold, 0)
|
||||
|
||||
def test_gl_entries_with_perpetual_inventory_against_pr(self):
|
||||
pr = frappe.copy_doc(pr_test_records[0])
|
||||
set_perpetual_inventory(1, pr.company)
|
||||
self.assertTrue(cint(erpnext.is_perpetual_inventory_enabled(pr.company)), 1)
|
||||
pr.submit()
|
||||
|
||||
pi = frappe.copy_doc(test_records[1])
|
||||
for d in pi.get("items"):
|
||||
pr = make_purchase_receipt(company="_Test Company with perpetual inventory", supplier_warehouse="Work In Progress - TCP1", warehouse= "Stores - TCP1", cost_center = "Main - TCP1", get_taxes_and_charges=True,)
|
||||
|
||||
self.assertTrue(cint(erpnext.is_perpetual_inventory_enabled(pr.company)), 1)
|
||||
|
||||
pi = make_purchase_invoice(company="_Test Company with perpetual inventory", supplier_warehouse="Work In Progress - TCP1", warehouse= "Stores - TCP1", cost_center = "Main - TCP1", expense_account ="_Test Account Cost for Goods Sold - TCP1", get_taxes_and_charges=True, qty=10,do_not_save= "True")
|
||||
|
||||
for d in pi.items:
|
||||
d.purchase_receipt = pr.name
|
||||
|
||||
pi.insert()
|
||||
pi.submit()
|
||||
|
||||
self.check_gle_for_pi(pi.name)
|
||||
|
||||
set_perpetual_inventory(0, pr.company)
|
||||
|
||||
def check_gle_for_pi(self, pi):
|
||||
gl_entries = frappe.db.sql("""select account, debit, credit
|
||||
gl_entries = frappe.db.sql("""select account, sum(debit) as debit, sum(credit) as credit
|
||||
from `tabGL Entry` where voucher_type='Purchase Invoice' and voucher_no=%s
|
||||
order by account asc""", pi, as_dict=1)
|
||||
group by account""", pi, as_dict=1)
|
||||
|
||||
self.assertTrue(gl_entries)
|
||||
|
||||
expected_values = dict((d[0], d) for d in [
|
||||
["_Test Payable - _TC", 0, 720],
|
||||
["Stock Received But Not Billed - _TC", 500.0, 0],
|
||||
["_Test Account Shipping Charges - _TC", 100.0, 0],
|
||||
["_Test Account VAT - _TC", 120.0, 0],
|
||||
["Creditors - TCP1", 0, 720],
|
||||
["Stock Received But Not Billed - TCP1", 500.0, 0],
|
||||
["_Test Account Shipping Charges - TCP1", 100.0, 0.0],
|
||||
["_Test Account VAT - TCP1", 120.0, 0]
|
||||
])
|
||||
|
||||
for i, gle in enumerate(gl_entries):
|
||||
@@ -524,10 +520,9 @@ class TestPurchaseInvoice(unittest.TestCase):
|
||||
self.assertFalse(gle)
|
||||
|
||||
def test_purchase_invoice_update_stock_gl_entry_with_perpetual_inventory(self):
|
||||
set_perpetual_inventory()
|
||||
|
||||
pi = make_purchase_invoice(update_stock=1, posting_date=frappe.utils.nowdate(),
|
||||
posting_time=frappe.utils.nowtime())
|
||||
posting_time=frappe.utils.nowtime(), cash_bank_account="Cash - TCP1", company="_Test Company with perpetual inventory", supplier_warehouse="Work In Progress - TCP1", warehouse= "Stores - TCP1", cost_center = "Main - TCP1", expense_account ="_Test Account Cost for Goods Sold - TCP1")
|
||||
|
||||
gl_entries = frappe.db.sql("""select account, account_currency, debit, credit,
|
||||
debit_in_account_currency, credit_in_account_currency
|
||||
@@ -548,9 +543,9 @@ class TestPurchaseInvoice(unittest.TestCase):
|
||||
self.assertEqual(expected_gl_entries[gle.account][2], gle.credit)
|
||||
|
||||
def test_purchase_invoice_for_is_paid_and_update_stock_gl_entry_with_perpetual_inventory(self):
|
||||
set_perpetual_inventory()
|
||||
|
||||
pi = make_purchase_invoice(update_stock=1, posting_date=frappe.utils.nowdate(),
|
||||
posting_time=frappe.utils.nowtime(), cash_bank_account="Cash - _TC", is_paid=1)
|
||||
posting_time=frappe.utils.nowtime(), cash_bank_account="Cash - TCP1", is_paid=1, company="_Test Company with perpetual inventory", supplier_warehouse="Work In Progress - TCP1", warehouse= "Stores - TCP1", cost_center = "Main - TCP1", expense_account ="_Test Account Cost for Goods Sold - TCP1")
|
||||
|
||||
gl_entries = frappe.db.sql("""select account, account_currency, sum(debit) as debit,
|
||||
sum(credit) as credit, debit_in_account_currency, credit_in_account_currency
|
||||
@@ -563,7 +558,7 @@ class TestPurchaseInvoice(unittest.TestCase):
|
||||
expected_gl_entries = dict((d[0], d) for d in [
|
||||
[pi.credit_to, 250.0, 250.0],
|
||||
[stock_in_hand_account, 250.0, 0.0],
|
||||
["Cash - _TC", 0.0, 250.0]
|
||||
["Cash - TCP1", 0.0, 250.0]
|
||||
])
|
||||
|
||||
for i, gle in enumerate(gl_entries):
|
||||
@@ -630,6 +625,7 @@ class TestPurchaseInvoice(unittest.TestCase):
|
||||
self.assertEqual(pi.get("items")[0].rm_supp_cost, flt(rm_supp_cost, 2))
|
||||
|
||||
def test_rejected_serial_no(self):
|
||||
set_perpetual_inventory(0)
|
||||
pi = make_purchase_invoice(item_code="_Test Serialized Item With Series", received_qty=2, qty=1,
|
||||
rejected_qty=1, rate=500, update_stock=1,
|
||||
rejected_warehouse = "_Test Rejected Warehouse - _TC")
|
||||
@@ -881,7 +877,7 @@ def make_purchase_invoice(**args):
|
||||
pi.is_return = args.is_return
|
||||
pi.return_against = args.return_against
|
||||
pi.is_subcontracted = args.is_subcontracted or "No"
|
||||
pi.supplier_warehouse = "_Test Warehouse 1 - _TC"
|
||||
pi.supplier_warehouse = args.supplier_warehouse or "_Test Warehouse 1 - _TC"
|
||||
|
||||
pi.append("items", {
|
||||
"item_code": args.item or args.item_code or "_Test Item",
|
||||
@@ -890,14 +886,21 @@ def make_purchase_invoice(**args):
|
||||
"received_qty": args.received_qty or 0,
|
||||
"rejected_qty": args.rejected_qty or 0,
|
||||
"rate": args.rate or 50,
|
||||
'expense_account': args.expense_account or '_Test Account Cost for Goods Sold - _TC',
|
||||
"conversion_factor": 1.0,
|
||||
"serial_no": args.serial_no,
|
||||
"stock_uom": "_Test UOM",
|
||||
"cost_center": "_Test Cost Center - _TC",
|
||||
"cost_center": args.cost_center or "_Test Cost Center - _TC",
|
||||
"project": args.project,
|
||||
"rejected_warehouse": args.rejected_warehouse or "",
|
||||
"rejected_serial_no": args.rejected_serial_no or ""
|
||||
})
|
||||
|
||||
if args.get_taxes_and_charges:
|
||||
taxes = get_taxes()
|
||||
for tax in taxes:
|
||||
pi.append("taxes", tax)
|
||||
|
||||
if not args.do_not_save:
|
||||
pi.insert()
|
||||
if not args.do_not_submit:
|
||||
|
||||
@@ -71,8 +71,8 @@
|
||||
"expense_account",
|
||||
"col_break5",
|
||||
"is_fixed_asset",
|
||||
"asset",
|
||||
"asset_location",
|
||||
"asset_category",
|
||||
"deferred_expense_section",
|
||||
"deferred_expense_account",
|
||||
"service_stop_date",
|
||||
@@ -116,6 +116,8 @@
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"fetch_from": "item_code.item_name",
|
||||
"fetch_if_empty": 1,
|
||||
"fieldname": "item_name",
|
||||
"fieldtype": "Data",
|
||||
"in_global_search": 1,
|
||||
@@ -414,6 +416,7 @@
|
||||
"print_hide": 1
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:!doc.is_fixed_asset",
|
||||
"fieldname": "batch_no",
|
||||
"fieldtype": "Link",
|
||||
"label": "Batch No",
|
||||
@@ -425,12 +428,14 @@
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:!doc.is_fixed_asset",
|
||||
"fieldname": "serial_no",
|
||||
"fieldtype": "Text",
|
||||
"label": "Serial No",
|
||||
"no_copy": 1
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:!doc.is_fixed_asset",
|
||||
"fieldname": "rejected_serial_no",
|
||||
"fieldtype": "Text",
|
||||
"label": "Rejected Serial No",
|
||||
@@ -591,7 +596,6 @@
|
||||
"oldfieldname": "purchase_order",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Purchase Order",
|
||||
"print_hide": 1,
|
||||
"read_only": 1,
|
||||
"search_index": 1
|
||||
},
|
||||
@@ -607,6 +611,7 @@
|
||||
"fieldname": "include_exploded_items",
|
||||
"fieldtype": "Check",
|
||||
"label": "Include Exploded Items",
|
||||
"print_hide": 1,
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
@@ -615,6 +620,7 @@
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"fetch_from": "item_code.is_fixed_asset",
|
||||
"fieldname": "is_fixed_asset",
|
||||
"fieldtype": "Check",
|
||||
"hidden": 1,
|
||||
@@ -623,14 +629,6 @@
|
||||
"print_hide": 1,
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"depends_on": "is_fixed_asset",
|
||||
"fieldname": "asset",
|
||||
"fieldtype": "Link",
|
||||
"label": "Asset",
|
||||
"no_copy": 1,
|
||||
"options": "Asset"
|
||||
},
|
||||
{
|
||||
"depends_on": "is_fixed_asset",
|
||||
"fieldname": "asset_location",
|
||||
@@ -676,7 +674,7 @@
|
||||
"fieldname": "pr_detail",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 1,
|
||||
"label": "PR Detail",
|
||||
"label": "Purchase Receipt Detail",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "pr_detail",
|
||||
"oldfieldtype": "Data",
|
||||
@@ -754,11 +752,21 @@
|
||||
"fieldtype": "Data",
|
||||
"label": "Manufacturer Part Number",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"depends_on": "is_fixed_asset",
|
||||
"fetch_from": "item_code.asset_category",
|
||||
"fieldname": "asset_category",
|
||||
"fieldtype": "Data",
|
||||
"in_preview": 1,
|
||||
"label": "Asset Category",
|
||||
"options": "Asset Category",
|
||||
"read_only": 1
|
||||
}
|
||||
],
|
||||
"idx": 1,
|
||||
"istable": 1,
|
||||
"modified": "2019-06-02 06:36:17.078419",
|
||||
"modified": "2019-11-21 16:27:52.043744",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Purchase Invoice Item",
|
||||
|
||||
@@ -41,6 +41,8 @@ def get_pos_data():
|
||||
items_list = get_items_list(pos_profile, doc.company)
|
||||
customers = get_customers_list(pos_profile)
|
||||
|
||||
doc.plc_conversion_rate = update_plc_conversion_rate(doc, pos_profile)
|
||||
|
||||
return {
|
||||
'doc': doc,
|
||||
'default_customer': pos_profile.get('customer'),
|
||||
@@ -53,7 +55,7 @@ def get_pos_data():
|
||||
'batch_no_data': get_batch_no_data(),
|
||||
'barcode_data': get_barcode_data(items_list),
|
||||
'tax_data': get_item_tax_data(),
|
||||
'price_list_data': get_price_list_data(doc.selling_price_list),
|
||||
'price_list_data': get_price_list_data(doc.selling_price_list, doc.plc_conversion_rate),
|
||||
'customer_wise_price_list': get_customer_wise_price_list(),
|
||||
'bin_data': get_bin_data(pos_profile),
|
||||
'pricing_rules': get_pricing_rule_data(doc),
|
||||
@@ -62,6 +64,15 @@ def get_pos_data():
|
||||
'meta': get_meta()
|
||||
}
|
||||
|
||||
def update_plc_conversion_rate(doc, pos_profile):
|
||||
conversion_rate = 1.0
|
||||
|
||||
price_list_currency = frappe.get_cached_value("Price List", doc.selling_price_list, "currency")
|
||||
if pos_profile.get("currency") != price_list_currency:
|
||||
conversion_rate = get_exchange_rate(price_list_currency,
|
||||
pos_profile.get("currency"), nowdate(), args="for_selling") or 1.0
|
||||
|
||||
return conversion_rate
|
||||
|
||||
def get_meta():
|
||||
doctype_meta = {
|
||||
@@ -228,7 +239,7 @@ def get_contacts(customers):
|
||||
|
||||
for data in customers:
|
||||
contact = frappe.db.sql(""" select email_id, phone, mobile_no from `tabContact`
|
||||
where is_primary_contact =1 and name in
|
||||
where is_primary_contact=1 and name in
|
||||
(select parent from `tabDynamic Link` where link_doctype = 'Customer' and link_name = %s
|
||||
and parenttype = 'Contact')""", data.name, as_dict=1)
|
||||
if contact:
|
||||
@@ -307,7 +318,7 @@ def get_item_tax_data():
|
||||
# example: {'Consulting Services': {'Excise 12 - TS': '12.000'}}
|
||||
|
||||
itemwise_tax = {}
|
||||
taxes = frappe.db.sql(""" select parent, tax_type, tax_rate from `tabItem Tax`""", as_dict=1)
|
||||
taxes = frappe.db.sql(""" select parent, tax_type, tax_rate from `tabItem Tax Template Detail`""", as_dict=1)
|
||||
|
||||
for tax in taxes:
|
||||
if tax.parent not in itemwise_tax:
|
||||
@@ -317,14 +328,14 @@ def get_item_tax_data():
|
||||
return itemwise_tax
|
||||
|
||||
|
||||
def get_price_list_data(selling_price_list):
|
||||
def get_price_list_data(selling_price_list, conversion_rate):
|
||||
itemwise_price_list = {}
|
||||
price_lists = frappe.db.sql("""Select ifnull(price_list_rate, 0) as price_list_rate,
|
||||
item_code from `tabItem Price` ip where price_list = %(price_list)s""",
|
||||
{'price_list': selling_price_list}, as_dict=1)
|
||||
|
||||
for item in price_lists:
|
||||
itemwise_price_list[item.item_code] = item.price_list_rate
|
||||
itemwise_price_list[item.item_code] = item.price_list_rate * conversion_rate
|
||||
|
||||
return itemwise_price_list
|
||||
|
||||
@@ -391,14 +402,21 @@ def make_invoice(doc_list={}, email_queue_list={}, customers_list={}):
|
||||
for docs in doc_list:
|
||||
for name, doc in iteritems(docs):
|
||||
if not frappe.db.exists('Sales Invoice', {'offline_pos_name': name}):
|
||||
validate_records(doc)
|
||||
si_doc = frappe.new_doc('Sales Invoice')
|
||||
si_doc.offline_pos_name = name
|
||||
si_doc.update(doc)
|
||||
si_doc.set_posting_time = 1
|
||||
si_doc.customer = get_customer_id(doc)
|
||||
si_doc.due_date = doc.get('posting_date')
|
||||
name_list = submit_invoice(si_doc, name, doc, name_list)
|
||||
if isinstance(doc, dict):
|
||||
validate_records(doc)
|
||||
si_doc = frappe.new_doc('Sales Invoice')
|
||||
si_doc.offline_pos_name = name
|
||||
si_doc.update(doc)
|
||||
si_doc.set_posting_time = 1
|
||||
si_doc.customer = get_customer_id(doc)
|
||||
si_doc.due_date = doc.get('posting_date')
|
||||
name_list = submit_invoice(si_doc, name, doc, name_list)
|
||||
else:
|
||||
doc.due_date = doc.get('posting_date')
|
||||
doc.customer = get_customer_id(doc)
|
||||
doc.set_posting_time = 1
|
||||
doc.offline_pos_name = name
|
||||
name_list = submit_invoice(doc, name, doc, name_list)
|
||||
else:
|
||||
name_list.append(name)
|
||||
|
||||
@@ -432,7 +450,6 @@ def get_customer_id(doc, customer=None):
|
||||
|
||||
return cust_id
|
||||
|
||||
|
||||
def make_customer_and_address(customers):
|
||||
customers_list = []
|
||||
for customer, data in iteritems(customers):
|
||||
@@ -449,7 +466,6 @@ def make_customer_and_address(customers):
|
||||
frappe.db.commit()
|
||||
return customers_list
|
||||
|
||||
|
||||
def add_customer(data):
|
||||
customer = data.get('full_name') or data.get('customer')
|
||||
if frappe.db.exists("Customer", customer.strip()):
|
||||
@@ -466,21 +482,18 @@ def add_customer(data):
|
||||
frappe.db.commit()
|
||||
return customer_doc.name
|
||||
|
||||
|
||||
def get_territory(data):
|
||||
if data.get('territory'):
|
||||
return data.get('territory')
|
||||
|
||||
return frappe.db.get_single_value('Selling Settings','territory') or _('All Territories')
|
||||
|
||||
|
||||
def get_customer_group(data):
|
||||
if data.get('customer_group'):
|
||||
return data.get('customer_group')
|
||||
|
||||
return frappe.db.get_single_value('Selling Settings', 'customer_group') or frappe.db.get_value('Customer Group', {'is_group': 0}, 'name')
|
||||
|
||||
|
||||
def make_contact(args, customer):
|
||||
if args.get('email_id') or args.get('phone'):
|
||||
name = frappe.db.get_value('Dynamic Link',
|
||||
@@ -506,7 +519,6 @@ def make_contact(args, customer):
|
||||
doc.flags.ignore_mandatory = True
|
||||
doc.save(ignore_permissions=True)
|
||||
|
||||
|
||||
def make_address(args, customer):
|
||||
if not args.get('address_line1'):
|
||||
return
|
||||
@@ -521,7 +533,10 @@ def make_address(args, customer):
|
||||
address = frappe.get_doc('Address', name)
|
||||
else:
|
||||
address = frappe.new_doc('Address')
|
||||
address.country = frappe.get_cached_value('Company', args.get('company'), 'country')
|
||||
if args.get('company'):
|
||||
address.country = frappe.get_cached_value('Company',
|
||||
args.get('company'), 'country')
|
||||
|
||||
address.append('links', {
|
||||
'link_doctype': 'Customer',
|
||||
'link_name': customer
|
||||
@@ -533,7 +548,6 @@ def make_address(args, customer):
|
||||
address.flags.ignore_mandatory = True
|
||||
address.save(ignore_permissions=True)
|
||||
|
||||
|
||||
def make_email_queue(email_queue):
|
||||
name_list = []
|
||||
for key, data in iteritems(email_queue):
|
||||
@@ -550,7 +564,6 @@ def make_email_queue(email_queue):
|
||||
|
||||
return name_list
|
||||
|
||||
|
||||
def validate_item(doc):
|
||||
for item in doc.get('items'):
|
||||
if not frappe.db.exists('Item', item.get('item_code')):
|
||||
@@ -569,7 +582,6 @@ def validate_item(doc):
|
||||
item_doc.save(ignore_permissions=True)
|
||||
frappe.db.commit()
|
||||
|
||||
|
||||
def submit_invoice(si_doc, name, doc, name_list):
|
||||
try:
|
||||
si_doc.insert()
|
||||
@@ -585,7 +597,6 @@ def submit_invoice(si_doc, name, doc, name_list):
|
||||
|
||||
return name_list
|
||||
|
||||
|
||||
def save_invoice(doc, name, name_list):
|
||||
try:
|
||||
if not frappe.db.exists('Sales Invoice', {'offline_pos_name': name}):
|
||||
|
||||
@@ -158,7 +158,7 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
|
||||
cur_frm.meta._default_print_format = cur_frm.meta.default_print_format;
|
||||
cur_frm.meta.default_print_format = cur_frm.pos_print_format;
|
||||
}
|
||||
} else if(cur_frm.doc.is_return) {
|
||||
} else if(cur_frm.doc.is_return && !cur_frm.meta.default_print_format) {
|
||||
if(cur_frm.return_print_format) {
|
||||
cur_frm.meta._default_print_format = cur_frm.meta.default_print_format;
|
||||
cur_frm.meta.default_print_format = cur_frm.return_print_format;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -136,6 +136,16 @@ class SalesInvoice(SellingController):
|
||||
if self.redeem_loyalty_points and self.loyalty_program and self.loyalty_points:
|
||||
validate_loyalty_points(self, self.loyalty_points)
|
||||
|
||||
def validate_fixed_asset(self):
|
||||
for d in self.get("items"):
|
||||
if d.is_fixed_asset and d.meta.get_field("asset") and d.asset:
|
||||
asset = frappe.get_doc("Asset", d.asset)
|
||||
if self.doctype == "Sales Invoice" and self.docstatus == 1:
|
||||
if self.update_stock:
|
||||
frappe.throw(_("'Update Stock' cannot be checked for fixed asset sale"))
|
||||
|
||||
elif asset.status in ("Scrapped", "Cancelled", "Sold"):
|
||||
frappe.throw(_("Row #{0}: Asset {1} cannot be submitted, it is already {2}").format(d.idx, d.asset, asset.status))
|
||||
|
||||
def before_save(self):
|
||||
set_account_for_mode_of_payment(self)
|
||||
@@ -206,9 +216,9 @@ class SalesInvoice(SellingController):
|
||||
total_amount_in_payments = 0
|
||||
for payment in self.payments:
|
||||
total_amount_in_payments += payment.amount
|
||||
|
||||
if total_amount_in_payments < self.rounded_total:
|
||||
frappe.throw(_("Total payments amount can't be greater than {}".format(-self.rounded_total)))
|
||||
invoice_total = self.rounded_total or self.grand_total
|
||||
if total_amount_in_payments < invoice_total:
|
||||
frappe.throw(_("Total payments amount can't be greater than {}".format(-invoice_total)))
|
||||
|
||||
def validate_pos_paid_amount(self):
|
||||
if len(self.payments) == 0 and self.is_pos:
|
||||
@@ -304,8 +314,10 @@ 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.get_cached_value("Customer", self.customer,
|
||||
"bypass_credit_limit_check_at_sales_order"))
|
||||
bypass_credit_limit_check_at_sales_order = frappe.db.get_value("Customer Credit Limit",
|
||||
filters={'parent': self.customer, 'parenttype': 'Customer', 'company': self.company},
|
||||
fieldname=["bypass_credit_limit_check"])
|
||||
|
||||
if bypass_credit_limit_check_at_sales_order:
|
||||
validate_against_credit_limit = True
|
||||
|
||||
@@ -684,7 +696,6 @@ class SalesInvoice(SellingController):
|
||||
|
||||
def make_gl_entries(self, gl_entries=None, repost_future_gle=True, from_repost=False):
|
||||
auto_accounting_for_stock = erpnext.is_perpetual_inventory_enabled(self.company)
|
||||
|
||||
if not gl_entries:
|
||||
gl_entries = self.get_gl_entries()
|
||||
|
||||
@@ -696,7 +707,7 @@ class SalesInvoice(SellingController):
|
||||
cint(self.redeem_loyalty_points)) else "Yes"
|
||||
|
||||
make_gl_entries(gl_entries, cancel=(self.docstatus == 2),
|
||||
update_outstanding=update_outstanding, merge_entries=False)
|
||||
update_outstanding=update_outstanding, merge_entries=False, from_repost=from_repost)
|
||||
|
||||
if update_outstanding == "No":
|
||||
from erpnext.accounts.doctype.gl_entry.gl_entry import update_outstanding_amt
|
||||
@@ -942,7 +953,7 @@ class SalesInvoice(SellingController):
|
||||
)
|
||||
|
||||
def make_gle_for_rounding_adjustment(self, gl_entries):
|
||||
if flt(self.rounding_adjustment, self.precision("rounding_adjustment")):
|
||||
if flt(self.rounding_adjustment, self.precision("rounding_adjustment")) and self.base_rounding_adjustment:
|
||||
round_off_account, round_off_cost_center = \
|
||||
get_round_off_account_and_cost_center(self.company)
|
||||
|
||||
@@ -990,10 +1001,8 @@ class SalesInvoice(SellingController):
|
||||
continue
|
||||
|
||||
for serial_no in item.serial_no.split("\n"):
|
||||
if serial_no and frappe.db.exists('Serial No', serial_no):
|
||||
sno = frappe.get_doc('Serial No', serial_no)
|
||||
sno.sales_invoice = invoice
|
||||
sno.db_update()
|
||||
if serial_no and frappe.db.get_value('Serial No', serial_no, 'item_code') == item.item_code:
|
||||
frappe.db.set_value('Serial No', serial_no, 'sales_invoice', invoice)
|
||||
|
||||
def validate_serial_numbers(self):
|
||||
"""
|
||||
@@ -1039,12 +1048,18 @@ class SalesInvoice(SellingController):
|
||||
continue
|
||||
|
||||
for serial_no in item.serial_no.split("\n"):
|
||||
sales_invoice = frappe.db.get_value("Serial No", serial_no, "sales_invoice")
|
||||
if sales_invoice and self.name != sales_invoice:
|
||||
sales_invoice_company = frappe.db.get_value("Sales Invoice", sales_invoice, "company")
|
||||
serial_no_details = frappe.db.get_value("Serial No", serial_no,
|
||||
["sales_invoice", "item_code"], as_dict=1)
|
||||
|
||||
if not serial_no_details:
|
||||
continue
|
||||
|
||||
if serial_no_details.sales_invoice and serial_no_details.item_code == item.item_code \
|
||||
and self.name != serial_no_details.sales_invoice:
|
||||
sales_invoice_company = frappe.db.get_value("Sales Invoice", serial_no_details.sales_invoice, "company")
|
||||
if sales_invoice_company == self.company:
|
||||
frappe.throw(_("Serial Number: {0} is already referenced in Sales Invoice: {1}"
|
||||
.format(serial_no, sales_invoice)))
|
||||
.format(serial_no, serial_no_details.sales_invoice)))
|
||||
|
||||
def update_project(self):
|
||||
if self.project:
|
||||
@@ -1229,7 +1244,8 @@ class SalesInvoice(SellingController):
|
||||
self.status = "Unpaid and Discounted"
|
||||
elif flt(self.outstanding_amount) > 0 and getdate(self.due_date) >= getdate(nowdate()):
|
||||
self.status = "Unpaid"
|
||||
elif flt(self.outstanding_amount) < 0 and self.is_return==0 and frappe.db.get_value('Sales Invoice', {'is_return': 1, 'return_against': self.name, 'docstatus': 1}):
|
||||
#Check if outstanding amount is 0 due to credit note issued against invoice
|
||||
elif flt(self.outstanding_amount) <= 0 and self.is_return == 0 and frappe.db.get_value('Sales Invoice', {'is_return': 1, 'return_against': self.name, 'docstatus': 1}):
|
||||
self.status = "Credit Note Issued"
|
||||
elif self.is_return == 1:
|
||||
self.status = "Return"
|
||||
@@ -1510,4 +1526,4 @@ def create_invoice_discounting(source_name, target_doc=None):
|
||||
"outstanding_amount": invoice.outstanding_amount
|
||||
})
|
||||
|
||||
return invoice_discounting
|
||||
return invoice_discounting
|
||||
|
||||
@@ -68,8 +68,6 @@
|
||||
"selling_price_list": "_Test Price List",
|
||||
"territory": "_Test Territory"
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
"company": "_Test Company",
|
||||
"conversion_rate": 1.0,
|
||||
@@ -276,7 +274,6 @@
|
||||
"uom": "_Test UOM 1",
|
||||
"conversion_factor": 1,
|
||||
"stock_uom": "_Test UOM 1"
|
||||
|
||||
},
|
||||
{
|
||||
"cost_center": "_Test Cost Center - _TC",
|
||||
|
||||
@@ -20,6 +20,9 @@ from erpnext.stock.doctype.item.test_item import create_item
|
||||
from six import iteritems
|
||||
from erpnext.accounts.doctype.sales_invoice.sales_invoice import make_inter_company_transaction
|
||||
from erpnext.regional.india.utils import get_ewb_data
|
||||
from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry
|
||||
from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import make_purchase_receipt
|
||||
from erpnext.stock.doctype.delivery_note.delivery_note import make_sales_invoice
|
||||
|
||||
class TestSalesInvoice(unittest.TestCase):
|
||||
def make(self):
|
||||
@@ -550,7 +553,6 @@ class TestSalesInvoice(unittest.TestCase):
|
||||
si.get("taxes")[6].tax_amount = 2
|
||||
|
||||
si.insert()
|
||||
print(si.name)
|
||||
|
||||
expected_values = [
|
||||
{
|
||||
@@ -679,56 +681,67 @@ class TestSalesInvoice(unittest.TestCase):
|
||||
self.assertFalse(gle)
|
||||
|
||||
def test_pos_gl_entry_with_perpetual_inventory(self):
|
||||
set_perpetual_inventory()
|
||||
make_pos_profile()
|
||||
|
||||
self._insert_purchase_receipt()
|
||||
pos = copy.deepcopy(test_records[1])
|
||||
pos["is_pos"] = 1
|
||||
pos["update_stock"] = 1
|
||||
pos["payments"] = [{'mode_of_payment': 'Bank Draft', 'account': '_Test Bank - _TC', 'amount': 300},
|
||||
{'mode_of_payment': 'Cash', 'account': 'Cash - _TC', 'amount': 300}]
|
||||
pr = make_purchase_receipt(company= "_Test Company with perpetual inventory",supplier_warehouse= "Work In Progress - TCP1", item_code= "_Test FG Item",warehouse= "Stores - TCP1",cost_center= "Main - TCP1")
|
||||
|
||||
pos = create_sales_invoice(company= "_Test Company with perpetual inventory", debit_to="Debtors - TCP1", item_code= "_Test FG Item", warehouse="Stores - TCP1", income_account = "Sales - TCP1", expense_account = "Cost of Goods Sold - TCP1", cost_center = "Main - TCP1", do_not_save=True)
|
||||
|
||||
pos.is_pos = 1
|
||||
pos.update_stock = 1
|
||||
|
||||
pos.append("payments", {'mode_of_payment': 'Bank Draft', 'account': '_Test Bank - TCP1', 'amount': 50})
|
||||
pos.append("payments", {'mode_of_payment': 'Cash', 'account': 'Cash - TCP1', 'amount': 50})
|
||||
|
||||
taxes = get_taxes_and_charges()
|
||||
pos.taxes = []
|
||||
for tax in taxes:
|
||||
pos.append("taxes", tax)
|
||||
|
||||
si = frappe.copy_doc(pos)
|
||||
si.insert()
|
||||
si.submit()
|
||||
self.assertEqual(si.paid_amount, 100.0)
|
||||
|
||||
self.assertEqual(si.paid_amount, 600.0)
|
||||
|
||||
self.pos_gl_entry(si, pos, 300)
|
||||
self.pos_gl_entry(si, pos, 50)
|
||||
|
||||
def test_pos_change_amount(self):
|
||||
set_perpetual_inventory()
|
||||
make_pos_profile()
|
||||
|
||||
self._insert_purchase_receipt()
|
||||
pos = copy.deepcopy(test_records[1])
|
||||
pos["is_pos"] = 1
|
||||
pos["update_stock"] = 1
|
||||
pos["payments"] = [{'mode_of_payment': 'Bank Draft', 'account': '_Test Bank - _TC', 'amount': 300},
|
||||
{'mode_of_payment': 'Cash', 'account': 'Cash - _TC', 'amount': 340}]
|
||||
pr = make_purchase_receipt(company= "_Test Company with perpetual inventory",supplier_warehouse= "Work In Progress - TCP1", item_code= "_Test FG Item",warehouse= "Stores - TCP1",cost_center= "Main - TCP1")
|
||||
|
||||
si = frappe.copy_doc(pos)
|
||||
si.change_amount = 5.0
|
||||
si.insert()
|
||||
si.submit()
|
||||
pos = create_sales_invoice(company= "_Test Company with perpetual inventory", debit_to="Debtors - TCP1", item_code= "_Test FG Item", warehouse="Stores - TCP1", income_account = "Sales - TCP1", expense_account = "Cost of Goods Sold - TCP1", cost_center = "Main - TCP1", do_not_save=True)
|
||||
|
||||
self.assertEqual(si.grand_total, 630.0)
|
||||
self.assertEqual(si.write_off_amount, -5)
|
||||
pos.is_pos = 1
|
||||
pos.update_stock = 1
|
||||
|
||||
pos.append("payments", {'mode_of_payment': 'Bank Draft', 'account': '_Test Bank - TCP1', 'amount': 50})
|
||||
pos.append("payments", {'mode_of_payment': 'Cash', 'account': 'Cash - TCP1', 'amount': 60})
|
||||
|
||||
pos.change_amount = 5.0
|
||||
pos.insert()
|
||||
pos.submit()
|
||||
|
||||
self.assertEqual(pos.grand_total, 100.0)
|
||||
self.assertEqual(pos.write_off_amount, -5)
|
||||
|
||||
def test_make_pos_invoice(self):
|
||||
from erpnext.accounts.doctype.sales_invoice.pos import make_invoice
|
||||
|
||||
set_perpetual_inventory()
|
||||
|
||||
make_pos_profile()
|
||||
self._insert_purchase_receipt()
|
||||
pr = make_purchase_receipt(company= "_Test Company with perpetual inventory",supplier_warehouse= "Work In Progress - TCP1", item_code= "_Test FG Item",warehouse= "Stores - TCP1",cost_center= "Main - TCP1")
|
||||
pos = create_sales_invoice(company= "_Test Company with perpetual inventory", debit_to="Debtors - TCP1", item_code= "_Test FG Item", warehouse="Stores - TCP1", income_account = "Sales - TCP1", expense_account = "Cost of Goods Sold - TCP1", cost_center = "Main - TCP1", do_not_save=True)
|
||||
|
||||
pos = copy.deepcopy(test_records[1])
|
||||
pos["is_pos"] = 1
|
||||
pos["update_stock"] = 1
|
||||
pos["payments"] = [{'mode_of_payment': 'Bank Draft', 'account': '_Test Bank - _TC', 'amount': 300},
|
||||
{'mode_of_payment': 'Cash', 'account': 'Cash - _TC', 'amount': 330}]
|
||||
pos.is_pos = 1
|
||||
pos.update_stock = 1
|
||||
|
||||
pos.append("payments", {'mode_of_payment': 'Bank Draft', 'account': '_Test Bank - TCP1', 'amount': 50})
|
||||
pos.append("payments", {'mode_of_payment': 'Cash', 'account': 'Cash - TCP1', 'amount': 50})
|
||||
|
||||
taxes = get_taxes_and_charges()
|
||||
pos.taxes = []
|
||||
for tax in taxes:
|
||||
pos.append("taxes", tax)
|
||||
|
||||
invoice_data = [{'09052016142': pos}]
|
||||
si = make_invoice(invoice_data).get('invoice')
|
||||
@@ -736,16 +749,15 @@ class TestSalesInvoice(unittest.TestCase):
|
||||
|
||||
sales_invoice = frappe.get_all('Sales Invoice', fields =["*"], filters = {'offline_pos_name': '09052016142', 'docstatus': 1})
|
||||
si = frappe.get_doc('Sales Invoice', sales_invoice[0].name)
|
||||
self.assertEqual(si.grand_total, 630.0)
|
||||
|
||||
self.pos_gl_entry(si, pos, 330)
|
||||
self.assertEqual(si.grand_total, 100)
|
||||
|
||||
self.pos_gl_entry(si, pos, 50)
|
||||
|
||||
def test_make_pos_invoice_in_draft(self):
|
||||
from erpnext.accounts.doctype.sales_invoice.pos import make_invoice
|
||||
from erpnext.stock.doctype.item.test_item import make_item
|
||||
|
||||
set_perpetual_inventory()
|
||||
|
||||
allow_negative_stock = frappe.db.get_single_value('Stock Settings', 'allow_negative_stock')
|
||||
if allow_negative_stock:
|
||||
frappe.db.set_value('Stock Settings', None, 'allow_negative_stock', 0)
|
||||
@@ -789,7 +801,7 @@ class TestSalesInvoice(unittest.TestCase):
|
||||
si.name, as_dict=1)[0]
|
||||
self.assertTrue(sle)
|
||||
self.assertEqual([sle.item_code, sle.warehouse, sle.actual_qty],
|
||||
["_Test Item", "_Test Warehouse - _TC", -1.0])
|
||||
['_Test FG Item', 'Stores - TCP1', -1.0])
|
||||
|
||||
# check gl entries
|
||||
gl_entries = frappe.db.sql("""select account, debit, credit
|
||||
@@ -797,19 +809,19 @@ class TestSalesInvoice(unittest.TestCase):
|
||||
order by account asc, debit asc, credit asc""", si.name, as_dict=1)
|
||||
self.assertTrue(gl_entries)
|
||||
|
||||
stock_in_hand = get_inventory_account('_Test Company')
|
||||
|
||||
stock_in_hand = get_inventory_account('_Test Company with perpetual inventory')
|
||||
expected_gl_entries = sorted([
|
||||
[si.debit_to, 630.0, 0.0],
|
||||
[pos["items"][0]["income_account"], 0.0, 500.0],
|
||||
[pos["taxes"][0]["account_head"], 0.0, 80.0],
|
||||
[pos["taxes"][1]["account_head"], 0.0, 50.0],
|
||||
[si.debit_to, 100.0, 0.0],
|
||||
[pos.items[0].income_account, 0.0, 89.09],
|
||||
['Round Off - TCP1', 0.0, 0.01],
|
||||
[pos.taxes[0].account_head, 0.0, 10.69],
|
||||
[pos.taxes[1].account_head, 0.0, 0.21],
|
||||
[stock_in_hand, 0.0, abs(sle.stock_value_difference)],
|
||||
[pos["items"][0]["expense_account"], abs(sle.stock_value_difference), 0.0],
|
||||
[si.debit_to, 0.0, 300.0],
|
||||
[pos.items[0].expense_account, abs(sle.stock_value_difference), 0.0],
|
||||
[si.debit_to, 0.0, 50.0],
|
||||
[si.debit_to, 0.0, cash_amount],
|
||||
["_Test Bank - _TC", 300.0, 0.0],
|
||||
["Cash - _TC", cash_amount, 0.0]
|
||||
["_Test Bank - TCP1", 50, 0.0],
|
||||
["Cash - TCP1", cash_amount, 0.0]
|
||||
])
|
||||
|
||||
for i, gle in enumerate(sorted(gl_entries, key=lambda gle: gle.account)):
|
||||
@@ -818,15 +830,14 @@ class TestSalesInvoice(unittest.TestCase):
|
||||
self.assertEqual(expected_gl_entries[i][2], gle.credit)
|
||||
|
||||
si.cancel()
|
||||
frappe.delete_doc('Sales Invoice', si.name)
|
||||
gle = frappe.db.sql("""select * from `tabGL Entry`
|
||||
where voucher_type='Sales Invoice' and voucher_no=%s""", si.name)
|
||||
|
||||
self.assertFalse(gle)
|
||||
|
||||
set_perpetual_inventory(0)
|
||||
|
||||
frappe.db.sql("delete from `tabPOS Profile`")
|
||||
si.delete()
|
||||
|
||||
def test_pos_si_without_payment(self):
|
||||
set_perpetual_inventory()
|
||||
@@ -1009,7 +1020,6 @@ class TestSalesInvoice(unittest.TestCase):
|
||||
"""
|
||||
from erpnext.stock.doctype.stock_entry.test_stock_entry import make_serialized_item
|
||||
from erpnext.stock.doctype.delivery_note.test_delivery_note import create_delivery_note
|
||||
from erpnext.stock.doctype.delivery_note.delivery_note import make_sales_invoice
|
||||
from erpnext.stock.doctype.serial_no.serial_no import get_serial_nos
|
||||
|
||||
se = make_serialized_item()
|
||||
@@ -1024,14 +1034,17 @@ class TestSalesInvoice(unittest.TestCase):
|
||||
self.assertEqual(si.get("items")[0].serial_no, dn.get("items")[0].serial_no)
|
||||
|
||||
def test_return_sales_invoice(self):
|
||||
set_perpetual_inventory()
|
||||
make_stock_entry(item_code="_Test Item", target="_Test Warehouse - _TC", qty=50, basic_rate=100)
|
||||
make_stock_entry(item_code="_Test Item", target="Stores - TCP1", qty=50, basic_rate=100)
|
||||
|
||||
actual_qty_0 = get_qty_after_transaction()
|
||||
actual_qty_0 = get_qty_after_transaction(item_code = "_Test Item", warehouse = "Stores - TCP1")
|
||||
|
||||
si = create_sales_invoice(qty=5, rate=500, update_stock=1)
|
||||
si = create_sales_invoice(qty = 5, rate=500, update_stock=1, company= "_Test Company with perpetual inventory", debit_to="Debtors - TCP1", item_code= "_Test Item", warehouse="Stores - TCP1", income_account = "Sales - TCP1", expense_account = "Cost of Goods Sold - TCP1", cost_center = "Main - TCP1")
|
||||
|
||||
|
||||
actual_qty_1 = get_qty_after_transaction(item_code = "_Test Item", warehouse = "Stores - TCP1")
|
||||
|
||||
frappe.db.commit()
|
||||
|
||||
actual_qty_1 = get_qty_after_transaction()
|
||||
self.assertEqual(actual_qty_0 - 5, actual_qty_1)
|
||||
|
||||
# outgoing_rate
|
||||
@@ -1039,10 +1052,9 @@ class TestSalesInvoice(unittest.TestCase):
|
||||
"voucher_no": si.name}, "stock_value_difference") / 5
|
||||
|
||||
# return entry
|
||||
si1 = create_sales_invoice(is_return=1, return_against=si.name, qty=-2, rate=500, update_stock=1)
|
||||
|
||||
actual_qty_2 = get_qty_after_transaction()
|
||||
si1 = create_sales_invoice(is_return=1, return_against=si.name, qty=-2, rate=500, update_stock=1, company= "_Test Company with perpetual inventory", debit_to="Debtors - TCP1", item_code= "_Test Item", warehouse="Stores - TCP1", income_account = "Sales - TCP1", expense_account = "Cost of Goods Sold - TCP1", cost_center = "Main - TCP1")
|
||||
|
||||
actual_qty_2 = get_qty_after_transaction(item_code = "_Test Item", warehouse = "Stores - TCP1")
|
||||
self.assertEqual(actual_qty_1 + 2, actual_qty_2)
|
||||
|
||||
incoming_rate, stock_value_difference = frappe.db.get_value("Stock Ledger Entry",
|
||||
@@ -1050,7 +1062,7 @@ class TestSalesInvoice(unittest.TestCase):
|
||||
["incoming_rate", "stock_value_difference"])
|
||||
|
||||
self.assertEqual(flt(incoming_rate, 3), abs(flt(outgoing_rate, 3)))
|
||||
stock_in_hand_account = get_inventory_account('_Test Company', si1.items[0].warehouse)
|
||||
stock_in_hand_account = get_inventory_account('_Test Company with perpetual inventory', si1.items[0].warehouse)
|
||||
|
||||
# Check gl entry
|
||||
gle_warehouse_amount = frappe.db.get_value("GL Entry", {"voucher_type": "Sales Invoice",
|
||||
@@ -1059,7 +1071,7 @@ class TestSalesInvoice(unittest.TestCase):
|
||||
self.assertEqual(gle_warehouse_amount, stock_value_difference)
|
||||
|
||||
party_credited = frappe.db.get_value("GL Entry", {"voucher_type": "Sales Invoice",
|
||||
"voucher_no": si1.name, "account": "Debtors - _TC", "party": "_Test Customer"}, "credit")
|
||||
"voucher_no": si1.name, "account": "Debtors - TCP1", "party": "_Test Customer"}, "credit")
|
||||
|
||||
self.assertEqual(party_credited, 1000)
|
||||
|
||||
@@ -1067,7 +1079,6 @@ class TestSalesInvoice(unittest.TestCase):
|
||||
self.assertFalse(si1.outstanding_amount)
|
||||
self.assertEqual(frappe.db.get_value("Sales Invoice", si.name, "outstanding_amount"), 1500)
|
||||
|
||||
set_perpetual_inventory(0)
|
||||
|
||||
def test_discount_on_net_total(self):
|
||||
si = frappe.copy_doc(test_records[2])
|
||||
@@ -1525,6 +1536,8 @@ class TestSalesInvoice(unittest.TestCase):
|
||||
self.assertEqual(si.total_taxes_and_charges, 577.05)
|
||||
self.assertEqual(si.grand_total, 1827.05)
|
||||
|
||||
|
||||
|
||||
def test_create_invoice_without_terms(self):
|
||||
si = create_sales_invoice(do_not_save=1)
|
||||
self.assertFalse(si.get('payment_schedule'))
|
||||
@@ -1931,4 +1944,29 @@ def get_outstanding_amount(against_voucher_type, against_voucher, account, party
|
||||
if against_voucher_type == 'Purchase Invoice':
|
||||
bal = bal * -1
|
||||
|
||||
return bal
|
||||
return bal
|
||||
|
||||
def get_taxes_and_charges():
|
||||
return [{
|
||||
"account_head": "_Test Account Excise Duty - TCP1",
|
||||
"charge_type": "On Net Total",
|
||||
"cost_center": "Main - TCP1",
|
||||
"description": "Excise Duty",
|
||||
"doctype": "Sales Taxes and Charges",
|
||||
"idx": 1,
|
||||
"included_in_print_rate": 1,
|
||||
"parentfield": "taxes",
|
||||
"rate": 12
|
||||
},
|
||||
{
|
||||
"account_head": "_Test Account Education Cess - TCP1",
|
||||
"charge_type": "On Previous Row Amount",
|
||||
"cost_center": "Main - TCP1",
|
||||
"description": "Education Cess",
|
||||
"doctype": "Sales Taxes and Charges",
|
||||
"idx": 2,
|
||||
"included_in_print_rate": 1,
|
||||
"parentfield": "taxes",
|
||||
"rate": 2,
|
||||
"row_id": 1
|
||||
}]
|
||||
@@ -16,11 +16,13 @@ frappe.ui.form.on('Share Transfer', {
|
||||
};
|
||||
};
|
||||
});
|
||||
if (frm.doc.docstatus == 1) {
|
||||
if (frm.doc.docstatus == 1 && frm.doc.equity_or_liability_account && frm.doc.asset_account) {
|
||||
frm.add_custom_button(__('Create Journal Entry'), function () {
|
||||
erpnext.share_transfer.make_jv(frm);
|
||||
});
|
||||
}
|
||||
|
||||
frm.toggle_reqd("asset_account", frm.doc.transfer_type != "Transfer");
|
||||
},
|
||||
no_of_shares: (frm) => {
|
||||
if (frm.doc.rate != undefined || frm.doc.rate != null){
|
||||
@@ -56,6 +58,10 @@ frappe.ui.form.on('Share Transfer', {
|
||||
};
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
transfer_type: function(frm) {
|
||||
frm.toggle_reqd("asset_account", frm.doc.transfer_type != "Transfer");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -86,17 +86,23 @@ class ShareTransfer(Document):
|
||||
frappe.throw(_('The field From Shareholder cannot be blank'))
|
||||
if self.from_folio_no is None or self.from_folio_no is '':
|
||||
self.to_folio_no = self.autoname_folio(self.to_shareholder)
|
||||
if self.asset_account is None:
|
||||
frappe.throw(_('The field Asset Account cannot be blank'))
|
||||
elif (self.transfer_type == 'Issue'):
|
||||
self.from_shareholder = ''
|
||||
if self.to_shareholder is None or self.to_shareholder == '':
|
||||
frappe.throw(_('The field To Shareholder cannot be blank'))
|
||||
if self.to_folio_no is None or self.to_folio_no is '':
|
||||
self.to_folio_no = self.autoname_folio(self.to_shareholder)
|
||||
if self.asset_account is None:
|
||||
frappe.throw(_('The field Asset Account cannot be blank'))
|
||||
else:
|
||||
if self.from_shareholder is None or self.to_shareholder is None:
|
||||
frappe.throw(_('The fields From Shareholder and To Shareholder cannot be blank'))
|
||||
if self.to_folio_no is None or self.to_folio_no is '':
|
||||
self.to_folio_no = self.autoname_folio(self.to_shareholder)
|
||||
if self.equity_or_liability_account is None:
|
||||
frappe.throw(_('The field Equity/Liability Account cannot be blank'))
|
||||
if self.from_shareholder == self.to_shareholder:
|
||||
frappe.throw(_('The seller and the buyer cannot be the same'))
|
||||
if self.no_of_shares != self.to_no - self.from_no + 1:
|
||||
|
||||
@@ -15,67 +15,74 @@ class TestShareTransfer(unittest.TestCase):
|
||||
frappe.db.sql("delete from `tabShare Balance`")
|
||||
share_transfers = [
|
||||
{
|
||||
"doctype" : "Share Transfer",
|
||||
"transfer_type" : "Issue",
|
||||
"date" : "2018-01-01",
|
||||
"to_shareholder" : "SH-00001",
|
||||
"share_type" : "Equity",
|
||||
"from_no" : 1,
|
||||
"to_no" : 500,
|
||||
"no_of_shares" : 500,
|
||||
"rate" : 10,
|
||||
"company" : "_Test Company"
|
||||
"doctype" : "Share Transfer",
|
||||
"transfer_type" : "Issue",
|
||||
"date" : "2018-01-01",
|
||||
"to_shareholder" : "SH-00001",
|
||||
"share_type" : "Equity",
|
||||
"from_no" : 1,
|
||||
"to_no" : 500,
|
||||
"no_of_shares" : 500,
|
||||
"rate" : 10,
|
||||
"company" : "_Test Company",
|
||||
"asset_account" : "Cash - _TC",
|
||||
"equity_or_liability_account": "Creditors - _TC"
|
||||
},
|
||||
{
|
||||
"doctype" : "Share Transfer",
|
||||
"transfer_type" : "Transfer",
|
||||
"date" : "2018-01-02",
|
||||
"from_shareholder" : "SH-00001",
|
||||
"to_shareholder" : "SH-00002",
|
||||
"share_type" : "Equity",
|
||||
"from_no" : 101,
|
||||
"to_no" : 200,
|
||||
"no_of_shares" : 100,
|
||||
"rate" : 15,
|
||||
"company" : "_Test Company"
|
||||
"doctype" : "Share Transfer",
|
||||
"transfer_type" : "Transfer",
|
||||
"date" : "2018-01-02",
|
||||
"from_shareholder" : "SH-00001",
|
||||
"to_shareholder" : "SH-00002",
|
||||
"share_type" : "Equity",
|
||||
"from_no" : 101,
|
||||
"to_no" : 200,
|
||||
"no_of_shares" : 100,
|
||||
"rate" : 15,
|
||||
"company" : "_Test Company",
|
||||
"equity_or_liability_account": "Creditors - _TC"
|
||||
},
|
||||
{
|
||||
"doctype" : "Share Transfer",
|
||||
"transfer_type" : "Transfer",
|
||||
"date" : "2018-01-03",
|
||||
"from_shareholder" : "SH-00001",
|
||||
"to_shareholder" : "SH-00003",
|
||||
"share_type" : "Equity",
|
||||
"from_no" : 201,
|
||||
"to_no" : 500,
|
||||
"no_of_shares" : 300,
|
||||
"rate" : 20,
|
||||
"company" : "_Test Company"
|
||||
"doctype" : "Share Transfer",
|
||||
"transfer_type" : "Transfer",
|
||||
"date" : "2018-01-03",
|
||||
"from_shareholder" : "SH-00001",
|
||||
"to_shareholder" : "SH-00003",
|
||||
"share_type" : "Equity",
|
||||
"from_no" : 201,
|
||||
"to_no" : 500,
|
||||
"no_of_shares" : 300,
|
||||
"rate" : 20,
|
||||
"company" : "_Test Company",
|
||||
"equity_or_liability_account": "Creditors - _TC"
|
||||
},
|
||||
{
|
||||
"doctype" : "Share Transfer",
|
||||
"transfer_type" : "Transfer",
|
||||
"date" : "2018-01-04",
|
||||
"from_shareholder" : "SH-00003",
|
||||
"to_shareholder" : "SH-00002",
|
||||
"share_type" : "Equity",
|
||||
"from_no" : 201,
|
||||
"to_no" : 400,
|
||||
"no_of_shares" : 200,
|
||||
"rate" : 15,
|
||||
"company" : "_Test Company"
|
||||
"doctype" : "Share Transfer",
|
||||
"transfer_type" : "Transfer",
|
||||
"date" : "2018-01-04",
|
||||
"from_shareholder" : "SH-00003",
|
||||
"to_shareholder" : "SH-00002",
|
||||
"share_type" : "Equity",
|
||||
"from_no" : 201,
|
||||
"to_no" : 400,
|
||||
"no_of_shares" : 200,
|
||||
"rate" : 15,
|
||||
"company" : "_Test Company",
|
||||
"equity_or_liability_account": "Creditors - _TC"
|
||||
},
|
||||
{
|
||||
"doctype" : "Share Transfer",
|
||||
"transfer_type" : "Purchase",
|
||||
"date" : "2018-01-05",
|
||||
"from_shareholder" : "SH-00003",
|
||||
"share_type" : "Equity",
|
||||
"from_no" : 401,
|
||||
"to_no" : 500,
|
||||
"no_of_shares" : 100,
|
||||
"rate" : 25,
|
||||
"company" : "_Test Company"
|
||||
"doctype" : "Share Transfer",
|
||||
"transfer_type" : "Purchase",
|
||||
"date" : "2018-01-05",
|
||||
"from_shareholder" : "SH-00003",
|
||||
"share_type" : "Equity",
|
||||
"from_no" : 401,
|
||||
"to_no" : 500,
|
||||
"no_of_shares" : 100,
|
||||
"rate" : 25,
|
||||
"company" : "_Test Company",
|
||||
"asset_account" : "Cash - _TC",
|
||||
"equity_or_liability_account": "Creditors - _TC"
|
||||
}
|
||||
]
|
||||
for d in share_transfers:
|
||||
@@ -84,30 +91,33 @@ class TestShareTransfer(unittest.TestCase):
|
||||
|
||||
def test_invalid_share_transfer(self):
|
||||
doc = frappe.get_doc({
|
||||
"doctype" : "Share Transfer",
|
||||
"transfer_type" : "Transfer",
|
||||
"date" : "2018-01-05",
|
||||
"from_shareholder" : "SH-00003",
|
||||
"to_shareholder" : "SH-00002",
|
||||
"share_type" : "Equity",
|
||||
"from_no" : 1,
|
||||
"to_no" : 100,
|
||||
"no_of_shares" : 100,
|
||||
"rate" : 15,
|
||||
"company" : "_Test Company"
|
||||
"doctype" : "Share Transfer",
|
||||
"transfer_type" : "Transfer",
|
||||
"date" : "2018-01-05",
|
||||
"from_shareholder" : "SH-00003",
|
||||
"to_shareholder" : "SH-00002",
|
||||
"share_type" : "Equity",
|
||||
"from_no" : 1,
|
||||
"to_no" : 100,
|
||||
"no_of_shares" : 100,
|
||||
"rate" : 15,
|
||||
"company" : "_Test Company",
|
||||
"equity_or_liability_account": "Creditors - _TC"
|
||||
})
|
||||
self.assertRaises(ShareDontExists, doc.insert)
|
||||
|
||||
doc = frappe.get_doc({
|
||||
"doctype" : "Share Transfer",
|
||||
"transfer_type" : "Purchase",
|
||||
"date" : "2018-01-02",
|
||||
"from_shareholder" : "SH-00001",
|
||||
"share_type" : "Equity",
|
||||
"from_no" : 1,
|
||||
"to_no" : 200,
|
||||
"no_of_shares" : 200,
|
||||
"rate" : 15,
|
||||
"company" : "_Test Company"
|
||||
"doctype" : "Share Transfer",
|
||||
"transfer_type" : "Purchase",
|
||||
"date" : "2018-01-02",
|
||||
"from_shareholder" : "SH-00001",
|
||||
"share_type" : "Equity",
|
||||
"from_no" : 1,
|
||||
"to_no" : 200,
|
||||
"no_of_shares" : 200,
|
||||
"rate" : 15,
|
||||
"company" : "_Test Company",
|
||||
"asset_account" : "Cash - _TC",
|
||||
"equity_or_liability_account": "Creditors - _TC"
|
||||
})
|
||||
self.assertRaises(ShareDontExists, doc.insert)
|
||||
|
||||
@@ -14,13 +14,13 @@ class TestShippingRule(unittest.TestCase):
|
||||
shipping_rule.name = test_records[0].get('name')
|
||||
shipping_rule.get("conditions")[0].from_value = 101
|
||||
self.assertRaises(FromGreaterThanToError, shipping_rule.insert)
|
||||
|
||||
|
||||
def test_many_zero_to_values(self):
|
||||
shipping_rule = frappe.copy_doc(test_records[0])
|
||||
shipping_rule.name = test_records[0].get('name')
|
||||
shipping_rule.get("conditions")[0].to_value = 0
|
||||
self.assertRaises(ManyBlankToValuesError, shipping_rule.insert)
|
||||
|
||||
|
||||
def test_overlapping_conditions(self):
|
||||
for range_a, range_b in [
|
||||
((50, 150), (0, 100)),
|
||||
@@ -38,6 +38,10 @@ class TestShippingRule(unittest.TestCase):
|
||||
self.assertRaises(OverlappingConditionError, shipping_rule.insert)
|
||||
|
||||
def create_shipping_rule(shipping_rule_type, shipping_rule_name):
|
||||
|
||||
if frappe.db.exists("Shipping Rule", shipping_rule_name):
|
||||
return frappe.get_doc("Shipping Rule", shipping_rule_name)
|
||||
|
||||
sr = frappe.new_doc("Shipping Rule")
|
||||
sr.account = "_Test Account Shipping Charges - _TC"
|
||||
sr.calculate_based_on = "Net Total"
|
||||
@@ -70,4 +74,4 @@ def create_shipping_rule(shipping_rule_type, shipping_rule_name):
|
||||
})
|
||||
sr.insert(ignore_permissions=True)
|
||||
sr.submit()
|
||||
return sr
|
||||
return sr
|
||||
|
||||
@@ -48,7 +48,6 @@ class TestTaxWithholdingCategory(unittest.TestCase):
|
||||
#delete invoices to avoid clashing
|
||||
for d in invoices:
|
||||
d.cancel()
|
||||
frappe.delete_doc("Purchase Invoice", d.name)
|
||||
|
||||
def test_single_threshold_tds(self):
|
||||
invoices = []
|
||||
@@ -83,7 +82,6 @@ class TestTaxWithholdingCategory(unittest.TestCase):
|
||||
# delete invoices to avoid clashing
|
||||
for d in invoices:
|
||||
d.cancel()
|
||||
frappe.delete_doc("Purchase Invoice", d.name)
|
||||
|
||||
def test_single_threshold_tds_with_previous_vouchers(self):
|
||||
invoices = []
|
||||
@@ -102,7 +100,6 @@ class TestTaxWithholdingCategory(unittest.TestCase):
|
||||
# delete invoices to avoid clashing
|
||||
for d in invoices:
|
||||
d.cancel()
|
||||
frappe.delete_doc("Purchase Invoice", d.name)
|
||||
|
||||
def create_purchase_invoice(**args):
|
||||
# return sales invoice doc object
|
||||
|
||||
@@ -3,8 +3,9 @@
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe, erpnext
|
||||
from frappe.utils import flt, cstr, cint
|
||||
from frappe.utils import flt, cstr, cint, comma_and
|
||||
from frappe import _
|
||||
from erpnext.accounts.utils import get_stock_and_account_balance
|
||||
from frappe.model.meta import get_field_precision
|
||||
from erpnext.accounts.doctype.budget.budget import validate_expense_against_budget
|
||||
from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import get_accounting_dimensions
|
||||
@@ -12,6 +13,7 @@ from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import g
|
||||
|
||||
class ClosedAccountingPeriod(frappe.ValidationError): pass
|
||||
class StockAccountInvalidTransaction(frappe.ValidationError): pass
|
||||
class StockValueAndAccountBalanceOutOfSync(frappe.ValidationError): pass
|
||||
|
||||
def make_gl_entries(gl_map, cancel=False, adv_adj=False, merge_entries=True, update_outstanding='Yes', from_repost=False):
|
||||
if gl_map:
|
||||
@@ -115,11 +117,9 @@ def check_if_in_list(gle, gl_map, dimensions=None):
|
||||
|
||||
def save_entries(gl_map, adv_adj, update_outstanding, from_repost=False):
|
||||
if not from_repost:
|
||||
validate_account_for_perpetual_inventory(gl_map)
|
||||
validate_cwip_accounts(gl_map)
|
||||
|
||||
round_off_debit_credit(gl_map)
|
||||
|
||||
for entry in gl_map:
|
||||
make_entry(entry, adv_adj, update_outstanding, from_repost)
|
||||
|
||||
@@ -127,6 +127,10 @@ def save_entries(gl_map, adv_adj, update_outstanding, from_repost=False):
|
||||
if not from_repost:
|
||||
validate_expense_against_budget(entry)
|
||||
|
||||
if not from_repost:
|
||||
validate_account_for_perpetual_inventory(gl_map)
|
||||
|
||||
|
||||
def make_entry(args, adv_adj, update_outstanding, from_repost=False):
|
||||
args.update({"doctype": "GL Entry"})
|
||||
gle = frappe.get_doc(args)
|
||||
@@ -137,25 +141,67 @@ def make_entry(args, adv_adj, update_outstanding, from_repost=False):
|
||||
gle.submit()
|
||||
|
||||
def validate_account_for_perpetual_inventory(gl_map):
|
||||
if cint(erpnext.is_perpetual_inventory_enabled(gl_map[0].company)) \
|
||||
and gl_map[0].voucher_type=="Journal Entry":
|
||||
aii_accounts = [d[0] for d in frappe.db.sql("""select name from tabAccount
|
||||
where account_type = 'Stock' and is_group=0""")]
|
||||
if cint(erpnext.is_perpetual_inventory_enabled(gl_map[0].company)):
|
||||
account_list = [gl_entries.account for gl_entries in gl_map]
|
||||
|
||||
for entry in gl_map:
|
||||
if entry.account in aii_accounts:
|
||||
aii_accounts = [d.name for d in frappe.get_all("Account",
|
||||
filters={'account_type': 'Stock', 'is_group': 0, 'company': gl_map[0].company})]
|
||||
|
||||
for account in account_list:
|
||||
if account not in aii_accounts:
|
||||
continue
|
||||
|
||||
account_bal, stock_bal, warehouse_list = get_stock_and_account_balance(account,
|
||||
gl_map[0].posting_date, gl_map[0].company)
|
||||
|
||||
if gl_map[0].voucher_type=="Journal Entry":
|
||||
# In case of Journal Entry, there are no corresponding SL entries,
|
||||
# hence deducting currency amount
|
||||
account_bal -= flt(gl_map[0].debit) - flt(gl_map[0].credit)
|
||||
if account_bal == stock_bal:
|
||||
frappe.throw(_("Account: {0} can only be updated via Stock Transactions")
|
||||
.format(entry.account), StockAccountInvalidTransaction)
|
||||
.format(account), StockAccountInvalidTransaction)
|
||||
|
||||
# This has been comment for a temporary, will add this code again on release of immutable ledger
|
||||
# elif account_bal != stock_bal:
|
||||
# precision = get_field_precision(frappe.get_meta("GL Entry").get_field("debit"),
|
||||
# currency=frappe.get_cached_value('Company', gl_map[0].company, "default_currency"))
|
||||
|
||||
# diff = flt(stock_bal - account_bal, precision)
|
||||
# error_reason = _("Stock Value ({0}) and Account Balance ({1}) are out of sync for account {2} and it's linked warehouses.").format(
|
||||
# stock_bal, account_bal, frappe.bold(account))
|
||||
# error_resolution = _("Please create adjustment Journal Entry for amount {0} ").format(frappe.bold(diff))
|
||||
# stock_adjustment_account = frappe.db.get_value("Company",gl_map[0].company,"stock_adjustment_account")
|
||||
|
||||
# db_or_cr_warehouse_account =('credit_in_account_currency' if diff < 0 else 'debit_in_account_currency')
|
||||
# db_or_cr_stock_adjustment_account = ('debit_in_account_currency' if diff < 0 else 'credit_in_account_currency')
|
||||
|
||||
# journal_entry_args = {
|
||||
# 'accounts':[
|
||||
# {'account': account, db_or_cr_warehouse_account : abs(diff)},
|
||||
# {'account': stock_adjustment_account, db_or_cr_stock_adjustment_account : abs(diff) }]
|
||||
# }
|
||||
|
||||
# frappe.msgprint(msg="""{0}<br></br>{1}<br></br>""".format(error_reason, error_resolution),
|
||||
# raise_exception=StockValueAndAccountBalanceOutOfSync,
|
||||
# title=_('Values Out Of Sync'),
|
||||
# primary_action={
|
||||
# 'label': _('Make Journal Entry'),
|
||||
# 'client_action': 'erpnext.route_to_adjustment_jv',
|
||||
# 'args': journal_entry_args
|
||||
# })
|
||||
|
||||
def validate_cwip_accounts(gl_map):
|
||||
if not cint(frappe.db.get_value("Asset Settings", None, "disable_cwip_accounting")) \
|
||||
and gl_map[0].voucher_type == "Journal Entry":
|
||||
cwip_enabled = any([cint(ac.enable_cwip_accounting) for ac in frappe.db.get_all("Asset Category","enable_cwip_accounting")])
|
||||
|
||||
if cwip_enabled and gl_map[0].voucher_type == "Journal Entry":
|
||||
cwip_accounts = [d[0] for d in frappe.db.sql("""select name from tabAccount
|
||||
where account_type = 'Capital Work in Progress' and is_group=0""")]
|
||||
|
||||
for entry in gl_map:
|
||||
if entry.account in cwip_accounts:
|
||||
frappe.throw(_("Account: <b>{0}</b> is capital Work in progress and can not be updated by Journal Entry").format(entry.account))
|
||||
frappe.throw(
|
||||
_("Account: <b>{0}</b> is capital Work in progress and can not be updated by Journal Entry").format(entry.account))
|
||||
|
||||
def round_off_debit_credit(gl_map):
|
||||
precision = get_field_precision(frappe.get_meta("GL Entry").get_field("debit"),
|
||||
|
||||
@@ -139,15 +139,11 @@ erpnext.accounts.bankTransactionUpload = class bankTransactionUpload {
|
||||
}
|
||||
|
||||
make() {
|
||||
const me = this;
|
||||
frappe.upload.make({
|
||||
args: {
|
||||
method: 'erpnext.accounts.doctype.bank_transaction.bank_transaction_upload.upload_bank_statement',
|
||||
allow_multiple: 0
|
||||
},
|
||||
no_socketio: true,
|
||||
sample_url: "e.g. http://example.com/somefile.csv",
|
||||
callback: function(attachment, r) {
|
||||
const me = this;
|
||||
new frappe.ui.FileUploader({
|
||||
method: 'erpnext.accounts.doctype.bank_transaction.bank_transaction_upload.upload_bank_statement',
|
||||
allow_multiple: 0,
|
||||
on_success: function(attachment, r) {
|
||||
if (!r.exc && r.message) {
|
||||
me.data = r.message;
|
||||
me.setup_transactions_dom();
|
||||
@@ -533,9 +529,16 @@ erpnext.accounts.ReconciliationRow = class ReconciliationRow {
|
||||
frappe.db.get_doc(dt, event.value)
|
||||
.then(doc => {
|
||||
let displayed_docs = []
|
||||
let payment = []
|
||||
if (dt === "Payment Entry") {
|
||||
payment.currency = doc.payment_type == "Receive" ? doc.paid_to_account_currency : doc.paid_from_account_currency;
|
||||
payment.doctype = dt
|
||||
payment.posting_date = doc.posting_date;
|
||||
payment.party = doc.party;
|
||||
payment.reference_no = doc.reference_no;
|
||||
payment.reference_date = doc.reference_date;
|
||||
payment.paid_amount = doc.paid_amount;
|
||||
payment.name = doc.name;
|
||||
displayed_docs.push(payment);
|
||||
} else if (dt === "Journal Entry") {
|
||||
doc.accounts.forEach(payment => {
|
||||
@@ -568,11 +571,11 @@ erpnext.accounts.ReconciliationRow = class ReconciliationRow {
|
||||
|
||||
const details_wrapper = me.dialog.fields_dict.payment_details.$wrapper;
|
||||
details_wrapper.append(frappe.render_template("linked_payment_header"));
|
||||
displayed_docs.forEach(values => {
|
||||
details_wrapper.append(frappe.render_template("linked_payment_row", values));
|
||||
displayed_docs.forEach(payment => {
|
||||
details_wrapper.append(frappe.render_template("linked_payment_row", payment));
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -816,8 +816,8 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
||||
contact = me.contacts[data.name];
|
||||
if(reg.test(data.name.toLowerCase())
|
||||
|| reg.test(data.customer_name.toLowerCase())
|
||||
|| (contact && reg.test(contact["mobile_no"]))
|
||||
|| (contact && reg.test(contact["phone"]))
|
||||
|| (contact && reg.test(contact["mobile_no"]))
|
||||
|| (data.customer_group && reg.test(data.customer_group.toLowerCase()))){
|
||||
return data;
|
||||
}
|
||||
@@ -1121,7 +1121,8 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
||||
if (key) {
|
||||
return $.grep(this.items_list, function (item) {
|
||||
if (search_status) {
|
||||
if (in_list(me.batch_no_data[item.item_code], me.search_item.$input.val())) {
|
||||
if (me.batch_no_data[item.item_code] &&
|
||||
in_list(me.batch_no_data[item.item_code], me.search_item.$input.val())) {
|
||||
search_status = false;
|
||||
return me.item_batch_no[item.item_code] = me.search_item.$input.val()
|
||||
} else if (me.serial_no_data[item.item_code]
|
||||
@@ -1129,7 +1130,8 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
||||
search_status = false;
|
||||
me.item_serial_no[item.item_code] = [me.search_item.$input.val(), me.serial_no_data[item.item_code][me.search_item.$input.val()]]
|
||||
return true
|
||||
} else if (in_list(me.barcode_data[item.item_code], me.search_item.$input.val())) {
|
||||
} else if (me.barcode_data[item.item_code] &&
|
||||
in_list(me.barcode_data[item.item_code], me.search_item.$input.val())) {
|
||||
search_status = false;
|
||||
return true;
|
||||
} else if (reg.test(item.item_code.toLowerCase()) || (item.description && reg.test(item.description.toLowerCase())) ||
|
||||
@@ -1625,7 +1627,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
||||
setTimeout(function () {
|
||||
w.print();
|
||||
w.close();
|
||||
}, 1000)
|
||||
}, 1000);
|
||||
},
|
||||
|
||||
submit_invoice: function () {
|
||||
@@ -1682,6 +1684,12 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
||||
$(this.wrapper).find('.pos-bill').css('pointer-events', pointer_events);
|
||||
$(this.wrapper).find('.pos-items-section').css('pointer-events', pointer_events);
|
||||
this.set_primary_action();
|
||||
|
||||
$(this.wrapper).find('#pos-item-disc').prop('disabled',
|
||||
this.pos_profile_data.allow_user_to_edit_discount ? false : true);
|
||||
|
||||
$(this.wrapper).find('#pos-item-price').prop('disabled',
|
||||
this.pos_profile_data.allow_user_to_edit_rate ? false : true);
|
||||
},
|
||||
|
||||
create_invoice: function () {
|
||||
@@ -1692,20 +1700,13 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
||||
|
||||
if(this.si_docs) {
|
||||
this.si_docs.forEach((row) => {
|
||||
existing_pos_list.push(Object.keys(row));
|
||||
existing_pos_list.push(Object.keys(row)[0]);
|
||||
});
|
||||
}
|
||||
|
||||
if (this.frm.doc.offline_pos_name
|
||||
&& in_list(existing_pos_list, this.frm.doc.offline_pos_name)) {
|
||||
&& in_list(existing_pos_list, cstr(this.frm.doc.offline_pos_name))) {
|
||||
this.update_invoice()
|
||||
//to retrieve and set the default payment
|
||||
invoice_data[this.frm.doc.offline_pos_name] = this.frm.doc;
|
||||
invoice_data[this.frm.doc.offline_pos_name].payments[0].amount = this.frm.doc.net_total
|
||||
invoice_data[this.frm.doc.offline_pos_name].payments[0].base_amount = this.frm.doc.net_total
|
||||
|
||||
this.frm.doc.paid_amount = this.frm.doc.net_total
|
||||
this.frm.doc.outstanding_amount = 0
|
||||
} else if(!this.frm.doc.offline_pos_name) {
|
||||
this.frm.doc.offline_pos_name = frappe.datetime.now_datetime();
|
||||
this.frm.doc.posting_date = frappe.datetime.get_today();
|
||||
@@ -1762,18 +1763,11 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
||||
this.si_docs = this.get_submitted_invoice() || [];
|
||||
this.email_queue_list = this.get_email_queue() || {};
|
||||
this.customers_list = this.get_customers_details() || {};
|
||||
if(this.customer_doc) {
|
||||
this.freeze = this.customer_doc.display
|
||||
}
|
||||
|
||||
freeze_screen = this.freeze_screen || false;
|
||||
|
||||
if ((this.si_docs.length || this.email_queue_list || this.customers_list) && !this.freeze) {
|
||||
this.freeze = true;
|
||||
|
||||
if (this.si_docs.length || this.email_queue_list || this.customers_list) {
|
||||
frappe.call({
|
||||
method: "erpnext.accounts.doctype.sales_invoice.pos.make_invoice",
|
||||
freeze: freeze_screen,
|
||||
freeze: true,
|
||||
args: {
|
||||
doc_list: me.si_docs,
|
||||
email_queue_list: me.email_queue_list,
|
||||
@@ -1906,7 +1900,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
||||
serial_no = me.item_serial_no[key][0];
|
||||
}
|
||||
|
||||
if (this.items[0].has_serial_no && serial_no == "") {
|
||||
if (this.items && this.items[0].has_serial_no && serial_no == "") {
|
||||
this.refresh();
|
||||
frappe.throw(__(repl("Error: Serial no is mandatory for item %(item)s", {
|
||||
'item': this.items[0].item_code
|
||||
|
||||
@@ -292,8 +292,11 @@ def validate_party_accounts(doc):
|
||||
|
||||
party_account_currency = frappe.db.get_value("Account", account.account, "account_currency", cache=True)
|
||||
existing_gle_currency = get_party_gle_currency(doc.doctype, doc.name, account.company)
|
||||
company_default_currency = frappe.get_cached_value('Company',
|
||||
frappe.db.get_default("Company"), "default_currency")
|
||||
if frappe.db.get_default("Company"):
|
||||
company_default_currency = frappe.get_cached_value('Company',
|
||||
frappe.db.get_default("Company"), "default_currency")
|
||||
else:
|
||||
company_default_currency = frappe.db.get_value('Company', account.company, "default_currency")
|
||||
|
||||
if existing_gle_currency and party_account_currency != existing_gle_currency:
|
||||
frappe.throw(_("Accounting entries have already been made in currency {0} for company {1}. Please select a receivable or payable account with currency {0}.").format(existing_gle_currency, account.company))
|
||||
@@ -365,7 +368,7 @@ def validate_due_date(posting_date, due_date, party_type, party, company=None, b
|
||||
.format(formatdate(default_due_date)))
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_address_tax_category(tax_category, billing_address=None, shipping_address=None):
|
||||
def get_address_tax_category(tax_category=None, billing_address=None, shipping_address=None):
|
||||
addr_tax_category_from = frappe.db.get_single_value("Accounts Settings", "determine_address_tax_category_from")
|
||||
if addr_tax_category_from == "Shipping Address":
|
||||
if shipping_address:
|
||||
@@ -469,7 +472,9 @@ def get_timeline_data(doctype, name):
|
||||
# fetch and append data from Activity Log
|
||||
data += frappe.db.sql("""select {fields}
|
||||
from `tabActivity Log`
|
||||
where reference_doctype={doctype} and reference_name={name}
|
||||
where (reference_doctype="{doctype}" and reference_name="{name}")
|
||||
or (timeline_doctype in ("{doctype}") and timeline_name="{name}")
|
||||
or (reference_doctype in ("Quotation", "Opportunity") and timeline_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,
|
||||
@@ -605,4 +610,4 @@ def get_partywise_advanced_payment_amount(party_type, posting_date = None):
|
||||
.format(("credit") if party_type == "Customer" else "debit", cond) , party_type)
|
||||
|
||||
if data:
|
||||
return frappe._dict(data)
|
||||
return frappe._dict(data)
|
||||
|
||||
@@ -1,22 +1,23 @@
|
||||
{
|
||||
"align_labels_right": 0,
|
||||
"creation": "2016-05-05 17:16:18.564460",
|
||||
"custom_format": 1,
|
||||
"disabled": 0,
|
||||
"doc_type": "Sales Invoice",
|
||||
"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{{ company }}<br>\n\t{{ __(\"POS No : \") }} {{ offline_pos_name }}<br>\n</p>\n<p>\n\t<b>{{ __(\"Customer\") }}:</b> {{ customer }}<br>\n</p>\n\n<p>\n\t<b>{{ __(\"Date\") }}:</b> {{ dateutil.global_date_format(posting_date) }}<br>\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 items %}\n\t\t<tr>\n\t\t\t<td>\n\t\t\t\t{{ item.item_name }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">{{ format_number(item.qty, null,precision(\"difference\")) }}<br>@ {{ format_currency(item.rate, currency) }}</td>\n\t\t\t<td class=\"text-right\">{{ format_currency(item.amount, currency) }}</td>\n\t\t</tr>\n\t\t{% endfor %}\n\t</tbody>\n</table>\n\n<table class=\"table table-condensed no-border\">\n\t<tbody>\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t{{ __(\"Net Total\") }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ format_currency(total, currency) }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{% for row in taxes %}\n\t\t{% if not row.included_in_print_rate %}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t{{ row.description }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ format_currency(row.tax_amount, currency) }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{% endif %}\n\t\t{% endfor %}\n\t\t{% if 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{{ format_currency(discount_amount, currency) }}\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{{ format_currency(grand_total, currency) }}\n\t\t\t</td>\n\t\t</tr>\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{{ format_currency(paid_amount, currency) }}\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t<b>{{ __(\"Qty Total\") }}</b>\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ qty_total }}\n\t\t\t</td>\n\t\t</tr>\n\t</tbody>\n</table>\n\n\n<hr>\n<p>{{ terms }}</p>\n<p class=\"text-center\">{{ __(\"Thank you, please visit again.\") }}</p>",
|
||||
"idx": 0,
|
||||
"line_breaks": 0,
|
||||
"modified": "2018-03-21 09:10:16.693732",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Point of Sale",
|
||||
"owner": "Administrator",
|
||||
"print_format_builder": 0,
|
||||
"print_format_type": "Js",
|
||||
"show_section_headings": 0,
|
||||
"align_labels_right": 0,
|
||||
"creation": "2016-05-05 17:16:18.564460",
|
||||
"custom_format": 1,
|
||||
"disabled": 0,
|
||||
"doc_type": "Sales Invoice",
|
||||
"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{{ company }}<br>\n\t{{ __(\"POS No : \") }} {{ offline_pos_name }}<br>\n</p>\n<p>\n\t<b>{{ __(\"Customer\") }}:</b> {{ customer }}<br>\n</p>\n\n<p>\n\t<b>{{ __(\"Date\") }}:</b> {{ dateutil.global_date_format(posting_date) }}<br>\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 items %}\n\t\t<tr>\n\t\t\t<td>\n\t\t\t\t{{ item.item_name }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">{{ format_number(item.qty, null,precision(\"difference\")) }}<br>@ {{ format_currency(item.rate, currency) }}</td>\n\t\t\t<td class=\"text-right\">{{ format_currency(item.amount, currency) }}</td>\n\t\t</tr>\n\t\t{% endfor %}\n\t</tbody>\n</table>\n\n<table class=\"table table-condensed no-border\">\n\t<tbody>\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t{{ __(\"Net Total\") }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ format_currency(total, currency) }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{% for row in taxes %}\n\t\t{% if not row.included_in_print_rate %}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t{{ row.description }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ format_currency(row.tax_amount, currency) }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{% endif %}\n\t\t{% endfor %}\n\t\t{% if 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{{ format_currency(discount_amount, currency) }}\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{{ format_currency(grand_total, currency) }}\n\t\t\t</td>\n\t\t</tr>\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{{ format_currency(paid_amount, currency) }}\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t<b>{{ __(\"Qty Total\") }}</b>\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ qty_total }}\n\t\t\t</td>\n\t\t</tr>\n\t</tbody>\n</table>\n\n\n<hr>\n<p>{{ terms }}</p>\n<p class=\"text-center\">{{ __(\"Thank you, please visit again.\") }}</p>",
|
||||
"idx": 0,
|
||||
"line_breaks": 0,
|
||||
"modified": "2019-09-05 17:20:30.726659",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Point of Sale",
|
||||
"owner": "Administrator",
|
||||
"print_format_builder": 0,
|
||||
"print_format_type": "JS",
|
||||
"raw_printing": 0,
|
||||
"show_section_headings": 0,
|
||||
"standard": "Yes"
|
||||
}
|
||||
@@ -9,7 +9,7 @@
|
||||
</div>
|
||||
<div class="col-xs-{{ "3" if df.fieldtype=="Check" else "7" }} value">
|
||||
{% if doc.get(df.fieldname) != None -%}
|
||||
{{ frappe.utils.fmt_money((doc[df.fieldname])|int|abs, currency=doc.currency) }}
|
||||
{{ frappe.utils.fmt_money((doc[df.fieldname])|abs, currency=doc.currency) }}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
@@ -26,7 +26,7 @@
|
||||
<div class="col-xs-5 {%- if doc.align_labels_right %} text-right{%- endif -%}">
|
||||
<label>{{ charge.get_formatted("description") }}</label></div>
|
||||
<div class="col-xs-7 text-right">
|
||||
{{ frappe.utils.fmt_money((charge.tax_amount)|int|abs, currency=doc.currency) }}
|
||||
{{ frappe.utils.fmt_money((charge.tax_amount)|abs, currency=doc.currency) }}
|
||||
</div>
|
||||
</div>
|
||||
{%- endif -%}
|
||||
@@ -65,8 +65,10 @@
|
||||
{% for tdf in visible_columns %}
|
||||
{% if not d.flags.compact_item_print or tdf.fieldname in doc.get(df.fieldname)[0].flags.compact_item_fields %}
|
||||
<td class="{{ get_align_class(tdf) }}" {{ fieldmeta(df) }}>
|
||||
{% if tdf.fieldtype == 'Currency' %}
|
||||
<div class="value">{{ frappe.utils.fmt_money((d[tdf.fieldname])|int|abs, currency=doc.currency) }}</div></td>
|
||||
{% if tdf.fieldname == 'qty' %}
|
||||
<div class="value">{{ (d[tdf.fieldname])|abs }}</div></td>
|
||||
{% elif tdf.fieldtype == 'Currency' %}
|
||||
<div class="value">{{ frappe.utils.fmt_money((d[tdf.fieldname])|abs, currency=doc.currency) }}</div></td>
|
||||
{% else %}
|
||||
<div class="value">{{ print_value(tdf, d, doc, visible_columns) }}</div></td>
|
||||
{% endif %}
|
||||
@@ -117,7 +119,7 @@
|
||||
{{ render_currency(df, doc) }}
|
||||
{% elif df.fieldtype =='Table' %}
|
||||
{{ render_table(df, doc)}}
|
||||
{% elif doc[df.fieldname] %}
|
||||
{% elif doc[df.fieldname] and df.fieldname != 'total_qty' %}
|
||||
{{ render_field(df, doc) }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
@@ -1,275 +1,269 @@
|
||||
<style>
|
||||
.print-format {
|
||||
padding: 4mm;
|
||||
font-size: 8.0pt !important;
|
||||
}
|
||||
.print-format td {
|
||||
vertical-align:middle !important;
|
||||
}
|
||||
</style>
|
||||
.print-format {
|
||||
padding: 4mm;
|
||||
font-size: 8.0pt !important;
|
||||
}
|
||||
.print-format td {
|
||||
vertical-align:middle !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<h2 class="text-center" style="margin-top:0">{%= __(report.report_name) %}</h2>
|
||||
<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 %}
|
||||
<h2 class="text-center" style="margin-top:0">{%= __(report.report_name) %}</h2>
|
||||
<h4 class="text-center">
|
||||
{% if (filters.customer_name) { %}
|
||||
{%= filters.customer_name %}
|
||||
{% } else { %}
|
||||
{%= filters.customer || filters.supplier %}
|
||||
{% } %}
|
||||
</h6>
|
||||
<h5 class="text-center">
|
||||
{%= __(filters.ageing_based_on) %}
|
||||
{%= __("Until") %}
|
||||
{%= frappe.datetime.str_to_user(filters.report_date) %}
|
||||
</h5>
|
||||
</h4>
|
||||
<h6 class="text-center">
|
||||
{% if (filters.tax_id) { %}
|
||||
{%= __("Tax Id: ")%} {%= filters.tax_id %}
|
||||
{% } %}
|
||||
</h6>
|
||||
<h5 class="text-center">
|
||||
{%= __(filters.ageing_based_on) %}
|
||||
{%= __("Until") %}
|
||||
{%= frappe.datetime.str_to_user(filters.report_date) %}
|
||||
</h5>
|
||||
|
||||
<div class="clearfix">
|
||||
<div class="pull-left">
|
||||
{% if(filters.payment_terms) { %}
|
||||
<strong>{%= __("Payment Terms") %}:</strong> {%= filters.payment_terms %}
|
||||
{% } %}
|
||||
<div class="clearfix">
|
||||
<div class="pull-left">
|
||||
{% if(filters.payment_terms) { %}
|
||||
<strong>{%= __("Payment Terms") %}:</strong> {%= filters.payment_terms %}
|
||||
{% } %}
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
{% if(filters.credit_limit) { %}
|
||||
<strong>{%= __("Credit Limit") %}:</strong> {%= format_currency(filters.credit_limit) %}
|
||||
{% } %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
{% if(filters.credit_limit) { %}
|
||||
<strong>{%= __("Credit Limit") %}:</strong> {%= format_currency(filters.credit_limit) %}
|
||||
|
||||
{% if(filters.show_future_payments) { %}
|
||||
{% 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;
|
||||
var range5 = report.columns[15].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;">
|
||||
<col style="width: 18mm;">
|
||||
</colgroup>
|
||||
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{%= __(" ") %}</th>
|
||||
<th>{%= __(range1) %}</th>
|
||||
<th>{%= __(range2) %}</th>
|
||||
<th>{%= __(range3) %}</th>
|
||||
<th>{%= __(range4) %}</th>
|
||||
<th>{%= __(range5) %}</th>
|
||||
<th>{%= __("Total") %}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>{%= __("Total Outstanding") %}</td>
|
||||
<td class="text-right">{%= format_number(balance_row["range1"], null, 2) %}</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(balance_row["range5"]) %}</td>
|
||||
<td class="text-right">
|
||||
{%= format_currency(flt(balance_row["outstanding"]), data[data.length-1]["currency"]) %}
|
||||
</td>
|
||||
</tr>
|
||||
<td>{%= __("Future Payments") %}</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td class="text-right">
|
||||
{%= format_currency(flt(balance_row[("future_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></th>
|
||||
<th class="text-right">
|
||||
{%= format_currency(flt(balance_row["outstanding"] - balance_row[("future_amount")]), data[data.length-1]["currency"]) %}</th>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
{% } %}
|
||||
{% } %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% 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;
|
||||
var range5 = report.columns[15].label;
|
||||
var range6 = report.columns[16].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;">
|
||||
<col style="width: 18mm;">
|
||||
<col style="width: 18mm;">
|
||||
</colgroup>
|
||||
|
||||
<table class="table table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{%= __(" ") %}</th>
|
||||
<th>{%= __(range1) %}</th>
|
||||
<th>{%= __(range2) %}</th>
|
||||
<th>{%= __(range3) %}</th>
|
||||
<th>{%= __(range4) %}</th>
|
||||
<th>{%= __(range5) %}</th>
|
||||
<th>{%= __(range6) %}</th>
|
||||
<th>{%= __("Total") %}</th>
|
||||
{% if(report.report_name === "Accounts Receivable" || report.report_name === "Accounts Payable") { %}
|
||||
<th style="width: 10%">{%= __("Date") %}</th>
|
||||
<th style="width: 4%">{%= __("Age (Days)") %}</th>
|
||||
|
||||
{% if(report.report_name === "Accounts Receivable" && filters.show_sales_person) { %}
|
||||
<th style="width: 14%">{%= __("Reference") %}</th>
|
||||
<th style="width: 10%">{%= __("Sales Person") %}</th>
|
||||
{% } else { %}
|
||||
<th style="width: 24%">{%= __("Reference") %}</th>
|
||||
{% } %}
|
||||
{% if(!filters.show_future_payments) { %}
|
||||
<th style="width: 20%">{%= (filters.customer || filters.supplier) ? __("Remarks"): __("Party") %}</th>
|
||||
{% } %}
|
||||
<th style="width: 10%; text-align: right">{%= __("Invoiced Amount") %}</th>
|
||||
{% if(!filters.show_future_payments) { %}
|
||||
<th style="width: 10%; text-align: right">{%= __("Paid Amount") %}</th>
|
||||
<th style="width: 10%; text-align: right">{%= report.report_name === "Accounts Receivable" ? __('Credit Note') : __('Debit Note') %}</th>
|
||||
{% } %}
|
||||
<th style="width: 10%; text-align: right">{%= __("Outstanding Amount") %}</th>
|
||||
{% if(filters.show_future_payments) { %}
|
||||
{% if(report.report_name === "Accounts Receivable") { %}
|
||||
<th style="width: 12%">{%= __("Customer LPO No.") %}</th>
|
||||
{% } %}
|
||||
<th style="width: 10%">{%= __("Future Payment Ref") %}</th>
|
||||
<th style="width: 10%">{%= __("Future Payment 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>
|
||||
<th style="width: 15%">{%= __("Total Paid Amount") %}</th>
|
||||
<th style="width: 15%">{%= report.report_name === "Accounts Receivable Summary" ? __('Credit Note Amount') : __('Debit Note Amount') %}</th>
|
||||
<th style="width: 15%">{%= __("Total Outstanding Amount") %}</th>
|
||||
{% } %}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>{%= __("Total Outstanding") %}</td>
|
||||
<td class="text-right">{%= format_number(balance_row[range1], null, 2) %}</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(balance_row[range5]) %}</td>
|
||||
<td class="text-right">{%= format_currency(balance_row[range6]) %}</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></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></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: 10%">{%= __("Date") %}</th>
|
||||
<th style="width: 4%">{%= __("Age (Days)") %}</th>
|
||||
|
||||
{% if(report.report_name === "Accounts Receivable" && filters.show_sales_person_in_print) { %}
|
||||
<th style="width: 14%">{%= __("Reference") %}</th>
|
||||
<th style="width: 10%">{%= __("Sales Person") %}</th>
|
||||
{% } else { %}
|
||||
<th style="width: 24%">{%= __("Reference") %}</th>
|
||||
{% } %}
|
||||
{% if(!filters.show_pdc_in_print) { %}
|
||||
<th style="width: 20%">{%= (filters.customer || filters.supplier) ? __("Remarks"): __("Party") %}</th>
|
||||
{% } %}
|
||||
<th style="width: 10%; text-align: right">{%= __("Invoiced Amount") %}</th>
|
||||
{% if(!filters.show_pdc_in_print) { %}
|
||||
<th style="width: 10%; text-align: right">{%= __("Paid Amount") %}</th>
|
||||
<th style="width: 10%; text-align: right">{%= report.report_name === "Accounts Receivable" ? __('Credit Note') : __('Debit Note') %}</th>
|
||||
{% } %}
|
||||
<th style="width: 10%; text-align: right">{%= __("Outstanding Amount") %}</th>
|
||||
{% if(filters.show_pdc_in_print) { %}
|
||||
{% if(report.report_name === "Accounts Receivable") { %}
|
||||
<th style="width: 12%">{%= __("Customer LPO No.") %}</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>
|
||||
<th style="width: 15%">{%= __("Total Paid Amount") %}</th>
|
||||
<th style="width: 15%">{%= report.report_name === "Accounts Receivable Summary" ? __('Credit Note Amount') : __('Debit Note Amount') %}</th>
|
||||
<th style="width: 15%">{%= __("Total Outstanding Amount") %}</th>
|
||||
{% } %}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for(var i=0, l=data.length; i<l; i++) { %}
|
||||
<tr>
|
||||
{% if(report.report_name === "Accounts Receivable" || report.report_name === "Accounts Payable") { %}
|
||||
{% if(data[i][__("Customer")] || data[i][__("Supplier")]) { %}
|
||||
<td>{%= frappe.datetime.str_to_user(data[i]["posting_date"]) %}</td>
|
||||
<td style="text-align: right">{%= data[i][__("Age (Days)")] %}</td>
|
||||
<td>
|
||||
{% if(!filters.show_pdc_in_print) { %}
|
||||
{%= data[i]["voucher_type"] %}
|
||||
<br>
|
||||
{% } %}
|
||||
{%= data[i]["voucher_no"] %}
|
||||
</td>
|
||||
|
||||
{% if(report.report_name === "Accounts Receivable" && filters.show_sales_person_in_print) { %}
|
||||
<td>{%= data[i]["sales_person"] %}</td>
|
||||
{% } %}
|
||||
|
||||
{% if(!filters.show_pdc_in_print) { %}
|
||||
<td>
|
||||
{% if(!(filters.customer || filters.supplier)) { %}
|
||||
{%= data[i][__("Customer")] || data[i][__("Supplier")] %}
|
||||
{% if(data[i][__("Customer Name")] && data[i][__("Customer Name")] != data[i][__("Customer")]) { %}
|
||||
<br> {%= data[i][__("Customer Name")] %}
|
||||
{% } else if(data[i][__("Supplier Name")] != data[i][__("Supplier")]) { %}
|
||||
<br> {%= data[i][__("Supplier Name")] %}
|
||||
{% for(var i=0, l=data.length; i<l; i++) { %}
|
||||
<tr>
|
||||
{% if(report.report_name === "Accounts Receivable" || report.report_name === "Accounts Payable") { %}
|
||||
{% if(data[i]["party"]) { %}
|
||||
<td>{%= frappe.datetime.str_to_user(data[i]["posting_date"]) %}</td>
|
||||
<td style="text-align: right">{%= data[i]["age"] %}</td>
|
||||
<td>
|
||||
{% if(!filters.show_future_payments) { %}
|
||||
{%= data[i]["voucher_type"] %}
|
||||
<br>
|
||||
{% } %}
|
||||
{%= data[i]["voucher_no"] %}
|
||||
</td>
|
||||
|
||||
{% if(report.report_name === "Accounts Receivable" && filters.show_sales_person) { %}
|
||||
<td>{%= data[i]["sales_person"] %}</td>
|
||||
{% } %}
|
||||
<div>
|
||||
{% if data[i][__("Remarks")] %}
|
||||
{%= __("Remarks") %}:
|
||||
{%= data[i][__("Remarks")] %}
|
||||
{% } %}
|
||||
</div>
|
||||
</td>
|
||||
{% } %}
|
||||
|
||||
<td style="text-align: right">
|
||||
{%= format_currency(data[i]["invoiced_amount"], 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]["po_no"] %}</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>
|
||||
{% } %}
|
||||
{% if(report.report_name === "Accounts Receivable" && filters.show_sales_person_in_print) { %}
|
||||
<td></td>
|
||||
{% } %}
|
||||
<td></td>
|
||||
<td style="text-align: right"><b>{%= __("Total") %}</b></td>
|
||||
<td style="text-align: right">
|
||||
{%= format_currency(data[i]["invoiced_amount"], 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">{%= 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")]|| " ") { %}
|
||||
{% if((data[i][__("Customer")] || data[i][__("Supplier")]) != __("'Total'")) { %}
|
||||
{% if(!filters.show_future_payments) { %}
|
||||
<td>
|
||||
{% if(!(filters.customer || filters.supplier)) { %}
|
||||
{%= data[i][__("Customer")] || data[i][__("Supplier")] %}
|
||||
{% if(data[i][__("Customer Name")] && data[i][__("Customer Name")] != data[i][__("Customer")]) { %}
|
||||
<br> {%= data[i][__("Customer Name")] %}
|
||||
{% } else if(data[i][__("Supplier Name")] != data[i][__("Supplier")]) { %}
|
||||
<br> {%= data[i][__("Supplier Name")] %}
|
||||
{%= data[i]["party"] %}
|
||||
{% if(data[i]["customer_name"] && data[i]["customer_name"] != data[i]["party"]) { %}
|
||||
<br> {%= data[i]["customer_name"] %}
|
||||
{% } else if(data[i]["supplier_name"] != data[i]["party"]) { %}
|
||||
<br> {%= data[i]["supplier_name"] %}
|
||||
{% } %}
|
||||
{% } %}
|
||||
<br>{%= __("Remarks") %}:
|
||||
{%= data[i][__("Remarks")] %}
|
||||
<div>
|
||||
{% if data[i]["remarks"] %}
|
||||
{%= __("Remarks") %}:
|
||||
{%= data[i]["remarks"] %}
|
||||
{% } %}
|
||||
</div>
|
||||
</td>
|
||||
{% } %}
|
||||
|
||||
<td style="text-align: right">
|
||||
{%= format_currency(data[i]["invoiced"], data[i]["currency"]) %}</td>
|
||||
|
||||
{% if(!filters.show_future_payments) { %}
|
||||
<td style="text-align: right">
|
||||
{%= format_currency(data[i]["paid"], data[i]["currency"]) %}</td>
|
||||
<td style="text-align: right">
|
||||
{%= format_currency(data[i]["credit_note"], data[i]["currency"]) %}</td>
|
||||
{% } %}
|
||||
<td style="text-align: right">
|
||||
{%= format_currency(data[i]["outstanding"], data[i]["currency"]) %}</td>
|
||||
|
||||
{% if(filters.show_future_payments) { %}
|
||||
{% if(report.report_name === "Accounts Receivable") { %}
|
||||
<td style="text-align: right">
|
||||
{%= data[i]["po_no"] %}</td>
|
||||
{% } %}
|
||||
<td style="text-align: right">{%= data[i]["future_ref"] %}</td>
|
||||
<td style="text-align: right">{%= format_currency(data[i]["future_amount"], data[i]["currency"]) %}</td>
|
||||
<td style="text-align: right">{%= format_currency(data[i]["remaining_balance"], data[i]["currency"]) %}</td>
|
||||
{% } %}
|
||||
{% } else { %}
|
||||
<td><b>{%= __("Total") %}</b></td>
|
||||
<td></td>
|
||||
{% if(!filters.show_future_payments) { %}
|
||||
<td></td>
|
||||
{% } %}
|
||||
{% if(report.report_name === "Accounts Receivable" && filters.show_sales_person) { %}
|
||||
<td></td>
|
||||
{% } %}
|
||||
<td></td>
|
||||
<td style="text-align: right"><b>{%= __("Total") %}</b></td>
|
||||
<td style="text-align: right">
|
||||
{%= format_currency(data[i]["invoiced"], data[i]["currency"] ) %}</td>
|
||||
|
||||
{% if(!filters.show_future_payments) { %}
|
||||
<td style="text-align: right">
|
||||
{%= format_currency(data[i]["paid"], data[i]["currency"]) %}</td>
|
||||
<td style="text-align: right">{%= format_currency(data[i]["credit_note"], data[i]["currency"]) %} </td>
|
||||
{% } %}
|
||||
<td style="text-align: right">
|
||||
{%= format_currency(data[i]["outstanding"], data[i]["currency"]) %}</td>
|
||||
|
||||
{% if(filters.show_future_payments) { %}
|
||||
{% if(report.report_name === "Accounts Receivable") { %}
|
||||
<td style="text-align: right">
|
||||
{%= data[i]["po_no"] %}</td>
|
||||
{% } %}
|
||||
<td style="text-align: right">{%= data[i]["future_ref"] %}</td>
|
||||
<td style="text-align: right">{%= format_currency(data[i]["future_amount"], data[i]["currency"]) %}</td>
|
||||
<td style="text-align: right">{%= format_currency(data[i]["remaining_balance"], data[i]["currency"]) %}</td>
|
||||
{% } %}
|
||||
{% } %}
|
||||
{% } else { %}
|
||||
{% if(data[i]["party"]|| " ") { %}
|
||||
{% if((data[i]["party"]) != __("'Total'")) { %}
|
||||
<td>
|
||||
{% if(!(filters.customer || filters.supplier)) { %}
|
||||
{%= data[i]["party"] %}
|
||||
{% if(data[i]["customer_name"] && data[i]["customer_name"] != data[i]["party"]) { %}
|
||||
<br> {%= data[i]["customer_name"] %}
|
||||
{% } else if(data[i]["supplier_name"] != data[i]["party"]) { %}
|
||||
<br> {%= data[i]["supplier_name"] %}
|
||||
{% } %}
|
||||
{% } %}
|
||||
<br>{%= __("Remarks") %}:
|
||||
{%= data[i]["remarks"] %}
|
||||
</td>
|
||||
{% } else { %}
|
||||
<td><b>{%= __("Total") %}</b></td>
|
||||
{% } %}
|
||||
<td style="text-align: right">{%= format_currency(data[i]["invoiced"], data[i]["currency"]) %}</td>
|
||||
<td style="text-align: right">{%= format_currency(data[i]["paid"], data[i]["currency"]) %}</td>
|
||||
<td style="text-align: right">{%= format_currency(data[i]["credit_note"], data[i]["currency"]) %}</td>
|
||||
<td style="text-align: right">{%= format_currency(data[i]["outstanding"], data[i]["currency"]) %}</td>
|
||||
{% } %}
|
||||
<td style="text-align: right">{%= format_currency(data[i][("total_invoiced_amt")], data[i]["currency"]) %}</td>
|
||||
<td style="text-align: right">{%= format_currency(data[i][("total_paid_amt")], data[i]["currency"]) %}</td>
|
||||
<td style="text-align: right">{%= report.report_name === "Accounts Receivable Summary" ? format_currency(data[i][__("credit_note_amt")], data[i]["currency"]) : format_currency(data[i][__("debit_note_amt")], data[i]["currency"]) %}</td>
|
||||
<td style="text-align: right">{%= format_currency(data[i][("total_outstanding_amt")], data[i]["currency"]) %}</td>
|
||||
{% } %}
|
||||
</tr>
|
||||
{% } %}
|
||||
</tr>
|
||||
{% } %}
|
||||
</tbody>
|
||||
</table>
|
||||
<p class="text-right text-muted">{{ __("Printed On ") }}{%= frappe.datetime.str_to_user(frappe.datetime.get_datetime_as_string()) %}</p>
|
||||
</tbody>
|
||||
</table>
|
||||
<p class="text-right text-muted">{{ __("Printed On ") }}{%= frappe.datetime.str_to_user(frappe.datetime.get_datetime_as_string()) %}</p>
|
||||
|
||||
@@ -79,13 +79,20 @@ frappe.query_reports["Accounts Receivable"] = {
|
||||
"options": "Customer",
|
||||
on_change: () => {
|
||||
var customer = frappe.query_report.get_filter_value('customer');
|
||||
var company = frappe.query_report.get_filter_value('company');
|
||||
if (customer) {
|
||||
frappe.db.get_value('Customer', customer, ["tax_id", "customer_name", "credit_limit", "payment_terms"], function(value) {
|
||||
frappe.db.get_value('Customer', customer, ["tax_id", "customer_name", "payment_terms"], function(value) {
|
||||
frappe.query_report.set_filter_value('tax_id', value["tax_id"]);
|
||||
frappe.query_report.set_filter_value('customer_name', value["customer_name"]);
|
||||
frappe.query_report.set_filter_value('credit_limit', value["credit_limit"]);
|
||||
frappe.query_report.set_filter_value('payment_terms', value["payment_terms"]);
|
||||
});
|
||||
|
||||
frappe.db.get_value('Customer Credit Limit', {'parent': customer, 'company': company},
|
||||
["credit_limit"], function(value) {
|
||||
if (value) {
|
||||
frappe.query_report.set_filter_value('credit_limit', value["credit_limit"]);
|
||||
}
|
||||
}, "Customer");
|
||||
} else {
|
||||
frappe.query_report.set_filter_value('tax_id', "");
|
||||
frappe.query_report.set_filter_value('customer_name', "");
|
||||
@@ -130,13 +137,18 @@ frappe.query_reports["Accounts Receivable"] = {
|
||||
"fieldtype": "Check",
|
||||
},
|
||||
{
|
||||
"fieldname":"show_pdc_in_print",
|
||||
"label": __("Show PDC in Print"),
|
||||
"fieldname":"show_future_payments",
|
||||
"label": __("Show Future Payments"),
|
||||
"fieldtype": "Check",
|
||||
},
|
||||
{
|
||||
"fieldname":"show_sales_person_in_print",
|
||||
"label": __("Show Sales Person in Print"),
|
||||
"fieldname":"show_delivery_notes",
|
||||
"label": __("Show Delivery Notes"),
|
||||
"fieldtype": "Check",
|
||||
},
|
||||
{
|
||||
"fieldname":"show_sales_person",
|
||||
"label": __("Show Sales Person"),
|
||||
"fieldtype": "Check",
|
||||
},
|
||||
{
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -14,33 +14,44 @@ class TestAccountsReceivable(unittest.TestCase):
|
||||
|
||||
filters = {
|
||||
'company': '_Test Company 2',
|
||||
'based_on_payment_terms': 1
|
||||
'based_on_payment_terms': 1,
|
||||
'report_date': today(),
|
||||
'range1': 30,
|
||||
'range2': 60,
|
||||
'range3': 90,
|
||||
'range4': 120
|
||||
}
|
||||
|
||||
# check invoice grand total and invoiced column's value for 3 payment terms
|
||||
name = make_sales_invoice()
|
||||
report = execute(filters)
|
||||
|
||||
expected_data = [[100,30], [100,50], [100,20]]
|
||||
expected_data = [[100, 30], [100, 50], [100, 20]]
|
||||
|
||||
self.assertEqual(expected_data[0], report[1][0][7:9])
|
||||
self.assertEqual(expected_data[1], report[1][1][7:9])
|
||||
self.assertEqual(expected_data[2], report[1][2][7:9])
|
||||
for i in range(3):
|
||||
row = report[1][i-1]
|
||||
self.assertEqual(expected_data[i-1], [row.invoice_grand_total, row.invoiced])
|
||||
|
||||
# check invoice grand total, invoiced, paid and outstanding column's value after payment
|
||||
make_payment(name)
|
||||
report = execute(filters)
|
||||
|
||||
expected_data_after_payment = [[100,50], [100,20]]
|
||||
expected_data_after_payment = [[100, 50, 10, 40], [100, 20, 0, 20]]
|
||||
|
||||
self.assertEqual(expected_data_after_payment[0], report[1][0][7:9])
|
||||
self.assertEqual(expected_data_after_payment[1], report[1][1][7:9])
|
||||
for i in range(2):
|
||||
row = report[1][i-1]
|
||||
self.assertEqual(expected_data_after_payment[i-1],
|
||||
[row.invoice_grand_total, row.invoiced, row.paid, row.outstanding])
|
||||
|
||||
# check invoice grand total, invoiced, paid and outstanding column's value after credit note
|
||||
make_credit_note(name)
|
||||
report = execute(filters)
|
||||
|
||||
expected_data_after_credit_note = [[100,100,30,100,-30]]
|
||||
|
||||
self.assertEqual(expected_data_after_credit_note[0], report[1][0][7:12])
|
||||
expected_data_after_credit_note = [100, 0, 0, 40, -40]
|
||||
|
||||
row = report[1][0]
|
||||
self.assertEqual(expected_data_after_credit_note,
|
||||
[row.invoice_grand_total, row.invoiced, row.paid, row.credit_note, row.outstanding])
|
||||
|
||||
def make_sales_invoice():
|
||||
frappe.set_user("Administrator")
|
||||
@@ -64,7 +75,7 @@ def make_sales_invoice():
|
||||
return si.name
|
||||
|
||||
def make_payment(docname):
|
||||
pe = get_payment_entry("Sales Invoice", docname, bank_account="Cash - _TC2", party_amount=30)
|
||||
pe = get_payment_entry("Sales Invoice", docname, bank_account="Cash - _TC2", party_amount=40)
|
||||
pe.paid_from = "Debtors - _TC2"
|
||||
pe.insert()
|
||||
pe.submit()
|
||||
|
||||
@@ -4,235 +4,10 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe import _, scrub
|
||||
from frappe.utils import flt
|
||||
from frappe.utils import flt, cint
|
||||
from erpnext.accounts.party import get_partywise_advanced_payment_amount
|
||||
from erpnext.accounts.report.accounts_receivable.accounts_receivable import ReceivablePayableReport
|
||||
|
||||
from six import iteritems
|
||||
from six.moves import zip
|
||||
|
||||
class AccountsReceivableSummary(ReceivablePayableReport):
|
||||
def run(self, args):
|
||||
party_naming_by = frappe.db.get_value(args.get("naming_by")[0], None, args.get("naming_by")[1])
|
||||
return self.get_columns(party_naming_by, args), self.get_data(party_naming_by, args)
|
||||
|
||||
def get_columns(self, party_naming_by, args):
|
||||
columns = [_(args.get("party_type")) + ":Link/" + args.get("party_type") + ":200"]
|
||||
|
||||
if party_naming_by == "Naming Series":
|
||||
columns += [ args.get("party_type") + " Name::140"]
|
||||
|
||||
credit_debit_label = "Credit Note Amt" if args.get('party_type') == 'Customer' else "Debit Note Amt"
|
||||
|
||||
columns += [{
|
||||
"label": _("Advance Amount"),
|
||||
"fieldname": "advance_amount",
|
||||
"fieldtype": "Currency",
|
||||
"options": "currency",
|
||||
"width": 100
|
||||
},{
|
||||
"label": _("Total Invoiced Amt"),
|
||||
"fieldname": "total_invoiced_amt",
|
||||
"fieldtype": "Currency",
|
||||
"options": "currency",
|
||||
"width": 100
|
||||
},
|
||||
{
|
||||
"label": _("Total Paid Amt"),
|
||||
"fieldname": "total_paid_amt",
|
||||
"fieldtype": "Currency",
|
||||
"options": "currency",
|
||||
"width": 100
|
||||
}]
|
||||
|
||||
columns += [
|
||||
{
|
||||
"label": _(credit_debit_label),
|
||||
"fieldname": scrub(credit_debit_label),
|
||||
"fieldtype": "Currency",
|
||||
"options": "currency",
|
||||
"width": 140
|
||||
},
|
||||
{
|
||||
"label": _("Total Outstanding Amt"),
|
||||
"fieldname": "total_outstanding_amt",
|
||||
"fieldtype": "Currency",
|
||||
"options": "currency",
|
||||
"width": 160
|
||||
},
|
||||
{
|
||||
"label": _("0-" + str(self.filters.range1)),
|
||||
"fieldname": scrub("0-" + str(self.filters.range1)),
|
||||
"fieldtype": "Currency",
|
||||
"options": "currency",
|
||||
"width": 160
|
||||
},
|
||||
{
|
||||
"label": _(str(self.filters.range1) + "-" + str(self.filters.range2)),
|
||||
"fieldname": scrub(str(self.filters.range1) + "-" + str(self.filters.range2)),
|
||||
"fieldtype": "Currency",
|
||||
"options": "currency",
|
||||
"width": 160
|
||||
},
|
||||
{
|
||||
"label": _(str(self.filters.range2) + "-" + str(self.filters.range3)),
|
||||
"fieldname": scrub(str(self.filters.range2) + "-" + str(self.filters.range3)),
|
||||
"fieldtype": "Currency",
|
||||
"options": "currency",
|
||||
"width": 160
|
||||
},
|
||||
{
|
||||
"label": _(str(self.filters.range3) + "-" + str(self.filters.range4)),
|
||||
"fieldname": scrub(str(self.filters.range3) + "-" + str(self.filters.range4)),
|
||||
"fieldtype": "Currency",
|
||||
"options": "currency",
|
||||
"width": 160
|
||||
},
|
||||
{
|
||||
"label": _(str(self.filters.range4) + _("-Above")),
|
||||
"fieldname": scrub(str(self.filters.range4) + _("-Above")),
|
||||
"fieldtype": "Currency",
|
||||
"options": "currency",
|
||||
"width": 160
|
||||
}
|
||||
]
|
||||
|
||||
if args.get("party_type") == "Customer":
|
||||
columns += [{
|
||||
"label": _("Territory"),
|
||||
"fieldname": "territory",
|
||||
"fieldtype": "Link",
|
||||
"options": "Territory",
|
||||
"width": 80
|
||||
},
|
||||
{
|
||||
"label": _("Customer Group"),
|
||||
"fieldname": "customer_group",
|
||||
"fieldtype": "Link",
|
||||
"options": "Customer Group",
|
||||
"width": 80
|
||||
},
|
||||
{
|
||||
"label": _("Sales Person"),
|
||||
"fieldtype": "Data",
|
||||
"fieldname": "sales_person",
|
||||
"width": 120,
|
||||
}]
|
||||
|
||||
if args.get("party_type") == "Supplier":
|
||||
columns += [{
|
||||
"label": _("Supplier Group"),
|
||||
"fieldname": "supplier_group",
|
||||
"fieldtype": "Link",
|
||||
"options": "Supplier Group",
|
||||
"width": 80
|
||||
}]
|
||||
|
||||
columns.append({
|
||||
"fieldname": "currency",
|
||||
"label": _("Currency"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Currency",
|
||||
"width": 80
|
||||
})
|
||||
|
||||
return columns
|
||||
|
||||
def get_data(self, party_naming_by, args):
|
||||
data = []
|
||||
|
||||
partywise_total = self.get_partywise_total(party_naming_by, args)
|
||||
|
||||
partywise_advance_amount = get_partywise_advanced_payment_amount(args.get("party_type"),
|
||||
self.filters.get("report_date")) or {}
|
||||
for party, party_dict in iteritems(partywise_total):
|
||||
row = [party]
|
||||
|
||||
if party_naming_by == "Naming Series":
|
||||
row += [self.get_party_name(args.get("party_type"), party)]
|
||||
|
||||
row += [partywise_advance_amount.get(party, 0)]
|
||||
|
||||
paid_amt = 0
|
||||
if party_dict.paid_amt > 0:
|
||||
paid_amt = flt(party_dict.paid_amt - partywise_advance_amount.get(party, 0))
|
||||
|
||||
row += [
|
||||
party_dict.invoiced_amt, paid_amt, party_dict.credit_amt, party_dict.outstanding_amt,
|
||||
party_dict.range1, party_dict.range2, party_dict.range3, party_dict.range4, party_dict.range5
|
||||
]
|
||||
|
||||
if args.get("party_type") == "Customer":
|
||||
row += [self.get_territory(party), self.get_customer_group(party), ", ".join(set(party_dict.sales_person))]
|
||||
if args.get("party_type") == "Supplier":
|
||||
row += [self.get_supplier_group(party)]
|
||||
|
||||
row.append(party_dict.currency)
|
||||
data.append(row)
|
||||
|
||||
return data
|
||||
|
||||
def get_partywise_total(self, party_naming_by, args):
|
||||
party_total = frappe._dict()
|
||||
for d in self.get_voucherwise_data(party_naming_by, args):
|
||||
party_total.setdefault(d.party,
|
||||
frappe._dict({
|
||||
"invoiced_amt": 0,
|
||||
"paid_amt": 0,
|
||||
"credit_amt": 0,
|
||||
"outstanding_amt": 0,
|
||||
"range1": 0,
|
||||
"range2": 0,
|
||||
"range3": 0,
|
||||
"range4": 0,
|
||||
"range5": 0,
|
||||
"sales_person": []
|
||||
})
|
||||
)
|
||||
for k in list(party_total[d.party]):
|
||||
if k not in ["currency", "sales_person"]:
|
||||
party_total[d.party][k] += flt(d.get(k, 0))
|
||||
|
||||
party_total[d.party].currency = d.currency
|
||||
|
||||
if d.sales_person:
|
||||
party_total[d.party].sales_person.append(d.sales_person)
|
||||
|
||||
return party_total
|
||||
|
||||
def get_voucherwise_data(self, party_naming_by, args):
|
||||
voucherwise_data = ReceivablePayableReport(self.filters).run(args)[1]
|
||||
|
||||
cols = ["posting_date", "party"]
|
||||
|
||||
if party_naming_by == "Naming Series":
|
||||
cols += ["party_name"]
|
||||
|
||||
if args.get("party_type") == 'Customer':
|
||||
cols += ["contact"]
|
||||
|
||||
cols += ["voucher_type", "voucher_no", "due_date"]
|
||||
|
||||
if args.get("party_type") == "Supplier":
|
||||
cols += ["bill_no", "bill_date"]
|
||||
|
||||
cols += ["invoiced_amt", "paid_amt", "credit_amt",
|
||||
"outstanding_amt", "age", "range1", "range2", "range3", "range4", "range5", "currency", "pdc/lc_date", "pdc/lc_ref",
|
||||
"pdc/lc_amount"]
|
||||
|
||||
if args.get("party_type") == "Supplier":
|
||||
cols += ["supplier_group", "remarks"]
|
||||
if args.get("party_type") == "Customer":
|
||||
cols += ["po_no", "do_no", "territory", "customer_group", "sales_person", "remarks"]
|
||||
|
||||
return self.make_data_dict(cols, voucherwise_data)
|
||||
|
||||
def make_data_dict(self, cols, data):
|
||||
data_dict = []
|
||||
for d in data:
|
||||
data_dict.append(frappe._dict(zip(cols, d)))
|
||||
|
||||
return data_dict
|
||||
|
||||
def execute(filters=None):
|
||||
args = {
|
||||
@@ -241,3 +16,122 @@ def execute(filters=None):
|
||||
}
|
||||
|
||||
return AccountsReceivableSummary(filters).run(args)
|
||||
|
||||
class AccountsReceivableSummary(ReceivablePayableReport):
|
||||
def run(self, args):
|
||||
self.party_type = args.get('party_type')
|
||||
self.party_naming_by = frappe.db.get_value(args.get("naming_by")[0], None, args.get("naming_by")[1])
|
||||
self.get_columns()
|
||||
self.get_data(args)
|
||||
return self.columns, self.data
|
||||
|
||||
def get_data(self, args):
|
||||
self.data = []
|
||||
|
||||
self.receivables = ReceivablePayableReport(self.filters).run(args)[1]
|
||||
|
||||
self.get_party_total(args)
|
||||
|
||||
party_advance_amount = get_partywise_advanced_payment_amount(self.party_type,
|
||||
self.filters.report_date) or {}
|
||||
|
||||
for party, party_dict in iteritems(self.party_total):
|
||||
if party_dict.outstanding <= 0:
|
||||
continue
|
||||
|
||||
row = frappe._dict()
|
||||
|
||||
row.party = party
|
||||
if self.party_naming_by == "Naming Series":
|
||||
row.party_name = frappe.get_cached_value(self.party_type, party, scrub(self.party_type) + "_name")
|
||||
|
||||
row.update(party_dict)
|
||||
|
||||
# Advance against party
|
||||
row.advance = party_advance_amount.get(party, 0)
|
||||
|
||||
# In AR/AP, advance shown in paid columns,
|
||||
# but in summary report advance shown in separate column
|
||||
row.paid -= row.advance
|
||||
|
||||
self.data.append(row)
|
||||
|
||||
def get_party_total(self, args):
|
||||
self.party_total = frappe._dict()
|
||||
|
||||
for d in self.receivables:
|
||||
self.init_party_total(d)
|
||||
|
||||
# Add all amount columns
|
||||
for k in list(self.party_total[d.party]):
|
||||
if k not in ["currency", "sales_person"]:
|
||||
|
||||
self.party_total[d.party][k] += d.get(k, 0.0)
|
||||
|
||||
# set territory, customer_group, sales person etc
|
||||
self.set_party_details(d)
|
||||
|
||||
def init_party_total(self, row):
|
||||
self.party_total.setdefault(row.party, frappe._dict({
|
||||
"invoiced": 0.0,
|
||||
"paid": 0.0,
|
||||
"credit_note": 0.0,
|
||||
"outstanding": 0.0,
|
||||
"range1": 0.0,
|
||||
"range2": 0.0,
|
||||
"range3": 0.0,
|
||||
"range4": 0.0,
|
||||
"range5": 0.0,
|
||||
"sales_person": []
|
||||
}))
|
||||
|
||||
def set_party_details(self, row):
|
||||
self.party_total[row.party].currency = row.currency
|
||||
|
||||
for key in ('territory', 'customer_group', 'supplier_group'):
|
||||
if row.get(key):
|
||||
self.party_total[row.party][key] = row.get(key)
|
||||
|
||||
if row.sales_person:
|
||||
self.party_total[row.party].sales_person.append(row.sales_person)
|
||||
|
||||
def get_columns(self):
|
||||
self.columns = []
|
||||
self.add_column(label=_(self.party_type), fieldname='party',
|
||||
fieldtype='Link', options=self.party_type, width=180)
|
||||
|
||||
if self.party_naming_by == "Naming Series":
|
||||
self.add_column(_('{0} Name').format(self.party_type),
|
||||
fieldname = 'party_name', fieldtype='Data')
|
||||
|
||||
credit_debit_label = "Credit Note" if self.party_type == 'Customer' else "Debit Note"
|
||||
|
||||
self.add_column(_('Advance Amount'), fieldname='advance')
|
||||
self.add_column(_('Invoiced Amount'), fieldname='invoiced')
|
||||
self.add_column(_('Paid Amount'), fieldname='paid')
|
||||
self.add_column(_(credit_debit_label), fieldname='credit_note')
|
||||
self.add_column(_('Outstanding Amount'), fieldname='outstanding')
|
||||
|
||||
self.setup_ageing_columns()
|
||||
|
||||
if self.party_type == "Customer":
|
||||
self.add_column(label=_('Territory'), fieldname='territory', fieldtype='Link',
|
||||
options='Territory')
|
||||
self.add_column(label=_('Customer Group'), fieldname='customer_group', fieldtype='Link',
|
||||
options='Customer Group')
|
||||
if self.filters.show_sales_person:
|
||||
self.add_column(label=_('Sales Person'), fieldname='sales_person', fieldtype='Data')
|
||||
else:
|
||||
self.add_column(label=_('Supplier Group'), fieldname='supplier_group', fieldtype='Link',
|
||||
options='Supplier Group')
|
||||
|
||||
self.add_column(label=_('Currency'), fieldname='currency', fieldtype='Link',
|
||||
options='Currency', width=80)
|
||||
|
||||
def setup_ageing_columns(self):
|
||||
for i, label in enumerate(["0-{range1}".format(range1=self.filters["range1"]),
|
||||
"{range1}-{range2}".format(range1=cint(self.filters["range1"])+ 1, range2=self.filters["range2"]),
|
||||
"{range2}-{range3}".format(range2=cint(self.filters["range2"])+ 1, range3=self.filters["range3"]),
|
||||
"{range3}-{range4}".format(range3=cint(self.filters["range3"])+ 1, range4=self.filters["range4"]),
|
||||
"{range4}-{above}".format(range4=cint(self.filters["range4"])+ 1, above=_("Above"))]):
|
||||
self.add_column(label=label, fieldname='range' + str(i+1))
|
||||
@@ -2,7 +2,7 @@
|
||||
// License: GNU General Public License v3. See license.txt
|
||||
|
||||
frappe.require("assets/erpnext/js/financial_statements.js", function() {
|
||||
frappe.query_reports["Balance Sheet"] = erpnext.financial_statements;
|
||||
frappe.query_reports["Balance Sheet"] = $.extend({}, erpnext.financial_statements);
|
||||
|
||||
frappe.query_reports["Balance Sheet"]["filters"].push({
|
||||
"fieldname": "accumulated_values",
|
||||
|
||||
@@ -135,11 +135,11 @@ def get_chart_data(filters, columns, asset, liability, equity):
|
||||
|
||||
datasets = []
|
||||
if asset_data:
|
||||
datasets.append({'name':'Assets', 'values': asset_data})
|
||||
datasets.append({'name': _('Assets'), 'values': asset_data})
|
||||
if liability_data:
|
||||
datasets.append({'name':'Liabilities', 'values': liability_data})
|
||||
datasets.append({'name': _('Liabilities'), 'values': liability_data})
|
||||
if equity_data:
|
||||
datasets.append({'name':'Equity', 'values': equity_data})
|
||||
datasets.append({'name': _('Equity'), 'values': equity_data})
|
||||
|
||||
chart = {
|
||||
"data": {
|
||||
|
||||
@@ -69,7 +69,7 @@ def get_columns(filters):
|
||||
for year in fiscal_year:
|
||||
for from_date, to_date in get_period_date_ranges(filters["period"], year[0]):
|
||||
if filters["period"] == "Yearly":
|
||||
labels = [_("Budget") + " " + str(year[0]), _("Actual ") + " " + str(year[0]), _("Varaiance ") + " " + str(year[0])]
|
||||
labels = [_("Budget") + " " + str(year[0]), _("Actual ") + " " + str(year[0]), _("Variance ") + " " + str(year[0])]
|
||||
for label in labels:
|
||||
columns.append(label+":Float:150")
|
||||
else:
|
||||
|
||||
@@ -286,14 +286,14 @@ class PartyLedgerSummaryReport(object):
|
||||
|
||||
if parties and accounts:
|
||||
if len(parties) == 1:
|
||||
party = parties.keys()[0]
|
||||
party = list(parties.keys())[0]
|
||||
for account, amount in iteritems(accounts):
|
||||
self.party_adjustment_accounts.add(account)
|
||||
self.party_adjustment_details.setdefault(party, {})
|
||||
self.party_adjustment_details[party].setdefault(account, 0)
|
||||
self.party_adjustment_details[party][account] += amount
|
||||
elif len(accounts) == 1 and not has_irrelevant_entry:
|
||||
account = accounts.keys()[0]
|
||||
account = list(accounts.keys())[0]
|
||||
self.party_adjustment_accounts.add(account)
|
||||
for party, amount in iteritems(parties):
|
||||
self.party_adjustment_details.setdefault(party, {})
|
||||
|
||||
@@ -425,9 +425,12 @@ def get_cost_centers_with_children(cost_centers):
|
||||
|
||||
all_cost_centers = []
|
||||
for d in cost_centers:
|
||||
lft, rgt = frappe.db.get_value("Cost Center", d, ["lft", "rgt"])
|
||||
children = frappe.get_all("Cost Center", filters={"lft": [">=", lft], "rgt": ["<=", rgt]})
|
||||
all_cost_centers += [c.name for c in children]
|
||||
if frappe.db.exists("Cost Center", d):
|
||||
lft, rgt = frappe.db.get_value("Cost Center", d, ["lft", "rgt"])
|
||||
children = frappe.get_all("Cost Center", filters={"lft": [">=", lft], "rgt": ["<=", rgt]})
|
||||
all_cost_centers += [c.name for c in children]
|
||||
else:
|
||||
frappe.throw(_("Cost Center: {0} does not exist".format(d)))
|
||||
|
||||
return list(set(all_cost_centers))
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ def _execute(filters=None, additional_table_columns=None, additional_query_colum
|
||||
filters.update({"from_date": filters.get("date_range") and filters.get("date_range")[0], "to_date": filters.get("date_range") and filters.get("date_range")[1]})
|
||||
columns = get_columns(additional_table_columns)
|
||||
|
||||
company_currency = erpnext.get_company_currency(filters.get('company'))
|
||||
company_currency = frappe.get_cached_value('Company', filters.get("company"), "default_currency")
|
||||
|
||||
item_list = get_items(filters, additional_query_columns)
|
||||
if item_list:
|
||||
|
||||
@@ -27,8 +27,8 @@ frappe.query_reports["Payment Period Based On Invoice Date"] = {
|
||||
fieldname:"payment_type",
|
||||
label: __("Payment Type"),
|
||||
fieldtype: "Select",
|
||||
options: "Incoming\nOutgoing",
|
||||
default: "Incoming"
|
||||
options: __("Incoming") + "\n" + __("Outgoing"),
|
||||
default: __("Incoming")
|
||||
},
|
||||
{
|
||||
"fieldname":"party_type",
|
||||
|
||||
@@ -4,11 +4,14 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe import _
|
||||
from erpnext.accounts.report.accounts_receivable.accounts_receivable import get_ageing_data
|
||||
from erpnext.accounts.report.accounts_receivable.accounts_receivable import ReceivablePayableReport
|
||||
from frappe.utils import getdate, flt
|
||||
|
||||
|
||||
def execute(filters=None):
|
||||
if not filters: filters = {}
|
||||
if not filters:
|
||||
filters = {}
|
||||
|
||||
validate_filters(filters)
|
||||
|
||||
columns = get_columns(filters)
|
||||
@@ -19,18 +22,28 @@ def execute(filters=None):
|
||||
for d in entries:
|
||||
invoice = invoice_details.get(d.against_voucher) or frappe._dict()
|
||||
|
||||
if d.reference_type=="Purchase Invoice":
|
||||
if d.reference_type == "Purchase Invoice":
|
||||
payment_amount = flt(d.debit) or -1 * flt(d.credit)
|
||||
else:
|
||||
payment_amount = flt(d.credit) or -1 * flt(d.debit)
|
||||
|
||||
row = [d.voucher_type, d.voucher_no, d.party_type, d.party, d.posting_date, d.against_voucher,
|
||||
invoice.posting_date, invoice.due_date, d.debit, d.credit, d.remarks]
|
||||
d.update({
|
||||
"range1": 0,
|
||||
"range2": 0,
|
||||
"range3": 0,
|
||||
"range4": 0,
|
||||
"outstanding": payment_amount
|
||||
})
|
||||
|
||||
if d.against_voucher:
|
||||
row += get_ageing_data(30, 60, 90, 120, d.posting_date, invoice.posting_date, payment_amount)
|
||||
else:
|
||||
row += ["", "", "", "", ""]
|
||||
ReceivablePayableReport(filters).get_ageing_data(invoice.posting_date, d)
|
||||
|
||||
row = [
|
||||
d.voucher_type, d.voucher_no, d.party_type, d.party, d.posting_date, d.against_voucher,
|
||||
invoice.posting_date, invoice.due_date, d.debit, d.credit, d.remarks,
|
||||
d.age, d.range1, d.range2, d.range3, d.range4
|
||||
]
|
||||
|
||||
if invoice.due_date:
|
||||
row.append((getdate(d.posting_date) - getdate(invoice.due_date)).days or 0)
|
||||
|
||||
@@ -39,8 +52,8 @@ def execute(filters=None):
|
||||
return columns, data
|
||||
|
||||
def validate_filters(filters):
|
||||
if (filters.get("payment_type") == "Incoming" and filters.get("party_type") == "Supplier") or \
|
||||
(filters.get("payment_type") == "Outgoing" and filters.get("party_type") == "Customer"):
|
||||
if (filters.get("payment_type") == _("Incoming") and filters.get("party_type") == "Supplier") or \
|
||||
(filters.get("payment_type") == _("Outgoing") and filters.get("party_type") == "Customer"):
|
||||
frappe.throw(_("{0} payment entries can not be filtered by {1}")\
|
||||
.format(filters.payment_type, filters.party_type))
|
||||
|
||||
@@ -51,7 +64,7 @@ def get_columns(filters):
|
||||
_("Party Type") + "::100",
|
||||
_("Party") + ":Dynamic Link/Party Type:140",
|
||||
_("Posting Date") + ":Date:100",
|
||||
_("Invoice") + (":Link/Purchase Invoice:130" if filters.get("payment_type") == "Outgoing" else ":Link/Sales Invoice:130"),
|
||||
_("Invoice") + (":Link/Purchase Invoice:130" if filters.get("payment_type") == _("Outgoing") else ":Link/Sales Invoice:130"),
|
||||
_("Invoice Posting Date") + ":Date:130",
|
||||
_("Payment Due Date") + ":Date:130",
|
||||
_("Debit") + ":Currency:120",
|
||||
@@ -69,7 +82,7 @@ def get_conditions(filters):
|
||||
conditions = []
|
||||
|
||||
if not filters.party_type:
|
||||
if filters.payment_type == "Outgoing":
|
||||
if filters.payment_type == _("Outgoing"):
|
||||
filters.party_type = "Supplier"
|
||||
else:
|
||||
filters.party_type = "Customer"
|
||||
@@ -101,7 +114,7 @@ def get_entries(filters):
|
||||
|
||||
def get_invoice_posting_date_map(filters):
|
||||
invoice_details = {}
|
||||
dt = "Sales Invoice" if filters.get("payment_type") == "Incoming" else "Purchase Invoice"
|
||||
dt = "Sales Invoice" if filters.get("payment_type") == _("Incoming") else "Purchase Invoice"
|
||||
for t in frappe.db.sql("select name, posting_date, due_date from `tab{0}`".format(dt), as_dict=1):
|
||||
invoice_details[t.name] = t
|
||||
|
||||
|
||||
@@ -75,11 +75,11 @@ def get_chart_data(filters, columns, income, expense, net_profit_loss):
|
||||
|
||||
datasets = []
|
||||
if income_data:
|
||||
datasets.append({'name': 'Income', 'values': income_data})
|
||||
datasets.append({'name': _('Income'), 'values': income_data})
|
||||
if expense_data:
|
||||
datasets.append({'name': 'Expense', 'values': expense_data})
|
||||
datasets.append({'name': _('Expense'), 'values': expense_data})
|
||||
if net_profit:
|
||||
datasets.append({'name': 'Net Profit/Loss', 'values': net_profit})
|
||||
datasets.append({'name': _('Net Profit/Loss'), 'values': net_profit})
|
||||
|
||||
chart = {
|
||||
"data": {
|
||||
|
||||
@@ -5,6 +5,7 @@ from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe.utils import flt
|
||||
from frappe import msgprint, _
|
||||
from frappe.model.meta import get_field_precision
|
||||
from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import get_accounting_dimensions
|
||||
|
||||
def execute(filters=None):
|
||||
@@ -68,7 +69,8 @@ def _execute(filters, additional_table_columns=None, additional_query_columns=No
|
||||
total_tax = 0
|
||||
for tax_acc in tax_accounts:
|
||||
if tax_acc not in income_accounts:
|
||||
tax_amount = flt(invoice_tax_map.get(inv.name, {}).get(tax_acc))
|
||||
tax_amount_precision = get_field_precision(frappe.get_meta("Sales Taxes and Charges").get_field("tax_amount"), currency=company_currency) or 2
|
||||
tax_amount = flt(invoice_tax_map.get(inv.name, {}).get(tax_acc), tax_amount_precision)
|
||||
total_tax += tax_amount
|
||||
row.append(tax_amount)
|
||||
|
||||
@@ -272,4 +274,4 @@ def get_mode_of_payments(invoice_list):
|
||||
for d in inv_mop:
|
||||
mode_of_payments.setdefault(d.parent, []).append(d.mode_of_payment)
|
||||
|
||||
return mode_of_payments
|
||||
return mode_of_payments
|
||||
|
||||
@@ -5,9 +5,8 @@
|
||||
"docstatus": 0,
|
||||
"doctype": "Report",
|
||||
"idx": 0,
|
||||
"is_standard": "Yes",
|
||||
"letter_head": "Capital Traders",
|
||||
"modified": "2018-12-12 05:10:02.987274",
|
||||
"is_standard": "Yes",
|
||||
"modified": "2019-02-12 05:10:02.987274",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Supplier Ledger Summary",
|
||||
|
||||
@@ -6,8 +6,7 @@
|
||||
"doctype": "Report",
|
||||
"idx": 0,
|
||||
"is_standard": "Yes",
|
||||
"letter_head": "Gadgets International",
|
||||
"modified": "2018-08-21 11:25:00.551823",
|
||||
"modified": "2018-09-21 11:25:00.551823",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "TDS Computation Summary",
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
{
|
||||
"add_total_row": 0,
|
||||
"add_total_row": 1,
|
||||
"creation": "2018-08-21 11:32:30.874923",
|
||||
"disable_prepared_report": 0,
|
||||
"disabled": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "Report",
|
||||
"idx": 0,
|
||||
"is_standard": "Yes",
|
||||
"letter_head": "Gadgets International",
|
||||
"modified": "2018-08-21 11:33:40.804532",
|
||||
"modified": "2019-09-24 13:46:16.473711",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "TDS Payable Monthly",
|
||||
|
||||
@@ -70,7 +70,7 @@ def get_result(filters):
|
||||
rate = [i.tax_withholding_rate for i in tds_doc.rates
|
||||
if i.fiscal_year == gle_map[d][0].fiscal_year]
|
||||
|
||||
if rate and len(rate) > 0:
|
||||
if rate and len(rate) > 0 and tds_deducted:
|
||||
rate = rate[0]
|
||||
|
||||
if getdate(filters.from_date) <= gle_map[d][0].posting_date \
|
||||
@@ -164,7 +164,7 @@ def get_columns(filters):
|
||||
{
|
||||
"label": _("TDS Rate %"),
|
||||
"fieldname": "tds_rate",
|
||||
"fieldtype": "Float",
|
||||
"fieldtype": "Percent",
|
||||
"width": 90
|
||||
},
|
||||
{
|
||||
|
||||
@@ -76,8 +76,7 @@ def get_data(filters):
|
||||
accumulate_values_into_parents(accounts, accounts_by_name)
|
||||
|
||||
data = prepare_data(accounts, filters, total_row, parent_children_map, company_currency)
|
||||
data = filter_out_zero_value_rows(data, parent_children_map,
|
||||
show_zero_values=filters.get("show_zero_values"))
|
||||
data = filter_out_zero_value_rows(data, parent_children_map, show_zero_values=filters.get("show_zero_values"))
|
||||
|
||||
return data
|
||||
|
||||
@@ -187,33 +186,11 @@ def calculate_values(accounts, gl_entries_by_account, opening_balances, filters,
|
||||
|
||||
d["closing_debit"] = d["opening_debit"] + d["debit"]
|
||||
d["closing_credit"] = d["opening_credit"] + d["credit"]
|
||||
total_row["debit"] += d["debit"]
|
||||
total_row["credit"] += d["credit"]
|
||||
|
||||
if d["root_type"] == "Asset" or d["root_type"] == "Equity" or d["root_type"] == "Expense":
|
||||
d["opening_debit"] -= d["opening_credit"]
|
||||
d["closing_debit"] -= d["closing_credit"]
|
||||
prepare_opening_closing(d)
|
||||
|
||||
# For opening
|
||||
check_opening_closing_has_negative_value(d, "opening_debit", "opening_credit")
|
||||
|
||||
# For closing
|
||||
check_opening_closing_has_negative_value(d, "closing_debit", "closing_credit")
|
||||
|
||||
if d["root_type"] == "Liability" or d["root_type"] == "Income":
|
||||
d["opening_credit"] -= d["opening_debit"]
|
||||
d["closing_credit"] -= d["closing_debit"]
|
||||
|
||||
# For opening
|
||||
check_opening_closing_has_negative_value(d, "opening_credit", "opening_debit")
|
||||
|
||||
# For closing
|
||||
check_opening_closing_has_negative_value(d, "closing_credit", "closing_debit")
|
||||
|
||||
total_row["opening_debit"] += d["opening_debit"]
|
||||
total_row["closing_debit"] += d["closing_debit"]
|
||||
total_row["opening_credit"] += d["opening_credit"]
|
||||
total_row["closing_credit"] += d["closing_credit"]
|
||||
for field in value_fields:
|
||||
total_row[field] += d[field]
|
||||
|
||||
return total_row
|
||||
|
||||
@@ -227,6 +204,10 @@ def prepare_data(accounts, filters, total_row, parent_children_map, company_curr
|
||||
data = []
|
||||
|
||||
for d in accounts:
|
||||
# Prepare opening closing for group account
|
||||
if parent_children_map.get(d.account):
|
||||
prepare_opening_closing(d)
|
||||
|
||||
has_value = False
|
||||
row = {
|
||||
"account": d.name,
|
||||
@@ -313,11 +294,16 @@ def get_columns():
|
||||
}
|
||||
]
|
||||
|
||||
def check_opening_closing_has_negative_value(d, dr_or_cr, switch_to_column):
|
||||
# If opening debit has negetive value then move it to opening credit and vice versa.
|
||||
def prepare_opening_closing(row):
|
||||
dr_or_cr = "debit" if row["root_type"] in ["Asset", "Equity", "Expense"] else "credit"
|
||||
reverse_dr_or_cr = "credit" if dr_or_cr == "debit" else "debit"
|
||||
|
||||
if d[dr_or_cr] < 0:
|
||||
d[switch_to_column] = abs(d[dr_or_cr])
|
||||
d[dr_or_cr] = 0.0
|
||||
else:
|
||||
d[switch_to_column] = 0.0
|
||||
for col_type in ["opening", "closing"]:
|
||||
valid_col = col_type + "_" + dr_or_cr
|
||||
reverse_col = col_type + "_" + reverse_dr_or_cr
|
||||
row[valid_col] -= row[reverse_col]
|
||||
if row[valid_col] < 0:
|
||||
row[reverse_col] = abs(row[valid_col])
|
||||
row[valid_col] = 0.0
|
||||
else:
|
||||
row[reverse_col] = 0.0
|
||||
@@ -13,6 +13,10 @@ from six import iteritems
|
||||
# imported to enable erpnext.accounts.utils.get_account_currency
|
||||
from erpnext.accounts.doctype.account.account import get_account_currency
|
||||
|
||||
from erpnext.stock.utils import get_stock_value_on
|
||||
from erpnext.stock import get_warehouse_account_map
|
||||
|
||||
|
||||
class FiscalYearError(frappe.ValidationError): pass
|
||||
|
||||
@frappe.whitelist()
|
||||
@@ -84,7 +88,8 @@ def validate_fiscal_year(date, fiscal_year, company, label="Date", doc=None):
|
||||
throw(_("{0} '{1}' not in Fiscal Year {2}").format(label, formatdate(date), fiscal_year))
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_balance_on(account=None, date=None, party_type=None, party=None, company=None, in_account_currency=True, cost_center=None):
|
||||
def get_balance_on(account=None, date=None, party_type=None, party=None, company=None,
|
||||
in_account_currency=True, cost_center=None, ignore_account_permission=False):
|
||||
if not account and frappe.form_dict.get("account"):
|
||||
account = frappe.form_dict.get("account")
|
||||
if not date and frappe.form_dict.get("date"):
|
||||
@@ -140,7 +145,8 @@ def get_balance_on(account=None, date=None, party_type=None, party=None, company
|
||||
|
||||
if account:
|
||||
|
||||
if not frappe.flags.ignore_account_permission:
|
||||
if not (frappe.flags.ignore_account_permission
|
||||
or ignore_account_permission):
|
||||
acc.check_permission("read")
|
||||
|
||||
if report_type == 'Profit and Loss':
|
||||
@@ -558,23 +564,23 @@ def fix_total_debit_credit():
|
||||
(dr_or_cr, dr_or_cr, '%s', '%s', '%s', dr_or_cr),
|
||||
(d.diff, d.voucher_type, d.voucher_no))
|
||||
|
||||
def get_stock_and_account_difference(account_list=None, posting_date=None, company=None):
|
||||
from erpnext.stock.utils import get_stock_value_on
|
||||
from erpnext.stock import get_warehouse_account_map
|
||||
|
||||
def get_stock_and_account_balance(account=None, posting_date=None, company=None):
|
||||
if not posting_date: posting_date = nowdate()
|
||||
|
||||
difference = {}
|
||||
warehouse_account = get_warehouse_account_map(company)
|
||||
|
||||
for warehouse, account_data in iteritems(warehouse_account):
|
||||
if account_data.get('account') in account_list:
|
||||
account_balance = get_balance_on(account_data.get('account'), posting_date, in_account_currency=False)
|
||||
stock_value = get_stock_value_on(warehouse, posting_date)
|
||||
if abs(flt(stock_value) - flt(account_balance)) > 0.005:
|
||||
difference.setdefault(account_data.get('account'), flt(stock_value) - flt(account_balance))
|
||||
account_balance = get_balance_on(account, posting_date, in_account_currency=False)
|
||||
|
||||
return difference
|
||||
related_warehouses = [wh for wh, wh_details in warehouse_account.items()
|
||||
if wh_details.account == account and not wh_details.is_group]
|
||||
|
||||
total_stock_value = 0.0
|
||||
for warehouse in related_warehouses:
|
||||
value = get_stock_value_on(warehouse, posting_date)
|
||||
total_stock_value += value
|
||||
|
||||
precision = frappe.get_precision("Journal Entry Account", "debit_in_account_currency")
|
||||
return flt(account_balance, precision), flt(total_stock_value, precision), related_warehouses
|
||||
|
||||
def get_currency_precision():
|
||||
precision = cint(frappe.db.get_default("currency_precision"))
|
||||
@@ -624,7 +630,7 @@ def get_held_invoices(party_type, party):
|
||||
'select name from `tabPurchase Invoice` where release_date IS NOT NULL and release_date > CURDATE()',
|
||||
as_dict=1
|
||||
)
|
||||
held_invoices = [d['name'] for d in held_invoices]
|
||||
held_invoices = set([d['name'] for d in held_invoices])
|
||||
|
||||
return held_invoices
|
||||
|
||||
@@ -633,14 +639,19 @@ def get_outstanding_invoices(party_type, party, account, condition=None, filters
|
||||
outstanding_invoices = []
|
||||
precision = frappe.get_precision("Sales Invoice", "outstanding_amount") or 2
|
||||
|
||||
if erpnext.get_party_account_type(party_type) == 'Receivable':
|
||||
if account:
|
||||
root_type = frappe.get_cached_value("Account", account, "root_type")
|
||||
party_account_type = "Receivable" if root_type == "Asset" else "Payable"
|
||||
else:
|
||||
party_account_type = erpnext.get_party_account_type(party_type)
|
||||
|
||||
if party_account_type == 'Receivable':
|
||||
dr_or_cr = "debit_in_account_currency - credit_in_account_currency"
|
||||
payment_dr_or_cr = "credit_in_account_currency - debit_in_account_currency"
|
||||
else:
|
||||
dr_or_cr = "credit_in_account_currency - debit_in_account_currency"
|
||||
payment_dr_or_cr = "debit_in_account_currency - credit_in_account_currency"
|
||||
|
||||
invoice = 'Sales Invoice' if erpnext.get_party_account_type(party_type) == 'Receivable' else 'Purchase Invoice'
|
||||
held_invoices = get_held_invoices(party_type, party)
|
||||
|
||||
invoice_list = frappe.db.sql("""
|
||||
@@ -659,7 +670,6 @@ def get_outstanding_invoices(party_type, party, account, condition=None, filters
|
||||
group by voucher_type, voucher_no
|
||||
order by posting_date, name""".format(
|
||||
dr_or_cr=dr_or_cr,
|
||||
invoice = invoice,
|
||||
condition=condition or ""
|
||||
), {
|
||||
"party_type": party_type,
|
||||
|
||||
@@ -51,27 +51,25 @@ class CropCycle(Document):
|
||||
self.create_task(disease_doc.treatment_task, self.name, start_date)
|
||||
|
||||
def create_project(self, period, crop_tasks):
|
||||
project = frappe.new_doc("Project")
|
||||
project.update({
|
||||
project = frappe.get_doc({
|
||||
"doctype": "Project",
|
||||
"project_name": self.title,
|
||||
"expected_start_date": self.start_date,
|
||||
"expected_end_date": add_days(self.start_date, period - 1)
|
||||
})
|
||||
project.insert()
|
||||
}).insert()
|
||||
|
||||
return project.name
|
||||
|
||||
def create_task(self, crop_tasks, project_name, start_date):
|
||||
for crop_task in crop_tasks:
|
||||
task = frappe.new_doc("Task")
|
||||
task.update({
|
||||
frappe.get_doc({
|
||||
"doctype": "Task",
|
||||
"subject": crop_task.get("task_name"),
|
||||
"priority": crop_task.get("priority"),
|
||||
"project": project_name,
|
||||
"exp_start_date": add_days(start_date, crop_task.get("start_day") - 1),
|
||||
"exp_end_date": add_days(start_date, crop_task.get("end_day") - 1)
|
||||
})
|
||||
task.insert()
|
||||
}).insert()
|
||||
|
||||
def reload_linked_analysis(self):
|
||||
linked_doctypes = ['Soil Texture', 'Soil Analysis', 'Plant Analysis']
|
||||
|
||||
@@ -41,6 +41,39 @@ frappe.ui.form.on('Asset', {
|
||||
});
|
||||
},
|
||||
|
||||
setup: function(frm) {
|
||||
frm.make_methods = {
|
||||
'Asset Movement': () => {
|
||||
frappe.call({
|
||||
method: "erpnext.assets.doctype.asset.asset.make_asset_movement",
|
||||
freeze: true,
|
||||
args:{
|
||||
"assets": [{ name: cur_frm.doc.name }]
|
||||
},
|
||||
callback: function (r) {
|
||||
if (r.message) {
|
||||
var doc = frappe.model.sync(r.message)[0];
|
||||
frappe.set_route("Form", doc.doctype, doc.name);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
frm.set_query("purchase_receipt", (doc) => {
|
||||
return {
|
||||
query: "erpnext.controllers.queries.get_purchase_receipts",
|
||||
filters: { item_code: doc.item_code }
|
||||
}
|
||||
});
|
||||
frm.set_query("purchase_invoice", (doc) => {
|
||||
return {
|
||||
query: "erpnext.controllers.queries.get_purchase_invoices",
|
||||
filters: { item_code: doc.item_code }
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
refresh: function(frm) {
|
||||
frappe.ui.form.trigger("Asset", "is_existing_asset");
|
||||
frm.toggle_display("next_depreciation_date", frm.doc.docstatus < 1);
|
||||
@@ -78,11 +111,6 @@ frappe.ui.form.on('Asset', {
|
||||
});
|
||||
}
|
||||
|
||||
if (frm.doc.status=='Submitted' && !frm.doc.is_existing_asset && !frm.doc.purchase_invoice) {
|
||||
frm.add_custom_button(__("Purchase Invoice"), function() {
|
||||
frm.trigger("make_purchase_invoice");
|
||||
}, __('Create'));
|
||||
}
|
||||
if (frm.doc.maintenance_required && !frm.doc.maintenance_schedule) {
|
||||
frm.add_custom_button(__("Asset Maintenance"), function() {
|
||||
frm.trigger("create_asset_maintenance");
|
||||
@@ -104,11 +132,36 @@ frappe.ui.form.on('Asset', {
|
||||
frm.trigger("setup_chart");
|
||||
}
|
||||
|
||||
frm.trigger("toggle_reference_doc");
|
||||
|
||||
if (frm.doc.docstatus == 0) {
|
||||
frm.toggle_reqd("finance_books", frm.doc.calculate_depreciation);
|
||||
}
|
||||
},
|
||||
|
||||
toggle_reference_doc: function(frm) {
|
||||
if (frm.doc.purchase_receipt && frm.doc.purchase_invoice && frm.doc.docstatus === 1) {
|
||||
frm.set_df_property('purchase_invoice', 'read_only', 1);
|
||||
frm.set_df_property('purchase_receipt', 'read_only', 1);
|
||||
}
|
||||
else if (frm.doc.purchase_receipt) {
|
||||
// if purchase receipt link is set then set PI disabled
|
||||
frm.toggle_reqd('purchase_invoice', 0);
|
||||
frm.set_df_property('purchase_invoice', 'read_only', 1);
|
||||
}
|
||||
else if (frm.doc.purchase_invoice) {
|
||||
// if purchase invoice link is set then set PR disabled
|
||||
frm.toggle_reqd('purchase_receipt', 0);
|
||||
frm.set_df_property('purchase_receipt', 'read_only', 1);
|
||||
}
|
||||
else {
|
||||
frm.toggle_reqd('purchase_receipt', 1);
|
||||
frm.set_df_property('purchase_receipt', 'read_only', 0);
|
||||
frm.toggle_reqd('purchase_invoice', 1);
|
||||
frm.set_df_property('purchase_invoice', 'read_only', 0);
|
||||
}
|
||||
},
|
||||
|
||||
make_journal_entry: function(frm) {
|
||||
frappe.call({
|
||||
method: "erpnext.assets.doctype.asset.asset.make_journal_entry",
|
||||
@@ -176,21 +229,25 @@ frappe.ui.form.on('Asset', {
|
||||
|
||||
item_code: function(frm) {
|
||||
if(frm.doc.item_code) {
|
||||
frappe.call({
|
||||
method: "erpnext.assets.doctype.asset.asset.get_item_details",
|
||||
args: {
|
||||
item_code: frm.doc.item_code,
|
||||
asset_category: frm.doc.asset_category
|
||||
},
|
||||
callback: function(r, rt) {
|
||||
if(r.message) {
|
||||
frm.set_value('finance_books', r.message);
|
||||
}
|
||||
}
|
||||
})
|
||||
frm.trigger('set_finance_book');
|
||||
}
|
||||
},
|
||||
|
||||
set_finance_book: function(frm) {
|
||||
frappe.call({
|
||||
method: "erpnext.assets.doctype.asset.asset.get_item_details",
|
||||
args: {
|
||||
item_code: frm.doc.item_code,
|
||||
asset_category: frm.doc.asset_category
|
||||
},
|
||||
callback: function(r, rt) {
|
||||
if(r.message) {
|
||||
frm.set_value('finance_books', r.message);
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
available_for_use_date: function(frm) {
|
||||
$.each(frm.doc.finance_books || [], function(i, d) {
|
||||
if(!d.depreciation_start_date) d.depreciation_start_date = frm.doc.available_for_use_date;
|
||||
@@ -203,33 +260,18 @@ frappe.ui.form.on('Asset', {
|
||||
},
|
||||
|
||||
opening_accumulated_depreciation: function(frm) {
|
||||
erpnext.asset.set_accululated_depreciation(frm);
|
||||
erpnext.asset.set_accumulated_depreciation(frm);
|
||||
},
|
||||
|
||||
make_schedules_editable: function(frm) {
|
||||
var is_editable = frm.doc.finance_books.filter(d => d.depreciation_method == "Manual").length > 0
|
||||
? true : false;
|
||||
if (frm.doc.finance_books) {
|
||||
var is_editable = frm.doc.finance_books.filter(d => d.depreciation_method == "Manual").length > 0
|
||||
? true : false;
|
||||
|
||||
frm.toggle_enable("schedules", is_editable);
|
||||
frm.fields_dict["schedules"].grid.toggle_enable("schedule_date", is_editable);
|
||||
frm.fields_dict["schedules"].grid.toggle_enable("depreciation_amount", is_editable);
|
||||
},
|
||||
|
||||
make_purchase_invoice: function(frm) {
|
||||
frappe.call({
|
||||
args: {
|
||||
"asset": frm.doc.name,
|
||||
"item_code": frm.doc.item_code,
|
||||
"gross_purchase_amount": frm.doc.gross_purchase_amount,
|
||||
"company": frm.doc.company,
|
||||
"posting_date": frm.doc.purchase_date
|
||||
},
|
||||
method: "erpnext.assets.doctype.asset.asset.make_purchase_invoice",
|
||||
callback: function(r) {
|
||||
var doclist = frappe.model.sync(r.message);
|
||||
frappe.set_route("Form", doclist[0].doctype, doclist[0].name);
|
||||
}
|
||||
})
|
||||
frm.toggle_enable("schedules", is_editable);
|
||||
frm.fields_dict["schedules"].grid.toggle_enable("schedule_date", is_editable);
|
||||
frm.fields_dict["schedules"].grid.toggle_enable("depreciation_amount", is_editable);
|
||||
}
|
||||
},
|
||||
|
||||
make_sales_invoice: function(frm) {
|
||||
@@ -282,17 +324,6 @@ frappe.ui.form.on('Asset', {
|
||||
},
|
||||
|
||||
calculate_depreciation: function(frm) {
|
||||
frappe.db.get_value("Asset Settings", {'name':"Asset Settings"}, 'schedule_based_on_fiscal_year', (data) => {
|
||||
if (data.schedule_based_on_fiscal_year == 1) {
|
||||
frm.set_df_property("depreciation_method", "options", "\nStraight Line\nManual");
|
||||
frm.toggle_reqd("available_for_use_date", true);
|
||||
frm.toggle_display("frequency_of_depreciation", false);
|
||||
frappe.db.get_value("Fiscal Year", {'name': frappe.sys_defaults.fiscal_year}, "year_end_date", (data) => {
|
||||
frm.set_value("next_depreciation_date", data.year_end_date);
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
frm.toggle_reqd("finance_books", frm.doc.calculate_depreciation);
|
||||
},
|
||||
|
||||
@@ -302,6 +333,65 @@ frappe.ui.form.on('Asset', {
|
||||
})
|
||||
},
|
||||
|
||||
purchase_receipt: function(frm) {
|
||||
frm.trigger('toggle_reference_doc');
|
||||
|
||||
if (frm.doc.purchase_receipt) {
|
||||
if (frm.doc.item_code) {
|
||||
frappe.db.get_doc('Purchase Receipt', frm.doc.purchase_receipt).then(pr_doc => {
|
||||
frm.set_value('company', pr_doc.company);
|
||||
frm.set_value('purchase_date', pr_doc.posting_date);
|
||||
const item = pr_doc.items.find(item => item.item_code === frm.doc.item_code);
|
||||
if (!item) {
|
||||
frm.set_value('purchase_receipt', '');
|
||||
frappe.msgprint({
|
||||
title: __('Invalid Purchase Receipt'),
|
||||
message: __("The selected Purchase Receipt doesn't contains selected Asset Item."),
|
||||
indicator: 'red'
|
||||
});
|
||||
}
|
||||
frm.set_value('gross_purchase_amount', item.base_net_rate);
|
||||
frm.set_value('location', item.asset_location);
|
||||
});
|
||||
} else {
|
||||
frm.set_value('purchase_receipt', '');
|
||||
frappe.msgprint({
|
||||
title: __('Not Allowed'),
|
||||
message: __("Please select Item Code first")
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
purchase_invoice: function(frm) {
|
||||
frm.trigger('toggle_reference_doc');
|
||||
if (frm.doc.purchase_invoice) {
|
||||
if (frm.doc.item_code) {
|
||||
frappe.db.get_doc('Purchase Invoice', frm.doc.purchase_invoice).then(pi_doc => {
|
||||
frm.set_value('company', pi_doc.company);
|
||||
frm.set_value('purchase_date', pi_doc.posting_date);
|
||||
const item = pi_doc.items.find(item => item.item_code === frm.doc.item_code);
|
||||
if (!item) {
|
||||
frm.set_value('purchase_invoice', '');
|
||||
frappe.msgprint({
|
||||
title: __('Invalid Purchase Invoice'),
|
||||
message: __("The selected Purchase Invoice doesn't contains selected Asset Item."),
|
||||
indicator: 'red'
|
||||
});
|
||||
}
|
||||
frm.set_value('gross_purchase_amount', item.base_net_rate);
|
||||
frm.set_value('location', item.asset_location);
|
||||
});
|
||||
} else {
|
||||
frm.set_value('purchase_invoice', '');
|
||||
frappe.msgprint({
|
||||
title: __('Not Allowed'),
|
||||
message: __("Please select Item Code first")
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
set_depreciation_rate: function(frm, row) {
|
||||
if (row.total_number_of_depreciations && row.frequency_of_depreciation
|
||||
&& row.expected_value_after_useful_life) {
|
||||
@@ -371,12 +461,12 @@ frappe.ui.form.on('Depreciation Schedule', {
|
||||
},
|
||||
|
||||
depreciation_amount: function(frm, cdt, cdn) {
|
||||
erpnext.asset.set_accululated_depreciation(frm);
|
||||
erpnext.asset.set_accumulated_depreciation(frm);
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
erpnext.asset.set_accululated_depreciation = function(frm) {
|
||||
erpnext.asset.set_accumulated_depreciation = function(frm) {
|
||||
if(frm.doc.depreciation_method != "Manual") return;
|
||||
|
||||
var accumulated_depreciation = flt(frm.doc.opening_accumulated_depreciation);
|
||||
@@ -415,92 +505,19 @@ erpnext.asset.restore_asset = function(frm) {
|
||||
})
|
||||
};
|
||||
|
||||
erpnext.asset.transfer_asset = function(frm) {
|
||||
var dialog = new frappe.ui.Dialog({
|
||||
title: __("Transfer Asset"),
|
||||
fields: [
|
||||
{
|
||||
"label": __("Target Location"),
|
||||
"fieldname": "target_location",
|
||||
"fieldtype": "Link",
|
||||
"options": "Location",
|
||||
"get_query": function () {
|
||||
return {
|
||||
filters: [
|
||||
["Location", "is_group", "=", 0]
|
||||
]
|
||||
}
|
||||
},
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"label": __("Select Serial No"),
|
||||
"fieldname": "serial_nos",
|
||||
"fieldtype": "Link",
|
||||
"options": "Serial No",
|
||||
"get_query": function () {
|
||||
return {
|
||||
filters: {
|
||||
'asset': frm.doc.name
|
||||
}
|
||||
}
|
||||
},
|
||||
"onchange": function() {
|
||||
let val = this.get_value();
|
||||
if (val) {
|
||||
let serial_nos = dialog.get_value("serial_no") || val;
|
||||
if (serial_nos) {
|
||||
serial_nos = serial_nos.split('\n');
|
||||
serial_nos.push(val);
|
||||
|
||||
const unique_sn = serial_nos.filter(function(elem, index, self) {
|
||||
return index === self.indexOf(elem);
|
||||
});
|
||||
|
||||
dialog.set_value("serial_no", unique_sn.join('\n'));
|
||||
dialog.set_value("serial_nos", "");
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": __("Serial No"),
|
||||
"fieldname": "serial_no",
|
||||
"read_only": 1,
|
||||
"fieldtype": "Small Text"
|
||||
},
|
||||
{
|
||||
"label": __("Date"),
|
||||
"fieldname": "transfer_date",
|
||||
"fieldtype": "Datetime",
|
||||
"reqd": 1,
|
||||
"default": frappe.datetime.now_datetime()
|
||||
erpnext.asset.transfer_asset = function() {
|
||||
frappe.call({
|
||||
method: "erpnext.assets.doctype.asset.asset.make_asset_movement",
|
||||
freeze: true,
|
||||
args:{
|
||||
"assets": [{ name: cur_frm.doc.name }],
|
||||
"purpose": "Transfer"
|
||||
},
|
||||
callback: function (r) {
|
||||
if (r.message) {
|
||||
var doc = frappe.model.sync(r.message)[0];
|
||||
frappe.set_route("Form", doc.doctype, doc.name);
|
||||
}
|
||||
]
|
||||
}
|
||||
});
|
||||
|
||||
dialog.set_primary_action(__("Transfer"), function() {
|
||||
var args = dialog.get_values();
|
||||
if(!args) return;
|
||||
dialog.hide();
|
||||
return frappe.call({
|
||||
type: "GET",
|
||||
method: "erpnext.assets.doctype.asset.asset.transfer_asset",
|
||||
args: {
|
||||
args: {
|
||||
"asset": frm.doc.name,
|
||||
"transaction_date": args.transfer_date,
|
||||
"source_location": frm.doc.location,
|
||||
"target_location": args.target_location,
|
||||
"serial_no": args.serial_no,
|
||||
"company": frm.doc.company
|
||||
}
|
||||
},
|
||||
freeze: true,
|
||||
callback: function(r) {
|
||||
cur_frm.reload_doc();
|
||||
}
|
||||
})
|
||||
});
|
||||
dialog.show();
|
||||
};
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user