Compare commits
1550 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cf849f7dff | ||
|
|
3e9fdb8d20 | ||
|
|
260755fd2e | ||
|
|
85df56b464 | ||
|
|
a9e956b5fc | ||
|
|
905eb63c5f | ||
|
|
3eee437014 | ||
|
|
4498de2041 | ||
|
|
bfb0d25765 | ||
|
|
9dd6ffa1e1 | ||
|
|
05322e805f | ||
|
|
8dc6db3218 | ||
|
|
1b63384eac | ||
|
|
37bbbb6b4b | ||
|
|
6f0244c2b6 | ||
|
|
e08bc9cd20 | ||
|
|
2043157567 | ||
|
|
8093a422cd | ||
|
|
4bef919d38 | ||
|
|
874947b8ae | ||
|
|
ca90c0406e | ||
|
|
6bf27d852b | ||
|
|
793cb76789 | ||
|
|
ff07054ca3 | ||
|
|
2ee5269d3e | ||
|
|
e27954da52 | ||
|
|
2faa0d0f04 | ||
|
|
f1664eec2f | ||
|
|
7f2efea7cb | ||
|
|
d2cc6b7c2e | ||
|
|
1afb6d6827 | ||
|
|
ccaf136830 | ||
|
|
58a41d1b11 | ||
|
|
777f3ac06c | ||
|
|
105c78e264 | ||
|
|
46cc1d2924 | ||
|
|
ff4ca9fe66 | ||
|
|
4989dc0921 | ||
|
|
1e613ebcd1 | ||
|
|
4f8f195d77 | ||
|
|
af64b86a04 | ||
|
|
7e9bc0524e | ||
|
|
9d0a0d1d32 | ||
|
|
9c84a8be7f | ||
|
|
d24537489e | ||
|
|
bd89b3b356 | ||
|
|
988fb90ddb | ||
|
|
8018b1766c | ||
|
|
9c4c2a0aca | ||
|
|
803e639961 | ||
|
|
fabd362b2a | ||
|
|
7dd98733f1 | ||
|
|
ee4b7721b0 | ||
|
|
95bc551254 | ||
|
|
2546bdabb1 | ||
|
|
af248964c6 | ||
|
|
8749f7bfd0 | ||
|
|
d18618b856 | ||
|
|
ce4af4907a | ||
|
|
84d24a384b | ||
|
|
29d86859d4 | ||
|
|
be452fee58 | ||
|
|
100eec0677 | ||
|
|
a4d3852c0e | ||
|
|
0399fc32be | ||
|
|
a79192ef4d | ||
|
|
e10ec543a7 | ||
|
|
1962b9a103 | ||
|
|
a3abaa57ec | ||
|
|
1bf3f7a38c | ||
|
|
af81750388 | ||
|
|
7330a3c2a5 | ||
|
|
9e8a4024a5 | ||
|
|
7ef00965fa | ||
|
|
97925aae15 | ||
|
|
0b75228722 | ||
|
|
a360fa774b | ||
|
|
4601b56ee1 | ||
|
|
d985a44291 | ||
|
|
ce66705e9c | ||
|
|
004923419c | ||
|
|
49ed1ac174 | ||
|
|
a7dd1e9bf6 | ||
|
|
4cfd0022f4 | ||
|
|
fc3d8cd94d | ||
|
|
5473a93b5e | ||
|
|
57d306ea1f | ||
|
|
7c324bd07f | ||
|
|
09421217b4 | ||
|
|
630dfcd0e7 | ||
|
|
b999a375b3 | ||
|
|
b5f5a3b5d5 | ||
|
|
814d39572a | ||
|
|
6fc4c0699a | ||
|
|
50ea06a568 | ||
|
|
daf0ddaab4 | ||
|
|
70107a4836 | ||
|
|
f2e6380d3e | ||
|
|
eed1e23b5b | ||
|
|
1bb75dd911 | ||
|
|
1086ce406f | ||
|
|
39c5497363 | ||
|
|
4bc31431e7 | ||
|
|
fe290877e4 | ||
|
|
e4bdc0586e | ||
|
|
695f9e1303 | ||
|
|
98747bdc2a | ||
|
|
16ed1ad060 | ||
|
|
ff312d964b | ||
|
|
49d7af5548 | ||
|
|
a30d21c346 | ||
|
|
f459bd57ba | ||
|
|
b4d89e1a5a | ||
|
|
25bc9d8acb | ||
|
|
568477f9c7 | ||
|
|
9c04ade20d | ||
|
|
7940211fad | ||
|
|
df0968ed67 | ||
|
|
89462e63cb | ||
|
|
23c53ffa9a | ||
|
|
ae3df8d391 | ||
|
|
2d51933ceb | ||
|
|
a7958dc2a2 | ||
|
|
1c4f78b01c | ||
|
|
2722ef6cad | ||
|
|
ac7d3907c2 | ||
|
|
17b7c6ecef | ||
|
|
8d7a155d78 | ||
|
|
6dc85ad1b2 | ||
|
|
ac98c1a090 | ||
|
|
90a6bde438 | ||
|
|
5fea7bf0e2 | ||
|
|
1031e9c4ec | ||
|
|
c6e4b9b5d3 | ||
|
|
f2a4b9ec56 | ||
|
|
14a1af4455 | ||
|
|
e3ab227124 | ||
|
|
5f6cc26126 | ||
|
|
8051fd1f99 | ||
|
|
1fc98f619c | ||
|
|
5921af8c0b | ||
|
|
fe505d33d2 | ||
|
|
300f0b24e2 | ||
|
|
b7c26e35e9 | ||
|
|
4c7c8b915a | ||
|
|
d80feb1e77 | ||
|
|
2a8c7307f0 | ||
|
|
0683d93621 | ||
|
|
5ce2fcd368 | ||
|
|
5372fdcaf1 | ||
|
|
9f46bbd25d | ||
|
|
87e82ce39e | ||
|
|
443aeddca0 | ||
|
|
dc7d5f57b8 | ||
|
|
1cbd633e5b | ||
|
|
cf58a634e9 | ||
|
|
b118e75bec | ||
|
|
2b1048fd83 | ||
|
|
7468f19b48 | ||
|
|
f994dd36a9 | ||
|
|
dc98613296 | ||
|
|
f132a46206 | ||
|
|
cfeac13c9c | ||
|
|
b82dc0473a | ||
|
|
8f0e8f3f52 | ||
|
|
7a9da275da | ||
|
|
cc25feea09 | ||
|
|
b64058bd10 | ||
|
|
b6af543243 | ||
|
|
7bcee291c7 | ||
|
|
570a45eeaf | ||
|
|
dcadd3d0c1 | ||
|
|
8d4975554d | ||
|
|
4bf8c8d0b8 | ||
|
|
0d9264e5e2 | ||
|
|
068f303448 | ||
|
|
e8e4367eb7 | ||
|
|
afadf9f8f4 | ||
|
|
8ab6da55de | ||
|
|
b066eb8c75 | ||
|
|
c33f2e936a | ||
|
|
2f02b8ccfd | ||
|
|
9e9b0f7266 | ||
|
|
148e6ef8bb | ||
|
|
00398b188c | ||
|
|
80e43864b7 | ||
|
|
9a9b91b76d | ||
|
|
d555222ebb | ||
|
|
222ba09c67 | ||
|
|
0c8a3edf5e | ||
|
|
c44f7d5834 | ||
|
|
f072fc992c | ||
|
|
092310846c | ||
|
|
eb00a7c692 | ||
|
|
8a7ed1e8f1 | ||
|
|
a852e33605 | ||
|
|
7f3732f0e0 | ||
|
|
75a9bd290c | ||
|
|
687c1d362c | ||
|
|
e771a63640 | ||
|
|
e87785fac5 | ||
|
|
c84da0c7b4 | ||
|
|
aeb4590a6f | ||
|
|
d6567c7f01 | ||
|
|
8083fc46a8 | ||
|
|
7f6a20ff17 | ||
|
|
95df85f676 | ||
|
|
728150e324 | ||
|
|
2ac8a06bae | ||
|
|
2f56af0384 | ||
|
|
06d647dd72 | ||
|
|
ee964637ac | ||
|
|
4f113fab91 | ||
|
|
8be5535a2b | ||
|
|
c0050dda71 | ||
|
|
56eecdd260 | ||
|
|
ead86735d4 | ||
|
|
76f6da88f3 | ||
|
|
e252ac8370 | ||
|
|
03b920570e | ||
|
|
da4e84d6d0 | ||
|
|
2f90a075fc | ||
|
|
de85fa5d5b | ||
|
|
e43500887f | ||
|
|
8f69a49e2c | ||
|
|
31cbe78320 | ||
|
|
fa85c61a0a | ||
|
|
e87e1ad61d | ||
|
|
bd75fed217 | ||
|
|
1ede125c80 | ||
|
|
e1e2049b1f | ||
|
|
32d9e1e2ba | ||
|
|
ea5b0fdacd | ||
|
|
a7374bedb2 | ||
|
|
5b7437d36a | ||
|
|
8fca1842c2 | ||
|
|
2473cf88ef | ||
|
|
4de04d6760 | ||
|
|
f4dc6f8338 | ||
|
|
df5ee5a50c | ||
|
|
7b4a3dee6e | ||
|
|
3dd6c5d1ed | ||
|
|
bc7a148999 | ||
|
|
f3f0322003 | ||
|
|
aa128a3411 | ||
|
|
57f74dbbff | ||
|
|
88b9c6af1d | ||
|
|
243832812f | ||
|
|
be09a8fe30 | ||
|
|
f5e54eefef | ||
|
|
867da93a39 | ||
|
|
580f61ab71 | ||
|
|
b55011a58e | ||
|
|
a8504a910e | ||
|
|
ffc048977f | ||
|
|
212709782a | ||
|
|
9fb0d3175d | ||
|
|
4839298ba4 | ||
|
|
b40c72b95c | ||
|
|
5a941e0944 | ||
|
|
4987545595 | ||
|
|
f53e35117a | ||
|
|
de2939d863 | ||
|
|
25a26d3e2c | ||
|
|
efd02c3459 | ||
|
|
13e72bf7f3 | ||
|
|
7b8cc6caa3 | ||
|
|
d1e66cd5bb | ||
|
|
3a9bad7954 | ||
|
|
3f6e69c3f6 | ||
|
|
57fb0e07cf | ||
|
|
4cfab1fbb6 | ||
|
|
c851b9f4b3 | ||
|
|
7d8f980c87 | ||
|
|
2ccae25bfe | ||
|
|
1da242fd37 | ||
|
|
35b7e69426 | ||
|
|
fbaca7f154 | ||
|
|
913094dce3 | ||
|
|
4d619a908c | ||
|
|
6dc8975c08 | ||
|
|
1b0a92c0c5 | ||
|
|
bd3aca85ac | ||
|
|
6d7372240f | ||
|
|
c799d1502b | ||
|
|
acdfe6c82b | ||
|
|
17687690cf | ||
|
|
f28920dd60 | ||
|
|
90f61dffa6 | ||
|
|
556f8e6b11 | ||
|
|
78aea3bbac | ||
|
|
67f75289c7 | ||
|
|
8e86a06858 | ||
|
|
445f5d7ade | ||
|
|
015228488b | ||
|
|
9a0e0ed721 | ||
|
|
89b392d59b | ||
|
|
799dedb582 | ||
|
|
9418df86f9 | ||
|
|
57dd748cae | ||
|
|
06b4e4d544 | ||
|
|
e98d54cdd9 | ||
|
|
a00838b7a0 | ||
|
|
fad4bc994d | ||
|
|
b3752d63db | ||
|
|
4c13c5143f | ||
|
|
9423af5cc1 | ||
|
|
dcc3b88d4f | ||
|
|
a55b69a945 | ||
|
|
89abee30bf | ||
|
|
066371bd76 | ||
|
|
f61a40698d | ||
|
|
0b9c0915c7 | ||
|
|
e6781ea4bb | ||
|
|
277fb85e32 | ||
|
|
4592dfcd13 | ||
|
|
cf0f922f2f | ||
|
|
bc35d6b98f | ||
|
|
3fbd40b591 | ||
|
|
f50b8a78eb | ||
|
|
5212a61388 | ||
|
|
0d1c057cf3 | ||
|
|
5a243d29da | ||
|
|
992b47e531 | ||
|
|
ee8f806f64 | ||
|
|
bc0ca74f88 | ||
|
|
55dabaf877 | ||
|
|
006c7efc06 | ||
|
|
4c809a9166 | ||
|
|
9e19e54f75 | ||
|
|
806f75a2fe | ||
|
|
295b0f4c2a | ||
|
|
7945527fd6 | ||
|
|
696531f392 | ||
|
|
c0d43a9b58 | ||
|
|
584250c4e5 | ||
|
|
ec467ae126 | ||
|
|
579fe78e6f | ||
|
|
a246a5e6e4 | ||
|
|
daaf015462 | ||
|
|
edb68fe08b | ||
|
|
7e736b2892 | ||
|
|
3b18f3a86a | ||
|
|
f6cf935c9c | ||
|
|
1dfbcd1055 | ||
|
|
3326230062 | ||
|
|
de4471876f | ||
|
|
41ce361f04 | ||
|
|
466a2b58ee | ||
|
|
0e71880463 | ||
|
|
1afbc001b5 | ||
|
|
9e3eba8ab2 | ||
|
|
32405f3120 | ||
|
|
d7735d634d | ||
|
|
b97a80249c | ||
|
|
9c3ddeaf7d | ||
|
|
de14eb3ffb | ||
|
|
74cce77dc5 | ||
|
|
2352f51838 | ||
|
|
0e2be93e92 | ||
|
|
903c214c3d | ||
|
|
9c653cf5e7 | ||
|
|
3c296a67a2 | ||
|
|
9196369c17 | ||
|
|
853ef4859d | ||
|
|
c861fbda49 | ||
|
|
a81f3685bc | ||
|
|
73d13351b5 | ||
|
|
43e8f2a48f | ||
|
|
f347919dbf | ||
|
|
14622a00b3 | ||
|
|
4a83b52ab5 | ||
|
|
30fed5f6ad | ||
|
|
96031d2288 | ||
|
|
58a0ef2d0e | ||
|
|
7b2168232e | ||
|
|
d0dc642b12 | ||
|
|
e4722a79cc | ||
|
|
671ce54380 | ||
|
|
d4ac8772ae | ||
|
|
1df71070d0 | ||
|
|
58d4b7afae | ||
|
|
9e08b68f22 | ||
|
|
3a38ccace0 | ||
|
|
f18b1c56ed | ||
|
|
24e7e234be | ||
|
|
53f7b614b0 | ||
|
|
277cebfe7b | ||
|
|
4500595a75 | ||
|
|
a1445903db | ||
|
|
1060f3a873 | ||
|
|
9f4c278a6b | ||
|
|
c017397787 | ||
|
|
1412600bdb | ||
|
|
c9b26e5559 | ||
|
|
9050137a39 | ||
|
|
b464c7cc4f | ||
|
|
543310e55a | ||
|
|
15d0a29ed9 | ||
|
|
f65cb3c4da | ||
|
|
fafa4f6541 | ||
|
|
2358198660 | ||
|
|
6342656477 | ||
|
|
966e7a832d | ||
|
|
872f22e293 | ||
|
|
5c246c513a | ||
|
|
e33fb939b3 | ||
|
|
61dddd76a0 | ||
|
|
9e5a6edba0 | ||
|
|
8cbcd4dff3 | ||
|
|
5b747cbbff | ||
|
|
8cbd4291a5 | ||
|
|
182259e7d2 | ||
|
|
ed6bdfae96 | ||
|
|
6c382f7a0f | ||
|
|
ec655c17a4 | ||
|
|
22ba79aebf | ||
|
|
b26593d8cc | ||
|
|
57b1af5153 | ||
|
|
3d55706d60 | ||
|
|
b0009e1701 | ||
|
|
c3b6b380f4 | ||
|
|
5b34142a40 | ||
|
|
d39500f706 | ||
|
|
29e8c73d50 | ||
|
|
5ac003e860 | ||
|
|
9b988f638e | ||
|
|
2bbd0206c6 | ||
|
|
8c3733a212 | ||
|
|
7e53e0f4e4 | ||
|
|
e5ed7e0daf | ||
|
|
0f2ad3590d | ||
|
|
2d912e01b7 | ||
|
|
6bd1dd2f64 | ||
|
|
95aa5ac4d3 | ||
|
|
45a8bdaf5f | ||
|
|
17f63d1484 | ||
|
|
50ada2ad64 | ||
|
|
326cad3275 | ||
|
|
7e1dde24d0 | ||
|
|
238d75c398 | ||
|
|
24f4ae4294 | ||
|
|
4dc6eb8c4e | ||
|
|
9c9d998ef5 | ||
|
|
8fa583dbc6 | ||
|
|
d08e15a4b5 | ||
|
|
bad30d6232 | ||
|
|
63d3bc8bd5 | ||
|
|
5eb3bcbf43 | ||
|
|
e3baeabbb4 | ||
|
|
4a3504fce3 | ||
|
|
cde1084ed4 | ||
|
|
b5925ef0e9 | ||
|
|
fe02a9077f | ||
|
|
6b00ede6ad | ||
|
|
d94c99b161 | ||
|
|
12b92b3f21 | ||
|
|
9ebd7bde2c | ||
|
|
6a729fb5e7 | ||
|
|
bed6e346ef | ||
|
|
788c565e71 | ||
|
|
72c61f6cc4 | ||
|
|
b1dfa6e9c9 | ||
|
|
971265d000 | ||
|
|
0e177818cc | ||
|
|
07bea95479 | ||
|
|
ab51a54ea2 | ||
|
|
f6e1b01645 | ||
|
|
11c564835a | ||
|
|
9697af7417 | ||
|
|
9c6e2bb34b | ||
|
|
ce77d3a705 | ||
|
|
4cf1598dfe | ||
|
|
12422d6ad4 | ||
|
|
4bd67bd993 | ||
|
|
ef80e5084e | ||
|
|
b0f5cafc27 | ||
|
|
b049cbc3d2 | ||
|
|
ff35a03f9d | ||
|
|
3a613a88ef | ||
|
|
c9e9c9bd59 | ||
|
|
61930ec4a1 | ||
|
|
02c4d4b9f1 | ||
|
|
352ddd6ed1 | ||
|
|
eb5d8cd2c6 | ||
|
|
7e89408105 | ||
|
|
441c4f7edd | ||
|
|
6f9ec66d02 | ||
|
|
2b61b68cb5 | ||
|
|
84f9b0589d | ||
|
|
3c464fe58e | ||
|
|
3ca2883efb | ||
|
|
2708274f9f | ||
|
|
5f9fe3a12e | ||
|
|
f1786b7cd9 | ||
|
|
32e6ba0645 | ||
|
|
cfee08d8de | ||
|
|
268fff442b | ||
|
|
b175f13974 | ||
|
|
0340ae4ee4 | ||
|
|
c8a54e4d9f | ||
|
|
69b1237b10 | ||
|
|
97d9866c0e | ||
|
|
aa7ebab3a1 | ||
|
|
03bc281763 | ||
|
|
a525914420 | ||
|
|
361d82e982 | ||
|
|
30cc791cc7 | ||
|
|
acf47d7570 | ||
|
|
14a9571fdc | ||
|
|
c4df4d3253 | ||
|
|
53781cbf1e | ||
|
|
1c4dd8a59d | ||
|
|
5e1ae83b72 | ||
|
|
65366f3430 | ||
|
|
1f51a97f04 | ||
|
|
cab54be0ab | ||
|
|
c9b4bf801d | ||
|
|
bdcd7c5487 | ||
|
|
7072686565 | ||
|
|
74063026c8 | ||
|
|
1e0e9fce92 | ||
|
|
092249a159 | ||
|
|
1fdc8bbe34 | ||
|
|
2b84ca7fd6 | ||
|
|
97826bccac | ||
|
|
85b2650ccb | ||
|
|
7c5bde4d78 | ||
|
|
43b13c30ac | ||
|
|
4537cc6e6c | ||
|
|
21e3d126e3 | ||
|
|
8e6409dd9b | ||
|
|
8d92094324 | ||
|
|
b555449dcf | ||
|
|
01418c43f6 | ||
|
|
a6e05c2a65 | ||
|
|
59c4d90278 | ||
|
|
657e758f5c | ||
|
|
d2b544dafd | ||
|
|
2c2d49718a | ||
|
|
5f347a8593 | ||
|
|
f6bd72411d | ||
|
|
e33bfd82a8 | ||
|
|
6091f44650 | ||
|
|
f0b58ba28a | ||
|
|
b8dde8c41c | ||
|
|
bafe1c7e0a | ||
|
|
c345d5b5bd | ||
|
|
3e51d875f7 | ||
|
|
96ff1c2fdb | ||
|
|
6bb18198e8 | ||
|
|
bead791e23 | ||
|
|
3b2cc05b3f | ||
|
|
b5283e73e5 | ||
|
|
500664328d | ||
|
|
04eed192d2 | ||
|
|
9e276352d5 | ||
|
|
155326cb83 | ||
|
|
ec10eb1c27 | ||
|
|
866147ce6a | ||
|
|
5347b9d858 | ||
|
|
c03dd38433 | ||
|
|
b07b80c8b9 | ||
|
|
40cd0b3bc2 | ||
|
|
42f886d7f1 | ||
|
|
4eb21e2c46 | ||
|
|
3d73dbd393 | ||
|
|
bae3b574ec | ||
|
|
c9ed426231 | ||
|
|
504d23e920 | ||
|
|
edb545b84b | ||
|
|
bced2c5b29 | ||
|
|
e9f8af6f98 | ||
|
|
de5348f61e | ||
|
|
02c2478cdc | ||
|
|
f448c7315e | ||
|
|
23963edf88 | ||
|
|
09a22264da | ||
|
|
c0d00e7776 | ||
|
|
2b10583b7c | ||
|
|
e540dcc39e | ||
|
|
3c419a7cf3 | ||
|
|
0cba0cf658 | ||
|
|
0a3c84ae95 | ||
|
|
15164b348a | ||
|
|
5e94726d42 | ||
|
|
4f490fef0d | ||
|
|
67ab8d2619 | ||
|
|
98e5242d6e | ||
|
|
3324913959 | ||
|
|
cd1355a6b6 | ||
|
|
b74b137ff8 | ||
|
|
2e209b6a5f | ||
|
|
22391adbb9 | ||
|
|
b38007f7b5 | ||
|
|
f46609c242 | ||
|
|
25217e6214 | ||
|
|
bca8cdfe52 | ||
|
|
77b5c66e3d | ||
|
|
6dc7372658 | ||
|
|
b55d3da612 | ||
|
|
69f8733f2b | ||
|
|
cd0e076952 | ||
|
|
b0989566d9 | ||
|
|
fa5d17a121 | ||
|
|
51d39a1dbb | ||
|
|
6d164cdac4 | ||
|
|
98c830f3ae | ||
|
|
09b4e25500 | ||
|
|
78dc0f6af6 | ||
|
|
52bc66dc3d | ||
|
|
053650ee75 | ||
|
|
5c3ef0158c | ||
|
|
99402b8e43 | ||
|
|
4d7a5f17d6 | ||
|
|
ba0ef22911 | ||
|
|
d099d7e3e5 | ||
|
|
859d93404d | ||
|
|
6f71d738b3 | ||
|
|
ba4ffdac86 | ||
|
|
151560fa5e | ||
|
|
d80f7965ec | ||
|
|
3e72981993 | ||
|
|
67774f3014 | ||
|
|
55c4ad9533 | ||
|
|
c027bcf59b | ||
|
|
12814dc5b0 | ||
|
|
ecccc6340f | ||
|
|
1b7e337176 | ||
|
|
1be736cb6f | ||
|
|
8defe6285f | ||
|
|
3332a74dab | ||
|
|
c879fa57cf | ||
|
|
92879d3cbe | ||
|
|
1a672dd274 | ||
|
|
0e8758e798 | ||
|
|
64f4ed62ce | ||
|
|
bd27266b69 | ||
|
|
6efd81073d | ||
|
|
f091899da7 | ||
|
|
6da91d67f3 | ||
|
|
eaf61005cd | ||
|
|
65a8ba139d | ||
|
|
da5192bee3 | ||
|
|
72dc3904c0 | ||
|
|
107eeae116 | ||
|
|
209da0f84e | ||
|
|
a6c60ffecb | ||
|
|
e6033dfb9a | ||
|
|
55ad85dda8 | ||
|
|
697ed4eb98 | ||
|
|
64dfa77022 | ||
|
|
d52ee6653c | ||
|
|
f7bcc4b910 | ||
|
|
c5193f3105 | ||
|
|
5bd01ca7d9 | ||
|
|
2ce5e02d99 | ||
|
|
9d609e528c | ||
|
|
1f445b49cf | ||
|
|
de4647f5ab | ||
|
|
742fd750cf | ||
|
|
3a88910711 | ||
|
|
7d695a13cf | ||
|
|
3a27fb91c1 | ||
|
|
b95565a70c | ||
|
|
b369211965 | ||
|
|
40f74b4316 | ||
|
|
c1983e8241 | ||
|
|
61c2180498 | ||
|
|
95773bec71 | ||
|
|
d75cde4bb0 | ||
|
|
59030f8d44 | ||
|
|
f733ef2fe7 | ||
|
|
69780ecbd9 | ||
|
|
e91ebc7eb9 | ||
|
|
756fdd212a | ||
|
|
6e3737403d | ||
|
|
910c1e0c78 | ||
|
|
016af283ca | ||
|
|
da04edccb2 | ||
|
|
6e71321e7d | ||
|
|
e81c49ee7b | ||
|
|
37c931c9c2 | ||
|
|
a59afeb327 | ||
|
|
39a419889f | ||
|
|
6caff5cd59 | ||
|
|
02a60b01cb | ||
|
|
10cf868df5 | ||
|
|
6ae7787811 | ||
|
|
63542f79c7 | ||
|
|
d5aefb3c98 | ||
|
|
1b3709c8a0 | ||
|
|
0302e9958b | ||
|
|
1f8e3f3802 | ||
|
|
fab101aa66 | ||
|
|
ca15b5e3b8 | ||
|
|
cd24337dfc | ||
|
|
4017a9373b | ||
|
|
c6e5fa2aea | ||
|
|
e8f81ec2e7 | ||
|
|
ae9ffed017 | ||
|
|
3c6bfa3dd0 | ||
|
|
136aa73822 | ||
|
|
8b04f3da3e | ||
|
|
a78a110914 | ||
|
|
69277c5fb0 | ||
|
|
be7154506f | ||
|
|
ca52a29b6e | ||
|
|
7a35c5224b | ||
|
|
2828e76657 | ||
|
|
b6b5d47168 | ||
|
|
8c91f38fee | ||
|
|
042b740cf9 | ||
|
|
48006552ee | ||
|
|
02dc62d8ce | ||
|
|
39d97e1e0b | ||
|
|
412fa76875 | ||
|
|
4d162cd0dd | ||
|
|
9f6832a5b6 | ||
|
|
b50c2e6d00 | ||
|
|
d0d67bf2ad | ||
|
|
5f459f58cb | ||
|
|
e4abb0f9de | ||
|
|
a7bc3abcdd | ||
|
|
9b315c2e0c | ||
|
|
6647a83485 | ||
|
|
040692c13c | ||
|
|
e0cdeea2f9 | ||
|
|
6aa4a03b0f | ||
|
|
252fe05edc | ||
|
|
b027ff0e73 | ||
|
|
59e762d658 | ||
|
|
5e0bc3c448 | ||
|
|
4cfe106144 | ||
|
|
b1ea3edceb | ||
|
|
57fb8b3abe | ||
|
|
08243530e7 | ||
|
|
47002deed6 | ||
|
|
e3510b0e9c | ||
|
|
2cd08bebb9 | ||
|
|
336ac2ad34 | ||
|
|
29132f6f23 | ||
|
|
a8f3f0703c | ||
|
|
ba81ab772e | ||
|
|
76b5a2d7bb | ||
|
|
388b10fb93 | ||
|
|
c8c7a95ac0 | ||
|
|
7870748b41 | ||
|
|
e575f516d8 | ||
|
|
c1203d465a | ||
|
|
c8f7f9552b | ||
|
|
a04b9f5a5e | ||
|
|
01b43747b8 | ||
|
|
f6af8d562e | ||
|
|
d8f990ac8e | ||
|
|
bca6ef575a | ||
|
|
093994353d | ||
|
|
0e87e33ab2 | ||
|
|
11bc742f74 | ||
|
|
6cbfaf56a3 | ||
|
|
aff26a5ea2 | ||
|
|
5c41df0ad6 | ||
|
|
743e0ad522 | ||
|
|
c1b3a201a2 | ||
|
|
1aaafc41d2 | ||
|
|
6292824f41 | ||
|
|
2ef3ccafc7 | ||
|
|
369292f523 | ||
|
|
acc746bd15 | ||
|
|
71f9b8e79f | ||
|
|
0bc1ee4c4e | ||
|
|
f66de4cc72 | ||
|
|
2b27a21316 | ||
|
|
547ffc5f65 | ||
|
|
516b8e09a1 | ||
|
|
1a036a8b1c | ||
|
|
275e887dc2 | ||
|
|
4f1348b08c | ||
|
|
65b635eeb3 | ||
|
|
d184068760 | ||
|
|
35533a8296 | ||
|
|
18e9d1e3fc | ||
|
|
61625f2938 | ||
|
|
3f51da59ad | ||
|
|
ab6ea90c66 | ||
|
|
d2527da5a4 | ||
|
|
b799e8dbb4 | ||
|
|
b932130bb2 | ||
|
|
14ac102d6d | ||
|
|
52bf09f27e | ||
|
|
a17a702dac | ||
|
|
aa59703709 | ||
|
|
461498f9f6 | ||
|
|
af6994f8fc | ||
|
|
a542ecc5c8 | ||
|
|
b663a6e913 | ||
|
|
ee6c16c78d | ||
|
|
1519b3539c | ||
|
|
b843b93454 | ||
|
|
9c90f29281 | ||
|
|
300a996ce5 | ||
|
|
ce60dddbc9 | ||
|
|
ee0114aa35 | ||
|
|
9639c21ff2 | ||
|
|
236a5026e3 | ||
|
|
fbbcae7049 | ||
|
|
d9555f62f8 | ||
|
|
6d114f7cb6 | ||
|
|
e37b3c6c89 | ||
|
|
f0b295a907 | ||
|
|
a485d8eb6e | ||
|
|
59999599a3 | ||
|
|
b83b4847e7 | ||
|
|
df605f1a9a | ||
|
|
bae37529e5 | ||
|
|
aa60a03484 | ||
|
|
5aaacde6e6 | ||
|
|
7f18b78be8 | ||
|
|
e267445a80 | ||
|
|
c8d165593a | ||
|
|
1b30b3ebec | ||
|
|
e3cd126304 | ||
|
|
ffd24933cd | ||
|
|
1810b31647 | ||
|
|
7fbda3ec9c | ||
|
|
c3a89c564b | ||
|
|
6abc772281 | ||
|
|
d98899d954 | ||
|
|
7a9172d94b | ||
|
|
f48b664679 | ||
|
|
a6e8e64d49 | ||
|
|
cc8868d892 | ||
|
|
1f1ee74b74 | ||
|
|
f3b8d87204 | ||
|
|
de7cf372e7 | ||
|
|
0520df04d0 | ||
|
|
bce5eef2c9 | ||
|
|
b047dab16d | ||
|
|
54b3802061 | ||
|
|
eb7ded961a | ||
|
|
f1935156ec | ||
|
|
512970cad1 | ||
|
|
f4c033fd52 | ||
|
|
aac50e1d10 | ||
|
|
142a94e042 | ||
|
|
d0cbad0ab1 | ||
|
|
4ed8a54a98 | ||
|
|
c918a76635 | ||
|
|
58c500df1f | ||
|
|
37e86b4610 | ||
|
|
a86884e40e | ||
|
|
dd4f5c6f80 | ||
|
|
f7344cde43 | ||
|
|
b0341aebde | ||
|
|
909670d234 | ||
|
|
5deef03fd7 | ||
|
|
f835acae57 | ||
|
|
2f5d5293d0 | ||
|
|
9fa7443720 | ||
|
|
88e5e5e7cc | ||
|
|
6f2638a3d9 | ||
|
|
46ed866de6 | ||
|
|
95cd3f256e | ||
|
|
4368590a12 | ||
|
|
7d14118334 | ||
|
|
0df87ef5c4 | ||
|
|
a482a81aec | ||
|
|
89b89eeafc | ||
|
|
2e1da1a627 | ||
|
|
0eef9b485f | ||
|
|
f9d3b5362a | ||
|
|
97aa21bd66 | ||
|
|
cb1b74f93b | ||
|
|
742b4b7a18 | ||
|
|
3879e892fd | ||
|
|
575be65956 | ||
|
|
2c92612cce | ||
|
|
232f982786 | ||
|
|
e9362a50eb | ||
|
|
d06f749544 | ||
|
|
6c2ffaf8b7 | ||
|
|
87a38250f6 | ||
|
|
5fff00338a | ||
|
|
b0474e8764 | ||
|
|
1c7ea0b44b | ||
|
|
2c3a660b99 | ||
|
|
cf9797fbc4 | ||
|
|
01e72cb28e | ||
|
|
df4522ca78 | ||
|
|
c862787561 | ||
|
|
6c6c6bf872 | ||
|
|
901eb381d8 | ||
|
|
fb330c26d2 | ||
|
|
5a09090be8 | ||
|
|
74f305490c | ||
|
|
fa0085e2dd | ||
|
|
ac08ca8390 | ||
|
|
7de7f6ac59 | ||
|
|
90e80da208 | ||
|
|
1b452a9486 | ||
|
|
8343b87526 | ||
|
|
cc96972213 | ||
|
|
65e6da00d5 | ||
|
|
750519d05d | ||
|
|
2a4a83ea6d | ||
|
|
c98beaee9c | ||
|
|
8bb84552e0 | ||
|
|
37df5d6254 | ||
|
|
f44e12b0ff | ||
|
|
6224c3eadc | ||
|
|
8c43732d2e | ||
|
|
e262c8e0ca | ||
|
|
1df3d051d6 | ||
|
|
da4d60db19 | ||
|
|
89da8d2e8d | ||
|
|
a4716e7899 | ||
|
|
9cc09f520c | ||
|
|
d7f442d734 | ||
|
|
165ed1155d | ||
|
|
1f8f62ad3a | ||
|
|
314c770236 | ||
|
|
3f052b21b5 | ||
|
|
33c9b4a425 | ||
|
|
b13dc76358 | ||
|
|
d68f0a659d | ||
|
|
f4c86811a1 | ||
|
|
96a856b445 | ||
|
|
da241aef28 | ||
|
|
715ec67a82 | ||
|
|
10148641c6 | ||
|
|
62270a478c | ||
|
|
0023ea0d44 | ||
|
|
9c27d3dbc6 | ||
|
|
2e9c5b1d6f | ||
|
|
a8ee5295b7 | ||
|
|
31c649d6f1 | ||
|
|
408714083d | ||
|
|
22e38c05b4 | ||
|
|
88f4e10833 | ||
|
|
90c2832f44 | ||
|
|
d9dee3fa16 | ||
|
|
06670e65e3 | ||
|
|
95184b55f0 | ||
|
|
6bbe7a9442 | ||
|
|
6ad0742c9d | ||
|
|
76cead4200 | ||
|
|
bb51167454 | ||
|
|
260a9d8230 | ||
|
|
e93cc463be | ||
|
|
f1032b5f93 | ||
|
|
985c538044 | ||
|
|
e623e0628f | ||
|
|
93176a8d0c | ||
|
|
e4173cbbb5 | ||
|
|
3d363222aa | ||
|
|
a28eab3193 | ||
|
|
aaf6f5e868 | ||
|
|
08cd604dae | ||
|
|
20fc1d0ae1 | ||
|
|
63614b92ca | ||
|
|
d30a3efa60 | ||
|
|
5358b5fdba | ||
|
|
82414cff7d | ||
|
|
42594c44ce | ||
|
|
1870ced3b1 | ||
|
|
3d48e12744 | ||
|
|
87f50edefe | ||
|
|
8002d8ffce | ||
|
|
eaeac88c88 | ||
|
|
815d807fcb | ||
|
|
f0e03f6594 | ||
|
|
f0e17f49fe | ||
|
|
01566217ad | ||
|
|
3ca32e99e5 | ||
|
|
f2d65bffeb | ||
|
|
ca2e60a67c | ||
|
|
a0cb49ef3a | ||
|
|
217151fa97 | ||
|
|
32a8d61176 | ||
|
|
2871e0a41a | ||
|
|
8f1249a4c9 | ||
|
|
d02ccc0822 | ||
|
|
5d35bb4537 | ||
|
|
aa93191786 | ||
|
|
fc50f669fd | ||
|
|
e2983fd70b | ||
|
|
c7eaef54f0 | ||
|
|
c583e8044b | ||
|
|
d820ff1572 | ||
|
|
b3c1ebb24d | ||
|
|
bcb8b4f75a | ||
|
|
4d40cad0d6 | ||
|
|
e6c4075ece | ||
|
|
6809629f4c | ||
|
|
03759680da | ||
|
|
8718fff7fd | ||
|
|
e33bcd0459 | ||
|
|
9a6ca31858 | ||
|
|
fc5223f258 | ||
|
|
b820e34548 | ||
|
|
4f2ca088ff | ||
|
|
691bf96dd2 | ||
|
|
d6397114b3 | ||
|
|
64f356e795 | ||
|
|
ffa8c16255 | ||
|
|
83a26605ea | ||
|
|
998d7857af | ||
|
|
cc88d66de4 | ||
|
|
50c69c173f | ||
|
|
0c598b2be9 | ||
|
|
4d54e43b6c | ||
|
|
3e330431a5 | ||
|
|
a70bed99b8 | ||
|
|
d15f232060 | ||
|
|
17b81aee64 | ||
|
|
0eafd44d8f | ||
|
|
8b3cac75fb | ||
|
|
3ea056d3df | ||
|
|
09717541f6 | ||
|
|
620839cb2f | ||
|
|
8bb78a2caf | ||
|
|
975a96ff45 | ||
|
|
d18e4a1a18 | ||
|
|
a514a99a75 | ||
|
|
af5bef08ca | ||
|
|
d9e731be3c | ||
|
|
3a89f62965 | ||
|
|
beb5ebe165 | ||
|
|
39219987bc | ||
|
|
80d762cc35 | ||
|
|
51b7d8c9b0 | ||
|
|
3e7e1baf5f | ||
|
|
ddea5fbc53 | ||
|
|
1a9a661c1c | ||
|
|
d2984e3618 | ||
|
|
020e28ad5a | ||
|
|
8003abd58f | ||
|
|
cd796ef996 | ||
|
|
f33f5d5b2a | ||
|
|
2262df7d52 | ||
|
|
3c74951626 | ||
|
|
90990b62b6 | ||
|
|
3839a4cb43 | ||
|
|
3f13a820e8 | ||
|
|
c1b1111efb | ||
|
|
b5dc2c73ab | ||
|
|
ed1c54a7a5 | ||
|
|
1f2eef4f14 | ||
|
|
454dbd06cc | ||
|
|
4e84fd0731 | ||
|
|
013119961a | ||
|
|
7396878a3b | ||
|
|
0b6954e728 | ||
|
|
0225e098c6 | ||
|
|
1f9b181b93 | ||
|
|
9a5c0c2f18 | ||
|
|
a28d113384 | ||
|
|
49a79cdb36 | ||
|
|
451a67cfd1 | ||
|
|
bfe4125182 | ||
|
|
7451d523cc | ||
|
|
7b69dbbfb1 | ||
|
|
5f32db7f1d | ||
|
|
d9a760dfb0 | ||
|
|
887db5398e | ||
|
|
48dd017dd2 | ||
|
|
24c86aa70a | ||
|
|
20e970d90f | ||
|
|
ba003e8453 | ||
|
|
bdced37535 | ||
|
|
5d4e971398 | ||
|
|
d70a0e1979 | ||
|
|
8ba79722d9 | ||
|
|
e19be466e2 | ||
|
|
68cc55f8d6 | ||
|
|
f1b5f34818 | ||
|
|
3379f2037a | ||
|
|
de19716959 | ||
|
|
c485f5a0d2 | ||
|
|
0d7bbafad4 | ||
|
|
d6af439235 | ||
|
|
043b4e9eec | ||
|
|
8d8c48575a | ||
|
|
f7862339ee | ||
|
|
b82362a869 | ||
|
|
d8477ef396 | ||
|
|
78fdd51104 | ||
|
|
b60f744587 | ||
|
|
5d9c0eafa4 | ||
|
|
a1a44c1020 | ||
|
|
86f0f4949c | ||
|
|
251a9831fd | ||
|
|
9b2f8dd7b5 | ||
|
|
be3cf1f48c | ||
|
|
138c1341a6 | ||
|
|
c7e24d6760 | ||
|
|
af32cdf27a | ||
|
|
5b42bcdf60 | ||
|
|
4e6577bb4d | ||
|
|
0a1546348e | ||
|
|
4dabcebee5 | ||
|
|
019662052a | ||
|
|
701178cdcf | ||
|
|
6813bc6caf | ||
|
|
4917cf4be8 | ||
|
|
39e7f349a2 | ||
|
|
53a9fedb0d | ||
|
|
6839824d7d | ||
|
|
2e3a3016db | ||
|
|
3c493b6cf3 | ||
|
|
694e515046 | ||
|
|
6dcd290bb7 | ||
|
|
cac40bc538 | ||
|
|
09c016c40e | ||
|
|
5962f2477f | ||
|
|
f47d24afea | ||
|
|
fd363575ca | ||
|
|
205cdd27eb | ||
|
|
d76ca6c588 | ||
|
|
1c0e17109e | ||
|
|
c8d21ef8f0 | ||
|
|
15d18bee43 | ||
|
|
fab665ad3f | ||
|
|
ddc142b0bc | ||
|
|
1a1f0478f0 | ||
|
|
d1a15e97f1 | ||
|
|
c521ec299b | ||
|
|
ed2821725f | ||
|
|
c35a481152 | ||
|
|
79f2d89210 | ||
|
|
93d9abf6ab | ||
|
|
2ea03cfbbf | ||
|
|
a15af06176 | ||
|
|
d2cda20d4e | ||
|
|
66c4b1bcda | ||
|
|
0e4495b581 | ||
|
|
cf352ddcc6 | ||
|
|
73b39d58fb | ||
|
|
b28c6b94f1 | ||
|
|
1f1090c2e6 | ||
|
|
a921be33b3 | ||
|
|
265c50cbba | ||
|
|
5b9539245d | ||
|
|
065a5ba07a | ||
|
|
161f3bbf87 | ||
|
|
8282e09949 | ||
|
|
eaa794f862 | ||
|
|
4fe0caaa0d | ||
|
|
b4e6db3e5b | ||
|
|
9a08747951 | ||
|
|
2c0fec20d1 | ||
|
|
7c4a697b9f | ||
|
|
4e3a85e03b | ||
|
|
16c727cc47 | ||
|
|
db330f425c | ||
|
|
a0fdf7013d | ||
|
|
de60b9d96f | ||
|
|
8b7089e521 | ||
|
|
2ccc6371c2 | ||
|
|
a89619080a | ||
|
|
a757220a82 | ||
|
|
474fe5a954 | ||
|
|
de50772a22 | ||
|
|
31e1429485 | ||
|
|
f0ab7b0959 | ||
|
|
44dab36a3a | ||
|
|
a1ac0008de | ||
|
|
e926ac8783 | ||
|
|
1015ba7bd9 | ||
|
|
1798da43ae | ||
|
|
1500c3f2b0 | ||
|
|
7858ce7095 | ||
|
|
4d708eef98 | ||
|
|
ff4693dde7 | ||
|
|
ade31d6f67 | ||
|
|
d6c6af4690 | ||
|
|
45010ff8e6 | ||
|
|
c31c7e8ae7 | ||
|
|
2e578787f6 | ||
|
|
cc7f6fd719 | ||
|
|
77751179f7 | ||
|
|
8f134e9480 | ||
|
|
d614e9b575 | ||
|
|
7b2256123b | ||
|
|
d32d6e62fb | ||
|
|
61ba3bd7f9 | ||
|
|
6260850023 | ||
|
|
f9e7035585 | ||
|
|
4d964fa175 | ||
|
|
7fbd229ed9 | ||
|
|
a17ce26a6f | ||
|
|
0f0aa2e383 | ||
|
|
05d7c29977 | ||
|
|
e6fb77f342 | ||
|
|
98c80c9d8e | ||
|
|
f020368c9e | ||
|
|
0fa0ae1326 | ||
|
|
fe4e97da80 | ||
|
|
afbd44df5d | ||
|
|
0ef5f61ed2 | ||
|
|
c21a6f17c9 | ||
|
|
d57f14e1f2 | ||
|
|
1d9cdf14ab | ||
|
|
39c4c0c84a | ||
|
|
48845491d1 | ||
|
|
59406a2710 | ||
|
|
26c4caae61 | ||
|
|
02fbfaf757 | ||
|
|
02994ca00d | ||
|
|
810136f695 | ||
|
|
c13ec48824 | ||
|
|
698cf1a8cb | ||
|
|
a2612ab576 | ||
|
|
c8cdd2daac | ||
|
|
907bcc3d15 | ||
|
|
c4a1abb6b9 | ||
|
|
7b108f945d | ||
|
|
d423c0e7ce | ||
|
|
b13d099820 | ||
|
|
347c9deb7f | ||
|
|
ff52cf33d1 | ||
|
|
bf4da21153 | ||
|
|
238276070c | ||
|
|
72e499e845 | ||
|
|
a32749533f | ||
|
|
33c314b704 | ||
|
|
cb8f9011bf | ||
|
|
00a869119c | ||
|
|
a88b02d7c3 | ||
|
|
71dd9e4564 | ||
|
|
3c1d8f2e93 | ||
|
|
8a6b6b65e1 | ||
|
|
5bba845918 | ||
|
|
26703070c9 | ||
|
|
a0f2559a65 | ||
|
|
0ab6abb8c3 | ||
|
|
25acba0c57 | ||
|
|
b9baed6699 | ||
|
|
bda448bf3c | ||
|
|
dea894defb | ||
|
|
87bed3890b | ||
|
|
09881cc525 | ||
|
|
c592aac6ea | ||
|
|
2a9b744d5a | ||
|
|
698a9bcb6e | ||
|
|
7713acc3f1 | ||
|
|
041fef9b09 | ||
|
|
46eb2395d1 | ||
|
|
d76b0e4df3 | ||
|
|
765d0bbf82 | ||
|
|
df91cfb817 | ||
|
|
c2d53cb3f8 | ||
|
|
5b7da5decb | ||
|
|
c1e0ace84b | ||
|
|
4326582c5b | ||
|
|
4d6604ab7a | ||
|
|
847a6adc4b | ||
|
|
6ebcd0e887 | ||
|
|
7ca0987080 | ||
|
|
f033de374e | ||
|
|
28ce38ae90 | ||
|
|
70e8e9b899 | ||
|
|
e126ef154c | ||
|
|
faa2bdd5ef | ||
|
|
e84351cb57 | ||
|
|
f9043511a8 | ||
|
|
ff6fdb2386 | ||
|
|
5c5b2cdce1 | ||
|
|
46776b4a4b | ||
|
|
4222121e41 | ||
|
|
964660940e | ||
|
|
83ffb39bee | ||
|
|
0c561f2d63 | ||
|
|
0b8e7bec6d | ||
|
|
4a335403a1 | ||
|
|
a2996cd525 | ||
|
|
a6479da710 | ||
|
|
58cb9b5fb8 | ||
|
|
83b944bf21 | ||
|
|
1a08480f6b | ||
|
|
fb3a0cbf42 | ||
|
|
a1705c10f0 | ||
|
|
dce61b1033 | ||
|
|
b5baaf3cb1 | ||
|
|
a42eb6b99e | ||
|
|
2131b048d9 | ||
|
|
bd6aa943a2 | ||
|
|
d673e88baa | ||
|
|
5862745253 | ||
|
|
41c65eb777 | ||
|
|
a1e6504740 | ||
|
|
11790586da | ||
|
|
c07aa03c47 | ||
|
|
4d74943ebc | ||
|
|
73bb4bd9f8 | ||
|
|
b91521df5a | ||
|
|
93c004955c | ||
|
|
5b99863974 | ||
|
|
0fb19212e5 | ||
|
|
ac2df7a94b | ||
|
|
2a75dbc45d | ||
|
|
6ab8d8ded1 | ||
|
|
472a93f22b | ||
|
|
f877a53918 | ||
|
|
65425a325f | ||
|
|
30807d37d9 | ||
|
|
b5add306c3 | ||
|
|
4b13f31ff7 | ||
|
|
d8c111e899 | ||
|
|
e8f77bb3f7 | ||
|
|
6e9e3b10a9 | ||
|
|
ea3fff9b5c | ||
|
|
3880ca9dd9 | ||
|
|
a6ff3166d9 | ||
|
|
314b9f2a2b | ||
|
|
7b832a3b62 | ||
|
|
30db16eb22 | ||
|
|
57e60a06d1 | ||
|
|
1437a6e420 | ||
|
|
0c78551490 | ||
|
|
ccbea4bc35 | ||
|
|
185cf40ad0 | ||
|
|
5154f41ff7 | ||
|
|
f8394c32a4 | ||
|
|
874bd7cb45 | ||
|
|
7c2ca65f1b | ||
|
|
999e3eadc5 | ||
|
|
e70c23f325 | ||
|
|
820b83dfef | ||
|
|
4e1057499c | ||
|
|
62bb880e5b | ||
|
|
2f773f004a | ||
|
|
7aa65776f7 | ||
|
|
65fbb59fd2 | ||
|
|
56c3692a04 | ||
|
|
e055c47942 | ||
|
|
c8421d8c08 | ||
|
|
dc361d7d39 | ||
|
|
08a20a467c | ||
|
|
34690622bf | ||
|
|
66301b7de0 | ||
|
|
40a1b4208b | ||
|
|
123abe5985 | ||
|
|
c2fe35fe8b | ||
|
|
07ed2ad548 | ||
|
|
3896832af2 | ||
|
|
270e90fb6b | ||
|
|
fe3a8686b7 | ||
|
|
738c2a33f5 | ||
|
|
b1ce5e74ab | ||
|
|
c5bc6fe36b | ||
|
|
13907b537c | ||
|
|
6922a4b24b | ||
|
|
3643fcec6b | ||
|
|
8fb0fb16c4 | ||
|
|
40985b7ee1 | ||
|
|
cd89d163b7 | ||
|
|
0d094c4fa8 | ||
|
|
b64a15ea51 | ||
|
|
49939844e7 | ||
|
|
92989541b6 | ||
|
|
e6c66defdc | ||
|
|
69f8d5a613 | ||
|
|
1adfd83260 | ||
|
|
c98436d756 | ||
|
|
8afa4d7039 | ||
|
|
189e3dc63b | ||
|
|
a2bc12d58a | ||
|
|
ca430c0aef | ||
|
|
f6231672ec | ||
|
|
fdf4260db9 | ||
|
|
a090cc5a91 | ||
|
|
78eadc9a96 | ||
|
|
66067e6408 | ||
|
|
f106772170 | ||
|
|
403446aa07 | ||
|
|
8a6159bfcd | ||
|
|
a7d8df8b3b | ||
|
|
38d6621a00 | ||
|
|
60a81024b7 | ||
|
|
217da52f31 | ||
|
|
efe56505c8 | ||
|
|
9e452bbdf8 | ||
|
|
eeee0f5f28 | ||
|
|
45109900e3 | ||
|
|
33e144018b | ||
|
|
6e8aac25e5 | ||
|
|
eab794395f | ||
|
|
ede9412de9 | ||
|
|
3f2376b494 | ||
|
|
814464aa4d | ||
|
|
eef068a2d8 | ||
|
|
2a9a806e81 | ||
|
|
3029456be5 | ||
|
|
a05e2ab1bc | ||
|
|
4c4bd640a4 | ||
|
|
690fe5fc8f | ||
|
|
a6043bd498 | ||
|
|
1f868feb08 | ||
|
|
7a99e80ccf | ||
|
|
628080301f | ||
|
|
546bec984f | ||
|
|
1a008eda13 | ||
|
|
cc50319941 | ||
|
|
c6854d95b3 | ||
|
|
bd52005dd2 | ||
|
|
458347b0a5 | ||
|
|
5661ebf805 | ||
|
|
22d2215e4a | ||
|
|
6e16869a40 | ||
|
|
63dbe6cae7 | ||
|
|
6973d782f8 | ||
|
|
6675b2b0e9 | ||
|
|
44bf3d1cf7 | ||
|
|
5280a478e7 | ||
|
|
6fa5133665 | ||
|
|
5253c67196 | ||
|
|
58523afbf3 | ||
|
|
60fa705cac | ||
|
|
c2cdafb4bb | ||
|
|
d1cfb36198 | ||
|
|
facf98d1d0 | ||
|
|
d83a326a6a | ||
|
|
a0bca04653 | ||
|
|
cc055c8ab3 | ||
|
|
4eff1272e6 | ||
|
|
ffce3d3167 | ||
|
|
c84abd205a | ||
|
|
40701a068e | ||
|
|
e34b2b75a4 | ||
|
|
2c36ddb0ce | ||
|
|
6af651b177 | ||
|
|
807fef058d | ||
|
|
aee5048cae | ||
|
|
d64c77aef0 | ||
|
|
8da41608fd | ||
|
|
5b757918a7 | ||
|
|
02e9c7bc75 | ||
|
|
bdfc349db5 | ||
|
|
04ec5864b0 | ||
|
|
b81c9a1904 | ||
|
|
3bb962c1b5 | ||
|
|
93a61f9468 | ||
|
|
9c49b28070 | ||
|
|
5a64d68895 | ||
|
|
dc6ab93b52 | ||
|
|
9910382496 | ||
|
|
acf307cc52 | ||
|
|
c18c91ae2e | ||
|
|
0d1e5b687e | ||
|
|
169355992c | ||
|
|
ea89f7adf0 | ||
|
|
3afa8c2d72 | ||
|
|
3c865c37a7 | ||
|
|
7294310e84 | ||
|
|
19bf3a0122 | ||
|
|
ec6a1f84eb | ||
|
|
55a4b9b3e3 | ||
|
|
3ed63ebc47 | ||
|
|
235b1346a4 | ||
|
|
4a1d35cd71 | ||
|
|
e4a7c939f0 | ||
|
|
7a759f6296 | ||
|
|
5876ab2874 | ||
|
|
a1b7c6018f | ||
|
|
c3ab48ea74 | ||
|
|
2a8cc03850 | ||
|
|
19c1501eba | ||
|
|
ab25f26f14 | ||
|
|
40458e3979 | ||
|
|
1e39385abe | ||
|
|
c0bcd2a34f | ||
|
|
d057926f7a | ||
|
|
c0f6dcd7e0 | ||
|
|
4d3a90cf3c | ||
|
|
fae6ba4264 | ||
|
|
7ba2a9c929 | ||
|
|
54b2bd7e15 | ||
|
|
0f5c45c265 | ||
|
|
65abf1131b | ||
|
|
37e535a28e | ||
|
|
cf43935508 | ||
|
|
a3b880e95b | ||
|
|
8f3e054245 | ||
|
|
a171f81738 | ||
|
|
7101fadd36 | ||
|
|
d34da301ac | ||
|
|
7f21d473f4 | ||
|
|
dc61df1717 | ||
|
|
1ca4d0bd4b | ||
|
|
7ce4abb0e2 | ||
|
|
5a75f8342f | ||
|
|
faea314f59 | ||
|
|
0485a681c5 | ||
|
|
159b3b3967 | ||
|
|
adb329a1d2 | ||
|
|
05bc4d697d | ||
|
|
0bdc74c160 | ||
|
|
1e48cb9742 | ||
|
|
6339e8c260 | ||
|
|
fbc3059c86 | ||
|
|
43a723c721 | ||
|
|
b506d99d62 | ||
|
|
9f321929ad | ||
|
|
9f96ce9dfd | ||
|
|
70804d949f | ||
|
|
ccb1636efd | ||
|
|
f1aec6c68e | ||
|
|
448f5192bb | ||
|
|
5e60cef6bd | ||
|
|
82a728e041 | ||
|
|
69f14159cf | ||
|
|
48509e3449 | ||
|
|
b77591f70f | ||
|
|
99e6216904 | ||
|
|
1eb63de3ce | ||
|
|
680218a6aa | ||
|
|
f5144f429c | ||
|
|
3bc7b0aa7c | ||
|
|
5bfeb00123 | ||
|
|
6a16ecac0c | ||
|
|
b3cced713b | ||
|
|
0e6751ac92 | ||
|
|
3b8655b69d | ||
|
|
ce07060bd8 | ||
|
|
29b4ca5668 | ||
|
|
1825f05c24 | ||
|
|
68fd1572c6 | ||
|
|
74d516192c | ||
|
|
60e05515c5 | ||
|
|
5672cd9b1d | ||
|
|
e8ca2987d0 | ||
|
|
de422f68e1 | ||
|
|
3b884ab41c | ||
|
|
d9421af90e | ||
|
|
9491539773 | ||
|
|
e1feef71ff | ||
|
|
bf9e25e42e | ||
|
|
326b553922 | ||
|
|
ba75ceb07c | ||
|
|
e2d28563af | ||
|
|
b21d2aea6f | ||
|
|
ac165df0e9 | ||
|
|
bac71ea456 | ||
|
|
ef26e6f208 | ||
|
|
8c3cee2aa2 | ||
|
|
43a9a9b2c7 | ||
|
|
b7d0cf7325 | ||
|
|
3068ed0f95 | ||
|
|
516f54054d |
40
.github/helper/update_pot_file.sh
vendored
Normal file
40
.github/helper/update_pot_file.sh
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
cd ~ || exit
|
||||
|
||||
echo "Setting Up Bench..."
|
||||
|
||||
pip install frappe-bench
|
||||
bench -v init frappe-bench --skip-assets --skip-redis-config-generation --python "$(which python)" --frappe-branch "${BASE_BRANCH}"
|
||||
cd ./frappe-bench || exit
|
||||
|
||||
echo "Get FCRM..."
|
||||
bench get-app --skip-assets crm "${GITHUB_WORKSPACE}"
|
||||
|
||||
echo "Generating POT file..."
|
||||
bench generate-pot-file --app crm
|
||||
|
||||
cd ./apps/crm || exit
|
||||
|
||||
echo "Configuring git user..."
|
||||
git config user.email "developers@erpnext.com"
|
||||
git config user.name "frappe-pr-bot"
|
||||
|
||||
echo "Setting the correct git remote..."
|
||||
# Here, the git remote is a local file path by default. Let's change it to the upstream repo.
|
||||
git remote set-url upstream https://github.com/frappe/crm.git
|
||||
|
||||
echo "Creating a new branch..."
|
||||
isodate=$(date -u +"%Y-%m-%d")
|
||||
branch_name="pot_${BASE_BRANCH}_${isodate}"
|
||||
git checkout -b "${branch_name}"
|
||||
|
||||
echo "Commiting changes..."
|
||||
git add crm/locale/main.pot
|
||||
git commit -m "chore: update POT file"
|
||||
|
||||
gh auth setup-git
|
||||
git push -u upstream "${branch_name}"
|
||||
|
||||
echo "Creating a PR..."
|
||||
gh pr create --fill --base "${BASE_BRANCH}" --head "${branch_name}" -R frappe/crm
|
||||
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
@ -51,7 +51,7 @@ jobs:
|
||||
check-latest: true
|
||||
|
||||
- name: Cache pip
|
||||
uses: actions/cache@v2
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.cache/pip
|
||||
key: ${{ runner.os }}-pip-${{ hashFiles('**/*requirements.txt', '**/pyproject.toml', '**/setup.py', '**/setup.cfg') }}
|
||||
@ -63,7 +63,7 @@ jobs:
|
||||
id: yarn-cache-dir-path
|
||||
run: 'echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT'
|
||||
|
||||
- uses: actions/cache@v3
|
||||
- uses: actions/cache@v4
|
||||
id: yarn-cache
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
|
||||
35
.github/workflows/generate-pot-file.yml
vendored
Normal file
35
.github/workflows/generate-pot-file.yml
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
name: Regenerate POT file (translatable strings)
|
||||
on:
|
||||
schedule:
|
||||
# 9:30 UTC => 3 PM IST Sunday
|
||||
- cron: "30 9 * * 0"
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
regenerate-pot-file:
|
||||
name: Regenerate POT file
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
branch: ["develop"]
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ matrix.branch }}
|
||||
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.12"
|
||||
|
||||
- name: Run script to update POT file
|
||||
run: |
|
||||
bash ${GITHUB_WORKSPACE}/.github/helper/update_pot_file.sh
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
||||
BASE_BRANCH: ${{ matrix.branch }}
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@ -7,6 +7,5 @@ dev-dist
|
||||
tags
|
||||
node_modules
|
||||
crm/public/frontend
|
||||
frontend/yarn.lock
|
||||
crm/www/crm.html
|
||||
build
|
||||
|
||||
11
README.md
11
README.md
@ -8,7 +8,7 @@
|
||||
|
||||
**Simplify Sales, Amplify Relationships**
|
||||
|
||||

|
||||
[](https://github.com/frappe/crm/releases)
|
||||
|
||||
<div>
|
||||
<picture>
|
||||
@ -84,6 +84,14 @@ The motivation behind building Frappe CRM stems from the need for a simple, cust
|
||||
- [Frappe Framework](https://github.com/frappe/frappe): A full-stack web application framework.
|
||||
- [Frappe UI](https://github.com/frappe/frappe-ui): A Vue-based UI library, to provide a modern user interface.
|
||||
|
||||
### Compatibility
|
||||
This app is compatible with the following versions of Frappe and ERPNext:
|
||||
|
||||
| CRM branch | Stability | Frappe branch | ERPNext branch |
|
||||
| :-------------------- | :-------- | :------------------- | :------------------- |
|
||||
| main - v1.x | stable | v15.x | v15.x |
|
||||
| develop - future/v2.x | unstable | develop - future/v16 | develop - future/v16 |
|
||||
|
||||
## Getting Started (Production)
|
||||
|
||||
### Managed Hosting
|
||||
@ -181,6 +189,7 @@ You need Docker, docker-compose and git setup on your machine. Refer [Docker doc
|
||||
- [Discuss Forum](https://discuss.frappe.io/c/frappe-crm)
|
||||
- [Documentation](https://docs.frappe.io/crm)
|
||||
- [YouTube](https://www.youtube.com/channel/UCn3bV5kx77HsVwtnlCeEi_A)
|
||||
- [X/Twitter](https://x.com/frappetech)
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
|
||||
__version__ = "1.34.5"
|
||||
__version__ = "1.53.1"
|
||||
__title__ = "Frappe CRM"
|
||||
|
||||
|
||||
@ -1,9 +1,10 @@
|
||||
from bs4 import BeautifulSoup
|
||||
import frappe
|
||||
from frappe.translate import get_all_translations
|
||||
from frappe.utils import validate_email_address, split_emails, cstr
|
||||
from frappe.utils.telemetry import POSTHOG_HOST_FIELD, POSTHOG_PROJECT_FIELD
|
||||
from bs4 import BeautifulSoup
|
||||
from frappe.config import get_modules_from_all_apps_for_user
|
||||
from frappe.core.api.file import get_max_file_size
|
||||
from frappe.translate import get_all_translations
|
||||
from frappe.utils import cstr, split_emails, validate_email_address
|
||||
from frappe.utils.telemetry import POSTHOG_HOST_FIELD, POSTHOG_PROJECT_FIELD
|
||||
|
||||
|
||||
@frappe.whitelist(allow_guest=True)
|
||||
@ -44,7 +45,7 @@ def get_user_signature():
|
||||
if html_signature:
|
||||
_signature = html_signature.renderContents()
|
||||
content = ""
|
||||
if (cstr(_signature) or signature):
|
||||
if cstr(_signature) or signature:
|
||||
content = f'<br><p class="signature">{signature}</p>'
|
||||
return content
|
||||
|
||||
@ -63,15 +64,22 @@ def check_app_permission():
|
||||
if frappe.session.user == "Administrator":
|
||||
return True
|
||||
|
||||
allowed_modules = get_modules_from_all_apps_for_user()
|
||||
allowed_modules = [x["module_name"] for x in allowed_modules]
|
||||
if "FCRM" not in allowed_modules:
|
||||
return False
|
||||
|
||||
roles = frappe.get_roles()
|
||||
if any(role in ["System Manager", "Sales User", "Sales Manager", "Sales Master Manager"] for role in roles):
|
||||
if any(
|
||||
role in ["System Manager", "Sales User", "Sales Manager"] for role in roles
|
||||
):
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
|
||||
@frappe.whitelist(allow_guest=True)
|
||||
def accept_invitation(key: str = None):
|
||||
def accept_invitation(key: str | None = None):
|
||||
if not key:
|
||||
frappe.throw("Invalid or expired key")
|
||||
|
||||
@ -91,6 +99,11 @@ def accept_invitation(key: str = None):
|
||||
|
||||
@frappe.whitelist()
|
||||
def invite_by_email(emails: str, role: str):
|
||||
frappe.only_for(["Sales Manager", "System Manager"])
|
||||
|
||||
if role not in ["System Manager", "Sales Manager", "Sales User"]:
|
||||
frappe.throw("Cannot invite for this role")
|
||||
|
||||
if not emails:
|
||||
return
|
||||
email_string = validate_email_address(emails, throw=False)
|
||||
@ -100,7 +113,10 @@ def invite_by_email(emails: str, role: str):
|
||||
existing_members = frappe.db.get_all("User", filters={"email": ["in", email_list]}, pluck="email")
|
||||
existing_invites = frappe.db.get_all(
|
||||
"CRM Invitation",
|
||||
filters={"email": ["in", email_list], "role": ["in", ["Sales Manager", "Sales User"]]},
|
||||
filters={
|
||||
"email": ["in", email_list],
|
||||
"role": ["in", ["System Manager", "Sales Manager", "Sales User"]],
|
||||
},
|
||||
pluck="email",
|
||||
)
|
||||
|
||||
@ -109,6 +125,12 @@ def invite_by_email(emails: str, role: str):
|
||||
for email in to_invite:
|
||||
frappe.get_doc(doctype="CRM Invitation", email=email, role=role).insert(ignore_permissions=True)
|
||||
|
||||
return {
|
||||
"existing_members": existing_members,
|
||||
"existing_invites": existing_invites,
|
||||
"to_invite": to_invite,
|
||||
}
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_file_uploader_defaults(doctype: str):
|
||||
@ -120,8 +142,8 @@ def get_file_uploader_defaults(doctype: str):
|
||||
make_attachments_public = meta.get("make_attachments_public")
|
||||
|
||||
return {
|
||||
'allowed_file_types': frappe.get_system_settings("allowed_file_extensions"),
|
||||
'max_file_size': get_max_file_size(),
|
||||
'max_number_of_files': max_number_of_files,
|
||||
'make_attachments_public': bool(make_attachments_public),
|
||||
}
|
||||
"allowed_file_types": frappe.get_system_settings("allowed_file_extensions"),
|
||||
"max_file_size": get_max_file_size(),
|
||||
"max_number_of_files": max_number_of_files,
|
||||
"make_attachments_public": bool(make_attachments_public),
|
||||
}
|
||||
|
||||
@ -124,6 +124,7 @@ def get_deal_activities(name):
|
||||
activity = {
|
||||
"activity_type": "communication",
|
||||
"communication_type": communication.communication_type,
|
||||
"communication_date": communication.communication_date or communication.creation,
|
||||
"creation": communication.creation,
|
||||
"data": {
|
||||
"subject": communication.subject,
|
||||
@ -255,6 +256,7 @@ def get_lead_activities(name):
|
||||
activity = {
|
||||
"activity_type": "communication",
|
||||
"communication_type": communication.communication_type,
|
||||
"communication_date": communication.communication_date or communication.creation,
|
||||
"creation": communication.creation,
|
||||
"data": {
|
||||
"subject": communication.subject,
|
||||
|
||||
32
crm/api/assignment_rule.py
Normal file
32
crm/api/assignment_rule.py
Normal file
@ -0,0 +1,32 @@
|
||||
import frappe
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_assignment_rules_list():
|
||||
assignment_rules = []
|
||||
for docname in frappe.get_all(
|
||||
"Assignment Rule", filters={"document_type": ["in", ["CRM Lead", "CRM Deal"]]}
|
||||
):
|
||||
doc = frappe.get_value(
|
||||
"Assignment Rule",
|
||||
docname,
|
||||
fieldname=[
|
||||
"name",
|
||||
"description",
|
||||
"disabled",
|
||||
"priority",
|
||||
],
|
||||
as_dict=True,
|
||||
)
|
||||
users_exists = bool(frappe.db.exists("Assignment Rule User", {"parent": docname.name}))
|
||||
assignment_rules.append({**doc, "users_exists": users_exists})
|
||||
return assignment_rules
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def duplicate_assignment_rule(docname, new_name):
|
||||
doc = frappe.get_doc("Assignment Rule", docname)
|
||||
doc.name = new_name
|
||||
doc.assignment_rule_name = new_name
|
||||
doc.insert()
|
||||
return doc
|
||||
@ -3,29 +3,9 @@ from frappe import _
|
||||
|
||||
|
||||
def validate(doc, method):
|
||||
set_primary_email(doc)
|
||||
set_primary_mobile_no(doc)
|
||||
doc.set_primary_email()
|
||||
doc.set_primary("mobile_no")
|
||||
update_deals_email_mobile_no(doc)
|
||||
|
||||
|
||||
def set_primary_email(doc):
|
||||
if not doc.email_ids:
|
||||
return
|
||||
|
||||
if len(doc.email_ids) == 1:
|
||||
doc.email_ids[0].is_primary = 1
|
||||
|
||||
|
||||
def set_primary_mobile_no(doc):
|
||||
if not doc.phone_nos:
|
||||
return
|
||||
|
||||
if len(doc.phone_nos) == 1:
|
||||
doc.phone_nos[0].is_primary_mobile_no = 1
|
||||
|
||||
|
||||
def update_deals_email_mobile_no(doc):
|
||||
linked_deals = frappe.get_all(
|
||||
"CRM Contacts",
|
||||
@ -34,38 +14,18 @@ def update_deals_email_mobile_no(doc):
|
||||
)
|
||||
|
||||
for linked_deal in linked_deals:
|
||||
deal = frappe.get_cached_doc("CRM Deal", linked_deal.parent)
|
||||
deal = frappe.db.get_values("CRM Deal", linked_deal.parent, ["email", "mobile_no"], as_dict=True)[0]
|
||||
if deal.email != doc.email_id or deal.mobile_no != doc.mobile_no:
|
||||
deal.email = doc.email_id
|
||||
deal.mobile_no = doc.mobile_no
|
||||
deal.save(ignore_permissions=True)
|
||||
frappe.db.set_value(
|
||||
"CRM Deal",
|
||||
linked_deal.parent,
|
||||
{
|
||||
"email": doc.email_id,
|
||||
"mobile_no": doc.mobile_no,
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_contact(name):
|
||||
Contact = frappe.qb.DocType("Contact")
|
||||
|
||||
query = (
|
||||
frappe.qb.from_(Contact)
|
||||
.select("*")
|
||||
.where(Contact.name == name)
|
||||
.limit(1)
|
||||
)
|
||||
|
||||
contact = query.run(as_dict=True)
|
||||
if not len(contact):
|
||||
frappe.throw(_("Contact not found"), frappe.DoesNotExistError)
|
||||
contact = contact.pop()
|
||||
|
||||
contact["doctype"] = "Contact"
|
||||
contact["email_ids"] = frappe.get_all(
|
||||
"Contact Email", filters={"parent": name}, fields=["name", "email_id", "is_primary"]
|
||||
)
|
||||
contact["phone_nos"] = frappe.get_all(
|
||||
"Contact Phone", filters={"parent": name}, fields=["name", "phone", "is_primary_mobile_no"]
|
||||
)
|
||||
return contact
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_linked_deals(contact):
|
||||
"""Get linked deals for a contact"""
|
||||
@ -109,12 +69,14 @@ def create_new(contact, field, value):
|
||||
if not frappe.has_permission("Contact", "write", contact):
|
||||
frappe.throw("Not permitted", frappe.PermissionError)
|
||||
|
||||
contact = frappe.get_doc("Contact", contact)
|
||||
contact = frappe.get_cached_doc("Contact", contact)
|
||||
|
||||
if field == "email":
|
||||
contact.append("email_ids", {"email_id": value})
|
||||
email = {"email_id": value, "is_primary": 1 if len(contact.email_ids) == 0 else 0}
|
||||
contact.append("email_ids", email)
|
||||
elif field in ("mobile_no", "phone"):
|
||||
contact.append("phone_nos", {"phone": value})
|
||||
mobile_no = {"phone": value, "is_primary_mobile_no": 1 if len(contact.phone_nos) == 0 else 0}
|
||||
contact.append("phone_nos", mobile_no)
|
||||
else:
|
||||
frappe.throw("Invalid field")
|
||||
|
||||
@ -174,10 +136,10 @@ def search_emails(txt: str):
|
||||
or_filters=or_filters,
|
||||
limit_start=0,
|
||||
limit_page_length=20,
|
||||
order_by='email_id, full_name, name',
|
||||
order_by="email_id, full_name, name",
|
||||
ignore_permissions=False,
|
||||
as_list=True,
|
||||
strict=False,
|
||||
)
|
||||
|
||||
return results
|
||||
return results
|
||||
|
||||
1142
crm/api/dashboard.py
Normal file
1142
crm/api/dashboard.py
Normal file
File diff suppressed because it is too large
Load Diff
@ -15,12 +15,10 @@ def login():
|
||||
frappe.local.response["location"] = frappe.local.response["redirect_to"]
|
||||
|
||||
|
||||
def validate_reset_password(user):
|
||||
def validate_reset_password(doc, event):
|
||||
if frappe.conf.demo_username and frappe.session.user == frappe.conf.demo_username:
|
||||
frappe.throw(
|
||||
_("Password cannot be reset by Demo User {}").format(
|
||||
frappe.bold(frappe.conf.demo_username)
|
||||
),
|
||||
_("Password cannot be reset by Demo User {}").format(frappe.bold(frappe.conf.demo_username)),
|
||||
frappe.PermissionError,
|
||||
)
|
||||
|
||||
@ -28,9 +26,6 @@ def validate_reset_password(user):
|
||||
def validate_user(doc, event):
|
||||
if frappe.conf.demo_username and frappe.session.user == frappe.conf.demo_username and doc.new_password:
|
||||
frappe.throw(
|
||||
_("Password cannot be reset by Demo User {}").format(
|
||||
frappe.bold(frappe.conf.demo_username)
|
||||
),
|
||||
_("Password cannot be reset by Demo User {}").format(frappe.bold(frappe.conf.demo_username)),
|
||||
frappe.PermissionError,
|
||||
)
|
||||
|
||||
|
||||
291
crm/api/doc.py
291
crm/api/doc.py
@ -2,6 +2,8 @@ import json
|
||||
|
||||
import frappe
|
||||
from frappe import _
|
||||
from frappe.custom.doctype.property_setter.property_setter import make_property_setter
|
||||
from frappe.desk.form.assign_to import set_status
|
||||
from frappe.model import no_value_fields
|
||||
from frappe.model.document import get_controller
|
||||
from frappe.utils import make_filter_tuple
|
||||
@ -9,6 +11,7 @@ from pypika import Criterion
|
||||
|
||||
from crm.api.views import get_views
|
||||
from crm.fcrm.doctype.crm_form_script.crm_form_script import get_form_script
|
||||
from crm.utils import get_dynamic_linked_docs, get_linked_docs
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
@ -178,23 +181,39 @@ def get_doctype_fields_meta(DocField, doctype, allowed_fieldtypes, restricted_fi
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_quick_filters(doctype: str):
|
||||
meta = frappe.get_meta(doctype)
|
||||
fields = [field for field in meta.fields if field.in_standard_filter]
|
||||
def get_quick_filters(doctype: str, cached: bool = True):
|
||||
meta = frappe.get_meta(doctype, cached)
|
||||
quick_filters = []
|
||||
|
||||
if global_settings := frappe.db.exists("CRM Global Settings", {"dt": doctype, "type": "Quick Filters"}):
|
||||
_quick_filters = frappe.db.get_value("CRM Global Settings", global_settings, "json")
|
||||
_quick_filters = json.loads(_quick_filters) or []
|
||||
|
||||
fields = []
|
||||
|
||||
for filter in _quick_filters:
|
||||
if filter == "name":
|
||||
fields.append({"label": "Name", "fieldname": "name", "fieldtype": "Data"})
|
||||
else:
|
||||
field = next((f for f in meta.fields if f.fieldname == filter), None)
|
||||
if field:
|
||||
fields.append(field)
|
||||
|
||||
else:
|
||||
fields = [field for field in meta.fields if field.in_standard_filter]
|
||||
|
||||
for field in fields:
|
||||
options = field.options
|
||||
if field.fieldtype == "Select" and options and isinstance(options, str):
|
||||
options = field.get("options")
|
||||
if field.get("fieldtype") == "Select" and options and isinstance(options, str):
|
||||
options = options.split("\n")
|
||||
options = [{"label": option, "value": option} for option in options]
|
||||
if not any([not option.get("value") for option in options]):
|
||||
options.insert(0, {"label": "", "value": ""})
|
||||
quick_filters.append(
|
||||
{
|
||||
"label": _(field.label),
|
||||
"fieldname": field.fieldname,
|
||||
"fieldtype": field.fieldtype,
|
||||
"label": _(field.get("label")),
|
||||
"fieldname": field.get("fieldname"),
|
||||
"fieldtype": field.get("fieldtype"),
|
||||
"options": options,
|
||||
}
|
||||
)
|
||||
@ -205,6 +224,55 @@ def get_quick_filters(doctype: str):
|
||||
return quick_filters
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def update_quick_filters(quick_filters: str, old_filters: str, doctype: str):
|
||||
quick_filters = json.loads(quick_filters)
|
||||
old_filters = json.loads(old_filters)
|
||||
|
||||
new_filters = [filter for filter in quick_filters if filter not in old_filters]
|
||||
removed_filters = [filter for filter in old_filters if filter not in quick_filters]
|
||||
|
||||
# update or create global quick filter settings
|
||||
create_update_global_settings(doctype, quick_filters)
|
||||
|
||||
# remove old filters
|
||||
for filter in removed_filters:
|
||||
update_in_standard_filter(filter, doctype, 0)
|
||||
|
||||
# add new filters
|
||||
for filter in new_filters:
|
||||
update_in_standard_filter(filter, doctype, 1)
|
||||
|
||||
|
||||
def create_update_global_settings(doctype, quick_filters):
|
||||
if global_settings := frappe.db.exists("CRM Global Settings", {"dt": doctype, "type": "Quick Filters"}):
|
||||
frappe.db.set_value("CRM Global Settings", global_settings, "json", json.dumps(quick_filters))
|
||||
else:
|
||||
# create CRM Global Settings doc
|
||||
doc = frappe.new_doc("CRM Global Settings")
|
||||
doc.dt = doctype
|
||||
doc.type = "Quick Filters"
|
||||
doc.json = json.dumps(quick_filters)
|
||||
doc.insert()
|
||||
|
||||
|
||||
def update_in_standard_filter(fieldname, doctype, value):
|
||||
if property_name := frappe.db.exists(
|
||||
"Property Setter",
|
||||
{"doc_type": doctype, "field_name": fieldname, "property": "in_standard_filter"},
|
||||
):
|
||||
frappe.db.set_value("Property Setter", property_name, "value", value)
|
||||
else:
|
||||
make_property_setter(
|
||||
doctype,
|
||||
fieldname,
|
||||
"in_standard_filter",
|
||||
value,
|
||||
"Check",
|
||||
validate_fields_for_doctype=False,
|
||||
)
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_data(
|
||||
doctype: str,
|
||||
@ -255,6 +323,8 @@ def get_data(
|
||||
if hasattr(_list, "default_list_data"):
|
||||
default_rows = _list.default_list_data().get("rows")
|
||||
|
||||
meta = frappe.get_meta(doctype)
|
||||
|
||||
if view_type != "kanban":
|
||||
if columns or rows:
|
||||
custom_view = True
|
||||
@ -274,7 +344,7 @@ def get_data(
|
||||
default_view_filters = {
|
||||
"dt": doctype,
|
||||
"type": view_type or "list",
|
||||
"is_default": 1,
|
||||
"is_standard": 1,
|
||||
"user": frappe.session.user,
|
||||
}
|
||||
|
||||
@ -296,6 +366,11 @@ def get_data(
|
||||
if column.get("key") == "_liked_by" and column.get("width") == "10rem":
|
||||
column["width"] = "50px"
|
||||
|
||||
# remove column if column.hidden is True
|
||||
column_meta = meta.get_field(column.get("key"))
|
||||
if column_meta and column_meta.get("hidden"):
|
||||
columns.remove(column)
|
||||
|
||||
# check if rows has group_by_field if not add it
|
||||
if group_by_field and group_by_field not in rows:
|
||||
rows.append(group_by_field)
|
||||
@ -372,9 +447,11 @@ def get_data(
|
||||
new_filters = filters.copy()
|
||||
new_filters.update({column_field: kc.get("name")})
|
||||
|
||||
all_count = len(
|
||||
frappe.get_list(doctype, filters=convert_filter_to_tuple(doctype, new_filters))
|
||||
)
|
||||
all_count = frappe.get_list(
|
||||
doctype,
|
||||
filters=convert_filter_to_tuple(doctype, new_filters),
|
||||
fields="count(*) as total_count",
|
||||
)[0].total_count
|
||||
|
||||
kc["all_count"] = all_count
|
||||
kc["count"] = len(column_data)
|
||||
@ -476,7 +553,9 @@ def get_data(
|
||||
"page_length_count": page_length_count,
|
||||
"is_default": is_default,
|
||||
"views": get_views(doctype),
|
||||
"total_count": len(frappe.get_list(doctype, filters=filters)),
|
||||
"total_count": frappe.get_list(doctype, filters=filters, fields="count(*) as total_count")[
|
||||
0
|
||||
].total_count,
|
||||
"row_count": len(data),
|
||||
"form_script": get_form_script(doctype),
|
||||
"list_script": get_form_script(doctype, "List"),
|
||||
@ -530,7 +609,7 @@ def get_records_based_on_order(doctype, rows, filters, page_length, order):
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_fields_meta(doctype, restricted_fieldtypes=None, as_array=False):
|
||||
def get_fields_meta(doctype, restricted_fieldtypes=None, as_array=False, only_required=False):
|
||||
not_allowed_fieldtypes = [
|
||||
"Tab Break",
|
||||
"Section Break",
|
||||
@ -565,6 +644,9 @@ def get_fields_meta(doctype, restricted_fieldtypes=None, as_array=False):
|
||||
if not restricted_fieldtypes or field.get("fieldtype") not in restricted_fieldtypes:
|
||||
fields.append(field)
|
||||
|
||||
if only_required:
|
||||
fields = [field for field in fields if field.get("reqd")]
|
||||
|
||||
if as_array:
|
||||
return fields
|
||||
|
||||
@ -578,6 +660,25 @@ def get_fields_meta(doctype, restricted_fieldtypes=None, as_array=False):
|
||||
return fields_meta
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def remove_assignments(doctype, name, assignees, ignore_permissions=False):
|
||||
assignees = frappe.parse_json(assignees)
|
||||
|
||||
if not assignees:
|
||||
return
|
||||
|
||||
for assign_to in assignees:
|
||||
set_status(
|
||||
doctype,
|
||||
name,
|
||||
todo=None,
|
||||
assign_to=assign_to,
|
||||
status="Cancelled",
|
||||
ignore_permissions=ignore_permissions,
|
||||
)
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_assigned_users(doctype, name, default_assigned_to=None):
|
||||
assigned_users = frappe.get_all(
|
||||
"ToDo",
|
||||
@ -645,3 +746,165 @@ def getCounts(d, doctype):
|
||||
"FCRM Note", filters={"reference_doctype": doctype, "reference_docname": d.get("name")}
|
||||
)
|
||||
return d
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_linked_docs_of_document(doctype, docname):
|
||||
try:
|
||||
doc = frappe.get_doc(doctype, docname)
|
||||
except frappe.DoesNotExistError:
|
||||
return []
|
||||
|
||||
linked_docs = get_linked_docs(doc)
|
||||
dynamic_linked_docs = get_dynamic_linked_docs(doc)
|
||||
|
||||
linked_docs.extend(dynamic_linked_docs)
|
||||
linked_docs = list({doc["reference_docname"]: doc for doc in linked_docs}.values())
|
||||
|
||||
docs_data = []
|
||||
for doc in linked_docs:
|
||||
if not doc.get("reference_doctype") or not doc.get("reference_docname"):
|
||||
continue
|
||||
|
||||
try:
|
||||
data = frappe.get_doc(doc["reference_doctype"], doc["reference_docname"])
|
||||
except (frappe.DoesNotExistError, frappe.ValidationError):
|
||||
continue
|
||||
|
||||
title = data.get("title")
|
||||
if data.doctype == "CRM Call Log":
|
||||
title = f"Call from {data.get('from')} to {data.get('to')}"
|
||||
|
||||
if data.doctype == "CRM Deal":
|
||||
title = data.get("organization")
|
||||
|
||||
if data.doctype == "CRM Notification":
|
||||
title = data.get("message")
|
||||
|
||||
docs_data.append(
|
||||
{
|
||||
"doc": data.doctype,
|
||||
"title": title or data.get("name"),
|
||||
"reference_docname": doc["reference_docname"],
|
||||
"reference_doctype": doc["reference_doctype"],
|
||||
}
|
||||
)
|
||||
return docs_data
|
||||
|
||||
|
||||
def remove_doc_link(doctype, docname):
|
||||
if not doctype or not docname:
|
||||
return
|
||||
|
||||
try:
|
||||
linked_doc_data = frappe.get_doc(doctype, docname)
|
||||
if doctype == "CRM Notification":
|
||||
delete_notification_type = {
|
||||
"notification_type_doctype": "",
|
||||
"notification_type_doc": "",
|
||||
}
|
||||
delete_references = {
|
||||
"reference_doctype": "",
|
||||
"reference_name": "",
|
||||
}
|
||||
if linked_doc_data.get("notification_type_doctype") == linked_doc_data.get("reference_doctype"):
|
||||
delete_references.update(delete_notification_type)
|
||||
|
||||
linked_doc_data.update(delete_references)
|
||||
else:
|
||||
linked_doc_data.update(
|
||||
{
|
||||
"reference_doctype": "",
|
||||
"reference_docname": "",
|
||||
}
|
||||
)
|
||||
linked_doc_data.save(ignore_permissions=True)
|
||||
except (frappe.DoesNotExistError, frappe.ValidationError):
|
||||
pass
|
||||
|
||||
|
||||
def remove_contact_link(doctype, docname):
|
||||
if not doctype or not docname:
|
||||
return
|
||||
|
||||
try:
|
||||
linked_doc_data = frappe.get_doc(doctype, docname)
|
||||
linked_doc_data.update(
|
||||
{
|
||||
"contact": None,
|
||||
"contacts": [],
|
||||
}
|
||||
)
|
||||
linked_doc_data.save(ignore_permissions=True)
|
||||
except (frappe.DoesNotExistError, frappe.ValidationError):
|
||||
pass
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def remove_linked_doc_reference(items, remove_contact=None, delete=False):
|
||||
if isinstance(items, str):
|
||||
items = frappe.parse_json(items)
|
||||
|
||||
for item in items:
|
||||
if not item.get("doctype") or not item.get("docname"):
|
||||
continue
|
||||
|
||||
try:
|
||||
if remove_contact:
|
||||
remove_contact_link(item["doctype"], item["docname"])
|
||||
else:
|
||||
remove_doc_link(item["doctype"], item["docname"])
|
||||
if delete:
|
||||
frappe.delete_doc(item["doctype"], item["docname"])
|
||||
except (frappe.DoesNotExistError, frappe.ValidationError):
|
||||
# Skip if document doesn't exist or has validation errors
|
||||
continue
|
||||
|
||||
return "success"
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def delete_bulk_docs(doctype, items, delete_linked=False):
|
||||
from frappe.desk.reportview import delete_bulk
|
||||
|
||||
if not doctype:
|
||||
frappe.throw("Doctype is required")
|
||||
|
||||
if not items:
|
||||
frappe.throw("Items are required")
|
||||
|
||||
items = frappe.parse_json(items)
|
||||
if not isinstance(items, list):
|
||||
frappe.throw("Items must be a list")
|
||||
|
||||
for doc in items:
|
||||
try:
|
||||
if not frappe.db.exists(doctype, doc):
|
||||
frappe.log_error(f"Document {doctype} {doc} does not exist", "Bulk Delete Error")
|
||||
continue
|
||||
|
||||
linked_docs = get_linked_docs_of_document(doctype, doc)
|
||||
for linked_doc in linked_docs:
|
||||
if not linked_doc.get("reference_doctype") or not linked_doc.get("reference_docname"):
|
||||
continue
|
||||
|
||||
remove_linked_doc_reference(
|
||||
[
|
||||
{
|
||||
"doctype": linked_doc["reference_doctype"],
|
||||
"docname": linked_doc["reference_docname"],
|
||||
}
|
||||
],
|
||||
remove_contact=doctype == "Contact",
|
||||
delete=delete_linked,
|
||||
)
|
||||
except Exception as e:
|
||||
frappe.log_error(
|
||||
f"Error processing linked docs for {doctype} {doc}: {str(e)}", "Bulk Delete Error"
|
||||
)
|
||||
|
||||
if len(items) > 10:
|
||||
frappe.enqueue("frappe.desk.reportview.delete_bulk", doctype=doctype, items=items)
|
||||
else:
|
||||
delete_bulk(doctype, items)
|
||||
return "success"
|
||||
|
||||
24
crm/api/onboarding.py
Normal file
24
crm/api/onboarding.py
Normal file
@ -0,0 +1,24 @@
|
||||
import frappe
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_first_lead():
|
||||
lead = frappe.get_all(
|
||||
"CRM Lead",
|
||||
filters={"converted": 0},
|
||||
fields=["name"],
|
||||
order_by="creation",
|
||||
limit=1,
|
||||
)
|
||||
return lead[0].name if lead else None
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_first_deal():
|
||||
deal = frappe.get_all(
|
||||
"CRM Deal",
|
||||
fields=["name"],
|
||||
order_by="creation",
|
||||
limit=1,
|
||||
)
|
||||
return deal[0].name if deal else None
|
||||
@ -23,64 +23,32 @@ def get_users():
|
||||
if frappe.session.user == user.name:
|
||||
user.session_user = True
|
||||
|
||||
user.is_manager = "Sales Manager" in frappe.get_roles(user.name) or user.name == "Administrator"
|
||||
user.roles = frappe.get_roles(user.name)
|
||||
|
||||
user.is_agent = frappe.db.exists("CRM Telephony Agent", {"user": user.name})
|
||||
user.role = ""
|
||||
|
||||
return users
|
||||
if "System Manager" in user.roles:
|
||||
user.role = "System Manager"
|
||||
elif "Sales Manager" in user.roles:
|
||||
user.role = "Sales Manager"
|
||||
elif "Sales User" in user.roles:
|
||||
user.role = "Sales User"
|
||||
elif "Guest" in user.roles:
|
||||
user.role = "Guest"
|
||||
|
||||
if frappe.session.user == user.name:
|
||||
user.session_user = True
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_contacts():
|
||||
contacts = frappe.get_all(
|
||||
"Contact",
|
||||
fields=[
|
||||
"name",
|
||||
"salutation",
|
||||
"first_name",
|
||||
"last_name",
|
||||
"full_name",
|
||||
"gender",
|
||||
"address",
|
||||
"designation",
|
||||
"image",
|
||||
"email_id",
|
||||
"mobile_no",
|
||||
"phone",
|
||||
"company_name",
|
||||
"modified",
|
||||
],
|
||||
order_by="first_name asc",
|
||||
distinct=True,
|
||||
)
|
||||
user.is_telephony_agent = frappe.db.exists("CRM Telephony Agent", {"user": user.name})
|
||||
|
||||
for contact in contacts:
|
||||
contact["email_ids"] = frappe.get_all(
|
||||
"Contact Email",
|
||||
filters={"parenttype": "Contact", "parent": contact.name},
|
||||
fields=["name", "email_id", "is_primary"],
|
||||
)
|
||||
crm_users = []
|
||||
|
||||
contact["phone_nos"] = frappe.get_all(
|
||||
"Contact Phone",
|
||||
filters={"parenttype": "Contact", "parent": contact.name},
|
||||
fields=["name", "phone", "is_primary_phone", "is_primary_mobile_no"],
|
||||
)
|
||||
# crm users are users with role Sales User or Sales Manager
|
||||
for user in users:
|
||||
if "Sales User" in user.roles or "Sales Manager" in user.roles:
|
||||
crm_users.append(user)
|
||||
|
||||
return contacts
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_lead_contacts():
|
||||
lead_contacts = frappe.get_all(
|
||||
"CRM Lead",
|
||||
fields=["name", "lead_name", "mobile_no", "phone", "image", "modified"],
|
||||
filters={"converted": 0},
|
||||
order_by="lead_name asc",
|
||||
distinct=True,
|
||||
)
|
||||
|
||||
return lead_contacts
|
||||
return users, crm_users
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
|
||||
99
crm/api/settings.py
Normal file
99
crm/api/settings.py
Normal file
@ -0,0 +1,99 @@
|
||||
import frappe
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def create_email_account(data):
|
||||
service = data.get("service")
|
||||
service_config = email_service_config.get(service)
|
||||
if not service_config:
|
||||
return "Service not supported"
|
||||
|
||||
try:
|
||||
email_doc = frappe.get_doc(
|
||||
{
|
||||
"doctype": "Email Account",
|
||||
"email_id": data.get("email_id"),
|
||||
"email_account_name": data.get("email_account_name"),
|
||||
"service": service,
|
||||
"enable_incoming": data.get("enable_incoming"),
|
||||
"enable_outgoing": data.get("enable_outgoing"),
|
||||
"default_incoming": data.get("default_incoming"),
|
||||
"default_outgoing": data.get("default_outgoing"),
|
||||
"email_sync_option": "ALL",
|
||||
"initial_sync_count": 100,
|
||||
"create_contact": 1,
|
||||
"track_email_status": 1,
|
||||
"use_tls": 1,
|
||||
"use_imap": 1,
|
||||
"smtp_port": 587,
|
||||
**service_config,
|
||||
}
|
||||
)
|
||||
if service == "Frappe Mail":
|
||||
email_doc.api_key = data.get("api_key")
|
||||
email_doc.api_secret = data.get("api_secret")
|
||||
email_doc.frappe_mail_site = data.get("frappe_mail_site")
|
||||
email_doc.append_to = "CRM Lead"
|
||||
else:
|
||||
email_doc.append("imap_folder", {"append_to": "CRM Lead", "folder_name": "INBOX"})
|
||||
email_doc.password = data.get("password")
|
||||
# validate whether the credentials are correct
|
||||
email_doc.get_incoming_server()
|
||||
|
||||
# if correct credentials, save the email account
|
||||
email_doc.save()
|
||||
except Exception as e:
|
||||
frappe.throw(str(e))
|
||||
|
||||
|
||||
email_service_config = {
|
||||
"Frappe Mail": {
|
||||
"domain": None,
|
||||
"password": None,
|
||||
"awaiting_password": 0,
|
||||
"ascii_encode_password": 0,
|
||||
"login_id_is_different": 0,
|
||||
"login_id": None,
|
||||
"use_imap": 0,
|
||||
"use_ssl": 0,
|
||||
"validate_ssl_certificate": 0,
|
||||
"use_starttls": 0,
|
||||
"email_server": None,
|
||||
"incoming_port": 0,
|
||||
"always_use_account_email_id_as_sender": 1,
|
||||
"use_tls": 0,
|
||||
"use_ssl_for_outgoing": 0,
|
||||
"smtp_server": None,
|
||||
"smtp_port": None,
|
||||
"no_smtp_authentication": 0,
|
||||
},
|
||||
"GMail": {
|
||||
"email_server": "imap.gmail.com",
|
||||
"use_ssl": 1,
|
||||
"smtp_server": "smtp.gmail.com",
|
||||
},
|
||||
"Outlook": {
|
||||
"email_server": "imap-mail.outlook.com",
|
||||
"use_ssl": 1,
|
||||
"smtp_server": "smtp-mail.outlook.com",
|
||||
},
|
||||
"Sendgrid": {
|
||||
"smtp_server": "smtp.sendgrid.net",
|
||||
"smtp_port": 587,
|
||||
},
|
||||
"SparkPost": {
|
||||
"smtp_server": "smtp.sparkpostmail.com",
|
||||
},
|
||||
"Yahoo": {
|
||||
"email_server": "imap.mail.yahoo.com",
|
||||
"use_ssl": 1,
|
||||
"smtp_server": "smtp.mail.yahoo.com",
|
||||
"smtp_port": 587,
|
||||
},
|
||||
"Yandex": {
|
||||
"email_server": "imap.yandex.com",
|
||||
"use_ssl": 1,
|
||||
"smtp_server": "smtp.yandex.com",
|
||||
"smtp_port": 587,
|
||||
},
|
||||
}
|
||||
137
crm/api/todo.py
137
crm/api/todo.py
@ -1,90 +1,79 @@
|
||||
import frappe
|
||||
from frappe import _
|
||||
|
||||
from crm.fcrm.doctype.crm_notification.crm_notification import notify_user
|
||||
|
||||
|
||||
def after_insert(doc, method):
|
||||
if (
|
||||
doc.reference_type in ["CRM Lead", "CRM Deal"]
|
||||
and doc.reference_name
|
||||
and doc.allocated_to
|
||||
):
|
||||
fieldname = "lead_owner" if doc.reference_type == "CRM Lead" else "deal_owner"
|
||||
lead_owner = frappe.db.get_value(
|
||||
doc.reference_type, doc.reference_name, fieldname
|
||||
)
|
||||
if not lead_owner:
|
||||
frappe.db.set_value(
|
||||
doc.reference_type, doc.reference_name, fieldname, doc.allocated_to
|
||||
)
|
||||
if doc.reference_type in ["CRM Lead", "CRM Deal"] and doc.reference_name and doc.allocated_to:
|
||||
fieldname = "lead_owner" if doc.reference_type == "CRM Lead" else "deal_owner"
|
||||
owner = frappe.db.get_value(doc.reference_type, doc.reference_name, fieldname)
|
||||
if not owner:
|
||||
frappe.db.set_value(
|
||||
doc.reference_type, doc.reference_name, fieldname, doc.allocated_to, update_modified=False
|
||||
)
|
||||
|
||||
if (
|
||||
doc.reference_type in ["CRM Lead", "CRM Deal", "CRM Task"]
|
||||
and doc.reference_name
|
||||
and doc.allocated_to
|
||||
):
|
||||
notify_assigned_user(doc)
|
||||
if doc.reference_type in ["CRM Lead", "CRM Deal", "CRM Task"] and doc.reference_name and doc.allocated_to:
|
||||
notify_assigned_user(doc)
|
||||
|
||||
|
||||
def on_update(doc, method):
|
||||
if (
|
||||
doc.has_value_changed("status")
|
||||
and doc.status == "Cancelled"
|
||||
and doc.reference_type in ["CRM Lead", "CRM Deal", "CRM Task"]
|
||||
and doc.reference_name
|
||||
and doc.allocated_to
|
||||
):
|
||||
notify_assigned_user(doc, is_cancelled=True)
|
||||
if (
|
||||
doc.has_value_changed("status")
|
||||
and doc.status == "Cancelled"
|
||||
and doc.reference_type in ["CRM Lead", "CRM Deal", "CRM Task"]
|
||||
and doc.reference_name
|
||||
and doc.allocated_to
|
||||
):
|
||||
notify_assigned_user(doc, is_cancelled=True)
|
||||
|
||||
|
||||
def notify_assigned_user(doc, is_cancelled=False):
|
||||
_doc = frappe.get_doc(doc.reference_type, doc.reference_name)
|
||||
owner = frappe.get_cached_value("User", frappe.session.user, "full_name")
|
||||
notification_text = get_notification_text(owner, doc, _doc, is_cancelled)
|
||||
_doc = frappe.get_doc(doc.reference_type, doc.reference_name)
|
||||
owner = frappe.get_cached_value("User", frappe.session.user, "full_name")
|
||||
notification_text = get_notification_text(owner, doc, _doc, is_cancelled)
|
||||
|
||||
message = (
|
||||
_("Your assignment on {0} {1} has been removed by {2}").format(
|
||||
doc.reference_type, doc.reference_name, owner
|
||||
)
|
||||
if is_cancelled
|
||||
else _("{0} assigned a {1} {2} to you").format(
|
||||
owner, doc.reference_type, doc.reference_name
|
||||
)
|
||||
)
|
||||
message = (
|
||||
_("Your assignment on {0} {1} has been removed by {2}").format(
|
||||
doc.reference_type, doc.reference_name, owner
|
||||
)
|
||||
if is_cancelled
|
||||
else _("{0} assigned a {1} {2} to you").format(owner, doc.reference_type, doc.reference_name)
|
||||
)
|
||||
|
||||
redirect_to_doctype, redirect_to_name = get_redirect_to_doc(doc)
|
||||
redirect_to_doctype, redirect_to_name = get_redirect_to_doc(doc)
|
||||
|
||||
notify_user(
|
||||
{
|
||||
"owner": frappe.session.user,
|
||||
"assigned_to": doc.allocated_to,
|
||||
"notification_type": "Assignment",
|
||||
"message": message,
|
||||
"notification_text": notification_text,
|
||||
"reference_doctype": doc.reference_type,
|
||||
"reference_docname": doc.reference_name,
|
||||
"redirect_to_doctype": redirect_to_doctype,
|
||||
"redirect_to_docname": redirect_to_name,
|
||||
}
|
||||
)
|
||||
notify_user(
|
||||
{
|
||||
"owner": frappe.session.user,
|
||||
"assigned_to": doc.allocated_to,
|
||||
"notification_type": "Assignment",
|
||||
"message": message,
|
||||
"notification_text": notification_text,
|
||||
"reference_doctype": doc.reference_type,
|
||||
"reference_docname": doc.reference_name,
|
||||
"redirect_to_doctype": redirect_to_doctype,
|
||||
"redirect_to_docname": redirect_to_name,
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
def get_notification_text(owner, doc, reference_doc, is_cancelled=False):
|
||||
name = doc.reference_name
|
||||
doctype = doc.reference_type
|
||||
name = doc.reference_name
|
||||
doctype = doc.reference_type
|
||||
|
||||
if doctype.startswith("CRM "):
|
||||
doctype = doctype[4:].lower()
|
||||
if doctype.startswith("CRM "):
|
||||
doctype = doctype[4:].lower()
|
||||
|
||||
if doctype in ["lead", "deal"]:
|
||||
name = (
|
||||
reference_doc.lead_name or name
|
||||
if doctype == "lead"
|
||||
else reference_doc.organization or reference_doc.lead_name or name
|
||||
)
|
||||
if doctype in ["lead", "deal"]:
|
||||
name = (
|
||||
reference_doc.lead_name or name
|
||||
if doctype == "lead"
|
||||
else reference_doc.organization or reference_doc.lead_name or name
|
||||
)
|
||||
|
||||
if is_cancelled:
|
||||
return f"""
|
||||
if is_cancelled:
|
||||
return f"""
|
||||
<div class="mb-2 leading-5 text-ink-gray-5">
|
||||
<span>{ _('Your assignment on {0} {1} has been removed by {2}').format(
|
||||
doctype,
|
||||
@ -94,7 +83,7 @@ def get_notification_text(owner, doc, reference_doc, is_cancelled=False):
|
||||
</div>
|
||||
"""
|
||||
|
||||
return f"""
|
||||
return f"""
|
||||
<div class="mb-2 leading-5 text-ink-gray-5">
|
||||
<span class="font-medium text-ink-gray-9">{ owner }</span>
|
||||
<span>{ _('assigned a {0} {1} to you').format(
|
||||
@ -104,9 +93,9 @@ def get_notification_text(owner, doc, reference_doc, is_cancelled=False):
|
||||
</div>
|
||||
"""
|
||||
|
||||
if doctype == "task":
|
||||
if is_cancelled:
|
||||
return f"""
|
||||
if doctype == "task":
|
||||
if is_cancelled:
|
||||
return f"""
|
||||
<div class="mb-2 leading-5 text-ink-gray-5">
|
||||
<span>{ _('Your assignment on task {0} has been removed by {1}').format(
|
||||
f'<span class="font-medium text-ink-gray-9">{ reference_doc.title }</span>',
|
||||
@ -114,7 +103,7 @@ def get_notification_text(owner, doc, reference_doc, is_cancelled=False):
|
||||
) }</span>
|
||||
</div>
|
||||
"""
|
||||
return f"""
|
||||
return f"""
|
||||
<div class="mb-2 leading-5 text-ink-gray-5">
|
||||
<span class="font-medium text-ink-gray-9">{ owner }</span>
|
||||
<span>{ _('assigned a new task {0} to you').format(
|
||||
@ -125,8 +114,8 @@ def get_notification_text(owner, doc, reference_doc, is_cancelled=False):
|
||||
|
||||
|
||||
def get_redirect_to_doc(doc):
|
||||
if doc.reference_type == "CRM Task":
|
||||
reference_doc = frappe.get_doc(doc.reference_type, doc.reference_name)
|
||||
return reference_doc.reference_doctype, reference_doc.reference_docname
|
||||
if doc.reference_type == "CRM Task":
|
||||
reference_doc = frappe.get_doc(doc.reference_type, doc.reference_name)
|
||||
return reference_doc.reference_doctype, reference_doc.reference_docname
|
||||
|
||||
return doc.reference_type, doc.reference_name
|
||||
return doc.reference_type, doc.reference_name
|
||||
|
||||
84
crm/api/user.py
Normal file
84
crm/api/user.py
Normal file
@ -0,0 +1,84 @@
|
||||
import frappe
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def add_existing_users(users, role="Sales User"):
|
||||
"""
|
||||
Add existing users to the CRM by assigning them a role (Sales User or Sales Manager).
|
||||
:param users: List of user names to be added
|
||||
"""
|
||||
frappe.only_for(["System Manager", "Sales Manager"])
|
||||
users = frappe.parse_json(users)
|
||||
|
||||
for user in users:
|
||||
add_user(user, role)
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def update_user_role(user, new_role):
|
||||
"""
|
||||
Update the role of the user to Sales Manager, Sales User, or System Manager.
|
||||
:param user: The name of the user
|
||||
:param new_role: The new role to assign (Sales Manager or Sales User)
|
||||
"""
|
||||
|
||||
frappe.only_for(["System Manager", "Sales Manager"])
|
||||
|
||||
if new_role not in ["System Manager", "Sales Manager", "Sales User"]:
|
||||
frappe.throw("Cannot assign this role")
|
||||
|
||||
user_doc = frappe.get_doc("User", user)
|
||||
|
||||
if new_role == "System Manager":
|
||||
user_doc.append_roles("System Manager", "Sales Manager", "Sales User")
|
||||
user_doc.set("block_modules", [])
|
||||
if new_role == "Sales Manager":
|
||||
user_doc.append_roles("Sales Manager", "Sales User")
|
||||
user_doc.remove_roles("System Manager")
|
||||
if new_role == "Sales User":
|
||||
user_doc.append_roles("Sales User")
|
||||
user_doc.remove_roles("Sales Manager", "System Manager")
|
||||
update_module_in_user(user_doc, "FCRM")
|
||||
|
||||
user_doc.save(ignore_permissions=True)
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def add_user(user, role):
|
||||
"""
|
||||
Add a user means adding role (Sales User or/and Sales Manager) to the user.
|
||||
:param user: The name of the user to be added
|
||||
:param role: The role to be assigned (Sales User or Sales Manager)
|
||||
"""
|
||||
update_user_role(user, role)
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def remove_user(user):
|
||||
"""
|
||||
Remove a user means removing Sales User & Sales Manager roles from the user.
|
||||
:param user: The name of the user to be removed
|
||||
"""
|
||||
frappe.only_for(["System Manager", "Sales Manager"])
|
||||
|
||||
user_doc = frappe.get_doc("User", user)
|
||||
roles = [d.role for d in user_doc.roles]
|
||||
|
||||
if "Sales User" in roles:
|
||||
user_doc.remove_roles("Sales User")
|
||||
if "Sales Manager" in roles:
|
||||
user_doc.remove_roles("Sales Manager")
|
||||
|
||||
user_doc.save(ignore_permissions=True)
|
||||
frappe.msgprint(f"User {user} has been removed from CRM roles.")
|
||||
|
||||
|
||||
def update_module_in_user(user, module):
|
||||
block_modules = frappe.get_all(
|
||||
"Module Def",
|
||||
fields=["name as module"],
|
||||
filters={"name": ["!=", module]},
|
||||
)
|
||||
|
||||
if block_modules:
|
||||
user.set("block_modules", block_modules)
|
||||
@ -8,9 +8,9 @@ def get_views(doctype):
|
||||
query = (
|
||||
frappe.qb.from_(View)
|
||||
.select("*")
|
||||
.where(Criterion.any([View.user == '', View.user == frappe.session.user]))
|
||||
.where(Criterion.any([View.user == "", View.user == frappe.session.user]))
|
||||
)
|
||||
if doctype:
|
||||
query = query.where(View.dt == doctype)
|
||||
views = query.run(as_dict=True)
|
||||
return views
|
||||
return views
|
||||
|
||||
@ -10,8 +10,15 @@ from crm.fcrm.doctype.crm_notification.crm_notification import notify_user
|
||||
def validate(doc, method):
|
||||
if doc.type == "Incoming" and doc.get("from"):
|
||||
name, doctype = get_lead_or_deal_from_number(doc.get("from"))
|
||||
doc.reference_doctype = doctype
|
||||
doc.reference_name = name
|
||||
if name != None:
|
||||
doc.reference_doctype = doctype
|
||||
doc.reference_name = name
|
||||
|
||||
if doc.type == "Outgoing" and doc.get("to"):
|
||||
name, doctype = get_lead_or_deal_from_number(doc.get("to"))
|
||||
if name != None:
|
||||
doc.reference_doctype = doctype
|
||||
doc.reference_name = name
|
||||
|
||||
|
||||
def on_update(doc, method):
|
||||
@ -29,7 +36,7 @@ def on_update(doc, method):
|
||||
def notify_agent(doc):
|
||||
if doc.type == "Incoming":
|
||||
doctype = doc.reference_doctype
|
||||
if doctype.startswith("CRM "):
|
||||
if doctype and doctype.startswith("CRM "):
|
||||
doctype = doctype[4:].lower()
|
||||
notification_text = f"""
|
||||
<div class="mb-2 leading-5 text-ink-gray-5">
|
||||
@ -335,5 +342,5 @@ def get_from_name(message):
|
||||
else:
|
||||
from_name = doc.get("lead_name")
|
||||
else:
|
||||
from_name = doc.get("first_name") + " " + doc.get("last_name")
|
||||
from_name = " ".join(filter(None, [doc.get("first_name"), doc.get("last_name")]))
|
||||
return from_name
|
||||
|
||||
8
crm/crowdin.yml
Normal file
8
crm/crowdin.yml
Normal file
@ -0,0 +1,8 @@
|
||||
files:
|
||||
- source: /crm/locale/main.pot
|
||||
translation: /crm/locale/%two_letters_code%.po
|
||||
pull_request_title: "chore: sync translations from crowdin"
|
||||
pull_request_labels:
|
||||
- translation
|
||||
commit_message: "chore: %language% translations"
|
||||
append_commit_message: false
|
||||
@ -41,13 +41,15 @@
|
||||
"fieldname": "from",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
"label": "From"
|
||||
"label": "From",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "status",
|
||||
"fieldtype": "Select",
|
||||
"label": "Status",
|
||||
"options": "Initiated\nRinging\nIn Progress\nCompleted\nFailed\nBusy\nNo Answer\nQueued\nCanceled"
|
||||
"options": "Initiated\nRinging\nIn Progress\nCompleted\nFailed\nBusy\nNo Answer\nQueued\nCanceled",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "start_time",
|
||||
@ -69,13 +71,15 @@
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 1,
|
||||
"label": "Type",
|
||||
"options": "Incoming\nOutgoing"
|
||||
"options": "Incoming\nOutgoing",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "to",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
"label": "To"
|
||||
"label": "To",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"description": "Call duration in seconds",
|
||||
@ -153,7 +157,7 @@
|
||||
],
|
||||
"index_web_pages_for_search": 1,
|
||||
"links": [],
|
||||
"modified": "2025-01-22 17:57:59.289548",
|
||||
"modified": "2025-04-01 16:01:54.479309",
|
||||
"modified_by": "Administrator",
|
||||
"module": "FCRM",
|
||||
"name": "CRM Call Log",
|
||||
|
||||
@ -13,14 +13,14 @@ class CRMCallLog(Document):
|
||||
def default_list_data():
|
||||
columns = [
|
||||
{
|
||||
"label": "From",
|
||||
"label": "Caller",
|
||||
"type": "Link",
|
||||
"key": "caller",
|
||||
"options": "User",
|
||||
"width": "9rem",
|
||||
},
|
||||
{
|
||||
"label": "To",
|
||||
"label": "Receiver",
|
||||
"type": "Link",
|
||||
"key": "receiver",
|
||||
"options": "User",
|
||||
@ -190,11 +190,20 @@ def get_call_log(name):
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def create_lead_from_call_log(call_log):
|
||||
def create_lead_from_call_log(call_log, lead_details=None):
|
||||
lead = frappe.new_doc("CRM Lead")
|
||||
lead.first_name = "Lead from call " + call_log.get("from")
|
||||
lead.mobile_no = call_log.get("from")
|
||||
lead.lead_owner = frappe.session.user
|
||||
lead_details = frappe.parse_json(lead_details or "{}")
|
||||
|
||||
if not lead_details.get("lead_owner"):
|
||||
lead_details["lead_owner"] = frappe.session.user
|
||||
if not lead_details.get("mobile_no"):
|
||||
lead_details["mobile_no"] = call_log.get("from") or ""
|
||||
if not lead_details.get("first_name"):
|
||||
lead_details["first_name"] = "Lead from call " + (
|
||||
lead_details.get("mobile_no") or call_log.get("name")
|
||||
)
|
||||
|
||||
lead.update(lead_details)
|
||||
lead.save(ignore_permissions=True)
|
||||
|
||||
# link call log with lead
|
||||
|
||||
0
crm/fcrm/doctype/crm_dashboard/__init__.py
Normal file
0
crm/fcrm/doctype/crm_dashboard/__init__.py
Normal file
8
crm/fcrm/doctype/crm_dashboard/crm_dashboard.js
Normal file
8
crm/fcrm/doctype/crm_dashboard/crm_dashboard.js
Normal file
@ -0,0 +1,8 @@
|
||||
// Copyright (c) 2025, Frappe Technologies Pvt. Ltd. and contributors
|
||||
// For license information, please see license.txt
|
||||
|
||||
// frappe.ui.form.on("CRM Dashboard", {
|
||||
// refresh(frm) {
|
||||
|
||||
// },
|
||||
// });
|
||||
105
crm/fcrm/doctype/crm_dashboard/crm_dashboard.json
Normal file
105
crm/fcrm/doctype/crm_dashboard/crm_dashboard.json
Normal file
@ -0,0 +1,105 @@
|
||||
{
|
||||
"actions": [],
|
||||
"allow_rename": 1,
|
||||
"autoname": "field:title",
|
||||
"creation": "2025-07-14 12:19:49.725022",
|
||||
"doctype": "DocType",
|
||||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
"title",
|
||||
"private",
|
||||
"column_break_exbw",
|
||||
"user",
|
||||
"section_break_hfza",
|
||||
"layout"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
"fieldname": "column_break_exbw",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"fieldname": "section_break_hfza",
|
||||
"fieldtype": "Section Break"
|
||||
},
|
||||
{
|
||||
"default": "[]",
|
||||
"fieldname": "layout",
|
||||
"fieldtype": "Code",
|
||||
"label": "Layout",
|
||||
"options": "JSON"
|
||||
},
|
||||
{
|
||||
"fieldname": "title",
|
||||
"fieldtype": "Data",
|
||||
"label": "Name",
|
||||
"unique": 1
|
||||
},
|
||||
{
|
||||
"depends_on": "private",
|
||||
"fieldname": "user",
|
||||
"fieldtype": "Link",
|
||||
"label": "User",
|
||||
"mandatory_depends_on": "private",
|
||||
"options": "User"
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"fieldname": "private",
|
||||
"fieldtype": "Check",
|
||||
"label": "Private"
|
||||
}
|
||||
],
|
||||
"grid_page_length": 50,
|
||||
"index_web_pages_for_search": 1,
|
||||
"links": [],
|
||||
"modified": "2025-07-14 12:36:10.831351",
|
||||
"modified_by": "Administrator",
|
||||
"module": "FCRM",
|
||||
"name": "CRM Dashboard",
|
||||
"naming_rule": "By fieldname",
|
||||
"owner": "Administrator",
|
||||
"permissions": [
|
||||
{
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "System Manager",
|
||||
"share": 1,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Sales Manager",
|
||||
"share": 1,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Sales User",
|
||||
"share": 1,
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"row_format": "Dynamic",
|
||||
"sort_field": "creation",
|
||||
"sort_order": "DESC",
|
||||
"states": [],
|
||||
"title_field": "title"
|
||||
}
|
||||
34
crm/fcrm/doctype/crm_dashboard/crm_dashboard.py
Normal file
34
crm/fcrm/doctype/crm_dashboard/crm_dashboard.py
Normal file
@ -0,0 +1,34 @@
|
||||
# Copyright (c) 2025, Frappe Technologies Pvt. Ltd. and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
import frappe
|
||||
from frappe import _
|
||||
from frappe.model.document import Document
|
||||
|
||||
|
||||
class CRMDashboard(Document):
|
||||
pass
|
||||
|
||||
|
||||
def default_manager_dashboard_layout():
|
||||
"""
|
||||
Returns the default layout for the CRM Manager Dashboard.
|
||||
"""
|
||||
return '[{"name":"total_leads","type":"number_chart","tooltip":"Total number of leads","layout":{"x":0,"y":0,"w":4,"h":3,"i":"total_leads"}},{"name":"ongoing_deals","type":"number_chart","tooltip":"Total number of ongoing deals","layout":{"x":8,"y":0,"w":4,"h":3,"i":"ongoing_deals"}},{"name":"won_deals","type":"number_chart","tooltip":"Total number of won deals","layout":{"x":12,"y":0,"w":4,"h":3,"i":"won_deals"}},{"name":"average_won_deal_value","type":"number_chart","tooltip":"Average value of won deals","layout":{"x":16,"y":0,"w":4,"h":3,"i":"average_won_deal_value"}},{"name":"average_deal_value","type":"number_chart","tooltip":"Average deal value of ongoing and won deals","layout":{"x":0,"y":2,"w":4,"h":3,"i":"average_deal_value"}},{"name":"average_time_to_close_a_lead","type":"number_chart","tooltip":"Average time taken to close a lead","layout":{"x":4,"y":0,"w":4,"h":3,"i":"average_time_to_close_a_lead"}},{"name":"average_time_to_close_a_deal","type":"number_chart","layout":{"x":4,"y":2,"w":4,"h":3,"i":"average_time_to_close_a_deal"}},{"name":"spacer","type":"spacer","layout":{"x":8,"y":2,"w":12,"h":3,"i":"spacer"}},{"name":"sales_trend","type":"axis_chart","layout":{"x":0,"y":4,"w":10,"h":9,"i":"sales_trend"}},{"name":"forecasted_revenue","type":"axis_chart","layout":{"x":10,"y":4,"w":10,"h":9,"i":"forecasted_revenue"}},{"name":"funnel_conversion","type":"axis_chart","layout":{"x":0,"y":11,"w":10,"h":9,"i":"funnel_conversion"}},{"name":"deals_by_stage_donut","type":"donut_chart","layout":{"x":10,"y":11,"w":10,"h":9,"i":"deals_by_stage_donut"}},{"name":"lost_deal_reasons","type":"axis_chart","layout":{"x":0,"y":32,"w":20,"h":9,"i":"lost_deal_reasons"}},{"name":"leads_by_source","type":"donut_chart","layout":{"x":0,"y":18,"w":10,"h":9,"i":"leads_by_source"}},{"name":"deals_by_source","type":"donut_chart","layout":{"x":10,"y":18,"w":10,"h":9,"i":"deals_by_source"}},{"name":"deals_by_territory","type":"axis_chart","layout":{"x":0,"y":25,"w":10,"h":9,"i":"deals_by_territory"}},{"name":"deals_by_salesperson","type":"axis_chart","layout":{"x":10,"y":25,"w":10,"h":9,"i":"deals_by_salesperson"}}]'
|
||||
|
||||
|
||||
def create_default_manager_dashboard(force=False):
|
||||
"""
|
||||
Creates the default CRM Manager Dashboard if it does not exist.
|
||||
"""
|
||||
if not frappe.db.exists("CRM Dashboard", "Manager Dashboard"):
|
||||
doc = frappe.new_doc("CRM Dashboard")
|
||||
doc.title = "Manager Dashboard"
|
||||
doc.layout = default_manager_dashboard_layout()
|
||||
doc.insert(ignore_permissions=True)
|
||||
else:
|
||||
doc = frappe.get_doc("CRM Dashboard", "Manager Dashboard")
|
||||
if force:
|
||||
doc.layout = default_manager_dashboard_layout()
|
||||
doc.save(ignore_permissions=True)
|
||||
return doc.layout
|
||||
30
crm/fcrm/doctype/crm_dashboard/test_crm_dashboard.py
Normal file
30
crm/fcrm/doctype/crm_dashboard/test_crm_dashboard.py
Normal file
@ -0,0 +1,30 @@
|
||||
# Copyright (c) 2025, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# See license.txt
|
||||
|
||||
# import frappe
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
|
||||
|
||||
# On IntegrationTestCase, the doctype test records and all
|
||||
# link-field test record dependencies are recursively loaded
|
||||
# Use these module variables to add/remove to/from that list
|
||||
EXTRA_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"]
|
||||
IGNORE_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"]
|
||||
|
||||
|
||||
class UnitTestCRMDashboard(UnitTestCase):
|
||||
"""
|
||||
Unit tests for CRMDashboard.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class IntegrationTestCRMDashboard(IntegrationTestCase):
|
||||
"""
|
||||
Integration tests for CRMDashboard.
|
||||
Use this class for testing interactions between multiple components.
|
||||
"""
|
||||
|
||||
pass
|
||||
@ -1,18 +1,5 @@
|
||||
import frappe
|
||||
|
||||
from crm.api.doc import get_assigned_users, get_fields_meta
|
||||
from crm.fcrm.doctype.crm_form_script.crm_form_script import get_form_script
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_deal(name):
|
||||
deal = frappe.get_doc("CRM Deal", name).as_dict()
|
||||
|
||||
deal["fields_meta"] = get_fields_meta("CRM Deal")
|
||||
deal["_form_script"] = get_form_script("CRM Deal")
|
||||
deal["_assign"] = get_assigned_users("CRM Deal", deal.name)
|
||||
return deal
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_deal_contacts(name):
|
||||
@ -20,30 +7,22 @@ def get_deal_contacts(name):
|
||||
"CRM Contacts",
|
||||
filters={"parenttype": "CRM Deal", "parent": name},
|
||||
fields=["contact", "is_primary"],
|
||||
distinct=True,
|
||||
)
|
||||
deal_contacts = []
|
||||
for contact in contacts:
|
||||
if not contact.contact:
|
||||
continue
|
||||
|
||||
is_primary = contact.is_primary
|
||||
contact = frappe.get_doc("Contact", contact.contact).as_dict()
|
||||
|
||||
def get_primary_email(contact):
|
||||
for email in contact.email_ids:
|
||||
if email.is_primary:
|
||||
return email.email_id
|
||||
return contact.email_ids[0].email_id if contact.email_ids else ""
|
||||
|
||||
def get_primary_mobile_no(contact):
|
||||
for phone in contact.phone_nos:
|
||||
if phone.is_primary:
|
||||
return phone.phone
|
||||
return contact.phone_nos[0].phone if contact.phone_nos else ""
|
||||
|
||||
_contact = {
|
||||
"name": contact.name,
|
||||
"image": contact.image,
|
||||
"full_name": contact.full_name,
|
||||
"email": get_primary_email(contact),
|
||||
"mobile_no": get_primary_mobile_no(contact),
|
||||
"email": contact.email_id,
|
||||
"mobile_no": contact.mobile_no,
|
||||
"is_primary": is_primary,
|
||||
}
|
||||
deal_contacts.append(_contact)
|
||||
|
||||
@ -5,4 +5,68 @@ frappe.ui.form.on("CRM Deal", {
|
||||
refresh(frm) {
|
||||
frm.add_web_link(`/crm/deals/${frm.doc.name}`, __("Open in Portal"));
|
||||
},
|
||||
update_total: function (frm) {
|
||||
let total = 0;
|
||||
let total_qty = 0;
|
||||
let net_total = 0;
|
||||
frm.doc.products.forEach((d) => {
|
||||
total += d.amount;
|
||||
total_qty += d.qty;
|
||||
net_total += d.net_amount;
|
||||
});
|
||||
|
||||
frappe.model.set_value(frm.doctype, frm.docname, "total", total);
|
||||
frappe.model.set_value(
|
||||
frm.doctype,
|
||||
frm.docname,
|
||||
"net_total",
|
||||
net_total || total
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
frappe.ui.form.on("CRM Products", {
|
||||
products_add: function (frm, cdt, cdn) {
|
||||
frm.trigger("update_total");
|
||||
},
|
||||
products_remove: function (frm, cdt, cdn) {
|
||||
frm.trigger("update_total");
|
||||
},
|
||||
product_code: function (frm, cdt, cdn) {
|
||||
let d = frappe.get_doc(cdt, cdn);
|
||||
frappe.model.set_value(cdt, cdn, "product_name", d.product_code);
|
||||
},
|
||||
rate: function (frm, cdt, cdn) {
|
||||
let d = frappe.get_doc(cdt, cdn);
|
||||
if (d.rate && d.qty) {
|
||||
frappe.model.set_value(cdt, cdn, "amount", d.rate * d.qty);
|
||||
}
|
||||
frm.trigger("update_total");
|
||||
},
|
||||
qty: function (frm, cdt, cdn) {
|
||||
let d = frappe.get_doc(cdt, cdn);
|
||||
if (d.rate && d.qty) {
|
||||
frappe.model.set_value(cdt, cdn, "amount", d.rate * d.qty);
|
||||
}
|
||||
frm.trigger("update_total");
|
||||
},
|
||||
discount_percentage: function (frm, cdt, cdn) {
|
||||
let d = frappe.get_doc(cdt, cdn);
|
||||
if (d.discount_percentage && d.amount) {
|
||||
discount_amount = (d.discount_percentage / 100) * d.amount;
|
||||
frappe.model.set_value(
|
||||
cdt,
|
||||
cdn,
|
||||
"discount_amount",
|
||||
discount_amount
|
||||
);
|
||||
frappe.model.set_value(
|
||||
cdt,
|
||||
cdn,
|
||||
"net_amount",
|
||||
d.amount - discount_amount
|
||||
);
|
||||
}
|
||||
frm.trigger("update_total");
|
||||
}
|
||||
});
|
||||
|
||||
@ -11,11 +11,18 @@
|
||||
"naming_series",
|
||||
"organization",
|
||||
"next_step",
|
||||
"probability",
|
||||
"column_break_ijan",
|
||||
"status",
|
||||
"close_date",
|
||||
"deal_owner",
|
||||
"lost_reason",
|
||||
"lost_notes",
|
||||
"section_break_jgpm",
|
||||
"probability",
|
||||
"expected_deal_value",
|
||||
"deal_value",
|
||||
"column_break_kpxa",
|
||||
"expected_closure_date",
|
||||
"closed_date",
|
||||
"contacts_tab",
|
||||
"contacts",
|
||||
"contact",
|
||||
@ -32,6 +39,7 @@
|
||||
"column_break_xbyf",
|
||||
"territory",
|
||||
"currency",
|
||||
"exchange_rate",
|
||||
"annual_revenue",
|
||||
"industry",
|
||||
"person_section",
|
||||
@ -43,6 +51,12 @@
|
||||
"mobile_no",
|
||||
"phone",
|
||||
"gender",
|
||||
"products_tab",
|
||||
"products",
|
||||
"section_break_ccbj",
|
||||
"total",
|
||||
"column_break_udbq",
|
||||
"net_total",
|
||||
"sla_tab",
|
||||
"sla",
|
||||
"sla_creation",
|
||||
@ -82,11 +96,6 @@
|
||||
"fieldtype": "Data",
|
||||
"label": "Website"
|
||||
},
|
||||
{
|
||||
"fieldname": "close_date",
|
||||
"fieldtype": "Date",
|
||||
"label": "Close Date"
|
||||
},
|
||||
{
|
||||
"fieldname": "next_step",
|
||||
"fieldtype": "Data",
|
||||
@ -119,13 +128,13 @@
|
||||
{
|
||||
"fieldname": "email",
|
||||
"fieldtype": "Data",
|
||||
"label": "Email",
|
||||
"label": "Primary Email",
|
||||
"options": "Email"
|
||||
},
|
||||
{
|
||||
"fieldname": "mobile_no",
|
||||
"fieldtype": "Data",
|
||||
"label": "Mobile No",
|
||||
"label": "Primary Mobile No",
|
||||
"options": "Phone"
|
||||
},
|
||||
{
|
||||
@ -239,7 +248,7 @@
|
||||
{
|
||||
"fieldname": "phone",
|
||||
"fieldtype": "Data",
|
||||
"label": "Phone",
|
||||
"label": "Primary Phone",
|
||||
"options": "Phone"
|
||||
},
|
||||
{
|
||||
@ -334,11 +343,96 @@
|
||||
"fieldtype": "Link",
|
||||
"label": "Currency",
|
||||
"options": "Currency"
|
||||
},
|
||||
{
|
||||
"fieldname": "products_tab",
|
||||
"fieldtype": "Tab Break",
|
||||
"label": "Products"
|
||||
},
|
||||
{
|
||||
"fieldname": "products",
|
||||
"fieldtype": "Table",
|
||||
"label": "Products",
|
||||
"options": "CRM Products"
|
||||
},
|
||||
{
|
||||
"fieldname": "section_break_ccbj",
|
||||
"fieldtype": "Section Break"
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_udbq",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"fieldname": "total",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Total",
|
||||
"options": "currency",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"description": "Total after discount",
|
||||
"fieldname": "net_total",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Net Total",
|
||||
"options": "currency",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "section_break_jgpm",
|
||||
"fieldtype": "Section Break"
|
||||
},
|
||||
{
|
||||
"fieldname": "deal_value",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Deal Value",
|
||||
"options": "currency"
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_kpxa",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"fieldname": "lost_reason",
|
||||
"fieldtype": "Link",
|
||||
"label": "Lost Reason",
|
||||
"mandatory_depends_on": "eval: doc.status == \"Lost\"",
|
||||
"options": "CRM Lost Reason"
|
||||
},
|
||||
{
|
||||
"fieldname": "lost_notes",
|
||||
"fieldtype": "Text",
|
||||
"label": "Lost Notes",
|
||||
"mandatory_depends_on": "eval: doc.lost_reason == \"Other\""
|
||||
},
|
||||
{
|
||||
"default": "1",
|
||||
"description": "The rate used to convert the deal\u2019s currency to your crm's base currency (set in CRM Settings). It is set once when the currency is first added and doesn't change automatically.",
|
||||
"fieldname": "exchange_rate",
|
||||
"fieldtype": "Float",
|
||||
"label": "Exchange Rate"
|
||||
},
|
||||
{
|
||||
"fieldname": "expected_deal_value",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Expected Deal Value",
|
||||
"options": "currency"
|
||||
},
|
||||
{
|
||||
"fieldname": "expected_closure_date",
|
||||
"fieldtype": "Date",
|
||||
"label": "Expected Closure Date"
|
||||
},
|
||||
{
|
||||
"fieldname": "closed_date",
|
||||
"fieldtype": "Date",
|
||||
"label": "Closed Date"
|
||||
}
|
||||
],
|
||||
"grid_page_length": 50,
|
||||
"index_web_pages_for_search": 1,
|
||||
"links": [],
|
||||
"modified": "2024-12-11 14:31:41.058895",
|
||||
"modified": "2025-08-26 12:12:56.324245",
|
||||
"modified_by": "Administrator",
|
||||
"module": "FCRM",
|
||||
"name": "CRM Deal",
|
||||
@ -370,10 +464,11 @@
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"row_format": "Dynamic",
|
||||
"show_title_field_in_link": 1,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"states": [],
|
||||
"title_field": "organization",
|
||||
"track_changes": 1
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,9 +7,8 @@ from frappe.desk.form.assign_to import add as assign
|
||||
from frappe.model.document import Document
|
||||
|
||||
from crm.fcrm.doctype.crm_service_level_agreement.utils import get_sla
|
||||
from crm.fcrm.doctype.crm_status_change_log.crm_status_change_log import (
|
||||
add_status_change_log,
|
||||
)
|
||||
from crm.fcrm.doctype.crm_status_change_log.crm_status_change_log import add_status_change_log
|
||||
from crm.fcrm.doctype.fcrm_settings.fcrm_settings import get_exchange_rate
|
||||
|
||||
|
||||
class CRMDeal(Document):
|
||||
@ -24,6 +23,11 @@ class CRMDeal(Document):
|
||||
self.assign_agent(self.deal_owner)
|
||||
if self.has_value_changed("status"):
|
||||
add_status_change_log(self)
|
||||
if frappe.db.get_value("CRM Deal Status", self.status, "type") == "Won":
|
||||
self.closed_date = frappe.utils.nowdate()
|
||||
self.validate_forecasting_fields()
|
||||
self.validate_lost_reason()
|
||||
self.update_exchange_rate()
|
||||
|
||||
def after_insert(self):
|
||||
if self.deal_owner:
|
||||
@ -133,6 +137,60 @@ class CRMDeal(Document):
|
||||
if sla:
|
||||
sla.apply(self)
|
||||
|
||||
def update_closed_date(self):
|
||||
"""
|
||||
Update the closed date based on the "Won" status.
|
||||
"""
|
||||
if self.status == "Won" and not self.closed_date:
|
||||
self.closed_date = frappe.utils.nowdate()
|
||||
|
||||
def update_default_probability(self):
|
||||
"""
|
||||
Update the default probability based on the status.
|
||||
"""
|
||||
if not self.probability or self.probability == 0:
|
||||
self.probability = frappe.db.get_value("CRM Deal Status", self.status, "probability") or 0
|
||||
|
||||
def update_expected_deal_value(self):
|
||||
"""
|
||||
Update the expected deal value based on the net total or total.
|
||||
"""
|
||||
if (
|
||||
frappe.db.get_single_value("FCRM Settings", "auto_update_expected_deal_value")
|
||||
and (self.net_total or self.total)
|
||||
and self.expected_deal_value
|
||||
):
|
||||
self.expected_deal_value = self.net_total or self.total
|
||||
|
||||
def validate_forecasting_fields(self):
|
||||
self.update_closed_date()
|
||||
self.update_default_probability()
|
||||
self.update_expected_deal_value()
|
||||
if frappe.db.get_single_value("FCRM Settings", "enable_forecasting"):
|
||||
if not self.expected_deal_value or self.expected_deal_value == 0:
|
||||
frappe.throw(_("Expected Deal Value is required."), frappe.MandatoryError)
|
||||
if not self.expected_closure_date:
|
||||
frappe.throw(_("Expected Closure Date is required."), frappe.MandatoryError)
|
||||
|
||||
def validate_lost_reason(self):
|
||||
"""
|
||||
Validate the lost reason if the status is set to "Lost".
|
||||
"""
|
||||
if self.status and frappe.get_cached_value("CRM Deal Status", self.status, "type") == "Lost":
|
||||
if not self.lost_reason:
|
||||
frappe.throw(_("Please specify a reason for losing the deal."), frappe.ValidationError)
|
||||
elif self.lost_reason == "Other" and not self.lost_notes:
|
||||
frappe.throw(_("Please specify the reason for losing the deal."), frappe.ValidationError)
|
||||
|
||||
def update_exchange_rate(self):
|
||||
if self.has_value_changed("currency") or not self.exchange_rate:
|
||||
system_currency = frappe.db.get_single_value("FCRM Settings", "currency") or "USD"
|
||||
exchange_rate = 1
|
||||
if self.currency and self.currency != system_currency:
|
||||
exchange_rate = get_exchange_rate(self.currency, system_currency)
|
||||
|
||||
self.db_set("exchange_rate", exchange_rate)
|
||||
|
||||
@staticmethod
|
||||
def default_list_data():
|
||||
columns = [
|
||||
|
||||
@ -7,8 +7,11 @@
|
||||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
"deal_status",
|
||||
"color",
|
||||
"position"
|
||||
"type",
|
||||
"position",
|
||||
"column_break_ojiu",
|
||||
"probability",
|
||||
"color"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
@ -32,11 +35,30 @@
|
||||
"fieldtype": "Int",
|
||||
"in_list_view": 1,
|
||||
"label": "Position"
|
||||
},
|
||||
{
|
||||
"fieldname": "probability",
|
||||
"fieldtype": "Percent",
|
||||
"in_list_view": 1,
|
||||
"label": "Probability"
|
||||
},
|
||||
{
|
||||
"default": "Open",
|
||||
"fieldname": "type",
|
||||
"fieldtype": "Select",
|
||||
"in_list_view": 1,
|
||||
"label": "Type",
|
||||
"options": "Open\nOngoing\nOn Hold\nWon\nLost"
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_ojiu",
|
||||
"fieldtype": "Column Break"
|
||||
}
|
||||
],
|
||||
"grid_page_length": 50,
|
||||
"index_web_pages_for_search": 1,
|
||||
"links": [],
|
||||
"modified": "2024-01-19 21:56:44.552134",
|
||||
"modified": "2025-07-11 16:03:28.077955",
|
||||
"modified_by": "Administrator",
|
||||
"module": "FCRM",
|
||||
"name": "CRM Deal Status",
|
||||
@ -68,7 +90,8 @@
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"row_format": "Dynamic",
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"states": []
|
||||
}
|
||||
}
|
||||
|
||||
@ -27,7 +27,7 @@
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 1,
|
||||
"label": "Type",
|
||||
"options": "Quick Entry\nSide Panel\nData Fields\nGrid Row"
|
||||
"options": "Quick Entry\nSide Panel\nData Fields\nGrid Row\nRequired Fields"
|
||||
},
|
||||
{
|
||||
"fieldname": "section_break_ttpm",
|
||||
@ -46,7 +46,7 @@
|
||||
],
|
||||
"index_web_pages_for_search": 1,
|
||||
"links": [],
|
||||
"modified": "2025-01-02 22:12:51.663011",
|
||||
"modified": "2025-02-21 13:09:49.573515",
|
||||
"modified_by": "Administrator",
|
||||
"module": "FCRM",
|
||||
"name": "CRM Fields Layout",
|
||||
|
||||
@ -24,10 +24,12 @@ def get_fields_layout(doctype: str, type: str, parent_doctype: str | None = None
|
||||
if layout and layout.layout:
|
||||
tabs = json.loads(layout.layout)
|
||||
|
||||
if not tabs:
|
||||
if not tabs and type != "Required Fields":
|
||||
tabs = get_default_layout(doctype)
|
||||
|
||||
has_tabs = tabs[0].get("sections") if tabs and tabs[0] else False
|
||||
has_tabs = False
|
||||
if isinstance(tabs, list) and len(tabs) > 0 and isinstance(tabs[0], dict):
|
||||
has_tabs = any("sections" in tab for tab in tabs)
|
||||
|
||||
if not has_tabs:
|
||||
tabs = [{"name": "first_tab", "sections": tabs}]
|
||||
@ -45,9 +47,19 @@ def get_fields_layout(doctype: str, type: str, parent_doctype: str | None = None
|
||||
fields = frappe.get_meta(doctype).fields
|
||||
fields = [field for field in fields if field.fieldname in allowed_fields]
|
||||
|
||||
required_fields = []
|
||||
|
||||
if type == "Required Fields":
|
||||
required_fields = [
|
||||
field for field in frappe.get_meta(doctype, False).fields if field.reqd and not field.default
|
||||
]
|
||||
|
||||
for tab in tabs:
|
||||
for section in tab.get("sections"):
|
||||
if section.get("columns"):
|
||||
section["columns"] = [column for column in section.get("columns") if column]
|
||||
for column in section.get("columns") if section.get("columns") else []:
|
||||
column["fields"] = [field for field in column.get("fields") if field]
|
||||
for field in column.get("fields") if column.get("fields") else []:
|
||||
field = next((f for f in fields if f.fieldname == field), None)
|
||||
if field:
|
||||
@ -55,6 +67,32 @@ def get_fields_layout(doctype: str, type: str, parent_doctype: str | None = None
|
||||
handle_perm_level_restrictions(field, doctype, parent_doctype)
|
||||
column["fields"][column.get("fields").index(field["fieldname"])] = field
|
||||
|
||||
# remove field from required_fields if it is already present
|
||||
if (
|
||||
type == "Required Fields"
|
||||
and field.reqd
|
||||
and any(f.get("fieldname") == field.get("fieldname") for f in required_fields)
|
||||
):
|
||||
required_fields = [
|
||||
f for f in required_fields if f.get("fieldname") != field.get("fieldname")
|
||||
]
|
||||
|
||||
if type == "Required Fields" and required_fields and tabs:
|
||||
tabs[-1].get("sections").append(
|
||||
{
|
||||
"label": "Required Fields",
|
||||
"name": "required_fields_section_" + str(random_string(4)),
|
||||
"opened": True,
|
||||
"hideLabel": True,
|
||||
"columns": [
|
||||
{
|
||||
"name": "required_fields_column_" + str(random_string(4)),
|
||||
"fields": [field.as_dict() for field in required_fields],
|
||||
}
|
||||
],
|
||||
}
|
||||
)
|
||||
|
||||
return tabs or []
|
||||
|
||||
|
||||
@ -78,6 +116,8 @@ def get_sidepanel_sections(doctype):
|
||||
fields = frappe.get_meta(doctype).fields
|
||||
fields = [field for field in fields if field.fieldtype not in not_allowed_fieldtypes]
|
||||
|
||||
add_forecasting_section(layout, doctype)
|
||||
|
||||
for section in layout:
|
||||
section["name"] = section.get("name") or section.get("label")
|
||||
for column in section.get("columns") if section.get("columns") else []:
|
||||
@ -95,6 +135,38 @@ def get_sidepanel_sections(doctype):
|
||||
return layout
|
||||
|
||||
|
||||
def add_forecasting_section(layout, doctype):
|
||||
if (
|
||||
doctype == "CRM Deal"
|
||||
and frappe.db.get_single_value("FCRM Settings", "enable_forecasting")
|
||||
and not any(section.get("name") == "forecasted_sales_section" for section in layout)
|
||||
):
|
||||
contacts_section_index = next(
|
||||
(
|
||||
i
|
||||
for i, section in enumerate(layout)
|
||||
if section.get("name") == "contacts_section" or section.get("label") == "Contacts"
|
||||
),
|
||||
None,
|
||||
)
|
||||
|
||||
if contacts_section_index is not None:
|
||||
layout.insert(
|
||||
contacts_section_index + 1,
|
||||
{
|
||||
"name": "forecasted_sales_section",
|
||||
"label": "Forecasted Sales",
|
||||
"opened": True,
|
||||
"columns": [
|
||||
{
|
||||
"name": "column_" + str(random_string(4)),
|
||||
"fields": ["expected_closure_date", "probability", "expected_deal_value"],
|
||||
}
|
||||
],
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
def handle_perm_level_restrictions(field, doctype, parent_doctype=None):
|
||||
if field.permlevel == 0:
|
||||
return
|
||||
|
||||
@ -65,7 +65,7 @@
|
||||
],
|
||||
"index_web_pages_for_search": 1,
|
||||
"links": [],
|
||||
"modified": "2024-09-16 19:40:19.340948",
|
||||
"modified": "2025-05-19 17:57:24.610295",
|
||||
"modified_by": "Administrator",
|
||||
"module": "FCRM",
|
||||
"name": "CRM Form Script",
|
||||
@ -83,9 +83,19 @@
|
||||
"role": "Sales Manager",
|
||||
"share": 1,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "All",
|
||||
"share": 1
|
||||
}
|
||||
],
|
||||
"row_format": "Dynamic",
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"states": []
|
||||
}
|
||||
}
|
||||
|
||||
0
crm/fcrm/doctype/crm_global_settings/__init__.py
Normal file
0
crm/fcrm/doctype/crm_global_settings/__init__.py
Normal file
@ -0,0 +1,8 @@
|
||||
// Copyright (c) 2025, Frappe Technologies Pvt. Ltd. and contributors
|
||||
// For license information, please see license.txt
|
||||
|
||||
// frappe.ui.form.on("CRM Global Settings", {
|
||||
// refresh(frm) {
|
||||
|
||||
// },
|
||||
// });
|
||||
@ -0,0 +1,98 @@
|
||||
{
|
||||
"actions": [],
|
||||
"allow_rename": 1,
|
||||
"autoname": "format:{type}-{dt}",
|
||||
"creation": "2025-02-28 14:37:10.002433",
|
||||
"doctype": "DocType",
|
||||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
"dt",
|
||||
"column_break_kipp",
|
||||
"type",
|
||||
"section_break_vass",
|
||||
"json"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
"default": "DocType",
|
||||
"fieldname": "dt",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 1,
|
||||
"label": "DocType",
|
||||
"options": "DocType",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_kipp",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"fieldname": "type",
|
||||
"fieldtype": "Select",
|
||||
"in_list_view": 1,
|
||||
"label": "Type",
|
||||
"options": "Quick Filters\nSidebar Items",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "section_break_vass",
|
||||
"fieldtype": "Section Break"
|
||||
},
|
||||
{
|
||||
"fieldname": "json",
|
||||
"fieldtype": "JSON",
|
||||
"label": "JSON"
|
||||
}
|
||||
],
|
||||
"grid_page_length": 50,
|
||||
"index_web_pages_for_search": 1,
|
||||
"links": [],
|
||||
"modified": "2025-03-02 14:03:49.372132",
|
||||
"modified_by": "Administrator",
|
||||
"module": "FCRM",
|
||||
"name": "CRM Global Settings",
|
||||
"naming_rule": "Expression",
|
||||
"owner": "Administrator",
|
||||
"permissions": [
|
||||
{
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "System Manager",
|
||||
"share": 1,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Sales User",
|
||||
"share": 1,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Sales Manager",
|
||||
"share": 1,
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"row_format": "Dynamic",
|
||||
"sort_field": "creation",
|
||||
"sort_order": "DESC",
|
||||
"states": []
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
# Copyright (c) 2025, Frappe Technologies Pvt. Ltd. and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
# import frappe
|
||||
from frappe.model.document import Document
|
||||
|
||||
|
||||
class CRMGlobalSettings(Document):
|
||||
pass
|
||||
@ -0,0 +1,30 @@
|
||||
# Copyright (c) 2025, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# See license.txt
|
||||
|
||||
# import frappe
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
|
||||
|
||||
# On IntegrationTestCase, the doctype test records and all
|
||||
# link-field test record dependencies are recursively loaded
|
||||
# Use these module variables to add/remove to/from that list
|
||||
EXTRA_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"]
|
||||
IGNORE_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"]
|
||||
|
||||
|
||||
class UnitTestCRMGlobalSettings(UnitTestCase):
|
||||
"""
|
||||
Unit tests for CRMGlobalSettings.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class IntegrationTestCRMGlobalSettings(IntegrationTestCase):
|
||||
"""
|
||||
Integration tests for CRMGlobalSettings.
|
||||
Use this class for testing interactions between multiple components.
|
||||
"""
|
||||
|
||||
pass
|
||||
@ -27,7 +27,7 @@
|
||||
"fieldtype": "Select",
|
||||
"in_list_view": 1,
|
||||
"label": "Role",
|
||||
"options": "\nSales User\nSales Manager",
|
||||
"options": "\nSales User\nSales Manager\nSystem Manager",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
@ -66,7 +66,7 @@
|
||||
],
|
||||
"index_web_pages_for_search": 1,
|
||||
"links": [],
|
||||
"modified": "2024-09-03 14:59:29.450018",
|
||||
"modified": "2025-06-17 17:20:18.935395",
|
||||
"modified_by": "Administrator",
|
||||
"module": "FCRM",
|
||||
"name": "CRM Invitation",
|
||||
@ -106,7 +106,8 @@
|
||||
"share": 1
|
||||
}
|
||||
],
|
||||
"row_format": "Dynamic",
|
||||
"sort_field": "creation",
|
||||
"sort_order": "DESC",
|
||||
"states": []
|
||||
}
|
||||
}
|
||||
|
||||
@ -21,7 +21,7 @@ class CRMInvitation(Document):
|
||||
if frappe.local.dev_server:
|
||||
print(f"Invite link for {self.email}: {invite_link}")
|
||||
|
||||
title = f"Frappe CRM"
|
||||
title = "Frappe CRM"
|
||||
template = "crm_invitation"
|
||||
|
||||
frappe.sendmail(
|
||||
@ -35,7 +35,7 @@ class CRMInvitation(Document):
|
||||
|
||||
@frappe.whitelist()
|
||||
def accept_invitation(self):
|
||||
frappe.only_for("System Manager")
|
||||
frappe.only_for(["System Manager", "Sales Manager"])
|
||||
self.accept()
|
||||
|
||||
def accept(self):
|
||||
@ -44,12 +44,28 @@ class CRMInvitation(Document):
|
||||
|
||||
user = self.create_user_if_not_exists()
|
||||
user.append_roles(self.role)
|
||||
if self.role == "System Manager":
|
||||
user.append_roles("Sales Manager", "Sales User")
|
||||
elif self.role == "Sales Manager":
|
||||
user.append_roles("Sales User")
|
||||
if self.role == "Sales User":
|
||||
self.update_module_in_user(user, "FCRM")
|
||||
user.save(ignore_permissions=True)
|
||||
|
||||
self.status = "Accepted"
|
||||
self.accepted_at = frappe.utils.now()
|
||||
self.save(ignore_permissions=True)
|
||||
|
||||
def update_module_in_user(self, user, module):
|
||||
block_modules = frappe.get_all(
|
||||
"Module Def",
|
||||
fields=["name as module"],
|
||||
filters={"name": ["!=", module]},
|
||||
)
|
||||
|
||||
if block_modules:
|
||||
user.set("block_modules", block_modules)
|
||||
|
||||
def create_user_if_not_exists(self):
|
||||
if not frappe.db.exists("User", self.email):
|
||||
first_name = self.email.split("@")[0].title()
|
||||
|
||||
@ -1,14 +0,0 @@
|
||||
import frappe
|
||||
|
||||
from crm.api.doc import get_assigned_users, get_fields_meta
|
||||
from crm.fcrm.doctype.crm_form_script.crm_form_script import get_form_script
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_lead(name):
|
||||
lead = frappe.get_doc("CRM Lead", name).as_dict()
|
||||
|
||||
lead["fields_meta"] = get_fields_meta("CRM Lead")
|
||||
lead["_form_script"] = get_form_script("CRM Lead")
|
||||
lead["_assign"] = get_assigned_users("CRM Lead", lead.name)
|
||||
return lead
|
||||
@ -5,4 +5,68 @@ frappe.ui.form.on("CRM Lead", {
|
||||
refresh(frm) {
|
||||
frm.add_web_link(`/crm/leads/${frm.doc.name}`, __("Open in Portal"));
|
||||
},
|
||||
update_total: function (frm) {
|
||||
let total = 0;
|
||||
let total_qty = 0;
|
||||
let net_total = 0;
|
||||
frm.doc.products.forEach((d) => {
|
||||
total += d.amount;
|
||||
total_qty += d.qty;
|
||||
net_total += d.net_amount;
|
||||
});
|
||||
|
||||
frappe.model.set_value(frm.doctype, frm.docname, "total", total);
|
||||
frappe.model.set_value(
|
||||
frm.doctype,
|
||||
frm.docname,
|
||||
"net_total",
|
||||
net_total || total
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
frappe.ui.form.on("CRM Products", {
|
||||
products_add: function (frm, cdt, cdn) {
|
||||
frm.trigger("update_total");
|
||||
},
|
||||
products_remove: function (frm, cdt, cdn) {
|
||||
frm.trigger("update_total");
|
||||
},
|
||||
product_code: function (frm, cdt, cdn) {
|
||||
let d = frappe.get_doc(cdt, cdn);
|
||||
frappe.model.set_value(cdt, cdn, "product_name", d.product_code);
|
||||
},
|
||||
rate: function (frm, cdt, cdn) {
|
||||
let d = frappe.get_doc(cdt, cdn);
|
||||
if (d.rate && d.qty) {
|
||||
frappe.model.set_value(cdt, cdn, "amount", d.rate * d.qty);
|
||||
}
|
||||
frm.trigger("update_total");
|
||||
},
|
||||
qty: function (frm, cdt, cdn) {
|
||||
let d = frappe.get_doc(cdt, cdn);
|
||||
if (d.rate && d.qty) {
|
||||
frappe.model.set_value(cdt, cdn, "amount", d.rate * d.qty);
|
||||
}
|
||||
frm.trigger("update_total");
|
||||
},
|
||||
discount_percentage: function (frm, cdt, cdn) {
|
||||
let d = frappe.get_doc(cdt, cdn);
|
||||
if (d.discount_percentage && d.amount) {
|
||||
discount_amount = (d.discount_percentage / 100) * d.amount;
|
||||
frappe.model.set_value(
|
||||
cdt,
|
||||
cdn,
|
||||
"discount_amount",
|
||||
discount_amount
|
||||
);
|
||||
frappe.model.set_value(
|
||||
cdt,
|
||||
cdn,
|
||||
"net_amount",
|
||||
d.amount - discount_amount
|
||||
);
|
||||
}
|
||||
frm.trigger("update_total");
|
||||
}
|
||||
});
|
||||
@ -37,6 +37,12 @@
|
||||
"annual_revenue",
|
||||
"image",
|
||||
"converted",
|
||||
"products_tab",
|
||||
"products",
|
||||
"section_break_ggwh",
|
||||
"total",
|
||||
"column_break_uisv",
|
||||
"net_total",
|
||||
"sla_tab",
|
||||
"sla",
|
||||
"sla_creation",
|
||||
@ -285,12 +291,47 @@
|
||||
"fieldtype": "Table",
|
||||
"label": "Status Change Log",
|
||||
"options": "CRM Status Change Log"
|
||||
},
|
||||
{
|
||||
"fieldname": "products_tab",
|
||||
"fieldtype": "Tab Break",
|
||||
"label": "Products"
|
||||
},
|
||||
{
|
||||
"fieldname": "products",
|
||||
"fieldtype": "Table",
|
||||
"label": "Products",
|
||||
"options": "CRM Products"
|
||||
},
|
||||
{
|
||||
"fieldname": "section_break_ggwh",
|
||||
"fieldtype": "Section Break"
|
||||
},
|
||||
{
|
||||
"fieldname": "total",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Total",
|
||||
"options": "currency",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_uisv",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"description": "Total after discount",
|
||||
"fieldname": "net_total",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Net Total",
|
||||
"options": "currency",
|
||||
"read_only": 1
|
||||
}
|
||||
],
|
||||
"grid_page_length": 50,
|
||||
"image_field": "image",
|
||||
"index_web_pages_for_search": 1,
|
||||
"links": [],
|
||||
"modified": "2025-01-02 22:14:01.991054",
|
||||
"modified": "2025-05-14 19:51:06.184569",
|
||||
"modified_by": "Administrator",
|
||||
"module": "FCRM",
|
||||
"name": "CRM Lead",
|
||||
@ -331,6 +372,7 @@
|
||||
"share": 1
|
||||
}
|
||||
],
|
||||
"row_format": "Dynamic",
|
||||
"sender_field": "email",
|
||||
"sender_name_field": "first_name",
|
||||
"show_title_field_in_link": 1,
|
||||
@ -339,4 +381,4 @@
|
||||
"states": [],
|
||||
"title_field": "lead_name",
|
||||
"track_changes": 1
|
||||
}
|
||||
}
|
||||
|
||||
@ -115,13 +115,14 @@ class CRMLead(Document):
|
||||
elif user != agent:
|
||||
frappe.share.remove(self.doctype, self.name, user)
|
||||
|
||||
def create_contact(self, throw=True):
|
||||
def create_contact(self, existing_contact=None, throw=True):
|
||||
if not self.lead_name:
|
||||
self.set_full_name()
|
||||
self.set_lead_name()
|
||||
|
||||
existing_contact = self.contact_exists(throw)
|
||||
existing_contact = existing_contact or self.contact_exists(throw)
|
||||
if existing_contact:
|
||||
self.update_lead_contact(existing_contact)
|
||||
return existing_contact
|
||||
|
||||
contact = frappe.new_doc("Contact")
|
||||
@ -151,12 +152,15 @@ class CRMLead(Document):
|
||||
|
||||
return contact.name
|
||||
|
||||
def create_organization(self):
|
||||
if not self.organization:
|
||||
def create_organization(self, existing_organization=None):
|
||||
if not self.organization and not existing_organization:
|
||||
return
|
||||
|
||||
existing_organization = frappe.db.exists("CRM Organization", {"organization_name": self.organization})
|
||||
existing_organization = existing_organization or frappe.db.exists(
|
||||
"CRM Organization", {"organization_name": self.organization}
|
||||
)
|
||||
if existing_organization:
|
||||
self.db_set("organization", existing_organization)
|
||||
return existing_organization
|
||||
|
||||
organization = frappe.new_doc("CRM Organization")
|
||||
@ -172,6 +176,20 @@ class CRMLead(Document):
|
||||
organization.insert(ignore_permissions=True)
|
||||
return organization.name
|
||||
|
||||
def update_lead_contact(self, contact):
|
||||
contact = frappe.get_cached_doc("Contact", contact)
|
||||
frappe.db.set_value(
|
||||
"CRM Lead",
|
||||
self.name,
|
||||
{
|
||||
"salutation": contact.salutation,
|
||||
"first_name": contact.first_name,
|
||||
"last_name": contact.last_name,
|
||||
"email": contact.email_id,
|
||||
"mobile_no": contact.mobile_no,
|
||||
},
|
||||
)
|
||||
|
||||
def contact_exists(self, throw=True):
|
||||
email_exist = frappe.db.exists("Contact Email", {"email_id": self.email})
|
||||
phone_exist = frappe.db.exists("Contact Phone", {"phone": self.phone})
|
||||
@ -197,8 +215,8 @@ class CRMLead(Document):
|
||||
|
||||
return False
|
||||
|
||||
def create_deal(self, contact, organization):
|
||||
deal = frappe.new_doc("CRM Deal")
|
||||
def create_deal(self, contact, organization, deal=None):
|
||||
new_deal = frappe.new_doc("CRM Deal")
|
||||
|
||||
lead_deal_map = {
|
||||
"lead_owner": "deal_owner",
|
||||
@ -211,7 +229,6 @@ class CRMLead(Document):
|
||||
"HTML",
|
||||
"Button",
|
||||
"Attach",
|
||||
"Table",
|
||||
]
|
||||
restricted_map_fields = [
|
||||
"name",
|
||||
@ -233,6 +250,7 @@ class CRMLead(Document):
|
||||
"first_responded_on",
|
||||
"communication_status",
|
||||
"sla_creation",
|
||||
"status_change_log",
|
||||
]
|
||||
|
||||
for field in self.meta.fields:
|
||||
@ -245,13 +263,13 @@ class CRMLead(Document):
|
||||
if field.fieldname in lead_deal_map:
|
||||
fieldname = lead_deal_map[field.fieldname]
|
||||
|
||||
if hasattr(deal, fieldname):
|
||||
if hasattr(new_deal, fieldname):
|
||||
if fieldname == "organization":
|
||||
deal.update({fieldname: organization})
|
||||
new_deal.update({fieldname: organization})
|
||||
else:
|
||||
deal.update({fieldname: self.get(field.fieldname)})
|
||||
new_deal.update({fieldname: self.get(field.fieldname)})
|
||||
|
||||
deal.update(
|
||||
new_deal.update(
|
||||
{
|
||||
"lead": self.name,
|
||||
"contacts": [{"contact": contact}],
|
||||
@ -259,7 +277,7 @@ class CRMLead(Document):
|
||||
)
|
||||
|
||||
if self.first_responded_on:
|
||||
deal.update(
|
||||
new_deal.update(
|
||||
{
|
||||
"sla_creation": self.sla_creation,
|
||||
"response_by": self.response_by,
|
||||
@ -270,8 +288,11 @@ class CRMLead(Document):
|
||||
}
|
||||
)
|
||||
|
||||
deal.insert(ignore_permissions=True)
|
||||
return deal.name
|
||||
if deal:
|
||||
new_deal.update(deal)
|
||||
|
||||
new_deal.insert(ignore_permissions=True)
|
||||
return new_deal.name
|
||||
|
||||
def set_sla(self):
|
||||
"""
|
||||
@ -297,8 +318,8 @@ class CRMLead(Document):
|
||||
if sla:
|
||||
sla.apply(self)
|
||||
|
||||
def convert_to_deal(self):
|
||||
return convert_to_deal(lead=self.name, doc=self)
|
||||
def convert_to_deal(self, deal=None):
|
||||
return convert_to_deal(lead=self.name, doc=self, deal=deal)
|
||||
|
||||
@staticmethod
|
||||
def get_non_filterable_fields():
|
||||
@ -380,7 +401,7 @@ class CRMLead(Document):
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def convert_to_deal(lead, doc=None):
|
||||
def convert_to_deal(lead, doc=None, deal=None, existing_contact=None, existing_organization=None):
|
||||
if not (doc and doc.flags.get("ignore_permissions")) and not frappe.has_permission(
|
||||
"CRM Lead", "write", lead
|
||||
):
|
||||
@ -392,7 +413,7 @@ def convert_to_deal(lead, doc=None):
|
||||
lead.db_set("converted", 1)
|
||||
if lead.sla and frappe.db.exists("CRM Communication Status", "Replied"):
|
||||
lead.db_set("communication_status", "Replied")
|
||||
contact = lead.create_contact(False)
|
||||
organization = lead.create_organization()
|
||||
deal = lead.create_deal(contact, organization)
|
||||
return deal
|
||||
contact = lead.create_contact(existing_contact, False)
|
||||
organization = lead.create_organization(existing_organization)
|
||||
_deal = lead.create_deal(contact, organization, deal)
|
||||
return _deal
|
||||
|
||||
@ -27,9 +27,10 @@
|
||||
"label": "Details"
|
||||
}
|
||||
],
|
||||
"grid_page_length": 50,
|
||||
"index_web_pages_for_search": 1,
|
||||
"links": [],
|
||||
"modified": "2025-01-02 22:13:30.498404",
|
||||
"modified": "2025-06-30 16:53:51.721752",
|
||||
"modified_by": "Administrator",
|
||||
"module": "FCRM",
|
||||
"name": "CRM Lead Source",
|
||||
@ -44,7 +45,7 @@
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Sales User",
|
||||
"role": "System Manager",
|
||||
"share": 1,
|
||||
"write": 1
|
||||
},
|
||||
@ -60,6 +61,15 @@
|
||||
"share": 1,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Sales User",
|
||||
"share": 1
|
||||
},
|
||||
{
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
@ -71,7 +81,8 @@
|
||||
}
|
||||
],
|
||||
"quick_entry": 1,
|
||||
"row_format": "Dynamic",
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"states": []
|
||||
}
|
||||
}
|
||||
|
||||
0
crm/fcrm/doctype/crm_lost_reason/__init__.py
Normal file
0
crm/fcrm/doctype/crm_lost_reason/__init__.py
Normal file
8
crm/fcrm/doctype/crm_lost_reason/crm_lost_reason.js
Normal file
8
crm/fcrm/doctype/crm_lost_reason/crm_lost_reason.js
Normal file
@ -0,0 +1,8 @@
|
||||
// Copyright (c) 2025, Frappe Technologies Pvt. Ltd. and contributors
|
||||
// For license information, please see license.txt
|
||||
|
||||
// frappe.ui.form.on("CRM Lost Reason", {
|
||||
// refresh(frm) {
|
||||
|
||||
// },
|
||||
// });
|
||||
79
crm/fcrm/doctype/crm_lost_reason/crm_lost_reason.json
Normal file
79
crm/fcrm/doctype/crm_lost_reason/crm_lost_reason.json
Normal file
@ -0,0 +1,79 @@
|
||||
{
|
||||
"actions": [],
|
||||
"allow_rename": 1,
|
||||
"autoname": "field:lost_reason",
|
||||
"creation": "2025-06-30 16:51:31.082360",
|
||||
"doctype": "DocType",
|
||||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
"lost_reason",
|
||||
"description"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
"fieldname": "lost_reason",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
"label": "Lost Reason",
|
||||
"reqd": 1,
|
||||
"unique": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "description",
|
||||
"fieldtype": "Text Editor",
|
||||
"label": "Description"
|
||||
}
|
||||
],
|
||||
"grid_page_length": 50,
|
||||
"index_web_pages_for_search": 1,
|
||||
"links": [],
|
||||
"modified": "2025-06-30 16:59:15.094049",
|
||||
"modified_by": "Administrator",
|
||||
"module": "FCRM",
|
||||
"name": "CRM Lost Reason",
|
||||
"naming_rule": "By fieldname",
|
||||
"owner": "Administrator",
|
||||
"permissions": [
|
||||
{
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "System Manager",
|
||||
"share": 1,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Sales Manager",
|
||||
"share": 1,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Sales User",
|
||||
"share": 1,
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"quick_entry": 1,
|
||||
"row_format": "Dynamic",
|
||||
"sort_field": "creation",
|
||||
"sort_order": "DESC",
|
||||
"states": []
|
||||
}
|
||||
9
crm/fcrm/doctype/crm_lost_reason/crm_lost_reason.py
Normal file
9
crm/fcrm/doctype/crm_lost_reason/crm_lost_reason.py
Normal file
@ -0,0 +1,9 @@
|
||||
# Copyright (c) 2025, Frappe Technologies Pvt. Ltd. and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
# import frappe
|
||||
from frappe.model.document import Document
|
||||
|
||||
|
||||
class CRMLostReason(Document):
|
||||
pass
|
||||
30
crm/fcrm/doctype/crm_lost_reason/test_crm_lost_reason.py
Normal file
30
crm/fcrm/doctype/crm_lost_reason/test_crm_lost_reason.py
Normal file
@ -0,0 +1,30 @@
|
||||
# Copyright (c) 2025, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# See license.txt
|
||||
|
||||
# import frappe
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
|
||||
|
||||
# On IntegrationTestCase, the doctype test records and all
|
||||
# link-field test record dependencies are recursively loaded
|
||||
# Use these module variables to add/remove to/from that list
|
||||
EXTRA_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"]
|
||||
IGNORE_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"]
|
||||
|
||||
|
||||
class UnitTestCRMLostReason(UnitTestCase):
|
||||
"""
|
||||
Unit tests for CRMLostReason.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class IntegrationTestCRMLostReason(IntegrationTestCase):
|
||||
"""
|
||||
Integration tests for CRMLostReason.
|
||||
Use this class for testing interactions between multiple components.
|
||||
"""
|
||||
|
||||
pass
|
||||
@ -8,7 +8,8 @@ from frappe.model.document import Document
|
||||
|
||||
class CRMNotification(Document):
|
||||
def on_update(self):
|
||||
frappe.publish_realtime("crm_notification")
|
||||
if self.to_user:
|
||||
frappe.publish_realtime("crm_notification", user= self.to_user)
|
||||
|
||||
def notify_user(args):
|
||||
"""
|
||||
@ -33,4 +34,4 @@ def notify_user(args):
|
||||
|
||||
if frappe.db.exists("CRM Notification", values):
|
||||
return
|
||||
frappe.get_doc(values).insert(ignore_permissions=True)
|
||||
frappe.get_doc(values).insert(ignore_permissions=True)
|
||||
|
||||
@ -10,6 +10,7 @@
|
||||
"organization_name",
|
||||
"no_of_employees",
|
||||
"currency",
|
||||
"exchange_rate",
|
||||
"annual_revenue",
|
||||
"organization_logo",
|
||||
"column_break_pnpp",
|
||||
@ -74,12 +75,18 @@
|
||||
"fieldtype": "Link",
|
||||
"label": "Address",
|
||||
"options": "Address"
|
||||
},
|
||||
{
|
||||
"description": "The rate used to convert the organization\u2019s currency to your crm's base currency (set in CRM Settings). It is set once when the currency is first added and doesn't change automatically.",
|
||||
"fieldname": "exchange_rate",
|
||||
"fieldtype": "Float",
|
||||
"label": "Exchange Rate"
|
||||
}
|
||||
],
|
||||
"image_field": "organization_logo",
|
||||
"index_web_pages_for_search": 1,
|
||||
"links": [],
|
||||
"modified": "2024-09-17 18:37:10.341062",
|
||||
"modified": "2025-07-15 11:40:12.175598",
|
||||
"modified_by": "Administrator",
|
||||
"module": "FCRM",
|
||||
"name": "CRM Organization",
|
||||
@ -111,7 +118,8 @@
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"row_format": "Dynamic",
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"states": []
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,51 +4,65 @@
|
||||
import frappe
|
||||
from frappe.model.document import Document
|
||||
|
||||
from crm.fcrm.doctype.fcrm_settings.fcrm_settings import get_exchange_rate
|
||||
|
||||
|
||||
class CRMOrganization(Document):
|
||||
@staticmethod
|
||||
def default_list_data():
|
||||
columns = [
|
||||
{
|
||||
'label': 'Organization',
|
||||
'type': 'Data',
|
||||
'key': 'organization_name',
|
||||
'width': '16rem',
|
||||
},
|
||||
{
|
||||
'label': 'Website',
|
||||
'type': 'Data',
|
||||
'key': 'website',
|
||||
'width': '14rem',
|
||||
},
|
||||
{
|
||||
'label': 'Industry',
|
||||
'type': 'Link',
|
||||
'key': 'industry',
|
||||
'options': 'CRM Industry',
|
||||
'width': '14rem',
|
||||
},
|
||||
{
|
||||
'label': 'Annual Revenue',
|
||||
'type': 'Currency',
|
||||
'key': 'annual_revenue',
|
||||
'width': '14rem',
|
||||
},
|
||||
{
|
||||
'label': 'Last Modified',
|
||||
'type': 'Datetime',
|
||||
'key': 'modified',
|
||||
'width': '8rem',
|
||||
},
|
||||
]
|
||||
rows = [
|
||||
"name",
|
||||
"organization_name",
|
||||
"organization_logo",
|
||||
"website",
|
||||
"industry",
|
||||
"currency",
|
||||
"annual_revenue",
|
||||
"modified",
|
||||
]
|
||||
return {'columns': columns, 'rows': rows}
|
||||
def validate(self):
|
||||
self.update_exchange_rate()
|
||||
|
||||
def update_exchange_rate(self):
|
||||
if self.has_value_changed("currency") or not self.exchange_rate:
|
||||
system_currency = frappe.db.get_single_value("FCRM Settings", "currency") or "USD"
|
||||
exchange_rate = 1
|
||||
if self.currency and self.currency != system_currency:
|
||||
exchange_rate = get_exchange_rate(self.currency, system_currency)
|
||||
|
||||
self.db_set("exchange_rate", exchange_rate)
|
||||
|
||||
@staticmethod
|
||||
def default_list_data():
|
||||
columns = [
|
||||
{
|
||||
"label": "Organization",
|
||||
"type": "Data",
|
||||
"key": "organization_name",
|
||||
"width": "16rem",
|
||||
},
|
||||
{
|
||||
"label": "Website",
|
||||
"type": "Data",
|
||||
"key": "website",
|
||||
"width": "14rem",
|
||||
},
|
||||
{
|
||||
"label": "Industry",
|
||||
"type": "Link",
|
||||
"key": "industry",
|
||||
"options": "CRM Industry",
|
||||
"width": "14rem",
|
||||
},
|
||||
{
|
||||
"label": "Annual Revenue",
|
||||
"type": "Currency",
|
||||
"key": "annual_revenue",
|
||||
"width": "14rem",
|
||||
},
|
||||
{
|
||||
"label": "Last Modified",
|
||||
"type": "Datetime",
|
||||
"key": "modified",
|
||||
"width": "8rem",
|
||||
},
|
||||
]
|
||||
rows = [
|
||||
"name",
|
||||
"organization_name",
|
||||
"organization_logo",
|
||||
"website",
|
||||
"industry",
|
||||
"currency",
|
||||
"annual_revenue",
|
||||
"modified",
|
||||
]
|
||||
return {"columns": columns, "rows": rows}
|
||||
|
||||
0
crm/fcrm/doctype/crm_product/__init__.py
Normal file
0
crm/fcrm/doctype/crm_product/__init__.py
Normal file
9
crm/fcrm/doctype/crm_product/crm_product.js
Normal file
9
crm/fcrm/doctype/crm_product/crm_product.js
Normal file
@ -0,0 +1,9 @@
|
||||
// Copyright (c) 2025, Frappe Technologies Pvt. Ltd. and contributors
|
||||
// For license information, please see license.txt
|
||||
|
||||
frappe.ui.form.on("CRM Product", {
|
||||
product_code: function (frm) {
|
||||
if (!frm.doc.product_name)
|
||||
frm.set_value("product_name", frm.doc.product_code);
|
||||
}
|
||||
});
|
||||
105
crm/fcrm/doctype/crm_product/crm_product.json
Normal file
105
crm/fcrm/doctype/crm_product/crm_product.json
Normal file
@ -0,0 +1,105 @@
|
||||
{
|
||||
"actions": [],
|
||||
"allow_import": 1,
|
||||
"allow_rename": 1,
|
||||
"autoname": "field:product_code",
|
||||
"creation": "2025-04-28 11:45:09.309636",
|
||||
"doctype": "DocType",
|
||||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
"naming_series",
|
||||
"product_code",
|
||||
"product_name",
|
||||
"column_break_bpdj",
|
||||
"disabled",
|
||||
"standard_rate",
|
||||
"image",
|
||||
"section_break_rtwm",
|
||||
"description"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
"fieldname": "naming_series",
|
||||
"fieldtype": "Select",
|
||||
"label": "Naming Series",
|
||||
"options": "CRM-PROD-.YYYY.-"
|
||||
},
|
||||
{
|
||||
"fieldname": "product_code",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
"label": "Product Code",
|
||||
"reqd": 1,
|
||||
"unique": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "product_name",
|
||||
"fieldtype": "Data",
|
||||
"label": "Product Name"
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_bpdj",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"fieldname": "disabled",
|
||||
"fieldtype": "Check",
|
||||
"label": "Disabled"
|
||||
},
|
||||
{
|
||||
"fieldname": "image",
|
||||
"fieldtype": "Attach Image",
|
||||
"label": "Image"
|
||||
},
|
||||
{
|
||||
"fieldname": "section_break_rtwm",
|
||||
"fieldtype": "Section Break"
|
||||
},
|
||||
{
|
||||
"fieldname": "description",
|
||||
"fieldtype": "Text Editor",
|
||||
"label": "Description"
|
||||
},
|
||||
{
|
||||
"fieldname": "standard_rate",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Standard Selling Rate"
|
||||
}
|
||||
],
|
||||
"grid_page_length": 50,
|
||||
"image_field": "image",
|
||||
"index_web_pages_for_search": 1,
|
||||
"links": [],
|
||||
"make_attachments_public": 1,
|
||||
"modified": "2025-04-28 12:47:25.087957",
|
||||
"modified_by": "Administrator",
|
||||
"module": "FCRM",
|
||||
"name": "CRM Product",
|
||||
"naming_rule": "By fieldname",
|
||||
"owner": "Administrator",
|
||||
"permissions": [
|
||||
{
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "System Manager",
|
||||
"share": 1,
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"quick_entry": 1,
|
||||
"row_format": "Dynamic",
|
||||
"search_fields": "product_name,description",
|
||||
"show_name_in_global_search": 1,
|
||||
"show_preview_popup": 1,
|
||||
"sort_field": "creation",
|
||||
"sort_order": "DESC",
|
||||
"states": [],
|
||||
"title_field": "product_name",
|
||||
"track_changes": 1
|
||||
}
|
||||
16
crm/fcrm/doctype/crm_product/crm_product.py
Normal file
16
crm/fcrm/doctype/crm_product/crm_product.py
Normal file
@ -0,0 +1,16 @@
|
||||
# Copyright (c) 2025, Frappe Technologies Pvt. Ltd. and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
import frappe
|
||||
from frappe.model.document import Document
|
||||
|
||||
|
||||
class CRMProduct(Document):
|
||||
def validate(self):
|
||||
self.set_product_name()
|
||||
|
||||
def set_product_name(self):
|
||||
if not self.product_name:
|
||||
self.product_name = self.product_code
|
||||
else:
|
||||
self.product_name = self.product_name.strip()
|
||||
29
crm/fcrm/doctype/crm_product/test_crm_product.py
Normal file
29
crm/fcrm/doctype/crm_product/test_crm_product.py
Normal file
@ -0,0 +1,29 @@
|
||||
# Copyright (c) 2025, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# See license.txt
|
||||
|
||||
# import frappe
|
||||
from frappe.tests import IntegrationTestCase, UnitTestCase
|
||||
|
||||
# On IntegrationTestCase, the doctype test records and all
|
||||
# link-field test record dependencies are recursively loaded
|
||||
# Use these module variables to add/remove to/from that list
|
||||
EXTRA_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"]
|
||||
IGNORE_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"]
|
||||
|
||||
|
||||
class UnitTestCRMProduct(UnitTestCase):
|
||||
"""
|
||||
Unit tests for CRMProduct.
|
||||
Use this class for testing individual functions and methods.
|
||||
"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class IntegrationTestCRMProduct(IntegrationTestCase):
|
||||
"""
|
||||
Integration tests for CRMProduct.
|
||||
Use this class for testing interactions between multiple components.
|
||||
"""
|
||||
|
||||
pass
|
||||
0
crm/fcrm/doctype/crm_products/__init__.py
Normal file
0
crm/fcrm/doctype/crm_products/__init__.py
Normal file
136
crm/fcrm/doctype/crm_products/crm_products.json
Normal file
136
crm/fcrm/doctype/crm_products/crm_products.json
Normal file
@ -0,0 +1,136 @@
|
||||
{
|
||||
"actions": [],
|
||||
"allow_rename": 1,
|
||||
"creation": "2025-04-28 12:50:49.812915",
|
||||
"doctype": "DocType",
|
||||
"editable_grid": 1,
|
||||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
"product_code",
|
||||
"column_break_gvbc",
|
||||
"product_name",
|
||||
"section_break_fnvf",
|
||||
"qty",
|
||||
"column_break_ajac",
|
||||
"rate",
|
||||
"section_break_olqb",
|
||||
"discount_percentage",
|
||||
"column_break_uvra",
|
||||
"discount_amount",
|
||||
"section_break_cnpb",
|
||||
"column_break_pozr",
|
||||
"amount",
|
||||
"column_break_ejqw",
|
||||
"net_amount"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
"fieldname": "column_break_gvbc",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"fieldname": "product_name",
|
||||
"fieldtype": "Data",
|
||||
"label": "Product Name",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "section_break_fnvf",
|
||||
"fieldtype": "Section Break"
|
||||
},
|
||||
{
|
||||
"fieldname": "section_break_olqb",
|
||||
"fieldtype": "Section Break"
|
||||
},
|
||||
{
|
||||
"bold": 1,
|
||||
"fieldname": "discount_percentage",
|
||||
"fieldtype": "Percent",
|
||||
"label": "Discount %"
|
||||
},
|
||||
{
|
||||
"fieldname": "discount_amount",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Discount Amount",
|
||||
"options": "currency",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "section_break_cnpb",
|
||||
"fieldtype": "Section Break"
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_pozr",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"bold": 1,
|
||||
"fieldname": "rate",
|
||||
"fieldtype": "Currency",
|
||||
"in_list_view": 1,
|
||||
"label": "Rate",
|
||||
"options": "currency",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"bold": 1,
|
||||
"fieldname": "amount",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Amount",
|
||||
"options": "currency",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"bold": 1,
|
||||
"depends_on": "discount_percentage",
|
||||
"description": "Amount after discount",
|
||||
"fieldname": "net_amount",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Net Amount",
|
||||
"options": "currency",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"bold": 1,
|
||||
"columns": 5,
|
||||
"fieldname": "product_code",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 1,
|
||||
"label": "Product",
|
||||
"options": "CRM Product"
|
||||
},
|
||||
{
|
||||
"bold": 1,
|
||||
"default": "1",
|
||||
"fieldname": "qty",
|
||||
"fieldtype": "Float",
|
||||
"label": "Quantity"
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_ajac",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_uvra",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_ejqw",
|
||||
"fieldtype": "Column Break"
|
||||
}
|
||||
],
|
||||
"grid_page_length": 50,
|
||||
"index_web_pages_for_search": 1,
|
||||
"istable": 1,
|
||||
"links": [],
|
||||
"modified": "2025-05-14 18:52:26.183306",
|
||||
"modified_by": "Administrator",
|
||||
"module": "FCRM",
|
||||
"name": "CRM Products",
|
||||
"owner": "Administrator",
|
||||
"permissions": [],
|
||||
"row_format": "Dynamic",
|
||||
"sort_field": "creation",
|
||||
"sort_order": "DESC",
|
||||
"states": []
|
||||
}
|
||||
110
crm/fcrm/doctype/crm_products/crm_products.py
Normal file
110
crm/fcrm/doctype/crm_products/crm_products.py
Normal file
@ -0,0 +1,110 @@
|
||||
# Copyright (c) 2025, Frappe Technologies Pvt. Ltd. and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
import frappe
|
||||
from frappe.model.document import Document
|
||||
|
||||
|
||||
class CRMProducts(Document):
|
||||
pass
|
||||
|
||||
|
||||
def create_product_details_script(doctype):
|
||||
if not frappe.db.exists("CRM Form Script", "Product Details Script for " + doctype):
|
||||
script = get_product_details_script(doctype)
|
||||
frappe.get_doc(
|
||||
{
|
||||
"doctype": "CRM Form Script",
|
||||
"name": "Product Details Script for " + doctype,
|
||||
"dt": doctype,
|
||||
"view": "Form",
|
||||
"script": script,
|
||||
"enabled": 1,
|
||||
"is_standard": 1,
|
||||
}
|
||||
).insert()
|
||||
|
||||
|
||||
def get_product_details_script(doctype):
|
||||
doctype_class = "class " + doctype.replace(" ", "")
|
||||
|
||||
return (
|
||||
doctype_class
|
||||
+ " {"
|
||||
+ """
|
||||
update_total() {
|
||||
let total = 0
|
||||
let total_qty = 0
|
||||
let net_total = 0
|
||||
let discount_applied = false
|
||||
|
||||
this.doc.products.forEach((d) => {
|
||||
total += d.amount
|
||||
net_total += d.net_amount
|
||||
if (d.discount_percentage > 0) {
|
||||
discount_applied = true
|
||||
}
|
||||
})
|
||||
|
||||
this.doc.total = total
|
||||
this.doc.net_total = net_total || total
|
||||
|
||||
if (!net_total && discount_applied) {
|
||||
this.doc.net_total = net_total
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class CRMProducts {
|
||||
products_add() {
|
||||
let row = this.doc.getRow('products')
|
||||
row.trigger('qty')
|
||||
this.doc.trigger('update_total')
|
||||
}
|
||||
|
||||
products_remove() {
|
||||
this.doc.trigger('update_total')
|
||||
}
|
||||
|
||||
async product_code(idx) {
|
||||
let row = this.doc.getRow('products', idx)
|
||||
|
||||
let a = await call("frappe.client.get_value", {
|
||||
doctype: "CRM Product",
|
||||
filters: { name: row.product_code },
|
||||
fieldname: ["product_name", "standard_rate"],
|
||||
})
|
||||
|
||||
row.product_name = a.product_name
|
||||
if (a.standard_rate && !row.rate) {
|
||||
row.rate = a.standard_rate
|
||||
row.trigger("rate")
|
||||
}
|
||||
}
|
||||
|
||||
qty(idx) {
|
||||
let row = this.doc.getRow('products', idx)
|
||||
row.amount = row.qty * row.rate
|
||||
row.trigger('discount_percentage', idx)
|
||||
}
|
||||
|
||||
rate() {
|
||||
let row = this.doc.getRow('products')
|
||||
row.amount = row.qty * row.rate
|
||||
row.trigger('discount_percentage')
|
||||
}
|
||||
|
||||
discount_percentage(idx) {
|
||||
let row = this.doc.getRow('products', idx)
|
||||
if (!row.discount_percentage) {
|
||||
row.net_amount = row.amount
|
||||
row.discount_amount = 0
|
||||
}
|
||||
if (row.discount_percentage && row.amount) {
|
||||
row.discount_amount = (row.discount_percentage / 100) * row.amount
|
||||
row.net_amount = row.amount - row.discount_amount
|
||||
}
|
||||
this.doc.trigger('update_total')
|
||||
}
|
||||
}"""
|
||||
)
|
||||
@ -25,7 +25,7 @@ class CRMServiceLevelAgreement(Document):
|
||||
if self.default:
|
||||
other_slas = frappe.get_all(
|
||||
"CRM Service Level Agreement",
|
||||
filters={"apply_on": self.apply_on, "default": True},
|
||||
filters={"apply_on": self.apply_on, "default": True, "name": ["!=", self.name]},
|
||||
fields=["name"],
|
||||
)
|
||||
if other_slas:
|
||||
|
||||
@ -13,6 +13,8 @@
|
||||
"column_break_mwmz",
|
||||
"duration",
|
||||
"last_status_change_log",
|
||||
"from_type",
|
||||
"to_type",
|
||||
"log_owner"
|
||||
],
|
||||
"fields": [
|
||||
@ -61,18 +63,31 @@
|
||||
"fieldtype": "Link",
|
||||
"label": "Owner",
|
||||
"options": "User"
|
||||
},
|
||||
{
|
||||
"fieldname": "from_type",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
"label": "From Type"
|
||||
},
|
||||
{
|
||||
"fieldname": "to_type",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
"label": "To Type"
|
||||
}
|
||||
],
|
||||
"index_web_pages_for_search": 1,
|
||||
"istable": 1,
|
||||
"links": [],
|
||||
"modified": "2024-01-06 13:26:40.597277",
|
||||
"modified": "2025-07-13 12:37:41.278584",
|
||||
"modified_by": "Administrator",
|
||||
"module": "FCRM",
|
||||
"name": "CRM Status Change Log",
|
||||
"owner": "Administrator",
|
||||
"permissions": [],
|
||||
"row_format": "Dynamic",
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"states": []
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,15 +1,17 @@
|
||||
# Copyright (c) 2024, Frappe Technologies Pvt. Ltd. and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
import frappe
|
||||
from datetime import datetime
|
||||
from frappe.utils import add_to_date, get_datetime
|
||||
|
||||
import frappe
|
||||
from frappe.model.document import Document
|
||||
from frappe.utils import add_to_date, get_datetime
|
||||
|
||||
|
||||
class CRMStatusChangeLog(Document):
|
||||
pass
|
||||
|
||||
|
||||
def get_duration(from_date, to_date):
|
||||
if not isinstance(from_date, datetime):
|
||||
from_date = get_datetime(from_date)
|
||||
@ -18,28 +20,45 @@ def get_duration(from_date, to_date):
|
||||
duration = to_date - from_date
|
||||
return duration.total_seconds()
|
||||
|
||||
|
||||
def add_status_change_log(doc):
|
||||
to_status_type = frappe.db.get_value("CRM Deal Status", doc.status, "type") if doc.status else None
|
||||
|
||||
if not doc.is_new():
|
||||
previous_status = doc.get_doc_before_save().status if doc.get_doc_before_save() else None
|
||||
previous_status_type = (
|
||||
frappe.db.get_value("CRM Deal Status", previous_status, "type") if previous_status else None
|
||||
)
|
||||
if not doc.status_change_log and previous_status:
|
||||
now_minus_one_minute = add_to_date(datetime.now(), minutes=-1)
|
||||
doc.append("status_change_log", {
|
||||
"from": previous_status,
|
||||
"to": "",
|
||||
"from_date": now_minus_one_minute,
|
||||
"to_date": "",
|
||||
"log_owner": frappe.session.user,
|
||||
})
|
||||
doc.append(
|
||||
"status_change_log",
|
||||
{
|
||||
"from": previous_status,
|
||||
"from_type": previous_status_type or "",
|
||||
"to": "",
|
||||
"to_type": "",
|
||||
"from_date": now_minus_one_minute,
|
||||
"to_date": "",
|
||||
"log_owner": frappe.session.user,
|
||||
},
|
||||
)
|
||||
last_status_change = doc.status_change_log[-1]
|
||||
last_status_change.to = doc.status
|
||||
last_status_change.to_type = to_status_type or ""
|
||||
last_status_change.to_date = datetime.now()
|
||||
last_status_change.log_owner = frappe.session.user
|
||||
last_status_change.duration = get_duration(last_status_change.from_date, last_status_change.to_date)
|
||||
|
||||
doc.append("status_change_log", {
|
||||
"from": doc.status,
|
||||
"to": "",
|
||||
"from_date": datetime.now(),
|
||||
"to_date": "",
|
||||
"log_owner": frappe.session.user,
|
||||
})
|
||||
doc.append(
|
||||
"status_change_log",
|
||||
{
|
||||
"from": doc.status,
|
||||
"from_type": to_status_type or "",
|
||||
"to": "",
|
||||
"to_type": "",
|
||||
"from_date": datetime.now(),
|
||||
"to_date": "",
|
||||
"log_owner": frappe.session.user,
|
||||
},
|
||||
)
|
||||
|
||||
@ -63,8 +63,7 @@
|
||||
"fieldname": "twiml_sid",
|
||||
"fieldtype": "Data",
|
||||
"label": "TwiML SID",
|
||||
"permlevel": 1,
|
||||
"read_only": 1
|
||||
"permlevel": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "section_break_ssqj",
|
||||
@ -105,7 +104,7 @@
|
||||
"index_web_pages_for_search": 1,
|
||||
"issingle": 1,
|
||||
"links": [],
|
||||
"modified": "2025-01-15 19:35:13.406254",
|
||||
"modified": "2025-08-19 13:36:19.823197",
|
||||
"modified_by": "Administrator",
|
||||
"module": "FCRM",
|
||||
"name": "CRM Twilio Settings",
|
||||
@ -152,8 +151,9 @@
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"row_format": "Dynamic",
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"states": [],
|
||||
"track_changes": 1
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
"label",
|
||||
"icon",
|
||||
"user",
|
||||
"is_standard",
|
||||
"is_default",
|
||||
"column_break_zacm",
|
||||
"type",
|
||||
@ -112,12 +113,6 @@
|
||||
"fieldtype": "Check",
|
||||
"label": "Public"
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"fieldname": "is_default",
|
||||
"fieldtype": "Check",
|
||||
"label": "Is Default"
|
||||
},
|
||||
{
|
||||
"fieldname": "icon",
|
||||
"fieldtype": "Data",
|
||||
@ -174,15 +169,26 @@
|
||||
"label": "Kanban Fields"
|
||||
},
|
||||
{
|
||||
"default": "name",
|
||||
"fieldname": "title_field",
|
||||
"fieldtype": "Data",
|
||||
"label": "Title Field"
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"fieldname": "is_standard",
|
||||
"fieldtype": "Check",
|
||||
"label": "Is Standard"
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"fieldname": "is_default",
|
||||
"fieldtype": "Check",
|
||||
"label": "Is Default"
|
||||
}
|
||||
],
|
||||
"index_web_pages_for_search": 1,
|
||||
"links": [],
|
||||
"modified": "2024-06-25 19:40:12.067788",
|
||||
"modified": "2025-02-20 15:36:55.059065",
|
||||
"modified_by": "Administrator",
|
||||
"module": "FCRM",
|
||||
"name": "CRM View Settings",
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
# Copyright (c) 2023, Frappe Technologies Pvt. Ltd. and contributors
|
||||
# For license information, please see license.txt
|
||||
import json
|
||||
|
||||
import frappe
|
||||
from frappe.model.document import Document, get_controller
|
||||
from frappe.utils import parse_json
|
||||
@ -9,15 +10,16 @@ from frappe.utils import parse_json
|
||||
class CRMViewSettings(Document):
|
||||
pass
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def create(view):
|
||||
view = frappe._dict(view)
|
||||
|
||||
view.filters = parse_json(view.filters) or {}
|
||||
view.columns = parse_json(view.columns or '[]')
|
||||
view.rows = parse_json(view.rows or '[]')
|
||||
view.kanban_columns = parse_json(view.kanban_columns or '[]')
|
||||
view.kanban_fields = parse_json(view.kanban_fields or '[]')
|
||||
view.columns = parse_json(view.columns or "[]")
|
||||
view.rows = parse_json(view.rows or "[]")
|
||||
view.kanban_columns = parse_json(view.kanban_columns or "[]")
|
||||
view.kanban_fields = parse_json(view.kanban_fields or "[]")
|
||||
|
||||
default_rows = sync_default_rows(view.doctype)
|
||||
view.rows = view.rows + default_rows if default_rows else view.rows
|
||||
@ -31,11 +33,11 @@ def create(view):
|
||||
doc = frappe.new_doc("CRM View Settings")
|
||||
doc.name = view.label
|
||||
doc.label = view.label
|
||||
doc.type = view.type or 'list'
|
||||
doc.type = view.type or "list"
|
||||
doc.icon = view.icon
|
||||
doc.dt = view.doctype
|
||||
doc.user = frappe.session.user
|
||||
doc.route_name = view.route_name or ""
|
||||
doc.route_name = view.route_name or get_route_name(view.doctype)
|
||||
doc.load_default_columns = view.load_default_columns or False
|
||||
doc.filters = json.dumps(view.filters)
|
||||
doc.order_by = view.order_by
|
||||
@ -49,6 +51,7 @@ def create(view):
|
||||
doc.insert()
|
||||
return doc
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def update(view):
|
||||
view = frappe._dict(view)
|
||||
@ -65,9 +68,9 @@ def update(view):
|
||||
|
||||
doc = frappe.get_doc("CRM View Settings", view.name)
|
||||
doc.label = view.label
|
||||
doc.type = view.type or 'list'
|
||||
doc.type = view.type or "list"
|
||||
doc.icon = view.icon
|
||||
doc.route_name = view.route_name or ""
|
||||
doc.route_name = view.route_name or get_route_name(view.doctype)
|
||||
doc.load_default_columns = view.load_default_columns or False
|
||||
doc.filters = json.dumps(filters)
|
||||
doc.order_by = view.order_by
|
||||
@ -81,11 +84,13 @@ def update(view):
|
||||
doc.save()
|
||||
return doc
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def delete(name):
|
||||
if frappe.db.exists("CRM View Settings", name):
|
||||
frappe.delete_doc("CRM View Settings", name)
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def public(name, value):
|
||||
if frappe.session.user != "Administrator" and "Sales Manager" not in frappe.get_roles():
|
||||
@ -98,15 +103,18 @@ def public(name, value):
|
||||
doc.user = "" if value else frappe.session.user
|
||||
doc.save()
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def pin(name, value):
|
||||
doc = frappe.get_doc("CRM View Settings", name)
|
||||
doc.pinned = value
|
||||
doc.save()
|
||||
|
||||
|
||||
def remove_duplicates(l):
|
||||
return list(dict.fromkeys(l))
|
||||
|
||||
|
||||
def sync_default_rows(doctype, type="list"):
|
||||
list = get_controller(doctype)
|
||||
rows = []
|
||||
@ -116,6 +124,7 @@ def sync_default_rows(doctype, type="list"):
|
||||
|
||||
return rows
|
||||
|
||||
|
||||
def sync_default_columns(view):
|
||||
list = get_controller(view.doctype)
|
||||
columns = []
|
||||
@ -137,14 +146,32 @@ def sync_default_columns(view):
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def create_or_update_default_view(view):
|
||||
def set_as_default(name=None, type=None, doctype=None):
|
||||
if name:
|
||||
frappe.db.set_value("CRM View Settings", name, "is_default", 1)
|
||||
else:
|
||||
doc = create_or_update_standard_view({"type": type, "doctype": doctype, "is_default": 1})
|
||||
name = doc.name
|
||||
|
||||
# remove default from other views of same user
|
||||
frappe.db.set_value(
|
||||
"CRM View Settings",
|
||||
{"name": ("!=", name), "user": frappe.session.user, "is_default": 1},
|
||||
"is_default",
|
||||
0,
|
||||
)
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def create_or_update_standard_view(view):
|
||||
view = frappe._dict(view)
|
||||
|
||||
filters = parse_json(view.filters) or {}
|
||||
columns = parse_json(view.columns or '[]')
|
||||
rows = parse_json(view.rows or '[]')
|
||||
kanban_columns = parse_json(view.kanban_columns or '[]')
|
||||
kanban_fields = parse_json(view.kanban_fields or '[]')
|
||||
columns = parse_json(view.columns or "[]")
|
||||
rows = parse_json(view.rows or "[]")
|
||||
kanban_columns = parse_json(view.kanban_columns or "[]")
|
||||
kanban_fields = parse_json(view.kanban_fields or "[]")
|
||||
view.column_field = view.column_field or "status"
|
||||
|
||||
default_rows = sync_default_rows(view.doctype, view.type)
|
||||
rows = rows + default_rows if default_rows else rows
|
||||
@ -157,47 +184,63 @@ def create_or_update_default_view(view):
|
||||
|
||||
doc = frappe.db.exists(
|
||||
"CRM View Settings",
|
||||
{
|
||||
"dt": view.doctype,
|
||||
"type": view.type or 'list',
|
||||
"is_default": True,
|
||||
"user": frappe.session.user
|
||||
},
|
||||
{"dt": view.doctype, "type": view.type or "list", "is_standard": True, "user": frappe.session.user},
|
||||
)
|
||||
if doc:
|
||||
doc = frappe.get_doc("CRM View Settings", doc)
|
||||
doc.label = view.label
|
||||
doc.type = view.type or 'list'
|
||||
doc.route_name = view.route_name or ""
|
||||
doc.type = view.type or "list"
|
||||
doc.route_name = view.route_name or get_route_name(view.doctype)
|
||||
doc.load_default_columns = view.load_default_columns or False
|
||||
doc.filters = json.dumps(filters)
|
||||
doc.order_by = view.order_by
|
||||
doc.group_by_field = view.group_by_field
|
||||
doc.order_by = view.order_by or "modified desc"
|
||||
doc.group_by_field = view.group_by_field or "owner"
|
||||
doc.column_field = view.column_field
|
||||
doc.title_field = view.title_field
|
||||
doc.kanban_columns = json.dumps(kanban_columns)
|
||||
doc.kanban_fields = json.dumps(kanban_fields)
|
||||
doc.columns = json.dumps(columns)
|
||||
doc.rows = json.dumps(rows)
|
||||
doc.is_default = view.is_default or False
|
||||
doc.save()
|
||||
else:
|
||||
doc = frappe.new_doc("CRM View Settings")
|
||||
label = 'Group By View' if view.type == 'group_by' else 'List View'
|
||||
|
||||
label = "List"
|
||||
if view.type == "group_by":
|
||||
label = "Group By"
|
||||
elif view.type == "kanban":
|
||||
label = "Kanban"
|
||||
|
||||
doc.name = view.label or label
|
||||
doc.label = view.label or label
|
||||
doc.type = view.type or 'list'
|
||||
doc.type = view.type or "list"
|
||||
doc.dt = view.doctype
|
||||
doc.user = frappe.session.user
|
||||
doc.route_name = view.route_name or ""
|
||||
doc.route_name = view.route_name or get_route_name(view.doctype)
|
||||
doc.load_default_columns = view.load_default_columns or False
|
||||
doc.filters = json.dumps(filters)
|
||||
doc.order_by = view.order_by
|
||||
doc.group_by_field = view.group_by_field
|
||||
doc.order_by = view.order_by or "modified desc"
|
||||
doc.group_by_field = view.group_by_field or "owner"
|
||||
doc.column_field = view.column_field
|
||||
doc.title_field = view.title_field
|
||||
doc.kanban_columns = json.dumps(kanban_columns)
|
||||
doc.kanban_fields = json.dumps(kanban_fields)
|
||||
doc.columns = json.dumps(columns)
|
||||
doc.rows = json.dumps(rows)
|
||||
doc.is_default = True
|
||||
doc.insert()
|
||||
doc.is_standard = True
|
||||
doc.is_default = view.is_default or False
|
||||
doc.insert()
|
||||
|
||||
return doc
|
||||
|
||||
|
||||
def get_route_name(doctype):
|
||||
# Example: "CRM Lead" -> "Leads"
|
||||
if doctype.startswith("CRM "):
|
||||
doctype = doctype[4:]
|
||||
|
||||
if doctype[-1] != "s":
|
||||
doctype += "s"
|
||||
|
||||
return doctype
|
||||
|
||||
@ -1,22 +1,24 @@
|
||||
# Copyright (c) 2024, Frappe and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
import json
|
||||
|
||||
import frappe
|
||||
from frappe import _
|
||||
from frappe.custom.doctype.property_setter.property_setter import make_property_setter
|
||||
from frappe.model.document import Document
|
||||
from frappe.frappeclient import FrappeClient
|
||||
from frappe.model.document import Document
|
||||
from frappe.utils import get_url_to_form, get_url_to_list
|
||||
import json
|
||||
|
||||
|
||||
class ERPNextCRMSettings(Document):
|
||||
def validate(self):
|
||||
if self.enabled:
|
||||
self.validate_if_erpnext_installed()
|
||||
self.add_quotation_to_option()
|
||||
self.create_custom_fields()
|
||||
self.create_custom_fields()
|
||||
self.create_crm_form_script()
|
||||
|
||||
|
||||
def validate_if_erpnext_installed(self):
|
||||
if not self.is_erpnext_in_different_site:
|
||||
if "erpnext" not in frappe.get_installed_apps():
|
||||
@ -37,6 +39,7 @@ class ERPNextCRMSettings(Document):
|
||||
def create_custom_fields(self):
|
||||
if not self.is_erpnext_in_different_site:
|
||||
from erpnext.crm.frappe_crm_api import create_custom_fields_for_frappe_crm
|
||||
|
||||
create_custom_fields_for_frappe_crm()
|
||||
else:
|
||||
self.create_custom_fields_in_remote_site()
|
||||
@ -48,22 +51,24 @@ class ERPNextCRMSettings(Document):
|
||||
except Exception:
|
||||
frappe.log_error(
|
||||
frappe.get_traceback(),
|
||||
f"Error while creating custom field in the remote erpnext site: {self.erpnext_site_url}"
|
||||
f"Error while creating custom field in the remote erpnext site: {self.erpnext_site_url}",
|
||||
)
|
||||
frappe.throw("Error while creating custom field in ERPNext, check error log for more details")
|
||||
|
||||
def create_crm_form_script(self):
|
||||
if not frappe.db.exists("CRM Form Script", "Create Quotation from CRM Deal"):
|
||||
script = get_crm_form_script()
|
||||
frappe.get_doc({
|
||||
"doctype": "CRM Form Script",
|
||||
"name": "Create Quotation from CRM Deal",
|
||||
"dt": "CRM Deal",
|
||||
"view": "Form",
|
||||
"script": script,
|
||||
"enabled": 1,
|
||||
"is_standard": 1
|
||||
}).insert()
|
||||
frappe.get_doc(
|
||||
{
|
||||
"doctype": "CRM Form Script",
|
||||
"name": "Create Quotation from CRM Deal",
|
||||
"dt": "CRM Deal",
|
||||
"view": "Form",
|
||||
"script": script,
|
||||
"enabled": 1,
|
||||
"is_standard": 1,
|
||||
}
|
||||
).insert()
|
||||
|
||||
@frappe.whitelist()
|
||||
def reset_erpnext_form_script(self):
|
||||
@ -77,14 +82,14 @@ class ERPNextCRMSettings(Document):
|
||||
frappe.log_error(frappe.get_traceback(), "Error while resetting form script")
|
||||
return False
|
||||
|
||||
|
||||
def get_erpnext_site_client(erpnext_crm_settings):
|
||||
site_url = erpnext_crm_settings.erpnext_site_url
|
||||
api_key = erpnext_crm_settings.api_key
|
||||
api_secret = erpnext_crm_settings.get_password("api_secret", raise_exception=False)
|
||||
|
||||
return FrappeClient(
|
||||
site_url, api_key=api_key, api_secret=api_secret
|
||||
)
|
||||
return FrappeClient(site_url, api_key=api_key, api_secret=api_secret)
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_customer_link(crm_deal):
|
||||
@ -107,7 +112,7 @@ def get_customer_link(crm_deal):
|
||||
except Exception:
|
||||
frappe.log_error(
|
||||
frappe.get_traceback(),
|
||||
f"Error while fetching customer in remote site: {erpnext_crm_settings.erpnext_site_url}"
|
||||
f"Error while fetching customer in remote site: {erpnext_crm_settings.erpnext_site_url}",
|
||||
)
|
||||
frappe.throw(_("Error while fetching customer in ERPNext, check error log for more details"))
|
||||
|
||||
@ -118,23 +123,54 @@ def get_quotation_url(crm_deal, organization):
|
||||
if not erpnext_crm_settings.enabled:
|
||||
frappe.throw(_("ERPNext is not integrated with the CRM"))
|
||||
|
||||
contact = get_contact(crm_deal)
|
||||
address = get_organization_address(organization)
|
||||
address = address.get("name") if address else None
|
||||
|
||||
if not erpnext_crm_settings.is_erpnext_in_different_site:
|
||||
quotation_url = get_url_to_list("Quotation")
|
||||
return f"{quotation_url}/new?quotation_to=CRM Deal&crm_deal={crm_deal}&party_name={crm_deal}&company={erpnext_crm_settings.erpnext_company}"
|
||||
base_url = f"{get_url_to_list('Quotation')}/new"
|
||||
params = {
|
||||
"quotation_to": "CRM Deal",
|
||||
"crm_deal": crm_deal,
|
||||
"party_name": crm_deal,
|
||||
"company": erpnext_crm_settings.erpnext_company,
|
||||
"contact_person": contact,
|
||||
"customer_address": address
|
||||
}
|
||||
else:
|
||||
site_url = erpnext_crm_settings.get("erpnext_site_url")
|
||||
quotation_url = f"{site_url}/app/quotation"
|
||||
|
||||
base_url = f"{site_url}/app/quotation/new"
|
||||
prospect = create_prospect_in_remote_site(crm_deal, erpnext_crm_settings)
|
||||
return f"{quotation_url}/new?quotation_to=Prospect&crm_deal={crm_deal}&party_name={prospect}&company={erpnext_crm_settings.erpnext_company}"
|
||||
params = {
|
||||
"quotation_to": "Prospect",
|
||||
"crm_deal": crm_deal,
|
||||
"party_name": prospect,
|
||||
"company": erpnext_crm_settings.erpnext_company,
|
||||
"contact_person": contact,
|
||||
"customer_address": address
|
||||
}
|
||||
|
||||
# Filter out None values and build query string
|
||||
query_string = "&".join(
|
||||
f"{key}={value}" for key, value in params.items()
|
||||
if value is not None
|
||||
)
|
||||
|
||||
return f"{base_url}?{query_string}"
|
||||
|
||||
|
||||
def create_prospect_in_remote_site(crm_deal, erpnext_crm_settings):
|
||||
try:
|
||||
client = get_erpnext_site_client(erpnext_crm_settings)
|
||||
doc = frappe.get_doc("CRM Deal", crm_deal)
|
||||
doc = frappe.get_cached_doc("CRM Deal", crm_deal)
|
||||
contacts = get_contacts(doc)
|
||||
address = get_organization_address(doc.organization)
|
||||
return client.post_api("erpnext.crm.frappe_crm_api.create_prospect_against_crm_deal",
|
||||
address = get_organization_address(doc.organization) or None
|
||||
|
||||
if address and not isinstance(address, dict):
|
||||
address = address.as_dict()
|
||||
|
||||
return client.post_api(
|
||||
"erpnext.crm.frappe_crm_api.create_prospect_against_crm_deal",
|
||||
{
|
||||
"organization": doc.organization,
|
||||
"lead_name": doc.lead_name,
|
||||
@ -145,34 +181,49 @@ def create_prospect_in_remote_site(crm_deal, erpnext_crm_settings):
|
||||
"industry": doc.industry,
|
||||
"website": doc.website,
|
||||
"annual_revenue": doc.annual_revenue,
|
||||
"contacts": json.dumps(contacts),
|
||||
"contacts": json.dumps(contacts) if contacts else None,
|
||||
"erpnext_company": erpnext_crm_settings.erpnext_company,
|
||||
"address": address.as_dict() if address else None
|
||||
"address": json.dumps(address) if address else None,
|
||||
},
|
||||
)
|
||||
except Exception:
|
||||
frappe.log_error(
|
||||
frappe.get_traceback(),
|
||||
f"Error while creating prospect in remote site: {erpnext_crm_settings.erpnext_site_url}"
|
||||
f"Error while creating prospect in remote site: {erpnext_crm_settings.erpnext_site_url}",
|
||||
)
|
||||
frappe.throw(_("Error while creating prospect in ERPNext, check error log for more details"))
|
||||
|
||||
|
||||
def get_contact(crm_deal):
|
||||
doc = frappe.get_cached_doc("CRM Deal", crm_deal)
|
||||
contact = None
|
||||
for c in doc.contacts:
|
||||
if c.is_primary:
|
||||
contact = c.contact
|
||||
break
|
||||
|
||||
return contact
|
||||
|
||||
|
||||
def get_contacts(doc):
|
||||
contacts = []
|
||||
for c in doc.contacts:
|
||||
contacts.append({
|
||||
"contact": c.contact,
|
||||
"full_name": c.full_name,
|
||||
"email": c.email,
|
||||
"mobile_no": c.mobile_no,
|
||||
"gender": c.gender,
|
||||
"is_primary": c.is_primary,
|
||||
})
|
||||
contacts.append(
|
||||
{
|
||||
"contact": c.contact,
|
||||
"full_name": c.full_name,
|
||||
"email": c.email,
|
||||
"mobile_no": c.mobile_no,
|
||||
"gender": c.gender,
|
||||
"is_primary": c.is_primary,
|
||||
}
|
||||
)
|
||||
return contacts
|
||||
|
||||
|
||||
def get_organization_address(organization):
|
||||
address = frappe.db.get_value("CRM Organization", organization, "address")
|
||||
address = frappe.get_doc("Address", address) if address else None
|
||||
address = frappe.get_cached_doc("Address", address) if address else None
|
||||
if not address:
|
||||
return None
|
||||
return {
|
||||
@ -188,6 +239,7 @@ def get_organization_address(organization):
|
||||
"pincode": address.pincode,
|
||||
}
|
||||
|
||||
|
||||
def create_customer_in_erpnext(doc, method):
|
||||
erpnext_crm_settings = frappe.get_single("ERPNext CRM Settings")
|
||||
if (
|
||||
@ -196,7 +248,7 @@ def create_customer_in_erpnext(doc, method):
|
||||
or doc.status != erpnext_crm_settings.deal_status
|
||||
):
|
||||
return
|
||||
|
||||
|
||||
contacts = get_contacts(doc)
|
||||
address = get_organization_address(doc.organization)
|
||||
customer = {
|
||||
@ -213,27 +265,27 @@ def create_customer_in_erpnext(doc, method):
|
||||
}
|
||||
if not erpnext_crm_settings.is_erpnext_in_different_site:
|
||||
from erpnext.crm.frappe_crm_api import create_customer
|
||||
|
||||
create_customer(customer)
|
||||
else:
|
||||
create_customer_in_remote_site(customer, erpnext_crm_settings)
|
||||
|
||||
frappe.publish_realtime("crm_customer_created")
|
||||
|
||||
|
||||
def create_customer_in_remote_site(customer, erpnext_crm_settings):
|
||||
client = get_erpnext_site_client(erpnext_crm_settings)
|
||||
try:
|
||||
client.post_api("erpnext.crm.frappe_crm_api.create_customer", customer)
|
||||
except Exception:
|
||||
frappe.log_error(
|
||||
frappe.get_traceback(),
|
||||
"Error while creating customer in remote site"
|
||||
)
|
||||
frappe.log_error(frappe.get_traceback(), "Error while creating customer in remote site")
|
||||
frappe.throw(_("Error while creating customer in ERPNext, check error log for more details"))
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_crm_form_script():
|
||||
return """
|
||||
async function setupForm({ doc, call, $dialog, updateField, createToast }) {
|
||||
return """
|
||||
async function setupForm({ doc, call, $dialog, updateField, toast }) {
|
||||
let actions = [];
|
||||
let is_erpnext_integration_enabled = await call("frappe.client.get_single_value", {doctype: "ERPNext CRM Settings", field: "enabled"});
|
||||
if (!["Lost", "Won"].includes(doc?.status) && is_erpnext_integration_enabled) {
|
||||
|
||||
@ -19,7 +19,8 @@
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 1,
|
||||
"label": "Title"
|
||||
"label": "Title",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "content",
|
||||
@ -49,7 +50,7 @@
|
||||
"link_fieldname": "note"
|
||||
}
|
||||
],
|
||||
"modified": "2024-01-19 21:56:30.123334",
|
||||
"modified": "2025-04-01 15:30:14.742001",
|
||||
"modified_by": "Administrator",
|
||||
"module": "FCRM",
|
||||
"name": "FCRM Note",
|
||||
|
||||
@ -7,6 +7,14 @@
|
||||
"field_order": [
|
||||
"defaults_tab",
|
||||
"restore_defaults",
|
||||
"enable_forecasting",
|
||||
"auto_update_expected_deal_value",
|
||||
"currency_tab",
|
||||
"currency",
|
||||
"exchange_rate_provider_section",
|
||||
"service_provider",
|
||||
"column_break_vqck",
|
||||
"access_key",
|
||||
"branding_tab",
|
||||
"brand_name",
|
||||
"brand_logo",
|
||||
@ -28,7 +36,7 @@
|
||||
{
|
||||
"fieldname": "defaults_tab",
|
||||
"fieldtype": "Tab Break",
|
||||
"label": "Defaults"
|
||||
"label": "Settings"
|
||||
},
|
||||
{
|
||||
"fieldname": "branding_tab",
|
||||
@ -56,12 +64,61 @@
|
||||
"fieldname": "favicon",
|
||||
"fieldtype": "Attach",
|
||||
"label": "Favicon"
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"description": "It will make deal's \"Expected Closure Date\" & \"Expected Deal Value\" mandatory to get accurate forecasting insights",
|
||||
"fieldname": "enable_forecasting",
|
||||
"fieldtype": "Check",
|
||||
"label": "Enable Forecasting"
|
||||
},
|
||||
{
|
||||
"fieldname": "currency",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 1,
|
||||
"label": "Currency",
|
||||
"options": "Currency"
|
||||
},
|
||||
{
|
||||
"fieldname": "currency_tab",
|
||||
"fieldtype": "Tab Break",
|
||||
"label": "Currency"
|
||||
},
|
||||
{
|
||||
"fieldname": "exchange_rate_provider_section",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Exchange Rate Provider"
|
||||
},
|
||||
{
|
||||
"default": "frankfurter.app",
|
||||
"fieldname": "service_provider",
|
||||
"fieldtype": "Select",
|
||||
"label": "Service Provider",
|
||||
"options": "frankfurter.app\nexchangerate.host"
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:doc.service_provider == 'exchangerate.host';",
|
||||
"fieldname": "access_key",
|
||||
"fieldtype": "Data",
|
||||
"label": "Access Key",
|
||||
"mandatory_depends_on": "eval:doc.service_provider == 'exchangerate.host';"
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_vqck",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"default": "1",
|
||||
"description": "Automatically update \"Expected Deal Value\" based on the total value of associated products in a deal",
|
||||
"fieldname": "auto_update_expected_deal_value",
|
||||
"fieldtype": "Check",
|
||||
"label": "Auto Update Expected Deal Value"
|
||||
}
|
||||
],
|
||||
"index_web_pages_for_search": 1,
|
||||
"issingle": 1,
|
||||
"links": [],
|
||||
"modified": "2025-01-19 14:23:05.981355",
|
||||
"modified": "2025-09-16 17:33:26.406549",
|
||||
"modified_by": "Administrator",
|
||||
"module": "FCRM",
|
||||
"name": "FCRM Settings",
|
||||
@ -95,7 +152,8 @@
|
||||
"share": 1
|
||||
}
|
||||
],
|
||||
"row_format": "Dynamic",
|
||||
"sort_field": "creation",
|
||||
"sort_order": "DESC",
|
||||
"states": []
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,9 @@
|
||||
# For license information, please see license.txt
|
||||
|
||||
import frappe
|
||||
import requests
|
||||
from frappe import _
|
||||
from frappe.custom.doctype.property_setter.property_setter import delete_property_setter, make_property_setter
|
||||
from frappe.model.document import Document
|
||||
|
||||
from crm.install import after_install
|
||||
@ -15,6 +17,8 @@ class FCRMSettings(Document):
|
||||
|
||||
def validate(self):
|
||||
self.do_not_allow_to_delete_if_standard()
|
||||
self.setup_forecasting()
|
||||
self.make_currency_read_only()
|
||||
|
||||
def do_not_allow_to_delete_if_standard(self):
|
||||
if not self.has_value_changed("dropdown_items"):
|
||||
@ -24,8 +28,53 @@ class FCRMSettings(Document):
|
||||
standard_old_items = [d.name1 for d in old_items if d.is_standard]
|
||||
deleted_standard_items = set(standard_old_items) - set(standard_new_items)
|
||||
if deleted_standard_items:
|
||||
standard_dropdown_items = get_standard_dropdown_items()
|
||||
if not deleted_standard_items.intersection(standard_dropdown_items):
|
||||
return
|
||||
frappe.throw(_("Cannot delete standard items {0}").format(", ".join(deleted_standard_items)))
|
||||
|
||||
def setup_forecasting(self):
|
||||
if self.has_value_changed("enable_forecasting"):
|
||||
if not self.enable_forecasting:
|
||||
delete_property_setter(
|
||||
"CRM Deal",
|
||||
"reqd",
|
||||
"expected_closure_date",
|
||||
)
|
||||
delete_property_setter(
|
||||
"CRM Deal",
|
||||
"reqd",
|
||||
"expected_deal_value",
|
||||
)
|
||||
else:
|
||||
make_property_setter(
|
||||
"CRM Deal",
|
||||
"expected_closure_date",
|
||||
"reqd",
|
||||
1 if self.enable_forecasting else 0,
|
||||
"Check",
|
||||
)
|
||||
make_property_setter(
|
||||
"CRM Deal",
|
||||
"expected_deal_value",
|
||||
"reqd",
|
||||
1 if self.enable_forecasting else 0,
|
||||
"Check",
|
||||
)
|
||||
|
||||
def make_currency_read_only(self):
|
||||
if self.currency and self.has_value_changed("currency"):
|
||||
make_property_setter(
|
||||
"FCRM Settings",
|
||||
"currency",
|
||||
"read_only",
|
||||
1,
|
||||
"Check",
|
||||
)
|
||||
|
||||
|
||||
def get_standard_dropdown_items():
|
||||
return [item.get("name1") for item in frappe.get_hooks("standard_dropdown_items")]
|
||||
|
||||
|
||||
def after_migrate():
|
||||
@ -51,3 +100,109 @@ def sync_table(key, hook):
|
||||
crm_settings.set(key, items)
|
||||
|
||||
crm_settings.save()
|
||||
|
||||
|
||||
def create_forecasting_script():
|
||||
if not frappe.db.exists("CRM Form Script", "Forecasting Script"):
|
||||
script = get_forecasting_script()
|
||||
frappe.get_doc(
|
||||
{
|
||||
"doctype": "CRM Form Script",
|
||||
"name": "Forecasting Script",
|
||||
"dt": "CRM Deal",
|
||||
"view": "Form",
|
||||
"script": script,
|
||||
"enabled": 1,
|
||||
"is_standard": 1,
|
||||
}
|
||||
).insert()
|
||||
|
||||
|
||||
def get_forecasting_script():
|
||||
return """class CRMDeal {
|
||||
async status() {
|
||||
await this.doc.trigger('updateProbability')
|
||||
}
|
||||
async updateProbability() {
|
||||
let status = await call("frappe.client.get_value", {
|
||||
doctype: "CRM Deal Status",
|
||||
fieldname: "probability",
|
||||
filters: { name: this.doc.status },
|
||||
})
|
||||
|
||||
this.doc.probability = status.probability
|
||||
}
|
||||
}"""
|
||||
|
||||
|
||||
def get_exchange_rate(from_currency, to_currency, date=None):
|
||||
if not date:
|
||||
date = "latest"
|
||||
|
||||
api_used = "frankfurter"
|
||||
|
||||
api_endpoint = f"https://api.frankfurter.app/{date}?from={from_currency}&to={to_currency}"
|
||||
res = requests.get(api_endpoint, timeout=5)
|
||||
if res.ok:
|
||||
data = res.json()
|
||||
return data["rates"][to_currency]
|
||||
|
||||
# Fallback to exchangerate.host if Frankfurter API fails
|
||||
settings = FCRMSettings("FCRM Settings")
|
||||
if settings and settings.service_provider == "exchangerate.host":
|
||||
api_used = "exchangerate.host"
|
||||
if not settings.access_key:
|
||||
frappe.throw(
|
||||
_("Access Key is required for Service Provider: {0}").format(
|
||||
frappe.bold(settings.service_provider)
|
||||
)
|
||||
)
|
||||
|
||||
params = {
|
||||
"access_key": settings.access_key,
|
||||
"from": from_currency,
|
||||
"to": to_currency,
|
||||
"amount": 1,
|
||||
}
|
||||
|
||||
if date != "latest":
|
||||
params["date"] = date
|
||||
|
||||
api_endpoint = "https://api.exchangerate.host/convert"
|
||||
|
||||
res = requests.get(api_endpoint, params=params, timeout=5)
|
||||
if res.ok:
|
||||
data = res.json()
|
||||
return data["result"]
|
||||
|
||||
frappe.log_error(
|
||||
title="Exchange Rate Fetch Error",
|
||||
message=f"Failed to fetch exchange rate from {from_currency} to {to_currency} using {api_used} API.",
|
||||
)
|
||||
|
||||
if api_used == "frankfurter":
|
||||
user = frappe.session.user
|
||||
is_manager = (
|
||||
"System Manager" in frappe.get_roles(user)
|
||||
or "Sales Manager" in frappe.get_roles(user)
|
||||
or user == "Administrator"
|
||||
)
|
||||
|
||||
if not is_manager:
|
||||
frappe.throw(
|
||||
_(
|
||||
"Ask your manager to set up the Exchange Rate Provider, as default provider does not support currency conversion for {0} to {1}."
|
||||
).format(from_currency, to_currency)
|
||||
)
|
||||
else:
|
||||
frappe.throw(
|
||||
_(
|
||||
"Setup the Exchange Rate Provider as 'Exchangerate Host' in settings, as default provider does not support currency conversion for {0} to {1}."
|
||||
).format(from_currency, to_currency)
|
||||
)
|
||||
|
||||
frappe.throw(
|
||||
_(
|
||||
"Failed to fetch exchange rate from {0} to {1} on {2}. Please check your internet connection or try again later."
|
||||
).format(from_currency, to_currency, date)
|
||||
)
|
||||
|
||||
37
crm/hooks.py
37
crm/hooks.py
@ -132,7 +132,6 @@ before_uninstall = "crm.uninstall.before_uninstall"
|
||||
override_doctype_class = {
|
||||
"Contact": "crm.overrides.contact.CustomContact",
|
||||
"Email Template": "crm.overrides.email_template.CustomEmailTemplate",
|
||||
"User": "crm.overrides.user.CustomUser",
|
||||
}
|
||||
|
||||
# Document Events
|
||||
@ -161,6 +160,7 @@ doc_events = {
|
||||
},
|
||||
"User": {
|
||||
"before_validate": ["crm.api.demo.validate_user"],
|
||||
"validate_reset_password": ["crm.api.demo.validate_reset_password"],
|
||||
},
|
||||
}
|
||||
|
||||
@ -264,22 +264,6 @@ standard_dropdown_items = [
|
||||
"route": "#",
|
||||
"is_standard": 1,
|
||||
},
|
||||
{
|
||||
"name1": "support_link",
|
||||
"label": "Support",
|
||||
"type": "Route",
|
||||
"icon": "life-buoy",
|
||||
"route": "https://t.me/frappecrm",
|
||||
"is_standard": 1,
|
||||
},
|
||||
{
|
||||
"name1": "docs_link",
|
||||
"label": "Docs",
|
||||
"type": "Route",
|
||||
"icon": "book-open",
|
||||
"route": "https://docs.frappe.io/crm",
|
||||
"is_standard": 1,
|
||||
},
|
||||
{
|
||||
"name1": "toggle_theme",
|
||||
"label": "Toggle theme",
|
||||
@ -293,7 +277,22 @@ standard_dropdown_items = [
|
||||
"label": "Settings",
|
||||
"type": "Route",
|
||||
"icon": "settings",
|
||||
"route": "#",
|
||||
"route": "#",
|
||||
"is_standard": 1,
|
||||
},
|
||||
{
|
||||
"name1": "login_to_fc",
|
||||
"label": "Login to Frappe Cloud",
|
||||
"type": "Route",
|
||||
"route": "#",
|
||||
"is_standard": 1,
|
||||
},
|
||||
{
|
||||
"name1": "about",
|
||||
"label": "About",
|
||||
"type": "Route",
|
||||
"icon": "info",
|
||||
"route": "#",
|
||||
"is_standard": 1,
|
||||
},
|
||||
{
|
||||
@ -307,7 +306,7 @@ standard_dropdown_items = [
|
||||
"label": "Log out",
|
||||
"type": "Route",
|
||||
"icon": "log-out",
|
||||
"route": "#",
|
||||
"route": "#",
|
||||
"is_standard": 1,
|
||||
},
|
||||
]
|
||||
|
||||
149
crm/install.py
149
crm/install.py
@ -4,6 +4,9 @@ import click
|
||||
import frappe
|
||||
from frappe.custom.doctype.custom_field.custom_field import create_custom_fields
|
||||
|
||||
from crm.fcrm.doctype.crm_dashboard.crm_dashboard import create_default_manager_dashboard
|
||||
from crm.fcrm.doctype.crm_products.crm_products import create_product_details_script
|
||||
|
||||
|
||||
def before_install():
|
||||
pass
|
||||
@ -18,7 +21,12 @@ def after_install(force=False):
|
||||
add_email_template_custom_fields()
|
||||
add_default_industries()
|
||||
add_default_lead_sources()
|
||||
add_default_lost_reasons()
|
||||
add_standard_dropdown_items()
|
||||
add_default_scripts()
|
||||
create_default_manager_dashboard(force)
|
||||
create_assignment_rule_custom_fields()
|
||||
add_assignment_rule_property_setters()
|
||||
frappe.db.commit()
|
||||
|
||||
|
||||
@ -65,30 +73,44 @@ def add_default_deal_statuses():
|
||||
statuses = {
|
||||
"Qualification": {
|
||||
"color": "gray",
|
||||
"type": "Open",
|
||||
"probability": 10,
|
||||
"position": 1,
|
||||
},
|
||||
"Demo/Making": {
|
||||
"color": "orange",
|
||||
"type": "Ongoing",
|
||||
"probability": 25,
|
||||
"position": 2,
|
||||
},
|
||||
"Proposal/Quotation": {
|
||||
"color": "blue",
|
||||
"type": "Ongoing",
|
||||
"probability": 50,
|
||||
"position": 3,
|
||||
},
|
||||
"Negotiation": {
|
||||
"color": "yellow",
|
||||
"type": "Ongoing",
|
||||
"probability": 70,
|
||||
"position": 4,
|
||||
},
|
||||
"Ready to Close": {
|
||||
"color": "purple",
|
||||
"type": "Ongoing",
|
||||
"probability": 90,
|
||||
"position": 5,
|
||||
},
|
||||
"Won": {
|
||||
"color": "green",
|
||||
"type": "Won",
|
||||
"probability": 100,
|
||||
"position": 6,
|
||||
},
|
||||
"Lost": {
|
||||
"color": "red",
|
||||
"type": "Lost",
|
||||
"probability": 0,
|
||||
"position": 7,
|
||||
},
|
||||
}
|
||||
@ -100,6 +122,8 @@ def add_default_deal_statuses():
|
||||
doc = frappe.new_doc("CRM Deal Status")
|
||||
doc.deal_status = status
|
||||
doc.color = statuses[status]["color"]
|
||||
doc.type = statuses[status]["type"]
|
||||
doc.probability = statuses[status]["probability"]
|
||||
doc.position = statuses[status]["position"]
|
||||
doc.insert()
|
||||
|
||||
@ -170,7 +194,7 @@ def add_default_fields_layout(force=False):
|
||||
},
|
||||
"CRM Deal-Data Fields": {
|
||||
"doctype": "CRM Deal",
|
||||
"layout": '[{"label": "Details", "name": "details_section", "opened": true, "columns": [{"name": "column_z9XL", "fields": ["organization", "annual_revenue", "next_step"]}, {"name": "column_gM4w", "fields": ["website", "close_date", "deal_owner"]}, {"name": "column_gWmE", "fields": ["territory", "probability"]}]}]',
|
||||
"layout": '[{"name":"first_tab","sections":[{"label":"Details","name":"details_section","opened":true,"columns":[{"name":"column_z9XL","fields":["organization","annual_revenue","next_step"]},{"name":"column_gM4w","fields":["website","closed_date","deal_owner"]},{"name":"column_gWmE","fields":["territory","probability"]}]},{"label":"Products","name":"section_jHhQ","opened":true,"columns":[{"name":"column_xiNF","fields":["products"]}],"editingLabel":false,"hideLabel":true},{"label":"New Section","name":"section_WNOQ","opened":true,"columns":[{"name":"column_ziBW","fields":["total"]},{"label":"","name":"column_wuwA","fields":["net_total"]}],"hideBorder":true,"hideLabel":true}]}]',
|
||||
},
|
||||
}
|
||||
|
||||
@ -340,6 +364,44 @@ def add_default_lead_sources():
|
||||
doc.insert()
|
||||
|
||||
|
||||
def add_default_lost_reasons():
|
||||
lost_reasons = [
|
||||
{
|
||||
"reason": "Pricing",
|
||||
"description": "The prospect found the pricing to be too high or not competitive.",
|
||||
},
|
||||
{"reason": "Competition", "description": "The prospect chose a competitor's product or service."},
|
||||
{
|
||||
"reason": "Budget Constraints",
|
||||
"description": "The prospect did not have the budget to proceed with the purchase.",
|
||||
},
|
||||
{
|
||||
"reason": "Missing Features",
|
||||
"description": "The prospect felt that the product or service was missing key features they needed.",
|
||||
},
|
||||
{
|
||||
"reason": "Long Sales Cycle",
|
||||
"description": "The sales process took too long, leading to loss of interest.",
|
||||
},
|
||||
{
|
||||
"reason": "No Decision-Maker",
|
||||
"description": "The prospect was not the decision-maker and could not proceed.",
|
||||
},
|
||||
{"reason": "Unresponsive Prospect", "description": "The prospect did not respond to follow-ups."},
|
||||
{"reason": "Poor Fit", "description": "The prospect was not a good fit for the product or service."},
|
||||
{"reason": "Other", "description": ""},
|
||||
]
|
||||
|
||||
for reason in lost_reasons:
|
||||
if frappe.db.exists("CRM Lost Reason", reason["reason"]):
|
||||
continue
|
||||
|
||||
doc = frappe.new_doc("CRM Lost Reason")
|
||||
doc.lost_reason = reason["reason"]
|
||||
doc.description = reason["description"]
|
||||
doc.insert()
|
||||
|
||||
|
||||
def add_standard_dropdown_items():
|
||||
crm_settings = frappe.get_single("FCRM Settings")
|
||||
|
||||
@ -353,3 +415,88 @@ def add_standard_dropdown_items():
|
||||
crm_settings.append("dropdown_items", item)
|
||||
|
||||
crm_settings.save()
|
||||
|
||||
|
||||
def add_default_scripts():
|
||||
from crm.fcrm.doctype.fcrm_settings.fcrm_settings import create_forecasting_script
|
||||
|
||||
for doctype in ["CRM Lead", "CRM Deal"]:
|
||||
create_product_details_script(doctype)
|
||||
create_forecasting_script()
|
||||
|
||||
|
||||
def add_assignment_rule_property_setters():
|
||||
"""Add a property setter to the Assignment Rule DocType for assign_condition and unassign_condition."""
|
||||
|
||||
default_fields = {
|
||||
"doctype": "Property Setter",
|
||||
"doctype_or_field": "DocField",
|
||||
"doc_type": "Assignment Rule",
|
||||
"property_type": "Data",
|
||||
"is_system_generated": 1,
|
||||
}
|
||||
|
||||
if not frappe.db.exists("Property Setter", {"name": "Assignment Rule-assign_condition-depends_on"}):
|
||||
frappe.get_doc(
|
||||
{
|
||||
**default_fields,
|
||||
"name": "Assignment Rule-assign_condition-depends_on",
|
||||
"field_name": "assign_condition",
|
||||
"property": "depends_on",
|
||||
"value": "eval: !doc.assign_condition_json",
|
||||
}
|
||||
).insert()
|
||||
else:
|
||||
frappe.db.set_value(
|
||||
"Property Setter",
|
||||
{"name": "Assignment Rule-assign_condition-depends_on"},
|
||||
"value",
|
||||
"eval: !doc.assign_condition_json",
|
||||
)
|
||||
if not frappe.db.exists("Property Setter", {"name": "Assignment Rule-unassign_condition-depends_on"}):
|
||||
frappe.get_doc(
|
||||
{
|
||||
**default_fields,
|
||||
"name": "Assignment Rule-unassign_condition-depends_on",
|
||||
"field_name": "unassign_condition",
|
||||
"property": "depends_on",
|
||||
"value": "eval: !doc.unassign_condition_json",
|
||||
}
|
||||
).insert()
|
||||
else:
|
||||
frappe.db.set_value(
|
||||
"Property Setter",
|
||||
{"name": "Assignment Rule-unassign_condition-depends_on"},
|
||||
"value",
|
||||
"eval: !doc.unassign_condition_json",
|
||||
)
|
||||
|
||||
|
||||
def create_assignment_rule_custom_fields():
|
||||
if not frappe.get_meta("Assignment Rule").has_field("assign_condition_json"):
|
||||
click.secho("* Installing Custom Fields in Assignment Rule")
|
||||
|
||||
create_custom_fields(
|
||||
{
|
||||
"Assignment Rule": [
|
||||
{
|
||||
"description": "Autogenerated field by CRM App",
|
||||
"fieldname": "assign_condition_json",
|
||||
"fieldtype": "Code",
|
||||
"label": "Assign Condition JSON",
|
||||
"insert_after": "assign_condition",
|
||||
"depends_on": "eval: doc.assign_condition_json",
|
||||
},
|
||||
{
|
||||
"description": "Autogenerated field by CRM App",
|
||||
"fieldname": "unassign_condition_json",
|
||||
"fieldtype": "Code",
|
||||
"label": "Unassign Condition JSON",
|
||||
"insert_after": "unassign_condition",
|
||||
"depends_on": "eval: doc.unassign_condition_json",
|
||||
},
|
||||
],
|
||||
}
|
||||
)
|
||||
|
||||
frappe.clear_cache(doctype="Assignment Rule")
|
||||
|
||||
@ -35,7 +35,7 @@ def set_default_calling_medium(medium):
|
||||
frappe.get_doc(
|
||||
{
|
||||
"doctype": "CRM Telephony Agent",
|
||||
"agent": frappe.session.user,
|
||||
"user": frappe.session.user,
|
||||
"default_medium": medium,
|
||||
}
|
||||
).insert(ignore_permissions=True)
|
||||
@ -110,12 +110,12 @@ def get_contact_by_phone_number(phone_number):
|
||||
number = parse_phone_number(phone_number)
|
||||
|
||||
if number.get("is_valid"):
|
||||
return get_contact(number.get("national_number"))
|
||||
return get_contact(number.get("national_number"), number.get("country"))
|
||||
else:
|
||||
return get_contact(phone_number, exact_match=True)
|
||||
return get_contact(phone_number, number.get("country"), exact_match=True)
|
||||
|
||||
|
||||
def get_contact(phone_number, exact_match=False):
|
||||
def get_contact(phone_number, country="IN", exact_match=False):
|
||||
if not phone_number:
|
||||
return {"mobile_no": phone_number}
|
||||
|
||||
@ -149,11 +149,11 @@ def get_contact(phone_number, exact_match=False):
|
||||
deal = frappe.db.get_value(
|
||||
"CRM Contacts", {"contact": contact.name, "is_primary": 1}, "parent"
|
||||
)
|
||||
if are_same_phone_number(contact.mobile_no, phone_number, validate=not exact_match):
|
||||
if are_same_phone_number(contact.mobile_no, phone_number, country, validate=not exact_match):
|
||||
contact["deal"] = deal
|
||||
return contact
|
||||
# Else, return the first contact
|
||||
if are_same_phone_number(contacts[0].mobile_no, phone_number, validate=not exact_match):
|
||||
if are_same_phone_number(contacts[0].mobile_no, phone_number, country, validate=not exact_match):
|
||||
return contacts[0]
|
||||
|
||||
# Else, Check if the number is associated with a lead
|
||||
@ -173,7 +173,7 @@ def get_contact(phone_number, exact_match=False):
|
||||
|
||||
if len(leads):
|
||||
for lead in leads:
|
||||
if are_same_phone_number(lead.mobile_no, phone_number, validate=not exact_match):
|
||||
if are_same_phone_number(lead.mobile_no, phone_number, country, validate=not exact_match):
|
||||
lead["lead"] = lead.name
|
||||
lead["full_name"] = lead.lead_name
|
||||
return lead
|
||||
|
||||
@ -242,19 +242,18 @@ def get_call_log_status(call_payload, direction="inbound"):
|
||||
elif status == "failed":
|
||||
return "Failed"
|
||||
|
||||
status = call_payload.get("DialCallStatus")
|
||||
call_type = call_payload.get("CallType")
|
||||
dial_call_status = call_payload.get("DialCallStatus")
|
||||
status = call_payload.get("DialCallStatus") or call_payload.get("Status")
|
||||
|
||||
if call_type == "incomplete" and dial_call_status == "no-answer":
|
||||
if call_type == "incomplete" and status == "no-answer":
|
||||
status = "No Answer"
|
||||
elif call_type == "client-hangup" and dial_call_status == "canceled":
|
||||
elif call_type == "client-hangup" and status == "canceled":
|
||||
status = "Canceled"
|
||||
elif call_type == "incomplete" and dial_call_status == "failed":
|
||||
elif call_type == "incomplete" and status == "failed":
|
||||
status = "Failed"
|
||||
elif call_type == "completed":
|
||||
status = "Completed"
|
||||
elif dial_call_status == "busy":
|
||||
elif status == "busy":
|
||||
status = "Ringing"
|
||||
|
||||
return status
|
||||
@ -272,14 +271,12 @@ def update_call_log(call_payload, status="Ringing", call_log=None):
|
||||
call_log.duration = (
|
||||
call_payload.get("DialCallDuration") or call_payload.get("ConversationDuration") or 0
|
||||
)
|
||||
call_log.recording_url = call_payload.get("RecordingUrl")
|
||||
call_log.recording_url = call_payload.get("RecordingUrl") if call_payload.get("RecordingUrl") else ""
|
||||
call_log.start_time = call_payload.get("StartTime")
|
||||
call_log.end_time = call_payload.get("EndTime")
|
||||
|
||||
if direction == "incoming" and call_payload.get("AgentEmail"):
|
||||
call_log.receiver = call_payload.get("AgentEmail")
|
||||
else:
|
||||
call_log.caller = frappe.session.user
|
||||
|
||||
call_log.save(ignore_permissions=True)
|
||||
frappe.db.commit()
|
||||
|
||||
6392
crm/locale/ar.po
Normal file
6392
crm/locale/ar.po
Normal file
File diff suppressed because it is too large
Load Diff
6398
crm/locale/bs.po
Normal file
6398
crm/locale/bs.po
Normal file
File diff suppressed because it is too large
Load Diff
6392
crm/locale/cs.po
Normal file
6392
crm/locale/cs.po
Normal file
File diff suppressed because it is too large
Load Diff
6392
crm/locale/da.po
Normal file
6392
crm/locale/da.po
Normal file
File diff suppressed because it is too large
Load Diff
6392
crm/locale/de.po
Normal file
6392
crm/locale/de.po
Normal file
File diff suppressed because it is too large
Load Diff
6392
crm/locale/eo.po
Normal file
6392
crm/locale/eo.po
Normal file
File diff suppressed because it is too large
Load Diff
6392
crm/locale/es.po
Normal file
6392
crm/locale/es.po
Normal file
File diff suppressed because it is too large
Load Diff
6392
crm/locale/fa.po
Normal file
6392
crm/locale/fa.po
Normal file
File diff suppressed because it is too large
Load Diff
6392
crm/locale/fr.po
Normal file
6392
crm/locale/fr.po
Normal file
File diff suppressed because it is too large
Load Diff
6398
crm/locale/hr.po
Normal file
6398
crm/locale/hr.po
Normal file
File diff suppressed because it is too large
Load Diff
6392
crm/locale/hu.po
Normal file
6392
crm/locale/hu.po
Normal file
File diff suppressed because it is too large
Load Diff
6392
crm/locale/id.po
Normal file
6392
crm/locale/id.po
Normal file
File diff suppressed because it is too large
Load Diff
6392
crm/locale/it.po
Normal file
6392
crm/locale/it.po
Normal file
File diff suppressed because it is too large
Load Diff
6396
crm/locale/main.pot
Normal file
6396
crm/locale/main.pot
Normal file
File diff suppressed because it is too large
Load Diff
6392
crm/locale/nb.po
Normal file
6392
crm/locale/nb.po
Normal file
File diff suppressed because it is too large
Load Diff
6392
crm/locale/nl.po
Normal file
6392
crm/locale/nl.po
Normal file
File diff suppressed because it is too large
Load Diff
6392
crm/locale/pl.po
Normal file
6392
crm/locale/pl.po
Normal file
File diff suppressed because it is too large
Load Diff
6392
crm/locale/pt.po
Normal file
6392
crm/locale/pt.po
Normal file
File diff suppressed because it is too large
Load Diff
6392
crm/locale/pt_BR.po
Normal file
6392
crm/locale/pt_BR.po
Normal file
File diff suppressed because it is too large
Load Diff
6392
crm/locale/ru.po
Normal file
6392
crm/locale/ru.po
Normal file
File diff suppressed because it is too large
Load Diff
6392
crm/locale/sr.po
Normal file
6392
crm/locale/sr.po
Normal file
File diff suppressed because it is too large
Load Diff
6392
crm/locale/sr_CS.po
Normal file
6392
crm/locale/sr_CS.po
Normal file
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user