Compare commits
348 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2d4cc7e71f | ||
|
|
fba61abd2a | ||
|
|
94bfe8ea0d | ||
|
|
31619f0a83 | ||
|
|
34037e0d88 | ||
|
|
647102fc94 | ||
|
|
a533b33fc6 | ||
|
|
bd7f48cfd4 | ||
|
|
82cef59fb3 | ||
|
|
cc6ce5beac | ||
|
|
15d7224335 | ||
|
|
1f51e71827 | ||
|
|
539a826b37 | ||
|
|
0ec9b90113 | ||
|
|
49b275ad1d | ||
|
|
7957f0ecea | ||
|
|
3c55d89f7f | ||
|
|
d5fda57297 | ||
|
|
a85a1ff145 | ||
|
|
afb8ec9cb6 | ||
|
|
8b92de26f0 | ||
|
|
fcd4f2b86b | ||
|
|
1277a61dad | ||
|
|
767d5e48e7 | ||
|
|
ed11e93b25 | ||
|
|
1d702bf112 | ||
|
|
43cdf792f9 | ||
|
|
687888133b | ||
|
|
e0825aaea9 | ||
|
|
0a76b8b29a | ||
|
|
0277dbc6b6 | ||
|
|
93a69e9485 | ||
|
|
6e33d91443 | ||
|
|
07364f5ece | ||
|
|
1890c794d7 | ||
|
|
71a9be8add | ||
|
|
fd131a4210 | ||
|
|
1a943151d7 | ||
|
|
c761f1b0a1 | ||
|
|
e970ddcee9 | ||
|
|
51db2ba22a | ||
|
|
cbc18ffdbf | ||
|
|
5b7d0a960e | ||
|
|
172efb1e87 | ||
|
|
95760a7db6 | ||
|
|
9c24bec654 | ||
|
|
7c0a58ac3f | ||
|
|
77e4f6b774 | ||
|
|
5bedd649df | ||
|
|
7207d21962 | ||
|
|
c118fc9343 | ||
|
|
bad13369d4 | ||
|
|
bf225c11b4 | ||
|
|
694edbc89a | ||
|
|
6406f8bda0 | ||
|
|
2901e14c59 | ||
|
|
5204eeedf7 | ||
|
|
ee8f88d641 | ||
|
|
b2206d1155 | ||
|
|
c54e25b5c7 | ||
|
|
6e36a48521 | ||
|
|
eca2e42ecb | ||
|
|
d7f7d5c9db | ||
|
|
37b0f7ca47 | ||
|
|
f4d5a66162 | ||
|
|
a84186c209 | ||
|
|
eb4c299bdb | ||
|
|
5b1b2fb858 | ||
|
|
eba9ca4d66 | ||
|
|
01de945388 | ||
|
|
79872bf62c | ||
|
|
c8ac3b042b | ||
|
|
f76853a8d9 | ||
|
|
323dc96c99 | ||
|
|
2563f404d2 | ||
|
|
29b565fdf5 | ||
|
|
2ea5c6913d | ||
|
|
5dcb40bc96 | ||
|
|
c07489a096 | ||
|
|
39e2c2bb09 | ||
|
|
e1a1c8ac31 | ||
|
|
28a6578ba2 | ||
|
|
932cf08aee | ||
|
|
47c2aa179b | ||
|
|
f7e9a9d786 | ||
|
|
04230cb656 | ||
|
|
54abf025b7 | ||
|
|
39ac535bdb | ||
|
|
dd74b5d44f | ||
|
|
afe85bdd04 | ||
|
|
e4b44a86a6 | ||
|
|
a1ccab81a0 | ||
|
|
cf3b318f7d | ||
|
|
568054ab96 | ||
|
|
0d207706c1 | ||
|
|
3d5a6af1ae | ||
|
|
79a994e895 | ||
|
|
20cdaadcd4 | ||
|
|
a2eccf08a1 | ||
|
|
6f62ecab73 | ||
|
|
463f71c6eb | ||
|
|
cea6b09d44 | ||
|
|
b4be679639 | ||
|
|
c51ef85dd8 | ||
|
|
3fc4e7c53f | ||
|
|
1d21274d65 | ||
|
|
ccddc48ced | ||
|
|
c9b7824573 | ||
|
|
e50c5321df | ||
|
|
c690b24a7d | ||
|
|
9a24abe5e9 | ||
|
|
c5d41eb22a | ||
|
|
47fd5e0ff0 | ||
|
|
bb7e499cbd | ||
|
|
cb66d3a8c9 | ||
|
|
43a62ad0f0 | ||
|
|
e6b52bbb43 | ||
|
|
6811e73b53 | ||
|
|
5cd9193a2b | ||
|
|
a613ea8abf | ||
|
|
d737390b80 | ||
|
|
20bf7375f4 | ||
|
|
fb0b24af78 | ||
|
|
002fa6c1d9 | ||
|
|
dbbc3eb8a6 | ||
|
|
c2c9124af8 | ||
|
|
5b19aeecb4 | ||
|
|
dd2f0330a6 | ||
|
|
61673aafd4 | ||
|
|
d4507ac6a0 | ||
|
|
7c8dc38f15 | ||
|
|
aa8745378a | ||
|
|
2b986d3b02 | ||
|
|
3fb5340188 | ||
|
|
05aa3b391e | ||
|
|
e095eeb084 | ||
|
|
7633aca7c1 | ||
|
|
6f9afffd8a | ||
|
|
7425af6968 | ||
|
|
de15a26cab | ||
|
|
5ac22ce6a1 | ||
|
|
20105d8a0d | ||
|
|
6d8688f8b4 | ||
|
|
9824e22ce1 | ||
|
|
34d2822483 | ||
|
|
787e59c37e | ||
|
|
77532cc8db | ||
|
|
c978b9c36a | ||
|
|
31608a82f8 | ||
|
|
4f0bfcd287 | ||
|
|
54673f8d1d | ||
|
|
4da17348fd | ||
|
|
aee26219ed | ||
|
|
8b63b1221f | ||
|
|
6bf3c7453b | ||
|
|
681c9dde84 | ||
|
|
34fb5cf0e2 | ||
|
|
0e2f9ee44c | ||
|
|
0bcd9efa88 | ||
|
|
b46069d44b | ||
|
|
329e7783bc | ||
|
|
2e3d2b8426 | ||
|
|
66eaf7e1c3 | ||
|
|
23ee568564 | ||
|
|
ad42d2f67a | ||
|
|
1bf440b03a | ||
|
|
9bf2df9303 | ||
|
|
986f6a71ec | ||
|
|
26cb8baef0 | ||
|
|
975dcc2bf3 | ||
|
|
1bc6a73878 | ||
|
|
f7caad8ecb | ||
|
|
27e8ae0ff9 | ||
|
|
a88912a2f5 | ||
|
|
10d634b016 | ||
|
|
e23e99f4bd | ||
|
|
075b9626cf | ||
|
|
025a407e13 | ||
|
|
cbebb4b8ba | ||
|
|
3ade883fd9 | ||
|
|
403ad48364 | ||
|
|
69f9975748 | ||
|
|
df2783dbb0 | ||
|
|
a940b6d149 | ||
|
|
0a0c78729f | ||
|
|
276d3e60bd | ||
|
|
c22e525a14 | ||
|
|
2ffea6ba94 | ||
|
|
6fc408e974 | ||
|
|
ed0723c6fe | ||
|
|
766f6a43d5 | ||
|
|
1664668b0e | ||
|
|
3ba22676bf | ||
|
|
db7a56b453 | ||
|
|
cb98d9ec5f | ||
|
|
b109ee96de | ||
|
|
eba7aa496c | ||
|
|
108bc78693 | ||
|
|
c85112b093 | ||
|
|
4a3140102c | ||
|
|
6ef1fb6b39 | ||
|
|
de6b30c7ac | ||
|
|
1c32d05601 | ||
|
|
659bc1aca4 | ||
|
|
226a101119 | ||
|
|
5dfd1d48fa | ||
|
|
c9af48af35 | ||
|
|
d8ac0f3df7 | ||
|
|
af2bf7541f | ||
|
|
d070d56f72 | ||
|
|
cc5632a99c | ||
|
|
7be0b47778 | ||
|
|
5facb60bbe | ||
|
|
56b5387dbd | ||
|
|
9743d688d0 | ||
|
|
1d5f8d4436 | ||
|
|
063a88f057 | ||
|
|
6cb8662bec | ||
|
|
74dfabbe21 | ||
|
|
4096603656 | ||
|
|
574415b59b | ||
|
|
0eee6bbf7e | ||
|
|
ed72a28e41 | ||
|
|
4e0908d055 | ||
|
|
3c2ffde95b | ||
|
|
2c021dcdcd | ||
|
|
1ee5ae1e25 | ||
|
|
0aadb9e213 | ||
|
|
a0693983cc | ||
|
|
6b71ef5843 | ||
|
|
602683fdc0 | ||
|
|
1eea26fc5c | ||
|
|
c040075bd4 | ||
|
|
a2afb16f6b | ||
|
|
bdab0eea0f | ||
|
|
ba5d6b5004 | ||
|
|
5b13b99441 | ||
|
|
a3e87c7af1 | ||
|
|
31e2a709d5 | ||
|
|
e083cde3d7 | ||
|
|
09fc4a456e | ||
|
|
4774c41958 | ||
|
|
03e7e581d8 | ||
|
|
e88ffe032e | ||
|
|
ea8bc8ecb0 | ||
|
|
a40c6282a1 | ||
|
|
570d1783f9 | ||
|
|
2076203fc1 | ||
|
|
d7b7f74ac9 | ||
|
|
d27308d1cd | ||
|
|
06a82d4e1f | ||
|
|
f9eff57531 | ||
|
|
e64fbd6d3c | ||
|
|
88e709e1f0 | ||
|
|
988a1ab419 | ||
|
|
13bf123b24 | ||
|
|
22b956d33c | ||
|
|
10be112e85 | ||
|
|
bb256e41d7 | ||
|
|
d35d74346d | ||
|
|
969d48a554 | ||
|
|
d8b15ebaf7 | ||
|
|
b55dd5b284 | ||
|
|
5760b79747 | ||
|
|
eb961370ff | ||
|
|
cb08d576f6 | ||
|
|
9f40a252fc | ||
|
|
aee8b5bcad | ||
|
|
f7980927a1 | ||
|
|
c1e1026486 | ||
|
|
7ae53657f9 | ||
|
|
a6a71216a8 | ||
|
|
51008f2abc | ||
|
|
c1e5cbb55d | ||
|
|
f41da5cfab | ||
|
|
2d0ef63e72 | ||
|
|
884d4cbc48 | ||
|
|
9602c394dd | ||
|
|
51ff2658cb | ||
|
|
dd1c3ba164 | ||
|
|
6b068e1367 | ||
|
|
b9dcf7f857 | ||
|
|
9ebbec5d9a | ||
|
|
bb9f59a051 | ||
|
|
f8de94b7c6 | ||
|
|
6626e32719 | ||
|
|
d55bdcf921 | ||
|
|
40a79de34d | ||
|
|
82a1561120 | ||
|
|
3505de037e | ||
|
|
d548ef8158 | ||
|
|
3ad37363ed | ||
|
|
d46abb49f3 | ||
|
|
c57517b201 | ||
|
|
8efeea9c59 | ||
|
|
bf9e8cfbcc | ||
|
|
096fc88200 | ||
|
|
d5dedb1808 | ||
|
|
e50f80302a | ||
|
|
9d44ac88f2 | ||
|
|
892a782e59 | ||
|
|
b166bcf50b | ||
|
|
0e2d1bd4ed | ||
|
|
f080003415 | ||
|
|
96e7c5a3bd | ||
|
|
4bad150cf0 | ||
|
|
76568f0e8e | ||
|
|
49febea6f5 | ||
|
|
a59e1792b5 | ||
|
|
28d6987455 | ||
|
|
56e19f3a8b | ||
|
|
b6b56453e1 | ||
|
|
d55d0c06e3 | ||
|
|
8681a95010 | ||
|
|
1f63747916 | ||
|
|
332ec15dd7 | ||
|
|
6f8dafbb5e | ||
|
|
d4073d50b2 | ||
|
|
88bcee78a7 | ||
|
|
cc2796e676 | ||
|
|
dbaf6b569b | ||
|
|
d37cef7f60 | ||
|
|
01293bb3a3 | ||
|
|
55ad42cfd0 | ||
|
|
381cec7b87 | ||
|
|
4c87497b7c | ||
|
|
9fdf2a8bfe | ||
|
|
f773f1f539 | ||
|
|
7b8a224dd0 | ||
|
|
e1482f1acc | ||
|
|
c98d244af0 | ||
|
|
ee19fc0c7f | ||
|
|
ee2129ce1c | ||
|
|
beed9ae4f8 | ||
|
|
50ddf921be | ||
|
|
3769d87240 | ||
|
|
15050e326c | ||
|
|
0f809426d2 | ||
|
|
adab5d308c | ||
|
|
824122c42a | ||
|
|
afda26e4f3 | ||
|
|
d6d354b5c3 | ||
|
|
7d310bd182 | ||
|
|
8b33a6cdc0 | ||
|
|
5e173c7106 | ||
|
|
c80796cdd5 | ||
|
|
fde03453e4 | ||
|
|
826e18a29f |
@@ -63,7 +63,7 @@ Your project neither promotes nor is associated with entities that currently fai
|
||||
|
||||
Use of the ERPNext name and logo is additionally allowed in the following situations:
|
||||
|
||||
All other ERPNext-related businesses or projects can use the ERPNext name and logo to refer to and explain their services, but they cannot use them as part of a product, project, service, domain, or company name and they cannot use them in any way that suggests an affiliation with or endorsement by the ERPNext or WebNotes or the ERPNext open source project. For example, a consulting company can describe its business as “123 Web Services, offering ERPNext consulting for small businesses,” but cannot call its business “The ERPNext Consulting Company.”
|
||||
All other ERPNext-related businesses or projects can use the ERPNext name and logo to refer to and explain their services, but they cannot use them as part of a product, project, service, domain, or company name and they cannot use them in any way that suggests an affiliation with or endorsement by ERPNext or Frappe Technologies or the ERPNext open source project. For example, a consulting company can describe its business as “123 Web Services, offering ERPNext consulting for small businesses,” but cannot call its business “The ERPNext Consulting Company.”
|
||||
|
||||
Similarly, it’s OK to use the ERPNext logo as part of a page that describes your products or services, but it is not OK to use it as part of your company or product logo or branding itself. Under no circumstances is it permitted to use ERPNext as part of a top-level domain name.
|
||||
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
from __future__ import unicode_literals
|
||||
__version__ = '6.13.1'
|
||||
__version__ = '6.20.0'
|
||||
|
||||
@@ -48,13 +48,13 @@ cur_frm.cscript.account_type = function(doc, cdt, cdn) {
|
||||
|
||||
cur_frm.cscript.add_toolbar_buttons = function(doc) {
|
||||
cur_frm.add_custom_button(__('Chart of Accounts'),
|
||||
function() { frappe.set_route("Accounts Browser", "Account"); }, 'icon-sitemap')
|
||||
function() { frappe.set_route("Accounts Browser", "Account"); }, __("View"))
|
||||
|
||||
if (doc.is_group == 1) {
|
||||
cur_frm.add_custom_button(__('Convert to non-Group'),
|
||||
cur_frm.add_custom_button(__('Group to Non-Group'),
|
||||
function() { cur_frm.cscript.convert_to_ledger(); }, 'icon-retweet', 'btn-default');
|
||||
} else if (cint(doc.is_group) == 0) {
|
||||
cur_frm.add_custom_button(__('View Ledger'), function() {
|
||||
cur_frm.add_custom_button(__('Ledger'), function() {
|
||||
frappe.route_options = {
|
||||
"account": doc.name,
|
||||
"from_date": sys_defaults.year_start_date,
|
||||
@@ -62,9 +62,9 @@ cur_frm.cscript.add_toolbar_buttons = function(doc) {
|
||||
"company": doc.company
|
||||
};
|
||||
frappe.set_route("query-report", "General Ledger");
|
||||
}, "icon-table");
|
||||
}, __("View"));
|
||||
|
||||
cur_frm.add_custom_button(__('Convert to Group'),
|
||||
cur_frm.add_custom_button(__('Group to Group'),
|
||||
function() { cur_frm.cscript.convert_to_group(); }, 'icon-retweet', 'btn-default')
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
"oldfieldtype": "Section Break",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -46,6 +47,7 @@
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -71,6 +73,7 @@
|
||||
"oldfieldtype": "Data",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
@@ -95,6 +98,7 @@
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -120,6 +124,7 @@
|
||||
"options": "Company",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
@@ -143,6 +148,7 @@
|
||||
"options": "\nAsset\nLiability\nIncome\nExpense\nEquity",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -166,6 +172,7 @@
|
||||
"options": "\nBalance Sheet\nProfit and Loss",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -191,6 +198,7 @@
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -212,6 +220,7 @@
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -238,6 +247,7 @@
|
||||
"options": "Account",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
@@ -261,9 +271,10 @@
|
||||
"no_copy": 0,
|
||||
"oldfieldname": "account_type",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "\nBank\nCash\nTax\nChargeable\nWarehouse\nReceivable\nPayable\nEquity\nFixed Asset\nCost of Goods Sold\nExpense Account\nRound Off\nIncome Account\nStock Received But Not Billed\nExpenses Included In Valuation\nStock Adjustment\nStock\nTemporary",
|
||||
"options": "\nBank\nCash\nDepreciation\nTax\nChargeable\nWarehouse\nReceivable\nPayable\nEquity\nFixed Asset\nCost of Goods Sold\nExpense Account\nRound Off\nIncome Account\nStock Received But Not Billed\nExpenses Included In Valuation\nStock Adjustment\nStock\nTemporary",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -289,6 +300,7 @@
|
||||
"oldfieldtype": "Currency",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -315,6 +327,7 @@
|
||||
"options": "No\nYes",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -338,6 +351,7 @@
|
||||
"options": "Warehouse",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -361,6 +375,7 @@
|
||||
"options": "\nDebit\nCredit",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -383,6 +398,7 @@
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -405,6 +421,7 @@
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -427,6 +444,7 @@
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -445,7 +463,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2015-11-16 06:29:41.535663",
|
||||
"modified": "2015-12-12 10:19:54.365839",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Account",
|
||||
|
||||
@@ -23,8 +23,11 @@ class Account(Document):
|
||||
frappe.db.get_value("Company", self.company, "abbr")
|
||||
|
||||
def validate(self):
|
||||
if frappe.local.flags.allow_unverified_charts:
|
||||
return
|
||||
self.validate_parent()
|
||||
self.validate_root_details()
|
||||
self.validate_group_or_ledger()
|
||||
self.set_root_and_report_type()
|
||||
self.validate_mandatory()
|
||||
self.validate_warehouse_account()
|
||||
@@ -78,6 +81,20 @@ class Account(Document):
|
||||
|
||||
if not self.parent_account and not self.is_group:
|
||||
frappe.throw(_("Root Account must be a group"))
|
||||
|
||||
def validate_group_or_ledger(self):
|
||||
if self.get("__islocal"):
|
||||
return
|
||||
|
||||
existing_is_group = frappe.db.get_value("Account", self.name, "is_group")
|
||||
if self.is_group != existing_is_group:
|
||||
if self.check_gle_exists():
|
||||
throw(_("Account with existing transaction cannot be converted to ledger"))
|
||||
elif self.is_group:
|
||||
if self.account_type:
|
||||
throw(_("Cannot covert to Group because Account Type is selected."))
|
||||
elif self.check_if_child_exists():
|
||||
throw(_("Account with child nodes cannot be set as ledger"))
|
||||
|
||||
def validate_frozen_accounts_modifier(self):
|
||||
old_value = frappe.db.get_value("Account", self.name, "freeze_account")
|
||||
@@ -199,6 +216,10 @@ class Account(Document):
|
||||
|
||||
if val != [self.is_group, self.root_type, self.company]:
|
||||
throw(_("""Merging is only possible if following properties are same in both records. Is Group, Root Type, Company"""))
|
||||
|
||||
if self.is_group and frappe.db.get_value("Account", new, "parent_account") == old:
|
||||
frappe.db.set_value("Account", new, "parent_account",
|
||||
frappe.db.get_value("Account", old, "parent_account"))
|
||||
|
||||
return new_account
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ from unidecode import unidecode
|
||||
|
||||
def create_charts(chart_name, company):
|
||||
chart = get_chart(chart_name)
|
||||
|
||||
|
||||
if chart:
|
||||
accounts = []
|
||||
|
||||
@@ -40,9 +40,9 @@ def create_charts(chart_name, company):
|
||||
"account_currency": frappe.db.get_value("Company", company, "default_currency")
|
||||
})
|
||||
|
||||
if root_account:
|
||||
if root_account or frappe.local.flags.allow_unverified_charts:
|
||||
account.flags.ignore_mandatory = True
|
||||
|
||||
|
||||
account.insert()
|
||||
|
||||
accounts.append(account_name_in_db)
|
||||
@@ -67,13 +67,17 @@ def get_chart(chart_name):
|
||||
from erpnext.accounts.doctype.account.chart_of_accounts.verified import standard_chart_of_accounts
|
||||
return standard_chart_of_accounts.get()
|
||||
else:
|
||||
path = os.path.join(os.path.dirname(__file__), "verified")
|
||||
for fname in os.listdir(path):
|
||||
if fname.endswith(".json"):
|
||||
with open(os.path.join(path, fname), "r") as f:
|
||||
chart = f.read()
|
||||
if chart and json.loads(chart).get("name") == chart_name:
|
||||
return json.loads(chart).get("tree")
|
||||
folders = ("verified",)
|
||||
if frappe.local.flags.allow_unverified_charts:
|
||||
folders = ("verified", "unverified")
|
||||
for folder in folders:
|
||||
path = os.path.join(os.path.dirname(__file__), folder)
|
||||
for fname in os.listdir(path):
|
||||
if fname.endswith(".json"):
|
||||
with open(os.path.join(path, fname), "r") as f:
|
||||
chart = f.read()
|
||||
if chart and json.loads(chart).get("name") == chart_name:
|
||||
return json.loads(chart).get("tree")
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_charts_for_country(country):
|
||||
@@ -82,24 +86,22 @@ def get_charts_for_country(country):
|
||||
def _get_chart_name(content):
|
||||
if content:
|
||||
content = json.loads(content)
|
||||
if content and content.get("is_active", "No") == "Yes" and content.get("disabled", "No") == "No":
|
||||
if content and content.get("disabled", "No") == "No":
|
||||
charts.append(content["name"])
|
||||
|
||||
country_code = frappe.db.get_value("Country", country, "code")
|
||||
if country_code:
|
||||
path = os.path.join(os.path.dirname(__file__), "verified")
|
||||
for fname in os.listdir(path):
|
||||
if fname.startswith(country_code) and fname.endswith(".json"):
|
||||
with open(os.path.join(path, fname), "r") as f:
|
||||
_get_chart_name(f.read())
|
||||
folders = ("verified",)
|
||||
if frappe.local.flags.allow_unverified_charts:
|
||||
folders = ("verified", "unverified")
|
||||
|
||||
# countries_use_OHADA_system = ["Benin", "Burkina Faso", "Cameroon", "Central African Republic", "Comoros",
|
||||
# "Congo", "Ivory Coast", "Gabon", "Guinea", "Guinea Bissau", "Equatorial Guinea", "Mali", "Niger",
|
||||
# "Replica of Democratic Congo", "Senegal", "Chad", "Togo"]
|
||||
#
|
||||
# if country in countries_use_OHADA_system:
|
||||
# with open(os.path.join(os.path.dirname(__file__), "syscohada_syscohada_chart_template.json"), "r") as f:
|
||||
# _get_chart_name(f.read())
|
||||
for folder in folders:
|
||||
path = os.path.join(os.path.dirname(__file__), folder)
|
||||
|
||||
for fname in os.listdir(path):
|
||||
if fname.startswith(country_code) and fname.endswith(".json"):
|
||||
with open(os.path.join(path, fname), "r") as f:
|
||||
_get_chart_name(f.read())
|
||||
|
||||
if len(charts) != 1:
|
||||
charts.append("Standard")
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"country_code": "at",
|
||||
"name": "Austria - Chart of Accounts",
|
||||
"is_active": "Yes",
|
||||
"tree": {
|
||||
"Summe Abschreibungen und Aufwendungen": {
|
||||
"7010 bis 7080 Abschreibungen auf das Anlageverm\u00f6gen (ausgenommen Finanzanlagen)": {},
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"country_code": "be",
|
||||
"name": "Belgian PCMN",
|
||||
"disabled": "Yes",
|
||||
"tree": {
|
||||
"CLASSE 1": {
|
||||
"BENEFICE (PERTE) REPORTE(E)": {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"country_code": "br",
|
||||
"name": "Planilha de Contas Brasileira",
|
||||
"is_active": "No",
|
||||
"tree": {
|
||||
"ATIVO": {
|
||||
"CIRCULANTE": {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"country_code": "ca",
|
||||
"name": "Chart of Accounts for english-speaking provinces",
|
||||
"is_active": "Yes",
|
||||
"tree": {
|
||||
"ASSETS": {
|
||||
"CURRENT ASSETS": {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"country_code": "ca",
|
||||
"name": "Plan comptable pour les provinces francophones",
|
||||
"is_active": "Yes",
|
||||
"tree": {
|
||||
"ACTIF": {
|
||||
"ACTIFS COURANTS": {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"country_code": "ch",
|
||||
"name": "Plan comptable STERCHI",
|
||||
"is_active": "Yes",
|
||||
"disabled": "Yes",
|
||||
"tree": {
|
||||
"Actif": {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"country_code": "co",
|
||||
"name": "Unique Account Chart - PUC",
|
||||
"is_active": "Yes",
|
||||
"tree": {
|
||||
"ACTIVO": {
|
||||
"DEUDORES": {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"country_code": "cr",
|
||||
"name": "Costa Rica - Company 0",
|
||||
"is_active": "Yes",
|
||||
"tree": {
|
||||
"0-Activo": {
|
||||
"0-Activo circulante": {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"country_code": "cr",
|
||||
"name": "Costa Rica - Company 1",
|
||||
"is_active": "Yes",
|
||||
"tree": {
|
||||
"xActivo": {
|
||||
"root_type": "Asset",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"country_code": "de",
|
||||
"name": "Deutscher Kontenplan SKR04",
|
||||
"is_active": "Yes",
|
||||
"disabled": "Yes",
|
||||
"tree": {
|
||||
"Bilanz - Aktiva": {
|
||||
"Anlageverm\u00f6gen": {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"country_code": "de",
|
||||
"name": "Deutscher Kontenplan SKR03",
|
||||
"is_active": "No",
|
||||
"disabled": "Yes",
|
||||
"tree": {
|
||||
"Aktiva": {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"country_code": "es",
|
||||
"name": "PGCE com\u00fan",
|
||||
"disabled": "Yes",
|
||||
"tree": {
|
||||
"Acreedores y deudores por operaciones comerciales": {
|
||||
"Acreedores varios": {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"country_code": "et",
|
||||
"name": "Ethiopia Tax and Account Chart Template",
|
||||
"is_active": "Yes",
|
||||
"tree": {
|
||||
"ASSETS": {
|
||||
"Cash and Cash Equivalents": {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"country_code": "gt",
|
||||
"name": "Plantilla de cuentas de Guatemala (sencilla)",
|
||||
"is_active": "Yes",
|
||||
"tree": {
|
||||
"Activo": {
|
||||
"Activo Corriente": {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"country_code": "hn",
|
||||
"name": "Plantilla de cuentas de Honduras (sencilla)",
|
||||
"is_active": "Yes",
|
||||
"tree": {
|
||||
"Activo": {
|
||||
"Activo Corriente": {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"country_code": "lu",
|
||||
"name": "PCMN Luxembourg",
|
||||
"disabled": "Yes",
|
||||
"tree": {
|
||||
"TOTAL CLASSES 1 A 5": {
|
||||
"CLASSE 1 - COMPTES DE CAPITAUX, DE PROVISIONS ET DE DETTES FINANCIERES": {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"country_code": "pa",
|
||||
"name": "Plan de Cuentas",
|
||||
"is_active": "Yes",
|
||||
"tree": {
|
||||
"ACTIVOS": {
|
||||
"Activo Fijo": {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"country_code": "ro",
|
||||
"name": "Romania - Chart of Accounts",
|
||||
"disabled": "Yes",
|
||||
"tree": {
|
||||
"CONTURI FINANCIARE": {
|
||||
"CONTURI DE BILANT": {
|
||||
|
||||
@@ -1,223 +0,0 @@
|
||||
{
|
||||
"country_code": "sg",
|
||||
"name": "Singapore Chart of Accounts",
|
||||
"is_active": "Yes",
|
||||
"tree": {
|
||||
"Assets": {
|
||||
"Cash and cash equivalents": {
|
||||
"Cash on hand": {
|
||||
"account_type": "Cash"
|
||||
},
|
||||
"Client trust account": {
|
||||
"account_type": "Cash"
|
||||
},
|
||||
"Current": {
|
||||
"account_type": "Bank"
|
||||
},
|
||||
"Money market": {
|
||||
"account_type": "Cash"
|
||||
},
|
||||
"Rents held in trust": {
|
||||
"account_type": "Cash"
|
||||
},
|
||||
"Savings": {
|
||||
"account_type": "Cash"
|
||||
},
|
||||
"account_type": "Cash"
|
||||
},
|
||||
"Current assets": {
|
||||
"Allowance for bad debts": {},
|
||||
"Development costs": {},
|
||||
"Employee cash advances": {},
|
||||
"Inventory": {},
|
||||
"Investments - other": {},
|
||||
"Loans to officers": {},
|
||||
"Loans to others": {},
|
||||
"Loans to shareholders": {},
|
||||
"Other Current Assets": {},
|
||||
"Prepaid expenses": {},
|
||||
"Retainage": {},
|
||||
"Undeposited funds": {}
|
||||
},
|
||||
"Non-current assets": {
|
||||
"Accumulated amortization of non-current assets": {},
|
||||
"Available-for-sale financial assets": {},
|
||||
"Deferred tax": {},
|
||||
"Goodwill": {},
|
||||
"Intangible Assets": {},
|
||||
"Investments": {},
|
||||
"Lease Buyout": {},
|
||||
"Licences": {},
|
||||
"Organisational costs": {},
|
||||
"Other intangible assets": {},
|
||||
"Other non-current assets": {},
|
||||
"Prepayments and accrued income": {},
|
||||
"Security Deposits": {}
|
||||
},
|
||||
"Property, plant and equipment": {
|
||||
"Accumulated amortisation": {},
|
||||
"Accumulated depletion": {},
|
||||
"Accumulated depreciation": {},
|
||||
"Buildings": {},
|
||||
"Depletable assets": {},
|
||||
"Furniture and fixtures": {},
|
||||
"Leasehold improvements": {},
|
||||
"Machinery and equipment": {},
|
||||
"Other Assets": {},
|
||||
"Vehicles": {}
|
||||
},
|
||||
"Purchase Tax Receivable": {
|
||||
"Purchase Tax Account 0% EP": {},
|
||||
"Purchase Tax Account 0% ME": {},
|
||||
"Purchase Tax Account 0% NR": {},
|
||||
"Purchase Tax Account 0% OP": {},
|
||||
"Purchase Tax Account 0% ZP": {},
|
||||
"Purchase Tax Account 7% BL": {},
|
||||
"Purchase Tax Account 7% IM": {},
|
||||
"Purchase Tax Account 7% TX-E33": {},
|
||||
"Purchase Tax Account 7% TX-N33": {},
|
||||
"Purchase Tax Account 7% TX-RE": {},
|
||||
"Purchase Tax Account 7% TX7": {},
|
||||
"Purchase Tax Account MES": {}
|
||||
},
|
||||
"Trade and other receivable": {
|
||||
"Other Receivable Account": {
|
||||
"account_type": "Receivable"
|
||||
},
|
||||
"Trade Receivable Account": {
|
||||
"account_type": "Receivable"
|
||||
},
|
||||
"account_type": "Receivable"
|
||||
},
|
||||
"root_type": "Asset"
|
||||
},
|
||||
"Liabilities": {
|
||||
"Current liabilities": {
|
||||
"Client Trust Accounts - Liabilities": {},
|
||||
"Current Tax Liability": {},
|
||||
"Current portion of employee benefits obligations": {},
|
||||
"Current portion of obligations under finance leases": {},
|
||||
"GST Payable": {},
|
||||
"Insurance Payable": {},
|
||||
"Interest payables": {},
|
||||
"Line of Credit": {},
|
||||
"Loan Payable": {},
|
||||
"Payroll Clearing": {},
|
||||
"Payroll liabilities": {},
|
||||
"Prepaid Expenses Payable": {},
|
||||
"Provision for warranty obligations": {},
|
||||
"Rents in trust - Liability": {},
|
||||
"Short term borrowings": {}
|
||||
},
|
||||
"Equity": {
|
||||
"Accumulated Adjustment": {},
|
||||
"Opening Balance Equity": {},
|
||||
"Ordinary shares": {},
|
||||
"Owner's Equity": {},
|
||||
"Paid-in capital or surplus": {},
|
||||
"Partner's Equity": {},
|
||||
"Preferred shares": {},
|
||||
"Retained Earnings": {},
|
||||
"Share capital": {},
|
||||
"Treasury Shares": {}
|
||||
},
|
||||
"Non-current liabilities": {
|
||||
"Accruals and Deferred Income": {},
|
||||
"Bank loans": {},
|
||||
"Long term borrowings": {},
|
||||
"Long term employee benefit obligations": {},
|
||||
"Notes Payable": {},
|
||||
"Obligations under finance leases": {},
|
||||
"Other non-current liabilities": {},
|
||||
"Shareholder Notes Payable": {}
|
||||
},
|
||||
"Sale Tax Payables": {
|
||||
" Sales Tax Account 0% ES33": {},
|
||||
"Sales Tax Account 0% ESN33": {},
|
||||
"Sales Tax Account 0% OS": {},
|
||||
"Sales Tax Account 0% ZR": {},
|
||||
"Sales Tax Account 7% DS": {},
|
||||
"Sales Tax Account 7% SR": {}
|
||||
},
|
||||
"Trade and other payables": {
|
||||
"Other Payable Account": {
|
||||
"account_type": "Payable"
|
||||
},
|
||||
"Trade Payable Account": {
|
||||
"account_type": "Payable"
|
||||
},
|
||||
"account_type": "Payable"
|
||||
},
|
||||
"root_type": "Liability"
|
||||
},
|
||||
"Cost of sales": {
|
||||
"Cost of Good Sold": {
|
||||
"Cost of Labour - COS": {},
|
||||
"Equipment rental - COS": {},
|
||||
"Freight and delivery - COS": {},
|
||||
"Other costs of sales - COS": {},
|
||||
"Supplies and materials - COS": {}
|
||||
},
|
||||
"root_type": "Expense"
|
||||
},
|
||||
"Income": {
|
||||
"Other revenue": {
|
||||
"Dividend revenue": {},
|
||||
"Gain/loss on sale of fixed assets or investments": {},
|
||||
"Interest earned": {},
|
||||
"Other investment revenue": {},
|
||||
"Other miscellaneous revenue": {},
|
||||
"Tax-exempt interest": {}
|
||||
},
|
||||
"Revenue": {
|
||||
"Discounts/refunds given": {},
|
||||
"Non-profit revenue": {},
|
||||
"Other primary revenue": {},
|
||||
"Sales of product revenue": {},
|
||||
"Service/fee revenue": {},
|
||||
"Unapplied cash payment income": {}
|
||||
},
|
||||
"root_type": "Income"
|
||||
},
|
||||
"Indirect Expenses": {
|
||||
"Expenses": {
|
||||
"Administrative expenses": {},
|
||||
"Advertising/promotional": {},
|
||||
"Auto": {},
|
||||
"Bad debts": {},
|
||||
"Bank charges": {},
|
||||
"Charitable contributions": {},
|
||||
"Cost of labour": {},
|
||||
"Distribution costs": {},
|
||||
"Dues and subscriptions": {},
|
||||
"Entertainment": {},
|
||||
"Equipment rental": {},
|
||||
"Finance costs": {},
|
||||
"Insurance": {},
|
||||
"Interest paid": {},
|
||||
"Legal and professional fees": {},
|
||||
"Meals and entertainment": {},
|
||||
"Other miscellaneous service cost": {},
|
||||
"Payroll expenses": {},
|
||||
"Promotional meals": {},
|
||||
"Rent or lease of buildings": {},
|
||||
"Repair and maintenance": {},
|
||||
"Shipping, freight, and delivery": {},
|
||||
"Supplies": {},
|
||||
"Taxes paid": {},
|
||||
"Travel": {},
|
||||
"Travel meals": {},
|
||||
"Unapplied cash bill payment expense": {},
|
||||
"Utilities": {}
|
||||
},
|
||||
"Other Expenses": {
|
||||
"Amortisation": {},
|
||||
"Depreciation": {},
|
||||
"Exchange Gain or Loss": {},
|
||||
"Other Expense": {},
|
||||
"Penalties and settlements": {}
|
||||
},
|
||||
"root_type": "Expense"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"country_code": "si",
|
||||
"name": "Kontni na\u010drt za gospodarske dru\u017ebe",
|
||||
"disabled": "Yes",
|
||||
"tree": {
|
||||
"DOLGORO\u010cNA SREDSTVA": {
|
||||
"DANA DOLGORO\u010cNA POSOJILA IN TERJATVE ZA NEVPLA\u010cANI VPOKLICANI KAPITAL": {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"country_code": "th",
|
||||
"name": "Thailand Chart of Accounts",
|
||||
"is_active": "Yes",
|
||||
"tree": {
|
||||
"Assets": {
|
||||
"Account Receivable": {},
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"country_code": "uy",
|
||||
"name": "Plan de Cuentas",
|
||||
"is_active": "Yes",
|
||||
"tree": {
|
||||
"ACTIVO": {
|
||||
"ACTIVO CORRIENTE": {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"country_code": "ae",
|
||||
"name": "U.A.E Chart of Accounts",
|
||||
"is_active": "Yes",
|
||||
"tree": {
|
||||
"Assets": {
|
||||
"Current Assets": {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"country_code": "gt",
|
||||
"name": "Cuentas de Guatemala",
|
||||
"is_active": "Yes",
|
||||
"tree": {
|
||||
"Activos": {
|
||||
"Activo Corriente": {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"country_code": "in",
|
||||
"name": "Chart of Accounts - India",
|
||||
"is_active": "Yes",
|
||||
"tree": {
|
||||
"Application of Funds (Assets)": {
|
||||
"Current Assets": {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"country_code": "ni",
|
||||
"name": "Catalogo de Cuentas Nicaragua",
|
||||
"is_active": "Yes",
|
||||
"tree": {
|
||||
"Activo": {
|
||||
"Activo Corriente": {
|
||||
|
||||
@@ -0,0 +1,273 @@
|
||||
{
|
||||
"country_code": "sg",
|
||||
"name": "Singapore Default Chart of Accounts",
|
||||
"tree": {
|
||||
"Assets": {
|
||||
"Current assets": {
|
||||
"Accounts Receivable": {
|
||||
"Credit Cards": {
|
||||
"AMEX Receivable": {},
|
||||
"CUP Receivale": {},
|
||||
"MC Receivable": {},
|
||||
"NETS Receivable": {},
|
||||
"VISA Receivable": {}
|
||||
},
|
||||
"Debtors": {
|
||||
"account_type": "Receivable"
|
||||
}
|
||||
},
|
||||
"Bank Accounts": {
|
||||
"Paypal Account": {
|
||||
"account_type": "Bank"
|
||||
},
|
||||
"account_type": "Bank"
|
||||
},
|
||||
"Cash in Hand": {
|
||||
"Cash in Transit": {
|
||||
"account_type": "Cash"
|
||||
},
|
||||
"Petty Cash": {
|
||||
"account_type": "Cash"
|
||||
}
|
||||
},
|
||||
"Loans and Advances-Assets": {
|
||||
"Prepayments": {}
|
||||
},
|
||||
"Securities and Deposits": {
|
||||
"Bank Guarantees": {},
|
||||
"Bank Deposits": {},
|
||||
"Rental Deposits": {}
|
||||
},
|
||||
"Stock Assets": {
|
||||
"account_type": "Stock",
|
||||
"is_group": 1
|
||||
},
|
||||
"Tax Assets": {
|
||||
"GST-Input": {}
|
||||
}
|
||||
},
|
||||
"Non-current assets": {
|
||||
"Fixed Assets": {
|
||||
"Accumulated Depreciation": {
|
||||
"AccDep-Equipment-ICT": {},
|
||||
"AccDep-Furniture and Fixtures": {},
|
||||
"AccDep-Equipment-Office": {},
|
||||
"AccDep-Motor Vehicle": {},
|
||||
"AccDep-Plant and Machinery": {}
|
||||
},
|
||||
"Equipment-ICT": {},
|
||||
"Furniture and Fixtures": {},
|
||||
"Equipment-Office": {},
|
||||
"Motor Vehicle": {},
|
||||
"Plant and Machinery": {}
|
||||
},
|
||||
"Non-Fixed Assets": {
|
||||
"Goodwill": {},
|
||||
"Investments": {
|
||||
"Investments-Associated Company": {},
|
||||
"Investments-Subsidiary": {}
|
||||
}
|
||||
},
|
||||
"Shares": {
|
||||
"Shares-Quoted": {},
|
||||
"Shares-Unquoted": {}
|
||||
}
|
||||
},
|
||||
"Temporary Accunts": {
|
||||
"Temporary Opening": {
|
||||
"account_type": "Temporary"
|
||||
}
|
||||
},
|
||||
"root_type": "Asset"
|
||||
},
|
||||
"Liabilities": {
|
||||
"Current liabilities": {
|
||||
"Accounts Payable": {
|
||||
"Creditors":{
|
||||
"account_type": "Payable"
|
||||
}
|
||||
},
|
||||
"Duties and Taxes": {
|
||||
"account_type": "Tax",
|
||||
"Deferred Tax Liabilities-Current": {},
|
||||
"GST-Output": {},
|
||||
"Income Tax Payable": {}
|
||||
},
|
||||
"Loans-Current": {
|
||||
"Amount Owing to Directors": {},
|
||||
"Bank Overdaft Account": {},
|
||||
"Secured Loans": {},
|
||||
"Unsecured Loans": {}
|
||||
},
|
||||
"Provision and Accruals": {
|
||||
"Accruals": {
|
||||
"Accr-CPF": {},
|
||||
"Accr-Sundry": {},
|
||||
"Accr-Withholding Tax": {}
|
||||
},
|
||||
"Provisions": {
|
||||
"Prov-Audit Fee": {},
|
||||
"Prov-Others": {},
|
||||
"Prov-Tax Fee": {},
|
||||
"Prov-Bonus": {
|
||||
"Prov-Bonus-Executive": {},
|
||||
"Prov-Bonus-Non Executive": {}
|
||||
}
|
||||
}
|
||||
},
|
||||
"Sponsorship Funds": {},
|
||||
"Stock Liabilities": {
|
||||
"Stock Received But Not Billed": {
|
||||
"account_type": "Stock Received But Not Billed"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Non-current liabilities": {
|
||||
"Deferred Tax Liabilities": {},
|
||||
"Loans-Non Current": {}
|
||||
},
|
||||
"Capital Account": {
|
||||
"Reserves and Surplus": {},
|
||||
"Shareholder Funds": {}
|
||||
},
|
||||
"root_type": "Liability"
|
||||
},
|
||||
"Equity": {
|
||||
"Share Capital": {},
|
||||
"Current Year Earnings": {},
|
||||
"Proposed Dividends": {},
|
||||
"Retained Earnings": {},
|
||||
"root_type": "Equity"
|
||||
},
|
||||
"Income": {
|
||||
"Direct Income": {
|
||||
"Management Income": {},
|
||||
"Sales Income": {}
|
||||
},
|
||||
"Indirect Income": {
|
||||
"Government Grants": {},
|
||||
"Interest Income": {
|
||||
"Current Account Interest Earned": {},
|
||||
"Fixed Deposit Interest Earned": {}
|
||||
},
|
||||
"Other Income": {},
|
||||
"Service Charges": {}
|
||||
},
|
||||
"root_type": "Income"
|
||||
},
|
||||
"Expenses": {
|
||||
"Expenses-Administrative": {
|
||||
"Audit Fees": {},
|
||||
"Bank charges and interest": {},
|
||||
"Currency Exchange Differences": {},
|
||||
"Insurance": {},
|
||||
"Interest on Loan": {},
|
||||
"Legal and Professional Fees": {},
|
||||
"Loss on Disposal of FA": {},
|
||||
"Postal and Courier Charges": {},
|
||||
"Printing and Stationery": {},
|
||||
"Secretarial Fees": {},
|
||||
"Tax Agent Fees": {}
|
||||
},
|
||||
"Expenses-Direct": {
|
||||
"Cost of Goods Sold": {
|
||||
"account_type": "Cost of Goods Sold"
|
||||
},
|
||||
"Cost of Sales": {},
|
||||
"Expenses Included in Valuation": {
|
||||
"account_type": "Expenses Included In Valuation"
|
||||
},
|
||||
"Stock Adjustment": {
|
||||
"account_type": "Stock Adjustment"
|
||||
}
|
||||
},
|
||||
"Expenses-Marketing": {
|
||||
"Advertising and Promotion": {},
|
||||
"Graphic Design Fees": {},
|
||||
"Internet Marketing": {}
|
||||
},
|
||||
"Expenses-Operating": {
|
||||
"Cleaning Costs": {},
|
||||
"Commission Charges": {
|
||||
"Comm-Credit Card": {},
|
||||
"Comm-NETS": {},
|
||||
"Comm-Paypal": {}
|
||||
},
|
||||
"Communication Costs": {
|
||||
"Internet Connection": {},
|
||||
"Telephone Costs": {}
|
||||
},
|
||||
"Entertainment Expenses": {},
|
||||
"General Expenses": {},
|
||||
"Licence Fees": {},
|
||||
"Rental Costs": {
|
||||
"Rental-Premises": {},
|
||||
"Rental-Equipment": {},
|
||||
"Rental-Storage": {}
|
||||
},
|
||||
"Repairs and Maintenance": {
|
||||
"R&M-ICT": {},
|
||||
"R&M-Building": {},
|
||||
"R&M-Fixtures & Furniture": {},
|
||||
"R&M-Office": {},
|
||||
"R&M-Plant & Machinery": {}
|
||||
},
|
||||
"Service Fees": {},
|
||||
"Subscription Fees": {
|
||||
"Publication Subscriptions": {},
|
||||
"TV Subscriptions": {}
|
||||
},
|
||||
"Travel Expenses": {},
|
||||
"Utilities": {
|
||||
"Utility-Electricity": {},
|
||||
"Utility-Gas": {},
|
||||
"Utility-Refuse Removal": {},
|
||||
"Utility-Water": {}
|
||||
}
|
||||
},
|
||||
"Expenses-Other": {
|
||||
"Bad Debts Written Off": {},
|
||||
"Depreciation": {
|
||||
"Dep-ICT Equipment": {},
|
||||
"Dep-Fixtures & Furniture": {},
|
||||
"Dep-Motor Vehicle": {},
|
||||
"Dep-Office Equipment": {},
|
||||
"Dep-Plant & Machinery": {},
|
||||
"Dep-Renovation": {}
|
||||
},
|
||||
"Donations": {},
|
||||
"Round Off": {},
|
||||
"Tax Expenses": {
|
||||
"Tax Expenses": {}
|
||||
}
|
||||
},
|
||||
"Expenses-Staff": {
|
||||
"Bonuses": {
|
||||
"Bonus-Executive": {},
|
||||
"Bonus-Non Executive": {},
|
||||
"Bonus-Performance": {}
|
||||
},
|
||||
"CPF": {},
|
||||
"Directors Fees": {},
|
||||
"FWL": {},
|
||||
"Incentives": {},
|
||||
"Medical Expenses": {},
|
||||
"Salaries": {
|
||||
"Casual Labour": {},
|
||||
"Salary-Executive": {},
|
||||
"Salary-Non Executive-Full Time": {},
|
||||
"Salary-Non Executive-Part Time": {}
|
||||
},
|
||||
"SDF": {},
|
||||
"Security Expenses": {},
|
||||
"Staff Advertising": {},
|
||||
"Staff Commission Paid": {},
|
||||
"Staff Meals": {},
|
||||
"Staff Training": {},
|
||||
"Staff Transport": {},
|
||||
"Staff Welfare": {}
|
||||
},
|
||||
"root_type": "Expense"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,343 @@
|
||||
{
|
||||
"country_code": "sg",
|
||||
"name": "Singapore F&B Chart of Accounts",
|
||||
"tree": {
|
||||
"Assets": {
|
||||
"Current assets": {
|
||||
"Accounts Receivable": {
|
||||
"Credit Cards": {
|
||||
"AMEX Receivable": {},
|
||||
"CUP Receivale": {},
|
||||
"MC Receivable": {},
|
||||
"NETS Receivable": {},
|
||||
"VISA Receivable": {}
|
||||
},
|
||||
"Debtors": {
|
||||
"account_type": "Receivable"
|
||||
}
|
||||
},
|
||||
"Bank Accounts": {
|
||||
"Paypal Account": {
|
||||
"account_type": "Bank"
|
||||
},
|
||||
"account_type": "Bank"
|
||||
},
|
||||
"Cash in Hand": {
|
||||
"Cash in Transit": {
|
||||
"account_type": "Cash"
|
||||
},
|
||||
"Petty Cash": {
|
||||
"account_type": "Cash"
|
||||
}
|
||||
},
|
||||
"Loans and Advances-Assets": {
|
||||
"Prepayments": {}
|
||||
},
|
||||
"Securities and Deposits": {
|
||||
"Bank Guarantees": {},
|
||||
"Bank Deposits": {},
|
||||
"Rental Deposits": {}
|
||||
},
|
||||
"Stock Assets": {
|
||||
"account_type": "Stock",
|
||||
"is_group": 1
|
||||
},
|
||||
"Tax Assets": {
|
||||
"GST-Input": {}
|
||||
}
|
||||
},
|
||||
"Non-current assets": {
|
||||
"Fixed Assets": {
|
||||
"Accumulated Depreciation": {
|
||||
"AccDep-Equipment-AV": {},
|
||||
"AccDep-Equipment-Bar": {},
|
||||
"AccDep-Equipment-ICT": {},
|
||||
"AccDep-Equipment-Electrical": {},
|
||||
"AccDep-Furniture and Fixtures": {},
|
||||
"AccDep-Equipment-Kitchen": {},
|
||||
"AccDep-Equipment-Lighting": {},
|
||||
"AccDep-Equipment-Office": {},
|
||||
"AccDep-Motor Vehicle": {},
|
||||
"AccDep-Plant and Machinery": {},
|
||||
"AccDep-Renovation": {}
|
||||
},
|
||||
"Equipment-AV": {},
|
||||
"Equipment-Bar": {},
|
||||
"Equipment-ICT": {},
|
||||
"Equipment-Electrical": {},
|
||||
"Furniture and Fixtures": {},
|
||||
"Equipment-Kitchen": {},
|
||||
"Equipment-Lighting": {},
|
||||
"Equipment-Office": {},
|
||||
"Motor Vehicle": {},
|
||||
"Plant and Machinery": {},
|
||||
"Renovation": {}
|
||||
},
|
||||
"Non-Fixed Assets": {
|
||||
"Goodwill": {},
|
||||
"Investments": {
|
||||
"Investments-Associated Company": {},
|
||||
"Investments-Subsidiary": {}
|
||||
}
|
||||
},
|
||||
"Shares": {
|
||||
"Shares-Quoted": {},
|
||||
"Shares-Unquoted": {}
|
||||
}
|
||||
},
|
||||
"Temporary Accunts": {
|
||||
"Temporary Opening": {
|
||||
"account_type": "Temporary"
|
||||
}
|
||||
},
|
||||
"root_type": "Asset"
|
||||
},
|
||||
"Liabilities": {
|
||||
"Current liabilities": {
|
||||
"Accounts Payable": {
|
||||
"Creditors":{
|
||||
"account_type": "Payable"
|
||||
}
|
||||
},
|
||||
"Duties and Taxes": {
|
||||
"account_type": "Tax",
|
||||
"Deferred Tax Liabilities-Current": {},
|
||||
"GST-Output": {},
|
||||
"Income Tax Payable": {}
|
||||
},
|
||||
"Loans-Current": {
|
||||
"Amount Owing to Directors": {},
|
||||
"Bank Overdaft Account": {},
|
||||
"Secured Loans": {},
|
||||
"Unsecured Loans": {}
|
||||
},
|
||||
"Provision and Accruals": {
|
||||
"Accruals": {
|
||||
"Accr-CPF": {},
|
||||
"Accr-Incentives": {},
|
||||
"Accr-OCR Employee Card": {},
|
||||
"Accr-Paypal Credit": {},
|
||||
"Accr-Sundry": {},
|
||||
"Accr-Tips": {},
|
||||
"Accr-Withholding Tax": {}
|
||||
},
|
||||
"Provisions": {
|
||||
"Prov-Audit Fee": {},
|
||||
"Prov-Others": {},
|
||||
"Prov-Tax Fee": {},
|
||||
"Prov-Bonus": {
|
||||
"Prov-Bonus-Executive": {},
|
||||
"Prov-Bonus-Non Executive": {}
|
||||
}
|
||||
}
|
||||
},
|
||||
"Sponsorship Funds": {},
|
||||
"Stock Liabilities": {
|
||||
"Stock Received But Not Billed": {
|
||||
"account_type": "Stock Received But Not Billed"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Non-current liabilities": {
|
||||
"Deferred Tax Liabilities": {},
|
||||
"Loans-Non Current": {}
|
||||
},
|
||||
"Capital Account": {
|
||||
"Reserves and Surplus": {},
|
||||
"Shareholder Funds": {}
|
||||
},
|
||||
"root_type": "Liability"
|
||||
},
|
||||
"Equity": {
|
||||
"Share Capital": {},
|
||||
"Current Year Earnings": {},
|
||||
"Proposed Dividends": {},
|
||||
"Retained Earnings": {},
|
||||
"root_type": "Equity"
|
||||
},
|
||||
"Income": {
|
||||
"Direct Income": {
|
||||
"Management Income": {},
|
||||
"Sales Income": {
|
||||
"Sales-Food": {},
|
||||
"Sales-Beverage": {},
|
||||
"Sales-Events and Functions": {},
|
||||
"Sales-Merchandise": {},
|
||||
"Sales-Pool Tables": {},
|
||||
"Sales-Tobacco": {},
|
||||
"Sales-Rental": {}
|
||||
}
|
||||
},
|
||||
"Indirect Income": {
|
||||
"Government Grants": {},
|
||||
"Interest Income": {
|
||||
"Current Account Interest Earned": {},
|
||||
"Fixed Deposit Interest Earned": {}
|
||||
},
|
||||
"Other Income": {},
|
||||
"Service Charges": {}
|
||||
},
|
||||
"root_type": "Income"
|
||||
},
|
||||
"Expenses": {
|
||||
"Expenses-Administrative": {
|
||||
"Admin Management Fees": {},
|
||||
"Audit Fees": {},
|
||||
"Auto": {},
|
||||
"Bank charges and interest": {},
|
||||
"Currency Exchange Differences": {},
|
||||
"Insurance": {},
|
||||
"Interest on Loan": {},
|
||||
"Legal and Professional Fees": {},
|
||||
"Loss on Disposal of FA": {},
|
||||
"Postal and Courier Charges": {},
|
||||
"Printing and Stationery": {},
|
||||
"Secretarial Fees": {},
|
||||
"Tax Agent Fees": {}
|
||||
},
|
||||
"Expenses-Direct": {
|
||||
"Cost of Goods Sold": {
|
||||
"account_type": "Cost of Goods Sold"
|
||||
},
|
||||
"Cost of Sales": {
|
||||
"COS-Food": {},
|
||||
"COS-Beverage": {},
|
||||
"COS-Tobacco": {},
|
||||
"COS-Events and Functions": {},
|
||||
"COS-Merchandise": {}
|
||||
},
|
||||
"Expenses Included in Valuation": {
|
||||
"account_type": "Expenses Included In Valuation"
|
||||
},
|
||||
"Stock Adjustment": {
|
||||
"account_type": "Stock Adjustment"
|
||||
}
|
||||
},
|
||||
"Expenses-Marketing": {
|
||||
"Advertising and Promotion": {},
|
||||
"Graphic Design Fees": {},
|
||||
"Internet Marketing": {
|
||||
"Marketing-Social Media": {},
|
||||
"Marketing-Website": {}
|
||||
}
|
||||
},
|
||||
"Expenses-Operating": {
|
||||
"Cleaning Costs": {
|
||||
"Cleaning-Kitchen": {},
|
||||
"Cleaning-Laundry": {},
|
||||
"Cleaning-Outlet": {}
|
||||
},
|
||||
"Commission Charges": {
|
||||
"Comm-Credit Card": {},
|
||||
"Comm-NETS": {},
|
||||
"Comm-Paypal": {}
|
||||
},
|
||||
"Communication Costs": {
|
||||
"Internet Connection": {},
|
||||
"Telephone Costs": {}
|
||||
},
|
||||
"Disposals": {
|
||||
"Disposals-Food": {},
|
||||
"Disposals-Beverage": {},
|
||||
"Disposals-Merchandise": {},
|
||||
"Disposals-Others": {}
|
||||
},
|
||||
"Entertainment Expenses": {
|
||||
"DJ Costs": {},
|
||||
"Live Band Costs": {},
|
||||
"Recorded Music Costs": {}
|
||||
},
|
||||
"FoC Accounts": {
|
||||
"FoC-ENT": {},
|
||||
"FoC-OC": {}
|
||||
},
|
||||
"General Expenses": {},
|
||||
"Landscaping Costs": {},
|
||||
"Licence Fees": {},
|
||||
"Operational Supplies": {
|
||||
"Supplies-Bar": {},
|
||||
"Supplies-Guest": {},
|
||||
"Supplies-Kitchen": {},
|
||||
"Supplies-Restaurant": {},
|
||||
"Supplies-Stewarding": {}
|
||||
},
|
||||
"Rental Costs": {
|
||||
"Rental-Premises": {},
|
||||
"Rental-Equipment": {},
|
||||
"Rental-Storage": {}
|
||||
},
|
||||
"Repairs and Maintenance": {
|
||||
"R&M-ICT": {},
|
||||
"R&M-AV": {},
|
||||
"R&M-Building": {},
|
||||
"R&M-Electrical & Lighting": {},
|
||||
"R&M-Fixtures & Furniture": {},
|
||||
"R&M-Kitchen & Bar": {},
|
||||
"R&M-Office": {},
|
||||
"R&M-Plant & Machinery": {}
|
||||
},
|
||||
"Service Fees": {},
|
||||
"Subscription Fees": {
|
||||
"Publication Subscriptions": {},
|
||||
"TV Subscriptions": {}
|
||||
},
|
||||
"Travel Expenses": {},
|
||||
"Utilities": {
|
||||
"Utility-Electricity": {},
|
||||
"Utility-Gas": {},
|
||||
"Utility-Refuse Removal": {},
|
||||
"Utility-Water": {}
|
||||
}
|
||||
},
|
||||
"Expenses-Other": {
|
||||
"Bad Debts Written Off": {},
|
||||
"Depreciation": {
|
||||
"Dep-AV Equipment": {},
|
||||
"Dep-Bar Equipment": {},
|
||||
"Dep-ICT Equipment": {},
|
||||
"Dep-Electrical Equipment": {},
|
||||
"Dep-Fixtures & Furniture": {},
|
||||
"Dep-Kitchen Equipment": {},
|
||||
"Dep-Lighting Equipment": {},
|
||||
"Dep-Motor Vehicle": {},
|
||||
"Dep-Office Equipment": {},
|
||||
"Dep-Plant & Machinery": {},
|
||||
"Dep-Renovation": {}
|
||||
},
|
||||
"Donations": {},
|
||||
"Round Off": {},
|
||||
"Tax Expenses": {
|
||||
"Tax Expenses": {}
|
||||
}
|
||||
},
|
||||
"Expenses-Staff": {
|
||||
"Bonuses": {
|
||||
"Bonus-Executive": {},
|
||||
"Bonus-Non Executive": {},
|
||||
"Bonus-Performance": {}
|
||||
},
|
||||
"CPF": {},
|
||||
"Directors Fees": {},
|
||||
"FWL": {},
|
||||
"Incentives": {},
|
||||
"Medical Expenses": {},
|
||||
"Salaries": {
|
||||
"Casual Labour": {},
|
||||
"Salary-Executive": {},
|
||||
"Salary-Non Executive-Full Time": {},
|
||||
"Salary-Non Executive-Part Time": {}
|
||||
},
|
||||
"SDF": {},
|
||||
"Security Expenses": {},
|
||||
"Staff Advertising": {},
|
||||
"Staff Commission Paid": {},
|
||||
"Staff Meals": {},
|
||||
"Staff Training": {},
|
||||
"Staff Transport": {},
|
||||
"Staff Uniforms": {},
|
||||
"Staff Welfare": {}
|
||||
},
|
||||
"root_type": "Expense"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,9 +21,11 @@
|
||||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Make Accounting Entry For Every Stock Movement",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -43,9 +45,11 @@
|
||||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Accounts Frozen Upto",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -65,10 +69,12 @@
|
||||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Role Allowed to Set Frozen Accounts & Edit Frozen Entries",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Role",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -88,10 +94,12 @@
|
||||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Credit Controller",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Role",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -110,10 +118,12 @@
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Check Supplier Invoice Number Uniqueness",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -131,7 +141,8 @@
|
||||
"is_submittable": 0,
|
||||
"issingle": 1,
|
||||
"istable": 0,
|
||||
"modified": "2015-07-14 00:51:48.095525",
|
||||
"max_attachments": 0,
|
||||
"modified": "2015-12-24 21:42:01.274459",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Accounts Settings",
|
||||
|
||||
@@ -26,7 +26,7 @@ class BankReconciliation(Document):
|
||||
t2.parent = t1.name and t2.account = %s
|
||||
and t1.posting_date >= %s and t1.posting_date <= %s and t1.docstatus=1
|
||||
and ifnull(t1.is_opening, 'No') = 'No' %s
|
||||
order by t1.posting_date""" %
|
||||
order by t1.posting_date DESC, t1.name DESC""" %
|
||||
('%s', '%s', '%s', condition), (self.bank_account, self.from_date, self.to_date), as_dict=1)
|
||||
|
||||
self.set('journal_entries', [])
|
||||
@@ -51,6 +51,7 @@ class BankReconciliation(Document):
|
||||
if d.cheque_date and getdate(d.clearance_date) < getdate(d.cheque_date):
|
||||
frappe.throw(_("Clearance date cannot be before check date in row {0}").format(d.idx))
|
||||
|
||||
if d.clearance_date or self.include_reconciled_entries:
|
||||
frappe.db.set_value("Journal Entry", d.voucher_id, "clearance_date", d.clearance_date)
|
||||
frappe.db.sql("""update `tabJournal Entry` set clearance_date = %s, modified = %s
|
||||
where name=%s""", (d.clearance_date, nowdate(), d.voucher_id))
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Voucher ID",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@@ -31,7 +31,8 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
"unique": 0,
|
||||
"width": "50"
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
@@ -56,7 +57,8 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
"unique": 0,
|
||||
"width": "15"
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
@@ -67,7 +69,7 @@
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"in_list_view": 0,
|
||||
"label": "Debit",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@@ -93,7 +95,7 @@
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"in_list_view": 0,
|
||||
"label": "Credit",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@@ -143,7 +145,7 @@
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Posting Date",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@@ -268,7 +270,7 @@
|
||||
"istable": 1,
|
||||
"max_attachments": 0,
|
||||
"menu_index": 0,
|
||||
"modified": "2015-12-04 11:01:24.286320",
|
||||
"modified": "2016-01-19 12:06:17.568428",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Bank Reconciliation Detail",
|
||||
@@ -277,4 +279,4 @@
|
||||
"read_only": 0,
|
||||
"read_only_onload": 0,
|
||||
"version": 0
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
||||
cur_frm.set_intro(intro_txt);
|
||||
|
||||
cur_frm.add_custom_button(__('Chart of Cost Centers'),
|
||||
function() { frappe.set_route("Accounts Browser", "Cost Center"); }, 'icon-sitemap')
|
||||
function() { frappe.set_route("Accounts Browser", "Cost Center"); }, __("View"))
|
||||
}
|
||||
|
||||
cur_frm.cscript.parent_cost_center = function(doc, cdt, cdn) {
|
||||
@@ -62,12 +62,12 @@ cur_frm.cscript.parent_cost_center = function(doc, cdt, cdn) {
|
||||
|
||||
cur_frm.cscript.hide_unhide_group_ledger = function(doc) {
|
||||
if (doc.is_group == 1) {
|
||||
cur_frm.add_custom_button(__('Convert to non-Group'),
|
||||
function() { cur_frm.cscript.convert_to_ledger(); }, 'icon-retweet',
|
||||
cur_frm.add_custom_button(__('Convert to Non-Group'),
|
||||
function() { cur_frm.cscript.convert_to_ledger(); }, "icon-retweet",
|
||||
"btn-default")
|
||||
} else if (doc.is_group == 0) {
|
||||
cur_frm.add_custom_button(__('Convert to Group'),
|
||||
function() { cur_frm.cscript.convert_to_group(); }, 'icon-retweet',
|
||||
function() { cur_frm.cscript.convert_to_group(); }, "icon-retweet",
|
||||
"btn-default")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ $.extend(cur_frm.cscript, {
|
||||
this.frm.toggle_enable('year_end_date', doc.__islocal)
|
||||
|
||||
if (!doc.__islocal && (doc.name != sys_defaults.fiscal_year)) {
|
||||
this.frm.add_custom_button(__("Set as Default"),
|
||||
this.frm.add_custom_button(__("Default"),
|
||||
this.frm.cscript.set_as_default, "icon-star");
|
||||
this.frm.set_intro(__("To set this Fiscal Year as Default, click on 'Set as Default'"));
|
||||
} else {
|
||||
|
||||
@@ -20,14 +20,15 @@ class FiscalYear(Document):
|
||||
msgprint(_("{0} is now the default Fiscal Year. Please refresh your browser for the change to take effect.").format(self.name))
|
||||
|
||||
def validate(self):
|
||||
year_start_end_dates = frappe.db.sql("""select year_start_date, year_end_date
|
||||
from `tabFiscal Year` where name=%s""", (self.name))
|
||||
|
||||
self.validate_dates()
|
||||
|
||||
if year_start_end_dates:
|
||||
if getdate(self.year_start_date) != year_start_end_dates[0][0] or getdate(self.year_end_date) != year_start_end_dates[0][1]:
|
||||
frappe.throw(_("Cannot change Fiscal Year Start Date and Fiscal Year End Date once the Fiscal Year is saved."))
|
||||
if not self.is_new():
|
||||
year_start_end_dates = frappe.db.sql("""select year_start_date, year_end_date
|
||||
from `tabFiscal Year` where name=%s""", (self.name))
|
||||
|
||||
if year_start_end_dates:
|
||||
if getdate(self.year_start_date) != year_start_end_dates[0][0] or getdate(self.year_end_date) != year_start_end_dates[0][1]:
|
||||
frappe.throw(_("Cannot change Fiscal Year Start Date and Fiscal Year End Date once the Fiscal Year is saved."))
|
||||
|
||||
def validate_dates(self):
|
||||
if getdate(self.year_start_date) > getdate(self.year_end_date):
|
||||
@@ -63,6 +64,6 @@ def auto_create_fiscal_year():
|
||||
end_year = cstr(new_fy.year_end_date.year)
|
||||
new_fy.year = start_year if start_year==end_year else (start_year + "-" + end_year)
|
||||
|
||||
new_fy.insert()
|
||||
new_fy.insert(ignore_permissions=True)
|
||||
except frappe.NameError:
|
||||
pass
|
||||
|
||||
@@ -6,10 +6,10 @@ import frappe
|
||||
from frappe import _
|
||||
from frappe.utils import flt, fmt_money, getdate, formatdate
|
||||
from frappe.model.document import Document
|
||||
from erpnext.accounts.party import validate_party_gle_currency
|
||||
from erpnext.accounts.party import validate_party_gle_currency, validate_party_frozen_disabled
|
||||
from erpnext.accounts.utils import get_account_currency
|
||||
from erpnext.setup.doctype.company.company import get_company_currency
|
||||
from erpnext.exceptions import InvalidAccountCurrency, CustomerFrozen
|
||||
from erpnext.exceptions import InvalidAccountCurrency
|
||||
|
||||
exclude_from_linked_with = True
|
||||
|
||||
@@ -96,11 +96,7 @@ class GLEntry(Document):
|
||||
frappe.throw(_("Cost Center {0} does not belong to Company {1}").format(self.cost_center, self.company))
|
||||
|
||||
def validate_party(self):
|
||||
if self.party_type and self.party:
|
||||
frozen_accounts_modifier = frappe.db.get_value( 'Accounts Settings', None,'frozen_accounts_modifier')
|
||||
if not frozen_accounts_modifier in frappe.get_roles():
|
||||
if frappe.db.get_value(self.party_type, self.party, "is_frozen"):
|
||||
frappe.throw("{0} {1} is frozen".format(self.party_type, self.party), CustomerFrozen)
|
||||
validate_party_frozen_disabled(self.party_type, self.party)
|
||||
|
||||
def validate_currency(self):
|
||||
company_currency = get_company_currency(self.company)
|
||||
|
||||
@@ -11,7 +11,7 @@ frappe.ui.form.on("Journal Entry", {
|
||||
frm.cscript.voucher_type(frm.doc);
|
||||
|
||||
if(frm.doc.docstatus==1) {
|
||||
frm.add_custom_button(__('View Ledger'), function() {
|
||||
frm.add_custom_button(__('Ledger'), function() {
|
||||
frappe.route_options = {
|
||||
"voucher_no": frm.doc.name,
|
||||
"from_date": frm.doc.posting_date,
|
||||
@@ -347,6 +347,7 @@ frappe.ui.form.on("Journal Entry Account", {
|
||||
callback: function(r) {
|
||||
if(r.message) {
|
||||
$.extend(d, r.message);
|
||||
erpnext.journal_entry.set_debit_credit_in_company_currency(frm, dt, dn);
|
||||
refresh_field('accounts');
|
||||
}
|
||||
}
|
||||
@@ -355,11 +356,11 @@ frappe.ui.form.on("Journal Entry Account", {
|
||||
},
|
||||
|
||||
debit_in_account_currency: function(frm, cdt, cdn) {
|
||||
erpnext.journal_entry.set_debit_credit_in_company_currency(frm, cdt, cdn);
|
||||
erpnext.journal_entry.set_exchange_rate(frm, cdt, cdn);
|
||||
},
|
||||
|
||||
credit_in_account_currency: function(frm, cdt, cdn) {
|
||||
erpnext.journal_entry.set_debit_credit_in_company_currency(frm, cdt, cdn);
|
||||
erpnext.journal_entry.set_exchange_rate(frm, cdt, cdn);
|
||||
},
|
||||
|
||||
debit: function(frm, dt, dn) {
|
||||
@@ -368,6 +369,17 @@ frappe.ui.form.on("Journal Entry Account", {
|
||||
|
||||
credit: function(frm, dt, dn) {
|
||||
cur_frm.cscript.update_totals(frm.doc);
|
||||
},
|
||||
|
||||
exchange_rate: function(frm, cdt, cdn) {
|
||||
var company_currency = frappe.get_doc(":Company", frm.doc.company).default_currency;
|
||||
var row = locals[cdt][cdn];
|
||||
|
||||
if(row.account_currency == company_currency || !frm.doc.multi_currency) {
|
||||
frappe.model.set_value(cdt, cdn, "exchange_rate", 1);
|
||||
}
|
||||
|
||||
erpnext.journal_entry.set_debit_credit_in_company_currency(frm, cdt, cdn);
|
||||
}
|
||||
})
|
||||
|
||||
@@ -395,8 +407,6 @@ $.extend(erpnext.journal_entry, {
|
||||
},
|
||||
|
||||
set_debit_credit_in_company_currency: function(frm, cdt, cdn) {
|
||||
erpnext.journal_entry.set_exchange_rate(frm, cdt, cdn);
|
||||
|
||||
var row = locals[cdt][cdn];
|
||||
|
||||
frappe.model.set_value(cdt, cdn, "debit",
|
||||
@@ -413,7 +423,8 @@ $.extend(erpnext.journal_entry, {
|
||||
var row = locals[cdt][cdn];
|
||||
|
||||
if(row.account_currency == company_currency || !frm.doc.multi_currency) {
|
||||
frappe.model.set_value(cdt, cdn, "exchange_rate", 1);
|
||||
row.exchange_rate = 1;
|
||||
erpnext.journal_entry.set_debit_credit_in_company_currency(frm, cdt, cdn);
|
||||
} else if (!row.exchange_rate || row.exchange_rate == 1 || row.account_type == "Bank") {
|
||||
frappe.call({
|
||||
method: "erpnext.accounts.doctype.journal_entry.journal_entry.get_exchange_rate",
|
||||
@@ -429,11 +440,15 @@ $.extend(erpnext.journal_entry, {
|
||||
},
|
||||
callback: function(r) {
|
||||
if(r.message) {
|
||||
frappe.model.set_value(cdt, cdn, "exchange_rate", r.message);
|
||||
row.exchange_rate = r.message;
|
||||
erpnext.journal_entry.set_debit_credit_in_company_currency(frm, cdt, cdn);
|
||||
}
|
||||
}
|
||||
})
|
||||
} else {
|
||||
erpnext.journal_entry.set_debit_credit_in_company_currency(frm, cdt, cdn);
|
||||
}
|
||||
refresh_field("exchange_rate", cdn, "accounts");
|
||||
},
|
||||
|
||||
quick_entry: function(frm) {
|
||||
|
||||
@@ -105,6 +105,12 @@ class JournalEntry(AccountsController):
|
||||
elif d.reference_type in ("Sales Order", "Purchase Order") and d.is_advance != "Yes":
|
||||
frappe.throw(_("Row {0}: Payment against Sales/Purchase Order should always be marked as advance").format(d.idx))
|
||||
|
||||
if d.is_advance == "Yes":
|
||||
if d.party_type == 'Customer' and flt(d.debit) > 0:
|
||||
frappe.throw(_("Row {0}: Advance against Customer must be credit").format(d.idx))
|
||||
elif d.party_type == 'Supplier' and flt(d.credit) > 0:
|
||||
frappe.throw(_("Row {0}: Advance against Supplier must be debit").format(d.idx))
|
||||
|
||||
def validate_against_jv(self):
|
||||
for d in self.get('accounts'):
|
||||
if d.reference_type=="Journal Entry":
|
||||
@@ -203,9 +209,7 @@ class JournalEntry(AccountsController):
|
||||
account = self.reference_accounts[reference_name]
|
||||
|
||||
if reference_type in ("Sales Order", "Purchase Order"):
|
||||
order = frappe.db.get_value(reference_type, reference_name,
|
||||
["docstatus", "per_billed", "status", "advance_paid",
|
||||
"base_grand_total", "grand_total", "currency"], as_dict=1)
|
||||
order = frappe.get_doc(reference_type, reference_name)
|
||||
|
||||
if order.docstatus != 1:
|
||||
frappe.throw(_("{0} {1} is not submitted").format(reference_type, reference_name))
|
||||
@@ -219,12 +223,16 @@ class JournalEntry(AccountsController):
|
||||
account_currency = get_account_currency(account)
|
||||
if account_currency == self.company_currency:
|
||||
voucher_total = order.base_grand_total
|
||||
formatted_voucher_total = fmt_money(voucher_total, order.precision("base_grand_total"),
|
||||
currency=account_currency)
|
||||
else:
|
||||
voucher_total = order.grand_total
|
||||
formatted_voucher_total = fmt_money(voucher_total, order.precision("grand_total"),
|
||||
currency=account_currency)
|
||||
|
||||
if flt(voucher_total) < (flt(order.advance_paid) + total):
|
||||
frappe.throw(_("Advance paid against {0} {1} cannot be greater \
|
||||
than Grand Total {2}").format(reference_type, reference_name, voucher_total))
|
||||
than Grand Total {2}").format(reference_type, reference_name, formatted_voucher_total))
|
||||
|
||||
def validate_invoices(self):
|
||||
"""Validate totals and docstatus for invoices"""
|
||||
@@ -274,10 +282,14 @@ class JournalEntry(AccountsController):
|
||||
alternate_currency = []
|
||||
for d in self.get("accounts"):
|
||||
account = frappe.db.get_value("Account", d.account, ["account_currency", "account_type"], as_dict=1)
|
||||
d.account_currency = account.account_currency or self.company_currency
|
||||
d.account_type = account.account_type
|
||||
if account:
|
||||
d.account_currency = account.account_currency
|
||||
d.account_type = account.account_type
|
||||
|
||||
if d.account_currency!=self.company_currency and d.account_currency not in alternate_currency:
|
||||
if not d.account_currency:
|
||||
d.account_currency = self.company_currency
|
||||
|
||||
if d.account_currency != self.company_currency and d.account_currency not in alternate_currency:
|
||||
alternate_currency.append(d.account_currency)
|
||||
|
||||
if alternate_currency:
|
||||
@@ -288,8 +300,11 @@ class JournalEntry(AccountsController):
|
||||
|
||||
def set_amounts_in_company_currency(self):
|
||||
for d in self.get("accounts"):
|
||||
d.debit = flt(flt(d.debit_in_account_currency)*flt(d.exchange_rate), d.precision("debit"))
|
||||
d.credit = flt(flt(d.credit_in_account_currency)*flt(d.exchange_rate), d.precision("credit"))
|
||||
d.debit_in_account_currency = flt(d.debit_in_account_currency, d.precision("debit_in_account_currency"))
|
||||
d.credit_in_account_currency = flt(d.credit_in_account_currency, d.precision("credit_in_account_currency"))
|
||||
|
||||
d.debit = flt(d.debit_in_account_currency * flt(d.exchange_rate), d.precision("debit"))
|
||||
d.credit = flt(d.credit_in_account_currency * flt(d.exchange_rate), d.precision("credit"))
|
||||
|
||||
def set_exchange_rate(self):
|
||||
for d in self.get("accounts"):
|
||||
@@ -341,6 +356,7 @@ class JournalEntry(AccountsController):
|
||||
def set_print_format_fields(self):
|
||||
total_amount = 0.0
|
||||
bank_account_currency = None
|
||||
self.pay_to_recd_from = None
|
||||
for d in self.get('accounts'):
|
||||
if d.party_type and d.party:
|
||||
if not self.pay_to_recd_from:
|
||||
@@ -351,6 +367,9 @@ class JournalEntry(AccountsController):
|
||||
total_amount += (d.debit_in_account_currency or d.credit_in_account_currency)
|
||||
bank_account_currency = d.account_currency
|
||||
|
||||
if not self.pay_to_recd_from:
|
||||
total_amount = 0
|
||||
|
||||
self.set_total_amount(total_amount, bank_account_currency)
|
||||
|
||||
def set_total_amount(self, amt, currency):
|
||||
@@ -498,7 +517,7 @@ class JournalEntry(AccountsController):
|
||||
d.party_balance = party_balance[(d.party_type, d.party)]
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_default_bank_cash_account(company, voucher_type, mode_of_payment=None):
|
||||
def get_default_bank_cash_account(company, voucher_type, mode_of_payment=None, account=None):
|
||||
from erpnext.accounts.doctype.sales_invoice.sales_invoice import get_bank_cash_account
|
||||
if mode_of_payment:
|
||||
account = get_bank_cash_account(mode_of_payment, company)
|
||||
@@ -506,16 +525,18 @@ def get_default_bank_cash_account(company, voucher_type, mode_of_payment=None):
|
||||
account.update({"balance": get_balance_on(account.get("account"))})
|
||||
return account
|
||||
|
||||
if voucher_type=="Bank Entry":
|
||||
account = frappe.db.get_value("Company", company, "default_bank_account")
|
||||
if not account:
|
||||
account = frappe.db.get_value("Account",
|
||||
{"company": company, "account_type": "Bank", "is_group": 0})
|
||||
elif voucher_type=="Cash Entry":
|
||||
account = frappe.db.get_value("Company", company, "default_cash_account")
|
||||
if not account:
|
||||
account = frappe.db.get_value("Account",
|
||||
{"company": company, "account_type": "Cash", "is_group": 0})
|
||||
if not account:
|
||||
if voucher_type=="Bank Entry":
|
||||
account = frappe.db.get_value("Company", company, "default_bank_account")
|
||||
if not account:
|
||||
account = frappe.db.get_value("Account",
|
||||
{"company": company, "account_type": "Bank", "is_group": 0})
|
||||
|
||||
elif voucher_type=="Cash Entry":
|
||||
account = frappe.db.get_value("Company", company, "default_cash_account")
|
||||
if not account:
|
||||
account = frappe.db.get_value("Account",
|
||||
{"company": company, "account_type": "Cash", "is_group": 0})
|
||||
|
||||
if account:
|
||||
account_details = frappe.db.get_value("Account", account,
|
||||
@@ -528,7 +549,7 @@ def get_default_bank_cash_account(company, voucher_type, mode_of_payment=None):
|
||||
}
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_payment_entry_against_order(dt, dn):
|
||||
def get_payment_entry_against_order(dt, dn, amount=None, journal_entry=False, bank_account=None):
|
||||
ref_doc = frappe.get_doc(dt, dn)
|
||||
|
||||
if flt(ref_doc.per_billed, 2) > 0:
|
||||
@@ -546,10 +567,11 @@ def get_payment_entry_against_order(dt, dn):
|
||||
party_account = get_party_account(party_type, ref_doc.get(party_type.lower()), ref_doc.company)
|
||||
party_account_currency = get_account_currency(party_account)
|
||||
|
||||
if party_account_currency == ref_doc.company_currency:
|
||||
amount = flt(ref_doc.base_grand_total) - flt(ref_doc.advance_paid)
|
||||
else:
|
||||
amount = flt(ref_doc.grand_total) - flt(ref_doc.advance_paid)
|
||||
if not amount:
|
||||
if party_account_currency == ref_doc.company_currency:
|
||||
amount = flt(ref_doc.base_grand_total) - flt(ref_doc.advance_paid)
|
||||
else:
|
||||
amount = flt(ref_doc.grand_total) - flt(ref_doc.advance_paid)
|
||||
|
||||
return get_payment_entry(ref_doc, {
|
||||
"party_type": party_type,
|
||||
@@ -559,11 +581,13 @@ def get_payment_entry_against_order(dt, dn):
|
||||
"amount_field_bank": amount_field_bank,
|
||||
"amount": amount,
|
||||
"remarks": 'Advance Payment received against {0} {1}'.format(dt, dn),
|
||||
"is_advance": "Yes"
|
||||
"is_advance": "Yes",
|
||||
"bank_account": bank_account,
|
||||
"journal_entry": journal_entry
|
||||
})
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_payment_entry_against_invoice(dt, dn):
|
||||
def get_payment_entry_against_invoice(dt, dn, amount=None, journal_entry=False, bank_account=None):
|
||||
ref_doc = frappe.get_doc(dt, dn)
|
||||
if dt == "Sales Invoice":
|
||||
party_type = "Customer"
|
||||
@@ -587,24 +611,28 @@ def get_payment_entry_against_invoice(dt, dn):
|
||||
"party_account_currency": ref_doc.party_account_currency,
|
||||
"amount_field_party": amount_field_party,
|
||||
"amount_field_bank": amount_field_bank,
|
||||
"amount": abs(ref_doc.outstanding_amount),
|
||||
"amount": amount if amount else abs(ref_doc.outstanding_amount),
|
||||
"remarks": 'Payment received against {0} {1}. {2}'.format(dt, dn, ref_doc.remarks),
|
||||
"is_advance": "No"
|
||||
"is_advance": "No",
|
||||
"bank_account": bank_account,
|
||||
"journal_entry": journal_entry
|
||||
})
|
||||
|
||||
def get_payment_entry(ref_doc, args):
|
||||
cost_center = frappe.db.get_value("Company", ref_doc.company, "cost_center")
|
||||
exchange_rate = get_exchange_rate(args.get("party_account"), args.get("party_account_currency"),
|
||||
ref_doc.company, ref_doc.doctype, ref_doc.name)
|
||||
exchange_rate = 1
|
||||
if args.get("party_account"):
|
||||
exchange_rate = get_exchange_rate(args.get("party_account"), args.get("party_account_currency"),
|
||||
ref_doc.company, ref_doc.doctype, ref_doc.name)
|
||||
|
||||
jv = frappe.new_doc("Journal Entry")
|
||||
jv.update({
|
||||
je = frappe.new_doc("Journal Entry")
|
||||
je.update({
|
||||
"voucher_type": "Bank Entry",
|
||||
"company": ref_doc.company,
|
||||
"remark": args.get("remarks")
|
||||
})
|
||||
|
||||
party_row = jv.append("accounts", {
|
||||
party_row = je.append("accounts", {
|
||||
"account": args.get("party_account"),
|
||||
"party_type": args.get("party_type"),
|
||||
"party": ref_doc.get(args.get("party_type").lower()),
|
||||
@@ -621,8 +649,10 @@ def get_payment_entry(ref_doc, args):
|
||||
"reference_name": ref_doc.name
|
||||
})
|
||||
|
||||
bank_row = jv.append("accounts")
|
||||
bank_account = get_default_bank_cash_account(ref_doc.company, "Bank Entry")
|
||||
bank_row = je.append("accounts")
|
||||
|
||||
#make it bank_details
|
||||
bank_account = get_default_bank_cash_account(ref_doc.company, "Bank Entry", account=args.get("bank_account"))
|
||||
if bank_account:
|
||||
bank_row.update(bank_account)
|
||||
bank_row.exchange_rate = get_exchange_rate(bank_account["account"],
|
||||
@@ -638,12 +668,12 @@ def get_payment_entry(ref_doc, args):
|
||||
# set multi currency check
|
||||
if party_row.account_currency != ref_doc.company_currency \
|
||||
or (bank_row.account_currency and bank_row.account_currency != ref_doc.company_currency):
|
||||
jv.multi_currency = 1
|
||||
je.multi_currency = 1
|
||||
|
||||
jv.set_amounts_in_company_currency()
|
||||
jv.set_total_debit_credit()
|
||||
je.set_amounts_in_company_currency()
|
||||
je.set_total_debit_credit()
|
||||
|
||||
return jv.as_dict()
|
||||
return je if args.get("journal_entry") else je.as_dict()
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_opening_accounts(company):
|
||||
@@ -769,7 +799,7 @@ def get_exchange_rate(account, account_currency=None, company=None,
|
||||
company_currency = get_company_currency(company)
|
||||
|
||||
if account_currency != company_currency:
|
||||
if reference_type in ("Sales Invoice", "Purchase Invoice") and reference_name:
|
||||
if reference_type and reference_name and frappe.get_meta(reference_type).get_field("conversion_rate"):
|
||||
exchange_rate = frappe.db.get_value(reference_type, reference_name, "conversion_rate")
|
||||
|
||||
elif account_details and account_details.account_type == "Bank" and \
|
||||
|
||||
118
erpnext/accounts/doctype/payment_gateway/payment_gateway.json
Normal file
118
erpnext/accounts/doctype/payment_gateway/payment_gateway.json
Normal file
@@ -0,0 +1,118 @@
|
||||
{
|
||||
"allow_copy": 0,
|
||||
"allow_import": 0,
|
||||
"allow_rename": 0,
|
||||
"autoname": "field:gateway",
|
||||
"creation": "2015-12-15 22:26:45.221162",
|
||||
"custom": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "DocType",
|
||||
"document_type": "",
|
||||
"fields": [
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "gateway",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Gateway",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
}
|
||||
],
|
||||
"hide_heading": 0,
|
||||
"hide_toolbar": 0,
|
||||
"idx": 0,
|
||||
"in_create": 1,
|
||||
"in_dialog": 0,
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2016-01-18 03:58:22.588834",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Payment Gateway",
|
||||
"name_case": "",
|
||||
"owner": "Administrator",
|
||||
"permissions": [
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Administrator",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
"email": 0,
|
||||
"export": 0,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"permlevel": 0,
|
||||
"print": 0,
|
||||
"read": 1,
|
||||
"report": 0,
|
||||
"role": "System Manager",
|
||||
"set_user_permissions": 0,
|
||||
"share": 0,
|
||||
"submit": 0,
|
||||
"write": 0
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
"email": 0,
|
||||
"export": 0,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"permlevel": 0,
|
||||
"print": 0,
|
||||
"read": 1,
|
||||
"report": 0,
|
||||
"role": "Accounts Manager",
|
||||
"set_user_permissions": 0,
|
||||
"share": 0,
|
||||
"submit": 0,
|
||||
"write": 0
|
||||
}
|
||||
],
|
||||
"read_only": 1,
|
||||
"read_only_onload": 0,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC"
|
||||
}
|
||||
10
erpnext/accounts/doctype/payment_gateway/payment_gateway.py
Normal file
10
erpnext/accounts/doctype/payment_gateway/payment_gateway.py
Normal file
@@ -0,0 +1,10 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe.model.document import Document
|
||||
|
||||
class PaymentGateway(Document):
|
||||
pass
|
||||
@@ -0,0 +1,12 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
import unittest
|
||||
|
||||
# test_records = frappe.get_test_records('Payment Gateway')
|
||||
|
||||
class TestPaymentGateway(unittest.TestCase):
|
||||
pass
|
||||
@@ -0,0 +1,6 @@
|
||||
cur_frm.cscript.refresh = function(doc, dt, dn){
|
||||
if(!doc.__islocal){
|
||||
var df = frappe.meta.get_docfield(doc.doctype, "gateway", doc.name);
|
||||
df.read_only = 1;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,293 @@
|
||||
{
|
||||
"allow_copy": 0,
|
||||
"allow_import": 0,
|
||||
"allow_rename": 0,
|
||||
"creation": "2015-12-23 21:31:52.699821",
|
||||
"custom": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "DocType",
|
||||
"document_type": "",
|
||||
"fields": [
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "gateway",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Payment Gateway",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Payment Gateway",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "is_default",
|
||||
"fieldtype": "Check",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Is Default",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "column_break_4",
|
||||
"fieldtype": "Column Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "payment_account",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Payment Account",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Account",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "currency",
|
||||
"fieldtype": "Read Only",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Currency",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "payment_account.account_currency",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "payment_request_message",
|
||||
"fieldtype": "Section Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"default": "Please click on the link below to make your payment",
|
||||
"fieldname": "message",
|
||||
"fieldtype": "Text Editor",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Default Payment Request Message",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"default": "Click here to make a payment",
|
||||
"fieldname": "payment_url_message",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Payment URL Message",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "payment_success_url",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Payment Success URL",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
}
|
||||
],
|
||||
"hide_heading": 0,
|
||||
"hide_toolbar": 0,
|
||||
"idx": 0,
|
||||
"in_create": 0,
|
||||
"in_dialog": 0,
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2016-01-18 03:53:50.534673",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Payment Gateway Account",
|
||||
"name_case": "",
|
||||
"owner": "Administrator",
|
||||
"permissions": [
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Administrator",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Accounts Manager",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"read_only": 0,
|
||||
"read_only_onload": 0,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC"
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe.model.document import Document
|
||||
|
||||
class PaymentGatewayAccount(Document):
|
||||
def autoname(self):
|
||||
self.name = self.gateway + " - " + self.currency
|
||||
|
||||
def validate(self):
|
||||
self.update_default_payment_gateway()
|
||||
self.set_as_default_if_not_set()
|
||||
|
||||
def update_default_payment_gateway(self):
|
||||
if self.is_default:
|
||||
frappe.db.sql("""update `tabPayment Gateway Account` set is_default = 0
|
||||
where is_default = 1 """)
|
||||
|
||||
def set_as_default_if_not_set(self):
|
||||
if not frappe.db.get_value("Payment Gateway Account", {"is_default": 1, "name": ("!=", self.name)}, "name"):
|
||||
self.is_default = 1
|
||||
@@ -0,0 +1,12 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
import unittest
|
||||
|
||||
# test_records = frappe.get_test_records('Payment Gateway Account')
|
||||
|
||||
class TestPaymentGatewayAccount(unittest.TestCase):
|
||||
pass
|
||||
@@ -47,6 +47,11 @@ erpnext.accounts.PaymentReconciliationController = frappe.ui.form.Controller.ext
|
||||
|
||||
refresh: function() {
|
||||
this.frm.disable_save();
|
||||
this.toggle_primary_action();
|
||||
},
|
||||
|
||||
onload_post_render: function() {
|
||||
this.toggle_primary_action();
|
||||
},
|
||||
|
||||
party: function() {
|
||||
@@ -75,6 +80,7 @@ erpnext.accounts.PaymentReconciliationController = frappe.ui.form.Controller.ext
|
||||
method: 'get_unreconciled_entries',
|
||||
callback: function(r, rt) {
|
||||
me.set_invoice_options();
|
||||
me.toggle_primary_action();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -87,10 +93,11 @@ erpnext.accounts.PaymentReconciliationController = frappe.ui.form.Controller.ext
|
||||
method: 'reconcile',
|
||||
callback: function(r, rt) {
|
||||
me.set_invoice_options();
|
||||
me.toggle_primary_action();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
set_invoice_options: function() {
|
||||
var invoices = [];
|
||||
|
||||
@@ -107,6 +114,20 @@ erpnext.accounts.PaymentReconciliationController = frappe.ui.form.Controller.ext
|
||||
});
|
||||
|
||||
refresh_field("payments");
|
||||
},
|
||||
|
||||
toggle_primary_action: function() {
|
||||
if ((this.frm.doc.payments || []).length) {
|
||||
this.frm.fields_dict.reconcile.$input
|
||||
&& this.frm.fields_dict.reconcile.$input.addClass("btn-primary");
|
||||
this.frm.fields_dict.get_unreconciled_entries.$input
|
||||
&& this.frm.fields_dict.get_unreconciled_entries.$input.removeClass("btn-primary");
|
||||
} else {
|
||||
this.frm.fields_dict.reconcile.$input
|
||||
&& this.frm.fields_dict.reconcile.$input.removeClass("btn-primary");
|
||||
this.frm.fields_dict.get_unreconciled_entries.$input
|
||||
&& this.frm.fields_dict.get_unreconciled_entries.$input.addClass("btn-primary");
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
@@ -19,10 +19,12 @@
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Company",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Company",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
@@ -41,10 +43,12 @@
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Party Type",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "DocType",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
@@ -64,10 +68,12 @@
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Party",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "party_type",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
@@ -86,11 +92,13 @@
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Receivable / Payable Account",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Account",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
@@ -109,10 +117,12 @@
|
||||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Bank / Cash Account",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Account",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -131,9 +141,11 @@
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -151,10 +163,12 @@
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "From Date",
|
||||
"label": "From Invoice Date",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -172,10 +186,12 @@
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "To Date",
|
||||
"label": "To Invoice Date",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -193,10 +209,12 @@
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Minimum Amount",
|
||||
"label": "Minimum Invoice Amount",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -214,10 +232,12 @@
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Maximum Amount",
|
||||
"label": "Maximum Invoice Amount",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -236,9 +256,11 @@
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Get Unreconciled Entries",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -257,9 +279,11 @@
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Unreconciled Payment Details",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -278,10 +302,12 @@
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Payments",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Payment Reconciliation Payment",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -300,9 +326,11 @@
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Reconcile",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -321,9 +349,11 @@
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Invoice/Journal Entry Details",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -342,10 +372,12 @@
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Invoices",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Payment Reconciliation Invoice",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -357,12 +389,15 @@
|
||||
"hide_heading": 0,
|
||||
"hide_toolbar": 1,
|
||||
"icon": "icon-resize-horizontal",
|
||||
"idx": 0,
|
||||
"in_create": 0,
|
||||
"in_dialog": 0,
|
||||
"is_submittable": 0,
|
||||
"issingle": 1,
|
||||
"istable": 0,
|
||||
"modified": "2015-09-21 03:41:24.672227",
|
||||
"max_attachments": 0,
|
||||
"menu_index": 0,
|
||||
"modified": "2016-01-04 02:26:58.807921",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Payment Reconciliation",
|
||||
|
||||
@@ -18,8 +18,6 @@ class PaymentReconciliation(Document):
|
||||
dr_or_cr = "credit_in_account_currency" if self.party_type == "Customer" \
|
||||
else "debit_in_account_currency"
|
||||
|
||||
cond = self.check_condition()
|
||||
|
||||
bank_account_condition = "t2.against_account like %(bank_cash_account)s" \
|
||||
if self.bank_cash_account else "1=1"
|
||||
|
||||
@@ -34,7 +32,6 @@ class PaymentReconciliation(Document):
|
||||
and t2.party_type = %(party_type)s and t2.party = %(party)s
|
||||
and t2.account = %(account)s and {dr_or_cr} > 0
|
||||
and (t2.reference_type is null or t2.reference_type in ('', 'Sales Order', 'Purchase Order'))
|
||||
{cond}
|
||||
and (CASE
|
||||
WHEN t1.voucher_type in ('Debit Note', 'Credit Note')
|
||||
THEN 1=1
|
||||
@@ -42,7 +39,6 @@ class PaymentReconciliation(Document):
|
||||
END)
|
||||
""".format(**{
|
||||
"dr_or_cr": dr_or_cr,
|
||||
"cond": cond,
|
||||
"bank_account_condition": bank_account_condition,
|
||||
}), {
|
||||
"party_type": self.party_type,
|
||||
@@ -158,8 +154,8 @@ class PaymentReconciliation(Document):
|
||||
frappe.throw(_("Please select Allocated Amount, Invoice Type and Invoice Number in atleast one row"))
|
||||
|
||||
def check_condition(self):
|
||||
cond = " and posting_date >= {0}".format(frappe.db.escape(self.from_date)) if self.from_date else ""
|
||||
cond += " and posting_date <= {0}".format(frappe.db.escape(self.to_date)) if self.to_date else ""
|
||||
cond = " and posting_date >= '{0}'".format(frappe.db.escape(self.from_date)) if self.from_date else ""
|
||||
cond += " and posting_date <= '{0}'".format(frappe.db.escape(self.to_date)) if self.to_date else ""
|
||||
|
||||
if self.party_type == "Customer":
|
||||
dr_or_cr = "debit_in_account_currency"
|
||||
|
||||
34
erpnext/accounts/doctype/payment_request/payment_request.js
Normal file
34
erpnext/accounts/doctype/payment_request/payment_request.js
Normal file
@@ -0,0 +1,34 @@
|
||||
cur_frm.add_fetch("payment_gateway", "payment_account", "payment_account")
|
||||
cur_frm.add_fetch("payment_gateway", "gateway", "gateway")
|
||||
cur_frm.add_fetch("payment_gateway", "message", "message")
|
||||
cur_frm.add_fetch("payment_gateway", "payment_url_message", "payment_url_message")
|
||||
cur_frm.add_fetch("payment_gateway", "payment_success_url", "payment_success_url")
|
||||
|
||||
frappe.ui.form.on("Payment Request", "onload", function(frm, dt, dn){
|
||||
if (frm.doc.reference_doctype) {
|
||||
frappe.call({
|
||||
method:"erpnext.accounts.doctype.payment_request.payment_request.get_print_format_list",
|
||||
args: {"ref_doctype": frm.doc.reference_doctype},
|
||||
callback:function(r){
|
||||
set_field_options("print_format", r.message["print_format"])
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
frappe.ui.form.on("Payment Request", "refresh", function(frm) {
|
||||
frm.add_custom_button(__('Resend Payment Email'), function(){
|
||||
frappe.call({
|
||||
method: "erpnext.accounts.doctype.payment_request.payment_request.resend_payment_email",
|
||||
args: {"docname": frm.doc.name},
|
||||
freeze: true,
|
||||
freeze_message: __("Sending"),
|
||||
callback: function(r){
|
||||
if(!r.exc) {
|
||||
frappe.msgprint(__("Message Sent"));
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
678
erpnext/accounts/doctype/payment_request/payment_request.json
Normal file
678
erpnext/accounts/doctype/payment_request/payment_request.json
Normal file
@@ -0,0 +1,678 @@
|
||||
{
|
||||
"allow_copy": 0,
|
||||
"allow_import": 0,
|
||||
"allow_rename": 0,
|
||||
"autoname": "PR.######",
|
||||
"creation": "2015-12-15 22:23:24.745065",
|
||||
"custom": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "DocType",
|
||||
"document_type": "",
|
||||
"fields": [
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "payment_details",
|
||||
"fieldtype": "Section Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Payment Details",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "amount",
|
||||
"fieldtype": "Currency",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Amount",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "2",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "currency",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Currency",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Currency",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"depends_on": "eval:doc.reference_doctype==\"Sales Order\"",
|
||||
"fieldname": "make_sales_invoice",
|
||||
"fieldtype": "Check",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Make Sales Invoice",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "column_break_5",
|
||||
"fieldtype": "Column Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"default": "Draft",
|
||||
"fieldname": "status",
|
||||
"fieldtype": "Select",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Status",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "\nDraft\nInitiated\nPaid\nFailed\nCancelled",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "section_break_7",
|
||||
"fieldtype": "Section Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "payment_gateway",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Payment Gateway",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Payment Gateway Account",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "payment_success_url",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Payment Success URL",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "column_break_9",
|
||||
"fieldtype": "Column Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "gateway",
|
||||
"fieldtype": "Read Only",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Gateway",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "payment_gateway.gateway",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "payment_account",
|
||||
"fieldtype": "Read Only",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Payment Account",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "payment_gateway.payment_account",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "recipient_and_message",
|
||||
"fieldtype": "Section Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Recipient and Message",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"default": "",
|
||||
"fieldname": "print_format",
|
||||
"fieldtype": "Select",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Print Format",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "mute_email",
|
||||
"fieldtype": "Check",
|
||||
"hidden": 1,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Mute Email",
|
||||
"length": 0,
|
||||
"no_copy": 1,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"report_hide": 1,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "email_to",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Email To",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 1,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "subject",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Subject",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "message",
|
||||
"fieldtype": "Text Editor",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Message",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "payment_url_message",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Payment URL Message",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "payment_url",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 1,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "payment_url",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "reference_details",
|
||||
"fieldtype": "Section Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Reference Details",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "reference_doctype",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Reference Doctype",
|
||||
"length": 0,
|
||||
"no_copy": 1,
|
||||
"options": "DocType",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"report_hide": 1,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "reference_name",
|
||||
"fieldtype": "Dynamic Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Reference Name",
|
||||
"length": 0,
|
||||
"no_copy": 1,
|
||||
"options": "reference_doctype",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"report_hide": 1,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "amended_from",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Amended From",
|
||||
"length": 0,
|
||||
"no_copy": 1,
|
||||
"options": "Payment Request",
|
||||
"permlevel": 0,
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
}
|
||||
],
|
||||
"hide_heading": 0,
|
||||
"hide_toolbar": 0,
|
||||
"idx": 0,
|
||||
"in_create": 0,
|
||||
"in_dialog": 0,
|
||||
"is_submittable": 1,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2016-01-11 05:49:28.342786",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Payment Request",
|
||||
"name_case": "",
|
||||
"owner": "Administrator",
|
||||
"permissions": [
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Accounts User",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"amend": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Accounts Manager",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 1,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"amend": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Administrator",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 1,
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"read_only": 0,
|
||||
"read_only_onload": 0,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC"
|
||||
}
|
||||
234
erpnext/accounts/doctype/payment_request/payment_request.py
Normal file
234
erpnext/accounts/doctype/payment_request/payment_request.py
Normal file
@@ -0,0 +1,234 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe import _
|
||||
from frappe.model.document import Document
|
||||
from frappe.utils import flt, nowdate, get_url, cstr
|
||||
from erpnext.accounts.party import get_party_account
|
||||
from erpnext.accounts.utils import get_account_currency, get_balance_on
|
||||
from erpnext.accounts.doctype.journal_entry.journal_entry import (get_payment_entry_against_invoice,
|
||||
get_payment_entry_against_order)
|
||||
|
||||
from itertools import chain
|
||||
|
||||
class PaymentRequest(Document):
|
||||
def validate(self):
|
||||
self.validate_payment_gateway_account()
|
||||
self.validate_payment_request()
|
||||
self.validate_currency()
|
||||
|
||||
def validate_payment_request(self):
|
||||
if frappe.db.get_value("Payment Request", {"reference_name": self.reference_name,
|
||||
"name": ("!=", self.name), "status": ("not in", ["Initiated", "Paid"]), "docstatus": 1}, "name"):
|
||||
frappe.throw(_("Payment Request already exists {0}".fomart(self.reference_name)))
|
||||
|
||||
def validate_currency(self):
|
||||
ref_doc = frappe.get_doc(self.reference_doctype, self.reference_name)
|
||||
if ref_doc.currency != frappe.db.get_value("Account", self.payment_account, "account_currency"):
|
||||
frappe.throw(_("Transaction currency must be same as Payment Gateway currency"))
|
||||
|
||||
def validate_payment_gateway_account(self):
|
||||
if not self.payment_gateway:
|
||||
frappe.throw(_("Payment Gateway Account is not configured"))
|
||||
|
||||
def validate_payment_gateway(self):
|
||||
if self.gateway == "PayPal":
|
||||
if not frappe.db.get_value("PayPal Settings", None, "api_username"):
|
||||
if not frappe.conf.paypal_username:
|
||||
frappe.throw(_("PayPal Settings missing"))
|
||||
|
||||
def on_submit(self):
|
||||
if not self.mute_email:
|
||||
self.send_payment_request()
|
||||
self.send_email()
|
||||
|
||||
self.make_communication_entry()
|
||||
|
||||
def on_cancel(self):
|
||||
self.set_as_cancelled()
|
||||
|
||||
def on_update_after_submit(self):
|
||||
pass
|
||||
|
||||
def set_status(self):
|
||||
pass
|
||||
|
||||
def get_payment_url(self):
|
||||
pass
|
||||
|
||||
def make_invoice(self):
|
||||
if self.make_sales_invoice:
|
||||
from erpnext.selling.doctype.sales_order.sales_order import make_sales_invoice
|
||||
si = make_sales_invoice(self.reference_name, ignore_permissions=True)
|
||||
si = si.insert(ignore_permissions=True)
|
||||
si.submit()
|
||||
|
||||
def send_payment_request(self):
|
||||
self.payment_url = get_url("/api/method/erpnext.accounts.doctype.payment_request.payment_request.generate_payment_request?name={0}".format(self.name))
|
||||
if self.payment_url:
|
||||
frappe.db.set_value(self.doctype, self.name, "status", "Initiated")
|
||||
|
||||
def set_as_paid(self):
|
||||
if frappe.session.user == "Guest":
|
||||
frappe.set_user("Administrator")
|
||||
|
||||
jv = self.create_journal_entry()
|
||||
self.make_invoice()
|
||||
|
||||
return jv
|
||||
|
||||
def create_journal_entry(self):
|
||||
"""create entry"""
|
||||
payment_details = {
|
||||
"amount": self.amount,
|
||||
"journal_entry": True,
|
||||
"bank_account": self.payment_account
|
||||
}
|
||||
|
||||
frappe.flags.ignore_account_permission = True
|
||||
|
||||
if self.reference_doctype == "Sales Order":
|
||||
jv = get_payment_entry_against_order(self.reference_doctype, self.reference_name,\
|
||||
amount=self.amount, journal_entry=True, bank_account=self.payment_account)
|
||||
|
||||
if self.reference_doctype == "Sales Invoice":
|
||||
jv = get_payment_entry_against_invoice(self.reference_doctype, self.reference_name,\
|
||||
amount=self.amount, journal_entry=True, bank_account=self.payment_account)
|
||||
|
||||
jv.update({
|
||||
"voucher_type": "Journal Entry",
|
||||
"posting_date": nowdate()
|
||||
})
|
||||
jv.insert(ignore_permissions=True)
|
||||
jv.submit()
|
||||
|
||||
#set status as paid for Payment Request
|
||||
frappe.db.set_value(self.doctype, self.name, "status", "Paid")
|
||||
|
||||
return jv
|
||||
|
||||
def send_email(self):
|
||||
"""send email with payment link"""
|
||||
frappe.sendmail(recipients=self.email_to, sender=None, subject=self.subject,
|
||||
message=self.get_message(), attachments=[frappe.attach_print(self.reference_doctype,
|
||||
self.reference_name, file_name=self.reference_name, print_format=self.print_format)])
|
||||
|
||||
def get_message(self):
|
||||
"""return message with payment gateway link"""
|
||||
return cstr(self.message) + " <a href='{0}'>{1}</a>".format(self.payment_url, \
|
||||
self.payment_url_message or _(" Click here to pay"))
|
||||
|
||||
def set_failed(self):
|
||||
pass
|
||||
|
||||
def set_as_cancelled(self):
|
||||
frappe.db.set_value(self.doctype, self.name, "status", "Cancelled")
|
||||
|
||||
def make_communication_entry(self):
|
||||
"""Make communication entry"""
|
||||
comm = frappe.get_doc({
|
||||
"doctype":"Communication",
|
||||
"subject": self.subject,
|
||||
"content": self.get_message(),
|
||||
"sent_or_received": "Sent",
|
||||
"reference_doctype": self.reference_doctype,
|
||||
"reference_name": self.reference_name
|
||||
})
|
||||
comm.insert(ignore_permissions=True)
|
||||
|
||||
def get_payment_success_url(self):
|
||||
return self.payment_success_url
|
||||
|
||||
@frappe.whitelist(allow_guest=True)
|
||||
def make_payment_request(**args):
|
||||
"""Make payment request"""
|
||||
|
||||
args = frappe._dict(args)
|
||||
ref_doc = frappe.get_doc(args.dt, args.dn)
|
||||
gateway_account = get_gateway_details(args)
|
||||
|
||||
pr = frappe.new_doc("Payment Request")
|
||||
pr.update({
|
||||
"payment_gateway": gateway_account.name,
|
||||
"gateway": gateway_account.gateway,
|
||||
"payment_account": gateway_account.payment_account,
|
||||
"currency": ref_doc.currency,
|
||||
"make_sales_invoice": args.cart or 0,
|
||||
"amount": get_amount(ref_doc, args.dt),
|
||||
"mute_email": args.mute_email or 0,
|
||||
"email_to": args.recipient_id or "",
|
||||
"subject": "Payment Request for %s"%args.dn,
|
||||
"message": gateway_account.message,
|
||||
"payment_url_message": gateway_account.payment_url_message,
|
||||
"payment_success_url": gateway_account.payment_success_url,
|
||||
"reference_doctype": args.dt,
|
||||
"reference_name": args.dn
|
||||
})
|
||||
|
||||
if args.return_doc:
|
||||
return pr
|
||||
|
||||
if args.submit_doc:
|
||||
pr.insert(ignore_permissions=True)
|
||||
pr.submit()
|
||||
|
||||
if args.cart:
|
||||
generate_payment_request(pr.name)
|
||||
frappe.db.commit()
|
||||
|
||||
if not args.cart:
|
||||
return pr
|
||||
|
||||
return pr.as_dict()
|
||||
|
||||
def get_amount(ref_doc, dt):
|
||||
"""get amount based on doctype"""
|
||||
if dt == "Sales Order":
|
||||
amount = flt(ref_doc.base_grand_total) - flt(ref_doc.advance_paid)
|
||||
|
||||
if dt == "Sales Invoice":
|
||||
amount = abs(ref_doc.outstanding_amount)
|
||||
|
||||
if amount > 0:
|
||||
return amount
|
||||
else:
|
||||
frappe.throw(_("Payment Entry is already created"))
|
||||
|
||||
def get_gateway_details(args):
|
||||
"""return gateway and payment account of default payment gateway"""
|
||||
if args.payemnt_gateway:
|
||||
gateway_account = frappe.db.get_value("Payment Gateway Account", args.payemnt_gateway,
|
||||
["name", "gateway", "payment_account", "message", "payment_url_message", "payment_success_url"],
|
||||
as_dict=1)
|
||||
|
||||
gateway_account = frappe.db.get_value("Payment Gateway Account", {"is_default": 1},
|
||||
["name", "gateway", "payment_account", "message", "payment_url_message", "payment_success_url"],
|
||||
as_dict=1)
|
||||
|
||||
if not gateway_account:
|
||||
frappe.throw(_("Payment Gateway Account is not configured"))
|
||||
|
||||
return gateway_account
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_print_format_list(ref_doctype):
|
||||
print_format_list = ["Standard"]
|
||||
|
||||
print_format_list.extend([p.name for p in frappe.get_all("Print Format",
|
||||
filters={"doc_type": ref_doctype})])
|
||||
|
||||
return {
|
||||
"print_format": print_format_list
|
||||
}
|
||||
|
||||
@frappe.whitelist(allow_guest=True)
|
||||
def generate_payment_request(name):
|
||||
frappe.get_doc("Payment Request", name).run_method("get_payment_url")
|
||||
|
||||
@frappe.whitelist(allow_guest=True)
|
||||
def resend_payment_email(docname):
|
||||
return frappe.get_doc("Payment Request", docname).send_email()
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
frappe.listview_settings['Payment Request'] = {
|
||||
add_fields: ["status"],
|
||||
get_indicator: function(doc) {
|
||||
if(doc.status == "Draft") {
|
||||
return [__("Draft"), "darkgrey", "status,=,Draft"];
|
||||
}
|
||||
else if(doc.status == "Initiated") {
|
||||
return [__("Initiated"), "green", "status,=,Initiated"];
|
||||
}
|
||||
else if(doc.status == "Paid") {
|
||||
return [__("Paid"), "blue", "status,=,Paid"];
|
||||
}
|
||||
else if(doc.status == "Cancelled") {
|
||||
return [__("Cancelled"), "orange", "status,=,Cancelled"];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
import unittest
|
||||
from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order
|
||||
from erpnext.accounts.doctype.payment_request.payment_request import make_payment_request
|
||||
from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice
|
||||
# test_records = frappe.get_test_records('Payment Request')
|
||||
|
||||
test_dependencies = ["Currency Exchange", "Journal Entry", "Contact", "Address"]
|
||||
|
||||
payment_gateway = {
|
||||
"doctype": "Payment Gateway",
|
||||
"gateway": "_Test Gateway"
|
||||
}
|
||||
|
||||
payment_method = [
|
||||
{
|
||||
"doctype": "Payment Gateway Account",
|
||||
"is_default": 1,
|
||||
"gateway": "_Test Gateway",
|
||||
"payment_account": "_Test Bank - _TC",
|
||||
"currency": "INR"
|
||||
},
|
||||
{
|
||||
"doctype": "Payment Gateway Account",
|
||||
"gateway": "_Test Gateway",
|
||||
"payment_account": "_Test Bank - _TC",
|
||||
"currency": "USD"
|
||||
}
|
||||
]
|
||||
|
||||
class TestPaymentRequest(unittest.TestCase):
|
||||
def setUp(self):
|
||||
if not frappe.db.get_value("Payment Gateway", payment_gateway["gateway"], "name"):
|
||||
frappe.get_doc(payment_gateway).insert(ignore_permissions=True)
|
||||
|
||||
for method in payment_method:
|
||||
if not frappe.db.get_value("Payment Gateway Account", {"gateway": method["gateway"],
|
||||
"currency": method["currency"]}, "name"):
|
||||
frappe.get_doc(method).insert(ignore_permissions=True)
|
||||
|
||||
def test_payment_request_linkings(self):
|
||||
SO_INR = make_sales_order(currency="INR")
|
||||
pr = make_payment_request(dt="Sales Order", dn=SO_INR.name, recipient_id="saurabh@erpnext.com")
|
||||
|
||||
self.assertEquals(pr.reference_doctype, "Sales Order")
|
||||
self.assertEquals(pr.reference_name, SO_INR.name)
|
||||
self.assertEquals(pr.currency, "INR")
|
||||
|
||||
SI_USD = create_sales_invoice(currency="USD", conversion_rate=50)
|
||||
pr = make_payment_request(dt="Sales Invoice", dn=SI_USD.name, recipient_id="saurabh@erpnext.com")
|
||||
|
||||
self.assertEquals(pr.reference_doctype, "Sales Invoice")
|
||||
self.assertEquals(pr.reference_name, SI_USD.name)
|
||||
self.assertEquals(pr.currency, "USD")
|
||||
|
||||
def test_payment_entry(self):
|
||||
SO_INR = make_sales_order(currency="INR")
|
||||
pr = make_payment_request(dt="Sales Order", dn=SO_INR.name, recipient_id="saurabh@erpnext.com",
|
||||
mute_email=1, submit_doc=1)
|
||||
jv = pr.set_as_paid()
|
||||
|
||||
SO_INR = frappe.get_doc("Sales Order", SO_INR.name)
|
||||
|
||||
self.assertEquals(SO_INR.advance_paid, jv.total_debit)
|
||||
|
||||
SI_USD = create_sales_invoice(customer="_Test Customer USD", debit_to="_Test Receivable USD - _TC",
|
||||
currency="USD", conversion_rate=50)
|
||||
|
||||
pr = make_payment_request(dt="Sales Invoice", dn=SI_USD.name, recipient_id="saurabh@erpnext.com",
|
||||
mute_email=1, return_doc=1, payemnt_gateway="_Test Gateway - USD")
|
||||
|
||||
self.assertRaises(frappe.ValidationError, pr.save)
|
||||
|
||||
|
||||
@@ -42,6 +42,10 @@ frappe.ui.form.on("Payment Tool", "refresh", function(frm) {
|
||||
frappe.ui.form.trigger("Payment Tool", "party_type");
|
||||
});
|
||||
|
||||
frappe.ui.form.on("Payment Tool", "party_type", function(frm) {
|
||||
frm.set_value("received_or_paid", frm.doc.party_type=="Customer" ? "Received" : "Paid");
|
||||
});
|
||||
|
||||
frappe.ui.form.on("Payment Tool", "party", function(frm) {
|
||||
if(frm.doc.party_type && frm.doc.party) {
|
||||
return frappe.call({
|
||||
|
||||
@@ -71,7 +71,9 @@ class PaymentTool(Document):
|
||||
d2.account = self.payment_account
|
||||
d2.account_currency = bank_account_currency
|
||||
d2.account_type = bank_account_type
|
||||
d2.exchange_rate = get_exchange_rate(self.payment_account, self.company)
|
||||
d2.exchange_rate = get_exchange_rate(self.payment_account, bank_account_currency, self.company,
|
||||
debit=(abs(total_payment_amount) if total_payment_amount < 0 else 0),
|
||||
credit=(total_payment_amount if total_payment_amount > 0 else 0))
|
||||
d2.account_balance = get_balance_on(self.payment_account)
|
||||
|
||||
amount_field_bank = 'debit_in_account_currency' if total_payment_amount < 0 \
|
||||
|
||||
@@ -180,7 +180,7 @@
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"description": "The account head under Liability, in which Profit/Loss will be booked",
|
||||
"description": "The account head under Liability or Equity, in which Profit/Loss will be booked",
|
||||
"fieldname": "closing_account_head",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"allow_copy": 0,
|
||||
"allow_import": 1,
|
||||
"allow_rename": 0,
|
||||
"autoname": "PRULE.#####",
|
||||
"allow_rename": 1,
|
||||
"autoname": "field:title",
|
||||
"creation": "2014-02-21 15:02:51",
|
||||
"custom": 0,
|
||||
"docstatus": 0,
|
||||
@@ -24,6 +24,7 @@
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -47,6 +48,7 @@
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
@@ -71,6 +73,7 @@
|
||||
"options": "\nItem Code\nItem Group\nBrand",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
@@ -95,6 +98,7 @@
|
||||
"options": "Item",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -119,6 +123,7 @@
|
||||
"options": "Brand",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -143,6 +148,7 @@
|
||||
"options": "Item Group",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -165,6 +171,7 @@
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -189,6 +196,7 @@
|
||||
"options": "\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -211,6 +219,7 @@
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -233,6 +242,7 @@
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -255,6 +265,7 @@
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -277,6 +288,7 @@
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -299,6 +311,7 @@
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -323,6 +336,7 @@
|
||||
"options": "\nCustomer\nCustomer Group\nTerritory\nSales Partner\nCampaign\nSupplier\nSupplier Type",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -347,6 +361,7 @@
|
||||
"options": "Customer",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -371,6 +386,7 @@
|
||||
"options": "Customer Group",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -395,6 +411,7 @@
|
||||
"options": "Territory",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -419,6 +436,7 @@
|
||||
"options": "Sales Partner",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -443,6 +461,7 @@
|
||||
"options": "Campaign",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -467,6 +486,7 @@
|
||||
"options": "Supplier",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -491,6 +511,7 @@
|
||||
"options": "Supplier Type",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -513,6 +534,7 @@
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -535,6 +557,7 @@
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -557,6 +580,7 @@
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -579,6 +603,7 @@
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -601,6 +626,7 @@
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -624,6 +650,7 @@
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -646,6 +673,7 @@
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -667,6 +695,7 @@
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -690,6 +719,7 @@
|
||||
"options": "Company",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -712,6 +742,7 @@
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -736,6 +767,7 @@
|
||||
"options": "\nPrice\nDiscount Percentage",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
@@ -757,6 +789,7 @@
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -780,6 +813,7 @@
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -803,6 +837,7 @@
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -827,6 +862,7 @@
|
||||
"options": "Price List",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -850,6 +886,7 @@
|
||||
"options": "Simple",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -872,6 +909,7 @@
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -890,7 +928,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2015-11-16 06:29:51.958974",
|
||||
"modified": "2016-01-15 04:05:11.633824",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Pricing Rule",
|
||||
@@ -1001,5 +1039,5 @@
|
||||
"read_only_onload": 0,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"title_field": "title"
|
||||
"title_field": ""
|
||||
}
|
||||
@@ -76,7 +76,7 @@ class PricingRule(Document):
|
||||
def apply_pricing_rule(args):
|
||||
"""
|
||||
args = {
|
||||
"item_list": [{"doctype": "", "name": "", "item_code": "", "brand": "", "item_group": ""}, ...],
|
||||
"items": [{"doctype": "", "name": "", "item_code": "", "brand": "", "item_group": ""}, ...],
|
||||
"customer": "something",
|
||||
"customer_group": "something",
|
||||
"territory": "something",
|
||||
@@ -97,18 +97,17 @@ def apply_pricing_rule(args):
|
||||
args = json.loads(args)
|
||||
|
||||
args = frappe._dict(args)
|
||||
|
||||
|
||||
if not args.transaction_type:
|
||||
set_transaction_type(args)
|
||||
|
||||
# list of dictionaries
|
||||
out = []
|
||||
|
||||
if args.get("parenttype") == "Material Request": return out
|
||||
if args.get("doctype") == "Material Request": return out
|
||||
|
||||
if not args.transaction_type:
|
||||
args.transaction_type = "buying" if frappe.get_meta(args.parenttype).get_field("supplier") \
|
||||
else "selling"
|
||||
|
||||
item_list = args.get("item_list")
|
||||
args.pop("item_list")
|
||||
item_list = args.get("items")
|
||||
args.pop("items")
|
||||
|
||||
for item in item_list:
|
||||
args_copy = copy.deepcopy(args)
|
||||
@@ -138,13 +137,17 @@ def get_pricing_rule_for_item(args):
|
||||
if not args.item_group:
|
||||
frappe.throw(_("Item Group not mentioned in item master for item {0}").format(args.item_code))
|
||||
|
||||
if args.customer and not (args.customer_group and args.territory):
|
||||
customer = frappe.db.get_value("Customer", args.customer, ["customer_group", "territory"])
|
||||
if customer:
|
||||
args.customer_group, args.territory = customer
|
||||
if args.transaction_type=="selling":
|
||||
if args.customer and not (args.customer_group and args.territory):
|
||||
customer = frappe.db.get_value("Customer", args.customer, ["customer_group", "territory"])
|
||||
if customer:
|
||||
args.customer_group, args.territory = customer
|
||||
|
||||
args.supplier = args.supplier_type = None
|
||||
|
||||
elif args.supplier and not args.supplier_type:
|
||||
args.supplier_type = frappe.db.get_value("Supplier", args.supplier, "supplier_type")
|
||||
args.customer = args.customer_group = args.territory = None
|
||||
|
||||
pricing_rules = get_pricing_rules(args)
|
||||
pricing_rule = filter_pricing_rules(args, pricing_rules)
|
||||
@@ -184,9 +187,12 @@ def get_pricing_rules(args):
|
||||
|
||||
|
||||
conditions = ""
|
||||
values = {"item_code": args.get("item_code"), "brand": args.get("brand")}
|
||||
|
||||
for field in ["company", "customer", "supplier", "supplier_type", "campaign", "sales_partner"]:
|
||||
if args.get(field):
|
||||
conditions += " and ifnull("+field+", '') in (%("+field+")s, '')"
|
||||
values[field] = args.get(field)
|
||||
else:
|
||||
conditions += " and ifnull("+field+", '') = ''"
|
||||
|
||||
@@ -194,12 +200,15 @@ def get_pricing_rules(args):
|
||||
group_condition = _get_tree_conditions(parenttype)
|
||||
if group_condition:
|
||||
conditions += " and " + group_condition
|
||||
|
||||
if not args.price_list: args.price_list = None
|
||||
conditions += " and ifnull(for_price_list, '') in (%(price_list)s, '')"
|
||||
values["price_list"] = args.get("price_list")
|
||||
|
||||
if args.get("transaction_date"):
|
||||
conditions += """ and %(transaction_date)s between ifnull(valid_from, '2000-01-01')
|
||||
and ifnull(valid_upto, '2500-12-31')"""
|
||||
values['transaction_date'] = args.get('transaction_date')
|
||||
|
||||
item_group_condition = _get_tree_conditions("Item Group", False)
|
||||
if item_group_condition: item_group_condition = " or " + item_group_condition
|
||||
@@ -210,7 +219,8 @@ def get_pricing_rules(args):
|
||||
and {transaction_type} = 1 {conditions}
|
||||
order by priority desc, name desc""".format(
|
||||
item_group_condition=item_group_condition,
|
||||
transaction_type=args.transaction_type, conditions=conditions), args, as_dict=1)
|
||||
transaction_type= args.transaction_type,
|
||||
conditions=conditions), values, as_dict=1)
|
||||
|
||||
def filter_pricing_rules(args, pricing_rules):
|
||||
# filter for qty
|
||||
@@ -267,3 +277,14 @@ def apply_internal_priority(pricing_rules, field_set, args):
|
||||
if filtered_rules: break
|
||||
|
||||
return filtered_rules or pricing_rules
|
||||
|
||||
def set_transaction_type(args):
|
||||
if args.doctype in ("Opportunity", "Quotation", "Sales Order", "Delivery Note", "Sales Invoice"):
|
||||
args.transaction_type = "selling"
|
||||
elif args.doctype in ("Material Request", "Supplier Quotation", "Purchase Order",
|
||||
"Purchase Receipt", "Purchase Invoice"):
|
||||
args.transaction_type = "buying"
|
||||
elif args.customer:
|
||||
args.transaction_type = "selling"
|
||||
else:
|
||||
args.transaction_type = "buying"
|
||||
@@ -31,22 +31,22 @@ class TestPricingRule(unittest.TestCase):
|
||||
"company": "_Test Company",
|
||||
"price_list": "_Test Price List",
|
||||
"currency": "_Test Currency",
|
||||
"parenttype": "Sales Order",
|
||||
"doctype": "Sales Order",
|
||||
"conversion_rate": 1,
|
||||
"price_list_currency": "_Test Currency",
|
||||
"plc_conversion_rate": 1,
|
||||
"order_type": "Sales",
|
||||
"transaction_type": "selling",
|
||||
"customer": "_Test Customer",
|
||||
"doctype": "Sales Order Item",
|
||||
"name": None
|
||||
})
|
||||
details = get_item_details(args)
|
||||
self.assertEquals(details.get("discount_percentage"), 10)
|
||||
|
||||
|
||||
prule = frappe.get_doc(test_record.copy())
|
||||
prule.applicable_for = "Customer"
|
||||
prule.title = "_Test Pricing Rule for Customer"
|
||||
self.assertRaises(MandatoryError, prule.insert)
|
||||
|
||||
prule.customer = "_Test Customer"
|
||||
prule.discount_percentage = 20
|
||||
prule.insert()
|
||||
@@ -56,16 +56,18 @@ class TestPricingRule(unittest.TestCase):
|
||||
prule = frappe.get_doc(test_record.copy())
|
||||
prule.apply_on = "Item Group"
|
||||
prule.item_group = "All Item Groups"
|
||||
prule.title = "_Test Pricing Rule for Item Group"
|
||||
prule.discount_percentage = 15
|
||||
prule.insert()
|
||||
|
||||
args.customer = None
|
||||
|
||||
args.customer = "_Test Customer 1"
|
||||
details = get_item_details(args)
|
||||
self.assertEquals(details.get("discount_percentage"), 10)
|
||||
|
||||
prule = frappe.get_doc(test_record.copy())
|
||||
prule.applicable_for = "Campaign"
|
||||
prule.campaign = "_Test Campaign"
|
||||
prule.title = "_Test Pricing Rule for Campaign"
|
||||
prule.discount_percentage = 5
|
||||
prule.priority = 8
|
||||
prule.insert()
|
||||
|
||||
@@ -25,13 +25,14 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({
|
||||
if(!doc.is_return) {
|
||||
if(doc.docstatus==1) {
|
||||
if(doc.outstanding_amount != 0) {
|
||||
this.frm.add_custom_button(__('Payment'), this.make_bank_entry).addClass("btn-primary");
|
||||
this.frm.add_custom_button(__('Payment'), this.make_bank_entry, __("Make"));
|
||||
cur_frm.page.set_inner_btn_group_as_primary(__("Make"));
|
||||
}
|
||||
cur_frm.add_custom_button(__('Debit Note'), this.make_debit_note);
|
||||
cur_frm.add_custom_button(__('Debit Note'), this.make_debit_note, __("Make"));
|
||||
}
|
||||
|
||||
if(doc.docstatus===0) {
|
||||
cur_frm.add_custom_button(__('From Purchase Order'), function() {
|
||||
cur_frm.add_custom_button(__('Purchase Order'), function() {
|
||||
frappe.model.map_current_doc({
|
||||
method: "erpnext.buying.doctype.purchase_order.purchase_order.make_purchase_invoice",
|
||||
source_doctype: "Purchase Order",
|
||||
@@ -43,9 +44,9 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({
|
||||
company: cur_frm.doc.company
|
||||
}
|
||||
})
|
||||
});
|
||||
}, __("Get items from"));
|
||||
|
||||
cur_frm.add_custom_button(__('From Purchase Receipt'), function() {
|
||||
cur_frm.add_custom_button(__('Purchase Receipt'), function() {
|
||||
frappe.model.map_current_doc({
|
||||
method: "erpnext.stock.doctype.purchase_receipt.purchase_receipt.make_purchase_invoice",
|
||||
source_doctype: "Purchase Receipt",
|
||||
@@ -56,7 +57,7 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({
|
||||
company: cur_frm.doc.company
|
||||
}
|
||||
})
|
||||
});
|
||||
}, __("Get items from"));
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -76,7 +77,7 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({
|
||||
me.apply_pricing_rule();
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
credit_to: function() {
|
||||
var me = this;
|
||||
if(this.frm.doc.credit_to) {
|
||||
|
||||
@@ -1153,6 +1153,31 @@
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "base_discount_amount",
|
||||
"fieldtype": "Currency",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Additional Discount Amount (Company Currency)",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Company:company:default_currency",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
@@ -1176,6 +1201,30 @@
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "additional_discount_percentage",
|
||||
"fieldtype": "Float",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Additional Discount Percentage",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
@@ -1201,31 +1250,6 @@
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "base_discount_amount",
|
||||
"fieldtype": "Currency",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Additional Discount Amount (Company Currency)",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Company:company:default_currency",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
@@ -1539,7 +1563,7 @@
|
||||
"in_list_view": 0,
|
||||
"label": "Write Off Account",
|
||||
"length": 0,
|
||||
"no_copy": 1,
|
||||
"no_copy": 0,
|
||||
"options": "Account",
|
||||
"permlevel": 0,
|
||||
"print_hide": 1,
|
||||
@@ -1564,7 +1588,7 @@
|
||||
"in_list_view": 0,
|
||||
"label": "Write Off Cost Center",
|
||||
"length": 0,
|
||||
"no_copy": 1,
|
||||
"no_copy": 0,
|
||||
"options": "Cost Center",
|
||||
"permlevel": 0,
|
||||
"print_hide": 1,
|
||||
@@ -2463,7 +2487,7 @@
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": 0,
|
||||
"modified": "2015-12-01 00:49:02.736868",
|
||||
"modified": "2016-01-25 05:18:57.728258",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Purchase Invoice",
|
||||
|
||||
@@ -11,6 +11,7 @@ import frappe.defaults
|
||||
from erpnext.controllers.buying_controller import BuyingController
|
||||
from erpnext.accounts.party import get_party_account, get_due_date
|
||||
from erpnext.accounts.utils import get_account_currency
|
||||
from erpnext.stock.doctype.purchase_receipt.purchase_receipt import update_billed_amount_based_on_po
|
||||
|
||||
form_grid_templates = {
|
||||
"items": "templates/form_grid/item_grid.html"
|
||||
@@ -150,14 +151,14 @@ class PurchaseInvoice(BuyingController):
|
||||
against_accounts = []
|
||||
stock_items = self.get_stock_items()
|
||||
for item in self.get("items"):
|
||||
# in case of auto inventory accounting,
|
||||
# in case of auto inventory accounting,
|
||||
# against expense account is always "Stock Received But Not Billed"
|
||||
# for a stock item and if not epening entry and not drop-ship entry
|
||||
|
||||
|
||||
if auto_accounting_for_stock and item.item_code in stock_items \
|
||||
and self.is_opening == 'No' and (not item.po_detail or
|
||||
and self.is_opening == 'No' and (not item.po_detail or
|
||||
not frappe.db.get_value("Purchase Order Item", item.po_detail, "delivered_by_supplier")):
|
||||
|
||||
|
||||
item.expense_account = stock_not_billed_account
|
||||
item.cost_center = None
|
||||
|
||||
@@ -246,6 +247,7 @@ class PurchaseInvoice(BuyingController):
|
||||
self.update_against_document_in_jv()
|
||||
self.update_prevdoc_status()
|
||||
self.update_billing_status_for_zero_amount_refdoc("Purchase Order")
|
||||
self.update_billing_status_in_pr()
|
||||
|
||||
self.update_project()
|
||||
|
||||
@@ -259,15 +261,19 @@ class PurchaseInvoice(BuyingController):
|
||||
gl_entries = []
|
||||
|
||||
# parent's gl entry
|
||||
if self.base_grand_total:
|
||||
if self.grand_total:
|
||||
# Didnot use base_grand_total to book rounding loss gle
|
||||
grand_total_in_company_currency = flt(self.grand_total * self.conversion_rate,
|
||||
self.precision("grand_total"))
|
||||
|
||||
gl_entries.append(
|
||||
self.get_gl_dict({
|
||||
"account": self.credit_to,
|
||||
"party_type": "Supplier",
|
||||
"party": self.supplier,
|
||||
"against": self.against_expense_account,
|
||||
"credit": self.base_grand_total,
|
||||
"credit_in_account_currency": self.base_grand_total \
|
||||
"credit": grand_total_in_company_currency,
|
||||
"credit_in_account_currency": grand_total_in_company_currency \
|
||||
if self.party_account_currency==self.company_currency else self.grand_total,
|
||||
"against_voucher": self.return_against if cint(self.is_return) else self.name,
|
||||
"against_voucher_type": self.doctype,
|
||||
@@ -407,6 +413,8 @@ class PurchaseInvoice(BuyingController):
|
||||
|
||||
self.update_prevdoc_status()
|
||||
self.update_billing_status_for_zero_amount_refdoc("Purchase Order")
|
||||
self.update_billing_status_in_pr()
|
||||
|
||||
self.make_gl_entries_on_cancel()
|
||||
self.update_project()
|
||||
|
||||
@@ -431,6 +439,24 @@ class PurchaseInvoice(BuyingController):
|
||||
if pi:
|
||||
frappe.throw("Supplier Invoice No exists in Purchase Invoice {0}".format(pi))
|
||||
|
||||
def update_billing_status_in_pr(self, update_modified=True):
|
||||
updated_pr = []
|
||||
for d in self.get("items"):
|
||||
if d.pr_detail:
|
||||
billed_amt = frappe.db.sql("""select sum(amount) from `tabPurchase Invoice Item`
|
||||
where pr_detail=%s and docstatus=1""", d.pr_detail)
|
||||
billed_amt = billed_amt and billed_amt[0][0] or 0
|
||||
frappe.db.set_value("Purchase Receipt Item", d.pr_detail, "billed_amt", billed_amt, update_modified=update_modified)
|
||||
updated_pr.append(d.purchase_receipt)
|
||||
elif d.po_detail:
|
||||
updated_pr += update_billed_amount_based_on_po(d.po_detail, update_modified)
|
||||
|
||||
for pr in set(updated_pr):
|
||||
frappe.get_doc("Purchase Receipt", pr).update_billing_percentage(update_modified=update_modified)
|
||||
|
||||
def on_recurring(self, reference_doc):
|
||||
self.due_date = None
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_expense_account(doctype, txt, searchfield, start, page_len, filters):
|
||||
from erpnext.controllers.queries import get_match_cond
|
||||
|
||||
@@ -50,15 +50,16 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
|
||||
if(doc.update_stock) this.show_stock_ledger();
|
||||
|
||||
if(doc.docstatus==1 && !doc.is_return) {
|
||||
|
||||
|
||||
var is_delivered_by_supplier = false;
|
||||
|
||||
|
||||
is_delivered_by_supplier = cur_frm.doc.items.some(function(item){
|
||||
return item.is_delivered_by_supplier ? true : false;
|
||||
})
|
||||
|
||||
|
||||
cur_frm.add_custom_button(doc.update_stock ? __('Sales Return') : __('Credit Note'),
|
||||
this.make_sales_return);
|
||||
this.make_sales_return, __("Make"));
|
||||
cur_frm.page.set_inner_btn_group_as_primary(__("Make"));
|
||||
|
||||
if(cint(doc.update_stock)!=1) {
|
||||
// show Make Delivery Note button only if Sales Invoice is not created from Delivery Note
|
||||
@@ -69,12 +70,14 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
|
||||
});
|
||||
|
||||
if(!from_delivery_note && !is_delivered_by_supplier) {
|
||||
cur_frm.add_custom_button(__('Delivery'), cur_frm.cscript['Make Delivery Note']).addClass("btn-primary");
|
||||
cur_frm.add_custom_button(__('Delivery'), cur_frm.cscript['Make Delivery Note'],
|
||||
__("Make"));
|
||||
}
|
||||
}
|
||||
|
||||
if(doc.outstanding_amount!=0 && !cint(doc.is_return)) {
|
||||
cur_frm.add_custom_button(__('Payment'), cur_frm.cscript.make_bank_entry).addClass("btn-primary");
|
||||
cur_frm.add_custom_button(__('Payment Request'), this.make_payment_request, __("Make"));
|
||||
cur_frm.add_custom_button(__('Payment'), cur_frm.cscript.make_bank_entry, __("Make"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -104,7 +107,7 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
|
||||
},
|
||||
|
||||
sales_order_btn: function() {
|
||||
this.$sales_order_btn = cur_frm.add_custom_button(__('From Sales Order'),
|
||||
this.$sales_order_btn = cur_frm.add_custom_button(__('Sales Order'),
|
||||
function() {
|
||||
frappe.model.map_current_doc({
|
||||
method: "erpnext.selling.doctype.sales_order.sales_order.make_sales_invoice",
|
||||
@@ -117,11 +120,11 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
|
||||
company: cur_frm.doc.company
|
||||
}
|
||||
})
|
||||
});
|
||||
}, __("Get items from"));
|
||||
},
|
||||
|
||||
delivery_note_btn: function() {
|
||||
this.$delivery_note_btn = cur_frm.add_custom_button(__('From Delivery Note'),
|
||||
this.$delivery_note_btn = cur_frm.add_custom_button(__('Delivery Note'),
|
||||
function() {
|
||||
frappe.model.map_current_doc({
|
||||
method: "erpnext.stock.doctype.delivery_note.delivery_note.make_sales_invoice",
|
||||
@@ -137,7 +140,7 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
|
||||
};
|
||||
}
|
||||
});
|
||||
});
|
||||
}, __("Get items from"));
|
||||
},
|
||||
|
||||
tc_name: function() {
|
||||
@@ -435,9 +438,11 @@ cur_frm.cscript.on_submit = function(doc, cdt, cdn) {
|
||||
})
|
||||
|
||||
if(cur_frm.doc.is_pos) {
|
||||
cur_frm.msgbox = frappe.msgprint('<a class="btn btn-primary" \
|
||||
onclick="cur_frm.print_preview.printit(true)" style="margin-right: 5px;">Print</a>\
|
||||
<a class="btn btn-default" href="#Form/Sales Invoice/New Sales Invoice">New</a>');
|
||||
cur_frm.msgbox = frappe.msgprint(format('<a class="btn btn-primary" \
|
||||
onclick="cur_frm.print_preview.printit(true)" style="margin-right: 5px;">{0}</a>\
|
||||
<a class="btn btn-default" href="javascript:new_doc(cur_frm.doctype);">{1}</a>', [
|
||||
__('Print'), __('New')
|
||||
]));
|
||||
|
||||
} else if(cint(frappe.boot.notification_settings.sales_invoice)) {
|
||||
cur_frm.email_doc(frappe.boot.notification_settings.sales_invoice_message);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -12,6 +12,7 @@ from frappe.model.mapper import get_mapped_doc
|
||||
|
||||
from erpnext.controllers.selling_controller import SellingController
|
||||
from erpnext.accounts.utils import get_account_currency
|
||||
from erpnext.stock.doctype.delivery_note.delivery_note import update_billed_amount_based_on_so
|
||||
|
||||
form_grid_templates = {
|
||||
"items": "templates/form_grid/item_grid.html"
|
||||
@@ -98,6 +99,7 @@ class SalesInvoice(SellingController):
|
||||
|
||||
self.update_status_updater_args()
|
||||
self.update_prevdoc_status()
|
||||
self.update_billing_status_in_dn()
|
||||
|
||||
# this sequence because outstanding may get -ve
|
||||
self.make_gl_entries()
|
||||
@@ -111,6 +113,7 @@ class SalesInvoice(SellingController):
|
||||
|
||||
self.update_time_log_batch(self.name)
|
||||
|
||||
|
||||
def before_cancel(self):
|
||||
self.update_time_log_batch(None)
|
||||
|
||||
@@ -129,6 +132,7 @@ class SalesInvoice(SellingController):
|
||||
|
||||
self.update_status_updater_args()
|
||||
self.update_prevdoc_status()
|
||||
self.update_billing_status_in_dn()
|
||||
|
||||
if not self.is_return:
|
||||
self.update_billing_status_for_zero_amount_refdoc("Sales Order")
|
||||
@@ -296,6 +300,9 @@ class SalesInvoice(SellingController):
|
||||
account = frappe.db.get_value("Account", self.debit_to,
|
||||
["account_type", "report_type", "account_currency"], as_dict=True)
|
||||
|
||||
if not account:
|
||||
frappe.throw(_("Debit To is required"))
|
||||
|
||||
if account.report_type != "Balance Sheet":
|
||||
frappe.throw(_("Debit To account must be a Balance Sheet account"))
|
||||
|
||||
@@ -381,7 +388,7 @@ class SalesInvoice(SellingController):
|
||||
|
||||
def validate_warehouse(self):
|
||||
super(SalesInvoice, self).validate_warehouse()
|
||||
|
||||
|
||||
for d in self.get('items'):
|
||||
if not d.warehouse:
|
||||
frappe.throw(_("Warehouse required at Row No {0}").format(d.idx))
|
||||
@@ -410,7 +417,7 @@ class SalesInvoice(SellingController):
|
||||
if self.c_form_applicable == 'Yes' and self.c_form_no:
|
||||
msgprint(_("Please remove this Invoice {0} from C-Form {1}")
|
||||
.format(self.name, self.c_form_no), raise_exception = 1)
|
||||
|
||||
|
||||
def validate_dropship_item(self):
|
||||
for item in self.items:
|
||||
if item.sales_order:
|
||||
@@ -524,14 +531,18 @@ class SalesInvoice(SellingController):
|
||||
|
||||
def make_customer_gl_entry(self, gl_entries):
|
||||
if self.grand_total:
|
||||
# Didnot use base_grand_total to book rounding loss gle
|
||||
grand_total_in_company_currency = flt(self.grand_total * self.conversion_rate,
|
||||
self.precision("grand_total"))
|
||||
|
||||
gl_entries.append(
|
||||
self.get_gl_dict({
|
||||
"account": self.debit_to,
|
||||
"party_type": "Customer",
|
||||
"party": self.customer,
|
||||
"against": self.against_income_account,
|
||||
"debit": self.base_grand_total,
|
||||
"debit_in_account_currency": self.base_grand_total \
|
||||
"debit": grand_total_in_company_currency,
|
||||
"debit_in_account_currency": grand_total_in_company_currency \
|
||||
if self.party_account_currency==self.company_currency else self.grand_total,
|
||||
"against_voucher": self.return_against if cint(self.is_return) else self.name,
|
||||
"against_voucher_type": self.doctype
|
||||
@@ -630,6 +641,27 @@ class SalesInvoice(SellingController):
|
||||
}, write_off_account_currency)
|
||||
)
|
||||
|
||||
def update_billing_status_in_dn(self, update_modified=True):
|
||||
updated_delivery_notes = []
|
||||
for d in self.get("items"):
|
||||
if d.dn_detail:
|
||||
billed_amt = frappe.db.sql("""select sum(amount) from `tabSales Invoice Item`
|
||||
where dn_detail=%s and docstatus=1""", d.dn_detail)
|
||||
billed_amt = billed_amt and billed_amt[0][0] or 0
|
||||
frappe.db.set_value("Delivery Note Item", d.dn_detail, "billed_amt", billed_amt, update_modified=update_modified)
|
||||
updated_delivery_notes.append(d.delivery_note)
|
||||
elif d.so_detail:
|
||||
updated_delivery_notes += update_billed_amount_based_on_so(d.so_detail, update_modified)
|
||||
|
||||
for dn in set(updated_delivery_notes):
|
||||
frappe.get_doc("Delivery Note", dn).update_billing_percentage(update_modified=update_modified)
|
||||
|
||||
def on_recurring(self, reference_doc):
|
||||
for fieldname in ("c_form_applicable", "c_form_no", "write_off_amount"):
|
||||
self.set(fieldname, reference_doc.get(fieldname))
|
||||
|
||||
self.due_date = None
|
||||
|
||||
def get_list_context(context=None):
|
||||
from erpnext.controllers.website_list_for_contact import get_list_context
|
||||
list_context = get_list_context(context)
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
"custom": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "DocType",
|
||||
"document_type": "Document",
|
||||
"fields": [
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
@@ -23,6 +24,7 @@
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -48,6 +50,7 @@
|
||||
"options": "Item",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -69,6 +72,7 @@
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -93,6 +97,7 @@
|
||||
"oldfieldtype": "Data",
|
||||
"permlevel": 0,
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
@@ -115,6 +120,7 @@
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -138,6 +144,7 @@
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -162,6 +169,7 @@
|
||||
"oldfieldtype": "Text",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"print_width": "200px",
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
@@ -186,6 +194,7 @@
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -210,6 +219,7 @@
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -233,6 +243,7 @@
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -255,6 +266,7 @@
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -279,6 +291,7 @@
|
||||
"oldfieldtype": "Currency",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -304,6 +317,7 @@
|
||||
"options": "currency",
|
||||
"permlevel": 0,
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -329,6 +343,7 @@
|
||||
"oldfieldtype": "Float",
|
||||
"permlevel": 0,
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -350,6 +365,7 @@
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -373,6 +389,7 @@
|
||||
"options": "UOM",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -398,6 +415,7 @@
|
||||
"options": "Company:company:default_currency",
|
||||
"permlevel": 0,
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -419,6 +437,7 @@
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -444,6 +463,7 @@
|
||||
"options": "currency",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
@@ -469,6 +489,7 @@
|
||||
"options": "currency",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
@@ -490,6 +511,7 @@
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -515,6 +537,7 @@
|
||||
"options": "Company:company:default_currency",
|
||||
"permlevel": 0,
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
@@ -540,6 +563,7 @@
|
||||
"options": "Company:company:default_currency",
|
||||
"permlevel": 0,
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
@@ -563,6 +587,7 @@
|
||||
"options": "Pricing Rule",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -585,6 +610,7 @@
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -609,6 +635,7 @@
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -633,6 +660,7 @@
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -655,6 +683,7 @@
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -679,6 +708,7 @@
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -703,6 +733,7 @@
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -727,6 +758,7 @@
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -750,6 +782,7 @@
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -772,6 +805,7 @@
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -797,6 +831,7 @@
|
||||
"options": "Account",
|
||||
"permlevel": 0,
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"print_width": "120px",
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
@@ -822,6 +857,7 @@
|
||||
"options": "Account",
|
||||
"permlevel": 0,
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -844,6 +880,7 @@
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -870,6 +907,7 @@
|
||||
"options": "Cost Center",
|
||||
"permlevel": 0,
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"print_width": "120px",
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
@@ -895,6 +933,7 @@
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -920,6 +959,7 @@
|
||||
"options": "Warehouse",
|
||||
"permlevel": 0,
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -933,17 +973,18 @@
|
||||
"collapsible": 0,
|
||||
"fieldname": "target_warehouse",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"hidden": 1,
|
||||
"ignore_user_permissions": 1,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Target Warehouse",
|
||||
"label": "Customer Warehouse (Optional)",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"no_copy": 1,
|
||||
"options": "Warehouse",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -968,6 +1009,7 @@
|
||||
"oldfieldtype": "Small Text",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -991,6 +1033,7 @@
|
||||
"options": "Batch",
|
||||
"permlevel": 0,
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -1017,6 +1060,7 @@
|
||||
"options": "Item Group",
|
||||
"permlevel": 0,
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -1041,6 +1085,7 @@
|
||||
"oldfieldtype": "Data",
|
||||
"permlevel": 0,
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -1065,6 +1110,7 @@
|
||||
"oldfieldtype": "Small Text",
|
||||
"permlevel": 0,
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -1086,6 +1132,7 @@
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -1109,6 +1156,7 @@
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"print_width": "150px",
|
||||
"read_only": 1,
|
||||
"report_hide": 0,
|
||||
@@ -1135,6 +1183,7 @@
|
||||
"oldfieldtype": "Currency",
|
||||
"permlevel": 0,
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -1158,6 +1207,7 @@
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -1181,6 +1231,7 @@
|
||||
"options": "Time Log Batch",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -1197,7 +1248,7 @@
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 1,
|
||||
"in_list_view": 1,
|
||||
"in_list_view": 0,
|
||||
"label": "Sales Order",
|
||||
"length": 0,
|
||||
"no_copy": 1,
|
||||
@@ -1206,6 +1257,7 @@
|
||||
"options": "Sales Order",
|
||||
"permlevel": 0,
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -1230,6 +1282,7 @@
|
||||
"oldfieldtype": "Data",
|
||||
"permlevel": 0,
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -1252,6 +1305,7 @@
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -1277,6 +1331,7 @@
|
||||
"options": "Delivery Note",
|
||||
"permlevel": 0,
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -1301,6 +1356,7 @@
|
||||
"oldfieldtype": "Data",
|
||||
"permlevel": 0,
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -1325,6 +1381,7 @@
|
||||
"oldfieldtype": "Currency",
|
||||
"permlevel": 0,
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -1347,6 +1404,7 @@
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -1369,6 +1427,7 @@
|
||||
"no_copy": 1,
|
||||
"permlevel": 0,
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 1,
|
||||
"reqd": 0,
|
||||
@@ -1386,7 +1445,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 1,
|
||||
"max_attachments": 0,
|
||||
"modified": "2015-11-16 06:29:56.335017",
|
||||
"modified": "2016-02-01 11:16:58.288462",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Sales Invoice Item",
|
||||
|
||||
@@ -141,6 +141,8 @@ def make_round_off_gle(gl_map, debit_credit_diff):
|
||||
|
||||
round_off_gle.update({
|
||||
"account": round_off_account,
|
||||
"debit_in_account_currency": abs(debit_credit_diff) if debit_credit_diff < 0 else 0,
|
||||
"credit_in_account_currency": debit_credit_diff if debit_credit_diff > 0 else 0,
|
||||
"debit": abs(debit_credit_diff) if debit_credit_diff < 0 else 0,
|
||||
"credit": debit_credit_diff if debit_credit_diff > 0 else 0,
|
||||
"cost_center": round_off_cost_center,
|
||||
|
||||
@@ -66,7 +66,7 @@ frappe.pages["Accounts Browser"].on_page_load = function(wrapper){
|
||||
$.each(r.message, function(i, v) {
|
||||
$('<option>').html(v).attr('value', v).appendTo(wrapper.$company_select);
|
||||
});
|
||||
wrapper.$company_select.val(frappe.defaults.get_user_default("company") || r.message[0]).change();
|
||||
wrapper.$company_select.val(frappe.defaults.get_user_default("Company") || r.message[0]).change();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ from frappe.defaults import get_user_permissions
|
||||
from frappe.utils import add_days, getdate, formatdate, get_first_day, date_diff
|
||||
from erpnext.utilities.doctype.address.address import get_address_display
|
||||
from erpnext.utilities.doctype.contact.contact import get_contact_details
|
||||
from erpnext.exceptions import InvalidAccountCurrency
|
||||
from erpnext.exceptions import PartyFrozen, InvalidCurrency, PartyDisabled, InvalidAccountCurrency
|
||||
|
||||
class DuplicatePartyAccountError(frappe.ValidationError): pass
|
||||
|
||||
@@ -237,16 +237,11 @@ def get_due_date(posting_date, party_type, party, company):
|
||||
due_date = None
|
||||
if posting_date and party:
|
||||
due_date = posting_date
|
||||
if party_type=="Customer":
|
||||
credit_days_based_on, credit_days = get_credit_days(party_type, party, company)
|
||||
if credit_days_based_on == "Fixed Days" and credit_days:
|
||||
due_date = add_days(posting_date, credit_days)
|
||||
elif credit_days_based_on == "Last Day of the Next Month":
|
||||
due_date = (get_first_day(posting_date, 0, 2) + datetime.timedelta(-1)).strftime("%Y-%m-%d")
|
||||
else:
|
||||
credit_days = get_credit_days(party_type, party, company)
|
||||
if credit_days:
|
||||
due_date = add_days(posting_date, credit_days)
|
||||
credit_days_based_on, credit_days = get_credit_days(party_type, party, company)
|
||||
if credit_days_based_on == "Fixed Days" and credit_days:
|
||||
due_date = add_days(posting_date, credit_days)
|
||||
elif credit_days_based_on == "Last Day of the Next Month":
|
||||
due_date = (get_first_day(posting_date, 0, 2) + datetime.timedelta(-1)).strftime("%Y-%m-%d")
|
||||
|
||||
return due_date
|
||||
|
||||
@@ -255,20 +250,21 @@ def get_credit_days(party_type, party, company):
|
||||
if party_type == "Customer":
|
||||
credit_days_based_on, credit_days, customer_group = \
|
||||
frappe.db.get_value(party_type, party, ["credit_days_based_on", "credit_days", "customer_group"])
|
||||
|
||||
if not credit_days_based_on:
|
||||
credit_days_based_on, credit_days = \
|
||||
frappe.db.get_value("Customer Group", customer_group, ["credit_days_based_on", "credit_days"]) \
|
||||
or frappe.db.get_value("Company", company, ["credit_days_based_on", "credit_days"])
|
||||
|
||||
return credit_days_based_on, credit_days
|
||||
else:
|
||||
credit_days, supplier_type = frappe.db.get_value(party_type, party, ["credit_days", "supplier_type"])
|
||||
if not credit_days:
|
||||
credit_days = frappe.db.get_value("Supplier Type", supplier_type, "credit_days") \
|
||||
or frappe.db.get_value("Company", company, "credit_days")
|
||||
credit_days_based_on, credit_days, supplier_type = \
|
||||
frappe.db.get_value(party_type, party, ["credit_days_based_on", "credit_days", "supplier_type"])
|
||||
|
||||
return credit_days
|
||||
if not credit_days_based_on:
|
||||
if party_type == "Customer":
|
||||
credit_days_based_on, credit_days = \
|
||||
frappe.db.get_value("Customer Group", customer_group, ["credit_days_based_on", "credit_days"]) \
|
||||
or frappe.db.get_value("Company", company, ["credit_days_based_on", "credit_days"])
|
||||
else:
|
||||
credit_days_based_on, credit_days = \
|
||||
frappe.db.get_value("Supplier Type", supplier_type, ["credit_days_based_on", "credit_days"])\
|
||||
or frappe.db.get_value("Company", company, ["credit_days_based_on", "credit_days"] )
|
||||
|
||||
return credit_days_based_on, credit_days
|
||||
|
||||
def validate_due_date(posting_date, due_date, party_type, party, company):
|
||||
if getdate(due_date) < getdate(posting_date):
|
||||
@@ -312,3 +308,13 @@ def set_taxes(party, party_type, posting_date, company, customer_group=None, sup
|
||||
args.update({"use_for_shopping_cart": use_for_shopping_cart})
|
||||
|
||||
return get_tax_template(posting_date, args)
|
||||
|
||||
def validate_party_frozen_disabled(party_type, party_name):
|
||||
if party_type and party_name:
|
||||
party = frappe.db.get_value(party_type, party_name, ["is_frozen", "disabled"], as_dict=True)
|
||||
if party.disabled:
|
||||
frappe.throw("{0} {1} is disabled".format(party_type, party_name), PartyDisabled)
|
||||
elif party.is_frozen:
|
||||
frozen_accounts_modifier = frappe.db.get_value( 'Accounts Settings', None,'frozen_accounts_modifier')
|
||||
if not frozen_accounts_modifier in frappe.get_roles():
|
||||
frappe.throw("{0} {1} is frozen".format(party_type, party_name), PartyFrozen)
|
||||
|
||||
@@ -8,7 +8,7 @@ frappe.query_reports["Accounts Payable"] = {
|
||||
"label": __("Company"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Company",
|
||||
"default": frappe.defaults.get_user_default("company")
|
||||
"default": frappe.defaults.get_user_default("Company")
|
||||
},
|
||||
{
|
||||
"fieldname":"supplier",
|
||||
|
||||
@@ -8,7 +8,7 @@ frappe.query_reports["Accounts Payable Summary"] = {
|
||||
"label": __("Company"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Company",
|
||||
"default": frappe.defaults.get_user_default("company")
|
||||
"default": frappe.defaults.get_user_default("Company")
|
||||
},
|
||||
{
|
||||
"fieldname":"supplier",
|
||||
|
||||
@@ -8,7 +8,7 @@ frappe.query_reports["Accounts Receivable"] = {
|
||||
"label": __("Company"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Company",
|
||||
"default": frappe.defaults.get_user_default("company")
|
||||
"default": frappe.defaults.get_user_default("Company")
|
||||
},
|
||||
{
|
||||
"fieldname":"customer",
|
||||
|
||||
@@ -68,6 +68,7 @@ class ReceivablePayableReport(object):
|
||||
"label": _("Currency"),
|
||||
"fieldtype": "Data",
|
||||
"width": 100,
|
||||
"hidden": 1
|
||||
},
|
||||
_("Remarks") + "::200"
|
||||
]
|
||||
|
||||
@@ -8,7 +8,7 @@ frappe.query_reports["Accounts Receivable Summary"] = {
|
||||
"label": __("Company"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Company",
|
||||
"default": frappe.defaults.get_user_default("company")
|
||||
"default": frappe.defaults.get_user_default("Company")
|
||||
},
|
||||
{
|
||||
"fieldname":"customer",
|
||||
|
||||
@@ -8,12 +8,14 @@ from frappe.utils import flt
|
||||
from erpnext.accounts.report.financial_statements import (get_period_list, get_columns, get_data)
|
||||
|
||||
def execute(filters=None):
|
||||
period_list = get_period_list(filters.fiscal_year, filters.periodicity, from_beginning=True)
|
||||
|
||||
asset = get_data(filters.company, "Asset", "Debit", period_list)
|
||||
liability = get_data(filters.company, "Liability", "Credit", period_list)
|
||||
equity = get_data(filters.company, "Equity", "Credit", period_list)
|
||||
provisional_profit_loss = get_provisional_profit_loss(asset, liability, equity, period_list)
|
||||
period_list = get_period_list(filters.fiscal_year, filters.periodicity)
|
||||
|
||||
asset = get_data(filters.company, "Asset", "Debit", period_list, only_current_fiscal_year=False)
|
||||
liability = get_data(filters.company, "Liability", "Credit", period_list, only_current_fiscal_year=False)
|
||||
equity = get_data(filters.company, "Equity", "Credit", period_list, only_current_fiscal_year=False)
|
||||
|
||||
provisional_profit_loss = get_provisional_profit_loss(asset, liability, equity,
|
||||
period_list, filters.company)
|
||||
|
||||
data = []
|
||||
data.extend(asset or [])
|
||||
@@ -22,16 +24,18 @@ def execute(filters=None):
|
||||
if provisional_profit_loss:
|
||||
data.append(provisional_profit_loss)
|
||||
|
||||
columns = get_columns(period_list)
|
||||
columns = get_columns(filters.periodicity, period_list, company=filters.company)
|
||||
|
||||
return columns, data
|
||||
|
||||
def get_provisional_profit_loss(asset, liability, equity, period_list):
|
||||
def get_provisional_profit_loss(asset, liability, equity, period_list, company):
|
||||
if asset and (liability or equity):
|
||||
total=0
|
||||
provisional_profit_loss = {
|
||||
"account_name": "'" + _("Provisional Profit / Loss (Credit)") + "'",
|
||||
"account": None,
|
||||
"warn_if_negative": True
|
||||
"warn_if_negative": True,
|
||||
"currency": frappe.db.get_value("Company", company, "default_currency")
|
||||
}
|
||||
|
||||
has_value = False
|
||||
@@ -47,6 +51,9 @@ def get_provisional_profit_loss(asset, liability, equity, period_list):
|
||||
|
||||
if provisional_profit_loss[period.key]:
|
||||
has_value = True
|
||||
|
||||
total += flt(provisional_profit_loss[period.key])
|
||||
provisional_profit_loss["total"] = total
|
||||
|
||||
if has_value:
|
||||
return provisional_profit_loss
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<div style="margin-bottom: 7px;" class="text-center">
|
||||
<div style="margin-bottom: 7px;">
|
||||
{%= frappe.boot.letter_heads[frappe.defaults.get_default("letter_head")] %}
|
||||
</div>
|
||||
<h2 class="text-center">{%= __("Bank Reconciliation Statement") %}</h2>
|
||||
<h4 class="text-center">{%= filters.account %}</h4>
|
||||
<h4 class="text-center">{%= filters.account && (filters.account + ", "+filters.report_date) || "" %} {%= filters.company %}</h4>
|
||||
<hr>
|
||||
<table class="table table-bordered">
|
||||
<thead>
|
||||
|
||||
@@ -39,18 +39,18 @@ def execute(filters=None):
|
||||
+ amounts_not_reflected_in_system
|
||||
|
||||
data += [
|
||||
get_balance_row(_("System Balance"), balance_as_per_system, account_currency),
|
||||
get_balance_row(_("Bank Statement balance as per General Ledger"), balance_as_per_system, account_currency),
|
||||
{},
|
||||
{
|
||||
"journal_entry": '"' + _("Amounts not reflected in bank") + '"',
|
||||
"journal_entry": _("Outstanding Cheques and Deposits to clear"),
|
||||
"debit": total_debit,
|
||||
"credit": total_credit,
|
||||
"account_currency": account_currency
|
||||
},
|
||||
get_balance_row(_("Amounts not reflected in system"), amounts_not_reflected_in_system,
|
||||
get_balance_row(_("Cheques and Deposits incorrectly cleared"), amounts_not_reflected_in_system,
|
||||
account_currency),
|
||||
{},
|
||||
get_balance_row(_("Expected balance as per bank"), bank_bal, account_currency)
|
||||
get_balance_row(_("Calculated Bank Statement balance"), bank_bal, account_currency)
|
||||
]
|
||||
|
||||
return columns, data
|
||||
@@ -129,22 +129,22 @@ def get_entries(filters):
|
||||
and jvd.account = %(account)s and jv.posting_date <= %(report_date)s
|
||||
and ifnull(jv.clearance_date, '4000-01-01') > %(report_date)s
|
||||
and ifnull(jv.is_opening, 'No') = 'No'
|
||||
order by jv.name DESC""", filters, as_dict=1)
|
||||
order by jv.posting_date DESC,jv.name DESC""", filters, as_dict=1)
|
||||
|
||||
return entries
|
||||
|
||||
def get_balance_row(label, amount, account_currency):
|
||||
if amount > 0:
|
||||
return {
|
||||
"journal_entry": '"' + label + '"',
|
||||
"journal_entry": label,
|
||||
"debit": amount,
|
||||
"credit": 0,
|
||||
"account_currency": account_currency
|
||||
}
|
||||
else:
|
||||
return {
|
||||
"journal_entry": '"' + label + '"',
|
||||
"journal_entry": label,
|
||||
"debit": 0,
|
||||
"credit": abs(amount),
|
||||
"account_currency": account_currency
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,12 @@ frappe.query_reports["Budget Variance Report"] = {
|
||||
fieldname: "period",
|
||||
label: __("Period"),
|
||||
fieldtype: "Select",
|
||||
options: "Monthly\nQuarterly\nHalf-Yearly\nYearly",
|
||||
options: [
|
||||
{ "value": "Monthly", "label": __("Monthly") },
|
||||
{ "value": "Quarterly", "label": __("Quarterly") },
|
||||
{ "value": "Half-Yearly", "label": __("Half-Yearly") },
|
||||
{ "value": "Yearly", "label": __("Yearly") }
|
||||
],
|
||||
default: "Monthly"
|
||||
},
|
||||
{
|
||||
@@ -22,7 +27,7 @@ frappe.query_reports["Budget Variance Report"] = {
|
||||
label: __("Company"),
|
||||
fieldtype: "Link",
|
||||
options: "Company",
|
||||
default: frappe.defaults.get_user_default("company")
|
||||
default: frappe.defaults.get_user_default("Company")
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
0
erpnext/accounts/report/cash_flow/__init__.py
Normal file
0
erpnext/accounts/report/cash_flow/__init__.py
Normal file
12
erpnext/accounts/report/cash_flow/cash_flow.js
Normal file
12
erpnext/accounts/report/cash_flow/cash_flow.js
Normal file
@@ -0,0 +1,12 @@
|
||||
// Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors
|
||||
// For license information, please see license.txt
|
||||
|
||||
frappe.require("assets/erpnext/js/financial_statements.js");
|
||||
|
||||
frappe.query_reports["Cash Flow"] = erpnext.financial_statements;
|
||||
|
||||
frappe.query_reports["Cash Flow"]["filters"].push({
|
||||
"fieldname": "accumulated_values",
|
||||
"label": __("Accumulated Values"),
|
||||
"fieldtype": "Check"
|
||||
})
|
||||
18
erpnext/accounts/report/cash_flow/cash_flow.json
Normal file
18
erpnext/accounts/report/cash_flow/cash_flow.json
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"add_total_row": 0,
|
||||
"apply_user_permissions": 1,
|
||||
"creation": "2015-12-12 10:22:45.383203",
|
||||
"disabled": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "Report",
|
||||
"idx": 0,
|
||||
"is_standard": "Yes",
|
||||
"modified": "2015-12-12 10:22:45.383203",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Cash Flow",
|
||||
"owner": "Administrator",
|
||||
"ref_doctype": "GL Entry",
|
||||
"report_name": "Cash Flow",
|
||||
"report_type": "Script Report"
|
||||
}
|
||||
145
erpnext/accounts/report/cash_flow/cash_flow.py
Normal file
145
erpnext/accounts/report/cash_flow/cash_flow.py
Normal file
@@ -0,0 +1,145 @@
|
||||
# Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe import _
|
||||
from erpnext.accounts.report.financial_statements import (get_period_list, get_columns, get_data)
|
||||
from erpnext.accounts.report.profit_and_loss_statement.profit_and_loss_statement import get_net_profit_loss
|
||||
|
||||
|
||||
def execute(filters=None):
|
||||
period_list = get_period_list(filters.fiscal_year, filters.periodicity)
|
||||
|
||||
operation_accounts = {
|
||||
"section_name": "Operations",
|
||||
"section_footer": _("Net Cash from Operations"),
|
||||
"section_header": _("Cash Flow from Operations"),
|
||||
"account_types": [
|
||||
{"account_type": "Depreciation", "label": _("Depreciation")},
|
||||
{"account_type": "Receivable", "label": _("Net Change in Accounts Receivable")},
|
||||
{"account_type": "Payable", "label": _("Net Change in Accounts Payable")},
|
||||
{"account_type": "Warehouse", "label": _("Net Change in Inventory")}
|
||||
]
|
||||
}
|
||||
|
||||
investing_accounts = {
|
||||
"section_name": "Investing",
|
||||
"section_footer": _("Net Cash from Investing"),
|
||||
"section_header": _("Cash Flow from Investing"),
|
||||
"account_types": [
|
||||
{"account_type": "Fixed Asset", "label": _("Net Change in Fixed Asset")}
|
||||
]
|
||||
}
|
||||
|
||||
financing_accounts = {
|
||||
"section_name": "Financing",
|
||||
"section_footer": _("Net Cash from Financing"),
|
||||
"section_header": _("Cash Flow from Financing"),
|
||||
"account_types": [
|
||||
{"account_type": "Equity", "label": _("Net Change in Equity")}
|
||||
]
|
||||
}
|
||||
|
||||
# combine all cash flow accounts for iteration
|
||||
cash_flow_accounts = []
|
||||
cash_flow_accounts.append(operation_accounts)
|
||||
cash_flow_accounts.append(investing_accounts)
|
||||
cash_flow_accounts.append(financing_accounts)
|
||||
|
||||
# compute net profit / loss
|
||||
income = get_data(filters.company, "Income", "Credit", period_list,
|
||||
accumulated_values=filters.accumulated_values, ignore_closing_entries=True)
|
||||
expense = get_data(filters.company, "Expense", "Debit", period_list,
|
||||
accumulated_values=filters.accumulated_values, ignore_closing_entries=True)
|
||||
|
||||
net_profit_loss = get_net_profit_loss(income, expense, period_list, filters.company)
|
||||
|
||||
data = []
|
||||
company_currency = frappe.db.get_value("Company", filters.company, "default_currency")
|
||||
|
||||
for cash_flow_account in cash_flow_accounts:
|
||||
|
||||
section_data = []
|
||||
data.append({
|
||||
"account_name": cash_flow_account['section_header'],
|
||||
"parent_account": None,
|
||||
"indent": 0.0,
|
||||
"account": cash_flow_account['section_header']
|
||||
})
|
||||
|
||||
if len(data) == 1:
|
||||
# add first net income in operations section
|
||||
if net_profit_loss:
|
||||
net_profit_loss.update({
|
||||
"indent": 1,
|
||||
"parent_account": operation_accounts['section_header']
|
||||
})
|
||||
data.append(net_profit_loss)
|
||||
section_data.append(net_profit_loss)
|
||||
|
||||
for account in cash_flow_account['account_types']:
|
||||
account_data = get_account_type_based_data(filters.company,
|
||||
account['account_type'], period_list, filters.accumulated_values)
|
||||
account_data.update({
|
||||
"account_name": account['label'],
|
||||
"indent": 1,
|
||||
"parent_account": cash_flow_account['section_header'],
|
||||
"currency": company_currency
|
||||
})
|
||||
data.append(account_data)
|
||||
section_data.append(account_data)
|
||||
|
||||
add_total_row_account(data, section_data, cash_flow_account['section_footer'],
|
||||
period_list, company_currency)
|
||||
|
||||
add_total_row_account(data, data, _("Net Change in Cash"), period_list, company_currency)
|
||||
columns = get_columns(filters.periodicity, period_list, filters.accumulated_values, filters.company)
|
||||
|
||||
return columns, data
|
||||
|
||||
|
||||
def get_account_type_based_data(company, account_type, period_list, accumulated_values):
|
||||
data = {}
|
||||
total = 0
|
||||
for period in period_list:
|
||||
gl_sum = frappe.db.sql_list("""
|
||||
select sum(credit) - sum(debit)
|
||||
from `tabGL Entry`
|
||||
where company=%s and posting_date >= %s and posting_date <= %s
|
||||
and voucher_type != 'Period Closing Voucher'
|
||||
and account in ( SELECT name FROM tabAccount WHERE account_type = %s)
|
||||
""", (company, period["year_start_date"] if accumulated_values else period['from_date'],
|
||||
period['to_date'], account_type))
|
||||
|
||||
if gl_sum and gl_sum[0]:
|
||||
amount = gl_sum[0]
|
||||
if account_type == "Depreciation":
|
||||
amount *= -1
|
||||
else:
|
||||
amount = 0
|
||||
|
||||
total += amount
|
||||
data.setdefault(period["key"], amount)
|
||||
|
||||
data["total"] = total
|
||||
return data
|
||||
|
||||
|
||||
def add_total_row_account(out, data, label, period_list, currency):
|
||||
total_row = {
|
||||
"account_name": "'" + _("{0}").format(label) + "'",
|
||||
"account": None,
|
||||
"currency": currency
|
||||
}
|
||||
for row in data:
|
||||
if row.get("parent_account"):
|
||||
for period in period_list:
|
||||
total_row.setdefault(period.key, 0.0)
|
||||
total_row[period.key] += row.get(period.key, 0.0)
|
||||
|
||||
total_row.setdefault("total", 0.0)
|
||||
total_row["total"] += row["total"]
|
||||
|
||||
out.append(total_row)
|
||||
out.append({})
|
||||
@@ -45,7 +45,7 @@
|
||||
<td class="text-right">
|
||||
{% var fieldname = report.columns[i].field; %}
|
||||
{% if (!is_null(row[fieldname])) { %}
|
||||
{%= format_currency(row[fieldname]) %}
|
||||
{%= format_currency(row[fieldname], row.currency) %}
|
||||
{% } %}
|
||||
</td>
|
||||
{% } %}
|
||||
|
||||
@@ -3,38 +3,42 @@
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe import _, _dict
|
||||
from frappe import _
|
||||
from frappe.utils import (flt, getdate, get_first_day, get_last_day,
|
||||
add_months, add_days, formatdate)
|
||||
|
||||
def get_period_list(fiscal_year, periodicity, from_beginning=False):
|
||||
"""Get a list of dict {"to_date": to_date, "key": key, "label": label}
|
||||
def get_period_list(fiscal_year, periodicity):
|
||||
"""Get a list of dict {"from_date": from_date, "to_date": to_date, "key": key, "label": label}
|
||||
Periodicity can be (Yearly, Quarterly, Monthly)"""
|
||||
|
||||
fy_start_end_date = frappe.db.get_value("Fiscal Year", fiscal_year, ["year_start_date", "year_end_date"])
|
||||
if not fy_start_end_date:
|
||||
frappe.throw(_("Fiscal Year {0} not found.").format(fiscal_year))
|
||||
|
||||
start_date = getdate(fy_start_end_date[0])
|
||||
end_date = getdate(fy_start_end_date[1])
|
||||
|
||||
# start with first day, so as to avoid year to_dates like 2-April if ever they occur]
|
||||
year_start_date = get_first_day(getdate(fy_start_end_date[0]))
|
||||
year_end_date = getdate(fy_start_end_date[1])
|
||||
|
||||
if periodicity == "Yearly":
|
||||
period_list = [_dict({"to_date": end_date, "key": fiscal_year, "label": fiscal_year})]
|
||||
period_list = [frappe._dict({"from_date": year_start_date, "to_date": year_end_date,
|
||||
"key": fiscal_year, "label": fiscal_year})]
|
||||
else:
|
||||
months_to_add = {
|
||||
"Half-yearly": 6,
|
||||
"Half-Yearly": 6,
|
||||
"Quarterly": 3,
|
||||
"Monthly": 1
|
||||
}[periodicity]
|
||||
|
||||
period_list = []
|
||||
|
||||
# start with first day, so as to avoid year to_dates like 2-April if ever they occur
|
||||
to_date = get_first_day(start_date)
|
||||
|
||||
start_date = year_start_date
|
||||
for i in xrange(12 / months_to_add):
|
||||
to_date = add_months(to_date, months_to_add)
|
||||
|
||||
period = frappe._dict({
|
||||
"from_date": start_date
|
||||
})
|
||||
to_date = add_months(start_date, months_to_add)
|
||||
start_date = to_date
|
||||
|
||||
if to_date == get_first_day(to_date):
|
||||
# if to_date is the first day, get the last day of previous month
|
||||
to_date = add_days(to_date, -1)
|
||||
@@ -42,71 +46,86 @@ def get_period_list(fiscal_year, periodicity, from_beginning=False):
|
||||
# to_date should be the last day of the new to_date's month
|
||||
to_date = get_last_day(to_date)
|
||||
|
||||
if to_date <= end_date:
|
||||
if to_date <= year_end_date:
|
||||
# the normal case
|
||||
period_list.append(_dict({ "to_date": to_date }))
|
||||
|
||||
# if it ends before a full year
|
||||
if to_date == end_date:
|
||||
break
|
||||
|
||||
period.to_date = to_date
|
||||
else:
|
||||
# if a fiscal year ends before a 12 month period
|
||||
period_list.append(_dict({ "to_date": end_date }))
|
||||
period.to_date = year_end_date
|
||||
|
||||
period_list.append(period)
|
||||
|
||||
if period.to_date == year_end_date:
|
||||
break
|
||||
|
||||
|
||||
# common processing
|
||||
for opts in period_list:
|
||||
key = opts["to_date"].strftime("%b_%Y").lower()
|
||||
label = formatdate(opts["to_date"], "MMM YYYY")
|
||||
if periodicity == "Monthly":
|
||||
label = formatdate(opts["to_date"], "MMM YYYY")
|
||||
else:
|
||||
label = get_label(periodicity, opts["from_date"], opts["to_date"])
|
||||
|
||||
opts.update({
|
||||
"key": key.replace(" ", "_").replace("-", "_"),
|
||||
"label": label,
|
||||
"year_start_date": start_date,
|
||||
"year_end_date": end_date
|
||||
"year_start_date": year_start_date,
|
||||
"year_end_date": year_end_date
|
||||
})
|
||||
|
||||
if from_beginning:
|
||||
# set start date as None for all fiscal periods, used in case of Balance Sheet
|
||||
opts["from_date"] = None
|
||||
else:
|
||||
opts["from_date"] = start_date
|
||||
|
||||
return period_list
|
||||
|
||||
def get_data(company, root_type, balance_must_be, period_list, ignore_closing_entries=False):
|
||||
def get_label(periodicity, from_date, to_date):
|
||||
if periodicity=="Yearly":
|
||||
if formatdate(from_date, "YYYY") == formatdate(to_date, "YYYY"):
|
||||
label = formatdate(from_date, "YYYY")
|
||||
else:
|
||||
label = formatdate(from_date, "YYYY") + "-" + formatdate(to_date, "YYYY")
|
||||
else:
|
||||
label = formatdate(from_date, "MMM YY") + "-" + formatdate(to_date, "MMM YY")
|
||||
|
||||
return label
|
||||
|
||||
def get_data(company, root_type, balance_must_be, period_list,
|
||||
accumulated_values=1, only_current_fiscal_year=True, ignore_closing_entries=False):
|
||||
accounts = get_accounts(company, root_type)
|
||||
if not accounts:
|
||||
return None
|
||||
|
||||
accounts, accounts_by_name = filter_accounts(accounts)
|
||||
|
||||
company_currency = frappe.db.get_value("Company", company, "default_currency")
|
||||
|
||||
gl_entries_by_account = {}
|
||||
for root in frappe.db.sql("""select lft, rgt from tabAccount
|
||||
where root_type=%s and ifnull(parent_account, '') = ''""", root_type, as_dict=1):
|
||||
set_gl_entries_by_account(company, period_list[0]["from_date"],
|
||||
period_list[-1]["to_date"],root.lft, root.rgt, gl_entries_by_account,
|
||||
ignore_closing_entries=ignore_closing_entries)
|
||||
|
||||
calculate_values(accounts_by_name, gl_entries_by_account, period_list)
|
||||
accumulate_values_into_parents(accounts, accounts_by_name, period_list)
|
||||
out = prepare_data(accounts, balance_must_be, period_list)
|
||||
|
||||
set_gl_entries_by_account(company,
|
||||
period_list[0]["year_start_date"] if only_current_fiscal_year else None,
|
||||
period_list[-1]["to_date"],
|
||||
root.lft, root.rgt,
|
||||
gl_entries_by_account, ignore_closing_entries=ignore_closing_entries)
|
||||
|
||||
calculate_values(accounts_by_name, gl_entries_by_account, period_list, accumulated_values)
|
||||
accumulate_values_into_parents(accounts, accounts_by_name, period_list, accumulated_values)
|
||||
out = prepare_data(accounts, balance_must_be, period_list, company_currency)
|
||||
|
||||
if out:
|
||||
add_total_row(out, balance_must_be, period_list)
|
||||
add_total_row(out, balance_must_be, period_list, company_currency)
|
||||
|
||||
return out
|
||||
|
||||
def calculate_values(accounts_by_name, gl_entries_by_account, period_list):
|
||||
def calculate_values(accounts_by_name, gl_entries_by_account, period_list, accumulated_values):
|
||||
for entries in gl_entries_by_account.values():
|
||||
for entry in entries:
|
||||
d = accounts_by_name.get(entry.account)
|
||||
for period in period_list:
|
||||
# check if posting date is within the period
|
||||
if entry.posting_date <= period.to_date:
|
||||
d[period.key] = d.get(period.key, 0.0) + flt(entry.debit) - flt(entry.credit)
|
||||
if accumulated_values or entry.posting_date >= period.from_date:
|
||||
d[period.key] = d.get(period.key, 0.0) + flt(entry.debit) - flt(entry.credit)
|
||||
|
||||
def accumulate_values_into_parents(accounts, accounts_by_name, period_list):
|
||||
def accumulate_values_into_parents(accounts, accounts_by_name, period_list, accumulated_values):
|
||||
"""accumulate children's values in parent accounts"""
|
||||
for d in reversed(accounts):
|
||||
if d.parent_account:
|
||||
@@ -114,7 +133,7 @@ def accumulate_values_into_parents(accounts, accounts_by_name, period_list):
|
||||
accounts_by_name[d.parent_account][period.key] = accounts_by_name[d.parent_account].get(period.key, 0.0) + \
|
||||
d.get(period.key, 0.0)
|
||||
|
||||
def prepare_data(accounts, balance_must_be, period_list):
|
||||
def prepare_data(accounts, balance_must_be, period_list, company_currency):
|
||||
out = []
|
||||
year_start_date = period_list[0]["year_start_date"].strftime("%Y-%m-%d")
|
||||
year_end_date = period_list[-1]["year_end_date"].strftime("%Y-%m-%d")
|
||||
@@ -122,13 +141,15 @@ def prepare_data(accounts, balance_must_be, period_list):
|
||||
for d in accounts:
|
||||
# add to output
|
||||
has_value = False
|
||||
total = 0
|
||||
row = {
|
||||
"account_name": d.account_name,
|
||||
"account": d.name,
|
||||
"parent_account": d.parent_account,
|
||||
"indent": flt(d.indent),
|
||||
"from_date": year_start_date,
|
||||
"to_date": year_end_date
|
||||
"year_start_date": year_start_date,
|
||||
"year_end_date": year_end_date,
|
||||
"currency": company_currency
|
||||
}
|
||||
for period in period_list:
|
||||
if d.get(period.key):
|
||||
@@ -140,16 +161,19 @@ def prepare_data(accounts, balance_must_be, period_list):
|
||||
if abs(row[period.key]) >= 0.005:
|
||||
# ignore zero values
|
||||
has_value = True
|
||||
total += flt(row[period.key])
|
||||
|
||||
if has_value:
|
||||
row["total"] = total
|
||||
out.append(row)
|
||||
|
||||
return out
|
||||
|
||||
def add_total_row(out, balance_must_be, period_list):
|
||||
def add_total_row(out, balance_must_be, period_list, company_currency):
|
||||
total_row = {
|
||||
"account_name": "'" + _("Total ({0})").format(balance_must_be) + "'",
|
||||
"account": None
|
||||
"account": None,
|
||||
"currency": company_currency
|
||||
}
|
||||
|
||||
for row in out:
|
||||
@@ -157,9 +181,12 @@ def add_total_row(out, balance_must_be, period_list):
|
||||
for period in period_list:
|
||||
total_row.setdefault(period.key, 0.0)
|
||||
total_row[period.key] += row.get(period.key, 0.0)
|
||||
|
||||
row[period.key] = ""
|
||||
|
||||
row[period.key] = ""
|
||||
|
||||
total_row.setdefault("total", 0.0)
|
||||
total_row["total"] += flt(row["total"])
|
||||
row["total"] = ""
|
||||
|
||||
out.append(total_row)
|
||||
|
||||
# blank row after Total
|
||||
@@ -241,7 +268,7 @@ def set_gl_entries_by_account(company, from_date, to_date, root_lft, root_rgt, g
|
||||
|
||||
return gl_entries_by_account
|
||||
|
||||
def get_columns(period_list):
|
||||
def get_columns(periodicity, period_list, accumulated_values=1, company=None):
|
||||
columns = [{
|
||||
"fieldname": "account",
|
||||
"label": _("Account"),
|
||||
@@ -249,12 +276,29 @@ def get_columns(period_list):
|
||||
"options": "Account",
|
||||
"width": 300
|
||||
}]
|
||||
if company:
|
||||
columns.append({
|
||||
"fieldname": "currency",
|
||||
"label": _("Currency"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Currency",
|
||||
"hidden": 1
|
||||
})
|
||||
for period in period_list:
|
||||
columns.append({
|
||||
"fieldname": period.key,
|
||||
"label": period.label,
|
||||
"fieldtype": "Currency",
|
||||
"options": "currency",
|
||||
"width": 150
|
||||
})
|
||||
if periodicity!="Yearly":
|
||||
if not accumulated_values:
|
||||
columns.append({
|
||||
"fieldname": "total",
|
||||
"label": _("Total"),
|
||||
"fieldtype": "Currency",
|
||||
"width": 150
|
||||
})
|
||||
|
||||
return columns
|
||||
|
||||
@@ -8,7 +8,7 @@ frappe.query_reports["General Ledger"] = {
|
||||
"label": __("Company"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Company",
|
||||
"default": frappe.defaults.get_user_default("company"),
|
||||
"default": frappe.defaults.get_user_default("Company"),
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ frappe.query_reports["Gross Profit"] = {
|
||||
"fieldtype": "Link",
|
||||
"options": "Company",
|
||||
"reqd": 1,
|
||||
"default": frappe.defaults.get_user_default("company")
|
||||
"default": frappe.defaults.get_user_default("Company")
|
||||
},
|
||||
{
|
||||
"fieldname":"from_date",
|
||||
|
||||
@@ -7,7 +7,9 @@ from frappe import _, scrub
|
||||
from frappe.utils import flt
|
||||
|
||||
def execute(filters=None):
|
||||
if not filters: filters = {}
|
||||
if not filters: filters = frappe._dict()
|
||||
company_currency = frappe.db.get_value("Company", filters.company, "default_currency")
|
||||
|
||||
gross_profit_data = GrossProfitGenerator(filters)
|
||||
|
||||
data = []
|
||||
@@ -43,6 +45,8 @@ def execute(filters=None):
|
||||
row = []
|
||||
for col in group_wise_columns.get(scrub(filters.group_by)):
|
||||
row.append(src.get(col))
|
||||
|
||||
row.append(company_currency)
|
||||
data.append(row)
|
||||
|
||||
return columns, data
|
||||
@@ -60,15 +64,15 @@ def get_columns(group_wise_columns, filters):
|
||||
"description": _("Description"),
|
||||
"warehouse": _("Warehouse") + ":Link/Warehouse",
|
||||
"qty": _("Qty") + ":Float",
|
||||
"base_rate": _("Avg. Selling Rate") + ":Currency",
|
||||
"buying_rate": _("Avg. Buying Rate") + ":Currency",
|
||||
"base_amount": _("Selling Amount") + ":Currency",
|
||||
"buying_amount": _("Buying Amount") + ":Currency",
|
||||
"gross_profit": _("Gross Profit") + ":Currency",
|
||||
"base_rate": _("Avg. Selling Rate") + ":Currency/currency",
|
||||
"buying_rate": _("Avg. Buying Rate") + ":Currency/currency",
|
||||
"base_amount": _("Selling Amount") + ":Currency/currency",
|
||||
"buying_amount": _("Buying Amount") + ":Currency/currency",
|
||||
"gross_profit": _("Gross Profit") + ":Currency/currency",
|
||||
"gross_profit_percent": _("Gross Profit %") + ":Percent",
|
||||
"project": _("Project") + ":Link/Project",
|
||||
"sales_person": _("Sales person"),
|
||||
"allocated_amount": _("Allocated Amount") + ":Currency",
|
||||
"allocated_amount": _("Allocated Amount") + ":Currency/currency",
|
||||
"customer": _("Customer") + ":Link/Customer",
|
||||
"customer_group": _("Customer Group") + ":Link/Customer Group",
|
||||
"territory": _("Territory") + ":Link/Territory"
|
||||
@@ -76,6 +80,13 @@ def get_columns(group_wise_columns, filters):
|
||||
|
||||
for col in group_wise_columns.get(scrub(filters.group_by)):
|
||||
columns.append(column_map.get(col))
|
||||
|
||||
columns.append({
|
||||
"fieldname": "currency",
|
||||
"label" : _("Currency"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Currency"
|
||||
})
|
||||
|
||||
return columns
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ frappe.query_reports["Item-wise Purchase Register"] = {
|
||||
"label": __("Company"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Company",
|
||||
"default": frappe.defaults.get_user_default("company")
|
||||
"default": frappe.defaults.get_user_default("Company")
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ frappe.query_reports["Item-wise Sales Register"] = frappe.query_reports["Sales R
|
||||
"label": __("Company"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Company",
|
||||
"default": frappe.defaults.get_user_default("company")
|
||||
"default": frappe.defaults.get_user_default("Company")
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ frappe.query_reports["Payment Period Based On Invoice Date"] = {
|
||||
fieldtype: "Link",
|
||||
options: "Company",
|
||||
reqd: 1,
|
||||
default: frappe.defaults.get_user_default("company")
|
||||
default: frappe.defaults.get_user_default("Company")
|
||||
},
|
||||
{
|
||||
fieldname: "from_date",
|
||||
|
||||
@@ -4,3 +4,9 @@
|
||||
frappe.require("assets/erpnext/js/financial_statements.js");
|
||||
|
||||
frappe.query_reports["Profit and Loss Statement"] = erpnext.financial_statements;
|
||||
|
||||
frappe.query_reports["Profit and Loss Statement"]["filters"].push({
|
||||
"fieldname": "accumulated_values",
|
||||
"label": __("Accumulated Values"),
|
||||
"fieldtype": "Check"
|
||||
})
|
||||
@@ -9,10 +9,13 @@ from erpnext.accounts.report.financial_statements import (get_period_list, get_c
|
||||
|
||||
def execute(filters=None):
|
||||
period_list = get_period_list(filters.fiscal_year, filters.periodicity)
|
||||
|
||||
income = get_data(filters.company, "Income", "Credit", period_list, ignore_closing_entries=True)
|
||||
expense = get_data(filters.company, "Expense", "Debit", period_list, ignore_closing_entries=True)
|
||||
net_profit_loss = get_net_profit_loss(income, expense, period_list)
|
||||
|
||||
income = get_data(filters.company, "Income", "Credit", period_list,
|
||||
accumulated_values=filters.accumulated_values, ignore_closing_entries=True)
|
||||
expense = get_data(filters.company, "Expense", "Debit", period_list,
|
||||
accumulated_values=filters.accumulated_values, ignore_closing_entries=True)
|
||||
|
||||
net_profit_loss = get_net_profit_loss(income, expense, period_list, filters.company)
|
||||
|
||||
data = []
|
||||
data.extend(income or [])
|
||||
@@ -20,19 +23,30 @@ def execute(filters=None):
|
||||
if net_profit_loss:
|
||||
data.append(net_profit_loss)
|
||||
|
||||
columns = get_columns(period_list)
|
||||
columns = get_columns(filters.periodicity, period_list, filters.accumulated_values, filters.company)
|
||||
|
||||
return columns, data
|
||||
|
||||
def get_net_profit_loss(income, expense, period_list):
|
||||
def get_net_profit_loss(income, expense, period_list, company):
|
||||
if income and expense:
|
||||
total = 0
|
||||
net_profit_loss = {
|
||||
"account_name": "'" + _("Net Profit / Loss") + "'",
|
||||
"account": None,
|
||||
"warn_if_negative": True
|
||||
"warn_if_negative": True,
|
||||
"currency": frappe.db.get_value("Company", company, "default_currency")
|
||||
}
|
||||
|
||||
has_value = False
|
||||
|
||||
for period in period_list:
|
||||
net_profit_loss[period.key] = flt(income[-2][period.key] - expense[-2][period.key], 3)
|
||||
|
||||
return net_profit_loss
|
||||
|
||||
if net_profit_loss[period.key]:
|
||||
has_value=True
|
||||
|
||||
total += flt(net_profit_loss[period.key])
|
||||
net_profit_loss["total"] = total
|
||||
|
||||
if has_value:
|
||||
return net_profit_loss
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user