Compare commits

...

348 Commits

Author SHA1 Message Date
Nabin Hait
2d4cc7e71f Merge branch 'develop' 2016-02-03 15:23:56 +05:30
Nabin Hait
fba61abd2a bumped to version 6.20.0 2016-02-03 15:53:56 +06:00
Nabin Hait
94bfe8ea0d [change-log] 2016-02-03 15:14:17 +05:30
Nabin Hait
31619f0a83 [docs] 2016-02-03 15:13:55 +05:30
Nabin Hait
34037e0d88 [translations] 2016-02-03 13:11:06 +05:30
Nabin Hait
647102fc94 Merge pull request #4729 from vjFaLk/doc-update
Updated documentation for new features
2016-02-03 13:01:02 +05:30
Nabin Hait
a533b33fc6 Merge pull request #4730 from nabinhait/ShashaQin-patch-8
Financial Statements: Accumulated periodic balance based on filters
2016-02-03 12:55:36 +05:30
Nabin Hait
bd7f48cfd4 [report] Financial Statements: Accumulated periodic balance based on filters 2016-02-02 19:05:43 +05:30
Nabin Hait
82cef59fb3 [fix] Purchase Return warehouse validation 2016-02-02 19:05:43 +05:30
ShashaQin
cc6ce5beac Update financial_statements.py 2016-02-02 19:05:42 +05:30
ShashaQin
15d7224335 Update balance_sheet.py 2016-02-02 19:05:42 +05:30
ShashaQin
1f51e71827 Update profit_and_loss_statement.py 2016-02-02 19:05:42 +05:30
ShashaQin
539a826b37 Update financial_statements.js
Adding Accumulated Values check box on Profit and Loss, Balance Sheet
2016-02-02 19:05:42 +05:30
Valmik Jangla
0ec9b90113 Updated documentation 2016-02-02 18:29:09 +05:30
Nabin Hait
49b275ad1d Merge pull request #4704 from chaoyee/develop
Update material_request.py
2016-02-02 16:11:35 +05:30
Nabin Hait
7957f0ecea Merge pull request #4726 from nabinhait/develop
Multiple fixes
2016-02-02 16:08:40 +05:30
Nabin Hait
3c55d89f7f [minor] Reference doctype in Item-wise price List Rate report 2016-02-01 15:55:09 +05:30
Nabin Hait
d5fda57297 [fix] Ignore permissions and made Customer warehouse field hidden in selling cycle 2016-02-01 15:55:09 +05:30
Nabin Hait
a85a1ff145 [fix] Validate rate with reference doc 2016-02-01 15:55:09 +05:30
Nabin Hait
afb8ec9cb6 [fix] Validate company abbr 2016-02-01 15:55:09 +05:30
Nabin Hait
8b92de26f0 Merge pull request #4718 from vjFaLk/holiday-fix
Fixed issue where no Holidays would cause the report to break
2016-02-01 15:49:15 +05:30
Nabin Hait
fcd4f2b86b Merge pull request #4706 from vrms/vrms-patch-1
Update implementation-strategy.md
2016-02-01 15:47:57 +05:30
Nabin Hait
1277a61dad Merge pull request #4720 from agusputra/patch-7
Update delete-a-company-and-all-related-transactions.md
2016-02-01 15:47:07 +05:30
Nabin Hait
767d5e48e7 Merge pull request #4723 from ShashaQin/patch-12
Stock Reconciliation Improvements
2016-02-01 15:38:48 +05:30
ShashaQin
ed11e93b25 Update stock_reconciliation.py
exclude 'disabled' item when get items
2016-02-01 16:54:19 +08:00
ShashaQin
1d702bf112 Update stock_reconciliation_item.json
Update valuation rate description. This description will be shown on downloaded template in order to input valuation rate correct.
2016-02-01 16:51:01 +08:00
Anand Doshi
43cdf792f9 Merge pull request #4715 from agusputra/patch-6
Update stock-reconciliation-for-non-serialized-item.md
2016-02-01 14:17:24 +05:30
Anand Doshi
687888133b Merge pull request #4716 from agusputra/patch-5
Update authorization-rule.md
2016-02-01 14:17:04 +05:30
Agus Syahputra
e0825aaea9 Update delete-a-company-and-all-related-transactions.md 2016-02-01 08:20:36 +07:00
Valmik Jangla
0a76b8b29a Fixed issue where no Holidays would cause the report to break 2016-01-30 10:59:40 +05:30
Agus Syahputra
0277dbc6b6 Update stock-reconciliation-for-non-serialized-item.md 2016-01-30 07:28:28 +07:00
Agus Syahputra
93a69e9485 Update authorization-rule.md 2016-01-29 23:41:46 +07:00
Anand Doshi
6e33d91443 [minor] fixes to attendance tool and employee holiday attendance 2016-01-29 16:57:54 +05:30
Valmik Jangla
07364f5ece Feature - Employee Attendance Tool 2016-01-29 16:57:54 +05:30
Valmik Jangla
1890c794d7 Added Employee Report Attendance Report
Made Holiday details mandatory
2016-01-29 16:57:54 +05:30
Chao-Yee Hsu 許朝益
71a9be8add Update material_request.py
Add "order by mr_item.item_code ASC" to 'get_material_requests_based_on_supplier(supplier)' in order to get material request item sorted by ascending order.
2016-01-29 18:45:22 +08:00
Anand Doshi
fd131a4210 Merge pull request #4699 from neilLasrado/tl-fix
Fixes in Time Log list view
2016-01-29 15:51:24 +05:30
shreyas
1a943151d7 [Refactor/Cleanup] Cleaned debug print statement
Refactored code to use format() instead of string formatting using %s
2016-01-29 15:41:45 +05:30
shreyas
c761f1b0a1 [Minor] Cleanup 2016-01-29 15:41:44 +05:30
shreyas
e970ddcee9 [Fix]
1. Sales Person wise transaction report
2. Sales Person wise target variance report
3. Sales order trend report generation for selection in group by feild
2016-01-29 15:41:44 +05:30
shreyas
51db2ba22a [Partial]Fixed Sales person target variance report 2016-01-29 15:41:44 +05:30
shreyas
cbc18ffdbf [Partial] Fixed the issue for Territory Item Group Variance report 2016-01-29 15:41:44 +05:30
Neil Trini Lasrado
5b7d0a960e Fixed indicators & List view in Time Log, Time Log Batch 2016-01-29 15:20:22 +05:30
Neil Trini Lasrado
172efb1e87 Fixed error messages while making Time Log Batch from Time Log List view 2016-01-29 14:27:03 +05:30
Anand Doshi
95760a7db6 Merge pull request #4680 from shyjuk/patch-1
Update index.md
2016-01-29 12:19:14 +05:30
Anand Doshi
9c24bec654 Merge branch 'nabinhait-mc_fix_5' into develop 2016-01-29 12:16:35 +05:30
Anand Doshi
7c0a58ac3f [fix] show formatted currency value in advance paid validation 2016-01-29 12:16:24 +05:30
Anand Doshi
77e4f6b774 [fix] strip item_code before autoname 2016-01-29 11:29:36 +05:30
Nabin Hait
5bedd649df Merge pull request #4691 from anandpdoshi/cleanup/remove-is-service-item
[cleanup] Removed 'Is Service Item' checkbox and filters
2016-01-29 11:10:54 +05:30
Anand Doshi
7207d21962 Merge pull request #4694 from umairsy/21-jan
Updated articles
2016-01-29 11:09:35 +05:30
Chao-Yee Hsu 許朝益
c118fc9343 Update material_request.py
Add "order by mr_item.item_code ASC" to 'get_material_requests_based_on_supplier(supplier)' in order to get material request item sorted by ascending order.
2016-01-29 10:38:33 +08:00
Rushabh Mehta
bad13369d4 [minor] added abbreviate function in company 2016-01-27 18:58:21 +05:30
Umair Sayyed
bf225c11b4 fixed articles 2016-01-27 18:19:31 +05:30
Umair Sayyed
694edbc89a updated articles 2016-01-27 18:19:31 +05:30
Umair Sayyed
6406f8bda0 discount article 2016-01-27 18:19:30 +05:30
Umair Sayyed
2901e14c59 articles 2016-01-27 18:19:30 +05:30
Umair Sayyed
5204eeedf7 articles 2016-01-27 18:19:30 +05:30
Nabin Hait
ee8f88d641 [patch] Set party account currency in existing orders 2016-01-27 16:01:31 +05:30
Nabin Hait
b2206d1155 [fix] Multi currency advance payment against Order 2016-01-27 15:43:24 +05:30
Anand Doshi
c54e25b5c7 Merge branch 'develop' 2016-01-27 14:20:19 +05:30
Anand Doshi
6e36a48521 bumped to version 6.19.0 2016-01-27 14:50:19 +06:00
Anand Doshi
eca2e42ecb [fix] patch title field of Pricing Rule 2016-01-27 12:36:36 +05:30
Anand Doshi
d7f7d5c9db [translations] 2016-01-27 12:36:36 +05:30
Anand Doshi
37b0f7ca47 [language] Added Estonian, Telugu and Urdu. Fixes frappe/translator#64 and frappe/translator#66 2016-01-27 12:36:35 +05:30
Anand Doshi
f4d5a66162 [change log] 2016-01-27 12:36:35 +05:30
Anand Doshi
a84186c209 Merge pull request #4692 from agusputra/patch-3
Update terms-and-conditions.md
2016-01-27 12:26:34 +05:30
Agus Syahputra
eb4c299bdb Update terms-and-conditions.md 2016-01-27 09:34:00 +07:00
Anand Doshi
5b1b2fb858 Merge branch 'shreyasp-disable_cust_supp' into develop 2016-01-26 16:41:11 +05:30
shreyas
eba9ca4d66 [Minor]Change to maintain args ordering convention 2016-01-26 16:29:26 +05:30
Anand Doshi
01de945388 [cleanup] Removed 'Is Service Item' checkbox and filters
'Is Service Item' checkbox only worked for filtering Items in Maintenance Schedule and Maintenance Visit, and validating that Items in a Maintenance type Order were of type 'Service'. However, it doesn't fit an actual use case where any Sales Item could be given for Maintenance, making the checkbox an unnecessary addition.
2016-01-26 16:22:51 +05:30
shreyas
79872bf62c [Refactor]Changed variable name to avoid conflict between args and local variable 2016-01-26 13:57:06 +05:30
shreyas
c8ac3b042b [Minor]Refactored code for better readability 2016-01-26 13:23:38 +05:30
shreyas
f76853a8d9 [Minor]Changed CustomerDisabled and CustomerFrozen to PartyDisabled and PartyFrozen 2016-01-25 21:25:11 +05:30
shreyas
323dc96c99 [Travis] Fixed reference failure in party.py 2016-01-25 18:19:14 +05:30
shreyas
2563f404d2 [Minor Change] Updated queries.py 2016-01-25 18:19:14 +05:30
shreyas
29b565fdf5 Added Disabled field to Supplier and Customer doctype
Frozen field is moved to More Information section for Customer and Supplier. Any Supplier/Customer which is disabled will not be shown while creating PO/SO
2016-01-25 18:19:13 +05:30
Anand Doshi
2ea5c6913d Merge pull request #4685 from shreyasp/supplier-credit-fix
Added the credit_days_based_on field to Supplier and Supplier Type doctype
2016-01-25 17:58:21 +05:30
Anand Doshi
5dcb40bc96 Merge pull request #4687 from anandpdoshi/fix/recurring-docs-no-copy
[fix] obey no_copy while creating recurring documents
2016-01-25 17:27:04 +05:30
Anand Doshi
c07489a096 [fix] Journal Entry: init debit/credit in account currency 2016-01-25 17:23:36 +05:30
Anand Doshi
39e2c2bb09 [fix] obey no_copy while creating recurring documents 2016-01-25 17:03:50 +05:30
Rushabh Mehta
e1a1c8ac31 [minor] clean up message if no Customer from Quotation > Sales Order, fixes #3854 2016-01-25 13:08:32 +05:30
shreyas
28a6578ba2 Added the credit_days_based_on field to Supplier and Supplier Type doctype 2016-01-25 12:44:14 +05:30
Shyju Kanaprath
932cf08aee Update index.md 2016-01-24 10:00:29 +05:30
Anand Doshi
47c2aa179b [fix] test case for get_item_details 2016-01-21 23:18:08 +05:30
Anand Doshi
f7e9a9d786 Merge branch 'develop' 2016-01-21 22:32:08 +05:30
Anand Doshi
04230cb656 bumped to version 6.18.4 2016-01-21 23:02:08 +06:00
Anand Doshi
54abf025b7 [hotfix] get_price_list_rate 2016-01-21 22:28:55 +05:30
Anand Doshi
39ac535bdb Merge branch 'develop' 2016-01-21 21:06:34 +05:30
Anand Doshi
dd74b5d44f bumped to version 6.18.3 2016-01-21 21:36:34 +06:00
Anand Doshi
afe85bdd04 [hotfix] use me.frm.doc in get_item_details 2016-01-21 21:04:16 +05:30
Nabin Hait
e4b44a86a6 Merge branch 'develop' 2016-01-21 18:53:36 +05:30
Nabin Hait
a1ccab81a0 bumped to version 6.18.2 2016-01-21 19:23:36 +06:00
Nabin Hait
cf3b318f7d Changes modified date 2016-01-21 18:52:25 +05:30
Nabin Hait
568054ab96 [fix] Make Delivery Note from Sales Invoice 2016-01-21 18:50:28 +05:30
Nabin Hait
0d207706c1 [fix] Get item details 2016-01-21 18:47:09 +05:30
Nabin Hait
3d5a6af1ae Delete Screenshot from 2014-11-18 18:13:22.png 2016-01-21 17:42:41 +05:30
Nabin Hait
79a994e895 Delete Screenshot from 2014-11-18 18:09:42.png 2016-01-21 17:42:35 +05:30
Nabin Hait
20cdaadcd4 Delete Screenshot from 2014-11-18 18:00:57.png 2016-01-21 17:42:28 +05:30
Nabin Hait
a2eccf08a1 Delete Screenshot from 2014-11-18 17:56:19.png 2016-01-21 17:42:22 +05:30
Nabin Hait
6f62ecab73 Delete Screenshot from 2014-11-18 18:09:42.png 2016-01-21 17:41:34 +05:30
Nabin Hait
463f71c6eb Delete Screenshot from 2014-11-18 18:13:22.png 2016-01-21 17:41:09 +05:30
Nabin Hait
cea6b09d44 Delete Screenshot from 2014-11-18 18:00:57.png 2016-01-21 17:40:41 +05:30
Nabin Hait
b4be679639 Delete Screenshot from 2014-11-18 17:56:19.png 2016-01-21 17:40:01 +05:30
Nabin Hait
c51ef85dd8 Merge branch 'develop' 2016-01-21 17:10:15 +05:30
Nabin Hait
3fc4e7c53f bumped to version 6.18.1 2016-01-21 17:40:14 +06:00
Nabin Hait
1d21274d65 Update manufacturer.json 2016-01-21 17:01:23 +05:30
Nabin Hait
ccddc48ced Merge branch 'develop' 2016-01-21 16:52:22 +05:30
Nabin Hait
c9b7824573 bumped to version 6.18.0 2016-01-21 17:22:22 +06:00
Nabin Hait
e50c5321df [docs] 2016-01-21 16:47:51 +05:30
Nabin Hait
c690b24a7d [change-log] 2016-01-21 16:32:09 +05:30
Nabin Hait
9a24abe5e9 [translations] 2016-01-21 16:32:08 +05:30
Nabin Hait
c5d41eb22a Merge pull request #4664 from saurabh6790/variant_fixes
[fixes] compare variants in lower case
2016-01-21 16:06:42 +05:30
Saurabh
47fd5e0ff0 [fixes] compare variants in lower case 2016-01-21 15:46:55 +05:30
Nabin Hait
bb7e499cbd Merge pull request #4662 from ccfiel/develop
undo reconciled journal entry record
2016-01-21 15:32:33 +05:30
Chris Ian Fiel
cb66d3a8c9 undo reconciled journal entry record
https://github.com/frappe/erpnext/issues/4661
2016-01-21 16:26:22 +08:00
Chris Ian Fiel
43a62ad0f0 undo reconciled journal entry record 2016-01-21 06:50:13 +08:00
Nabin Hait
e6b52bbb43 Update create_manufacturer_records.py 2016-01-21 00:30:39 +05:30
Nabin Hait
6811e73b53 Merge pull request #4658 from umairsy/20-jan
Updated articles in Buying
2016-01-20 22:28:50 +05:30
Umair Sayyed
5cd9193a2b Updated articles in Buying 2016-01-20 18:47:33 +05:30
Nabin Hait
a613ea8abf [patch] Create manufacturer records 2016-01-20 18:32:37 +05:30
Dominik
d737390b80 Changed Manufacturer from Data to its own DocType, copied most of the logic from Customer but used short_name for namig series. 2016-01-20 18:32:37 +05:30
Nabin Hait
20bf7375f4 Merge pull request #4655 from nabinhait/rounding_issue
Rounding based on smallest circulating currency fraction value
2016-01-20 18:12:36 +05:30
Nabin Hait
fb0b24af78 Rounding based on smallest circulating currency fraction value 2016-01-20 17:07:35 +05:30
Nabin Hait
002fa6c1d9 Merge pull request #4650 from RicardoJohann/patch-2
Accounts - Bank reconciliation - Workflow and labeling improvements
2016-01-20 17:03:06 +05:30
Nabin Hait
dbbc3eb8a6 Merge pull request #4656 from nabinhait/gle_rounding
[fix] Round off gle due to currency conversion
2016-01-20 16:48:42 +05:30
Nabin Hait
c2c9124af8 Merge pull request #4643 from nabinhait/status_button
[fix] Close button visible in all sumitted PR and DN
2016-01-20 16:47:17 +05:30
Nabin Hait
5b19aeecb4 Merge pull request #4642 from nabinhait/return_fix1
[fix] Accept return items in any warehouse
2016-01-20 16:46:33 +05:30
Nabin Hait
dd2f0330a6 Merge pull request #4641 from nabinhait/report-currency
[fix] Currency in Gross Profit report
2016-01-20 16:45:57 +05:30
Nabin Hait
61673aafd4 Merge pull request #4640 from nabinhait/fix50
Fixes
2016-01-20 16:35:46 +05:30
Nabin Hait
d4507ac6a0 [fix] Round off gle due to currency conversion 2016-01-20 16:14:27 +05:30
Nabin Hait
7c8dc38f15 Merge pull request #4654 from agusputra/patch-1
Update adding-users.md
2016-01-20 14:43:14 +05:30
Agus Syahputra
aa8745378a Update adding-users.md 2016-01-20 15:45:16 +07:00
Nabin Hait
2b986d3b02 Merge pull request #4651 from RicardoJohann/patch-4
Update queries.py - Added item_group
2016-01-20 13:11:44 +05:30
RicardoJohann
3fb5340188 Update queries.py 2016-01-20 14:32:59 +08:00
RicardoJohann
05aa3b391e Update bank_reconciliation.py 2016-01-20 13:38:20 +08:00
RicardoJohann
e095eeb084 Update bank_reconciliation_statement.py 2016-01-20 13:36:36 +08:00
Rushabh Mehta
7633aca7c1 Merge pull request #4645 from umairsy/16-jan
updated stock articles
2016-01-20 10:27:24 +05:30
RicardoJohann
6f9afffd8a Update bank_reconciliation_statement.html 2016-01-20 12:15:20 +08:00
RicardoJohann
7425af6968 Update bank_reconciliation_detail.json
Accounts - Bank reconciliation - Workflow and labeling improvements
2016-01-20 12:02:20 +08:00
Umair Sayyed
de15a26cab updated stock articles 2016-01-19 18:39:27 +05:30
Nabin Hait
5ac22ce6a1 [fix] Close button visible in all sumitted PR and DN 2016-01-19 18:30:02 +05:30
Nabin Hait
20105d8a0d [fix] Accept return items in any warehouse 2016-01-19 18:05:28 +05:30
Nabin Hait
6d8688f8b4 [fix] Currency in Gross Profit report 2016-01-19 17:27:06 +05:30
Nabin Hait
9824e22ce1 [fix] Price list rate applied via set_missing_values 2016-01-19 16:48:32 +05:30
Nabin Hait
34d2822483 Fixes in get_item_details and test cases 2016-01-19 16:48:32 +05:30
Nabin Hait
787e59c37e [fix] BOM Autonaming 2016-01-19 16:48:31 +05:30
Nabin Hait
77532cc8db [fix] Total Amount in Journal Entry 2016-01-19 16:48:31 +05:30
Rushabh Mehta
c978b9c36a [minor] [fix] in Item > Add / Edit Prices, go to list view instead of report, fixes #4639 2016-01-19 16:34:49 +05:30
Nabin Hait
31608a82f8 Merge pull request #4632 from nabinhait/pos_fix
Calculate change in POS based on smallest currency fraction value
2016-01-19 11:46:13 +05:30
Nabin Hait
4f0bfcd287 Merge pull request #4621 from neilLasrado/develop
Fixed time log overlap validation. Fixed test case in time log
2016-01-19 11:13:00 +05:30
Rushabh Mehta
54673f8d1d Merge pull request #4635 from MaxMorais/patch-2
Add localization in the on_submit event
2016-01-19 10:45:51 +05:30
Maxwell
4da17348fd Add localization in the on_submit event 2016-01-18 23:29:21 -02:00
Rushabh Mehta
aee26219ed [fix] get warehouse details on selection 2016-01-18 18:57:49 +05:30
Nabin Hait
8b63b1221f Calculate change in POS based on smallest currency fraction value 2016-01-18 17:56:55 +05:30
Rushabh Mehta
6bf3c7453b [fix] payment request 2016-01-18 14:29:26 +05:30
Rushabh Mehta
681c9dde84 [ui] payment request cleanup 2016-01-18 14:21:45 +05:30
Rushabh Mehta
34fb5cf0e2 [fix] make setup_wizard.create_bank_account multi-company safe 2016-01-18 12:35:24 +05:30
Rushabh Mehta
0e2f9ee44c [docs] fix 2016-01-18 12:35:24 +05:30
Anand Doshi
0bcd9efa88 [fix] value returned by frappe._ will always be unicode 2016-01-18 12:30:31 +05:30
Rushabh Mehta
b46069d44b [cleanup] contextual buttons in sales & purchase and fix rate setting in opp -> quotation and material request -> purchase order 2016-01-15 16:59:26 +05:30
Neil Trini Lasrado
329e7783bc Fixed time log overlap validation. Fixed test case in time log 2016-01-15 16:34:06 +05:30
Rushabh Mehta
2e3d2b8426 Merge pull request #4613 from nabinhait/fixes
[fix] Item query and exchange rate
2016-01-15 11:19:44 +05:30
Rushabh Mehta
66eaf7e1c3 Merge pull request #4607 from saurabh6790/group_custom_buttons
[enhance] merge customize buttons under groups
2016-01-15 11:15:23 +05:30
Rushabh Mehta
23ee568564 Merge pull request #4620 from nabinhait/fixes12
Minor fixes
2016-01-15 11:15:10 +05:30
Nabin Hait
ad42d2f67a Minor fixes 2016-01-15 11:09:41 +05:30
Rushabh Mehta
1bf440b03a [fix] module ordering 2016-01-14 18:19:21 +05:30
Rushabh Mehta
9bf2df9303 [minor] [layout] cleaned up Time Log layout 2016-01-14 18:19:21 +05:30
Rushabh Mehta
986f6a71ec [minor] fix new customer link in POS 2016-01-14 18:15:56 +05:30
Rushabh Mehta
26cb8baef0 Merge pull request #4618 from neilLasrado/develop
Added additional cost to time log
2016-01-14 17:11:53 +05:30
Neil Trini Lasrado
975dcc2bf3 Added additional cost to time log. Fixed issues in Time log billing amount calculation and billing amount calculation while making time log batch 2016-01-14 16:09:35 +05:30
Rushabh Mehta
1bc6a73878 Merge pull request #4614 from saurabh6790/cart_fixes
[fixes] redirect uri fixes
2016-01-14 11:47:29 +05:30
Saurabh
f7caad8ecb [fixes] redirect uri fixes 2016-01-14 11:30:47 +05:30
Rushabh Mehta
27e8ae0ff9 Merge pull request #4612 from rmehta/sales-partner-address-fix
[fix] set sales partner from previous document, fixes #4611
2016-01-14 10:48:03 +05:30
Nabin Hait
a88912a2f5 [fix] Item query and exchange rate 2016-01-14 10:43:17 +05:30
Rushabh Mehta
10d634b016 [fix] set sales partner from previous document, fixes #4611 2016-01-14 10:34:18 +05:30
Saurabh
e23e99f4bd [enhance] merge customize buttons under groups 2016-01-13 09:18:31 +05:30
Rushabh Mehta
075b9626cf [docs] update 2016-01-12 17:08:33 +05:30
Rushabh Mehta
025a407e13 Merge pull request #4595 from saurabh6790/payment_request_vai_cart
Payment request via cart
2016-01-12 14:23:42 +05:30
Saurabh
cbebb4b8ba [fixes] code cleanup 2016-01-12 14:13:35 +05:30
Saurabh
3ade883fd9 [fixes] place cart button via js 2016-01-12 14:09:52 +05:30
Saurabh
403ad48364 [fixes] display cart count only if item exist in cart 2016-01-12 14:09:52 +05:30
Saurabh
69f9975748 [fixes] show link to visit cart after adding item, hide cart button on cart view 2016-01-12 14:09:52 +05:30
Saurabh
df2783dbb0 [enhance] i. facility to send PR email; ii. update cart, item view and order view; 2016-01-12 14:09:52 +05:30
Saurabh
a940b6d149 [fixes] handle cancled payment requests 2016-01-12 14:09:51 +05:30
Saurabh
0a0c78729f [enhace] display payment status on order 2016-01-12 14:09:51 +05:30
Saurabh
276d3e60bd [enhance] pay via cart 2016-01-12 14:09:51 +05:30
Saurabh
c22e525a14 [Fixes] payment request url fixes 2016-01-12 14:09:51 +05:30
Saurabh
2ffea6ba94 [document & fixes] document and test case rewrite 2016-01-12 14:09:51 +05:30
Saurabh
6fc408e974 [fixes] conmify account details and validate gateway currency 2016-01-12 14:09:51 +05:30
Saurabh
ed0723c6fe [fixes] Create payment gateway account 2016-01-12 14:09:50 +05:30
Saurabh
766f6a43d5 [fixes] test case for Payment request 2016-01-12 14:09:50 +05:30
Saurabh
1664668b0e [fixes] multi-currency fixes 2016-01-12 14:09:50 +05:30
Saurabh
3ba22676bf [fixes] Create and manage payment request 2016-01-12 14:09:50 +05:30
Saurabh
db7a56b453 [fixes] fieldtype, message fixes on Payment Request 2016-01-12 14:09:50 +05:30
Saurabh
cb98d9ec5f [fixes] print format listing 2016-01-12 14:09:50 +05:30
Saurabh
b109ee96de [fixes] Base structure for Payment Request 2016-01-12 14:09:49 +05:30
Saurabh
eba7aa496c [enhace] basic structure for payment gateway 2016-01-12 14:09:49 +05:30
Rushabh Mehta
108bc78693 Merge branch 'develop' 2016-01-12 12:25:18 +05:30
Rushabh Mehta
c85112b093 bumped to version 6.17.0 2016-01-12 12:55:17 +06:00
Rushabh Mehta
4a3140102c Merge pull request #4606 from nabinhait/report_currency
[fix] Currency symbol based on account/company currency, not based on Global Defaults
2016-01-12 12:12:43 +05:30
Rushabh Mehta
6ef1fb6b39 Merge pull request #4605 from umairsy/docs
[docs] added articles in manufacturing, stock, website
2016-01-12 12:12:08 +05:30
Rushabh Mehta
de6b30c7ac Merge pull request #4604 from anandpdoshi/fix/duplicate-region-setup-wizard
[fix] removed duplicate 'region' section as it is already in Frappe Framework
2016-01-12 12:11:41 +05:30
Rushabh Mehta
1c32d05601 [translations] update 2016-01-12 12:02:26 +05:30
Rushabh Mehta
659bc1aca4 [minor] fixes reported on support 2016-01-12 11:57:25 +05:30
Nabin Hait
226a101119 [fix] Currency symbol based on account/company currency, not based on Global Defaults 2016-01-12 11:56:40 +05:30
Rushabh Mehta
5dfd1d48fa [minor] disabled in terms and conditions, fixes #4602 2016-01-12 10:29:29 +05:30
Umair Sayyed
c9af48af35 [docs] added articles in manufacturing, stock, website 2016-01-11 18:35:28 +05:30
Anand Doshi
d8ac0f3df7 [fix] removed duplicate 'region' section as it is already in Frappe Framework 2016-01-11 18:22:02 +05:30
Nabin Hait
af2bf7541f Merge pull request #4603 from ccfiel/develop
note added equity
2016-01-11 13:13:15 +05:30
Chris Ian Fiel
d070d56f72 note added equity 2016-01-11 15:34:24 +08:00
Anand Doshi
cc5632a99c [minor] removed image_view from in list view 2016-01-11 13:03:14 +05:30
Rushabh Mehta
7be0b47778 [minor] [fix] validate fiscal year in trial balance 2016-01-11 11:59:08 +05:30
Rushabh Mehta
5facb60bbe [fix] cleanup old style js in email digest 2016-01-11 10:37:20 +05:30
Rushabh Mehta
56b5387dbd [minor] README 2016-01-11 10:37:20 +05:30
Rushabh Mehta
9743d688d0 Merge pull request #4597 from makeen/fixEditButtonAddressContact
fix button "Edit" encode url in address and contact template
2016-01-11 10:33:18 +05:30
Raul Viveros
1d5f8d4436 fix button "Edit" encode url in address and contact template 2016-01-09 22:18:14 +01:00
vrms
063a88f057 Update implementation-strategy.md 2016-01-09 19:45:39 +08:00
Anand Doshi
6cb8662bec Merge branch 'develop' 2016-01-07 18:27:21 +05:30
Anand Doshi
74dfabbe21 bumped to version 6.16.4 2016-01-07 18:57:21 +06:00
Anand Doshi
4096603656 [fix] add index on so_detail in Delivery Note Item 2016-01-07 17:10:09 +05:30
Anand Doshi
574415b59b Merge branch 'develop' 2016-01-06 18:56:03 +05:30
Anand Doshi
0eee6bbf7e bumped to version 6.16.3 2016-01-06 19:26:03 +06:00
Anand Doshi
ed72a28e41 [minor] patch for billed in DN and PR 2016-01-06 18:53:12 +05:30
Anand Doshi
4e0908d055 [change-log] 2016-01-06 18:23:25 +05:30
Anand Doshi
3c2ffde95b Merge pull request #4573 from anandpdoshi/fix/stock-entry-calculate-amount-in-js
[fix] Stock Entry: calculate amount in javascript
2016-01-06 18:04:53 +05:30
Anand Doshi
2c021dcdcd [fix] Stock Entry: calculate amount in javascript 2016-01-06 17:47:39 +05:30
Rushabh Mehta
1ee5ae1e25 [fix] [minor] don't show cancelled sales orders 2016-01-06 16:47:18 +05:30
Anand Doshi
0aadb9e213 Merge pull request #4584 from nabinhait/last_pur_rate
Get last purchase rate button in Purchase Order
2016-01-06 16:33:07 +05:30
Anand Doshi
a0693983cc Merge branch 'nabinhait-billing_status' into develop 2016-01-06 16:32:19 +05:30
Anand Doshi
6b71ef5843 [refactor] changed set_modified, change_modified to update_modified like in the framework 2016-01-06 16:32:06 +05:30
Nabin Hait
602683fdc0 Get last purchase rate button in Purchase Order 2016-01-06 16:03:58 +05:30
Nabin Hait
1eea26fc5c [patch] Update billing status in Delivery Note and Purchase Receipt 2016-01-06 15:42:44 +05:30
Nabin Hait
c040075bd4 [patch] Update billing status in Delivery Note and Purchase Receipt 2016-01-06 15:42:44 +05:30
Nabin Hait
a2afb16f6b [testcase] Billing status in Purchase Receipt 2016-01-06 15:42:44 +05:30
Nabin Hait
bdab0eea0f Billing status in Purchase Receipt 2016-01-06 15:42:43 +05:30
Nabin Hait
ba5d6b5004 [test-case] for billing status in DN 2016-01-06 15:42:27 +05:30
Nabin Hait
5b13b99441 Update billing status in Delivery Note if directly invoiced against SO 2016-01-06 15:42:27 +05:30
Anand Doshi
a3e87c7af1 Merge branch 'umairsy-develop' into develop 2016-01-06 15:06:27 +05:30
Umair Sayyed
31e2a709d5 updated articles in Accounts 2016-01-06 15:06:11 +05:30
Umair Sayyed
e083cde3d7 updated articles 2016-01-06 15:05:31 +05:30
Anand Doshi
09fc4a456e Merge pull request #4582 from nabinhait/develop
Chart of accounts added for Singapore and some other fixes
2016-01-06 15:01:49 +05:30
Anand Doshi
4774c41958 [fix] validate_multi_currency 2016-01-06 14:16:10 +05:30
Anand Doshi
03e7e581d8 [minor] removed Communication table 2016-01-06 13:23:45 +05:30
Anand Doshi
e88ffe032e [fix] show fields like sales_order, against_sales_order, schedule_date in item grid if In List View is checked 2016-01-06 12:54:59 +05:30
Nabin Hait
ea8bc8ecb0 Chart of accounts added for Singapore and some other fixes 2016-01-06 12:32:48 +05:30
Anand Doshi
a40c6282a1 [fix] don't allow import for child tables 2016-01-06 12:20:25 +05:30
Anand Doshi
570d1783f9 Merge branch 'develop' 2016-01-05 19:09:36 +05:30
Anand Doshi
2076203fc1 bumped to version 6.16.2 2016-01-05 19:39:35 +06:00
Anand Doshi
d7b7f74ac9 [docs] 2016-01-05 19:08:09 +05:30
Anand Doshi
d27308d1cd Merge pull request #4575 from nabinhait/report_fix_1
[fix] minor fix in stock projected qty
2016-01-05 18:41:48 +05:30
Anand Doshi
06a82d4e1f Merge pull request #4574 from rmehta/translations
Translation fixes
2016-01-05 18:41:18 +05:30
Anand Doshi
f9eff57531 [fix] credit limit 2016-01-05 16:00:33 +05:30
Rushabh Mehta
e64fbd6d3c [minor] fixes for chart_of_accounts_builder app 2016-01-04 18:11:21 +05:30
Anand Doshi
88e709e1f0 Merge branch 'develop' 2016-01-04 17:58:13 +05:30
Anand Doshi
988a1ab419 bumped to version 6.16.1 2016-01-04 18:28:13 +06:00
Anand Doshi
13bf123b24 [hotfix] item on web 2016-01-04 17:51:35 +05:30
Anand Doshi
22b956d33c Merge branch 'develop' 2016-01-04 16:55:20 +05:30
Anand Doshi
10be112e85 bumped to version 6.16.0 2016-01-04 17:25:20 +06:00
Anand Doshi
bb256e41d7 [translations] 2016-01-04 16:51:24 +05:30
Nabin Hait
d35d74346d [fix] minor fix in stock projected qty 2016-01-04 16:16:49 +05:30
Rushabh Mehta
969d48a554 [translations] fixes #4534-38 2016-01-04 16:09:40 +05:30
Anand Doshi
d8b15ebaf7 Merge pull request #4572 from nabinhait/multi-currency-docs
[fix] Updated multi currency docs
2016-01-04 16:06:02 +05:30
Anand Doshi
b55dd5b284 [fix] BOM validate quantity > 0 2016-01-04 16:02:04 +05:30
Rushabh Mehta
5760b79747 [translations] fixes #4533 2016-01-04 15:57:01 +05:30
Rushabh Mehta
eb961370ff [translations] fixes #4532 2016-01-04 15:48:37 +05:30
Nabin Hait
cb08d576f6 Merge pull request #4571 from anandpdoshi/fix/payment-reconciliation-date
[fix] Payment Reconciliation: use the date and amount filters only for Invoice
2016-01-04 15:24:10 +05:30
Nabin Hait
9f40a252fc [fix] Updated multi currency docs 2016-01-04 15:20:37 +05:30
Anand Doshi
aee8b5bcad [fix] Purchase Receipt: Show row no. against the Rejected Warehouse mandatory error 2016-01-04 13:16:09 +05:30
Anand Doshi
f7980927a1 [fix] Payment Reconciliation: use the date and amount filters only for Invoice 2016-01-04 13:00:14 +05:30
Anand Doshi
c1e1026486 [fix] validate 'cannot change fiscal year dates' only if not new 2016-01-04 12:20:25 +05:30
Anand Doshi
7ae53657f9 Merge pull request #4565 from nabinhait/leave_docs
[docs] Leave Management
2016-01-04 12:11:00 +05:30
Anand Doshi
a6a71216a8 Merge pull request #4566 from rmehta/website-cleanup
[cleanup] [website]
2016-01-04 11:41:20 +05:30
Rushabh Mehta
51008f2abc [cleanup] [website] 2016-01-01 17:24:37 +05:30
Nabin Hait
c1e5cbb55d [docs] Leave Management 2016-01-01 17:08:57 +05:30
Nabin Hait
f41da5cfab Merge branch 'develop' 2015-12-31 16:14:17 +05:30
Nabin Hait
2d0ef63e72 bumped to version 6.15.1 2015-12-31 16:44:17 +06:00
Nabin Hait
884d4cbc48 Merge pull request #4560 from nabinhait/item_variants
[fix] Disable atrribute table in variant item record
2015-12-31 15:58:41 +05:30
Nabin Hait
9602c394dd Merge branch 'gabtzi-develop' into develop 2015-12-31 15:49:20 +05:30
Nabin Hait
51ff2658cb [fix] Minor changes in item naming 2015-12-31 15:49:00 +05:30
Nabin Hait
dd1c3ba164 Merge branch 'develop' of https://github.com/gabtzi/erpnext into gabtzi-develop 2015-12-31 15:46:15 +05:30
Nabin Hait
6b068e1367 [fix] Disable atrribute table in variant item record 2015-12-31 15:44:12 +05:30
Nabin Hait
b9dcf7f857 Merge pull request #4554 from umairsy/develop
Updated Articles
2015-12-31 15:37:46 +05:30
Nabin Hait
9ebbec5d9a Merge pull request #4558 from nabinhait/item_variants
[fix] Disable atrribute table in variant item record
2015-12-31 15:18:06 +05:30
Nabin Hait
bb9f59a051 Merge pull request #4556 from nabinhait/setup_bank
[fix] Create bank accounts from setup wizard #4546
2015-12-31 15:17:51 +05:30
Nabin Hait
f8de94b7c6 Merge pull request #4557 from nabinhait/po_fix
[fix] Update ordered qty in SO, if PO is made against SO
2015-12-31 15:17:41 +05:30
Nabin Hait
6626e32719 [fix] Disable atrribute table in variant item record 2015-12-31 14:54:57 +05:30
Rushabh Mehta
d55bdcf921 [fix] before_install returns False if setup wizard has been completed, fixes frappe/frappe#1488 2015-12-31 11:12:48 +05:30
Umair Sayyed
40a79de34d updating articles under Accounts 2015-12-30 18:27:08 +05:30
Nabin Hait
82a1561120 [fix] Create bank accounts from setup wizard #4546 2015-12-30 15:32:57 +05:30
Nabin Hait
3505de037e [fix] Update ordered qty in SO, if PO is made against SO 2015-12-30 15:03:34 +05:30
Umair Sayyed
d548ef8158 updated Articles in Customization and Accounting section 2015-12-29 16:25:26 +05:30
Umair Sayyed
3ad37363ed update artciles in customization section 2015-12-28 17:24:51 +05:30
gabtzi
d46abb49f3 Fix for Issue #4543: Suffix now uses attribute abbreviation if it exists or value for numeric attributes 2015-12-28 12:03:24 +02:00
Nabin Hait
c57517b201 Merge branch 'develop' 2015-12-28 15:09:44 +05:30
Nabin Hait
8efeea9c59 bumped to version 6.15.0 2015-12-28 15:39:43 +06:00
Nabin Hait
bf9e8cfbcc [translations] 2015-12-28 14:38:22 +05:30
gabtzi
096fc88200 Fix for Issue #4543: Improved code to check if it's a variant only once. 2015-12-28 11:07:10 +02:00
Nabin Hait
d5dedb1808 Merge pull request #4548 from nabinhait/fix1
[fix] Ignore permissions while creating fiscal year automatically
2015-12-28 14:23:01 +05:30
Nabin Hait
e50f80302a Merge pull request #4549 from saurabh6790/bin_update
[fixes] flag to identify actual qty update
2015-12-28 14:22:46 +05:30
gabtzi
9d44ac88f2 Fix for Issue #4543: Automatic item_code generation for variants when parent item is named after a Naming Series 2015-12-28 10:26:42 +02:00
Nabin Hait
892a782e59 docs 2015-12-28 13:27:41 +05:30
Saurabh
b166bcf50b [fixes] flag to trigger actual qty update 2015-12-28 13:25:35 +05:30
Nabin Hait
0e2d1bd4ed [fix] Ignore permissions while creating fiscal year automatically 2015-12-28 13:04:19 +05:30
Nabin Hait
f080003415 Merge pull request #4542 from umairsy/develop
updated Articles under Customization section
2015-12-28 12:43:18 +05:30
Nabin Hait
96e7c5a3bd Merge pull request #4541 from neilLasrado/develop
Added education as a domain in Company
2015-12-28 12:42:16 +05:30
Umair Sayyed
4bad150cf0 updated customization related articles 2015-12-24 20:40:37 +05:30
Anand Doshi
76568f0e8e [fix] log newsletter sending error 2015-12-24 15:13:54 +05:30
Neil Trini Lasrado
49febea6f5 Added education as a domain in Company 2015-12-24 15:10:35 +05:30
Rushabh Mehta
a59e1792b5 Merge pull request #4535 from nabinhait/defaults
[fix] Get defaults based on doctype or fieldname
2015-12-24 11:50:08 +05:30
Rushabh Mehta
28d6987455 Merge pull request #4537 from umairsy/develop
updated help articles  in the setup section
2015-12-24 11:47:27 +05:30
Umair Sayyed
56e19f3a8b updated articles in the setup section 2015-12-23 18:58:07 +05:30
Nabin Hait
b6b56453e1 [fix] Get defaults based on doctype or fieldname 2015-12-23 16:37:06 +05:30
Rushabh Mehta
d55d0c06e3 Merge branch 'develop' 2015-12-23 16:29:34 +05:30
Rushabh Mehta
8681a95010 bumped to version 6.14.1 2015-12-23 16:59:34 +06:00
Rushabh Mehta
1f63747916 [minor] [fix] add child in sales browser 2015-12-23 16:23:37 +05:30
Rushabh Mehta
332ec15dd7 Merge pull request #4525 from nabinhait/jv_fix_10
[fix] Validate advance entry based on party
2015-12-23 16:09:29 +05:30
Nabin Hait
6f8dafbb5e [fix] Validate advance entry based on party 2015-12-23 13:03:31 +05:30
Rushabh Mehta
d4073d50b2 Merge pull request #4530 from umairsy/develop
Updated screenshots in some articles
2015-12-23 13:01:30 +05:30
Rushabh Mehta
88bcee78a7 Merge pull request #4524 from nabinhait/jv_fix_9
[fix] Set debit/credit in company currency
2015-12-23 12:59:02 +05:30
Rushabh Mehta
cc2796e676 Merge pull request #4520 from partzsch/develop
Time Log now down to seconds
2015-12-23 12:56:44 +05:30
Umair Sayyed
dbaf6b569b Updated screenshots in some articles 2015-12-23 12:11:53 +05:30
Nabin Hait
d37cef7f60 [fix] Set debit/credit in company currency 2015-12-22 15:13:01 +05:30
Rushabh Mehta
01293bb3a3 [fix] [minor] fix available qty even if 0 2015-12-22 12:57:42 +05:30
partzsch
55ad42cfd0 Time Log now down to seconds
according to request of @anadpdoshi
new branch new commit new PR
2015-12-21 17:51:42 +01:00
Anand Doshi
381cec7b87 [fix] added Shopping Cart and Report Builder in Learn module 2015-12-21 18:56:20 +05:30
Anand Doshi
4c87497b7c Merge branch 'develop' 2015-12-21 18:34:08 +05:30
Anand Doshi
9fdf2a8bfe bumped to version 6.14.0 2015-12-21 19:04:08 +06:00
Anand Doshi
f773f1f539 [videos] added missing videos 2015-12-21 18:32:23 +05:30
Anand Doshi
7b8a224dd0 Merge pull request #4519 from umairsy/develop
video help page on report builder and shopping cart
2015-12-21 18:16:26 +05:30
Umair Sayyed
e1482f1acc video help page on report builder and shopping cart 2015-12-21 18:06:15 +05:30
Anand Doshi
c98d244af0 [change-log] 2015-12-21 17:31:09 +05:30
Anand Doshi
ee19fc0c7f [translations] + added Gujarati - Fixes frappe/translator#63 2015-12-21 17:10:20 +05:30
Anand Doshi
ee2129ce1c Merge pull request #4513 from nabinhait/discount_percentage
Additional Discount amount based on percentage
2015-12-21 16:13:17 +05:30
Anand Doshi
beed9ae4f8 Merge pull request #4510 from nabinhait/account_merge
[fix] Group account merging with sub-ordinate group
2015-12-21 16:03:19 +05:30
Anand Doshi
50ddf921be [minor] UOM message 2015-12-21 10:58:33 +05:30
Nabin Hait
3769d87240 Additional Discount amount based on percentage 2015-12-18 13:12:08 +05:30
Anand Doshi
15050e326c Merge pull request #4509 from anandpdoshi/fix/validate-total-transfer-in-material-request
[fix] Validate transfer qty cannot be greater than qty
2015-12-18 10:50:36 +05:30
Anand Doshi
0f809426d2 [fix] Validate transfer qty cannot be greater than qty 2015-12-17 22:35:03 +05:30
Nabin Hait
adab5d308c [fix] Group account merging with sub-ordinate group 2015-12-17 12:53:25 +05:30
Nabin Hait
824122c42a Merge branch 'ccfiel-develop' into develop 2015-12-17 12:20:40 +05:30
Nabin Hait
afda26e4f3 Fixed conflict 2015-12-17 12:19:58 +05:30
Chris Ian Fiel
d6d354b5c3 By: nabinhait
Depreciation account is an expense account, it is debited while booking depreciation. Thats why Depreciation amount is coming as negative, I think it should be positive and added to the "Net Profit and Loss".
2015-12-17 09:42:12 +08:00
Chris Ian Fiel
7d310bd182 Merge branch 'develop' of https://github.com/frappe/erpnext into develop 2015-12-17 09:18:24 +08:00
Nabin Hait
8b33a6cdc0 Cleanup in cash flow 2015-12-16 16:09:43 +05:30
Nabin Hait
5e173c7106 Merge branch 'develop' of https://github.com/ccfiel/erpnext into ccfiel-develop 2015-12-15 17:39:55 +05:30
Chris Ian Fiel
c80796cdd5 Cash Flow Report 2015-12-12 11:26:54 +08:00
Chris Ian Fiel
fde03453e4 Cash Flow Report 2015-12-12 10:54:56 +08:00
Chris Ian Fiel
826e18a29f Cash Flow Report 2015-12-12 10:33:01 +08:00
822 changed files with 60446 additions and 35290 deletions

View File

@@ -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, its 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.

View File

@@ -1,2 +1,2 @@
from __future__ import unicode_literals
__version__ = '6.13.1'
__version__ = '6.20.0'

View File

@@ -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')
}
}

View File

@@ -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",

View File

@@ -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

View File

@@ -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")

View File

@@ -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)": {},

View File

@@ -1,7 +1,6 @@
{
"country_code": "be",
"name": "Belgian PCMN",
"disabled": "Yes",
"tree": {
"CLASSE 1": {
"BENEFICE (PERTE) REPORTE(E)": {

View File

@@ -1,7 +1,6 @@
{
"country_code": "br",
"name": "Planilha de Contas Brasileira",
"is_active": "No",
"tree": {
"ATIVO": {
"CIRCULANTE": {

View File

@@ -1,7 +1,6 @@
{
"country_code": "ca",
"name": "Chart of Accounts for english-speaking provinces",
"is_active": "Yes",
"tree": {
"ASSETS": {
"CURRENT ASSETS": {

View File

@@ -1,7 +1,6 @@
{
"country_code": "ca",
"name": "Plan comptable pour les provinces francophones",
"is_active": "Yes",
"tree": {
"ACTIF": {
"ACTIFS COURANTS": {

View File

@@ -1,7 +1,6 @@
{
"country_code": "ch",
"name": "Plan comptable STERCHI",
"is_active": "Yes",
"disabled": "Yes",
"tree": {
"Actif": {

View File

@@ -1,7 +1,6 @@
{
"country_code": "co",
"name": "Unique Account Chart - PUC",
"is_active": "Yes",
"tree": {
"ACTIVO": {
"DEUDORES": {

View File

@@ -1,7 +1,6 @@
{
"country_code": "cr",
"name": "Costa Rica - Company 0",
"is_active": "Yes",
"tree": {
"0-Activo": {
"0-Activo circulante": {

View File

@@ -1,7 +1,6 @@
{
"country_code": "cr",
"name": "Costa Rica - Company 1",
"is_active": "Yes",
"tree": {
"xActivo": {
"root_type": "Asset",

View File

@@ -1,7 +1,7 @@
{
"country_code": "de",
"name": "Deutscher Kontenplan SKR04",
"is_active": "Yes",
"disabled": "Yes",
"tree": {
"Bilanz - Aktiva": {
"Anlageverm\u00f6gen": {

View File

@@ -1,7 +1,6 @@
{
"country_code": "de",
"name": "Deutscher Kontenplan SKR03",
"is_active": "No",
"disabled": "Yes",
"tree": {
"Aktiva": {

View File

@@ -1,6 +1,7 @@
{
"country_code": "es",
"name": "PGCE com\u00fan",
"disabled": "Yes",
"tree": {
"Acreedores y deudores por operaciones comerciales": {
"Acreedores varios": {

View File

@@ -1,7 +1,6 @@
{
"country_code": "et",
"name": "Ethiopia Tax and Account Chart Template",
"is_active": "Yes",
"tree": {
"ASSETS": {
"Cash and Cash Equivalents": {

View File

@@ -1,7 +1,6 @@
{
"country_code": "gt",
"name": "Plantilla de cuentas de Guatemala (sencilla)",
"is_active": "Yes",
"tree": {
"Activo": {
"Activo Corriente": {

View File

@@ -1,7 +1,6 @@
{
"country_code": "hn",
"name": "Plantilla de cuentas de Honduras (sencilla)",
"is_active": "Yes",
"tree": {
"Activo": {
"Activo Corriente": {

View File

@@ -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": {

View File

@@ -1,7 +1,6 @@
{
"country_code": "pa",
"name": "Plan de Cuentas",
"is_active": "Yes",
"tree": {
"ACTIVOS": {
"Activo Fijo": {

View File

@@ -1,6 +1,7 @@
{
"country_code": "ro",
"name": "Romania - Chart of Accounts",
"disabled": "Yes",
"tree": {
"CONTURI FINANCIARE": {
"CONTURI DE BILANT": {

View File

@@ -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"
}
}
}

View File

@@ -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": {

View File

@@ -1,7 +1,6 @@
{
"country_code": "th",
"name": "Thailand Chart of Accounts",
"is_active": "Yes",
"tree": {
"Assets": {
"Account Receivable": {},

View File

@@ -1,7 +1,6 @@
{
"country_code": "uy",
"name": "Plan de Cuentas",
"is_active": "Yes",
"tree": {
"ACTIVO": {
"ACTIVO CORRIENTE": {

View File

@@ -1,7 +1,6 @@
{
"country_code": "ae",
"name": "U.A.E Chart of Accounts",
"is_active": "Yes",
"tree": {
"Assets": {
"Current Assets": {

View File

@@ -1,7 +1,6 @@
{
"country_code": "gt",
"name": "Cuentas de Guatemala",
"is_active": "Yes",
"tree": {
"Activos": {
"Activo Corriente": {

View File

@@ -1,7 +1,6 @@
{
"country_code": "in",
"name": "Chart of Accounts - India",
"is_active": "Yes",
"tree": {
"Application of Funds (Assets)": {
"Current Assets": {

View File

@@ -1,7 +1,6 @@
{
"country_code": "ni",
"name": "Catalogo de Cuentas Nicaragua",
"is_active": "Yes",
"tree": {
"Activo": {
"Activo Corriente": {

View File

@@ -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"
}
}
}

View File

@@ -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"
}
}
}

View File

@@ -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",

View File

@@ -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))

View File

@@ -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
}
}

View File

@@ -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")
}
}

View File

@@ -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 {

View File

@@ -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

View File

@@ -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)

View File

@@ -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) {

View File

@@ -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 \

View 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"
}

View 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

View File

@@ -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

View File

@@ -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;
}
}

View File

@@ -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"
}

View File

@@ -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

View File

@@ -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

View File

@@ -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");
}
}
});

View File

@@ -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",

View File

@@ -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"

View 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"));
}
}
});
});
});

View 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"
}

View 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()

View File

@@ -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"];
}
}
}

View File

@@ -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)

View File

@@ -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({

View File

@@ -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 \

View File

@@ -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,

View File

@@ -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": ""
}

View File

@@ -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"

View File

@@ -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()

View File

@@ -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) {

View File

@@ -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",

View File

@@ -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

View File

@@ -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

View File

@@ -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)

View File

@@ -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",

View File

@@ -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,

View File

@@ -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();
}
});
}

View File

@@ -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)

View File

@@ -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",

View File

@@ -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",

View File

@@ -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",

View File

@@ -68,6 +68,7 @@ class ReceivablePayableReport(object):
"label": _("Currency"),
"fieldtype": "Data",
"width": 100,
"hidden": 1
},
_("Remarks") + "::200"
]

View File

@@ -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",

View File

@@ -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

View File

@@ -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>

View File

@@ -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
}
}

View File

@@ -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")
},
]
}
}

View 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"
})

View 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"
}

View 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({})

View File

@@ -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>
{% } %}

View File

@@ -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

View File

@@ -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
},
{

View File

@@ -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",

View File

@@ -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

View File

@@ -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")
}
]
}

View File

@@ -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")
}
]
}

View File

@@ -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",

View File

@@ -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"
})

View File

@@ -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