Compare commits
559 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eb7fea673b | ||
|
|
4b2692182a | ||
|
|
76f330ca66 | ||
|
|
2134d24b36 | ||
|
|
9d1e8640ef | ||
|
|
49e0a687b3 | ||
|
|
54106807e4 | ||
|
|
a8dbb0dd41 | ||
|
|
65e8676f8b | ||
|
|
5c81f9c44e | ||
|
|
7c932003ed | ||
|
|
c379c78fec | ||
|
|
09a9f4c0c9 | ||
|
|
ec621194fc | ||
|
|
c12ccdb6ea | ||
|
|
d8de921c40 | ||
|
|
73f0bf36c1 | ||
|
|
2e7ad8980c | ||
|
|
4541875c81 | ||
|
|
0fabc6a841 | ||
|
|
2a45e1cfd0 | ||
|
|
2d5727b17b | ||
|
|
b2c2fca8a5 | ||
|
|
9472247b6e | ||
|
|
ebdac5db5c | ||
|
|
7ea8528d50 | ||
|
|
74d0e40bdc | ||
|
|
2d57b0aa52 | ||
|
|
0c4ef64b32 | ||
|
|
e30511d315 | ||
|
|
64f2ccd9e1 | ||
|
|
6b12b07b33 | ||
|
|
f5794f1c07 | ||
|
|
8e4640f464 | ||
|
|
f976143063 | ||
|
|
177b86a15b | ||
|
|
e7e615cf18 | ||
|
|
13b93ebed8 | ||
|
|
3319170805 | ||
|
|
ed5f423e65 | ||
|
|
311079a311 | ||
|
|
08222150f2 | ||
|
|
7e8e8ba714 | ||
|
|
c65a0c7197 | ||
|
|
bc34f3edae | ||
|
|
615d342056 | ||
|
|
8462a7691b | ||
|
|
063141d152 | ||
|
|
fb21ce3893 | ||
|
|
1ee5675750 | ||
|
|
e9baaa68e7 | ||
|
|
901f4434fd | ||
|
|
0936ae6dca | ||
|
|
4362443b6e | ||
|
|
201dbbd977 | ||
|
|
a6628eee56 | ||
|
|
a1c96de9fc | ||
|
|
6fbda08583 | ||
|
|
cda83bba59 | ||
|
|
2f8d4451f5 | ||
|
|
0f2310690e | ||
|
|
33f36c3462 | ||
|
|
a08855a0de | ||
|
|
3197767650 | ||
|
|
28da7523be | ||
|
|
ce64afaa51 | ||
|
|
f5bb9ae1b1 | ||
|
|
22831563ff | ||
|
|
32f168617c | ||
|
|
74bbd24b1d | ||
|
|
9d1f077922 | ||
|
|
e0e3f92019 | ||
|
|
05b28eb161 | ||
|
|
36a4db69b8 | ||
|
|
da0a23e635 | ||
|
|
31affc0e67 | ||
|
|
d4f9af3498 | ||
|
|
ad9b4faa47 | ||
|
|
0240dc53ae | ||
|
|
ed20b68a3a | ||
|
|
86903e5f5b | ||
|
|
793ba6bd37 | ||
|
|
8ae051cb39 | ||
|
|
adeff27f28 | ||
|
|
9ea461638e | ||
|
|
989b60ae52 | ||
|
|
fc274e29ec | ||
|
|
d45f7d60c3 | ||
|
|
c1611abebf | ||
|
|
e0f6b3edbe | ||
|
|
a038831c45 | ||
|
|
36028bfb56 | ||
|
|
a87121c6da | ||
|
|
e219d61ed4 | ||
|
|
66b2717c54 | ||
|
|
eba1bdbcca | ||
|
|
139dc7b9b2 | ||
|
|
0aa71a5c41 | ||
|
|
5aecc538dd | ||
|
|
5f59726903 | ||
|
|
1eb560130a | ||
|
|
7979f7ed21 | ||
|
|
a7f757a3f4 | ||
|
|
777397489e | ||
|
|
436f526102 | ||
|
|
c28c86dfd8 | ||
|
|
9beffb646d | ||
|
|
f0d29be1d5 | ||
|
|
f2b7cd65a9 | ||
|
|
2735733d1f | ||
|
|
93fdc670fe | ||
|
|
40c5174aa0 | ||
|
|
0799b28e46 | ||
|
|
89a3ee7f57 | ||
|
|
347bf93b4f | ||
|
|
d7cc47e3ac | ||
|
|
1d7e933590 | ||
|
|
080b64a98f | ||
|
|
c4ec534b06 | ||
|
|
22ababbec1 | ||
|
|
17cb5b7799 | ||
|
|
e0c9dd3d23 | ||
|
|
41891ec95c | ||
|
|
dfc0072929 | ||
|
|
e1e5d675ac | ||
|
|
c4e92c6416 | ||
|
|
7c34f1c472 | ||
|
|
2c832addca | ||
|
|
c095cfa224 | ||
|
|
fbb10d37d3 | ||
|
|
7bb9c3f125 | ||
|
|
a03f654446 | ||
|
|
574c7e7c63 | ||
|
|
9294fc8e7e | ||
|
|
07d4c373f3 | ||
|
|
79499e3615 | ||
|
|
cc9bc95b25 | ||
|
|
ae763d7afa | ||
|
|
70e2a50f0f | ||
|
|
c22ff12951 | ||
|
|
1b8c158fdc | ||
|
|
4078ef8ef5 | ||
|
|
462740f72b | ||
|
|
c055ea6465 | ||
|
|
3decf4dbc5 | ||
|
|
4b41e420c0 | ||
|
|
2c545ef1ad | ||
|
|
c6b59ef082 | ||
|
|
dbbba659a8 | ||
|
|
3c3719fa9c | ||
|
|
a7af1d619e | ||
|
|
307fac8b78 | ||
|
|
18eb8c5f68 | ||
|
|
602fdc0000 | ||
|
|
f1c3537924 | ||
|
|
81578d2e77 | ||
|
|
8f674fe0fb | ||
|
|
abb3af7b30 | ||
|
|
cc008cc109 | ||
|
|
347889b233 | ||
|
|
8ed0268b9d | ||
|
|
fa799f7d81 | ||
|
|
23c28704d2 | ||
|
|
dd905fcaba | ||
|
|
53593c9c47 | ||
|
|
8612778136 | ||
|
|
9adcf85a14 | ||
|
|
d6d2193f91 | ||
|
|
bec11fa86e | ||
|
|
dfae0ea570 | ||
|
|
d7fb6dce89 | ||
|
|
759f9ee973 | ||
|
|
646d06ee9f | ||
|
|
7f80485070 | ||
|
|
45f0c25a6d | ||
|
|
c3211ab394 | ||
|
|
dc45153430 | ||
|
|
4e3b601990 | ||
|
|
b5be7bab9b | ||
|
|
8dc2c6a16c | ||
|
|
fe977289eb | ||
|
|
45b5b6d11f | ||
|
|
ec43e4dd33 | ||
|
|
c58b330673 | ||
|
|
5d976ca3ac | ||
|
|
fcb6b01e4e | ||
|
|
f2f17959ab | ||
|
|
e0a1039756 | ||
|
|
6448076143 | ||
|
|
3f657bcf51 | ||
|
|
4cdb79941b | ||
|
|
0ff32e73ba | ||
|
|
fe8db590a1 | ||
|
|
53f7ba26f6 | ||
|
|
937103f840 | ||
|
|
1969f9e1ac | ||
|
|
60fcce66f7 | ||
|
|
47fcc0310d | ||
|
|
7e676f3aae | ||
|
|
30aac9bbcf | ||
|
|
c2a5858143 | ||
|
|
879b3a0cbc | ||
|
|
ef0a0e8209 | ||
|
|
f7f20f624a | ||
|
|
b87e9f2651 | ||
|
|
b665d86292 | ||
|
|
4f7215662d | ||
|
|
db22657d93 | ||
|
|
24da761a17 | ||
|
|
115dcc09d4 | ||
|
|
990d7c4862 | ||
|
|
166024a23c | ||
|
|
3c4bb0c7c9 | ||
|
|
258191ab40 | ||
|
|
d66396abe3 | ||
|
|
2ced3b07d4 | ||
|
|
49dd7bee87 | ||
|
|
3b432dce88 | ||
|
|
21d324c597 | ||
|
|
a7ab20ec78 | ||
|
|
7c1976950d | ||
|
|
158200b209 | ||
|
|
a570cd66f7 | ||
|
|
d7f3d63a8e | ||
|
|
2e67426936 | ||
|
|
16f88ba3cd | ||
|
|
e31a41854b | ||
|
|
7349c191ab | ||
|
|
dc540dda4d | ||
|
|
4b97811941 | ||
|
|
5c494f79f3 | ||
|
|
191935bbf5 | ||
|
|
ffa4769b51 | ||
|
|
db4304914c | ||
|
|
db7901ec49 | ||
|
|
8c78a1abb7 | ||
|
|
8821541f33 | ||
|
|
5cec7ec84a | ||
|
|
9d5566634c | ||
|
|
86894f3bbf | ||
|
|
9536f112b5 | ||
|
|
44a40b860e | ||
|
|
b3d26c08f6 | ||
|
|
98d4622ed8 | ||
|
|
24b26db327 | ||
|
|
fa9fabaa49 | ||
|
|
49e8e783e3 | ||
|
|
1230e3a28b | ||
|
|
c4ee74857d | ||
|
|
3f8f4ff6cd | ||
|
|
cb39e0878e | ||
|
|
a4e0a1c061 | ||
|
|
fc13b87fd5 | ||
|
|
d9ba544e09 | ||
|
|
2fa914b410 | ||
|
|
e288e5238a | ||
|
|
7cbf5b4e67 | ||
|
|
44edfb7231 | ||
|
|
1cd96a136f | ||
|
|
af21479665 | ||
|
|
93eab5521c | ||
|
|
4ba95d0b7a | ||
|
|
5ae6a61c4d | ||
|
|
eec59ae7c4 | ||
|
|
efa9a7ed5b | ||
|
|
557abdebe0 | ||
|
|
8589b1db22 | ||
|
|
82a21beba0 | ||
|
|
256c4da0a5 | ||
|
|
7395dc9969 | ||
|
|
6a23cfa5cd | ||
|
|
d39bc09e62 | ||
|
|
c7676797e1 | ||
|
|
7460dcf406 | ||
|
|
423932fab2 | ||
|
|
efda5b0d36 | ||
|
|
13a9e27320 | ||
|
|
b0433d96a3 | ||
|
|
f3aba2e536 | ||
|
|
1594f102fd | ||
|
|
b2f2df4c64 | ||
|
|
9f6c48d82e | ||
|
|
f0307dc75e | ||
|
|
872e4d1f3d | ||
|
|
b164e606f9 | ||
|
|
806343395a | ||
|
|
afe93d633c | ||
|
|
cd20717c3d | ||
|
|
f96bcf943b | ||
|
|
9e056ec1ce | ||
|
|
cef681942f | ||
|
|
5c6d13a0df | ||
|
|
719f2803b3 | ||
|
|
dc15b4fa8a | ||
|
|
529709e08b | ||
|
|
e82eee512b | ||
|
|
ee0c623760 | ||
|
|
dbb4955483 | ||
|
|
ed87335513 | ||
|
|
8a4111fe0e | ||
|
|
4bfa8d560b | ||
|
|
96db41d996 | ||
|
|
9a74330d6f | ||
|
|
1951baca57 | ||
|
|
da08124df2 | ||
|
|
2aecc5a717 | ||
|
|
a37ffe162b | ||
|
|
bc99c9d6e0 | ||
|
|
f32314dd0b | ||
|
|
7e73f35916 | ||
|
|
e1e63a91d6 | ||
|
|
9a05aad8ea | ||
|
|
f6b77479d7 | ||
|
|
3c279163fc | ||
|
|
6933617538 | ||
|
|
2648661757 | ||
|
|
e31a97f355 | ||
|
|
6bdb73c392 | ||
|
|
deda7e2c75 | ||
|
|
5cdb8cea13 | ||
|
|
90a8c9e636 | ||
|
|
c0c951b6a9 | ||
|
|
39eb7faeb9 | ||
|
|
4829ad3eb8 | ||
|
|
a682d45846 | ||
|
|
76dd468f0e | ||
|
|
a6df26839d | ||
|
|
2a79b00700 | ||
|
|
6a749e3a8e | ||
|
|
c5d4fc38aa | ||
|
|
02f7e83bd1 | ||
|
|
f55d9414cd | ||
|
|
5644ed37a4 | ||
|
|
ee6200576a | ||
|
|
eeb8ba18cd | ||
|
|
3a19370892 | ||
|
|
6dc1ba6f7f | ||
|
|
d91af2853e | ||
|
|
d23ae108ae | ||
|
|
b9b6a6cea5 | ||
|
|
72f8ae2d5a | ||
|
|
1e347910d5 | ||
|
|
25cfb700bb | ||
|
|
8d2d4e82fd | ||
|
|
c43d58ac79 | ||
|
|
0b3c10601c | ||
|
|
14bf711d04 | ||
|
|
35a9d585b4 | ||
|
|
38e56eeb45 | ||
|
|
3dd1043d5e | ||
|
|
55387aa931 | ||
|
|
03463ef73b | ||
|
|
371663169c | ||
|
|
f3ded044e0 | ||
|
|
68b0d54b4b | ||
|
|
95e45574cb | ||
|
|
e4a71935eb | ||
|
|
3e846d19d4 | ||
|
|
5411ece766 | ||
|
|
aeb68b2899 | ||
|
|
0064dc6f4a | ||
|
|
11bf06ad76 | ||
|
|
5c6a2acff7 | ||
|
|
cdbd4218a8 | ||
|
|
701cddfb15 | ||
|
|
4bbf91bea1 | ||
|
|
e481e81e67 | ||
|
|
102b417b52 | ||
|
|
efc2a45835 | ||
|
|
5c119a7e95 | ||
|
|
f7a102ffe3 | ||
|
|
d659343541 | ||
|
|
dbf5e54eab | ||
|
|
5eb139a531 | ||
|
|
9e2358c544 | ||
|
|
8d0ef21911 | ||
|
|
9a8f37c579 | ||
|
|
029f698c65 | ||
|
|
806017c92a | ||
|
|
69951e5d1c | ||
|
|
10fd91c78e | ||
|
|
63d71d7f2f | ||
|
|
777bff6e8d | ||
|
|
1e42a3d028 | ||
|
|
da282d405f | ||
|
|
8f1bb82ab9 | ||
|
|
f2b46635b5 | ||
|
|
a11e14424c | ||
|
|
01441ef37f | ||
|
|
f6cf5e0f43 | ||
|
|
cb665285db | ||
|
|
6b66c387ad | ||
|
|
5e702de710 | ||
|
|
7e79f300a1 | ||
|
|
955902ccad | ||
|
|
b882fa14f4 | ||
|
|
d12d7142c6 | ||
|
|
42db5d76a9 | ||
|
|
5dd92fd5d6 | ||
|
|
bd4030bf85 | ||
|
|
a83337a2dd | ||
|
|
e51e5238ec | ||
|
|
5d5fe5d9d5 | ||
|
|
e27717261d | ||
|
|
57738a0ff3 | ||
|
|
b476c989a4 | ||
|
|
7f0406f281 | ||
|
|
33f6b9d6e8 | ||
|
|
c196037cb0 | ||
|
|
866103bf66 | ||
|
|
528eb4e4ff | ||
|
|
481454298d | ||
|
|
8a0b7cece1 | ||
|
|
b4eba77f7b | ||
|
|
b0a9581e59 | ||
|
|
6472bdace2 | ||
|
|
c95b9f9221 | ||
|
|
a4db83a934 | ||
|
|
28acaeb345 | ||
|
|
5c96b75a68 | ||
|
|
064d2ba16a | ||
|
|
5fbb757c2c | ||
|
|
df07c964f7 | ||
|
|
0e2a088ac4 | ||
|
|
ffc2f8885b | ||
|
|
a1ffacaf0b | ||
|
|
b09d9dabc5 | ||
|
|
06720dfb90 | ||
|
|
a2e0a9b05f | ||
|
|
3f7e2729bb | ||
|
|
6260b58a0a | ||
|
|
2511aa2b14 | ||
|
|
9a4a13cb73 | ||
|
|
139aa71666 | ||
|
|
d3f04d754a | ||
|
|
432b86344e | ||
|
|
8c52258e6d | ||
|
|
ffe8af3f2f | ||
|
|
fe5728718f | ||
|
|
424b4a4b36 | ||
|
|
2a3d7e660f | ||
|
|
a0a43ca4e4 | ||
|
|
9cd9836e18 | ||
|
|
39a3f50732 | ||
|
|
ba7221c332 | ||
|
|
6a45588a2c | ||
|
|
ab9d755e4d | ||
|
|
1cf8bd8767 | ||
|
|
829eda47a8 | ||
|
|
0663ec4a9c | ||
|
|
61bf425935 | ||
|
|
d203aea7c2 | ||
|
|
a4f99428d7 | ||
|
|
e761fe89e2 | ||
|
|
d51f805b78 | ||
|
|
c4a0ed63ef | ||
|
|
31ccf9a80b | ||
|
|
4ac68952e8 | ||
|
|
e7fc25d6a8 | ||
|
|
0527a393aa | ||
|
|
2b1d8854d5 | ||
|
|
8e332ffd16 | ||
|
|
3ab9f24a12 | ||
|
|
13fa595282 | ||
|
|
aebb844da9 | ||
|
|
7334bea3c2 | ||
|
|
caa4380d49 | ||
|
|
54047780fc | ||
|
|
c53dbc7cdf | ||
|
|
4b6b377134 | ||
|
|
df200f305b | ||
|
|
9a064e9ced | ||
|
|
9dc1b00d87 | ||
|
|
63aa5fd673 | ||
|
|
3c68488873 | ||
|
|
30fb30cffb | ||
|
|
9373ba96d5 | ||
|
|
a402079cd4 | ||
|
|
2ca388b0a5 | ||
|
|
f437e867fd | ||
|
|
6ebcc5c006 | ||
|
|
6a2edee914 | ||
|
|
de69ad0a48 | ||
|
|
25a4bd02f4 | ||
|
|
a3d058938e | ||
|
|
4cae8a0d54 | ||
|
|
454b6f9f8a | ||
|
|
9f1b59dfc6 | ||
|
|
2926651e1c | ||
|
|
9b67f4344b | ||
|
|
68852f25b5 | ||
|
|
8a436500f0 | ||
|
|
2298d59b8b | ||
|
|
620145c59a | ||
|
|
bcf2422848 | ||
|
|
83638b5f05 | ||
|
|
57518fc5f1 | ||
|
|
fea93d0f65 | ||
|
|
b1ea6b1f66 | ||
|
|
497d363fc1 | ||
|
|
74f64b67db | ||
|
|
2117afba07 | ||
|
|
e409d0d70b | ||
|
|
50125b35d2 | ||
|
|
c38527ef5f | ||
|
|
facde47c6c | ||
|
|
20dc79ac99 | ||
|
|
61da43f793 | ||
|
|
af30c3fdfd | ||
|
|
b63d550a70 | ||
|
|
b09dc46e68 | ||
|
|
68888a21ec | ||
|
|
7d7661c9ed | ||
|
|
fbda00eef0 | ||
|
|
a0212d8014 | ||
|
|
c8d2604afc | ||
|
|
861453279d | ||
|
|
be96600c1c | ||
|
|
8709c51e84 | ||
|
|
6fc0262cb6 | ||
|
|
4b5ced03ec | ||
|
|
a888e29b0a | ||
|
|
ae2e8996b0 | ||
|
|
1c2bbd77a0 | ||
|
|
2ffba327ac | ||
|
|
4764f3ea1d | ||
|
|
104deeebb5 | ||
|
|
2a9e4e9a32 | ||
|
|
2b08985e16 | ||
|
|
a38a7b8e76 | ||
|
|
88eedb7397 | ||
|
|
605cc93c90 | ||
|
|
1644fce273 | ||
|
|
8cc2bf7fcf | ||
|
|
fe6409debf | ||
|
|
edc58619d1 | ||
|
|
85800fa929 | ||
|
|
60ec0128a2 | ||
|
|
90e0700e24 | ||
|
|
48156e3d8b | ||
|
|
8b353e5e15 | ||
|
|
fcbd4d7638 | ||
|
|
9409efe02a | ||
|
|
b645a217fd | ||
|
|
ef295d2977 | ||
|
|
2d0e31b479 | ||
|
|
2678ed181a | ||
|
|
1fce0b1f79 | ||
|
|
91e9822f65 | ||
|
|
c652a6254f | ||
|
|
30430796c7 | ||
|
|
6de403f2be | ||
|
|
1f84799f2d | ||
|
|
d2dd83c3a3 | ||
|
|
1b23208779 | ||
|
|
39bb8e2ed4 | ||
|
|
e460aa277b | ||
|
|
b234a3545a | ||
|
|
afea58b7a1 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -5,3 +5,5 @@ conf.py
|
||||
locale
|
||||
latest_updates.json
|
||||
.wnf-lang-status
|
||||
*.egg-info
|
||||
dist/
|
||||
|
||||
23
.travis.yml
Normal file
23
.travis.yml
Normal file
@@ -0,0 +1,23 @@
|
||||
language: python
|
||||
|
||||
python:
|
||||
- "2.7"
|
||||
|
||||
services:
|
||||
- mysql
|
||||
|
||||
install:
|
||||
- CFLAGS=-O0 pip install git+https://github.com/frappe/frappe.git@develop &&
|
||||
- pip install --editable .
|
||||
|
||||
script:
|
||||
cd ./test_sites/ &&
|
||||
frappe --reinstall test_site &&
|
||||
frappe --install_app erpnext test_site &&
|
||||
frappe --request '?cmd=erpnext.setup.page.setup_wizard.setup_wizard.setup_account¤cy=USD&first_name=Test&last_name=User&company_name=Wind+Power+LLC&timezone=America/New_York&company_abbr=WP&industry=Manufacturing&country=United states&fy_start_date=2014-01-01&fy_end_date=2014-12-31' test_site &&
|
||||
frappe --run_tests test_site --app erpnext
|
||||
|
||||
before_script:
|
||||
- mysql -e 'create database travis' &&
|
||||
- echo "USE mysql;\nUPDATE user SET password=PASSWORD('travis') WHERE user='travis';\nFLUSH PRIVILEGES;\n" | mysql -u root
|
||||
|
||||
18
MANIFEST.in
Normal file
18
MANIFEST.in
Normal file
@@ -0,0 +1,18 @@
|
||||
include MANIFEST.in
|
||||
include requirements.txt
|
||||
include *.json
|
||||
include *.md
|
||||
include *.py
|
||||
include *.txt
|
||||
recursive-include erpnext *.css
|
||||
recursive-include erpnext *.csv
|
||||
recursive-include erpnext *.html
|
||||
recursive-include erpnext *.ico
|
||||
recursive-include erpnext *.js
|
||||
recursive-include erpnext *.json
|
||||
recursive-include erpnext *.md
|
||||
recursive-include erpnext *.png
|
||||
recursive-include erpnext *.py
|
||||
recursive-include erpnext *.svg
|
||||
recursive-include erpnext *.txt
|
||||
recursive-exclude * *.pyc
|
||||
31
README.md
31
README.md
@@ -1,10 +1,10 @@
|
||||
# ERPNext - Open Source ERP for small, medium sized businesses
|
||||
# ERPNext - Open Source ERP for small, medium sized businesses [](https://travis-ci.org/frappe/erpnext)
|
||||
|
||||
[https://erpnext.com](https://erpnext.com)
|
||||
|
||||
Includes Accounting, Inventory, CRM, Sales, Purchase, Projects, HRMS. Built on Python / MySQL.
|
||||
|
||||
ERPNext is built on [wnframework](https://github.com/webnotes/wnframework)
|
||||
ERPNext is built on [frappe](https://github.com/frappe/frappe)
|
||||
|
||||
- [User Guide](http://erpnext.org/user-guide.html)
|
||||
- [Getting Help](http://erpnext.org/getting-help.html)
|
||||
@@ -13,29 +13,22 @@ ERPNext is built on [wnframework](https://github.com/webnotes/wnframework)
|
||||
|
||||
---
|
||||
|
||||
### Development install
|
||||
|
||||
Use the bench, https://github.com/frappe/frappe-bench.
|
||||
|
||||
### Admin Login
|
||||
|
||||
1. go to "/login"
|
||||
1. Administrator user name: "Administrator"
|
||||
1. Administrator passowrd "admin"
|
||||
|
||||
### Download and Install
|
||||
|
||||
##### Virtual Image:
|
||||
|
||||
- [ERPNext Download](http://erpnext.com/erpnext-download)
|
||||
|
||||
##### On Linux:
|
||||
|
||||
1. Switch to root user using `sudo su`
|
||||
1. create a folder where you want to install erpnext
|
||||
1. go to the new folder
|
||||
1. `wget https://raw.github.com/webnotes/erpnext/master/install_erpnext.py`
|
||||
1. `python install_erpnext.py`
|
||||
|
||||
[See installation notes](https://github.com/webnotes/erpnext/wiki/How-to-Install-ERPNext)
|
||||
|
||||
##### Patch and update
|
||||
|
||||
To patch and update from the latest git repository the erpnext folder and run.
|
||||
You will have to set your origin in git remote
|
||||
|
||||
$ lib/wnf.py --update origin master
|
||||
|
||||
---
|
||||
|
||||
## License
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
[
|
||||
{
|
||||
"creation": "2011-12-21 11:08:55",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-09-13 17:17:47",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
{
|
||||
"doc_type": "Sales Invoice",
|
||||
"doctype": "Print Format",
|
||||
"html": "<html>\n<head>\n<!--Item Table, Totals and Other Charges-->\n<script>\nfunction get_print_format() {\n var oc = getchildren('Sales Invoice Item', doc.name, 'entries');\n\tvar rows = '<table width=\"100%\" cellpadding=\"0\" class=\"cart\">\\\n <tr>\\\n <td colspan=\"3\"><hr></td>\\\n </tr>\\\n <tr>\\\n <td width=\"60%\" align=\"left\">ITEM NAME.</td>\\\n <td width=\"10%\" align=\"right\">QTY</td>\\\n <td width=\"30%\" align=\"right\">AMOUNT</td>\\\n </tr>\\\n <tr>\\\n <td colspan=\"3\"><hr></td>\\\n </tr>';\n\tfor (var x=0; x<oc.length; x++) {\n console.log(oc[x].item_code!=oc[x].item_name);\n\t\trows += '<tr>\\\n <td align=\"left\">' + oc[x].item_code + \n (oc[x].item_code!=oc[x].item_name ? ('<br>' + oc[x].item_name) : '') + '</td>\\\n <td align=\"right\" style=\"vertical-align:top;\">' + oc[x].qty + '</td>\\\n <td align=\"right\" valign=\"top\">' + format_currency(oc[x].export_amount, doc.currency) + '</td>\\\n </tr>';\n\t}\n rows += '<tr>\\\n <td colspan=\"3\"><hr></td>\\\n </tr>\\\n <tr>\\\n <td colspan=\"2\" align=\"right\">Net Total</td>\\\n <td align=\"right\">' + format_currency(doc.net_total_export, doc.currency) + '</td>\\\n </tr>';\n if (doc.other_charges_total_export != 0) {\n var taxes = wn.model.get_children(\"Sales Taxes and Charges\", doc.name, \"other_charges\", \"Sales Invoice\");\n\t\t$.each(taxes, function(i, d) {\n\t\t\trows += '<tr>\\\n \t\t\t\t<td colspan=\"2\" align=\"right\">' + d.description + '</td>\\\n \t\t\t\t<td style=\"text-align: right;\">' + format_currency(d.tax_amount / doc.conversion_rate, doc.currency) + '</td>\\\n \t\t\t<tr>';\n\t\t});\n }\n rows += '<tr>\\\n <td colspan=\"2\" align=\"right\" style=\"vertical-align:middle;\">Grand Total</td>\\\n <td align=\"right\"><hr width=\"90%\" align=\"right\">' + format_currency(doc.grand_total_export, doc.currency) + '<br>\\\n <hr width=\"90%\" align=\"right\"></td>\\\n </tr>\\\n <tr>\\\n <td align=\"center\" colspan=\"3\">Thank You. Please visit again.</td>\\\n </tr>\\\n </table>';\n\treturn rows;\n}\n</script>\n<style>\n table, tr, td, div, p {\n font-family: Monospace;\n line-height: 200%;\n }\n h1, h2, h3, h4, h5, h6 {\n text-align: center;\n }\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 4in;\n\t\t}\n\t}\n</style>\n</head>\n\n<body>\n<table width=\"100%\" cellpadding=\"4\">\n <tr>\n <td align=\"left\">RECEIPT NO: <script>doc.name</script></td>\n <td align=\"right\">DATE: <script>date.str_to_user(doc.posting_date)</script></td>\n </tr>\n <tr>\n <td>M/s <script>doc.customer</script></td>\n </tr>\n</table>\n<!--Item Table & Totals-->\n<div><script>get_print_format();</script></div>\n</body>\n</html>\n",
|
||||
"module": "Accounts",
|
||||
"name": "__common__",
|
||||
"print_format_type": "Client",
|
||||
"standard": "Yes"
|
||||
},
|
||||
{
|
||||
"doctype": "Print Format",
|
||||
"name": "POS Invoice"
|
||||
}
|
||||
]
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,21 +0,0 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
# For license information, please see license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
from webnotes.utils import cint, cstr
|
||||
from webnotes import msgprint, _
|
||||
|
||||
class DocType:
|
||||
def __init__(self, d, dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
|
||||
def on_update(self):
|
||||
webnotes.conn.set_default("auto_accounting_for_stock", self.doc.auto_accounting_for_stock)
|
||||
|
||||
if self.doc.auto_accounting_for_stock:
|
||||
for wh in webnotes.conn.sql("select name from `tabWarehouse`"):
|
||||
wh_bean = webnotes.bean("Warehouse", wh[0])
|
||||
wh_bean.save()
|
||||
@@ -1,182 +0,0 @@
|
||||
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
// License: GNU General Public License v3. See license.txt
|
||||
|
||||
//
|
||||
|
||||
//--------- ONLOAD -------------
|
||||
wn.require("app/js/controllers/accounts.js");
|
||||
|
||||
cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
||||
|
||||
}
|
||||
|
||||
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
||||
cur_frm.set_footnote(wn.markdown(cur_frm.meta.description));
|
||||
}
|
||||
|
||||
// For customizing print
|
||||
cur_frm.pformat.net_total_import = function(doc) {
|
||||
return '';
|
||||
}
|
||||
|
||||
cur_frm.pformat.grand_total_import = function(doc) {
|
||||
return '';
|
||||
}
|
||||
|
||||
cur_frm.pformat.in_words_import = function(doc) {
|
||||
return '';
|
||||
}
|
||||
|
||||
cur_frm.pformat.purchase_tax_details= function(doc){
|
||||
|
||||
//function to make row of table
|
||||
var make_row = function(title,val,bold){
|
||||
var bstart = '<b>'; var bend = '</b>';
|
||||
return '<tr><td style="width:50%;">'+(bold?bstart:'')+title+(bold?bend:'')+'</td>'
|
||||
+'<td style="width:25%;text-align:right;"></td>'
|
||||
+'<td style="width:25%;text-align:right;">'+format_currency(val, doc.currency)+'</td>'
|
||||
+'</tr>'
|
||||
}
|
||||
|
||||
function convert_rate(val){
|
||||
var new_val = flt(val)/flt(doc.conversion_rate);
|
||||
return new_val;
|
||||
}
|
||||
|
||||
function print_hide(fieldname) {
|
||||
var doc_field = wn.meta.get_docfield(doc.doctype, fieldname, doc.name);
|
||||
return doc_field.print_hide;
|
||||
}
|
||||
|
||||
var cl = getchildren('Purchase Taxes and Charges',doc.name,'purchase_tax_details');
|
||||
|
||||
// outer table
|
||||
var out='<div><table class="noborder" style="width:100%">\
|
||||
<tr><td style="width: 60%"></td><td>';
|
||||
|
||||
// main table
|
||||
out +='<table class="noborder" style="width:100%">';
|
||||
if(!print_hide('net_total_import')) {
|
||||
out += make_row('Net Total', doc.net_total_import, 1);
|
||||
}
|
||||
|
||||
// add rows
|
||||
if(cl.length){
|
||||
for(var i=0;i<cl.length;i++){
|
||||
out += make_row(cl[i].description,convert_rate(cl[i].tax_amount),0);
|
||||
}
|
||||
}
|
||||
// grand total
|
||||
if(!print_hide('grand_total_import')) {
|
||||
out += make_row('Grand Total', doc.grand_total_import, 1);
|
||||
}
|
||||
if(doc.in_words_import && !print_hide('in_words_import')){
|
||||
out +='</table></td></tr>';
|
||||
out += '<tr><td colspan = "2">';
|
||||
out += '<table><tr><td style="width:25%;"><b>In Words</b></td>';
|
||||
out+= '<td style="width:50%;">'+doc.in_words_import+'</td></tr>';
|
||||
}
|
||||
out +='</table></td></tr></table></div>';
|
||||
return out;
|
||||
}
|
||||
|
||||
cur_frm.cscript.add_deduct_tax = function(doc, cdt, cdn) {
|
||||
var d = locals[cdt][cdn];
|
||||
if(!d.category && d.add_deduct_tax){
|
||||
alert(wn._("Please select Category first"));
|
||||
d.add_deduct_tax = '';
|
||||
}
|
||||
else if(d.category != 'Total' && d.add_deduct_tax == 'Deduct') {
|
||||
console.log([d.category, d.add_deduct_tax]);
|
||||
msgprint(wn._("You cannot deduct when category is for 'Valuation' or 'Valuation and Total'"));
|
||||
d.add_deduct_tax = '';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
cur_frm.cscript.charge_type = function(doc, cdt, cdn) {
|
||||
var d = locals[cdt][cdn];
|
||||
if(!d.category && d.charge_type){
|
||||
alert(wn._("Please select Category first"));
|
||||
d.charge_type = '';
|
||||
}
|
||||
else if(d.idx == 1 && (d.charge_type == 'On Previous Row Amount' || d.charge_type == 'On Previous Row Total')){
|
||||
alert(wn._("You cannot select Charge Type as 'On Previous Row Amount' or 'On Previous Row Total' for first row"));
|
||||
d.charge_type = '';
|
||||
}
|
||||
else if((d.category == 'Valuation' || d.category == 'Valuation and Total') && (d.charge_type == 'On Previous Row Amount' || d.charge_type == 'On Previous Row Total')){
|
||||
alert(wn._("You cannot select charge type as 'On Previous Row Amount' or 'On Previous Row Total' for valuation. You can select only 'Total' option for previous row amount or previous row total"))
|
||||
d.charge_type = '';
|
||||
}
|
||||
validated = false;
|
||||
refresh_field('charge_type',d.name,'purchase_tax_details');
|
||||
|
||||
cur_frm.cscript.row_id(doc, cdt, cdn);
|
||||
cur_frm.cscript.rate(doc, cdt, cdn);
|
||||
cur_frm.cscript.tax_amount(doc, cdt, cdn);
|
||||
}
|
||||
|
||||
|
||||
cur_frm.cscript.row_id = function(doc, cdt, cdn) {
|
||||
var d = locals[cdt][cdn];
|
||||
if(!d.charge_type && d.row_id){
|
||||
alert(wn._("Please select Charge Type first"));
|
||||
d.row_id = '';
|
||||
}
|
||||
else if((d.charge_type == 'Actual' || d.charge_type == 'On Net Total') && d.row_id) {
|
||||
alert(wn._("You can Enter Row only if your Charge Type is 'On Previous Row Amount' or ' Previous Row Total'"));
|
||||
d.row_id = '';
|
||||
}
|
||||
else if((d.charge_type == 'On Previous Row Amount' || d.charge_type == 'On Previous Row Total') && d.row_id){
|
||||
if(d.row_id >= d.idx){
|
||||
alert(wn._("You cannot Enter Row no. greater than or equal to current row no. for this Charge type"));
|
||||
d.row_id = '';
|
||||
}
|
||||
}
|
||||
validated = false;
|
||||
refresh_field('row_id',d.name,'purchase_tax_details');
|
||||
}
|
||||
|
||||
cur_frm.set_query("account_head", "purchase_tax_details", function(doc) {
|
||||
return {
|
||||
query: "controllers.queries.tax_account_query",
|
||||
filters: {
|
||||
"account_type": ["Tax", "Chargeable", "Expense Account"],
|
||||
"debit_or_credit": "Debit",
|
||||
"company": doc.company
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
cur_frm.fields_dict['purchase_tax_details'].grid.get_field("cost_center").get_query = function(doc) {
|
||||
return {
|
||||
filters: {
|
||||
'company': doc.company,
|
||||
'group_or_ledger': "Ledger"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.cscript.rate = function(doc, cdt, cdn) {
|
||||
var d = locals[cdt][cdn];
|
||||
if(!d.charge_type && d.rate) {
|
||||
alert(wn._("Please select Charge Type first"));
|
||||
d.rate = '';
|
||||
}
|
||||
validated = false;
|
||||
refresh_field('rate',d.name,'purchase_tax_details');
|
||||
}
|
||||
|
||||
cur_frm.cscript.tax_amount = function(doc, cdt, cdn) {
|
||||
var d = locals[cdt][cdn];
|
||||
if(!d.charge_type && d.tax_amount){
|
||||
alert(wn._("Please select Charge Type first"));
|
||||
d.tax_amount = '';
|
||||
}
|
||||
else if(d.charge_type && d.tax_amount) {
|
||||
alert(wn._("You cannot directly enter Amount and if your Charge Type is Actual enter your amount in Rate"));
|
||||
d.tax_amount = '';
|
||||
}
|
||||
validated = false;
|
||||
refresh_field('tax_amount',d.name,'purchase_tax_details');
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
{% extends "app/portal/templates/sale.html" %}
|
||||
|
||||
{% block status -%}
|
||||
{% if doc.status %}{{ doc.status }}{% endif %}
|
||||
{%- endblock %}
|
||||
@@ -1,30 +0,0 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
from webnotes import _
|
||||
from webnotes.utils import flt, fmt_money
|
||||
|
||||
no_cache = True
|
||||
|
||||
def get_context():
|
||||
from portal.utils import get_transaction_context
|
||||
context = get_transaction_context("Sales Invoice", webnotes.form_dict.name)
|
||||
modify_status(context.get("doc"))
|
||||
context.update({
|
||||
"parent_link": "invoices",
|
||||
"parent_title": "Invoices"
|
||||
})
|
||||
return context
|
||||
|
||||
def modify_status(doc):
|
||||
doc.status = ""
|
||||
if flt(doc.outstanding_amount):
|
||||
doc.status = '<span class="label %s"><i class="icon-fixed-width %s"></i> %s</span>' % \
|
||||
("label-warning", "icon-exclamation-sign",
|
||||
_("To Pay") + " = " + fmt_money(doc.outstanding_amount, currency=doc.currency))
|
||||
else:
|
||||
doc.status = '<span class="label %s"><i class="icon-fixed-width %s"></i> %s</span>' % \
|
||||
("label-success", "icon-ok", _("Paid"))
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
{% extends "app/portal/templates/sales_transactions.html" %}
|
||||
@@ -1,28 +0,0 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
no_cache = True
|
||||
|
||||
def get_context():
|
||||
from portal.utils import get_currency_context
|
||||
context = get_currency_context()
|
||||
context.update({
|
||||
"title": "Invoices",
|
||||
"method": "accounts.doctype.sales_invoice.templates.pages.invoices.get_invoices",
|
||||
"icon": "icon-file-text",
|
||||
"empty_list_message": "No Invoices Found",
|
||||
"page": "invoice"
|
||||
})
|
||||
return context
|
||||
|
||||
@webnotes.whitelist()
|
||||
def get_invoices(start=0):
|
||||
from portal.utils import get_transaction_list
|
||||
from accounts.doctype.sales_invoice.templates.pages.invoice import modify_status
|
||||
invoices = get_transaction_list("Sales Invoice", start, ["outstanding_amount"])
|
||||
for d in invoices:
|
||||
modify_status(d)
|
||||
return invoices
|
||||
@@ -1,22 +0,0 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
from webnotes.utils import cint
|
||||
from webnotes.model.controller import DocListController
|
||||
|
||||
class DocType(DocListController):
|
||||
def validate(self):
|
||||
if self.doc.is_default == 1:
|
||||
webnotes.conn.sql("""update `tabSales Taxes and Charges Master` set is_default = 0
|
||||
where ifnull(is_default,0) = 1 and name != %s and company = %s""",
|
||||
(self.doc.name, self.doc.company))
|
||||
|
||||
# at least one territory
|
||||
self.validate_table_has_rows("valid_for_territories")
|
||||
|
||||
def on_update(self):
|
||||
cart_settings = webnotes.get_obj("Shopping Cart Settings")
|
||||
if cint(cart_settings.doc.enabled):
|
||||
cart_settings.validate_tax_masters()
|
||||
@@ -1,70 +0,0 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
import webnotes
|
||||
import unittest
|
||||
from accounts.doctype.shipping_rule.shipping_rule import FromGreaterThanToError, ManyBlankToValuesError, OverlappingConditionError
|
||||
|
||||
class TestShippingRule(unittest.TestCase):
|
||||
def test_from_greater_than_to(self):
|
||||
shipping_rule = webnotes.bean(copy=test_records[0])
|
||||
shipping_rule.doclist[1].from_value = 101
|
||||
self.assertRaises(FromGreaterThanToError, shipping_rule.insert)
|
||||
|
||||
def test_many_zero_to_values(self):
|
||||
shipping_rule = webnotes.bean(copy=test_records[0])
|
||||
shipping_rule.doclist[1].to_value = 0
|
||||
self.assertRaises(ManyBlankToValuesError, shipping_rule.insert)
|
||||
|
||||
def test_overlapping_conditions(self):
|
||||
for range_a, range_b in [
|
||||
((50, 150), (0, 100)),
|
||||
((50, 150), (100, 200)),
|
||||
((50, 150), (75, 125)),
|
||||
((50, 150), (25, 175)),
|
||||
((50, 150), (50, 150)),
|
||||
]:
|
||||
shipping_rule = webnotes.bean(copy=test_records[0])
|
||||
shipping_rule.doclist[1].from_value = range_a[0]
|
||||
shipping_rule.doclist[1].to_value = range_a[1]
|
||||
shipping_rule.doclist[2].from_value = range_b[0]
|
||||
shipping_rule.doclist[2].to_value = range_b[1]
|
||||
self.assertRaises(OverlappingConditionError, shipping_rule.insert)
|
||||
|
||||
test_records = [
|
||||
[
|
||||
{
|
||||
"doctype": "Shipping Rule",
|
||||
"label": "_Test Shipping Rule",
|
||||
"calculate_based_on": "Net Total",
|
||||
"company": "_Test Company",
|
||||
"account": "_Test Account Shipping Charges - _TC",
|
||||
"cost_center": "_Test Cost Center - _TC"
|
||||
},
|
||||
{
|
||||
"doctype": "Shipping Rule Condition",
|
||||
"parentfield": "shipping_rule_conditions",
|
||||
"from_value": 0,
|
||||
"to_value": 100,
|
||||
"shipping_amount": 50.0
|
||||
},
|
||||
{
|
||||
"doctype": "Shipping Rule Condition",
|
||||
"parentfield": "shipping_rule_conditions",
|
||||
"from_value": 101,
|
||||
"to_value": 200,
|
||||
"shipping_amount": 100.0
|
||||
},
|
||||
{
|
||||
"doctype": "Shipping Rule Condition",
|
||||
"parentfield": "shipping_rule_conditions",
|
||||
"from_value": 201,
|
||||
"shipping_amount": 0.0
|
||||
},
|
||||
{
|
||||
"doctype": "Applicable Territory",
|
||||
"parentfield": "valid_for_territories",
|
||||
"territory": "_Test Territory"
|
||||
}
|
||||
]
|
||||
]
|
||||
@@ -1,29 +0,0 @@
|
||||
select.accbrowser-company-select {
|
||||
width: 200px;
|
||||
margin-top: 2px;
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
span.tree-node-toolbar {
|
||||
padding: 2px;
|
||||
margin-left: 15px;
|
||||
border-radius: 3px;
|
||||
-moz-border-radius: 3px;
|
||||
-webkit-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
background-color: #ddd;
|
||||
}
|
||||
|
||||
.tree-area a.selected {
|
||||
font-weight: bold;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
span.balance-area {
|
||||
float: right;
|
||||
height: 13px;
|
||||
}
|
||||
|
||||
span.balance-bold {
|
||||
font-weight: bold;
|
||||
}
|
||||
@@ -1,321 +0,0 @@
|
||||
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
// License: GNU General Public License v3. See license.txt
|
||||
|
||||
// tree of chart of accounts / cost centers
|
||||
// multiple companies
|
||||
// add node
|
||||
// edit node
|
||||
// see ledger
|
||||
|
||||
pscript['onload_Accounts Browser'] = function(wrapper){
|
||||
console.log($(wrapper).html());
|
||||
wn.ui.make_app_page({
|
||||
parent: wrapper,
|
||||
single_column: true
|
||||
})
|
||||
|
||||
wrapper.appframe.add_module_icon("Accounts");
|
||||
|
||||
var main = $(wrapper).find(".layout-main"),
|
||||
chart_area = $("<div>")
|
||||
.css({"margin-bottom": "15px", "min-height": "200px"})
|
||||
.appendTo(main),
|
||||
help_area = $('<div class="well">'+
|
||||
'<h4>'+wn._('Quick Help')+'</h4>'+
|
||||
'<ol>'+
|
||||
'<li>'+wn._('To add child nodes, explore tree and click on the node under which you want to add more nodes.')+'</li>'+
|
||||
'<li>'+
|
||||
wn._('Accounting Entries can be made against leaf nodes, called')+
|
||||
'<b>' +wn._('Ledgers')+'</b>.'+ wn._('Entries against') +
|
||||
'<b>' +wn._('Groups') + '</b>'+ wn._('are not allowed.')+
|
||||
'</li>'+
|
||||
'<li>'+wn._('Please do NOT create Account (Ledgers) for Customers and Suppliers. They are created directly from the Customer / Supplier masters.')+'</li>'+
|
||||
'<li>'+
|
||||
'<b>'+wn._('To create a Bank Account:')+'</b>'+
|
||||
wn._('Go to the appropriate group (usually Application of Funds > Current Assets > Bank Accounts)')+
|
||||
wn._('and create a new Account Ledger (by clicking on Add Child) of type "Bank or Cash"')+
|
||||
'</li>'+
|
||||
'<li>'+
|
||||
'<b>'+wn._('To create a Tax Account:')+'</b>'+
|
||||
wn._('Go to the appropriate group (usually Source of Funds > Current Liabilities > Taxes and Duties)')+
|
||||
wn._('and create a new Account Ledger (by clicking on Add Child) of type "Tax" and do mention the Tax rate.')+
|
||||
'</li>'+
|
||||
'</ol>'+
|
||||
'<p>'+wn._('Please setup your chart of accounts before you start Accounting Entries')+'</p></div>').appendTo(main);
|
||||
|
||||
if (wn.boot.profile.can_create.indexOf("Company") !== -1) {
|
||||
wrapper.appframe.add_button(wn._('New Company'), function() { newdoc('Company'); },
|
||||
'icon-plus');
|
||||
}
|
||||
|
||||
wrapper.appframe.set_title_right('Refresh', function() {
|
||||
wrapper.$company_select.change();
|
||||
});
|
||||
|
||||
// company-select
|
||||
wrapper.$company_select = wrapper.appframe.add_select("Company", [])
|
||||
.change(function() {
|
||||
var ctype = wn.get_route()[1] || 'Account';
|
||||
erpnext.account_chart = new erpnext.AccountsChart(ctype, $(this).val(),
|
||||
chart_area.get(0));
|
||||
pscript.set_title(wrapper, ctype, $(this).val());
|
||||
})
|
||||
|
||||
// load up companies
|
||||
return wn.call({
|
||||
method:'accounts.page.accounts_browser.accounts_browser.get_companies',
|
||||
callback: function(r) {
|
||||
wrapper.$company_select.empty();
|
||||
$.each(r.message, function(i, v) {
|
||||
$('<option>').html(v).attr('value', v).appendTo(wrapper.$company_select);
|
||||
});
|
||||
wrapper.$company_select.val(wn.defaults.get_default("company") || r[0]).change();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
pscript.set_title = function(wrapper, ctype, val) {
|
||||
if(val) {
|
||||
wrapper.appframe.set_title('Chart of '+ctype+'s' + " - " + cstr(val));
|
||||
} else {
|
||||
wrapper.appframe.set_title('Chart of '+ctype+'s');
|
||||
}
|
||||
}
|
||||
|
||||
pscript['onshow_Accounts Browser'] = function(wrapper){
|
||||
// set route
|
||||
var ctype = wn.get_route()[1] || 'Account';
|
||||
|
||||
if(erpnext.account_chart && erpnext.account_chart.ctype != ctype) {
|
||||
wrapper.$company_select.change();
|
||||
}
|
||||
|
||||
pscript.set_title(wrapper, ctype);
|
||||
}
|
||||
|
||||
erpnext.AccountsChart = Class.extend({
|
||||
init: function(ctype, company, wrapper) {
|
||||
$(wrapper).empty();
|
||||
var me = this;
|
||||
me.ctype = ctype;
|
||||
me.can_create = wn.model.can_create(this.ctype);
|
||||
me.can_delete = wn.model.can_delete(this.ctype);
|
||||
me.can_write = wn.model.can_write(this.ctype);
|
||||
|
||||
|
||||
me.company = company;
|
||||
this.tree = new wn.ui.Tree({
|
||||
parent: $(wrapper),
|
||||
label: ctype==="Account" ? "Accounts" : "Cost Centers",
|
||||
args: {ctype: ctype, comp: company},
|
||||
method: 'accounts.page.accounts_browser.accounts_browser.get_children',
|
||||
click: function(link) {
|
||||
if(me.cur_toolbar)
|
||||
$(me.cur_toolbar).toggle(false);
|
||||
|
||||
if(!link.toolbar)
|
||||
me.make_link_toolbar(link);
|
||||
|
||||
if(link.toolbar) {
|
||||
me.cur_toolbar = link.toolbar;
|
||||
$(me.cur_toolbar).toggle(true);
|
||||
}
|
||||
|
||||
// bold
|
||||
$('.balance-bold').removeClass('balance-bold'); // deselect
|
||||
$(link).parent().find('.balance-area:first').addClass('balance-bold'); // select
|
||||
|
||||
},
|
||||
onrender: function(treenode) {
|
||||
if (ctype == 'Account' && treenode.data) {
|
||||
if(treenode.data.balance) {
|
||||
treenode.parent.append('<span class="balance-area">'
|
||||
+ format_currency(treenode.data.balance, treenode.data.currency)
|
||||
+ '</span>');
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
this.tree.rootnode.$a.click();
|
||||
},
|
||||
make_link_toolbar: function(link) {
|
||||
var data = $(link).data('node-data');
|
||||
if(!data) return;
|
||||
|
||||
link.toolbar = $('<span class="tree-node-toolbar"></span>').insertAfter(link);
|
||||
|
||||
var node_links = [];
|
||||
// edit
|
||||
if (wn.model.can_read(this.ctype) !== -1) {
|
||||
node_links.push('<a onclick="erpnext.account_chart.open();">'+wn._('Edit')+'</a>');
|
||||
}
|
||||
if (data.expandable && wn.boot.profile.in_create.indexOf(this.ctype) !== -1) {
|
||||
node_links.push('<a onclick="erpnext.account_chart.new_node();">'+wn._('Add Child')+'</a>');
|
||||
} else if (this.ctype === 'Account' && wn.boot.profile.can_read.indexOf("GL Entry") !== -1) {
|
||||
node_links.push('<a onclick="erpnext.account_chart.show_ledger();">'+wn._('View Ledger')+'</a>');
|
||||
}
|
||||
|
||||
if (this.can_write) {
|
||||
node_links.push('<a onclick="erpnext.account_chart.rename()">'+wn._('Rename')+'</a>');
|
||||
};
|
||||
|
||||
if (this.can_delete) {
|
||||
node_links.push('<a onclick="erpnext.account_chart.delete()">'+wn._('Delete')+'</a>');
|
||||
};
|
||||
|
||||
link.toolbar.append(node_links.join(" | "));
|
||||
},
|
||||
open: function() {
|
||||
var node = this.selected_node();
|
||||
wn.set_route("Form", this.ctype, node.data("label"));
|
||||
},
|
||||
show_ledger: function() {
|
||||
var me = this;
|
||||
var node = me.selected_node();
|
||||
wn.route_options = {
|
||||
"account": node.data('label'),
|
||||
"from_date": sys_defaults.year_start_date,
|
||||
"to_date": sys_defaults.year_end_date
|
||||
};
|
||||
wn.set_route("general-ledger");
|
||||
},
|
||||
rename: function() {
|
||||
var node = this.selected_node();
|
||||
wn.model.rename_doc(this.ctype, node.data('label'), function(new_name) {
|
||||
node.parents("ul:first").parent().find(".tree-link:first").trigger("reload");
|
||||
});
|
||||
},
|
||||
delete: function() {
|
||||
var node = this.selected_node();
|
||||
wn.model.delete_doc(this.ctype, node.data('label'), function() {
|
||||
node.parent().remove();
|
||||
});
|
||||
},
|
||||
new_node: function() {
|
||||
if(this.ctype=='Account') {
|
||||
this.new_account();
|
||||
} else {
|
||||
this.new_cost_center();
|
||||
}
|
||||
},
|
||||
selected_node: function() {
|
||||
return this.tree.$w.find('.tree-link.selected');
|
||||
},
|
||||
new_account: function() {
|
||||
var me = this;
|
||||
|
||||
// the dialog
|
||||
var d = new wn.ui.Dialog({
|
||||
title:wn._('New Account'),
|
||||
fields: [
|
||||
{fieldtype:'Data', fieldname:'account_name', label:wn._('New Account Name'), reqd:true,
|
||||
description: wn._("Name of new Account. Note: Please don't create accounts for Customers and Suppliers,")+
|
||||
wn._("they are created automatically from the Customer and Supplier master")},
|
||||
{fieldtype:'Select', fieldname:'group_or_ledger', label:wn._('Group or Ledger'),
|
||||
options:'Group\nLedger', description: wn._('Further accounts can be made under Groups,')+
|
||||
wn._('but entries can be made against Ledger')},
|
||||
{fieldtype:'Select', fieldname:'account_type', label:wn._('Account Type'),
|
||||
options: ['', 'Fixed Asset Account', 'Bank or Cash', 'Expense Account', 'Tax',
|
||||
'Income Account', 'Chargeable'].join('\n'),
|
||||
description: wn._("Optional. This setting will be used to filter in various transactions.") },
|
||||
{fieldtype:'Float', fieldname:'tax_rate', label:wn._('Tax Rate')},
|
||||
{fieldtype:'Button', fieldname:'create_new', label:wn._('Create New') }
|
||||
]
|
||||
})
|
||||
|
||||
var fd = d.fields_dict;
|
||||
|
||||
// account type if ledger
|
||||
$(fd.group_or_ledger.input).change(function() {
|
||||
if($(this).val()=='Group') {
|
||||
$(fd.account_type.wrapper).toggle(false);
|
||||
$(fd.tax_rate.wrapper).toggle(false);
|
||||
} else {
|
||||
$(fd.account_type.wrapper).toggle(true);
|
||||
if(fd.account_type.get_value()=='Tax') {
|
||||
$(fd.tax_rate.wrapper).toggle(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// tax rate if tax
|
||||
$(fd.account_type.input).change(function() {
|
||||
if($(this).val()=='Tax') {
|
||||
$(fd.tax_rate.wrapper).toggle(true);
|
||||
} else {
|
||||
$(fd.tax_rate.wrapper).toggle(false);
|
||||
}
|
||||
})
|
||||
|
||||
// create
|
||||
$(fd.create_new.input).click(function() {
|
||||
var btn = this;
|
||||
$(btn).set_working();
|
||||
var v = d.get_values();
|
||||
if(!v) return;
|
||||
|
||||
var node = me.selected_node();
|
||||
v.parent_account = node.data('label');
|
||||
v.master_type = '';
|
||||
v.company = me.company;
|
||||
|
||||
return wn.call({
|
||||
args: v,
|
||||
method:'accounts.utils.add_ac',
|
||||
callback: function(r) {
|
||||
$(btn).done_working();
|
||||
d.hide();
|
||||
node.trigger('reload');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// show
|
||||
d.onshow = function() {
|
||||
$(fd.group_or_ledger.input).change();
|
||||
$(fd.account_type.input).change();
|
||||
}
|
||||
|
||||
$(fd.group_or_ledger.input).val("Ledger").change();
|
||||
d.show();
|
||||
},
|
||||
|
||||
new_cost_center: function(){
|
||||
var me = this;
|
||||
// the dialog
|
||||
var d = new wn.ui.Dialog({
|
||||
title:wn._('New Cost Center'),
|
||||
fields: [
|
||||
{fieldtype:'Data', fieldname:'cost_center_name', label:wn._('New Cost Center Name'), reqd:true},
|
||||
{fieldtype:'Select', fieldname:'group_or_ledger', label:wn._('Group or Ledger'),
|
||||
options:'Group\nLedger', description:wn._('Further accounts can be made under Groups,')+
|
||||
wn._('but entries can be made against Ledger')},
|
||||
{fieldtype:'Button', fieldname:'create_new', label:wn._('Create New') }
|
||||
]
|
||||
});
|
||||
|
||||
// create
|
||||
$(d.fields_dict.create_new.input).click(function() {
|
||||
var btn = this;
|
||||
$(btn).set_working();
|
||||
var v = d.get_values();
|
||||
if(!v) return;
|
||||
|
||||
var node = me.selected_node();
|
||||
|
||||
v.parent_cost_center = node.data('label');
|
||||
v.company = me.company;
|
||||
|
||||
return wn.call({
|
||||
args: v,
|
||||
method:'accounts.utils.add_cc',
|
||||
callback: function(r) {
|
||||
$(btn).done_working();
|
||||
d.hide();
|
||||
node.trigger('reload');
|
||||
}
|
||||
});
|
||||
});
|
||||
d.show();
|
||||
}
|
||||
});
|
||||
@@ -1,295 +0,0 @@
|
||||
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
// License: GNU General Public License v3. See license.txt"
|
||||
|
||||
wn.module_page["Accounts"] = [
|
||||
{
|
||||
top: true,
|
||||
title: wn._("Documents"),
|
||||
icon: "icon-copy",
|
||||
items: [
|
||||
{
|
||||
label: wn._("Journal Voucher"),
|
||||
description: wn._("Accounting journal entries."),
|
||||
doctype:"Journal Voucher"
|
||||
},
|
||||
{
|
||||
label: wn._("Sales Invoice"),
|
||||
description: wn._("Bills raised to Customers."),
|
||||
doctype:"Sales Invoice"
|
||||
},
|
||||
{
|
||||
label: wn._("Purchase Invoice"),
|
||||
description: wn._("Bills raised by Suppliers."),
|
||||
doctype:"Purchase Invoice"
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
title: wn._("Masters"),
|
||||
icon: "icon-book",
|
||||
items: [
|
||||
{
|
||||
label: wn._("Chart of Accounts"),
|
||||
route: "Accounts Browser/Account",
|
||||
description: wn._("Structure of books of accounts."),
|
||||
doctype:"Account"
|
||||
},
|
||||
{
|
||||
label: wn._("Chart of Cost Centers"),
|
||||
route: "Accounts Browser/Cost Center",
|
||||
description: wn._("Structure cost centers for budgeting."),
|
||||
doctype:"Cost Center"
|
||||
},
|
||||
{
|
||||
label: wn._("Customer"),
|
||||
description: wn._("Customer database."),
|
||||
doctype:"Customer"
|
||||
},
|
||||
{
|
||||
label: wn._("Supplier"),
|
||||
description: wn._("Supplier database."),
|
||||
doctype:"Supplier"
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
title: wn._("Setup"),
|
||||
icon: "icon-wrench",
|
||||
items: [
|
||||
{
|
||||
label: wn._("Company"),
|
||||
description: wn._("Company Master."),
|
||||
doctype:"Company"
|
||||
},
|
||||
{
|
||||
label: wn._("Fiscal Year"),
|
||||
description: wn._("Accounting Year."),
|
||||
doctype:"Fiscal Year"
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
title: wn._("Tools"),
|
||||
icon: "icon-wrench",
|
||||
items: [
|
||||
{
|
||||
"route":"Form/Bank Reconciliation/Bank Reconciliation",
|
||||
"label": wn._("Bank Reconciliation"),
|
||||
"description": wn._("Update bank payment dates with journals."),
|
||||
doctype: "Bank Reconciliation"
|
||||
},
|
||||
{
|
||||
"route":"Form/Payment to Invoice Matching Tool/Payment to Invoice Matching Tool",
|
||||
"label": wn._("Payment Reconciliation"),
|
||||
"description": wn._("Match non-linked Invoices and Payments."),
|
||||
doctype: "Payment to Invoice Matching Tool"
|
||||
|
||||
},
|
||||
{
|
||||
"label": wn._("Period Closing Voucher"),
|
||||
"doctype": "Period Closing Voucher",
|
||||
description: wn._("Close Balance Sheet and book Profit or Loss.")
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
title: wn._("Setup"),
|
||||
icon: "icon-cog",
|
||||
items: [
|
||||
{
|
||||
"label": wn._("Accounts Settings"),
|
||||
"route": "Form/Accounts Settings",
|
||||
"doctype":"Accounts Settings",
|
||||
"description": wn._("Settings for Accounts")
|
||||
},
|
||||
{
|
||||
"label": wn._("Sales Taxes and Charges Master"),
|
||||
"doctype":"Sales Taxes and Charges Master",
|
||||
"description": wn._("Tax Template for Sales")
|
||||
},
|
||||
{
|
||||
"label": wn._("Purchase Taxes and Charges Master"),
|
||||
"doctype":"Purchase Taxes and Charges Master",
|
||||
"description": wn._("Tax Template for Purchase")
|
||||
},
|
||||
{
|
||||
"label": wn._("Shipping Rules"),
|
||||
"doctype":"Shipping Rule",
|
||||
"description": wn._("Rules to calculate shipping amount for a sale")
|
||||
},
|
||||
{
|
||||
"label": wn._("Currency Exchange"),
|
||||
"doctype":"Currency Exchange",
|
||||
"description": wn._("Manage exchange rates for currency conversion")
|
||||
},
|
||||
{
|
||||
"label": wn._("Point-of-Sale Setting"),
|
||||
"doctype":"POS Setting",
|
||||
"description": wn._("User settings for Point-of-sale (POS)")
|
||||
},
|
||||
{
|
||||
"doctype":"Budget Distribution",
|
||||
"label": wn._("Budget Distribution"),
|
||||
"description": wn._("Seasonality for setting budgets.")
|
||||
},
|
||||
{
|
||||
"doctype":"Terms and Conditions",
|
||||
"label": wn._("Terms and Conditions Template"),
|
||||
description: wn._("Template of terms or contract.")
|
||||
},
|
||||
{
|
||||
"doctype":"Mode of Payment",
|
||||
"label": wn._("Mode of Payment"),
|
||||
description: wn._("e.g. Bank, Cash, Credit Card")
|
||||
},
|
||||
{
|
||||
"doctype":"C-Form",
|
||||
"label": wn._("C-Form"),
|
||||
description: wn._("C-Form records"),
|
||||
country: "India"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
title: wn._("Main Reports"),
|
||||
right: true,
|
||||
icon: "icon-table",
|
||||
items: [
|
||||
{
|
||||
"label":wn._("General Ledger"),
|
||||
doctype: "GL Entry",
|
||||
route: "query-report/General Ledger"
|
||||
},
|
||||
{
|
||||
"label":wn._("Trial Balance"),
|
||||
page: "trial-balance"
|
||||
},
|
||||
{
|
||||
"page":"Financial Statements",
|
||||
"label": wn._("Financial Statements")
|
||||
},
|
||||
{
|
||||
"label":wn._("Accounts Receivable"),
|
||||
route: "query-report/Accounts Receivable",
|
||||
doctype: "Sales Invoice"
|
||||
},
|
||||
{
|
||||
"label":wn._("Accounts Payable"),
|
||||
route: "query-report/Accounts Payable",
|
||||
doctype: "Purchase Invoice"
|
||||
},
|
||||
{
|
||||
"label":wn._("Sales Register"),
|
||||
route: "query-report/Sales Register",
|
||||
doctype: "Sales Invoice"
|
||||
},
|
||||
{
|
||||
"label":wn._("Purchase Register"),
|
||||
route: "query-report/Purchase Register",
|
||||
doctype: "Purchase Invoice"
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
title: wn._("Analytics"),
|
||||
right: true,
|
||||
icon: "icon-bar-chart",
|
||||
items: [
|
||||
{
|
||||
"label":wn._("Financial Analytics"),
|
||||
page: "financial-analytics"
|
||||
},
|
||||
{
|
||||
"label":wn._("Gross Profit"),
|
||||
route: "query-report/Gross Profit",
|
||||
doctype: "Sales Invoice"
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
title: wn._("Reports"),
|
||||
right: true,
|
||||
icon: "icon-list",
|
||||
items: [
|
||||
{
|
||||
"label":wn._("Bank Reconciliation Statement"),
|
||||
route: "query-report/Bank Reconciliation Statement",
|
||||
doctype: "Journal Voucher"
|
||||
},
|
||||
{
|
||||
"label":wn._("Ordered Items To Be Billed"),
|
||||
route: "query-report/Ordered Items To Be Billed",
|
||||
doctype: "Sales Invoice"
|
||||
},
|
||||
{
|
||||
"label":wn._("Delivered Items To Be Billed"),
|
||||
route: "query-report/Delivered Items To Be Billed",
|
||||
doctype: "Sales Invoice"
|
||||
},
|
||||
{
|
||||
"label":wn._("Purchase Order Items To Be Billed"),
|
||||
route: "query-report/Purchase Order Items To Be Billed",
|
||||
doctype: "Purchase Invoice"
|
||||
},
|
||||
{
|
||||
"label":wn._("Received Items To Be Billed"),
|
||||
route: "query-report/Received Items To Be Billed",
|
||||
doctype: "Purchase Invoice"
|
||||
},
|
||||
{
|
||||
"label":wn._("Bank Clearance Summary"),
|
||||
route: "query-report/Bank Clearance Summary",
|
||||
doctype: "Journal Voucher"
|
||||
},
|
||||
{
|
||||
"label":wn._("Payment Period Based On Invoice Date"),
|
||||
route: "query-report/Payment Period Based On Invoice Date",
|
||||
doctype: "Journal Voucher"
|
||||
},
|
||||
{
|
||||
"label":wn._("Sales Partners Commission"),
|
||||
route: "query-report/Sales Partners Commission",
|
||||
doctype: "Sales Invoice"
|
||||
},
|
||||
{
|
||||
"label":wn._("Customer Account Head"),
|
||||
route: "query-report/Customer Account Head",
|
||||
doctype: "Account"
|
||||
},
|
||||
{
|
||||
"label":wn._("Supplier Account Head"),
|
||||
route: "query-report/Supplier Account Head",
|
||||
doctype: "Account"
|
||||
},
|
||||
{
|
||||
"label":wn._("Item-wise Sales Register"),
|
||||
route: "query-report/Item-wise Sales Register",
|
||||
doctype: "Sales Invoice"
|
||||
},
|
||||
{
|
||||
"label":wn._("Item-wise Purchase Register"),
|
||||
route: "query-report/Item-wise Purchase Register",
|
||||
doctype: "Purchase Invoice"
|
||||
},
|
||||
{
|
||||
"label":wn._("Budget Variance Report"),
|
||||
route: "query-report/Budget Variance Report",
|
||||
doctype: "Cost Center"
|
||||
},
|
||||
{
|
||||
"label":wn._("Purchase Invoice Trends"),
|
||||
route: "query-report/Purchase Invoice Trends",
|
||||
doctype: "Purchase Invoice"
|
||||
},
|
||||
{
|
||||
"label":wn._("Sales Invoice Trends"),
|
||||
route: "query-report/Sales Invoice Trends",
|
||||
doctype: "Sales Invoice"
|
||||
},
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
pscript['onload_accounts-home'] = function(wrapper) {
|
||||
wn.views.moduleview.make(wrapper, "Accounts");
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
[
|
||||
{
|
||||
"creation": "2012-06-14 15:07:28",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-07-11 14:40:16",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
{
|
||||
"doctype": "Page",
|
||||
"icon": "icon-th",
|
||||
"module": "Accounts",
|
||||
"name": "__common__",
|
||||
"page_name": "accounts-home",
|
||||
"standard": "Yes",
|
||||
"title": "Accounts Home"
|
||||
},
|
||||
{
|
||||
"doctype": "Page",
|
||||
"name": "accounts-home"
|
||||
}
|
||||
]
|
||||
@@ -1,22 +0,0 @@
|
||||
[
|
||||
{
|
||||
"creation": "2013-07-30 17:28:49",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-09-05 12:40:04",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
{
|
||||
"doctype": "Report",
|
||||
"is_standard": "Yes",
|
||||
"name": "__common__",
|
||||
"query": "select\n `tabDelivery Note`.`name` as \"Delivery Note:Link/Delivery Note:120\",\n\t`tabDelivery Note`.`customer` as \"Customer:Link/Customer:120\",\n\t`tabDelivery Note`.`posting_date` as \"Date:Date\",\n\t`tabDelivery Note`.`project_name` as \"Project\",\n\t`tabDelivery Note Item`.`item_code` as \"Item:Link/Item:120\",\n\t(`tabDelivery Note Item`.`qty` - ifnull((select sum(qty) from `tabSales Invoice Item` \n\t where `tabSales Invoice Item`.docstatus=1 and \n `tabSales Invoice Item`.delivery_note = `tabDelivery Note`.name and\n\t `tabSales Invoice Item`.dn_detail = `tabDelivery Note Item`.name), 0))\n\t\tas \"Qty:Float:110\",\n\t(`tabDelivery Note Item`.`amount` - ifnull((select sum(amount) from `tabSales Invoice Item` \n where `tabSales Invoice Item`.docstatus=1 and \n `tabSales Invoice Item`.delivery_note = `tabDelivery Note`.name and\n `tabSales Invoice Item`.dn_detail = `tabDelivery Note Item`.name), 0))\n\t\tas \"Amount:Currency:110\",\n\t`tabDelivery Note Item`.`item_name` as \"Item Name::150\",\n\t`tabDelivery Note Item`.`description` as \"Description::200\"\nfrom `tabDelivery Note`, `tabDelivery Note Item`\nwhere\n `tabDelivery Note`.docstatus = 1 and\n\t`tabDelivery Note`.`status` != \"Stopped\" and\n `tabDelivery Note`.name = `tabDelivery Note Item`.parent and\n (`tabDelivery Note Item`.qty > ifnull((select sum(qty) from `tabSales Invoice Item` \n where `tabSales Invoice Item`.docstatus=1 and \n `tabSales Invoice Item`.delivery_note = `tabDelivery Note`.name and\n `tabSales Invoice Item`.dn_detail = `tabDelivery Note Item`.name), 0))\norder by `tabDelivery Note`.`name` desc",
|
||||
"ref_doctype": "Sales Invoice",
|
||||
"report_name": "Delivered Items To Be Billed",
|
||||
"report_type": "Query Report"
|
||||
},
|
||||
{
|
||||
"doctype": "Report",
|
||||
"name": "Delivered Items To Be Billed"
|
||||
}
|
||||
]
|
||||
@@ -1,51 +0,0 @@
|
||||
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
// License: GNU General Public License v3. See license.txt
|
||||
|
||||
wn.query_reports["General Ledger"] = {
|
||||
"filters": [
|
||||
{
|
||||
"fieldname":"company",
|
||||
"label": wn._("Company"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Company",
|
||||
"default": wn.defaults.get_user_default("company"),
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname":"account",
|
||||
"label": wn._("Account"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Account"
|
||||
},
|
||||
{
|
||||
"fieldname":"voucher_no",
|
||||
"label": wn._("Voucher No"),
|
||||
"fieldtype": "Data",
|
||||
},
|
||||
{
|
||||
"fieldname":"group_by",
|
||||
"label": wn._("Group by"),
|
||||
"fieldtype": "Select",
|
||||
"options": "\nGroup by Account\nGroup by Voucher"
|
||||
},
|
||||
{
|
||||
"fieldtype": "Break",
|
||||
},
|
||||
{
|
||||
"fieldname":"from_date",
|
||||
"label": wn._("From Date"),
|
||||
"fieldtype": "Date",
|
||||
"default": wn.datetime.add_months(wn.datetime.get_today(), -1),
|
||||
"reqd": 1,
|
||||
"width": "60px"
|
||||
},
|
||||
{
|
||||
"fieldname":"to_date",
|
||||
"label": wn._("To Date"),
|
||||
"fieldtype": "Date",
|
||||
"default": wn.datetime.get_today(),
|
||||
"reqd": 1,
|
||||
"width": "60px"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
from webnotes.utils import flt
|
||||
from webnotes import _
|
||||
|
||||
def execute(filters=None):
|
||||
validate_filters(filters)
|
||||
columns = get_columns()
|
||||
|
||||
if filters.get("group_by"):
|
||||
data = get_grouped_gle(filters)
|
||||
else:
|
||||
data = get_gl_entries(filters)
|
||||
if data:
|
||||
data.append(get_total_row(data))
|
||||
|
||||
return columns, data
|
||||
|
||||
def validate_filters(filters):
|
||||
if filters.get("account") and filters.get("group_by") == "Group by Account":
|
||||
webnotes.throw(_("Can not filter based on Account, if grouped by Account"))
|
||||
|
||||
if filters.get("voucher_no") and filters.get("group_by") == "Group by Voucher":
|
||||
webnotes.throw(_("Can not filter based on Voucher No, if grouped by Voucher"))
|
||||
|
||||
def get_columns():
|
||||
return ["Posting Date:Date:100", "Account:Link/Account:200", "Debit:Currency:100",
|
||||
"Credit:Currency:100", "Voucher Type::120", "Voucher No::160",
|
||||
"Cost Center:Link/Cost Center:100", "Remarks::200"]
|
||||
|
||||
def get_gl_entries(filters):
|
||||
return webnotes.conn.sql("""select
|
||||
posting_date, account, debit, credit, voucher_type, voucher_no, cost_center, remarks
|
||||
from `tabGL Entry`
|
||||
where company=%(company)s
|
||||
and posting_date between %(from_date)s and %(to_date)s
|
||||
{conditions}
|
||||
order by posting_date, account"""\
|
||||
.format(conditions=get_conditions(filters)), filters, as_list=1)
|
||||
|
||||
def get_conditions(filters):
|
||||
conditions = []
|
||||
if filters.get("account"):
|
||||
conditions.append("account=%(account)s")
|
||||
if filters.get("voucher_no"):
|
||||
conditions.append("voucher_no=%(voucher_no)s")
|
||||
|
||||
return "and {}".format(" and ".join(conditions)) if conditions else ""
|
||||
|
||||
def get_grouped_gle(filters):
|
||||
gle_map = {}
|
||||
gle = get_gl_entries(filters)
|
||||
for d in gle:
|
||||
gle_map.setdefault(d[1 if filters["group_by"]=="Group by Account" else 5], []).append(d)
|
||||
|
||||
data = []
|
||||
for entries in gle_map.values():
|
||||
subtotal_debit = subtotal_credit = 0.0
|
||||
for entry in entries:
|
||||
data.append(entry)
|
||||
subtotal_debit += flt(entry[2])
|
||||
subtotal_credit += flt(entry[3])
|
||||
|
||||
data.append(["", "Total", subtotal_debit, subtotal_credit, "", "", ""])
|
||||
|
||||
if data:
|
||||
data.append(get_total_row(gle))
|
||||
return data
|
||||
|
||||
def get_total_row(gle):
|
||||
total_debit = total_credit = 0.0
|
||||
for d in gle:
|
||||
total_debit += flt(d[2])
|
||||
total_credit += flt(d[3])
|
||||
|
||||
return ["", "Total Debit/Credit", total_debit, total_credit, "", "", ""]
|
||||
@@ -1,22 +0,0 @@
|
||||
[
|
||||
{
|
||||
"creation": "2013-02-21 14:26:44",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-02-22 15:53:01",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
{
|
||||
"doctype": "Report",
|
||||
"is_standard": "Yes",
|
||||
"name": "__common__",
|
||||
"query": "select \n `tabSales Order`.`name` as \"Sales Order:Link/Sales Order:120\",\n `tabSales Order`.`customer` as \"Customer:Link/Customer:120\",\n `tabSales Order`.`status` as \"Status\",\n `tabSales Order`.`transaction_date` as \"Date:Date\",\n `tabSales Order`.`project_name` as \"Project\",\n `tabSales Order Item`.item_code as \"Item:Link/Item:120\",\n `tabSales Order Item`.amount as \"Amount:Currency:110\",\n (`tabSales Order Item`.billed_amt * ifnull(`tabSales Order`.conversion_rate, 1)) as \"Billed Amount:Currency:110\",\n (ifnull(`tabSales Order Item`.amount, 0) - (ifnull(`tabSales Order Item`.billed_amt, 0) * ifnull(`tabSales Order`.conversion_rate, 1))) as \"Pending Amount:Currency:120\",\n `tabSales Order Item`.item_name as \"Item Name::150\",\n `tabSales Order Item`.description as \"Description::200\"\nfrom\n `tabSales Order`, `tabSales Order Item`\nwhere\n `tabSales Order Item`.`parent` = `tabSales Order`.`name`\n and `tabSales Order`.docstatus = 1\n and `tabSales Order`.status != \"Stopped\"\n and ifnull(`tabSales Order Item`.billed_amt,0) < ifnull(`tabSales Order Item`.export_amount,0)\norder by `tabSales Order`.transaction_date asc",
|
||||
"ref_doctype": "Sales Invoice",
|
||||
"report_name": "Ordered Items To Be Billed",
|
||||
"report_type": "Query Report"
|
||||
},
|
||||
{
|
||||
"doctype": "Report",
|
||||
"name": "Ordered Items To Be Billed"
|
||||
}
|
||||
]
|
||||
@@ -1,22 +0,0 @@
|
||||
[
|
||||
{
|
||||
"creation": "2013-07-30 18:35:10",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-07-31 11:46:57",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
{
|
||||
"doctype": "Report",
|
||||
"is_standard": "Yes",
|
||||
"name": "__common__",
|
||||
"query": "select\n `tabPurchase Receipt`.`name` as \"Purchase Receipt:Link/Purchase Receipt:120\",\n `tabPurchase Receipt`.`supplier` as \"Supplier:Link/Supplier:120\",\n\t`tabPurchase Receipt`.`posting_date` as \"Date:Date\",\n\t`tabPurchase Receipt Item`.`project_name` as \"Project\",\n\t`tabPurchase Receipt Item`.`item_code` as \"Item:Link/Item:120\",\n\t(`tabPurchase Receipt Item`.`qty` - ifnull((select sum(qty) from `tabPurchase Invoice Item` \n\t where `tabPurchase Invoice Item`.purchase_receipt = `tabPurchase Receipt`.name and\n\t `tabPurchase Invoice Item`.pr_detail = `tabPurchase Receipt Item`.name), 0))\n\t\tas \"Qty:Float:110\",\n\t(`tabPurchase Receipt Item`.`amount` - ifnull((select sum(amount) from `tabPurchase Invoice Item` \n where `tabPurchase Invoice Item`.purchase_receipt = `tabPurchase Receipt`.name and\n `tabPurchase Invoice Item`.pr_detail = `tabPurchase Receipt Item`.name), 0))\n\t\tas \"Amount:Currency:110\",\n\t`tabPurchase Receipt Item`.`item_name` as \"Item Name::150\",\n\t`tabPurchase Receipt Item`.`description` as \"Description::200\"\nfrom `tabPurchase Receipt`, `tabPurchase Receipt Item`\nwhere\n `tabPurchase Receipt`.docstatus = 1 and\n\t`tabPurchase Receipt`.`status` != \"Stopped\" and\n `tabPurchase Receipt`.name = `tabPurchase Receipt Item`.parent and\n (`tabPurchase Receipt Item`.qty > ifnull((select sum(qty) from `tabPurchase Invoice Item` \n where `tabPurchase Invoice Item`.purchase_receipt = `tabPurchase Receipt`.name and\n `tabPurchase Invoice Item`.pr_detail = `tabPurchase Receipt Item`.name), 0))\norder by `tabPurchase Receipt`.`name` desc",
|
||||
"ref_doctype": "Purchase Invoice",
|
||||
"report_name": "Received Items To Be Billed",
|
||||
"report_type": "Query Report"
|
||||
},
|
||||
{
|
||||
"doctype": "Report",
|
||||
"name": "Received Items To Be Billed"
|
||||
}
|
||||
]
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,198 +0,0 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
import webnotes.defaults
|
||||
|
||||
from webnotes.utils import cint
|
||||
from webnotes import msgprint, _
|
||||
from webnotes.model.doc import make_autoname
|
||||
|
||||
|
||||
from utilities.transaction_base import TransactionBase
|
||||
|
||||
class DocType(TransactionBase):
|
||||
def __init__(self, doc, doclist=[]):
|
||||
self.doc = doc
|
||||
self.doclist = doclist
|
||||
|
||||
def autoname(self):
|
||||
supp_master_name = webnotes.defaults.get_global_default('supp_master_name')
|
||||
|
||||
if supp_master_name == 'Supplier Name':
|
||||
if webnotes.conn.exists("Customer", self.doc.supplier_name):
|
||||
webnotes.msgprint(_("A Customer exists with same name"), raise_exception=1)
|
||||
self.doc.name = self.doc.supplier_name
|
||||
else:
|
||||
self.doc.name = make_autoname(self.doc.naming_series + '.#####')
|
||||
|
||||
def update_address(self):
|
||||
webnotes.conn.sql("""update `tabAddress` set supplier_name=%s, modified=NOW()
|
||||
where supplier=%s""", (self.doc.supplier_name, self.doc.name))
|
||||
|
||||
def update_contact(self):
|
||||
webnotes.conn.sql("""update `tabContact` set supplier_name=%s, modified=NOW()
|
||||
where supplier=%s""", (self.doc.supplier_name, self.doc.name))
|
||||
|
||||
def update_credit_days_limit(self):
|
||||
webnotes.conn.sql("""update tabAccount set credit_days = %s where name = %s""",
|
||||
(cint(self.doc.credit_days), self.doc.name + " - " + self.get_company_abbr()))
|
||||
|
||||
def on_update(self):
|
||||
if not self.doc.naming_series:
|
||||
self.doc.naming_series = ''
|
||||
|
||||
self.update_address()
|
||||
self.update_contact()
|
||||
|
||||
# create account head
|
||||
self.create_account_head()
|
||||
|
||||
# update credit days and limit in account
|
||||
self.update_credit_days_limit()
|
||||
|
||||
def get_payables_group(self):
|
||||
g = webnotes.conn.sql("select payables_group from tabCompany where name=%s", self.doc.company)
|
||||
g = g and g[0][0] or ''
|
||||
if not g:
|
||||
msgprint("Update Company master, assign a default group for Payables")
|
||||
raise Exception
|
||||
return g
|
||||
|
||||
def add_account(self, ac, par, abbr):
|
||||
ac_bean = webnotes.bean({
|
||||
"doctype": "Account",
|
||||
'account_name':ac,
|
||||
'parent_account':par,
|
||||
'group_or_ledger':'Group',
|
||||
'company':self.doc.company,
|
||||
"freeze_account": "No",
|
||||
})
|
||||
ac_bean.ignore_permissions = True
|
||||
ac_bean.insert()
|
||||
|
||||
msgprint(_("Created Group ") + ac)
|
||||
|
||||
def get_company_abbr(self):
|
||||
return webnotes.conn.sql("select abbr from tabCompany where name=%s", self.doc.company)[0][0]
|
||||
|
||||
def get_parent_account(self, abbr):
|
||||
if (not self.doc.supplier_type):
|
||||
msgprint("Supplier Type is mandatory")
|
||||
raise Exception
|
||||
|
||||
if not webnotes.conn.sql("select name from tabAccount where name=%s and debit_or_credit = 'Credit' and ifnull(is_pl_account, 'No') = 'No'", (self.doc.supplier_type + " - " + abbr)):
|
||||
|
||||
# if not group created , create it
|
||||
self.add_account(self.doc.supplier_type, self.get_payables_group(), abbr)
|
||||
|
||||
return self.doc.supplier_type + " - " + abbr
|
||||
|
||||
def validate(self):
|
||||
#validation for Naming Series mandatory field...
|
||||
if webnotes.defaults.get_global_default('supp_master_name') == 'Naming Series':
|
||||
if not self.doc.naming_series:
|
||||
msgprint("Series is Mandatory.", raise_exception=1)
|
||||
|
||||
def create_account_head(self):
|
||||
if self.doc.company :
|
||||
abbr = self.get_company_abbr()
|
||||
parent_account = self.get_parent_account(abbr)
|
||||
|
||||
if not webnotes.conn.sql("select name from tabAccount where name=%s", (self.doc.name + " - " + abbr)):
|
||||
ac_bean = webnotes.bean({
|
||||
"doctype": "Account",
|
||||
'account_name': self.doc.name,
|
||||
'parent_account': parent_account,
|
||||
'group_or_ledger':'Ledger',
|
||||
'company': self.doc.company,
|
||||
'account_type': '',
|
||||
'tax_rate': '0',
|
||||
'master_type': 'Supplier',
|
||||
'master_name': self.doc.name,
|
||||
"freeze_account": "No"
|
||||
})
|
||||
ac_bean.ignore_permissions = True
|
||||
ac_bean.insert()
|
||||
|
||||
msgprint(_("Created Account Head: ") + ac_bean.doc.name)
|
||||
else:
|
||||
self.check_parent_account(parent_account, abbr)
|
||||
else :
|
||||
msgprint("Please select Company under which you want to create account head")
|
||||
|
||||
def check_parent_account(self, parent_account, abbr):
|
||||
if webnotes.conn.get_value("Account", self.doc.name + " - " + abbr,
|
||||
"parent_account") != parent_account:
|
||||
ac = webnotes.bean("Account", self.doc.name + " - " + abbr)
|
||||
ac.doc.parent_account = parent_account
|
||||
ac.save()
|
||||
|
||||
def get_contacts(self,nm):
|
||||
if nm:
|
||||
contact_details =webnotes.conn.convert_to_lists(webnotes.conn.sql("select name, CONCAT(IFNULL(first_name,''),' ',IFNULL(last_name,'')),contact_no,email_id from `tabContact` where supplier = '%s'"%nm))
|
||||
|
||||
return contact_details
|
||||
else:
|
||||
return ''
|
||||
|
||||
def delete_supplier_address(self):
|
||||
for rec in webnotes.conn.sql("select * from `tabAddress` where supplier=%s", (self.doc.name,), as_dict=1):
|
||||
webnotes.conn.sql("delete from `tabAddress` where name=%s",(rec['name']))
|
||||
|
||||
def delete_supplier_contact(self):
|
||||
for contact in webnotes.conn.sql_list("""select name from `tabContact`
|
||||
where supplier=%s""", self.doc.name):
|
||||
webnotes.delete_doc("Contact", contact)
|
||||
|
||||
def delete_supplier_account(self):
|
||||
"""delete supplier's ledger if exist and check balance before deletion"""
|
||||
acc = webnotes.conn.sql("select name from `tabAccount` where master_type = 'Supplier' \
|
||||
and master_name = %s and docstatus < 2", self.doc.name)
|
||||
if acc:
|
||||
from webnotes.model import delete_doc
|
||||
delete_doc('Account', acc[0][0])
|
||||
|
||||
def on_trash(self):
|
||||
self.delete_supplier_address()
|
||||
self.delete_supplier_contact()
|
||||
self.delete_supplier_account()
|
||||
|
||||
def before_rename(self, olddn, newdn, merge=False):
|
||||
from accounts.utils import rename_account_for
|
||||
rename_account_for("Supplier", olddn, newdn, merge)
|
||||
|
||||
def after_rename(self, olddn, newdn, merge=False):
|
||||
set_field = ''
|
||||
if webnotes.defaults.get_global_default('supp_master_name') == 'Supplier Name':
|
||||
webnotes.conn.set(self.doc, "supplier_name", newdn)
|
||||
self.update_contact()
|
||||
set_field = ", supplier_name=%(newdn)s"
|
||||
self.update_supplier_address(newdn, set_field)
|
||||
|
||||
def update_supplier_address(self, newdn, set_field):
|
||||
webnotes.conn.sql("""update `tabAddress` set address_title=%(newdn)s
|
||||
{set_field} where supplier=%(newdn)s"""\
|
||||
.format(set_field=set_field), ({"newdn": newdn}))
|
||||
|
||||
@webnotes.whitelist()
|
||||
def get_dashboard_info(supplier):
|
||||
if not webnotes.has_permission("Supplier", "read", supplier):
|
||||
webnotes.msgprint("No Permission", raise_exception=True)
|
||||
|
||||
out = {}
|
||||
for doctype in ["Supplier Quotation", "Purchase Order", "Purchase Receipt", "Purchase Invoice"]:
|
||||
out[doctype] = webnotes.conn.get_value(doctype,
|
||||
{"supplier": supplier, "docstatus": ["!=", 2] }, "count(*)")
|
||||
|
||||
billing = webnotes.conn.sql("""select sum(grand_total), sum(outstanding_amount)
|
||||
from `tabPurchase Invoice`
|
||||
where supplier=%s
|
||||
and docstatus = 1
|
||||
and fiscal_year = %s""", (supplier, webnotes.conn.get_default("fiscal_year")))
|
||||
|
||||
out["total_billing"] = billing[0][0]
|
||||
out["total_unpaid"] = billing[0][1]
|
||||
|
||||
return out
|
||||
@@ -1,169 +0,0 @@
|
||||
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
// License: GNU General Public License v3. See license.txt"
|
||||
|
||||
wn.module_page["Buying"] = [
|
||||
{
|
||||
title: wn._("Documents"),
|
||||
top: true,
|
||||
icon: "icon-copy",
|
||||
items: [
|
||||
{
|
||||
label: wn._("Supplier"),
|
||||
description: wn._("Supplier database."),
|
||||
doctype:"Supplier"
|
||||
},
|
||||
{
|
||||
label: wn._("Material Request"),
|
||||
description: wn._("Request for purchase."),
|
||||
doctype:"Material Request"
|
||||
},
|
||||
{
|
||||
label: wn._("Supplier Quotation"),
|
||||
description: wn._("Quotations received from Suppliers."),
|
||||
doctype:"Supplier Quotation"
|
||||
},
|
||||
{
|
||||
label: wn._("Purchase Order"),
|
||||
description: wn._("Purchase Orders given to Suppliers."),
|
||||
doctype:"Purchase Order"
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
title: wn._("Masters"),
|
||||
icon: "icon-book",
|
||||
items: [
|
||||
{
|
||||
label: wn._("Contact"),
|
||||
description: wn._("All Contacts."),
|
||||
doctype:"Contact"
|
||||
},
|
||||
{
|
||||
label: wn._("Address"),
|
||||
description: wn._("All Addresses."),
|
||||
doctype:"Address"
|
||||
},
|
||||
{
|
||||
label: wn._("Item"),
|
||||
description: wn._("All Products or Services."),
|
||||
doctype:"Item"
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
title: wn._("Setup"),
|
||||
icon: "icon-cog",
|
||||
items: [
|
||||
{
|
||||
"label": wn._("Buying Settings"),
|
||||
"route": "Form/Buying Settings",
|
||||
"doctype":"Buying Settings",
|
||||
"description": wn._("Settings for Buying Module")
|
||||
},
|
||||
{
|
||||
"label": wn._("Purchase Taxes and Charges Master"),
|
||||
"doctype":"Purchase Taxes and Charges Master",
|
||||
"description": wn._("Tax Template for Purchase")
|
||||
},
|
||||
{
|
||||
label: wn._("Price List"),
|
||||
description: wn._("Multiple Price list."),
|
||||
doctype:"Price List"
|
||||
},
|
||||
{
|
||||
label: wn._("Item Price"),
|
||||
description: wn._("Multiple Item prices."),
|
||||
doctype:"Item Price"
|
||||
},
|
||||
{
|
||||
"doctype":"Supplier Type",
|
||||
"label": wn._("Supplier Type"),
|
||||
"description": wn._("Supplier classification.")
|
||||
},
|
||||
{
|
||||
"route":"Sales Browser/Item Group",
|
||||
"label":wn._("Item Group"),
|
||||
"description": wn._("Tree of item classification"),
|
||||
doctype:"Item Group"
|
||||
},
|
||||
{
|
||||
label: wn._("Terms and Conditions"),
|
||||
description: wn._("Template of terms or contract."),
|
||||
doctype:"Terms and Conditions"
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
title: wn._("Tools"),
|
||||
icon: "icon-wrench",
|
||||
items: [
|
||||
]
|
||||
},
|
||||
{
|
||||
title: wn._("Analytics"),
|
||||
right: true,
|
||||
icon: "icon-bar-chart",
|
||||
items: [
|
||||
{
|
||||
"label":wn._("Purchase Analytics"),
|
||||
page: "purchase-analytics"
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
title: wn._("Reports"),
|
||||
right: true,
|
||||
icon: "icon-list",
|
||||
items: [
|
||||
{
|
||||
"label":wn._("Items To Be Requested"),
|
||||
route: "query-report/Items To Be Requested",
|
||||
doctype: "Item"
|
||||
},
|
||||
{
|
||||
"label":wn._("Requested Items To Be Ordered"),
|
||||
route: "query-report/Requested Items To Be Ordered",
|
||||
doctype: "Material Request"
|
||||
},
|
||||
{
|
||||
"label":wn._("Material Requests for which Supplier Quotations are not created"),
|
||||
route: "query-report/Material Requests for which Supplier Quotations are not created",
|
||||
doctype: "Material Request"
|
||||
},
|
||||
{
|
||||
"label":wn._("Purchase In Transit"),
|
||||
route: "query-report/Purchase In Transit",
|
||||
doctype: "Purchase Order"
|
||||
},
|
||||
{
|
||||
"label":wn._("Item-wise Purchase History"),
|
||||
route: "query-report/Item-wise Purchase History",
|
||||
doctype: "Item"
|
||||
},
|
||||
{
|
||||
"label":wn._("Item-wise Last Purchase Rate"),
|
||||
route: "query-report/Item-wise Last Purchase Rate",
|
||||
doctype: "Item"
|
||||
},
|
||||
{
|
||||
"label":wn._("Purchase Order Trends"),
|
||||
route: "query-report/Purchase Order Trends",
|
||||
doctype: "Purchase Order"
|
||||
},
|
||||
{
|
||||
"label":wn._("Supplier Addresses And Contacts"),
|
||||
route: "query-report/Supplier Addresses and Contacts",
|
||||
doctype: "Supplier"
|
||||
},
|
||||
{
|
||||
"label":wn._("Supplier-Wise Sales Analytics"),
|
||||
route: "query-report/Supplier-Wise Sales Analytics",
|
||||
doctype: "Stock Ledger Entry"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
pscript['onload_buying-home'] = function(wrapper) {
|
||||
wn.views.moduleview.make(wrapper, "Buying");
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
[
|
||||
{
|
||||
"creation": "2012-02-21 13:22:54",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-07-11 14:41:50",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
{
|
||||
"doctype": "Page",
|
||||
"icon": "icon-th",
|
||||
"module": "Buying",
|
||||
"name": "__common__",
|
||||
"page_name": "buying-home",
|
||||
"standard": "Yes",
|
||||
"title": "Buying Home"
|
||||
},
|
||||
{
|
||||
"doctype": "Page",
|
||||
"name": "buying-home"
|
||||
}
|
||||
]
|
||||
@@ -1,23 +0,0 @@
|
||||
[
|
||||
{
|
||||
"creation": "2013-05-13 16:10:02",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-05-13 16:21:07",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
{
|
||||
"add_total_row": 1,
|
||||
"doctype": "Report",
|
||||
"is_standard": "Yes",
|
||||
"name": "__common__",
|
||||
"query": "select \n mr.name as \"Material Request:Link/Material Request:120\",\n\tmr.transaction_date as \"Date:Date:100\",\n\tmr_item.item_code as \"Item Code:Link/Item:120\",\n\tmr_item.qty as \"Qty:Float:100\",\n\tmr_item.ordered_qty as \"Ordered Qty:Float:100\", \n\t(mr_item.qty - ifnull(mr_item.ordered_qty, 0)) as \"Qty to Order:Float:100\",\n\tmr_item.item_name as \"Item Name::150\",\n\tmr_item.description as \"Description::200\"\nfrom\n\t`tabMaterial Request` mr, `tabMaterial Request Item` mr_item\nwhere\n\tmr_item.parent = mr.name\n\tand mr.material_request_type = \"Purchase\"\n\tand mr.docstatus = 1\n\tand mr.status != \"Stopped\"\n\tand ifnull(mr_item.ordered_qty, 0) < ifnull(mr_item.qty, 0)\norder by mr.transaction_date asc",
|
||||
"ref_doctype": "Purchase Order",
|
||||
"report_name": "Requested Items To Be Ordered",
|
||||
"report_type": "Query Report"
|
||||
},
|
||||
{
|
||||
"doctype": "Report",
|
||||
"name": "Requested Items To Be Ordered"
|
||||
}
|
||||
]
|
||||
203
buying/utils.py
203
buying/utils.py
@@ -1,203 +0,0 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
from webnotes import msgprint, _
|
||||
from webnotes.utils import getdate, flt, add_days, cstr
|
||||
import json
|
||||
|
||||
@webnotes.whitelist()
|
||||
def get_item_details(args):
|
||||
"""
|
||||
args = {
|
||||
"doctype": "",
|
||||
"docname": "",
|
||||
"item_code": "",
|
||||
"warehouse": None,
|
||||
"supplier": None,
|
||||
"transaction_date": None,
|
||||
"conversion_rate": 1.0,
|
||||
"buying_price_list": None,
|
||||
"price_list_currency": None,
|
||||
"plc_conversion_rate": 1.0,
|
||||
"is_subcontracted": "Yes" / "No"
|
||||
}
|
||||
"""
|
||||
if isinstance(args, basestring):
|
||||
args = json.loads(args)
|
||||
|
||||
args = webnotes._dict(args)
|
||||
|
||||
item_bean = webnotes.bean("Item", args.item_code)
|
||||
item = item_bean.doc
|
||||
|
||||
_validate_item_details(args, item)
|
||||
|
||||
out = _get_basic_details(args, item_bean)
|
||||
|
||||
out.supplier_part_no = _get_supplier_part_no(args, item_bean)
|
||||
|
||||
if not out.warehouse:
|
||||
out.warehouse = item_bean.doc.default_warehouse
|
||||
|
||||
if out.warehouse:
|
||||
out.projected_qty = get_projected_qty(item.name, out.warehouse)
|
||||
|
||||
if args.transaction_date and item.lead_time_days:
|
||||
out.schedule_date = out.lead_time_date = add_days(args.transaction_date,
|
||||
item.lead_time_days)
|
||||
|
||||
meta = webnotes.get_doctype(args.doctype)
|
||||
|
||||
if meta.get_field("currency"):
|
||||
out.purchase_ref_rate = out.discount_rate = out.purchase_rate = \
|
||||
out.import_ref_rate = out.import_rate = 0.0
|
||||
out.update(_get_price_list_rate(args, item_bean, meta))
|
||||
|
||||
if args.doctype == "Material Request":
|
||||
out.min_order_qty = flt(item.min_order_qty)
|
||||
|
||||
return out
|
||||
|
||||
def _get_basic_details(args, item_bean):
|
||||
item = item_bean.doc
|
||||
|
||||
out = webnotes._dict({
|
||||
"description": item.description_html or item.description,
|
||||
"qty": 1.0,
|
||||
"uom": item.stock_uom,
|
||||
"conversion_factor": 1.0,
|
||||
"warehouse": args.warehouse or item.default_warehouse,
|
||||
"item_tax_rate": json.dumps(dict(([d.tax_type, d.tax_rate] for d in
|
||||
item_bean.doclist.get({"parentfield": "item_tax"})))),
|
||||
"batch_no": None,
|
||||
"expense_head": item.purchase_account \
|
||||
or webnotes.conn.get_value("Company", args.company, "default_expense_account"),
|
||||
"cost_center": item.cost_center
|
||||
})
|
||||
|
||||
for fieldname in ("item_name", "item_group", "brand", "stock_uom"):
|
||||
out[fieldname] = item.fields.get(fieldname)
|
||||
|
||||
return out
|
||||
|
||||
def _get_price_list_rate(args, item_bean, meta):
|
||||
from utilities.transaction_base import validate_currency
|
||||
item = item_bean.doc
|
||||
out = webnotes._dict()
|
||||
|
||||
# try fetching from price list
|
||||
if args.buying_price_list and args.price_list_currency:
|
||||
price_list_rate = webnotes.conn.sql("""select ref_rate from `tabItem Price`
|
||||
where price_list=%s and item_code=%s and buying_or_selling='Buying'""",
|
||||
(args.buying_price_list, args.item_code), as_dict=1)
|
||||
|
||||
if price_list_rate:
|
||||
validate_currency(args, item_bean.doc, meta)
|
||||
|
||||
out.import_ref_rate = flt(price_list_rate[0].ref_rate) * \
|
||||
flt(args.plc_conversion_rate) / flt(args.conversion_rate)
|
||||
|
||||
# if not found, fetch from last purchase transaction
|
||||
if not out.import_ref_rate:
|
||||
last_purchase = get_last_purchase_details(item.name, args.docname, args.conversion_rate)
|
||||
if last_purchase:
|
||||
out.update(last_purchase)
|
||||
|
||||
if out.import_ref_rate or out.import_rate:
|
||||
validate_currency(args, item, meta)
|
||||
|
||||
return out
|
||||
|
||||
def _get_supplier_part_no(args, item_bean):
|
||||
item_supplier = item_bean.doclist.get({"parentfield": "item_supplier_details",
|
||||
"supplier": args.supplier})
|
||||
|
||||
return item_supplier and item_supplier[0].supplier_part_no or None
|
||||
|
||||
def _validate_item_details(args, item):
|
||||
from utilities.transaction_base import validate_item_fetch
|
||||
validate_item_fetch(args, item)
|
||||
|
||||
# validate if purchase item or subcontracted item
|
||||
if item.is_purchase_item != "Yes":
|
||||
msgprint(_("Item") + (" %s: " % item.name) + _("not a purchase item"),
|
||||
raise_exception=True)
|
||||
|
||||
if args.is_subcontracted == "Yes" and item.is_sub_contracted_item != "Yes":
|
||||
msgprint(_("Item") + (" %s: " % item.name) +
|
||||
_("not a sub-contracted item.") +
|
||||
_("Please select a sub-contracted item or do not sub-contract the transaction."),
|
||||
raise_exception=True)
|
||||
|
||||
def get_last_purchase_details(item_code, doc_name=None, conversion_rate=1.0):
|
||||
"""returns last purchase details in stock uom"""
|
||||
# get last purchase order item details
|
||||
last_purchase_order = webnotes.conn.sql("""\
|
||||
select po.name, po.transaction_date, po.conversion_rate,
|
||||
po_item.conversion_factor, po_item.purchase_ref_rate,
|
||||
po_item.discount_rate, po_item.purchase_rate
|
||||
from `tabPurchase Order` po, `tabPurchase Order Item` po_item
|
||||
where po.docstatus = 1 and po_item.item_code = %s and po.name != %s and
|
||||
po.name = po_item.parent
|
||||
order by po.transaction_date desc, po.name desc
|
||||
limit 1""", (item_code, cstr(doc_name)), as_dict=1)
|
||||
|
||||
# get last purchase receipt item details
|
||||
last_purchase_receipt = webnotes.conn.sql("""\
|
||||
select pr.name, pr.posting_date, pr.posting_time, pr.conversion_rate,
|
||||
pr_item.conversion_factor, pr_item.purchase_ref_rate, pr_item.discount_rate,
|
||||
pr_item.purchase_rate
|
||||
from `tabPurchase Receipt` pr, `tabPurchase Receipt Item` pr_item
|
||||
where pr.docstatus = 1 and pr_item.item_code = %s and pr.name != %s and
|
||||
pr.name = pr_item.parent
|
||||
order by pr.posting_date desc, pr.posting_time desc, pr.name desc
|
||||
limit 1""", (item_code, cstr(doc_name)), as_dict=1)
|
||||
|
||||
purchase_order_date = getdate(last_purchase_order and last_purchase_order[0].transaction_date \
|
||||
or "1900-01-01")
|
||||
purchase_receipt_date = getdate(last_purchase_receipt and \
|
||||
last_purchase_receipt[0].posting_date or "1900-01-01")
|
||||
|
||||
if (purchase_order_date > purchase_receipt_date) or \
|
||||
(last_purchase_order and not last_purchase_receipt):
|
||||
# use purchase order
|
||||
last_purchase = last_purchase_order[0]
|
||||
purchase_date = purchase_order_date
|
||||
|
||||
elif (purchase_receipt_date > purchase_order_date) or \
|
||||
(last_purchase_receipt and not last_purchase_order):
|
||||
# use purchase receipt
|
||||
last_purchase = last_purchase_receipt[0]
|
||||
purchase_date = purchase_receipt_date
|
||||
|
||||
else:
|
||||
return webnotes._dict()
|
||||
|
||||
conversion_factor = flt(last_purchase.conversion_factor)
|
||||
out = webnotes._dict({
|
||||
"purchase_ref_rate": flt(last_purchase.purchase_ref_rate) / conversion_factor,
|
||||
"purchase_rate": flt(last_purchase.purchase_rate) / conversion_factor,
|
||||
"discount_rate": flt(last_purchase.discount_rate),
|
||||
"purchase_date": purchase_date
|
||||
})
|
||||
|
||||
conversion_rate = flt(conversion_rate) or 1.0
|
||||
out.update({
|
||||
"import_ref_rate": out.purchase_ref_rate / conversion_rate,
|
||||
"import_rate": out.purchase_rate / conversion_rate,
|
||||
"rate": out.purchase_rate
|
||||
})
|
||||
|
||||
return out
|
||||
|
||||
@webnotes.whitelist()
|
||||
def get_conversion_factor(item_code, uom):
|
||||
return {"conversion_factor": webnotes.conn.get_value("UOM Conversion Detail",
|
||||
{"parent": item_code, "uom": uom}, "conversion_factor")}
|
||||
|
||||
@webnotes.whitelist()
|
||||
def get_projected_qty(item_code, warehouse):
|
||||
return webnotes.conn.get_value("Bin", {"item_code": item_code,
|
||||
"warehouse": warehouse}, "projected_qty")
|
||||
78
config.json
78
config.json
@@ -1,78 +0,0 @@
|
||||
{
|
||||
"app_name": "ERPNext",
|
||||
"app_version": "3.3.1",
|
||||
"base_template": "app/portal/templates/base.html",
|
||||
"modules": {
|
||||
"Accounts": {
|
||||
"color": "#3498db",
|
||||
"icon": "icon-money",
|
||||
"link": "accounts-home",
|
||||
"type": "module"
|
||||
},
|
||||
"Activity": {
|
||||
"color": "#e67e22",
|
||||
"icon": "icon-play",
|
||||
"label": "Activity",
|
||||
"link": "activity",
|
||||
"type": "page"
|
||||
},
|
||||
"Buying": {
|
||||
"color": "#c0392b",
|
||||
"icon": "icon-shopping-cart",
|
||||
"link": "buying-home",
|
||||
"type": "module"
|
||||
},
|
||||
"HR": {
|
||||
"color": "#2ecc71",
|
||||
"icon": "icon-group",
|
||||
"label": "Human Resources",
|
||||
"link": "hr-home",
|
||||
"type": "module"
|
||||
},
|
||||
"Manufacturing": {
|
||||
"color": "#7f8c8d",
|
||||
"icon": "icon-cogs",
|
||||
"link": "manufacturing-home",
|
||||
"type": "module"
|
||||
},
|
||||
"Notes": {
|
||||
"color": "#95a5a6",
|
||||
"doctype": "Note",
|
||||
"icon": "icon-file-alt",
|
||||
"label": "Notes",
|
||||
"link": "List/Note",
|
||||
"type": "list"
|
||||
},
|
||||
"Projects": {
|
||||
"color": "#8e44ad",
|
||||
"icon": "icon-puzzle-piece",
|
||||
"link": "projects-home",
|
||||
"type": "module"
|
||||
},
|
||||
"Selling": {
|
||||
"color": "#1abc9c",
|
||||
"icon": "icon-tag",
|
||||
"link": "selling-home",
|
||||
"type": "module"
|
||||
},
|
||||
"Setup": {
|
||||
"color": "#bdc3c7",
|
||||
"icon": "icon-wrench",
|
||||
"link": "Setup",
|
||||
"type": "setup"
|
||||
},
|
||||
"Stock": {
|
||||
"color": "#f39c12",
|
||||
"icon": "icon-truck",
|
||||
"link": "stock-home",
|
||||
"type": "module"
|
||||
},
|
||||
"Support": {
|
||||
"color": "#2c3e50",
|
||||
"icon": "icon-phone",
|
||||
"link": "support-home",
|
||||
"type": "module"
|
||||
}
|
||||
},
|
||||
"requires_framework_version": "==3.3.1"
|
||||
}
|
||||
22
erpnext/accounts/Print Format/POS Invoice/POS Invoice.txt
Normal file
22
erpnext/accounts/Print Format/POS Invoice/POS Invoice.txt
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,9 +1,9 @@
|
||||
{%- if doc.letter_head -%}
|
||||
{{ webnotes.conn.get_value("Letter Head", doc.letter_head, "content") }}
|
||||
{{ frappe.db.get_value("Letter Head", doc.letter_head, "content") }}
|
||||
{%- endif -%}
|
||||
<!-- Page Layout Settings -->
|
||||
<div class='common page-header'>
|
||||
<table class='header-table' cellspacing=0>
|
||||
<table class='header-table' cellspacing=0 style="width: 100%">
|
||||
<thead>
|
||||
<tr><td colspan="2"><h1>{{ doc.select_print_heading or 'Invoice' }}</h1></td></tr>
|
||||
<tr><td colspan="2"><h3>{{ doc.name }}</h3></td></tr>
|
||||
@@ -28,18 +28,18 @@
|
||||
<tr>
|
||||
<td width=40%><b>Invoice Date</b></td>
|
||||
<td>{{ utils.formatdate(doc.posting_date) }}</td>
|
||||
<tr>
|
||||
</tr>
|
||||
{%- if doc.convert_into_recurring_invoice and doc.recurring_id -%}
|
||||
<tr>
|
||||
<td width=40%><b>Invoice Period</b></td>
|
||||
<td>{{ (utils.formatdate(doc.invoice_period_from_date)) +
|
||||
' to ' + utils.formatdate(doc.invoice_period_to_date) }}</td>
|
||||
<tr>
|
||||
</tr>
|
||||
{%- endif -%}
|
||||
<tr>
|
||||
<td><b>Due Date</b></td>
|
||||
<td>{{ utils.formatdate(doc.due_date) }}</td>
|
||||
<tr>
|
||||
</tr>
|
||||
</tbody></table></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@@ -72,8 +72,8 @@
|
||||
<td style="width: 37%;">{{ row.description }}</td>
|
||||
<td style="width: 5%; text-align: right;">{{ row.qty }}</td>
|
||||
<td style="width: 5%;">{{ row.stock_uom }}</td>
|
||||
<td style="width: 15%; text-align: right;">{{ utils.fmt_money(row.export_rate, currency=doc.currency) }}</td>
|
||||
<td style="width: 15%; text-align: right;">{{ utils.fmt_money(row.export_amount, currency=doc.currency) }}</td>
|
||||
<td style="width: 15%; text-align: right;">{{ utils.fmt_money(row.rate, currency=doc.currency) }}</td>
|
||||
<td style="width: 15%; text-align: right;">{{ utils.fmt_money(row.amount, currency=doc.currency) }}</td>
|
||||
</tr>
|
||||
{% endfor -%}
|
||||
</tbody>
|
||||
@@ -11,7 +11,7 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
||||
// -----------------------------------------
|
||||
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
||||
if(doc.__islocal) {
|
||||
msgprint(wn._("Please create new account from Chart of Accounts."));
|
||||
msgprint(frappe._("Please create new account from Chart of Accounts."));
|
||||
throw "cannot create";
|
||||
}
|
||||
|
||||
@@ -26,8 +26,8 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
||||
'is_pl_account', 'company'], false);
|
||||
|
||||
if(doc.group_or_ledger=='Ledger') {
|
||||
wn.model.with_doc("Accounts Settings", "Accounts Settings", function (name) {
|
||||
var accounts_settings = wn.model.get_doc("Accounts Settings", name);
|
||||
frappe.model.with_doc("Accounts Settings", "Accounts Settings", function (name) {
|
||||
var accounts_settings = frappe.model.get_doc("Accounts Settings", name);
|
||||
var display = accounts_settings["frozen_accounts_modifier"]
|
||||
&& in_list(user_roles, accounts_settings["frozen_accounts_modifier"]);
|
||||
|
||||
@@ -37,8 +37,8 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
||||
|
||||
// read-only for root accounts
|
||||
if(!doc.parent_account) {
|
||||
cur_frm.perm = [[1,0,0], [1,0,0]];
|
||||
cur_frm.set_intro(wn._("This is a root account and cannot be edited."));
|
||||
cur_frm.set_read_only();
|
||||
cur_frm.set_intro(frappe._("This is a root account and cannot be edited."));
|
||||
} else {
|
||||
// credit days and type if customer or supplier
|
||||
cur_frm.set_intro(null);
|
||||
@@ -81,23 +81,24 @@ cur_frm.cscript.account_type = function(doc, cdt, cdn) {
|
||||
// Hide/unhide group or ledger
|
||||
// -----------------------------------------
|
||||
cur_frm.cscript.add_toolbar_buttons = function(doc) {
|
||||
cur_frm.appframe.add_button(wn._('Chart of Accounts'),
|
||||
function() { wn.set_route("Accounts Browser", "Account"); }, 'icon-sitemap')
|
||||
cur_frm.appframe.add_button(frappe._('Chart of Accounts'),
|
||||
function() { frappe.set_route("Accounts Browser", "Account"); }, 'icon-sitemap')
|
||||
|
||||
if (cstr(doc.group_or_ledger) == 'Group') {
|
||||
cur_frm.add_custom_button(wn._('Convert to Ledger'),
|
||||
cur_frm.add_custom_button(frappe._('Convert to Ledger'),
|
||||
function() { cur_frm.cscript.convert_to_ledger(); }, 'icon-retweet')
|
||||
} else if (cstr(doc.group_or_ledger) == 'Ledger') {
|
||||
cur_frm.add_custom_button(wn._('Convert to Group'),
|
||||
cur_frm.add_custom_button(frappe._('Convert to Group'),
|
||||
function() { cur_frm.cscript.convert_to_group(); }, 'icon-retweet')
|
||||
|
||||
cur_frm.appframe.add_button(wn._('View Ledger'), function() {
|
||||
wn.route_options = {
|
||||
cur_frm.appframe.add_button(frappe._('View Ledger'), function() {
|
||||
frappe.route_options = {
|
||||
"account": doc.name,
|
||||
"from_date": sys_defaults.year_start_date,
|
||||
"to_date": sys_defaults.year_end_date
|
||||
"to_date": sys_defaults.year_end_date,
|
||||
"company": doc.company
|
||||
};
|
||||
wn.set_route("general-ledger");
|
||||
frappe.set_route("query-report", "General Ledger");
|
||||
}, "icon-table");
|
||||
}
|
||||
}
|
||||
@@ -2,12 +2,12 @@
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
import frappe
|
||||
|
||||
from webnotes.utils import flt, fmt_money, cstr, cint
|
||||
from webnotes import msgprint, _
|
||||
from frappe.utils import flt, fmt_money, cstr, cint
|
||||
from frappe import msgprint, throw, _
|
||||
|
||||
get_value = webnotes.conn.get_value
|
||||
get_value = frappe.db.get_value
|
||||
|
||||
class DocType:
|
||||
def __init__(self,d,dl):
|
||||
@@ -16,11 +16,11 @@ class DocType:
|
||||
|
||||
def autoname(self):
|
||||
self.doc.name = self.doc.account_name.strip() + ' - ' + \
|
||||
webnotes.conn.get_value("Company", self.doc.company, "abbr")
|
||||
frappe.db.get_value("Company", self.doc.company, "abbr")
|
||||
|
||||
def get_address(self):
|
||||
return {
|
||||
'address': webnotes.conn.get_value(self.doc.master_type,
|
||||
'address': frappe.db.get_value(self.doc.master_type,
|
||||
self.doc.master_name, "address")
|
||||
}
|
||||
|
||||
@@ -41,24 +41,29 @@ class DocType:
|
||||
if self.doc.master_type in ('Customer', 'Supplier') or self.doc.account_type == "Warehouse":
|
||||
if not self.doc.master_name:
|
||||
msgprint(_("Please enter Master Name once the account is created."))
|
||||
elif not webnotes.conn.exists(self.doc.master_type or self.doc.account_type,
|
||||
elif not frappe.db.exists(self.doc.master_type or self.doc.account_type,
|
||||
self.doc.master_name):
|
||||
webnotes.throw(_("Invalid Master Name"))
|
||||
throw(_("Invalid Master Name"))
|
||||
|
||||
def validate_parent(self):
|
||||
"""Fetch Parent Details and validation for account not to be created under ledger"""
|
||||
if self.doc.parent_account:
|
||||
par = webnotes.conn.sql("""select name, group_or_ledger, is_pl_account, debit_or_credit
|
||||
par = frappe.db.sql("""select name, group_or_ledger, is_pl_account, debit_or_credit
|
||||
from tabAccount where name =%s""", self.doc.parent_account)
|
||||
if not par:
|
||||
msgprint("Parent account does not exists", raise_exception=1)
|
||||
throw(_("Parent account does not exists"))
|
||||
elif par[0][0] == self.doc.name:
|
||||
msgprint("You can not assign itself as parent account", raise_exception=1)
|
||||
throw(_("You can not assign itself as parent account"))
|
||||
elif par[0][1] != 'Group':
|
||||
msgprint("Parent account can not be a ledger", raise_exception=1)
|
||||
throw(_("Parent account can not be a ledger"))
|
||||
elif self.doc.debit_or_credit and par[0][3] != self.doc.debit_or_credit:
|
||||
msgprint("You can not move a %s account under %s account" %
|
||||
(self.doc.debit_or_credit, par[0][3]), raise_exception=1)
|
||||
throw("{msg} {debit_or_credit} {under} {account} {acc}".format(**{
|
||||
"msg": _("You cannot move a"),
|
||||
"debit_or_credit": self.doc.debit_or_credit,
|
||||
"under": _("account under"),
|
||||
"account": par[0][3],
|
||||
"acc": _("account")
|
||||
}))
|
||||
|
||||
if not self.doc.is_pl_account:
|
||||
self.doc.is_pl_account = par[0][2]
|
||||
@@ -67,42 +72,48 @@ class DocType:
|
||||
|
||||
def validate_max_root_accounts(self):
|
||||
"""Raise exception if there are more than 4 root accounts"""
|
||||
if webnotes.conn.sql("""select count(*) from tabAccount where
|
||||
if frappe.db.sql("""select count(*) from tabAccount where
|
||||
company=%s and ifnull(parent_account,'')='' and docstatus != 2""",
|
||||
self.doc.company)[0][0] > 4:
|
||||
webnotes.msgprint("One company cannot have more than 4 root Accounts",
|
||||
raise_exception=1)
|
||||
throw(_("One company cannot have more than 4 root Accounts"))
|
||||
|
||||
def validate_duplicate_account(self):
|
||||
if self.doc.fields.get('__islocal') or not self.doc.name:
|
||||
company_abbr = webnotes.conn.get_value("Company", self.doc.company, "abbr")
|
||||
if webnotes.conn.sql("""select name from tabAccount where name=%s""",
|
||||
company_abbr = frappe.db.get_value("Company", self.doc.company, "abbr")
|
||||
if frappe.db.sql("""select name from tabAccount where name=%s""",
|
||||
(self.doc.account_name + " - " + company_abbr)):
|
||||
msgprint("Account Name: %s already exists, please rename"
|
||||
% self.doc.account_name, raise_exception=1)
|
||||
throw("{name}: {acc_name} {exist}, {rename}".format(**{
|
||||
"name": _("Account Name"),
|
||||
"acc_name": self.doc.account_name,
|
||||
"exist": _("already exists"),
|
||||
"rename": _("please rename")
|
||||
}))
|
||||
|
||||
def validate_root_details(self):
|
||||
#does not exists parent
|
||||
if webnotes.conn.exists("Account", self.doc.name):
|
||||
if not webnotes.conn.get_value("Account", self.doc.name, "parent_account"):
|
||||
webnotes.msgprint("Root cannot be edited.", raise_exception=1)
|
||||
if frappe.db.exists("Account", self.doc.name):
|
||||
if not frappe.db.get_value("Account", self.doc.name, "parent_account"):
|
||||
throw(_("Root cannot be edited."))
|
||||
|
||||
def validate_frozen_accounts_modifier(self):
|
||||
old_value = webnotes.conn.get_value("Account", self.doc.name, "freeze_account")
|
||||
old_value = frappe.db.get_value("Account", self.doc.name, "freeze_account")
|
||||
if old_value and old_value != self.doc.freeze_account:
|
||||
frozen_accounts_modifier = webnotes.conn.get_value( 'Accounts Settings', None,
|
||||
frozen_accounts_modifier = frappe.db.get_value( 'Accounts Settings', None,
|
||||
'frozen_accounts_modifier')
|
||||
if not frozen_accounts_modifier or \
|
||||
frozen_accounts_modifier not in webnotes.user.get_roles():
|
||||
webnotes.throw(_("You are not authorized to set Frozen value"))
|
||||
frozen_accounts_modifier not in frappe.user.get_roles():
|
||||
throw(_("You are not authorized to set Frozen value"))
|
||||
|
||||
def convert_group_to_ledger(self):
|
||||
if self.check_if_child_exists():
|
||||
msgprint("Account: %s has existing child. You can not convert this account to ledger" %
|
||||
(self.doc.name), raise_exception=1)
|
||||
throw("{acc}: {account_name} {child}. {msg}".format(**{
|
||||
"acc": _("Account"),
|
||||
"account_name": self.doc.name,
|
||||
"child": _("has existing child"),
|
||||
"msg": _("You can not convert this account to ledger")
|
||||
}))
|
||||
elif self.check_gle_exists():
|
||||
msgprint("Account with existing transaction can not be converted to ledger.",
|
||||
raise_exception=1)
|
||||
throw(_("Account with existing transaction can not be converted to ledger."))
|
||||
else:
|
||||
self.doc.group_or_ledger = 'Ledger'
|
||||
self.doc.save()
|
||||
@@ -110,11 +121,9 @@ class DocType:
|
||||
|
||||
def convert_ledger_to_group(self):
|
||||
if self.check_gle_exists():
|
||||
msgprint("Account with existing transaction can not be converted to group.",
|
||||
raise_exception=1)
|
||||
throw(_("Account with existing transaction can not be converted to group."))
|
||||
elif self.doc.master_type or self.doc.account_type:
|
||||
msgprint("Cannot covert to Group because Master Type or Account Type is selected.",
|
||||
raise_exception=1)
|
||||
throw(_("Cannot covert to Group because Master Type or Account Type is selected."))
|
||||
else:
|
||||
self.doc.group_or_ledger = 'Group'
|
||||
self.doc.save()
|
||||
@@ -122,42 +131,42 @@ class DocType:
|
||||
|
||||
# Check if any previous balance exists
|
||||
def check_gle_exists(self):
|
||||
return webnotes.conn.get_value("GL Entry", {"account": self.doc.name})
|
||||
return frappe.db.get_value("GL Entry", {"account": self.doc.name})
|
||||
|
||||
def check_if_child_exists(self):
|
||||
return webnotes.conn.sql("""select name from `tabAccount` where parent_account = %s
|
||||
return frappe.db.sql("""select name from `tabAccount` where parent_account = %s
|
||||
and docstatus != 2""", self.doc.name)
|
||||
|
||||
def validate_mandatory(self):
|
||||
if not self.doc.debit_or_credit:
|
||||
msgprint("Debit or Credit field is mandatory", raise_exception=1)
|
||||
throw(_("Debit or Credit field is mandatory"))
|
||||
if not self.doc.is_pl_account:
|
||||
msgprint("Is PL Account field is mandatory", raise_exception=1)
|
||||
throw(_("Is PL Account field is mandatory"))
|
||||
|
||||
def validate_warehouse_account(self):
|
||||
if not cint(webnotes.defaults.get_global_default("auto_accounting_for_stock")):
|
||||
if not cint(frappe.defaults.get_global_default("auto_accounting_for_stock")):
|
||||
return
|
||||
|
||||
if self.doc.account_type == "Warehouse":
|
||||
old_warehouse = cstr(webnotes.conn.get_value("Account", self.doc.name, "master_name"))
|
||||
old_warehouse = cstr(frappe.db.get_value("Account", self.doc.name, "master_name"))
|
||||
if old_warehouse != cstr(self.doc.master_name):
|
||||
if old_warehouse:
|
||||
self.validate_warehouse(old_warehouse)
|
||||
if self.doc.master_name:
|
||||
self.validate_warehouse(self.doc.master_name)
|
||||
else:
|
||||
webnotes.throw(_("Master Name is mandatory if account type is Warehouse"))
|
||||
throw(_("Master Name is mandatory if account type is Warehouse"))
|
||||
|
||||
def validate_warehouse(self, warehouse):
|
||||
if webnotes.conn.get_value("Stock Ledger Entry", {"warehouse": warehouse}):
|
||||
webnotes.throw(_("Stock transactions exist against warehouse ") + warehouse +
|
||||
if frappe.db.get_value("Stock Ledger Entry", {"warehouse": warehouse}):
|
||||
throw(_("Stock transactions exist against warehouse ") + warehouse +
|
||||
_(" .You can not assign / modify / remove Master Name"))
|
||||
|
||||
def update_nsm_model(self):
|
||||
"""update lft, rgt indices for nested set model"""
|
||||
import webnotes
|
||||
import webnotes.utils.nestedset
|
||||
webnotes.utils.nestedset.update_nsm(self)
|
||||
import frappe
|
||||
import frappe.utils.nestedset
|
||||
frappe.utils.nestedset.update_nsm(self)
|
||||
|
||||
def on_update(self):
|
||||
self.validate_max_root_accounts()
|
||||
@@ -165,40 +174,39 @@ class DocType:
|
||||
|
||||
def get_authorized_user(self):
|
||||
# Check logged-in user is authorized
|
||||
if webnotes.conn.get_value('Accounts Settings', None, 'credit_controller') \
|
||||
in webnotes.user.get_roles():
|
||||
if frappe.db.get_value('Accounts Settings', None, 'credit_controller') \
|
||||
in frappe.user.get_roles():
|
||||
return 1
|
||||
|
||||
def check_credit_limit(self, total_outstanding):
|
||||
# Get credit limit
|
||||
credit_limit_from = 'Customer'
|
||||
|
||||
cr_limit = webnotes.conn.sql("""select t1.credit_limit from tabCustomer t1, `tabAccount` t2
|
||||
cr_limit = frappe.db.sql("""select t1.credit_limit from tabCustomer t1, `tabAccount` t2
|
||||
where t2.name=%s and t1.name = t2.master_name""", self.doc.name)
|
||||
credit_limit = cr_limit and flt(cr_limit[0][0]) or 0
|
||||
if not credit_limit:
|
||||
credit_limit = webnotes.conn.get_value('Company', self.doc.company, 'credit_limit')
|
||||
credit_limit = frappe.db.get_value('Company', self.doc.company, 'credit_limit')
|
||||
credit_limit_from = 'Company'
|
||||
|
||||
# If outstanding greater than credit limit and not authorized person raise exception
|
||||
if credit_limit > 0 and flt(total_outstanding) > credit_limit \
|
||||
and not self.get_authorized_user():
|
||||
msgprint("""Total Outstanding amount (%s) for <b>%s</b> can not be \
|
||||
throw("""Total Outstanding amount (%s) for <b>%s</b> can not be \
|
||||
greater than credit limit (%s). To change your credit limit settings, \
|
||||
please update in the <b>%s</b> master""" % (fmt_money(total_outstanding),
|
||||
self.doc.name, fmt_money(credit_limit), credit_limit_from), raise_exception=1)
|
||||
self.doc.name, fmt_money(credit_limit), credit_limit_from))
|
||||
|
||||
def validate_trash(self):
|
||||
"""checks gl entries and if child exists"""
|
||||
if not self.doc.parent_account:
|
||||
msgprint("Root account can not be deleted", raise_exception=1)
|
||||
throw(_("Root account can not be deleted"))
|
||||
|
||||
if self.check_gle_exists():
|
||||
msgprint("""Account with existing transaction (Sales Invoice / Purchase Invoice / \
|
||||
Journal Voucher) can not be deleted""", raise_exception=1)
|
||||
throw("""Account with existing transaction (Sales Invoice / Purchase Invoice / \
|
||||
Journal Voucher) can not be deleted""")
|
||||
if self.check_if_child_exists():
|
||||
msgprint("Child account exists for this account. You can not delete this account.",
|
||||
raise_exception=1)
|
||||
throw(_("Child account exists for this account. You can not delete this account."))
|
||||
|
||||
def on_trash(self):
|
||||
self.validate_trash()
|
||||
@@ -206,16 +214,19 @@ class DocType:
|
||||
|
||||
def before_rename(self, old, new, merge=False):
|
||||
# Add company abbr if not provided
|
||||
from setup.doctype.company.company import get_name_with_abbr
|
||||
from erpnext.setup.doctype.company.company import get_name_with_abbr
|
||||
new_account = get_name_with_abbr(new, self.doc.company)
|
||||
|
||||
# Validate properties before merging
|
||||
if merge:
|
||||
val = list(webnotes.conn.get_value("Account", new_account,
|
||||
["group_or_ledger", "debit_or_credit", "is_pl_account"]))
|
||||
if not frappe.db.exists("Account", new):
|
||||
throw(_("Account ") + new +_(" does not exists"))
|
||||
|
||||
val = list(frappe.db.get_value("Account", new_account,
|
||||
["group_or_ledger", "debit_or_credit", "is_pl_account", "company"]))
|
||||
|
||||
if val != [self.doc.group_or_ledger, self.doc.debit_or_credit, self.doc.is_pl_account]:
|
||||
webnotes.throw(_("""Merging is only possible if following \
|
||||
if val != [self.doc.group_or_ledger, self.doc.debit_or_credit, self.doc.is_pl_account, self.doc.company]:
|
||||
throw(_("""Merging is only possible if following \
|
||||
properties are same in both records.
|
||||
Group or Ledger, Debit or Credit, Is PL Account"""))
|
||||
|
||||
@@ -223,22 +234,22 @@ class DocType:
|
||||
|
||||
def after_rename(self, old, new, merge=False):
|
||||
if not merge:
|
||||
webnotes.conn.set_value("Account", new, "account_name",
|
||||
frappe.db.set_value("Account", new, "account_name",
|
||||
" - ".join(new.split(" - ")[:-1]))
|
||||
else:
|
||||
from webnotes.utils.nestedset import rebuild_tree
|
||||
from frappe.utils.nestedset import rebuild_tree
|
||||
rebuild_tree("Account", "parent_account")
|
||||
|
||||
def get_master_name(doctype, txt, searchfield, start, page_len, filters):
|
||||
conditions = (" and company='%s'"% filters["company"]) if doctype == "Warehouse" else ""
|
||||
|
||||
return webnotes.conn.sql("""select name from `tab%s` where %s like %s %s
|
||||
return frappe.db.sql("""select name from `tab%s` where %s like %s %s
|
||||
order by name limit %s, %s""" %
|
||||
(filters["master_type"], searchfield, "%s", conditions, "%s", "%s"),
|
||||
("%%%s%%" % txt, start, page_len), as_list=1)
|
||||
|
||||
def get_parent_account(doctype, txt, searchfield, start, page_len, filters):
|
||||
return webnotes.conn.sql("""select name from tabAccount
|
||||
return frappe.db.sql("""select name from tabAccount
|
||||
where group_or_ledger = 'Group' and docstatus != 2 and company = %s
|
||||
and %s like %s order by name limit %s, %s""" %
|
||||
("%s", searchfield, "%s", "%s", "%s"),
|
||||
@@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-01-30 12:49:46",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-09-24 11:22:18",
|
||||
"modified": "2014-01-20 17:48:20",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@@ -28,6 +28,7 @@
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"cancel": 0,
|
||||
"doctype": "DocPerm",
|
||||
"name": "__common__",
|
||||
"parent": "Account",
|
||||
@@ -138,6 +139,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "parent_account",
|
||||
"fieldtype": "Link",
|
||||
"ignore_restrictions": 1,
|
||||
"label": "Parent Account",
|
||||
"oldfieldname": "parent_account",
|
||||
"oldfieldtype": "Link",
|
||||
@@ -154,7 +156,6 @@
|
||||
"oldfieldname": "account_type",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "\nFixed Asset Account\nBank or Cash\nExpense Account\nTax\nIncome Account\nChargeable\nWarehouse",
|
||||
"permlevel": 0,
|
||||
"search_index": 0
|
||||
},
|
||||
{
|
||||
@@ -254,64 +255,77 @@
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"doctype": "DocPerm",
|
||||
"email": 1,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"role": "Accounts User",
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
"doctype": "DocPerm",
|
||||
"email": 1,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"role": "Auditor",
|
||||
"write": 0
|
||||
},
|
||||
{
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
"doctype": "DocPerm",
|
||||
"email": 1,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"role": "Sales User",
|
||||
"write": 0
|
||||
},
|
||||
{
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
"doctype": "DocPerm",
|
||||
"email": 1,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"role": "Purchase User",
|
||||
"write": 0
|
||||
},
|
||||
{
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
"doctype": "DocPerm",
|
||||
"permlevel": 2,
|
||||
"role": "Auditor",
|
||||
"write": 0
|
||||
},
|
||||
{
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"doctype": "DocPerm",
|
||||
"email": 1,
|
||||
"export": 0,
|
||||
"import": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"restrict": 1,
|
||||
"role": "Accounts Manager",
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
"doctype": "DocPerm",
|
||||
"permlevel": 2,
|
||||
"role": "Accounts Manager",
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
"doctype": "DocPerm",
|
||||
"permlevel": 2,
|
||||
"role": "Accounts User",
|
||||
@@ -2,10 +2,10 @@
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
import frappe
|
||||
|
||||
def make_test_records(verbose):
|
||||
from webnotes.test_runner import make_test_objects
|
||||
def _make_test_records(verbose):
|
||||
from frappe.test_runner import make_test_objects
|
||||
|
||||
accounts = [
|
||||
# [account_name, parent_account, group_or_ledger]
|
||||
@@ -0,0 +1,31 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
# For license information, please see license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe import _
|
||||
from frappe.utils import cint
|
||||
|
||||
class DocType:
|
||||
def __init__(self, d, dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
|
||||
def on_update(self):
|
||||
frappe.db.set_default("auto_accounting_for_stock", self.doc.auto_accounting_for_stock)
|
||||
|
||||
if cint(self.doc.auto_accounting_for_stock):
|
||||
# set default perpetual account in company
|
||||
for company in frappe.db.sql("select name from tabCompany"):
|
||||
frappe.bean("Company", company[0]).save()
|
||||
|
||||
# Create account head for warehouses
|
||||
warehouse_list = frappe.db.sql("select name, company from tabWarehouse", as_dict=1)
|
||||
warehouse_with_no_company = [d.name for d in warehouse_list if not d.company]
|
||||
if warehouse_with_no_company:
|
||||
frappe.throw(_("Company is missing in following warehouses") + ": \n" +
|
||||
"\n".join(warehouse_with_no_company))
|
||||
for wh in warehouse_list:
|
||||
wh_bean = frappe.bean("Warehouse", wh.name)
|
||||
wh_bean.save()
|
||||
@@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-06-24 15:49:57",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-09-24 11:52:58",
|
||||
"modified": "2013-12-20 19:22:52",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@@ -25,11 +25,13 @@
|
||||
{
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"email": 1,
|
||||
"name": "__common__",
|
||||
"parent": "Accounts Settings",
|
||||
"parentfield": "permissions",
|
||||
"parenttype": "DocType",
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"role": "Accounts Manager",
|
||||
"write": 1
|
||||
@@ -1,9 +1,8 @@
|
||||
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
// License: GNU General Public License v3. See license.txt
|
||||
|
||||
|
||||
cur_frm.add_fetch("bank_account", "company", "company");
|
||||
cur_frm.cscript.onload = function(doc, cdt, cdn){
|
||||
cur_frm.set_intro('<i class="icon-question" /> ' +
|
||||
wn._("Update clearance date of Journal Entries marked as 'Bank Vouchers'"))
|
||||
}
|
||||
frappe._("Update clearance date of Journal Entries marked as 'Bank Vouchers'"))
|
||||
}
|
||||
@@ -2,13 +2,13 @@
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
import frappe
|
||||
|
||||
from webnotes.utils import cstr, flt, getdate, now, nowdate
|
||||
from webnotes.model import db_exists
|
||||
from webnotes.model.doc import addchild
|
||||
from webnotes.model.bean import getlist, copy_doclist
|
||||
from webnotes import msgprint
|
||||
from frappe.utils import cstr, flt, getdate, now, nowdate
|
||||
from frappe.model import db_exists
|
||||
from frappe.model.doc import addchild
|
||||
from frappe.model.bean import getlist, copy_doclist
|
||||
from frappe import msgprint
|
||||
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ class DocType:
|
||||
msgprint("Bank Account, From Date and To Date are Mandatory")
|
||||
return
|
||||
|
||||
dl = webnotes.conn.sql("select t1.name, t1.cheque_no, t1.cheque_date, t2.debit, t2.credit, t1.posting_date, t2.against_account from `tabJournal Voucher` t1, `tabJournal Voucher Detail` t2 where t2.parent = t1.name and t2.account = %s and (clearance_date is null or clearance_date = '0000-00-00' or clearance_date = '') and t1.posting_date >= %s and t1.posting_date <= %s and t1.docstatus=1", (self.doc.bank_account, self.doc.from_date, self.doc.to_date))
|
||||
dl = frappe.db.sql("select t1.name, t1.cheque_no, t1.cheque_date, t2.debit, t2.credit, t1.posting_date, t2.against_account from `tabJournal Voucher` t1, `tabJournal Voucher Detail` t2 where t2.parent = t1.name and t2.account = %s and (clearance_date is null or clearance_date = '0000-00-00' or clearance_date = '') and t1.posting_date >= %s and t1.posting_date <= %s and t1.docstatus=1", (self.doc.bank_account, self.doc.from_date, self.doc.to_date))
|
||||
|
||||
self.doclist = self.doc.clear_table(self.doclist, 'entries')
|
||||
self.doc.total_amount = 0.0
|
||||
@@ -46,7 +46,7 @@ class DocType:
|
||||
msgprint("Clearance Date can not be before Cheque Date (Row #%s)" %
|
||||
d.idx, raise_exception=1)
|
||||
|
||||
webnotes.conn.sql("""update `tabJournal Voucher`
|
||||
frappe.db.sql("""update `tabJournal Voucher`
|
||||
set clearance_date = %s, modified = %s where name=%s""",
|
||||
(d.clearance_date, nowdate(), d.voucher_id))
|
||||
vouchers.append(d.voucher_id)
|
||||
@@ -2,7 +2,7 @@
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
import frappe
|
||||
|
||||
class DocType:
|
||||
def __init__(self, d, dl):
|
||||
@@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-02-22 01:27:37",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-11-03 14:11:31",
|
||||
"modified": "2013-12-20 19:22:55",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@@ -2,7 +2,7 @@
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
import frappe
|
||||
|
||||
class DocType:
|
||||
def __init__(self, d, dl):
|
||||
@@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-03-07 11:55:04",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-08-22 17:27:59",
|
||||
"modified": "2013-12-20 19:22:59",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@@ -8,7 +8,7 @@ cur_frm.cscript.onload = function(doc,cdt,cdn){
|
||||
}
|
||||
|
||||
return $c('runserverobj',args={'method' : 'get_months', 'docs' :
|
||||
wn.model.compress(make_doclist(doc.doctype, doc.name))},callback1);
|
||||
frappe.model.compress(make_doclist(doc.doctype, doc.name))},callback1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
import frappe
|
||||
|
||||
from webnotes.utils import flt
|
||||
from webnotes.model.doc import addchild
|
||||
from webnotes.model.bean import getlist
|
||||
from webnotes import msgprint, _
|
||||
from frappe.utils import flt
|
||||
from frappe.model.doc import addchild
|
||||
from frappe.model.bean import getlist
|
||||
from frappe import msgprint, _
|
||||
|
||||
class DocType:
|
||||
def __init__(self,doc,doclist=[]):
|
||||
@@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-01-10 16:34:05",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-07-22 15:30:37",
|
||||
"modified": "2014-01-20 17:48:27",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@@ -24,6 +24,7 @@
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"cancel": 0,
|
||||
"doctype": "DocPerm",
|
||||
"name": "__common__",
|
||||
"parent": "Budget Distribution",
|
||||
@@ -79,13 +80,16 @@
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"doctype": "DocPerm",
|
||||
"email": 1,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"delete": 0,
|
||||
"doctype": "DocPerm",
|
||||
"permlevel": 2
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
import frappe
|
||||
|
||||
class DocType:
|
||||
def __init__(self, d, dl):
|
||||
@@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-02-22 01:27:38",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-07-10 14:54:06",
|
||||
"modified": "2013-12-20 19:22:59",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@@ -2,9 +2,9 @@
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
from webnotes.utils import flt, getdate
|
||||
from webnotes.model.bean import getlist
|
||||
import frappe
|
||||
from frappe.utils import flt, getdate
|
||||
from frappe.model.bean import getlist
|
||||
|
||||
class DocType:
|
||||
def __init__(self,d,dl):
|
||||
@@ -16,19 +16,19 @@ class DocType:
|
||||
|
||||
for d in getlist(self.doclist, 'invoice_details'):
|
||||
if d.invoice_no:
|
||||
inv = webnotes.conn.sql("""select c_form_applicable, c_form_no from
|
||||
inv = frappe.db.sql("""select c_form_applicable, c_form_no from
|
||||
`tabSales Invoice` where name = %s and docstatus = 1""", d.invoice_no)
|
||||
|
||||
if not inv:
|
||||
webnotes.msgprint("""Invoice: %s is not exists in the system or
|
||||
frappe.msgprint("""Invoice: %s is not exists in the system or
|
||||
is not submitted, please check.""" % d.invoice_no, raise_exception=1)
|
||||
|
||||
elif inv[0][0] != 'Yes':
|
||||
webnotes.msgprint("C-form is not applicable for Invoice: %s" %
|
||||
frappe.msgprint("C-form is not applicable for Invoice: %s" %
|
||||
d.invoice_no, raise_exception=1)
|
||||
|
||||
elif inv[0][1] and inv[0][1] != self.doc.name:
|
||||
webnotes.msgprint("""Invoice %s is tagged in another C-form: %s.
|
||||
frappe.msgprint("""Invoice %s is tagged in another C-form: %s.
|
||||
If you want to change C-form no for this invoice,
|
||||
please remove invoice no from the previous c-form and then try again""" %
|
||||
(d.invoice_no, inv[0][1]), raise_exception=1)
|
||||
@@ -42,31 +42,31 @@ class DocType:
|
||||
|
||||
def before_cancel(self):
|
||||
# remove cform reference
|
||||
webnotes.conn.sql("""update `tabSales Invoice` set c_form_no=null
|
||||
frappe.db.sql("""update `tabSales Invoice` set c_form_no=null
|
||||
where c_form_no=%s""", self.doc.name)
|
||||
|
||||
def set_cform_in_sales_invoices(self):
|
||||
inv = [d.invoice_no for d in getlist(self.doclist, 'invoice_details')]
|
||||
if inv:
|
||||
webnotes.conn.sql("""update `tabSales Invoice` set c_form_no=%s, modified=%s
|
||||
frappe.db.sql("""update `tabSales Invoice` set c_form_no=%s, modified=%s
|
||||
where name in (%s)""" % ('%s', '%s', ', '.join(['%s'] * len(inv))),
|
||||
tuple([self.doc.name, self.doc.modified] + inv))
|
||||
|
||||
webnotes.conn.sql("""update `tabSales Invoice` set c_form_no = null, modified = %s
|
||||
frappe.db.sql("""update `tabSales Invoice` set c_form_no = null, modified = %s
|
||||
where name not in (%s) and ifnull(c_form_no, '') = %s""" %
|
||||
('%s', ', '.join(['%s']*len(inv)), '%s'),
|
||||
tuple([self.doc.modified] + inv + [self.doc.name]))
|
||||
else:
|
||||
webnotes.msgprint("Please enter atleast 1 invoice in the table", raise_exception=1)
|
||||
frappe.msgprint("Please enter atleast 1 invoice in the table", raise_exception=1)
|
||||
|
||||
def set_total_invoiced_amount(self):
|
||||
total = sum([flt(d.grand_total) for d in getlist(self.doclist, 'invoice_details')])
|
||||
webnotes.conn.set(self.doc, 'total_invoiced_amount', total)
|
||||
frappe.db.set(self.doc, 'total_invoiced_amount', total)
|
||||
|
||||
def get_invoice_details(self, invoice_no):
|
||||
""" Pull details from invoices for referrence """
|
||||
|
||||
inv = webnotes.conn.sql("""select posting_date, territory, net_total, grand_total
|
||||
inv = frappe.db.sql("""select posting_date, territory, net_total, grand_total
|
||||
from `tabSales Invoice` where name = %s""", invoice_no)
|
||||
return {
|
||||
'invoice_date' : inv and getdate(inv[0][0]).strftime('%Y-%m-%d') or '',
|
||||
@@ -76,10 +76,10 @@ class DocType:
|
||||
}
|
||||
|
||||
def get_invoice_nos(doctype, txt, searchfield, start, page_len, filters):
|
||||
from utilities import build_filter_conditions
|
||||
from erpnext.utilities import build_filter_conditions
|
||||
conditions, filter_values = build_filter_conditions(filters)
|
||||
|
||||
return webnotes.conn.sql("""select name from `tabSales Invoice` where docstatus = 1
|
||||
return frappe.db.sql("""select name from `tabSales Invoice` where docstatus = 1
|
||||
and c_form_applicable = 'Yes' and ifnull(c_form_no, '') = '' %s
|
||||
and %s like %s order by name limit %s, %s""" %
|
||||
(conditions, searchfield, "%s", "%s", "%s"),
|
||||
@@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-03-07 11:55:06",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-11-02 14:05:25",
|
||||
"modified": "2013-12-20 19:23:58",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@@ -157,6 +157,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "amended_from",
|
||||
"fieldtype": "Link",
|
||||
"ignore_restrictions": 1,
|
||||
"label": "Amended From",
|
||||
"no_copy": 1,
|
||||
"options": "C-Form",
|
||||
@@ -166,14 +167,18 @@
|
||||
{
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"email": 1,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"role": "Accounts User",
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"email": 1,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"role": "Accounts Manager",
|
||||
"write": 1
|
||||
},
|
||||
@@ -2,7 +2,7 @@
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
import frappe
|
||||
|
||||
class DocType:
|
||||
def __init__(self, d, dl):
|
||||
@@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-02-22 01:27:38",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-11-02 16:58:31",
|
||||
"modified": "2013-12-20 19:23:00",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@@ -1,8 +1,8 @@
|
||||
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
// License: GNU General Public License v3. See license.txt
|
||||
|
||||
wn.provide("erpnext.accounts");
|
||||
erpnext.accounts.CostCenterController = wn.ui.form.Controller.extend({
|
||||
frappe.provide("erpnext.accounts");
|
||||
erpnext.accounts.CostCenterController = frappe.ui.form.Controller.extend({
|
||||
onload: function() {
|
||||
this.setup_queries();
|
||||
},
|
||||
@@ -41,8 +41,8 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
||||
cur_frm.toggle_enable(['group_or_ledger', 'company'], doc.__islocal);
|
||||
|
||||
if(!doc.__islocal && doc.group_or_ledger=='Group') {
|
||||
intro_txt += '<p><b>'+wn._('Note:')+'</b>'+ wn._('This Cost Center is a')+ '<i>'+wn._('Group')+'</i>, '+
|
||||
wn._('Accounting Entries are not allowed against groups.')+'</p>';
|
||||
intro_txt += '<p><b>'+frappe._('Note:')+'</b>'+ frappe._('This Cost Center is a')+ '<i>'+frappe._('Group')+'</i>, '+
|
||||
frappe._('Accounting Entries are not allowed against groups.')+'</p>';
|
||||
}
|
||||
|
||||
cur_frm.cscript.hide_unhide_group_ledger(doc);
|
||||
@@ -50,22 +50,22 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
||||
cur_frm.toggle_display('sb1', doc.group_or_ledger=='Ledger')
|
||||
cur_frm.set_intro(intro_txt);
|
||||
|
||||
cur_frm.appframe.add_button(wn._('Chart of Cost Centers'),
|
||||
function() { wn.set_route("Accounts Browser", "Cost Center"); }, 'icon-sitemap')
|
||||
cur_frm.appframe.add_button(frappe._('Chart of Cost Centers'),
|
||||
function() { frappe.set_route("Accounts Browser", "Cost Center"); }, 'icon-sitemap')
|
||||
}
|
||||
|
||||
cur_frm.cscript.parent_cost_center = function(doc,cdt,cdn){
|
||||
cur_frm.cscript.parent_cost_center = function(doc, cdt, cdn) {
|
||||
if(!doc.company){
|
||||
alert(wn._('Please enter company name first'));
|
||||
msgprint(frappe._('Please enter company name first'));
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.cscript.hide_unhide_group_ledger = function(doc) {
|
||||
if (cstr(doc.group_or_ledger) == 'Group') {
|
||||
cur_frm.add_custom_button(wn._('Convert to Ledger'),
|
||||
cur_frm.add_custom_button(frappe._('Convert to Ledger'),
|
||||
function() { cur_frm.cscript.convert_to_ledger(); }, 'icon-retweet')
|
||||
} else if (cstr(doc.group_or_ledger) == 'Ledger') {
|
||||
cur_frm.add_custom_button(wn._('Convert to Group'),
|
||||
cur_frm.add_custom_button(frappe._('Convert to Group'),
|
||||
function() { cur_frm.cscript.convert_to_group(); }, 'icon-retweet')
|
||||
}
|
||||
}
|
||||
@@ -2,11 +2,11 @@
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
from webnotes.model.bean import getlist
|
||||
from webnotes import msgprint, _
|
||||
import frappe
|
||||
from frappe.model.bean import getlist
|
||||
from frappe import msgprint, _
|
||||
|
||||
from webnotes.utils.nestedset import DocTypeNestedSet
|
||||
from frappe.utils.nestedset import DocTypeNestedSet
|
||||
|
||||
class DocType(DocTypeNestedSet):
|
||||
def __init__(self,d,dl):
|
||||
@@ -14,7 +14,7 @@ class DocType(DocTypeNestedSet):
|
||||
self.nsm_parent_field = 'parent_cost_center'
|
||||
|
||||
def autoname(self):
|
||||
company_abbr = webnotes.conn.sql("select abbr from tabCompany where name=%s",
|
||||
company_abbr = frappe.db.sql("select abbr from tabCompany where name=%s",
|
||||
self.doc.company)[0][0]
|
||||
self.doc.name = self.doc.cost_center_name.strip() + ' - ' + company_abbr
|
||||
|
||||
@@ -46,10 +46,10 @@ class DocType(DocTypeNestedSet):
|
||||
return 1
|
||||
|
||||
def check_gle_exists(self):
|
||||
return webnotes.conn.get_value("GL Entry", {"cost_center": self.doc.name})
|
||||
return frappe.db.get_value("GL Entry", {"cost_center": self.doc.name})
|
||||
|
||||
def check_if_child_exists(self):
|
||||
return webnotes.conn.sql("select name from `tabCost Center` where \
|
||||
return frappe.db.sql("select name from `tabCost Center` where \
|
||||
parent_cost_center = %s and docstatus != 2", self.doc.name)
|
||||
|
||||
def validate_budget_details(self):
|
||||
@@ -67,7 +67,7 @@ class DocType(DocTypeNestedSet):
|
||||
"""
|
||||
Cost Center name must be unique
|
||||
"""
|
||||
if (self.doc.fields.get("__islocal") or not self.doc.name) and webnotes.conn.sql("select name from `tabCost Center` where cost_center_name = %s and company=%s", (self.doc.cost_center_name, self.doc.company)):
|
||||
if (self.doc.fields.get("__islocal") or not self.doc.name) and frappe.db.sql("select name from `tabCost Center` where cost_center_name = %s and company=%s", (self.doc.cost_center_name, self.doc.company)):
|
||||
msgprint("Cost Center Name already exists, please rename", raise_exception=1)
|
||||
|
||||
self.validate_mandatory()
|
||||
@@ -75,7 +75,7 @@ class DocType(DocTypeNestedSet):
|
||||
|
||||
def before_rename(self, olddn, newdn, merge=False):
|
||||
# Add company abbr if not provided
|
||||
from setup.doctype.company.company import get_name_with_abbr
|
||||
from erpnext.setup.doctype.company.company import get_name_with_abbr
|
||||
new_cost_center = get_name_with_abbr(newdn, self.doc.company)
|
||||
|
||||
# Validate properties before merging
|
||||
@@ -85,7 +85,7 @@ class DocType(DocTypeNestedSet):
|
||||
|
||||
def after_rename(self, olddn, newdn, merge=False):
|
||||
if not merge:
|
||||
webnotes.conn.set_value("Cost Center", newdn, "cost_center_name",
|
||||
frappe.db.set_value("Cost Center", newdn, "cost_center_name",
|
||||
" - ".join(newdn.split(" - ")[:-1]))
|
||||
else:
|
||||
super(DocType, self).after_rename(olddn, newdn, merge)
|
||||
@@ -2,12 +2,13 @@
|
||||
{
|
||||
"creation": "2013-01-23 19:57:17",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-07-22 15:23:10",
|
||||
"modified": "2014-01-20 17:48:30",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
{
|
||||
"allow_copy": 1,
|
||||
"allow_import": 1,
|
||||
"allow_rename": 1,
|
||||
"autoname": "field:cost_center_name",
|
||||
"description": "Track separate Income and Expense for product verticals or divisions.",
|
||||
@@ -29,12 +30,15 @@
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"cancel": 0,
|
||||
"doctype": "DocPerm",
|
||||
"email": 1,
|
||||
"name": "__common__",
|
||||
"parent": "Cost Center",
|
||||
"parentfield": "permissions",
|
||||
"parenttype": "DocType",
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"submit": 0
|
||||
@@ -74,6 +78,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "parent_cost_center",
|
||||
"fieldtype": "Link",
|
||||
"ignore_restrictions": 1,
|
||||
"label": "Parent Cost Center",
|
||||
"oldfieldname": "parent_cost_center",
|
||||
"oldfieldtype": "Link",
|
||||
@@ -171,6 +176,7 @@
|
||||
"fieldname": "old_parent",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 1,
|
||||
"ignore_restrictions": 1,
|
||||
"label": "old_parent",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "old_parent",
|
||||
@@ -180,15 +186,15 @@
|
||||
"report_hide": 1
|
||||
},
|
||||
{
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"doctype": "DocPerm",
|
||||
"role": "Accounts Manager",
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
"doctype": "DocPerm",
|
||||
"role": "Accounts User",
|
||||
"write": 0
|
||||
@@ -8,12 +8,12 @@ $.extend(cur_frm.cscript, {
|
||||
this.frm.toggle_enable('year_end_date', doc.__islocal)
|
||||
|
||||
if (!doc.__islocal && (doc.name != sys_defaults.fiscal_year)) {
|
||||
this.frm.add_custom_button(wn._("Set as Default"), this.frm.cscript.set_as_default);
|
||||
this.frm.set_intro(wn._("To set this Fiscal Year as Default, click on 'Set as Default'"));
|
||||
this.frm.add_custom_button(frappe._("Set as Default"), this.frm.cscript.set_as_default);
|
||||
this.frm.set_intro(frappe._("To set this Fiscal Year as Default, click on 'Set as Default'"));
|
||||
} else this.frm.set_intro("");
|
||||
},
|
||||
set_as_default: function() {
|
||||
return wn.call({
|
||||
return frappe.call({
|
||||
doc: cur_frm.doc,
|
||||
method: "set_as_default"
|
||||
});
|
||||
@@ -22,7 +22,7 @@ $.extend(cur_frm.cscript, {
|
||||
var me = this;
|
||||
|
||||
year_end_date =
|
||||
wn.datetime.add_days(wn.datetime.add_months(this.frm.doc.year_start_date, 12), -1);
|
||||
frappe.datetime.add_days(frappe.datetime.add_months(this.frm.doc.year_start_date, 12), -1);
|
||||
this.frm.set_value("year_end_date", year_end_date);
|
||||
},
|
||||
});
|
||||
@@ -2,46 +2,44 @@
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
from webnotes import msgprint, _
|
||||
from webnotes.utils import getdate
|
||||
import frappe
|
||||
from frappe import msgprint, _
|
||||
from frappe.utils import getdate
|
||||
|
||||
class DocType:
|
||||
def __init__(self, d, dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
|
||||
def set_as_default(self):
|
||||
webnotes.conn.set_value("Global Defaults", None, "current_fiscal_year", self.doc.name)
|
||||
webnotes.get_obj("Global Defaults").on_update()
|
||||
frappe.db.set_value("Global Defaults", None, "current_fiscal_year", self.doc.name)
|
||||
frappe.get_obj("Global Defaults").on_update()
|
||||
|
||||
# clear cache
|
||||
webnotes.clear_cache()
|
||||
frappe.clear_cache()
|
||||
|
||||
msgprint(self.doc.name + _(""" is now the default Fiscal Year. \
|
||||
Please refresh your browser for the change to take effect."""))
|
||||
|
||||
def validate(self):
|
||||
year_start_end_dates = webnotes.conn.sql("""select year_start_date, year_end_date
|
||||
year_start_end_dates = frappe.db.sql("""select year_start_date, year_end_date
|
||||
from `tabFiscal Year` where name=%s""", (self.doc.name))
|
||||
|
||||
if year_start_end_dates:
|
||||
if getdate(self.doc.year_start_date) != year_start_end_dates[0][0] or getdate(self.doc.year_end_date) != year_start_end_dates[0][1]:
|
||||
webnotes.throw(_("Cannot change Year Start Date and Year End Date \
|
||||
once the Fiscal Year is saved."))
|
||||
frappe.throw(_("Cannot change Year Start Date and Year End Date once the Fiscal Year is saved."))
|
||||
|
||||
def on_update(self):
|
||||
# validate year start date and year end date
|
||||
if getdate(self.doc.year_start_date) > getdate(self.doc.year_end_date):
|
||||
webnotes.throw(_("Year Start Date should not be greater than Year End Date"))
|
||||
frappe.throw(_("Year Start Date should not be greater than Year End Date"))
|
||||
|
||||
if (getdate(self.doc.year_end_date) - getdate(self.doc.year_start_date)).days > 366:
|
||||
webnotes.throw(_("Year Start Date and Year End Date are not within Fiscal Year."))
|
||||
frappe.throw(_("Year Start Date and Year End Date are not within Fiscal Year."))
|
||||
|
||||
year_start_end_dates = webnotes.conn.sql("""select name, year_start_date, year_end_date
|
||||
year_start_end_dates = frappe.db.sql("""select name, year_start_date, year_end_date
|
||||
from `tabFiscal Year` where name!=%s""", (self.doc.name))
|
||||
|
||||
for fiscal_year, ysd, yed in year_start_end_dates:
|
||||
if (getdate(self.doc.year_start_date) == ysd and getdate(self.doc.year_end_date) == yed) \
|
||||
and (not webnotes.flags.in_test):
|
||||
webnotes.throw(_("Year Start Date and Year End Date are already \
|
||||
set in Fiscal Year: ") + fiscal_year)
|
||||
and (not frappe.flags.in_test):
|
||||
frappe.throw(_("Year Start Date and Year End Date are already set in Fiscal Year: ") + fiscal_year)
|
||||
@@ -2,11 +2,12 @@
|
||||
{
|
||||
"creation": "2013-01-22 16:50:25",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-11-25 11:40:02",
|
||||
"modified": "2014-01-20 17:48:46",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
{
|
||||
"allow_import": 1,
|
||||
"autoname": "field:year",
|
||||
"description": "**Fiscal Year** represents a Financial Year. All accounting entries and other major transactions are tracked against **Fiscal Year**.",
|
||||
"doctype": "DocType",
|
||||
@@ -25,11 +26,13 @@
|
||||
},
|
||||
{
|
||||
"doctype": "DocPerm",
|
||||
"email": 1,
|
||||
"name": "__common__",
|
||||
"parent": "Fiscal Year",
|
||||
"parentfield": "permissions",
|
||||
"parenttype": "DocType",
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1
|
||||
},
|
||||
{
|
||||
@@ -78,8 +81,9 @@
|
||||
"reqd": 0
|
||||
},
|
||||
{
|
||||
"cancel": 1,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"doctype": "DocPerm",
|
||||
"report": 1,
|
||||
"role": "System Manager",
|
||||
@@ -87,6 +91,7 @@
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"delete": 0,
|
||||
"doctype": "DocPerm",
|
||||
"role": "All"
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user