Compare commits

...

1116 Commits

Author SHA1 Message Date
Anand Doshi
0b59d1c78b Merge branch 'develop' 2015-10-22 21:59:21 +05:30
Anand Doshi
0fbf10797c bumped to version 6.6.3 2015-10-22 22:29:21 +06:00
Anand Doshi
58344cbb81 [hotfix] setup wizard is_pro_application if not service 2015-10-22 21:57:13 +05:30
Anand Doshi
c6e2c8f79e Merge branch 'develop' 2015-10-22 19:36:09 +05:30
Anand Doshi
b64b461d53 bumped to version 6.6.2 2015-10-22 20:06:09 +06:00
Anand Doshi
0b93bdcf40 [fix] get_party_gle_currency caching 2015-10-22 19:33:08 +05:30
Anand Doshi
e3910d02a5 Merge branch 'develop' 2015-10-22 18:53:19 +05:30
Anand Doshi
0af146cea6 bumped to version 6.6.1 2015-10-22 19:23:19 +06:00
Anand Doshi
683f756d0f [fix] Fetch company of employee in leave application 2015-10-22 18:52:15 +05:30
Anand Doshi
d905204e49 [fix] Update expense account in old purchase invoices if missing 2015-10-22 18:49:08 +05:30
Anand Doshi
d8bc40d7f0 [fix] party gle currency validation 2015-10-22 17:55:22 +05:30
Anand Doshi
54059b77a0 Merge branch 'develop' 2015-10-22 17:12:01 +05:30
Anand Doshi
f9f0e2591f bumped to version 6.6.0 2015-10-22 17:42:00 +06:00
Anand Doshi
5810bf70c7 [change-log] 2015-10-22 17:02:44 +05:30
Anand Doshi
97d8db775e Merge pull request #4208 from nabinhait/pcv
Period Closing Voucher as per multi currency
2015-10-22 16:46:26 +05:30
Nabin Hait
fbe08ec7d0 Period Closing Voucher Test Cases 2015-10-22 16:21:37 +05:30
Nabin Hait
0045c305ac Period Closing Voucher as per multi currency 2015-10-22 16:21:37 +05:30
Anand Doshi
5dd0fb6e2a Merge pull request #4213 from nabinhait/serial_no_fix
[fix] For Serial No Status
2015-10-22 15:25:11 +05:30
Anand Doshi
e99fff8d08 Merge pull request #4212 from anandpdoshi/leave-application-js-clenup
[minor] leave application cleanup
2015-10-22 15:19:57 +05:30
Anand Doshi
b61fed9106 Merge pull request #4205 from nabinhait/expenses_included_in_valuation
Expenses Included in Valuation
2015-10-22 15:19:38 +05:30
Nabin Hait
398c83afa5 [fix] For Serial No Status 2015-10-22 15:11:44 +05:30
Anand Doshi
c346484ca4 [minor] leave application cleanup 2015-10-21 19:56:14 +05:30
Nabin Hait
70b7f7f036 minor improvement in patch 2015-10-21 17:40:06 +05:30
Nabin Hait
31c51ef914 [fix] test case for purchase invoice gle 2015-10-21 17:40:06 +05:30
Nabin Hait
be464696cc [fix][patch] Fix wrong gle for Purchase Invoice against Expenses Included in Valuation account 2015-10-21 17:40:06 +05:30
Anand Doshi
191b2970e9 [translations] updated 2015-10-21 16:59:33 +05:30
Anand Doshi
c50f033722 [language] Added Ukranian language - українська. Closes frappe/translator#57 2015-10-21 16:59:32 +05:30
Anand Doshi
e1e1414894 Merge pull request #4195 from anandpdoshi/journal-entry-posting-date
[enhancement] Quick Entry in Journal Entry, remember Posting Date
2015-10-21 16:50:40 +05:30
Anand Doshi
d1441245fb [fix] variant website page render 2015-10-21 16:36:43 +05:30
Anand Doshi
87da662703 [enhancement] Quick Entry in Journal Entry, remember Posting Date 2015-10-21 16:27:13 +05:30
Anand Doshi
99ba924303 Merge pull request #4207 from rmehta/rename-tool
[feature] rename via console merge with frappe/frappe#1349
2015-10-21 14:27:49 +05:30
Anand Doshi
066ff9599a Merge pull request #4206 from neilLasrado/variant
Prevent Template Item from going into infinite loop while saving
2015-10-21 14:20:49 +05:30
Rushabh Mehta
33ebaf479d [feature] rename via console merge with frappe/frappe#1349 2015-10-21 12:26:37 +05:30
Neil Trini Lasrado
3a573d1a6d Prevent Template Item from going into infinite loop while saving 2015-10-21 12:20:06 +05:30
Rushabh Mehta
7f66983309 [minor] added column type definition in batch-wise balance history 2015-10-21 12:04:27 +05:30
Rushabh Mehta
2c867fdd73 [fix] email digest cache 2015-10-21 11:13:40 +05:30
Anand Doshi
95dfc2730b [fix] re-run thumbnail patch 2015-10-20 19:03:30 +05:30
Anand Doshi
558646c6b8 [fix] ignore mandatory when creating customer and contact in cart 2015-10-20 18:57:38 +05:30
Anand Doshi
ea0d98891f [minor] don't display missing file doc message in item's make thumbnail 2015-10-20 18:57:38 +05:30
Anand Doshi
1b4c5ad1e1 Merge branch 'develop' 2015-10-20 18:35:49 +05:30
Anand Doshi
2678135f5e bumped to version 6.5.3 2015-10-20 19:05:49 +06:00
Anand Doshi
25ef4ff373 [fix] variant selector display 2015-10-20 18:34:21 +05:30
Anand Doshi
c85a37fe00 Merge branch 'develop' 2015-10-20 17:53:37 +05:30
Anand Doshi
3c3d69f905 bumped to version 6.5.2 2015-10-20 18:23:37 +06:00
Anand Doshi
aed8da40ae Merge pull request #4198 from nabinhait/mc_fix
[fix] Set higher precision for debit, credit and exchange rate field
2015-10-20 17:46:22 +05:30
Anand Doshi
3bc43682f1 Merge pull request #4199 from neilLasrado/item
Default value of allow production order in Item master changed to 1
2015-10-20 17:44:26 +05:30
Rushabh Mehta
725816e616 Merge pull request #4203 from anandpdoshi/item-variant-in-website
[fix] Patch template item to be shown in website, show variant's description and price on change of attribute
2015-10-20 17:41:26 +05:30
Anand Doshi
7c0eadb451 [fix] Patch template item to be shown in website, show variant's description and price on change of attribute 2015-10-20 17:30:02 +05:30
Neil Trini Lasrado
d4357e80d7 Fixed Test Cases 2015-10-20 16:21:02 +05:30
Neil Trini Lasrado
c0f88e4caf Default value fot allow production order in Item master changed to 1 2015-10-20 15:51:04 +05:30
Anand Doshi
73286dd9f5 [minor] define email field for Issue 2015-10-20 14:53:22 +05:30
Anand Doshi
1f259ba73d Merge pull request #4178 from anandpdoshi/item-reorder-if-no-bin
[fix] Item Re-order if Bin does not exists and fixed Stock Projected Qty report to show per Warehouse Re-order level
2015-10-20 14:43:20 +05:30
Anand Doshi
7b2b0cd73c [fix] Item Re-order if Bin does not exists and fixed Stock Projected Qty report to show per Warehouse Re-order level 2015-10-20 14:29:47 +05:30
Anand Doshi
2c749db2a9 Merge pull request #4196 from neilLasrado/develop
Fixed issue in Item Variant for Numeric Attributes
2015-10-20 14:28:16 +05:30
Anand Doshi
17c633d00f [fix] Set fieldtype of description field as Text Editor in Landed Cost Item 2015-10-20 14:26:44 +05:30
Anand Doshi
4ee5b75687 Merge pull request #4200 from nabinhait/fix16
[fix] Set fieldtype of description field as Text in Landed Cost Item
2015-10-20 14:24:36 +05:30
Neil Trini Lasrado
a4fad72a65 Considered greater precision of value and increment (better code) 2015-10-20 12:20:49 +05:30
Neil Trini Lasrado
e65ac00f36 Considered greater precision of value and increment 2015-10-20 12:20:49 +05:30
Neil Trini Lasrado
75bd0f7cfe Fixed issue in Item Variant for Numeric Attributes 2015-10-20 12:20:49 +05:30
Nabin Hait
4d20f3029b [fix] Set fieldtype of description field as Text in Landed Cost Item 2015-10-20 12:18:19 +05:30
Nabin Hait
c35b35abca [fix] Set higher precision for exchange rate field 2015-10-20 12:11:51 +05:30
Anand Doshi
17dc249841 [fix] rollback if exception in bulk rename 2015-10-20 12:11:26 +05:30
Anand Doshi
12af47918d [fix] rename tool 2015-10-20 12:02:39 +05:30
Anand Doshi
84ca0197e4 Merge pull request #4197 from saurabh6790/fixes
[minor][fix] set default fiscal year for holiday list calendar view
2015-10-20 11:40:00 +05:30
Anand Doshi
3395e7a2e4 [fix] Daily digest date format 2015-10-20 08:48:43 +05:30
Anand Doshi
25956d6282 [fix] Item thumbnail 2015-10-20 08:48:43 +05:30
Saurabh
ba2133cba2 [minor][fix] set default fiscal year for holiday list calendar view 2015-10-19 19:20:11 +05:30
Anand Doshi
28e3d63280 Merge branch 'develop' 2015-10-19 19:10:58 +05:30
Anand Doshi
414660313a bumped to version 6.5.1 2015-10-19 19:40:58 +06:00
Anand Doshi
c52a601e87 Merge pull request #4189 from nabinhait/dn_target_wh_testcase
Test case fixed for swtiching valuation method
2015-10-19 19:09:27 +05:30
Anand Doshi
7a869b0dca [hotfix] print in patch 2015-10-19 17:33:40 +05:30
Nabin Hait
6f64a78ecf Test case fixed for swtiching valuation method 2015-10-19 16:53:35 +05:30
Nabin Hait
608bbc7850 Test case fixed for swtiching valuation method 2015-10-19 16:53:35 +05:30
Anand Doshi
639826e888 Merge branch 'develop' 2015-10-19 16:30:33 +05:30
Anand Doshi
16b2c51988 bumped to version 6.5.0 2015-10-19 17:00:33 +06:00
Anand Doshi
76e9ba1e76 [change-log] 2015-10-19 16:03:34 +05:30
Anand Doshi
9dad86c189 Merge pull request #4190 from nabinhait/income_expense_account_query
[fix] Allowed accounts with account type='Income Account' for default income account in item
2015-10-19 15:43:32 +05:30
Anand Doshi
5302b46955 Merge pull request #4183 from nabinhait/multi_currency_fix
Multi currency fix
2015-10-19 15:32:24 +05:30
Nabin Hait
afd14f6f0e [fix] Allowed accounts with account type='Income Account' for default income account in item 2015-10-19 15:27:58 +05:30
Anand Doshi
05584d6d8b Merge pull request #4191 from rmehta/email-digest-quotes
[enhancement] add a quote with email digest
2015-10-19 15:18:20 +05:30
Nabin Hait
aa015902d5 Validate currency of default receivable/payable accounts 2015-10-19 15:10:11 +05:30
Nabin Hait
2873f2e7de Validate currency of default receivable/payable accounts 2015-10-19 15:10:11 +05:30
Rushabh Mehta
64fd970a8a Merge pull request #4193 from anandpdoshi/attach-as-small-text
[fix] change attach fields to small text
2015-10-19 14:58:57 +05:30
Anand Doshi
b4e9c1da64 [fix] thumbnail generation for item 2015-10-19 12:57:19 +05:30
Anand Doshi
1d093a4039 [fix] change attach fields to small text 2015-10-19 12:56:29 +05:30
Rushabh Mehta
fe9717cb9c [enhancement] add a quote with email digest 2015-10-19 12:35:07 +05:30
Anand Doshi
d665a07621 [fix] remove label 'Column Break' 2015-10-16 15:44:28 +05:30
Rushabh Mehta
2a1ba886f1 [patch-fix] 2015-10-15 16:56:53 +05:30
Rushabh Mehta
55f1ea05da [release] Added change log 2015-10-15 16:32:36 +05:30
Rushabh Mehta
2e7f9d2b8f [fixes] email digest 2015-10-15 16:31:16 +05:30
Rushabh Mehta
3a519f269d Merge pull request #4175 from anandpdoshi/dynamic-linked-with
[fix] exclude gl entry and stock ledger entry in linked with. Depends on frappe/frappe#1339
2015-10-15 14:25:18 +05:30
Rushabh Mehta
4c0d0793a3 Merge pull request #4174 from saurabh6790/shopping_cart
[fix] order.html rate display
2015-10-15 14:01:46 +05:30
Rushabh Mehta
d3b8a74508 [test] fix, force values in target warehouse too 2015-10-15 13:23:10 +05:30
Anand Doshi
77760db89c [fix] strip whitespace in setup wizard args 2015-10-15 12:54:40 +05:30
Anand Doshi
1d23ebb51d [fix] exclude gl entry and stock ledger entry in linked with. Depends on frappe/frappe#1339 2015-10-15 12:54:40 +05:30
Rushabh Mehta
ba5b0e8458 [test] [fix] print values for failing test 2015-10-15 12:45:42 +05:30
Rushabh Mehta
14a908bdec [test] [fix] abs(valuation_rate) for moving average 2015-10-15 12:28:20 +05:30
Rushabh Mehta
9f436a7c71 [fix] [exchange-rate] let user defined exchange rate take preceedence 2015-10-15 11:57:46 +05:30
Rushabh Mehta
746fd90625 [fix] [exchange-rate] let user defined exchange rate take preceedence 2015-10-15 11:50:38 +05:30
Rushabh Mehta
f861856ed9 [fix] do not check purchase invoice uniqueness for cancelled documents 2015-10-15 11:37:34 +05:30
Rushabh Mehta
f94f153078 [test] fixes 2015-10-15 11:31:59 +05:30
Rushabh Mehta
c9bacedbfe [test] fixes 2015-10-15 11:00:34 +05:30
Saurabh
c0cee82727 [small fixes] frozen customer testcase 2015-10-14 18:03:07 +05:30
Saurabh
4c53931363 [fixes and test case] test case to avoid duplicate customer name exection 2015-10-14 18:03:07 +05:30
Saurabh
53f7e6281c [fix] Duplicate Customer Name Error 2015-10-14 18:03:07 +05:30
Saurabh
9f235b891f [fix] order.html rate display 2015-10-14 18:03:07 +05:30
Rushabh Mehta
c4d4c7feb0 [fix] repost_actual_qty fix 2015-10-14 17:37:28 +05:30
Rushabh Mehta
ee6862b277 [fix] VARCHAR lengths as 140 2015-10-14 17:28:35 +05:30
Rushabh Mehta
53f77ad5e8 Merge pull request #4125 from rmehta/variant-in-website
[enhancement] add variants in website
2015-10-14 16:22:36 +05:30
Rushabh Mehta
fb73151da6 [fixes] 2015-10-14 16:22:01 +05:30
Rushabh Mehta
6e322d0a02 [enhancement] use thumbnails in grid views, patch to make thumbnails 2015-10-14 16:21:24 +05:30
Rushabh Mehta
73e73795f1 [minor] Added 'Invite User' in Contact 2015-10-14 16:20:39 +05:30
Rushabh Mehta
80d2a55342 [enhancement] add variants in website 2015-10-14 16:16:00 +05:30
Rushabh Mehta
9cbf6b1b22 Merge pull request #4114 from anandpdoshi/varchar-140
Limit varchar length to 140 instead of 255 to mitigate Row Size Too Large error
2015-10-14 16:14:53 +05:30
Anand Doshi
41dd2c458b [minor] pass does not exist error 2015-10-14 16:13:49 +05:30
Anand Doshi
71ebad5668 Limit varchar length to 140 instead of 255 to mitigate Row Size Too Large error 2015-10-14 16:13:49 +05:30
Rushabh Mehta
b4c0e94e99 Merge pull request #4113 from rmehta/email-digest-cleanup
[cleanup] Email Digest
2015-10-14 15:53:53 +05:30
Rushabh Mehta
73f1dc4edf [cleanup] added unsubscribe to email digest 2015-10-14 15:53:37 +05:30
Rushabh Mehta
174299124f [cleanup] [wip] email digest 2015-10-14 15:53:37 +05:30
Rushabh Mehta
c27748b2b3 Merge pull request #4040 from nabinhait/dn_target_warehouse
Delivery to target warehouse
2015-10-14 15:29:54 +05:30
Rushabh Mehta
626ba1bb81 [translations] added bn, da-DK, es-PE, si 2015-10-14 15:24:42 +05:30
Rushabh Mehta
591f047974 Merge pull request #4163 from neilLasrado/develop
Cost Center - Income Account
2015-10-14 15:20:11 +05:30
Nabin Hait
38e4c6f2af Allow same serial nos for raw materials and fg item in repack / manufacture entry 2015-10-13 18:37:39 +05:30
Neil Trini Lasrado
58e9590850 Fixed issues with Permissions in Company Doctype 2015-10-13 17:45:43 +05:30
Nabin Hait
03afb45e34 [fix] Validate deletion of serial no 2015-10-13 15:46:42 +05:30
Nabin Hait
d91382dbf3 [fix] serial no status 2015-10-13 15:46:42 +05:30
Nabin Hait
e07958bbda Change log and sopnsors for delivery to target warehouse 2015-10-13 15:46:42 +05:30
Nabin Hait
b445be3552 Test case for delivery to target warehouse 2015-10-13 15:46:42 +05:30
Nabin Hait
c865f229fb Target Warehouse in Delivery Note and Sales Invoice and removed Serial No status 2015-10-13 15:46:42 +05:30
Neil Trini Lasrado
ec5deb6e48 Changed label in Company 2015-10-13 15:28:12 +05:30
Neil Trini Lasrado
486bf2e113 Added Change Log 2015-10-13 15:17:53 +05:30
Neil Trini Lasrado
f49b085625 Allowed Income account to be added to Cost Center 2015-10-13 14:54:39 +05:30
Rushabh Mehta
adcaf75bb0 Merge branch 'develop' 2015-10-13 14:46:15 +05:30
Rushabh Mehta
4f4fc45ae6 bumped to version 6.4.7 2015-10-13 15:16:15 +06:00
Rushabh Mehta
079d0b7108 Merge pull request #4161 from rmehta/sales-order-status
[fix] Sales Order status for Maintenance
2015-10-13 12:38:00 +05:30
Rushabh Mehta
86125b2b9f [fix] sales order status for maintenance 2015-10-13 12:31:05 +05:30
Rushabh Mehta
22d0d586ab [minor] [typo] 2015-10-13 12:30:21 +05:30
Rushabh Mehta
eb62aed8c7 Merge pull request #4157 from nabinhait/bin
[fix][patch] Delete duplicate bins
2015-10-12 18:39:16 +05:30
Rushabh Mehta
60f1739ca5 Merge pull request #4158 from rmehta/journal-entry-title-fix
[fix] set title in Journal Entry only if not set
2015-10-12 18:35:49 +05:30
Rushabh Mehta
5f349a67c9 Merge pull request #4156 from rmehta/item-section-fix
[fix] [minor] collapsible section for Item - removed custom script
2015-10-12 18:35:38 +05:30
Rushabh Mehta
fd294eb981 Merge pull request #4154 from rmehta/sales-analytics-fix
[minor] [fix] Use customer_name in Sales Analytics
2015-10-12 18:32:39 +05:30
Rushabh Mehta
d256055a8c Merge pull request #4153 from rmehta/stock-entry-fix
[fix] [minor] stock_entry.py error for None qty
2015-10-12 18:32:28 +05:30
Rushabh Mehta
cefa106a06 Merge pull request #4151 from anandpdoshi/purchase-invoice-letterhead
[fix] Added Letter Head field to Purchase Invoice
2015-10-12 18:30:25 +05:30
Rushabh Mehta
67ecfcf52c Merge pull request #4148 from saurabh6790/erp_support
[minor fix], escape % char
2015-10-12 18:30:13 +05:30
Nabin Hait
b7e46c4ed9 [fix][patch] Delete duplicate bins 2015-10-12 18:28:50 +05:30
Rushabh Mehta
bc5ecfff06 Merge pull request #4146 from nabinhait/fix10
[fix] Multiple minor fixes
2015-10-12 18:27:02 +05:30
Rushabh Mehta
8fa4845d00 [fix] set title in Journal Entry only if not set 2015-10-12 16:59:52 +05:30
Rushabh Mehta
d4882653c3 [fix] [minor] collapsible section for Item - removed custom script 2015-10-12 16:45:53 +05:30
Anand Doshi
9a4d165ba2 [fix] get_party_details.js - set posting_date if args are initialised 2015-10-12 16:23:51 +05:30
Rushabh Mehta
a7099eaa8d [minor] [fix] Use customer_name in Sales Analytics 2015-10-12 16:22:10 +05:30
Anand Doshi
4b72d05793 [fix] get allocated_percentage from party's sales team 2015-10-12 16:15:52 +05:30
Rushabh Mehta
a30f3ea1f9 [fix] [minor] stock_entry.py error for None qty 2015-10-12 16:12:52 +05:30
Rushabh Mehta
3b6a8af0da Merge pull request #4150 from rmehta/project-title-fix
[fix] copy task titles with project
2015-10-12 15:57:04 +05:30
Anand Doshi
4fa69780a8 [fix] Added Letter Head field to Purchase Invoice 2015-10-12 15:55:24 +05:30
Rushabh Mehta
2dc619ae1f [fix] copy task titles with project 2015-10-12 15:55:12 +05:30
Nabin Hait
fc9031924e [fix] Field type of Age field converted to Int 2015-10-12 15:47:07 +05:30
Saurabh
e14124198d minor fix, escape % char 2015-10-12 15:08:09 +05:30
Nabin Hait
51e980dd2c [fix] Multiple minor fixes 2015-10-10 18:10:05 +05:30
Rushabh Mehta
95781919fb [fix] sales order notification 2015-10-08 11:50:04 +05:30
Rushabh Mehta
c03cba9d17 [fix] sales order notification 2015-10-08 11:46:32 +05:30
Nabin Hait
72cd206286 Merge branch 'develop' 2015-10-07 17:27:23 +05:30
Nabin Hait
9801745090 bumped to version 6.4.6 2015-10-07 17:57:23 +06:00
Anand Doshi
7866c6e6db [fix] modified in sales order and purchase order 2015-10-07 17:26:19 +05:30
Nabin Hait
5812fdb574 Merge branch 'develop' 2015-10-07 14:40:32 +05:30
Nabin Hait
4c502bcd26 bumped to version 6.4.5 2015-10-07 15:10:32 +06:00
Nabin Hait
714948c867 Merge pull request #4136 from nabinhait/uom
[fix] Fetch UOM Conversion Factor from template if not specified in variants
2015-10-07 14:30:18 +05:30
Nabin Hait
8f3b360f83 Merge pull request #4133 from saurabh6790/erp_support
Calendar view for holiday listing
2015-10-07 14:29:38 +05:30
Nabin Hait
314086d6c0 [fix] Fetch UOM Conversion Factor from template if not specified in variants 2015-10-07 11:55:08 +05:30
Nabin Hait
bcd655a985 Merge pull request #4109 from rmehta/fix-sales-purchase-order-status
[fix] sales & purchase order status
2015-10-07 11:34:30 +05:30
Saurabh
b0dbdc1439 minor fixes 2015-10-07 11:27:25 +05:30
Nabin Hait
37b0bf257d Merge pull request #4117 from nabinhait/sample_data
[fix] Create sample opportunity and quotation only if Customer exists
2015-10-07 11:25:50 +05:30
Nabin Hait
c5a25f44e1 Merge pull request #4119 from nabinhait/fix3
[fix] Return account currency only if account provided
2015-10-07 11:25:19 +05:30
Nabin Hait
8dafa376ab Merge pull request #4123 from nabinhait/fix4
[fix] allowed more than 2 currencies in Journal Entry
2015-10-07 11:24:45 +05:30
Saurabh
74eb8e34da [Fixes] minor fix for fiscal year in holiday list 2015-10-07 11:17:14 +05:30
Nabin Hait
5c66fb7631 Merge pull request #4130 from nabinhait/reports
[fix][report] Left join used in pending reports
2015-10-07 11:15:36 +05:30
Nabin Hait
be3b3b2107 Merge pull request #4132 from nabinhait/credit_limit
minor fix in credit limit
2015-10-07 11:15:02 +05:30
Nabin Hait
9ab09fd1d6 Merge pull request #4134 from nabinhait/valuation_rate
[fix] Valuation Rate in Stock Balance report
2015-10-07 11:09:56 +05:30
Nabin Hait
8a7bdd5a92 [fix] Valuation Rate in Stock Balance report 2015-10-06 18:46:56 +05:30
Saurabh
1d753c92b1 Calendar view for holiday listing 2015-10-06 15:21:23 +05:30
Nabin Hait
54ecc8ebba minor fix in credit limit 2015-10-06 14:28:41 +05:30
Nabin Hait
f4edaef481 [fix][report] Left join used in pending reports 2015-10-06 12:48:04 +05:30
Nabin Hait
ebbd163903 [fix] allowed more than 2 currencies in Journal Entry 2015-10-05 13:21:38 +05:30
Nabin Hait
8954b24b22 [fix] Return account currency only if account provided 2015-10-04 12:27:46 +05:30
Nabin Hait
ae92fc7f35 [fix] Create sample opportunity and quotation only if Customer exists 2015-10-03 13:42:44 +05:30
Rushabh Mehta
0bc3ca02f3 [fix] default contact for website 2015-10-03 12:08:43 +05:30
Rushabh Mehta
d10ba853e6 [fix] sales & purchase order status 2015-10-02 17:16:51 +05:30
Anand Doshi
5bcf8315de Merge branch 'develop' 2015-10-02 16:35:36 +05:30
Anand Doshi
789a798e36 bumped to version 6.4.4 2015-10-02 17:05:36 +06:00
Nabin Hait
ee1169dac7 Merge pull request #4112 from nabinhait/fix1
Minor fix
2015-10-02 16:27:49 +05:30
Nabin Hait
fbef1fdf3a Minor fix 2015-10-02 16:26:18 +05:30
Anand Doshi
4358e1cd46 Merge pull request #4111 from nabinhait/payment_reco_patch
[patch] Fix affected Journal Entries due to reconciliation
2015-10-02 16:05:03 +05:30
Nabin Hait
7a287a9153 [patch] Fix affected Journal Entries due to reconciliation 2015-10-02 16:00:42 +05:30
Anand Doshi
5a49ded5d9 Merge branch 'develop' 2015-10-02 12:43:27 +05:30
Anand Doshi
71f23acc2b bumped to version 6.4.3 2015-10-02 13:13:27 +06:00
Anand Doshi
1a1f790150 [fix] test case 2015-10-02 12:34:18 +05:30
Rushabh Mehta
3c54e9779b Merge pull request #4108 from nabinhait/payment_reco
[fix] Payment Reconciliation in multi-currency
2015-10-02 12:32:54 +05:30
Nabin Hait
db48b7d764 [fix] Payment Reconciliation in multi-currency 2015-10-02 12:05:55 +05:30
Rushabh Mehta
83c0899c83 [fix] [minor] default ranges for demo 2015-10-02 11:31:37 +05:30
Nabin Hait
e5047ec90a Merge pull request #4106 from anandpdoshi/payment-tool-amount
In Payment Tool, Set Payment Amount = Outstanding Amount if checked
2015-10-02 10:39:57 +05:30
Anand Doshi
d9ab725be4 [fix] In Payment Tool, Set Payment Amount = Outstanding Amount if checked 2015-10-01 19:17:02 +05:30
Anand Doshi
7afaeb0820 [fix] the case when party account currency is missing 2015-10-01 18:55:43 +05:30
Anand Doshi
da2d8b958d Merge branch 'develop' 2015-10-01 14:01:22 +05:30
Anand Doshi
ba48f82e03 bumped to version 6.4.2 2015-10-01 14:31:22 +06:00
Anand Doshi
8e7e128e81 Merge pull request #4104 from nabinhait/addresses_and_contacts
[fix] get permission query condition if no permitted links
2015-10-01 14:00:38 +05:30
Anand Doshi
0353569e8b Merge pull request #4103 from nabinhait/monthly_attendance_sheet
[fix] Month issue fixed in Monthly Attendance Sheet
2015-10-01 13:58:33 +05:30
Anand Doshi
665e2f5418 Merge pull request #4100 from nabinhait/general_ledger_report
[fix] General Ledger report fixed
2015-10-01 13:56:13 +05:30
Nabin Hait
dace2b6796 [fix] get permission query condition if no permitted links 2015-10-01 13:54:46 +05:30
Nabin Hait
712b02593a [fix] Month issue fixed in Monthly Attendance Sheet 2015-10-01 12:35:54 +05:30
Anand Doshi
d2a60fd727 Merge pull request #4102 from nabinhait/lead_email
[fix] Validate duplicate email ids in Lead
2015-10-01 12:07:37 +05:30
Nabin Hait
f924e08b93 [fix] Validate duplicate email ids in Lead 2015-10-01 11:51:48 +05:30
Nabin Hait
5c623dae4d [fix] General Ledger report fixed 2015-10-01 11:22:15 +05:30
Anand Doshi
e2c3d40b57 [hotfix] Payment Reconciliation Invoice Type 2015-10-01 11:21:26 +05:30
Anand Doshi
673887455f [fix] Show Contribution (%) in Sales Team table in Customer Form 2015-10-01 11:21:25 +05:30
Anand Doshi
63199e486b Merge branch 'develop' 2015-09-30 20:51:00 +05:30
Anand Doshi
bf7294cf5c bumped to version 6.4.1 2015-09-30 21:20:59 +06:00
Anand Doshi
8aa06a809a Merge pull request #4096 from nabinhait/jv_reference
Repost GL Entries for Journal Entries where reference name is missing
2015-09-30 19:44:21 +05:30
Nabin Hait
72d2d682ae Repost GL Entries for Journal Entries where reference name is missing 2015-09-30 18:50:54 +05:30
Anand Doshi
21f6ea6f7e [hotfix] remove allow on submit from item tables 2015-09-30 18:45:29 +05:30
Anand Doshi
185f488c51 Merge branch 'develop' 2015-09-30 17:23:52 +05:30
Anand Doshi
f3006972d5 bumped to version 6.4.0 2015-09-30 17:53:52 +06:00
Anand Doshi
dccc6bc11d [change-log] 2015-09-30 17:19:51 +05:30
Anand Doshi
15d2c89939 Merge remote-tracking branch 'upstream/master' into develop
Conflicts:
	erpnext/accounts/report/general_ledger/general_ledger.py
2015-09-30 17:13:58 +05:30
Anand Doshi
ca4c8a2a46 [translations] 2015-09-30 17:10:58 +05:30
Anand Doshi
c320fe541d Merge pull request #4067 from anandpdoshi/remove-party-account-currency
Remove party_account_currency from Customer and Supplier, and use currency derived from get_party_account
2015-09-30 16:55:24 +05:30
Anand Doshi
f40a87511e Merge pull request #4091 from rmehta/repack-allow-low-rate
[fix] remove validation to disallow lower rate
2015-09-30 16:46:31 +05:30
Anand Doshi
4945b94950 [fix] added validation to match account currency with existing gle and test case 2015-09-30 16:41:15 +05:30
Rushabh Mehta
cb96b61449 [fix] remove validation to disallow lower rate 2015-09-30 16:22:05 +05:30
Anand Doshi
248c867a2c [minor] removed test case for party multi-currency validation, since party multi-currency is now based on account 2015-09-30 15:11:13 +05:30
Anand Doshi
da98ab6f3c [fix] Only 1 account per company for a party 2015-09-30 15:11:12 +05:30
Anand Doshi
cd0989e051 Added method get_account_currency 2015-09-30 15:11:12 +05:30
Anand Doshi
b20baf894f [fix] Remove party_account_currency from Customer and Supplier, and use currency derived from get_party_account 2015-09-30 15:11:12 +05:30
Nabin Hait
d3cf4f1264 Merge pull request #4075 from anandpdoshi/journal-entry-get-exchange-rate
return exchange rate as 1 if no account is specified
2015-09-30 15:05:41 +05:30
Anand Doshi
2dbe2b63b2 Merge pull request #4088 from anandpdoshi/address-contact-permissions
Apply permissions on address and contact based on permissions of Customer, Supplier
2015-09-30 12:19:50 +05:30
Anand Doshi
edba8f5582 [fix] Print 'Attach' field in Stock Entry Detail 2015-09-30 11:50:08 +05:30
Anand Doshi
89b8d11f9c [fix] Apply permissions on address and contact based on permissions of Customer, Supplier 2015-09-29 20:11:57 +05:30
Anand Doshi
19a33994da [cleanup] removed desk_home and desk_home_flows from conf.js 2015-09-29 20:06:22 +05:30
Rushabh Mehta
89349d3ae3 [fix] [payment-reconciliation] ignore rows with blank invoice numbers 2015-09-29 16:39:53 +05:30
Anand Doshi
f6a31a568a Merge pull request #4085 from rmehta/bulk-priority
[enhancement] lower priority for newsletter emails
2015-09-29 15:25:13 +05:30
Rushabh Mehta
4bcbcd29f7 [enhancement] lower priority for newsletter emails 2015-09-29 14:58:45 +05:30
Anand Doshi
740a11263f [minor] validate invoice number is selected in Payment Reconciliation 2015-09-29 12:55:11 +05:30
Anand Doshi
142859f36e Merge pull request #4076 from anandpdoshi/shopping-cart-order
check doc.has_website_permission in order.html. Merge after frappe/frappe#1316
2015-09-28 19:40:17 +05:30
Anand Doshi
6534ad082d Merge pull request #4069 from anandpdoshi/round-status-updater-percentages
Round status update percentages to 2 decimals
2015-09-28 19:40:01 +05:30
Anand Doshi
6361ae3495 Merge branch 'rmehta-backup-cleanup' into develop 2015-09-28 19:38:06 +05:30
Rushabh Mehta
7f75dbf061 [cleanup] remove backup manager 2015-09-28 19:12:54 +05:30
Anand Doshi
199d8a44fc [fix] check doc.has_website_permission in order.html 2015-09-28 19:04:42 +05:30
Rushabh Mehta
72b1128467 [fixes] accounts controller add flt 2015-09-28 17:29:46 +05:30
Anand Doshi
d6cb55ad1a [fix] return exchange rate as 1 if no account is specified 2015-09-28 17:20:02 +05:30
Anand Doshi
c76e34d7de [fix] In get_bom_items_as_dict don't filter by is_pro_applicable for multi-level bom 2015-09-28 17:01:44 +05:30
Anand Doshi
33b10faf94 Merge pull request #4074 from anandpdoshi/multi-level-bom-fetch
[fix] In get_bom_items_as_dict don't filter by is_pro_applicable for multi-level bom
2015-09-28 17:00:52 +05:30
Anand Doshi
d970b001a4 [fix] Round status update percentages to 2 decimals 2015-09-28 16:52:22 +05:30
Anand Doshi
d767fb6134 [fix] In get_bom_items_as_dict don't filter by is_pro_applicable for multi-level bom 2015-09-28 16:44:48 +05:30
Rushabh Mehta
6239923340 Merge pull request #4071 from gmarke/patch-2
Update get_item_details.py
2015-09-28 10:18:56 +05:30
gmarke
e5a31462fe Update get_item_details.py
like this it will be possible to correctly handle cost center for stock entries when no default cost center per company is set
2015-09-27 09:38:01 +02:00
Anand Doshi
6f39300d43 Merge pull request #4068 from anandpdoshi/due-date-validation
if no party, don't validate due date based on credit days
2015-09-25 17:31:33 +05:30
Anand Doshi
0ca587e018 [fix] if no party, don't validate due date based on credit days 2015-09-25 16:32:14 +05:30
Rushabh Mehta
8ffe12ebe4 [chart-of-accounts] added default for Guatemala 2015-09-25 15:40:33 +05:30
Anand Doshi
8579af371c Merge pull request #4057 from rmehta/gl-report-fix
GL Report Fix
2015-09-25 12:30:26 +05:30
Rushabh Mehta
b5ff9421e1 [optimize] customer outstanding query 2015-09-25 12:25:12 +05:30
Rushabh Mehta
ba8ec17f0b Merge pull request #4065 from nabinhait/receivable_payable
[fix] Fetch gl entries in receivable/payable report only if party mentioned
2015-09-25 11:34:14 +05:30
Nabin Hait
44bd3b2601 [fix] Fetch gl entries in receivable/payable report only if party mentioned 2015-09-25 10:33:51 +05:30
Rushabh Mehta
9d40eca428 Merge pull request #4064 from nabinhait/trial_balance_for_party
[report] Trial Balance for Party
2015-09-25 10:01:44 +05:30
Nabin Hait
1b6c00e2c7 [report] Trial Balance for Party 2015-09-25 09:18:03 +05:30
Anand Doshi
52efde31e7 Merge branch 'develop' 2015-09-24 17:31:12 +05:30
Anand Doshi
f723032fd7 bumped to version 6.3.2 2015-09-24 18:01:11 +06:00
Anand Doshi
3297c43bdf [fix] Tax Rule permission to Account Manager 2015-09-24 17:29:28 +05:30
Anand Doshi
aea250bc5a [fix] [patch] fix missing default lead 2015-09-24 16:31:36 +05:30
Anand Doshi
d37d4dfdec [fix] applicable territory patch and tax rule tests 2015-09-24 15:44:39 +05:30
Anand Doshi
0ea68b33ed Merge branch 'develop' 2015-09-24 15:23:05 +05:30
Anand Doshi
7f96c20f5b bumped to version 6.3.1 2015-09-24 15:53:05 +06:00
Anand Doshi
e75d947867 [fix] [patch] convert applicable territory 2015-09-24 15:22:12 +05:30
Anand Doshi
bba0a5d38f [fix] [patch] tax rule 2015-09-24 15:11:24 +05:30
Anand Doshi
953e97536a [fix] [patch] tax rule 2015-09-24 15:05:06 +05:30
Anand Doshi
e74d7ca33e [fix] [patch] tax rule 2015-09-24 15:04:15 +05:30
Rushabh Mehta
8f2b8afcb7 [fix] gl entry report if not filtered 2015-09-24 15:03:53 +05:30
Anand Doshi
b3f12c3109 [fix] [patch] convert_applicable_territory 2015-09-24 15:01:27 +05:30
Anand Doshi
f66e6aacd4 [fix] [patch] convert_applicable_territory 2015-09-24 14:59:26 +05:30
Anand Doshi
1d621be1f7 Merge branch 'develop' 2015-09-24 14:35:36 +05:30
Anand Doshi
ab57e52cbd bumped to version 6.3.0 2015-09-24 15:05:35 +06:00
Anand Doshi
e63da9813c Merge remote-tracking branch 'frappe/master' into develop
Conflicts:
	erpnext/patches.txt
2015-09-24 14:34:50 +05:30
Anand Doshi
c020e42d20 [fix] [patch] convert applicable territory 2015-09-24 13:08:35 +05:30
Anand Doshi
b126ba0132 [change-log] 2015-09-24 13:06:00 +05:30
Anand Doshi
20ae349ebd Merge pull request #4055 from anandpdoshi/project-sales-order-query
Project's Sales Order - get_query fix
2015-09-24 12:49:54 +05:30
Anand Doshi
c6e4b5978d [fix] Sales Order - get_query fix 2015-09-24 11:32:54 +05:30
Anand Doshi
361eca4cae Merge pull request #4054 from anandpdoshi/sales-team-update-after-submit
Sales Team editable after submit
2015-09-24 11:30:31 +05:30
Anand Doshi
9fc03b6c10 Merge pull request #4052 from rmehta/fix-operation-name
[fix] minor, remove operation naming field from operation
2015-09-24 11:30:07 +05:30
Anand Doshi
e2d46d0474 [fix] Allow Sales Team to be added/updated after submit 2015-09-23 19:26:29 +05:30
Rushabh Mehta
dd2f2f5321 [fix] minor, remove operation naming field from operation 2015-09-23 17:06:01 +05:30
Anand Doshi
6e4f5a214a Merge pull request #4033 from rmehta/portal-fixes
Portal Fixes
2015-09-23 16:05:12 +05:30
Anand Doshi
b07b0a9e54 [fix] Sales Order indicators for Maintenance 2015-09-23 15:52:11 +05:30
Rushabh Mehta
307978fea9 [test-fixes] 2015-09-23 15:43:09 +05:30
Anand Doshi
06ad308ca1 [fixes] setup wizard and other fixes related to cart 2015-09-23 12:50:35 +05:30
Anand Doshi
52dfc32eca [fix] validate_valuation_rate for Repack 2015-09-23 12:50:35 +05:30
Rushabh Mehta
72fbf902d7 [cleanup] added single price list for shopping cart, removed Applicable Territory 2015-09-23 12:50:34 +05:30
Rushabh Mehta
8ffd483e24 [wip] shopping cart shipping rule, price list cleanup 2015-09-23 12:49:16 +05:30
Rushabh Mehta
3d76686b82 [shopping-cart] cart via Jinja WIP 2015-09-23 12:49:16 +05:30
Rushabh Mehta
156ce607e2 [cleanup] [wip] portal, shopping cart cleanup 2015-09-23 12:49:16 +05:30
Anand Doshi
65b6762247 Merge pull request #4049 from bobzz-zone/patch-11
Update item_grid.html
2015-09-23 12:09:26 +05:30
Rushabh Mehta
abdfb4d3db [fixed] New button in POS Sales Invoice, reported via forum 2015-09-23 12:05:51 +05:30
bobzz-zone
3bcb13b1b8 Update item_grid.html
Change the colour of the indicator to be green when delivered qty is bigger than ordered qty
2015-09-23 11:42:06 +07:00
Anand Doshi
b6ec680c46 [fix] round percentages in get_indicator 2015-09-22 16:36:20 +05:30
Anand Doshi
53a0de7607 [fix] Recalculate rate after applying Pricing Rule 2015-09-22 15:26:53 +05:30
Anand Doshi
0a1d037f01 Merge pull request #3974 from rmehta/dms
[enhancement] document management system
2015-09-22 14:51:01 +05:30
Anand Doshi
ce3e15d30c Merge pull request #4042 from anandpdoshi/fix-payment-reconciliation-invoice
[fix] Show payment's invoice number as 'Invoice Type | Invoice Number' for better unsability
2015-09-22 14:21:23 +05:30
Nabin Hait
5b649521d1 [fix] Get outstanding invoices in Payment Reconciliation and Payment Tool 2015-09-22 13:06:34 +05:30
Anand Doshi
798e75832c [fix] Show payment's invoice number as 'Invoice Type | Invoice Number' for better unsability 2015-09-22 12:59:43 +05:30
Anand Doshi
aa95a1b1ef Merge pull request #4047 from nabinhait/payment_reco
[fix] Get outstanding invoices in Payment Reconciliation and Payment Tool
2015-09-22 12:55:27 +05:30
Nabin Hait
c0c94aef44 [fix] Get outstanding invoices in Payment Reconciliation and Payment Tool 2015-09-22 08:37:37 +05:30
Anand Doshi
e4dfeb651f [optimization] get balance on 2015-09-21 19:31:43 +05:30
Anand Doshi
f7e6eb4fd7 [optimization] get balance on 2015-09-21 19:30:21 +05:30
Rushabh Mehta
97c858a5e3 [fix] pull sales team from customer 2015-09-21 10:03:38 +05:30
Rushabh Mehta
974892bf87 Merge pull request #4036 from rmehta/no-party-currency
[fix] no default party currency
2015-09-18 13:40:42 +05:30
Rushabh Mehta
361df8993f [fix] no default party currency 2015-09-18 12:59:51 +05:30
Anand Doshi
b8b8de7a49 [hotfix] multicurrency gl entry 2015-09-17 21:07:45 +05:30
Anand Doshi
be6cfddc4d [hotfix] multicurrency gl entry 2015-09-17 21:07:04 +05:30
Anand Doshi
bf8c8df9ce Revert "[hotfix] set_balance_in_account_currency"
This reverts commit 9acd6a2629.
2015-09-17 20:55:50 +05:30
Anand Doshi
40759c284c Revert "[hotfix] set_balance_in_account_currency"
This reverts commit 9acd6a2629.
2015-09-17 20:51:41 +05:30
Nabin Hait
a48d754158 [fix] minor issue 2015-09-17 20:37:07 +05:30
Anand Doshi
26bcd89d10 [hotfix] journal entry - get balance 2015-09-17 20:36:44 +05:30
Anand Doshi
20fd360a63 [hotfix] journal entry - get balance 2015-09-17 20:36:19 +05:30
Anand Doshi
df8efce36f [hotfix] set_balance_in_account_currency 2015-09-17 20:29:57 +05:30
Anand Doshi
9acd6a2629 [hotfix] set_balance_in_account_currency 2015-09-17 20:29:31 +05:30
Anand Doshi
779ae439cd Merge pull request #4034 from nabinhait/mc5
[fix] minor issue
2015-09-17 20:10:19 +05:30
Nabin Hait
a8ef4c9220 [fix] minor issue 2015-09-17 19:38:11 +05:30
Anand Doshi
ce6b61b41e [fix] customer naming series validation and patch to fix missing default taxes and lead 2015-09-17 19:02:59 +05:30
Anand Doshi
0332f83bc2 [fix] customer naming series validation and patch to fix missing default taxes and lead 2015-09-17 19:01:48 +05:30
Nabin Hait
926ae17e5a Update journal_entry.py 2015-09-17 18:42:55 +05:30
Nabin Hait
8adb5f3e32 Update journal_entry.py 2015-09-17 18:40:35 +05:30
Anand Doshi
5532a14938 [hotfix] create customer contact and address from lead only on create 2015-09-17 18:27:56 +05:30
Anand Doshi
a69682c4e0 [hotfix] create customer contact and address from lead only on create 2015-09-17 18:27:36 +05:30
Anand Doshi
d20120e649 [fix] remove duplicate newsletter subscribers 2015-09-17 17:47:26 +05:30
Anand Doshi
e9b14e497b [fix] remove duplicate newsletter subscribers 2015-09-17 17:46:40 +05:30
Anand Doshi
ba0bf9e13d [hotfix] multicurrency patch 2015-09-17 17:36:20 +05:30
Anand Doshi
cba5a684cb [hotfix] multicurrency patch 2015-09-17 17:36:05 +05:30
Anand Doshi
c439b87ccc [hotfix] multicurrency patch 2015-09-17 17:28:58 +05:30
Anand Doshi
340709b2da [hotfix] multicurrency patch 2015-09-17 17:28:39 +05:30
Nabin Hait
a8de61e24b [fix] Multi currency patch 2015-09-17 17:16:58 +05:30
Anand Doshi
28386f551b Merge pull request #4032 from nabinhait/mc4
[fix] Multi currency patch
2015-09-17 17:16:08 +05:30
Nabin Hait
9ff52cd57e [fix] Multi currency patch 2015-09-17 17:07:26 +05:30
Rushabh Mehta
e3401182c8 Merge pull request #4012 from saurabh6790/cart
Taxation for Shopping Cart based on Tax Rule template
2015-09-17 16:26:35 +05:30
Anand Doshi
7523429ded Merge branch 'develop' 2015-09-17 15:35:09 +05:30
Anand Doshi
0401e418be bumped to version 6.2.0 2015-09-17 16:05:08 +06:00
Anand Doshi
ff6fd7fa9d [change-log] 2015-09-17 15:27:01 +05:30
Anand Doshi
7620393b9b Merge pull request #4031 from anandpdoshi/translations
Translations
2015-09-17 15:13:19 +05:30
Anand Doshi
6489e97726 [translations] 2015-09-17 15:08:09 +05:30
Anand Doshi
8c1a4c0c48 Merge branch 'nabinhait-mc3' into develop 2015-09-17 14:43:58 +05:30
Nabin Hait
77ca80217c [fix] Account Currency and Balance fixed in chart of accounts #4019 2015-09-17 14:43:33 +05:30
Nabin Hait
8247ad4028 [fix] Currency symbol fixed in Accounts receivable/payable report #4020 2015-09-17 14:40:15 +05:30
Anand Doshi
1194c6ef4b [fix] use the new split_emails method to split emails by comma 2015-09-17 14:40:15 +05:30
Anand Doshi
70fed64cd5 Merge pull request #4029 from nabinhait/mc2
[fix] Account Currency and Balance fixed in chart of accounts #4019
2015-09-17 14:37:00 +05:30
Nabin Hait
87c2d1d634 [fix] Dashboard info in accounting currency for Customer and Supplier #4017 2015-09-17 14:16:01 +05:30
Anand Doshi
d4aa27cbb8 Merge pull request #4025 from anandpdoshi/split-emails
use the new split_emails method to split emails by comma. Merge this after Communication CC is merged.
2015-09-17 14:00:03 +05:30
Nabin Hait
59f4fa9a8c [fix] Account Currency and Balance fixed in chart of accounts #4019 2015-09-17 13:57:42 +05:30
Anand Doshi
3b0c0a76b4 Merge pull request #4028 from nabinhait/mc1
[fix] Currency symbol fixed in Accounts receivable/payable report #4020
2015-09-17 13:38:32 +05:30
Nabin Hait
262ac09305 [fix] Currency symbol fixed in Accounts receivable/payable report #4020 2015-09-17 13:24:14 +05:30
Anand Doshi
2a04d98c16 Merge pull request #4023 from saurabh6790/error_report
[Fixes] Check Warehouse for Company Delete and Variant Attribute Value
2015-09-17 13:20:05 +05:30
Anand Doshi
fec9f75707 Merge pull request #4021 from anandpdoshi/payment-tool-ignore-journal-entry
ignore journal entry based invoice in payment tool and payment reconciliation tool
2015-09-17 13:19:06 +05:30
Anand Doshi
12106725fb [fix] set Payment Amount in Payment Tool 2015-09-17 12:59:44 +05:30
Anand Doshi
c5f919eb68 [fix] use the new split_emails method to split emails by comma 2015-09-16 19:20:55 +05:30
Saurabh
5fe0086d9a [Fixes] Warehouse check while company delete & Variant Attribute value check 2015-09-16 16:59:24 +05:30
Anand Doshi
0b031cdd6c [fix] ignore journal entry based invoice in payment tool and payment reconciliation tool 2015-09-16 12:46:54 +05:30
Anand Doshi
c19afa140d [fix] reload time log in update projects patch 2015-09-16 12:44:22 +05:30
Saurabh
0bd145a608 [fixes] test cases and tax rule validation 2015-09-15 17:06:52 +05:30
Saurabh
c663f5c2bd [Test] test state based taxasion 2015-09-15 15:41:01 +05:30
Saurabh
adde1cff48 [Enhancement] add state ccriteria in tax rule 2015-09-15 15:41:01 +05:30
Saurabh
bb9427d1ef [Fixes] deprecated 2015-09-15 15:41:01 +05:30
Saurabh
052babc6b6 [Fixes] [Minor] removed console statement 2015-09-15 15:41:01 +05:30
Saurabh
24fa06bc53 [Fixes] rebase conflict fixes 2015-09-15 15:41:01 +05:30
Saurabh
7c867ae9ad [Fixes] Tax Rule preparation and test taxes creation, remove dummy quotation 2015-09-15 15:41:01 +05:30
Saurabh
8f7317175d [enhancement] bring taxes from tax rules and test cases 2015-09-15 15:41:01 +05:30
Saurabh
957e7a37be [Shopping Cart][Fixes] tax calculation based on tax rule 2015-09-15 15:41:01 +05:30
Saurabh
def71d4d5d [Shopping Cart][Fixes] tax calculation based on tax rule 2015-09-15 15:41:00 +05:30
Neil Trini Lasrado
ef511b160e Added Tax Rule under ERPNext > Accounts > Setup 2015-09-15 15:41:00 +05:30
Neil Trini Lasrado
09f9c96c53 Fixes in Tax Rule 2015-09-15 15:41:00 +05:30
Neil Trini Lasrado
1a2d121073 Removed default taxes and charges from customer and supplier master. Added patch to create tax rules against customer/supplier 2015-09-15 15:41:00 +05:30
Neil Trini Lasrado
810bd35609 Apply Tax Rule based on Customer Selection in Sales / Purchase Transactions 2015-09-15 15:41:00 +05:30
Neil Trini Lasrado
949d7dbaba Added validations, test-cases to Tax Rule 2015-09-15 15:41:00 +05:30
Neil Trini Lasrado
72e6aa160c Added New Doctype Tax Rule 2015-09-15 15:41:00 +05:30
Anand Doshi
0870b185de Merge pull request #4015 from anandpdoshi/use-add-fetch
Use add_fetch in Product Bundle, Maintenance Visit and Maintenance Schedule instead of redundant get_item_details method
2015-09-15 14:02:06 +05:30
Anand Doshi
69f2cc8d24 [fix] don't fetch template item in get items of stock reconciliation 2015-09-15 11:54:13 +05:30
Anand Doshi
86102064a5 [fix] Use add_fetch in Product Bundle, Maintenance Visit and Maintenance Schedule instead of redundant get_item_details method 2015-09-15 11:50:30 +05:30
Anand Doshi
0fd3347148 [fix] handle invalid date in get_retirement_date 2015-09-15 11:29:51 +05:30
Anand Doshi
b74265c842 [minor] [patch] reload activity cost in default_activity_rate 2015-09-15 11:27:19 +05:30
Anand Doshi
1fef2fad2d [minor] fixes in queries and payment tool 2015-09-14 18:27:21 +05:30
Anand Doshi
9345240ff1 Merge pull request #4007 from anandpdoshi/setup-wizard-duplicate-entry
catch DuplicateEntryError in install_fixtures step of Setup Wizard
2015-09-14 16:33:16 +05:30
Anand Doshi
9ab23231e6 Merge pull request #4011 from anandpdoshi/defaults-during-creation
[fix] Use User Permission value as default only if the document type is Setup. Merge with frappe/frappe#1304
2015-09-14 16:33:00 +05:30
Anand Doshi
dbe623b167 [fix] Use User Permission value as default only if the document type is Setup 2015-09-14 13:08:53 +05:30
Anand Doshi
71e51c179c [fix] changed modified for multi-currency sync 2015-09-11 16:55:11 +05:30
Anand Doshi
4b8dbbdf98 [minor] Change modified of Sales Invoice.json 2015-09-11 16:39:03 +05:30
Anand Doshi
aaf1895a12 Merge branch 'nabinhait-multi-currency' into develop
Conflicts:
	erpnext/accounts/doctype/journal_entry/journal_entry.json
2015-09-11 16:35:17 +05:30
Anand Doshi
979326b0b1 minor fixes in multi-currency 2015-09-11 16:33:45 +05:30
Anand Doshi
5d9cfc76cd Don't copy title field in Duplicate 2015-09-11 15:35:26 +05:30
Nabin Hait
8db7bd2d8f [fix] Igonre permissions while saving Company and Warehouse from Accounts Settings 2015-09-11 15:34:42 +05:30
Rushabh Mehta
d461d462aa [minor] rename notified_modifed > notified_update. Merge with #1296 2015-09-11 15:34:41 +05:30
Anand Doshi
e67fa424b2 [fix] catch DuplicateEntryError in install_fixtures step of Setup Wizard 2015-09-11 15:32:06 +05:30
Anand Doshi
121176f0e9 Merge pull request #4002 from rmehta/notify-update-rename
[minor] rename notified_modifed > notified_update. Merge with #1296
2015-09-11 15:11:57 +05:30
Anand Doshi
1c2636e7b3 Merge pull request #4003 from nabinhait/fix8
[fix] Igonre permissions while saving Company and Warehouse from Accounts Settings
2015-09-11 15:00:13 +05:30
Anand Doshi
840cad0ff7 Don't copy title field in Duplicate 2015-09-11 12:26:57 +05:30
Nabin Hait
f76d63b92a Merge branch 'develop' of https://github.com/frappe/erpnext into multi-currency
[fix][patch] delete item variant attributes if no variants exists against that item
2015-09-10 19:26:02 +05:30
Nabin Hait
71ef6675ce [fix] Journal Entry client side minor fixes 2015-09-10 19:25:50 +05:30
Anand Doshi
793b87948c [fix] [patch] item template attributes 2015-09-10 18:10:15 +05:30
Anand Doshi
a1b0ff09a8 Merge pull request #4004 from nabinhait/fix9
[fix] Bypass Root Not Editable validation from Setup Wizard
2015-09-10 15:56:45 +05:30
Nabin Hait
5a803d76ad [fix] Bypass Root Not Editable validation from Setup Wizard 2015-09-10 13:20:35 +05:30
Nabin Hait
9513025130 [fix] Igonre permissions while saving Company and Warehouse from Accounts Settings 2015-09-10 12:13:27 +05:30
Rushabh Mehta
a13c60bf9f [minor] fix title in readme 2015-09-10 10:43:43 +05:30
Rushabh Mehta
bc23e5ac5c [minor] rename notified_modifed > notified_update. Merge with #1296 2015-09-10 10:30:41 +05:30
Nabin Hait
2377cdfa4e Fixed conflict 2015-09-09 18:45:41 +05:30
Nabin Hait
e3ae05aabd Multi-currency: Exchange Rate in Journal Entry 2015-09-09 18:43:12 +05:30
Anand Doshi
a2fda1c779 Merge branch 'develop' 2015-09-09 18:42:49 +05:30
Anand Doshi
a29577ca71 bumped to version 6.1.1 2015-09-09 19:12:48 +06:00
Anand Doshi
b1454cdf9f [fix] fix planned qty 2015-09-09 18:00:09 +05:30
Anand Doshi
f668a4d03c Merge branch 'develop' 2015-09-09 15:32:03 +05:30
Anand Doshi
c2b4ae6667 bumped to version 6.1.0 2015-09-09 16:02:03 +06:00
Anand Doshi
1857bb8b0b [change-log] 2015-09-09 15:23:16 +05:30
Anand Doshi
888a70c2d4 [fix] Setup Wizard - the case of forgetting mute emails 2015-09-09 15:14:54 +05:30
Anand Doshi
9d5b84e78a Merge pull request #3996 from nabinhait/fix6
Check credit limit in Delivery Note / Sales Invoice, only if not created against Sales Order
2015-09-09 15:11:12 +05:30
Anand Doshi
bdc125ad0f Merge pull request #3999 from nabinhait/planned_qty
Planned Qty logic fixed and reposted for existing
2015-09-09 13:14:09 +05:30
Nabin Hait
f0b3014a23 Planned Qty logic fixed and reposted for existing 2015-09-09 11:04:10 +05:30
Nabin Hait
0b17a91aba Merge pull request #3998 from nabinhait/fix7
[fix] Gross Profit report should not include return entries
2015-09-09 10:37:30 +05:30
Nabin Hait
83dd3e14e5 [fix] Gross Profit report should not include return entries 2015-09-09 10:37:04 +05:30
Anand Doshi
38f64ea3ab Merge pull request #3991 from anandpdoshi/apply-user-permissions-fix
[minor] Unset Apply User Permissions in default permissions
2015-09-08 22:09:44 +05:30
Nabin Hait
cd103c05d6 Check credit limit in Delivery Note / Sales Invoice, only if not created against Sales Order 2015-09-08 19:24:35 +05:30
Anand Doshi
bc1e8b4408 [minor] Unset Apply User Permissions in default permissions 2015-09-08 19:23:23 +05:30
Nabin Hait
6c3ff3e2ed Fixed conflict 2015-09-08 18:09:03 +05:30
Anand Doshi
4fb7f881c8 Merge branch 'nabinhait-fix4' into develop 2015-09-08 16:37:52 +05:30
Nabin Hait
83a358afc1 Fix invoice outstanding where party missing
Conflicts:
	erpnext/accounts/doctype/gl_entry/gl_entry.py
	erpnext/patches.txt
2015-09-08 16:37:26 +05:30
Nabin Hait
96bb070781 Payment against invoices where party not specified
Conflicts:
	erpnext/accounts/doctype/gl_entry/gl_entry.py
2015-09-08 16:36:44 +05:30
Nabin Hait
d387dd3bc6 [fix] Project: round percent_complete to 2 decimals 2015-09-08 16:15:00 +05:30
Anand Doshi
9f25575e0c Merge pull request #3988 from nabinhait/fix2
Set expense account in stock reco only if company available
2015-09-08 15:59:18 +05:30
Anand Doshi
e1af7f1a0f [minor] default mins_between_operations = 10 2015-09-08 15:55:09 +05:30
Anand Doshi
c35df5ce80 Merge branch 'rmehta-stock-settings' into develop
Conflicts:
	erpnext/patches.txt
2015-09-08 15:54:17 +05:30
Anand Doshi
2c2868db11 [translations] 2015-09-08 15:53:54 +05:30
Anand Doshi
17f28c13ed [fix] Customer match condition in autosuggest 2015-09-08 15:53:54 +05:30
Anand Doshi
3f1f2dd307 [fix] setup wizard - industry type 2015-09-08 15:53:53 +05:30
Anand Doshi
ab05dcd9f9 [fix] [patch] reload item attribute + value 2015-09-08 15:53:53 +05:30
Rushabh Mehta
f21edba97f [fixes] to task test case and fix tree ui for mobile 2015-09-08 15:53:53 +05:30
Rushabh Mehta
91b0e2348c [minor] task not mandatory for Time Log and Expense Claim #3904 2015-09-08 15:53:53 +05:30
Nabin Hait
4de91887db [patch] Re-run the 'default_title' patch 2015-09-08 15:53:35 +05:30
Anand Doshi
9b1288605f bumped to version 6.0.1 2015-09-08 15:53:05 +05:30
Anand Doshi
43888546f6 Merge pull request #3968 from rmehta/task-not-mandatory
[minor] task not mandatory for Time Log and Expense Claim #3904
2015-09-08 15:47:11 +05:30
Anand Doshi
68d2e317d2 Merge pull request #3992 from anandpdoshi/translations
[translations]
2015-09-08 15:45:08 +05:30
Nabin Hait
2249eea59f Fixed conflict 2015-09-08 12:55:21 +05:30
Nabin Hait
d608363d7b [fix] Map amount in advance payment entry agaionst SO/PO based on party account currency 2015-09-08 12:53:59 +05:30
Nabin Hait
b2739cbb79 Get average exchange rate in case of bank transfer 2015-09-08 12:18:45 +05:30
Anand Doshi
f5940907ae [translations] 2015-09-07 18:47:04 +05:30
Anand Doshi
90162078d5 Merge pull request #3989 from anandpdoshi/customer-query-match-condition
Customer match condition in autosuggest
2015-09-07 14:52:49 +05:30
Anand Doshi
cba99743a4 [fix] Customer match condition in autosuggest 2015-09-07 14:51:30 +05:30
Nabin Hait
f44128f81c Set expense account in stock reco only if company available 2015-09-07 10:45:15 +05:30
Nabin Hait
3607737b5e Merge branch 'develop' of https://github.com/frappe/erpnext into multi-currency 2015-09-07 10:41:01 +05:30
Nabin Hait
bf9691ed39 Multiple fixes 2015-09-07 10:40:48 +05:30
Anand Doshi
bbca95fd1b [fix] setup wizard - industry type 2015-09-07 10:11:46 +05:30
Anand Doshi
4df98d52c1 [fix] setup wizard - industry type 2015-09-07 10:11:23 +05:30
Anand Doshi
28f8664b93 [fix] [patch] reload item attribute + value 2015-09-04 16:41:27 +05:30
Nabin Hait
216aaaf1d6 Set currency and exchange rate based on Customer's currency while making Quotation from Opportunity 2015-09-04 16:41:04 +05:30
Rushabh Mehta
be9edae961 [fixes] to task test case and fix tree ui for mobile 2015-09-04 16:18:17 +05:30
Rushabh Mehta
4223d7c044 [minor] task not mandatory for Time Log and Expense Claim #3904 2015-09-04 16:18:17 +05:30
Nabin Hait
3a53d49b7e [fix] Set account and party balance in Journal Entry 2015-09-04 15:46:47 +05:30
Nabin Hait
4d62d7867e [report] Bank Reconciliation Statement in account currency 2015-09-04 13:26:45 +05:30
Nabin Hait
c0e3b1a0c7 Removed account and party balance in company currency from Journal Entry 2015-09-04 13:26:23 +05:30
Nabin Hait
34fe81f7eb Patch fixed 2015-09-03 19:18:00 +05:30
Nabin Hait
11a746d363 Fixed conflict 2015-09-03 16:04:11 +05:30
Nabin Hait
1609933748 Test cases for multi currency 2015-09-03 16:03:07 +05:30
Anand Doshi
5f90f7096d Merge pull request #3976 from nabinhait/fixes1
[patch] Re-run the 'default_title' patch
2015-09-03 11:15:53 +05:30
Nabin Hait
59c4ae5a46 [patch] Re-run the 'default_title' patch 2015-09-03 10:46:48 +05:30
Rushabh Mehta
85abdc4fad [minor] added stock settings for serial no. #3967. Merge with https://github.com/frappe/frappe/pull/1291 2015-09-03 10:29:38 +05:30
Nabin Hait
98096771c2 [multi currency] Introduced Accounting Currency in Customer and Supplier, and validation according to that 2015-09-03 10:28:08 +05:30
Anand Doshi
ba51ebd1b7 Merge branch 'develop' 2015-09-02 18:58:14 +05:30
Anand Doshi
be090fa512 bumped to version 6.0.1 2015-09-02 19:28:14 +06:00
Rushabh Mehta
c2283ca304 [hot] [fix] remove test options in Opportunity 2015-09-02 18:56:35 +05:30
Rushabh Mehta
deb38f7a68 [enhancement] document management system 2015-09-02 18:34:24 +05:30
Anand Doshi
283850ce47 Merge pull request #3971 from anandpdoshi/fix-item-variant-attributes
Attributes in the variant should be in the same order as in the Template
2015-09-02 16:09:09 +05:30
Anand Doshi
caa839003b Merge branch 'develop' 2015-09-02 16:02:45 +05:30
Anand Doshi
a6130dc918 bumped to version 6.0.0 2015-09-02 16:32:45 +06:00
Anand Doshi
099bbbded0 Attributes in the variant should be in the same order as in the Template
- Moved Item Variant code from item.py to controllers/item_variant.py
- Use Template Item's order of Attribute for Variant Item
2015-09-02 15:56:55 +05:30
Anand Doshi
c3796d273c [change-log] 2015-09-02 15:54:53 +05:30
Anand Doshi
28700d6404 Merge pull request #3973 from nabinhait/fix14
[Fix] Delete Company Transactions
2015-09-02 14:59:44 +05:30
Anand Doshi
38f400ea87 Merge pull request #3972 from nabinhait/fix
Item Price Fix
2015-09-02 14:57:26 +05:30
Anand Doshi
f5793fff3c Merge pull request #3966 from rmehta/calendar-for-sales-order
[enhancement] calendar for sales order and other related fixes  #3542
2015-09-02 14:52:21 +05:30
Nabin Hait
e1d2bef389 [fix] Dont delete Employee while deleting company transactions 2015-09-02 14:07:46 +05:30
Nabin Hait
0ca3e3d89e [fix] Clear notification count while deleting company transactions 2015-09-02 13:09:48 +05:30
Nabin Hait
a1fa659475 [fix] Delete Time Logs while deleting company transactions 2015-09-02 12:56:29 +05:30
Nabin Hait
906bf64f04 [fix] Insert Item Price automatically based on Rate in Stock UOM 2015-09-02 11:32:14 +05:30
Nabin Hait
e52ee553c0 Removed debug flag 2015-09-02 11:32:14 +05:30
Anand Doshi
409c1e494b Updated CONTRIBUTING.md 2015-09-02 10:55:45 +05:30
Rushabh Mehta
19e560e73f [fix] dropbox backup check not working 2015-09-01 09:57:25 +05:30
Nabin Hait
bac9b8eef6 Payment Tool changes due to multi currency 2015-08-31 19:01:11 +05:30
Nabin Hait
76bb927337 Fixed conflict 2015-08-31 17:28:05 +05:30
Nabin Hait
699751c531 [report] Accounts Receivable / Payable in multi currency 2015-08-31 17:02:04 +05:30
Nabin Hait
06b15bfd63 [report] General Ledger in multi currency 2015-08-31 15:39:03 +05:30
Rushabh Mehta
8f1391dc96 [enhancement] calendar for sales order and other related fixes #3542 2015-08-31 12:42:45 +05:30
Anand Doshi
0161b40aa9 Merge pull request #3965 from nabinhait/gross_profit
[fix] Fixed gross profit report due to removal of designation field from Sales Team table
2015-08-31 12:26:11 +05:30
Nabin Hait
1901ca5a45 [fix] Fixed gross profit report due to removal of designation field from Sales Team table 2015-08-31 12:02:50 +05:30
Nabin Hait
c68f68d6cc [fix] Patch fixed for account_currency field rename 2015-08-28 19:26:28 +05:30
Nabin Hait
6e439a5e53 Multi currency: test case and fixes 2015-08-28 19:24:22 +05:30
Anand Doshi
610ad47676 [hotfix] reload Delivery Note, Sales Invoice and Purchase Receipt in return entry patch 2015-08-28 11:40:14 +05:30
Anand Doshi
42701b2160 Merge branch 'nabinhait-notifications' into develop
Conflicts:
	erpnext/selling/doctype/sales_order/sales_order.py
2015-08-27 17:05:32 +05:30
Anand Doshi
3d9d2d1dd1 Exported all doctypes 2015-08-27 17:04:39 +05:30
Anand Doshi
3ea7ce84ed [fix] print hide additional discount, reload doctypes in sales return patch 2015-08-27 17:04:39 +05:30
Anand Doshi
002049eb85 [minor] show Inventory section for new Item if Maintain Stock is checked 2015-08-27 17:04:06 +05:30
Anand Doshi
57a51351d3 [fix] Changed more section label to 'More Information' 2015-08-27 17:04:06 +05:30
Anand Doshi
77a2107973 [minor] In Sales Order, changed label from PO No. to Customer's Purchase Order 2015-08-27 17:04:05 +05:30
Rushabh Mehta
c5346c99de [enhancement] allow user to set warning for multiple items and sales order against multiple purchase orders #3699 2015-08-27 17:03:37 +05:30
Anand Doshi
8b66f2a691 Exported all doctypes 2015-08-27 16:45:52 +05:30
Nabin Hait
78be566428 minor fix 2015-08-27 16:27:44 +05:30
Nabin Hait
f6f38f2f2d [new fields] Exchange Rate in Journal Entry and some properties changes in Journal Entry Account 2015-08-27 16:27:33 +05:30
Nabin Hait
9a9a4293b3 [new fields] Party Account Currency, Paid Amount and Write Off Amount in Acompany Currency 2015-08-27 16:26:38 +05:30
Anand Doshi
f370b0c6a4 [fix] print hide additional discount, reload doctypes in sales return patch 2015-08-27 16:03:29 +05:30
Nabin Hait
09c68c9ad0 Merge branch 'develop' of https://github.com/frappe/erpnext into multi-currency 2015-08-27 14:55:55 +05:30
Nabin Hait
13d8835b75 Fixed merge conflict 2015-08-27 14:55:34 +05:30
Anand Doshi
b8610e1079 [fix] removed update_stock_ledger from delivery note 2015-08-27 14:46:47 +05:30
Anand Doshi
41e948b00a [hotfix] update reserved quantity in delivery note 2015-08-27 14:42:25 +05:30
Nabin Hait
2091f0c97e Checked out json files from upstream 2015-08-27 14:35:17 +05:30
Anand Doshi
c6802ca6d0 [minor] show Inventory section for new Item if Maintain Stock is checked 2015-08-27 13:21:43 +05:30
Anand Doshi
282e4947fa [fix] Changed more section label to 'More Information' 2015-08-27 13:11:46 +05:30
Nabin Hait
54fe26dcfb [patch] Multi currency 2015-08-27 12:55:24 +05:30
Nabin Hait
4ffd7f3d05 Outstanding, paid and write-off amount in Invoice 2015-08-27 12:28:36 +05:30
Nabin Hait
a12d959729 GL Entries for Sales/Purchase Invoice in multi currency 2015-08-27 12:27:24 +05:30
Anand Doshi
b99c180466 Merge branch 'rmehta-validation-settings' into develop 2015-08-27 12:22:06 +05:30
Anand Doshi
6cf193d432 [minor] In Sales Order, changed label from PO No. to Customer's Purchase Order 2015-08-27 12:21:17 +05:30
Nabin Hait
35a5c87cbf [fix] Clear notifications for Sales / Purchase Order on stop/unstop 2015-08-27 12:06:11 +05:30
Rushabh Mehta
740db53b86 [fix] returned_qty reapply and change-log 2015-08-27 12:00:16 +05:30
Anand Doshi
69b6195d3b Merge branch 'validation-settings' of https://github.com/rmehta/erpnext into rmehta-validation-settings
Conflicts:
	erpnext/stock/doctype/delivery_note/delivery_note.py
2015-08-27 11:39:20 +05:30
Rushabh Mehta
cd2d8a0410 [merge] re-applied changes to sales invoice & delivery note 2015-08-27 11:05:26 +05:30
Rushabh Mehta
5bec301929 Merge branch 'layout-cleanup' into develop
Conflicts:
	erpnext/accounts/doctype/sales_invoice/sales_invoice.json
	erpnext/stock/doctype/delivery_note/delivery_note.json
2015-08-27 11:01:39 +05:30
Rushabh Mehta
491df14426 [minor] catch invalid item code in pricing list (via support ticket) 2015-08-27 10:31:28 +05:30
Rushabh Mehta
00eba4d7f6 [minor] show price list in sales order (via support ticket) 2015-08-27 10:25:07 +05:30
Rushabh Mehta
17679c6902 [layout cleanup] purchase, stock, journal entry 2015-08-26 22:20:38 +05:30
Anand Doshi
fa65c7bf29 [minor] stopped or cancelled message 2015-08-26 19:15:24 +05:30
Rushabh Mehta
f7800c053b [layout cleanup] in Quotation, Sales Order, Delivery Note 2015-08-26 18:53:37 +05:30
Anand Doshi
10fc83d369 Merge branch 'develop' 2015-08-26 17:57:24 +05:30
Anand Doshi
eed8906a1e bumped to version 5.8.2 2015-08-26 18:27:24 +06:00
Anand Doshi
414248b792 [fix] event creation on Contact Date 2015-08-26 17:56:55 +05:30
Anand Doshi
e91b3ea407 Merge branch 'develop' 2015-08-26 17:43:27 +05:30
Anand Doshi
28d53be50c bumped to version 5.8.1 2015-08-26 18:13:26 +06:00
Anand Doshi
cb2f9a863d [hotfix] reload Sales and Purchase Order Item 2015-08-26 17:42:40 +05:30
Anand Doshi
2b6bdc1edb [fix] filter and validation of Debit To and Credit To accounts 2015-08-26 17:42:40 +05:30
Anand Doshi
f326c63588 Merge branch 'develop' 2015-08-26 16:55:08 +05:30
Anand Doshi
8ca72d8883 bumped to version 5.8.0 2015-08-26 17:25:08 +06:00
Anand Doshi
ab9f03d557 Merge pull request #3952 from neilLasrado/variant-duplication
Fixed validation to prevent duplication of Item Variants in case of Numeric Attributes
2015-08-26 16:52:25 +05:30
Anand Doshi
7fa8fb984e [fix] Show write off account 2015-08-26 16:48:41 +05:30
Anand Doshi
f29628072f [change-log] 2015-08-26 14:50:05 +05:30
Anand Doshi
cb3a4caa44 [fix] removed validate due date in Journal Entry 2015-08-26 14:50:04 +05:30
Neil Trini Lasrado
755f1f6841 Fixed validation to prevent duplication of Item Variants in case of Numeric Attributes 2015-08-26 12:59:29 +05:30
Anand Doshi
80a784fdc5 Merge pull request #3943 from nabinhait/fix4
[fix] Print Delivery Note without amount
2015-08-26 12:29:24 +05:30
Rushabh Mehta
678a4e24ff [cleanup] Opportunity 2015-08-26 12:27:25 +05:30
Rushabh Mehta
b8a6f40370 [cleanup] layouts of item, customer, supplier, lead 2015-08-26 10:51:45 +05:30
Rushabh Mehta
f24f6044bd [layout] cleaned up Sales Invoice 2015-08-26 10:51:44 +05:30
Rushabh Mehta
b6398be232 [minor] [fix] project query 2015-08-26 10:51:04 +05:30
Anand Doshi
007e2d0015 Merge branch 'nabinhait-return_improvements' into develop 2015-08-25 19:11:29 +05:30
Anand Doshi
fe13bfed44 Fixes to Return Improvements pull request
- Added "Returned Qty" in Sales and Purchase Order
- Map Expense Account in Return Delivery Note
- Defined some No Copy fields
- Added "Credit Note" and "Debit Note" Print Headings
- Fixed patch
2015-08-25 19:07:04 +05:30
Rushabh Mehta
3c107cdbf8 [enhancement] allow user to set warning for multiple items and sales order against multiple purchase orders #3699 2015-08-25 14:26:42 +05:30
Nabin Hait
b719c469c8 Allow different rate in Return Entry 2015-08-25 14:11:13 +05:30
Nabin Hait
3f321ebfde utilities/repost_stock file renamed to stock/stock_balance 2015-08-25 14:11:13 +05:30
Nabin Hait
047ecd1eb9 Update order reference in return entries and repost reserved / ordered qty 2015-08-25 14:11:13 +05:30
Nabin Hait
1f94fa25a8 Update delivered / ordered qty in sales/purchase order from return entry
Reserved Qty logic cleaned up
2015-08-25 14:11:12 +05:30
Rushabh Mehta
ddd79f43d2 [fix] [hot] erpnext contact page 2015-08-25 14:03:43 +05:30
Nabin Hait
a7c013c030 [fix] Print Delivery Note without amount 2015-08-24 18:43:19 +05:30
Anand Doshi
f7cfaf58b5 Merge pull request #3927 from neilLasrado/default-warehouse
Fetch default  WIP Warehouse and FG Warehouse on load of Production Order
2015-08-24 18:17:30 +05:30
Anand Doshi
82366e4b3f Merge pull request #3941 from nabinhait/fix2
[fix] Stock Entry additional costs patch fix for v4 accounts
2015-08-24 17:49:47 +05:30
Anand Doshi
b0d4162ca6 Merge pull request #3942 from nabinhait/fix3
[fix] In general ledger report, consider cost center in group by voucher
2015-08-24 17:42:51 +05:30
Anand Doshi
b968772e97 Merge pull request #3939 from neilLasrado/variant
Fixes in Item Variants
2015-08-24 17:42:23 +05:30
Nabin Hait
3a990d946d [fix] In general ledger report, consider cost center in group by voucher 2015-08-24 17:21:01 +05:30
Neil Trini Lasrado
db189d7f19 Fixed test case for Item Variants 2015-08-24 16:59:24 +05:30
Nabin Hait
b69eb84936 [fix] Stock Entry additional costs patch fix for v4 accounts 2015-08-24 16:55:10 +05:30
Anand Doshi
00c5875ff7 Merge branch 'develop' 2015-08-24 16:53:51 +05:30
Anand Doshi
5c9bd5e650 bumped to version 5.7.7 2015-08-24 17:23:51 +06:00
Neil Trini Lasrado
92a3dbb5d3 Fixes in Default Warehouse 2015-08-24 15:52:56 +05:30
Neil Trini Lasrado
75d90b1c00 Fixed Produciton Planning Tool 2015-08-24 15:23:58 +05:30
Neil Trini Lasrado
72e4cdcb25 Added default WIP Warehouse and FG Warehouse to Manufacturing Settings
Fetch default  WIP Warehouse and FG Warehouse on load of Production Order
2015-08-24 15:23:58 +05:30
Neil Trini Lasrado
4c614bd59a Fixed validation for numeric variants to check with values from template instead of master 2015-08-24 15:13:01 +05:30
Neil Trini Lasrado
7a6f048928 Fixed issue while creating item variants with decimal values (precision error) 2015-08-24 15:13:01 +05:30
Anand Doshi
96773bdc0e Merge pull request #3926 from neilLasrado/prod-order
Production Order - Validation Added
2015-08-24 14:44:44 +05:30
Anand Doshi
d092fd918a Merge pull request #3937 from rmehta/purchase-order-fix
[hot] make_stock_entry button in purchase order
2015-08-24 14:41:40 +05:30
Anand Doshi
50e2e1d9af Merge pull request #3936 from rmehta/customer-report-fix
[fix] Customer Address and Contact report
2015-08-24 14:35:42 +05:30
Rushabh Mehta
da24698cf7 [minor] in ap, ar renamed label for date as 'as on date' as it was confusing 2015-08-24 14:31:07 +05:30
Rushabh Mehta
d999dd1bb9 [minor] fix setup wizard buying_items query 2015-08-24 14:23:55 +05:30
Rushabh Mehta
c8a5a2cc4a [hot] make_stock_entry button in purchase order 2015-08-24 13:12:45 +05:30
Rushabh Mehta
12fb0d998f [fix] Customer Address and Contact report 2015-08-24 12:21:04 +05:30
Neil Trini Lasrado
17231e39cc Added validation in Production Order. Operations Time made mandatory 2015-08-21 16:52:04 +05:30
Anand Doshi
4451db2db4 Merge branch 'develop' 2015-08-21 14:57:19 +05:30
Anand Doshi
d7a6c11a92 bumped to version 5.7.6 2015-08-21 15:27:19 +06:00
Anand Doshi
bcb386fb64 Merge pull request #3922 from nabinhait/fraction_gle
Divisonal loss adjustment in purchase receipt
2015-08-21 14:55:44 +05:30
Anand Doshi
3709668464 Merge pull request #3925 from nabinhait/uom_replace
[fix]Stock UOM Replace Utility: Multiply Qty after Transaction by conversion factor as well, as there is no qty mentioned for stock reconciliation
2015-08-21 14:47:27 +05:30
Nabin Hait
7c2901fb56 [fix]Stock UOM Replace Utility: Multiply Qty after Transaction by conversion factor as well, as there is no qty mentioned for stock reconciliation 2015-08-21 14:45:59 +05:30
Anand Doshi
b5d9ab24ec Merge pull request #3921 from nabinhait/uom_replace
[fix]Stock UOM Replace Utility: Multiply Qty after Transaction by conversion factor as well, as there is no qty mentioned for stock reconciliation
2015-08-21 14:39:25 +05:30
Nabin Hait
895029dc15 Validate currency in transactions 2015-08-21 14:31:47 +05:30
Nabin Hait
c561a499d7 Multi currency GL entry fixes 2015-08-21 14:31:47 +05:30
Nabin Hait
69c1401764 Multi currency patch initialized 2015-08-21 14:31:47 +05:30
Nabin Hait
50ba6faaf6 Currency input from Chart of Accounts page 2015-08-21 14:31:47 +05:30
Nabin Hait
46bcbaf97b GL Entry in account currency 2015-08-21 14:31:47 +05:30
Nabin Hait
0e46a9b86e Journal Entry: client side triggers 2015-08-21 14:31:46 +05:30
Nabin Hait
e459cb4d09 Journal Entry: validate and post gle in multi currency 2015-08-21 14:31:46 +05:30
Nabin Hait
7dbd395781 Toggle alternative currency fields 2015-08-21 14:31:46 +05:30
Nabin Hait
6aea1c0da5 Currency validation in gl entry 2015-08-21 14:31:46 +05:30
Rushabh Mehta
aeab6c559c [enhancement] multi-currency, added fields #1002 2015-08-21 14:31:46 +05:30
Nabin Hait
597a402dff Divisonal loss adjustment in purchase receipt 2015-08-21 14:13:55 +05:30
Nabin Hait
1b6fd1ba5b [fix]Stock UOM Replace Utility: Multiply Qty after Transaction by conversion factor as well, as there is no qty mentioned for stock reconciliation 2015-08-21 13:05:19 +05:30
Anand Doshi
ac35b8af55 Merge pull request #3912 from nabinhait/jv1
[fix] payment amt against invoice outstanding
2015-08-21 13:01:53 +05:30
Anand Doshi
9b02aa722c Merge pull request #3920 from nabinhait/advances
[fix] Fetch advances in Sales/Purchase Invoice
2015-08-21 13:01:39 +05:30
Anand Doshi
32f3426007 Merge pull request #3919 from nabinhait/conv_factor
[fix] UOM Conversion factor mandatory in stock entry
2015-08-21 12:59:19 +05:30
Nabin Hait
046db626a2 [fix] Fetch advances in Sales/Purchase Invoice 2015-08-21 12:34:41 +05:30
Nabin Hait
d7ed197131 [fix] UOM Conversion factor mandatory in stock entry 2015-08-21 12:00:32 +05:30
Anand Doshi
f37884472d Merge branch 'develop' 2015-08-20 18:47:19 +05:30
Anand Doshi
e9cebd4de3 bumped to version 5.7.5 2015-08-20 19:17:19 +06:00
Anand Doshi
db1a9edbdf [minor] removed test case of template cannot have stock 2015-08-20 18:20:06 +05:30
Anand Doshi
5c85740aab [minor] don't validate stock for template item 2015-08-20 17:43:35 +05:30
Anand Doshi
8554cbf001 [minor] fixed patch item template attributes 2015-08-20 17:43:35 +05:30
Anand Doshi
0e90e8e8dc Merge branch 'develop' 2015-08-20 15:45:07 +05:30
Anand Doshi
30d3eb3d4b bumped to version 5.7.4 2015-08-20 16:15:07 +06:00
Anand Doshi
cf7adb5c02 [patch] re-run repost_reserved_qty 2015-08-20 15:42:58 +05:30
Anand Doshi
a5dce0adea Merge branch 'develop' 2015-08-20 15:42:23 +05:30
Anand Doshi
ac9a94f421 bumped to version 5.7.3 2015-08-20 16:12:23 +06:00
Anand Doshi
62cae01542 Merge branch 'develop' 2015-08-20 15:34:47 +05:30
Anand Doshi
4488764cd0 bumped to version 5.7.2 2015-08-20 16:04:47 +06:00
Anand Doshi
f6abfbffbc Merge pull request #3914 from nabinhait/patchfix
[fix][patch] Repost reserved qty for stock item
2015-08-20 15:33:49 +05:30
Nabin Hait
24998a6ca7 [fix][patch] Delete Bin for non-stock item 2015-08-20 15:21:42 +05:30
Nabin Hait
712fccd876 [fix][patch] Repost reserved qty for stock item 2015-08-20 14:59:44 +05:30
Anand Doshi
35cd427463 Merge branch 'develop' 2015-08-20 11:57:31 +05:30
Anand Doshi
7299026729 bumped to version 5.7.1 2015-08-20 12:27:31 +06:00
Anand Doshi
98c3aec274 [minor] hide Attribute Value using script so that it is visible in data import 2015-08-20 11:56:31 +05:30
Anand Doshi
807c6af571 [minor] fix item template attributes 2015-08-20 11:42:05 +05:30
Nabin Hait
efc89f4395 [fix] payment amt against invoice outstanding 2015-08-20 11:30:44 +05:30
Anand Doshi
f3eeb601ad Merge pull request #3908 from rmehta/text-editor
[fix] changed text > text editor for description fields in tables
2015-08-19 16:48:06 +05:30
Anand Doshi
701b994671 Merge branch 'develop' 2015-08-19 14:34:30 +05:30
Anand Doshi
139283fbf7 bumped to version 5.7.0 2015-08-19 15:04:30 +06:00
Anand Doshi
89cac6c8a6 Merge pull request #3909 from nabinhait/testcase1
Testcase and Patch Fix
2015-08-19 14:33:50 +05:30
Nabin Hait
3922823bd6 [fix] Test case fixed for purchase cost against project 2015-08-19 14:23:13 +05:30
Nabin Hait
6ce72c5b07 [fix] Update project cost for draft project only 2015-08-19 14:15:28 +05:30
Anand Doshi
548f7e8c74 [change-log] for v5.7.0 2015-08-19 13:31:35 +05:30
Anand Doshi
e270c7261d [minor] project cost 2015-08-19 13:02:30 +05:30
Rushabh Mehta
81e9d4e8f5 [fix] changed text > text editor for description fields in tables 2015-08-19 13:00:03 +05:30
Anand Doshi
4765d75b83 [minor] fix typo 2015-08-19 12:50:44 +05:30
Anand Doshi
8af567a229 [minor] import error 2015-08-19 12:10:03 +05:30
Anand Doshi
6e82d7b50d Merge pull request #3899 from nabinhait/project
[fix] Purchase cost against project
2015-08-19 11:58:12 +05:30
Nabin Hait
fa5fcf5405 [fix] Purchase cost against project 2015-08-19 11:56:23 +05:30
Anand Doshi
ffca81dbc1 [fix] added test cases and fixes to Item Variants 2015-08-19 11:52:05 +05:30
Rushabh Mehta
b52724f5b9 [minor] should fix #3884 2015-08-19 11:41:41 +05:30
Anand Doshi
b82961e8dd Merge pull request #3898 from nabinhait/reserved_qty
[fix][patch] Reserved Qty logic fixed and reposted for existing items
2015-08-19 11:22:03 +05:30
Nabin Hait
1826791891 [fix][patch] Reserved Qty logic fixed and reposted for existing items 2015-08-19 11:00:00 +05:30
Anand Doshi
df469c3e02 Merge pull request #3901 from rmehta/notify
[minor] notify stop/unstop (merge after merging realtime in frappe)
2015-08-19 10:31:41 +05:30
Anand Doshi
79cb7bffab Merge pull request #3906 from anandpdoshi/item-variant-fixes
Fixes to Item Variant Attribute
2015-08-19 10:31:11 +05:30
Anand Doshi
90fd6fee23 [fix] generate item code for variant 2015-08-19 10:21:24 +05:30
Anand Doshi
2538e51887 Fixes to Item Variant Attribute. Fixes #3905 2015-08-19 09:33:07 +05:30
Anand Doshi
1d2bde3b56 Merge pull request #3900 from nabinhait/fix6
Note files deleted, shifted to frappe repo
2015-08-18 18:35:17 +05:30
Anand Doshi
cf2c624c03 Merge pull request #3902 from rmehta/pos-print
[enhancement] POS print after save #3853
2015-08-18 18:32:04 +05:30
Rushabh Mehta
ad9156a6ae [enhancement] POS print after save #385:wq:wq 2015-08-18 18:05:43 +05:30
Anand Doshi
2f01f96ae3 [fix] [patch] item template attributes 2015-08-18 17:52:50 +05:30
Anand Doshi
2235caebee Merge pull request #3903 from anandpdoshi/fix-item-variant-attribute
patch and rename Variant Attribute to Item Variant Attribute
2015-08-18 17:44:21 +05:30
Anand Doshi
afbe39a559 [fix] patch and rename Variant Attribute to Item Variant Attribute 2015-08-18 17:30:44 +05:30
Rushabh Mehta
1d1f1b06d9 [minor] notify stop/unstop 2015-08-18 17:26:50 +05:30
Anand Doshi
b6c5b21dd0 [fix] [patch] typo and remove Bulk SMS 2015-08-18 16:27:20 +05:30
Anand Doshi
71c33823f6 Merge pull request #3806 from neilLasrado/item-variants
Improvements in Item Variants
2015-08-18 16:13:10 +05:30
Anand Doshi
82988be79f Merge pull request #3846 from rmehta/add-to-learn
Learn module
2015-08-18 12:10:03 +05:30
Nabin Hait
5b19dc3a5f Note files deleted, shifted to frappe repo 2015-08-18 11:46:53 +05:30
Anand Doshi
09ba897297 [fix] [patch] Item Template Attributes - migration from v4 and v5 2015-08-17 19:21:29 +05:30
Anand Doshi
2e0d90a7b9 [fix] travis 2015-08-17 17:58:53 +05:30
Anand Doshi
ddcc766a55 bumped to version 5.6.4 2015-08-17 17:58:53 +05:30
Nabin Hait
9495adc9d7 Update patches.txt 2015-08-17 17:58:53 +05:30
Nabin Hait
26bc1a58af [fix] Get Balance only if account or party mentioned 2015-08-17 17:58:53 +05:30
Nabin Hait
91e1077e4c [fix] precision issue in stock entry 2015-08-17 17:58:52 +05:30
Nabin Hait
3278ea177d [fix] Additional Costs patch fixed for version 4 to 5 migration 2015-08-17 17:58:52 +05:30
Nabin Hait
f1b2032466 Included Party and reference name in Journal Entry Account grid view 2015-08-17 17:58:52 +05:30
Nabin Hait
1c98886c85 [fix] Get stock and rate function restored 2015-08-17 17:58:52 +05:30
Anand Doshi
92d8a9b2d5 bumped to version 5.6.3 2015-08-17 17:58:52 +05:30
Anand Doshi
fd67ebf66d Show Communication in CRM 2015-08-17 17:58:51 +05:30
Anand Doshi
720ccabfe9 [fix] Journal Entry Reference Name query 2015-08-17 17:58:51 +05:30
Anand Doshi
d4cb1045ed [fix] Show 'Backflush Raw Materials Based On' in Manufacturing Settings 2015-08-17 17:58:51 +05:30
Anand Doshi
4f3eadc488 bumped to version 5.6.2 2015-08-17 17:58:51 +05:30
Anand Doshi
5dc7ff1355 [hotfix] [patch] cleanup journal entry 2015-08-17 17:58:51 +05:30
Anand Doshi
bfbf768daa [hotfix] [patch] cleanup journal entry 2015-08-17 17:58:51 +05:30
Anand Doshi
b334065977 [hotfix] translation in es.csv 2015-08-17 17:58:50 +05:30
Anand Doshi
d74d121199 [hotfix] [report] payment period based on invoice date 2015-08-17 17:58:50 +05:30
Anand Doshi
d726ce5e9e [fix] travis 2015-08-17 15:14:25 +05:30
Anand Doshi
5e35590bc9 Merge pull request #3871 from anandpdoshi/append-to-communication
Show Communication in CRM
2015-08-17 14:48:08 +05:30
Anand Doshi
41793bddd2 Merge branch 'develop' 2015-08-17 14:36:48 +05:30
Anand Doshi
b23049a55e bumped to version 5.6.4 2015-08-17 15:06:48 +06:00
Nabin Hait
99bf6c0927 Update patches.txt 2015-08-17 14:31:29 +05:30
Anand Doshi
b528c5cad2 Merge pull request #3893 from nabinhait/fix2
[fix] Get Balance only if account or party mentioned
2015-08-17 14:29:03 +05:30
Nabin Hait
dc76823a81 [fix] Get Balance only if account or party mentioned 2015-08-17 14:28:19 +05:30
Anand Doshi
862c36832a Merge pull request #3892 from nabinhait/fix1
[fix] Get stock and rate function restored
2015-08-17 14:26:01 +05:30
Anand Doshi
bd9dad96ae Merge pull request #3894 from nabinhait/fix3
Included Party and reference name in Journal Entry Account grid view
2015-08-17 14:24:52 +05:30
Anand Doshi
8ca933a83f Merge pull request #3895 from nabinhait/fix4
[fix] Additional Costs patch fixed for version 4 to 5 migration
2015-08-17 14:24:30 +05:30
Anand Doshi
f0107db3ca Merge pull request #3896 from nabinhait/fix5
[fix] precision issue in stock entry
2015-08-17 14:20:51 +05:30
Nabin Hait
c01342190c [fix] precision issue in stock entry 2015-08-17 14:18:44 +05:30
Nabin Hait
f763c1af25 [fix] Additional Costs patch fixed for version 4 to 5 migration 2015-08-17 12:06:53 +05:30
Nabin Hait
cbfd387c0b Included Party and reference name in Journal Entry Account grid view 2015-08-17 11:42:48 +05:30
Nabin Hait
ac07b1cc07 [fix] Get stock and rate function restored 2015-08-17 10:50:30 +05:30
Anand Doshi
4a1319289e Merge branch 'develop' 2015-08-14 17:53:41 +05:30
Anand Doshi
c5a43e46d8 bumped to version 5.6.3 2015-08-14 18:23:40 +06:00
Anand Doshi
1a2e6bf718 Show Communication in CRM 2015-08-14 17:51:14 +05:30
Anand Doshi
04dfd7b98f [fix] Journal Entry Reference Name query 2015-08-14 17:34:43 +05:30
Anand Doshi
85e0e87f01 [fix] Show 'Backflush Raw Materials Based On' in Manufacturing Settings 2015-08-14 12:55:27 +05:30
Anand Doshi
e7a3c7c5ab Merge branch 'develop' 2015-08-14 12:21:37 +05:30
Anand Doshi
acc32fe7f7 bumped to version 5.6.2 2015-08-14 12:51:37 +06:00
Anand Doshi
487454e817 [hotfix] [patch] cleanup journal entry 2015-08-14 12:17:34 +05:30
Anand Doshi
dc278a7427 [hotfix] [patch] cleanup journal entry 2015-08-14 12:05:50 +05:30
Anand Doshi
698ee434c0 [hotfix] translation in es.csv 2015-08-14 11:45:43 +05:30
Neil Trini Lasrado
68f66a7e8b fixed Test Cases 2015-08-13 17:34:25 +05:30
Anand Doshi
e116cb596c [hotfix] [report] payment period based on invoice date 2015-08-13 17:25:20 +05:30
Neil Trini Lasrado
6cce304b27 Changelog added 2015-08-13 16:19:55 +05:30
Neil Trini Lasrado
9710eede00 Fixed Test Cases 2015-08-13 16:19:55 +05:30
Neil Trini Lasrado
62dba50e9b Multiple Fixes 2015-08-13 16:18:55 +05:30
Neil Trini Lasrado
cdc060cb7c Allow Editing variant attribute in Variant. Add validation to check duplication. 2015-08-13 16:17:36 +05:30
Neil Trini Lasrado
b9b49632f2 Added patch to fetch Item Template Attributes 2015-08-13 16:17:36 +05:30
Neil Trini Lasrado
ebf4cbeae3 Fixed Manage Variant 2015-08-13 16:17:01 +05:30
Neil Trini Lasrado
8b608c9043 Search Variants added to Item Master
Added feature for Variants to hande numeric values
2015-08-13 16:17:01 +05:30
Anand Doshi
169c3ed09d Merge branch 'develop' 2015-08-13 15:54:41 +05:30
Anand Doshi
d7ba618b92 bumped to version 5.6.1 2015-08-13 16:24:41 +06:00
Anand Doshi
0a37f5575f [hotfix] [patch] stock entry additional cost for docstatus < 2 2015-08-13 15:53:40 +05:30
Anand Doshi
b1bae1bde8 Merge branch 'develop' 2015-08-13 15:44:03 +05:30
Anand Doshi
bcfd4277f4 bumped to version 5.6.0 2015-08-13 16:14:03 +06:00
Anand Doshi
2b6915519f [change-log] 2015-08-13 15:36:18 +05:30
Anand Doshi
5eb84352ec Merge pull request #3868 from nabinhait/price_list_rate
[fix] Reset price list rate based on Pricing Rule type
2015-08-13 15:10:08 +05:30
Anand Doshi
1580bf9ca4 Merge pull request #3869 from rmehta/pricing-rule-layout
[minor] pricing rule layout
2015-08-13 15:08:54 +05:30
Rushabh Mehta
4c4c534dcd [minor] pricing rule layout 2015-08-13 15:00:54 +05:30
Nabin Hait
0da11f1b10 [fix] Reset price list rate based on Pricing Rule type 2015-08-13 14:58:19 +05:30
Anand Doshi
cb4784c940 Merge pull request #3822 from neilLasrado/item-uom
Changed UOM validation for Item Master
2015-08-13 14:36:37 +05:30
Nabin Hait
4c8ee279f3 Merge branch 'bobzz-zone-patch-7' into develop 2015-08-13 14:15:45 +05:30
Nabin Hait
58aea1f819 minor fix 2015-08-13 14:15:27 +05:30
Nabin Hait
760bfb27d0 Merge branch 'patch-7' of https://github.com/bobzz-zone/erpnext into bobzz-zone-patch-7 2015-08-13 14:14:26 +05:30
Anand Doshi
c0c4e866be Merge branch 'nabinhait-item_description' into develop
Conflicts:
	erpnext/patches.txt
2015-08-13 13:40:33 +05:30
Anand Doshi
b16474e606 [minor] Reload Journal Entry Account 2015-08-13 13:38:22 +05:30
Rushabh Mehta
bbed8972c3 [minor] pincode label changed to postal code, #3770 2015-08-13 13:38:21 +05:30
Rushabh Mehta
35f94dfbc6 [patch] cleanup_journal_entry 2015-08-13 13:38:21 +05:30
Rushabh Mehta
832fa2e76b [patch] cleanup_journal_entry 2015-08-13 13:38:21 +05:30
Rushabh Mehta
682ce24f8c [patch] cleanup_journal_entry 2015-08-13 13:38:21 +05:30
Nabin Hait
9f02b08427 minor fix 2015-08-13 13:38:20 +05:30
Rushabh Mehta
2645980f62 [patch] cleanup_journal_entry 2015-08-13 13:38:20 +05:30
Anand Doshi
ae1a91835e Merge pull request #3866 from nabinhait/fix3
[fix] fraction issue in gl entry
2015-08-13 13:35:57 +05:30
Anand Doshi
094755415a Merge pull request #3867 from rmehta/salary-slip-fix
[fix] salary slip to consider disable rounded total, #3792
2015-08-13 13:35:02 +05:30
Anand Doshi
746eae4d1a [minor] Reload Journal Entry Account 2015-08-13 12:52:13 +05:30
Rushabh Mehta
cdbb448f6c [fix] salary slip to consider disable rounded total, #3792 2015-08-13 12:48:04 +05:30
Rushabh Mehta
907ea7dd8a [minor] pincode label changed to postal code, #3770 2015-08-13 12:35:43 +05:30
Neil Trini Lasrado
9a73b7a319 Changed UOM validation for Item Master 2015-08-13 12:21:32 +05:30
Nabin Hait
2e54da2ea5 [fix] fraction issue in gl entry 2015-08-13 12:19:27 +05:30
Rushabh Mehta
7e4b93f48e [patch] cleanup_journal_entry 2015-08-13 12:10:21 +05:30
Rushabh Mehta
b01cc1b449 [patch] cleanup_journal_entry 2015-08-13 11:54:04 +05:30
Rushabh Mehta
f738b951c5 [patch] cleanup_journal_entry 2015-08-13 11:50:51 +05:30
Anand Doshi
bb1679b74b Merge pull request #3865 from nabinhait/fix3
minor fix
2015-08-13 11:48:47 +05:30
Nabin Hait
6ddcac7cee minor fix 2015-08-13 11:47:35 +05:30
Rushabh Mehta
bcf7da6b1e [patch] cleanup_journal_entry 2015-08-13 11:46:01 +05:30
Nabin Hait
c51d5ba5df [patch] Update item description in Production Order based on item master 2015-08-13 11:39:45 +05:30
Anand Doshi
57ca765d9e Merge pull request #3848 from rmehta/journal-entry-refactor
[refactor] added dynamic link in journal entry, #3847, #3814
2015-08-13 11:39:13 +05:30
Anand Doshi
92e7d1f41d Merge pull request #3855 from nabinhait/discount
discount percentage should not be reset to zero on applying price list
2015-08-13 11:39:03 +05:30
Rushabh Mehta
ed40542658 [fix] minor auto-select party type and add has_permission in whitelisted methods 2015-08-13 10:34:49 +05:30
Rushabh Mehta
207b3efed7 [fix] journal entry get_query 2015-08-12 15:18:35 +05:30
Rushabh Mehta
3131c732ff [fix] capacity planning error 2015-08-12 12:29:16 +05:30
Rushabh Mehta
1828c12481 [refactor] added dynamic link in journal entry, #3847 2015-08-12 12:28:33 +05:30
Nabin Hait
4a91c49e0d discount percentage should not be reset to zero on applying price list 2015-08-11 18:16:10 +05:30
Anand Doshi
ba1f4263dd Added Rohit Industries as sponsors for #3546 2015-08-11 17:05:17 +05:30
Anand Doshi
7d45929872 Merge pull request #3829 from dottenbr/customer-taxid
Tax ID added and Customer Details description updated
2015-08-11 12:33:32 +05:30
Rushabh Mehta
b70f871592 Merge pull request #3850 from dottenbr/patch-1
Update README.md
2015-08-11 10:15:42 +05:30
Rushabh Mehta
d58df13150 Merge pull request #3849 from dottenbr/phone-mandatory-removed
Phone removed from mandatory in Address
2015-08-11 10:03:28 +05:30
Dominik
4101a48869 Update README.md 2015-08-10 23:59:16 +05:30
Dominik
28eff7fb91 Phone removed from mandatory in Address 2015-08-10 20:22:21 +05:30
Nabin Hait
6dc40e9baf Update accounts_controller.py 2015-08-10 19:18:39 +05:30
Nabin Hait
ac6d11eb3c minor improvements 2015-08-10 19:14:43 +05:30
Neil Trini Lasrado
1c6eeb228f Fixes in Stock Entry 2015-08-10 19:14:43 +05:30
Neil Trini Lasrado
b44f26d1ba Fixed Max value for update FG Item in Production Order 2015-08-10 19:14:43 +05:30
Neil Trini Lasrado
8ea2f45713 Renamed update_fg_goods_based_on in Manufacturing Settings to backflush_raw_materials_based_on 2015-08-10 19:14:43 +05:30
Neil Trini Lasrado
dde65752b6 Fixed code to consider partial FG entry 2015-08-10 19:14:43 +05:30
Neil Trini Lasrado
845980c010 Added Feature - Update FG based on Material Transfer For Manufacturing 2015-08-10 19:14:43 +05:30
Rushabh Mehta
6f593130d0 Merge pull request #3823 from nabinhait/stock-entry-tax
Stock entry tax
2015-08-10 14:31:20 +05:30
Nabin Hait
52f3bfca73 change log and sponsors page 2015-08-10 14:07:45 +05:30
Nabin Hait
3c3a3ecea8 Additional Costs in Stock Entry 2015-08-10 14:07:45 +05:30
Nabin Hait
246e47e76e [fix] Dashboard in customer / supplier 2015-08-10 14:07:02 +05:30
Nabin Hait
f6aad5ed2d Distribute tax amount between items in stock entry 2015-08-10 14:07:01 +05:30
Nabin Hait
aa87931172 Show only active BOM in stock entry 2015-08-10 14:07:01 +05:30
Nabin Hait
fc155c7712 Added tax table in stock entry 2015-08-10 14:07:01 +05:30
Rushabh Mehta
bf4f99adf1 [learn] added modules #3841 2015-08-10 13:21:57 +05:30
Rushabh Mehta
47b5e6272d Merge pull request #3844 from nabinhait/fix12
[fix] Made expense account non-mandatory in POS Profile
2015-08-10 13:16:39 +05:30
Rushabh Mehta
eae56cae54 Merge pull request #3843 from thecarly/patch-1
[minor] fixed typo
2015-08-10 13:13:00 +05:30
Nabin Hait
ea925d26a8 [fix] Made expense account non-mandatory in POS Profile 2015-08-10 12:57:05 +05:30
thecarly
56f5156f3c [minor] fixed typo 2015-08-10 12:50:44 +05:30
Rushabh Mehta
ee069d47b5 Merge pull request #3797 from anandpdoshi/fix-missing-item-images
Rename old filenames for Item
2015-08-10 11:58:54 +05:30
Rushabh Mehta
6c83b6bddc Merge pull request #3811 from rmehta/opportunity-customer
[minor] add close button in opportunity and project links in customer
2015-08-10 11:57:23 +05:30
Rushabh Mehta
815b460ddd Merge pull request #3809 from nabinhait/journal_entry_fix
[fix] Party / Account Validation message against Invoice
2015-08-10 11:57:01 +05:30
Rushabh Mehta
5f7166de83 [minor] remove section break in opportunity 2015-08-10 11:30:47 +05:30
Dominik
d1416542a0 Tax ID added and Customer Details description updated
Tax ID is a relatively generic descriptor for VAT (Value Added Tax) or any other countrie's tax identification system and should be required by most users of an ERP system. Since this removes the necessity to put the VAT into the Customer Description (not the ideal place to begin with) the description was updated and slimmed down.
2015-08-08 00:05:38 +05:30
Rushabh Mehta
69095e7285 [fix] website search 2015-08-07 15:48:53 +05:30
Rushabh Mehta
d6bdad7adf [fix] [hot] total in time log batch 2015-08-06 15:46:42 +05:30
Rushabh Mehta
48cccca9af [minor] add close button in opportunity and project links in customer 2015-08-06 15:37:01 +05:30
Nabin Hait
7c5124140e [fix] Party / Account Validation message against Invoice 2015-08-06 12:58:53 +05:30
Nabin Hait
143f384986 Merge branch 'develop' 2015-08-05 19:14:37 +05:30
Nabin Hait
37fdc43c88 bumped to version 5.5.1 2015-08-05 19:44:37 +06:00
Nabin Hait
ceb761852e Merge pull request #3807 from nabinhait/hotfix
[fix] fifo in stock ledger
2015-08-05 19:13:12 +05:30
Nabin Hait
65d8de36d0 Merge pull request #3804 from nabinhait/fix1
Fixes
2015-08-05 19:04:41 +05:30
Nabin Hait
8142cd2865 [fix] fifo in stock ledger 2015-08-05 18:57:37 +05:30
Anand Doshi
ed3a6cf748 [minor] removed print 2015-08-05 18:38:33 +05:30
Nabin Hait
2285eb7649 Merge pull request #3801 from bobzz-zone/patch-8
Update buying_controller.py
2015-08-05 16:15:02 +05:30
Nabin Hait
1648605950 [fix] Disabled OHADA system while fetching COA based on country 2015-08-05 15:56:05 +05:30
Nabin Hait
039154faa9 [fix] Asynchronus issue while fetching item description in Production Order 2015-08-05 15:56:05 +05:30
Rushabh Mehta
147acfd502 [fix] [mobile] abs url erpnext icon 2015-08-05 14:49:32 +05:30
bobzz-zone
b4c7bad33d Update buying_controller.py
dont force change conversion factor
2015-08-05 11:30:12 +07:00
bobzz-zone
ff04bf6346 Update stock_entry.py
fixed for null expense account
2015-08-05 11:28:11 +07:00
Anand Doshi
aa5182bb9e [fix] rename old filenames that start with FileData and fix missing Item images 2015-08-04 23:06:01 +05:30
Anand Doshi
329afe88f9 Merge branch 'develop' 2015-08-04 16:12:22 +05:30
Anand Doshi
ffa1e1c3bc bumped to version 5.5.0 2015-08-04 16:42:22 +06:00
Anand Doshi
f6616b6cbd [change-log] 2015-08-04 16:02:37 +05:30
Anand Doshi
d95b8e530a Merge pull request #3794 from nabinhait/serial_no
[fix] serial no validation in return entry
2015-08-04 15:43:23 +05:30
Nabin Hait
0e1314c5b5 [fix] serial no validation in return entry 2015-08-04 15:22:48 +05:30
Anand Doshi
cc920a7e4c Merge pull request #3780 from rmehta/service-product-bundle
[enhancement] make service type product bundle #3452
2015-08-04 15:05:05 +05:30
Rushabh Mehta
5bd394278d [fix] test-case, warehouse mandatory for mix type product bundle 2015-08-04 14:49:25 +05:30
Rushabh Mehta
a208c56813 [enhancement] auto insert item price if missing, #3533 2015-08-04 14:48:52 +05:30
Rushabh Mehta
862a2eb975 [enhancement] make service type product bundle: 2015-08-04 14:47:45 +05:30
Anand Doshi
1385f20042 Merge pull request #3791 from rmehta/update-translations
[translations] updated
2015-08-04 14:45:58 +05:30
Anand Doshi
950250d444 Merge pull request #3793 from nabinhait/serial_no
Validate serial no in return entry with against document
2015-08-04 14:45:30 +05:30
Rushabh Mehta
63b98ec113 [translations] updated 2015-08-04 12:43:37 +05:30
Anand Doshi
4a0edd04c4 Merge pull request #3779 from nabinhait/fifo_stack
[fix] Get fifo rate only qty exists in batch
2015-08-04 12:26:42 +05:30
Nabin Hait
b7c0c55d61 Validate serial no in return entry with against document 2015-08-04 12:18:12 +05:30
Nabin Hait
232ad777c9 [fix][patch] Remove fifo stack entry if qty after transaction is zero via stock reconciliation 2015-08-04 11:40:38 +05:30
Nabin Hait
7edb951fdb [fix] Get fifo rate only qty exists in batch 2015-08-04 11:09:14 +05:30
Nabin Hait
845bbe3e27 Update fix_invoice_outstanding.py 2015-08-04 10:48:05 +05:30
Nabin Hait
f7bf50d6fe Merge pull request #3786 from nabinhait/fix4
[fix] Ignore if error coming while sending emails to system managers
2015-08-03 19:27:04 +05:30
Nabin Hait
374559bfad [fix] Ignore if error coming while sending emails to system managers 2015-08-03 19:26:32 +05:30
Anand Doshi
e7c6605455 Merge pull request #3761 from nabinhait/fix1
Fixes
2015-08-03 19:20:31 +05:30
Nabin Hait
5bbe823106 [patch] Fix outstanding amount for original invoice for return entry 2015-08-03 19:19:11 +05:30
Nabin Hait
ad44b00f33 [patch] Fix outstanding amount for original invoice for return entry 2015-08-03 19:19:11 +05:30
Nabin Hait
893db7a5c3 Allow payment against invoice with negative outstanding 2015-08-03 19:18:22 +05:30
Nabin Hait
433cdc960d Update outstanding in original invoice from return invoice 2015-08-03 19:18:22 +05:30
Nabin Hait
4f2832ecd2 [fix] Allow against purchase invoice against credit amount row 2015-08-03 19:18:22 +05:30
Nabin Hait
1755a5f298 [fix] get items from bom in material request 2015-08-03 19:18:21 +05:30
Nabin Hait
b3b059b0ea [fix] payment reconciliation 2015-08-03 19:18:21 +05:30
Anand Doshi
d615d4fdcd Merge pull request #3785 from nabinhait/fix3
[fix] newsletter list unique check
2015-08-03 19:18:07 +05:30
Anand Doshi
da77abc25b Merge pull request #3767 from nabinhait/tax_calc
[fix] Tax calculation while discount applied on net total
2015-08-03 19:17:04 +05:30
Anand Doshi
7cb19f6e9f Merge pull request #3783 from nabinhait/fix2
[fix] Get open SO in production planning tool
2015-08-03 19:14:24 +05:30
Anand Doshi
441a75b1d4 Merge pull request #3782 from rmehta/uom-fix
[fix] force stock_uom in item and stock ledger entry
2015-08-03 19:13:38 +05:30
Nabin Hait
03bccb81d8 [test case] Test case for discount amount on net total 2015-08-03 19:11:44 +05:30
Nabin Hait
1db0b6de0c Patch to notify system managers if there are any wrong entries due to bug related to discount amount on net total 2015-08-03 19:11:44 +05:30
Nabin Hait
db53a789be [fix] Tax calculation while discount applied on net total 2015-08-03 19:10:59 +05:30
Nabin Hait
c3e1f6bb96 [fix] newsletter list unique check 2015-08-03 19:09:05 +05:30
Anand Doshi
f2e5e7fc22 Merge pull request #3776 from nabinhait/account_type
Propogate root type and report type into children based on parent
2015-08-03 19:04:42 +05:30
Nabin Hait
541927d58a [fix] Get open SO in production planning tool 2015-08-03 16:39:20 +05:30
Rushabh Mehta
b16b9cd7a0 [fix] force stock_uom in item and stock ledger entry 2015-08-03 16:13:33 +05:30
Nabin Hait
94f15fcec6 Propogate root type and report type into children based on parent 2015-08-03 11:17:07 +05:30
Anand Doshi
ba9dbb1b09 [minor] removed Link/DocType in Payment Period Based on Invoice Date 2015-08-03 11:05:45 +05:30
Nabin Hait
b7f2066250 Merge pull request #3768 from nabinhait/uom
[fix] UOM conversion factor in stock entry
2015-07-31 20:11:23 +05:30
Nabin Hait
b30c40ec8a [fix] UOM conversion factor in stock entry 2015-07-31 19:48:57 +05:30
Rushabh Mehta
2f5587ab25 [fix] uom conversion factor in stock entry, #3734 2015-07-31 15:20:29 +05:30
Nabin Hait
75e9733283 Merge branch 'develop' 2015-07-30 16:47:49 +05:30
Nabin Hait
69588f57e7 bumped to version 5.4.2 2015-07-30 17:17:48 +06:00
Nabin Hait
88d8c164f7 Merge pull request #3757 from nabinhait/fix1
[hotfix] item search in production order
2015-07-30 16:46:27 +05:30
Nabin Hait
c330a49e9d [hotfix] item search in production order 2015-07-30 16:45:58 +05:30
Nabin Hait
b75f5fd5ab Merge branch 'develop' 2015-07-30 14:59:01 +05:30
Nabin Hait
6f5815838e bumped to version 5.4.1 2015-07-30 15:29:01 +06:00
Nabin Hait
fe53651287 Merge pull request #3755 from nabinhait/fix1
repost stock for product bundle materials
2015-07-30 14:54:21 +05:30
Nabin Hait
d8546c4316 Fixed include holiday logic in leave calculation 2015-07-30 14:53:27 +05:30
Nabin Hait
17405d4130 repost stock for product bundle materials 2015-07-30 14:53:27 +05:30
Anand Doshi
2f443a5789 [hotfix] Item checkbox mandatory and removed Module Def Contacts 2015-07-30 14:44:43 +05:30
Nabin Hait
a5e11d7195 Merge branch 'develop' 2015-07-30 11:57:53 +05:30
Nabin Hait
3832e1f9be bumped to version 5.4.0 2015-07-30 12:27:53 +06:00
Nabin Hait
67079d292c Merge pull request #3725 from neilLasrado/test
Fixed test cases related to Time Logs
2015-07-30 11:51:26 +05:30
Nabin Hait
01a3a81f71 Merge pull request #3753 from nabinhait/return1
[fix] Actual tax amount should be negative while creating return entry
2015-07-30 11:50:45 +05:30
Nabin Hait
befa8d613f Merge pull request #3750 from nabinhait/payreco
Minor fixes
2015-07-30 11:50:19 +05:30
Nabin Hait
9e26bcfeeb [fix] Actual tax amount should be negative while creating return entry 2015-07-30 11:48:18 +05:30
Neil Trini Lasrado
f948fea3bf simulate added to make_time_log in test_time_log 2015-07-29 18:48:58 +05:30
Neil Trini Lasrado
d851bd8d85 Fixed test cases related to Time Logs 2015-07-29 18:48:58 +05:30
Nabin Hait
30672c6b55 Merge pull request #3751 from neilLasrado/leave-application
Fixes in leave application
2015-07-29 18:47:59 +05:30
Neil Trini Lasrado
e73941b9cc Fixes in leave application 2015-07-29 18:39:27 +05:30
Nabin Hait
f33787a706 [fix] Get serial nos using FIFO in Return Delivery Note 2015-07-29 18:08:10 +05:30
Nabin Hait
fcc4021e44 minor fix in payment reconciliation 2015-07-29 17:41:51 +05:30
Nabin Hait
3b67c89e0b Merge pull request #3749 from nabinhait/changelog
Change log added
2015-07-29 16:41:57 +05:30
Nabin Hait
7364ebaff6 minor fix 2015-07-29 16:41:23 +05:30
Nabin Hait
fd8f34018d Change log added 2015-07-29 16:38:02 +05:30
Nabin Hait
799fa09a23 Merge pull request #3748 from nabinhait/fix7
[fix][patch] Reload Leave Type
2015-07-29 16:37:29 +05:30
Nabin Hait
d1dc622914 [fix][patch] Reload Leave Type 2015-07-29 16:37:02 +05:30
Nabin Hait
8ce47862f9 Merge branch 'meatechsupport-develop' into develop 2015-07-29 16:15:27 +05:30
Nabin Hait
b24d2efc4b [fix] Updated 'Include Holiday' in existing and default leave type records 2015-07-29 16:15:08 +05:30
Nabin Hait
a184fbfa66 Merge branch 'develop' of https://github.com/meatechsupport/erpnext into meatechsupport-develop 2015-07-29 16:05:47 +05:30
Nabin Hait
763821d57d Merge pull request #3746 from nabinhait/get_item_details
[fix] Get item details based on selected company
2015-07-29 16:02:39 +05:30
Nabin Hait
a132767126 Merge pull request #3739 from nabinhait/packed-items
Packed items in sales invoice
2015-07-29 16:01:30 +05:30
Nabin Hait
453cc374d4 - Fixed logic of reserved qty calculation while delivered product bundle via Sales Invoice
- Delete stock ledger entries on cancellation of Sales Invoice while product bundle delivered
- Make packing list on validate
2015-07-29 15:59:57 +05:30
Nabin Hait
43e46a8506 Merge pull request #3733 from nabinhait/fix3
POS Profile: removed income account, cost center, territory and bank/cash account from mandatory
2015-07-29 15:57:05 +05:30
Nabin Hait
2c95130451 Merge pull request #3741 from nabinhait/sponsors
sponsors page updated
2015-07-29 15:54:58 +05:30
Nabin Hait
d46fb5eb8c Merge pull request #3743 from rmehta/indicator-fix
[fix] indicators for sales order, purchase order #3736
2015-07-29 15:53:44 +05:30
Nabin Hait
e95c18a42d Merge pull request #3744 from nabinhait/return
Sales / Purchase Return Improvements
2015-07-29 15:51:34 +05:30
Nabin Hait
18c2c54633 Merge pull request #3718 from rmehta/item-cleanup
[cleanup] yes/no selects changed to checks in Item
2015-07-29 15:49:54 +05:30
Nabin Hait
0edec9d25b Merge pull request #3730 from nabinhait/fix1
minor fixes
2015-07-29 15:48:24 +05:30
Nabin Hait
15216fdd6f [fix] Get item details based on selected company 2015-07-29 15:47:45 +05:30
Nabin Hait
9117af3077 [fix] Uncheck Is POS option while creating return entry against POS Invoice 2015-07-29 15:40:59 +05:30
Rushabh Mehta
92b6f76612 [fix] disable save in naming series 2015-07-29 15:17:30 +05:30
Rushabh Mehta
8bf0b89595 [minor] currency field in list view for item price 2015-07-29 14:55:48 +05:30
Nabin Hait
746c162055 Return status in listview for return entry 2015-07-29 14:54:33 +05:30
Nabin Hait
9eb9ccd785 Make Debit / Credit Note button in Purchase / Sales Invoice 2015-07-29 13:23:37 +05:30
Nabin Hait
1e046aa49a Hide buttons for return entry 2015-07-29 13:16:37 +05:30
Nabin Hait
3ad26e4dd1 Fix Against Voucher in GL Entry for return against purchase invoice 2015-07-29 13:15:57 +05:30
Rushabh Mehta
2f3b097d63 [fix] indicators for sales order, purchase order #3736 2015-07-29 13:08:27 +05:30
Nabin Hait
c505cbc988 sponsors page updated 2015-07-29 12:34:18 +05:30
Rushabh Mehta
1e8025b327 [cleanup] yes/no selects changed to checks in Item 2015-07-29 11:38:33 +05:30
Anand Doshi
0e6f2474e8 [minor] removed trailing space in offer letter status 2015-07-29 11:27:02 +05:30
Meatechsupport
e102332f08 removed testcase 2015-07-28 19:03:30 +04:00
Meatechsupport
145227e4ec Edited the Test case 2015-07-28 18:39:04 +04:00
Nabin Hait
18e033514e Merge pull request #3679 from neilLasrado/freeze-customer
Added ability to freeze Customer/Supplier
2015-07-28 15:21:06 +05:30
Nabin Hait
26052df76e POS Profile: removed income account, cost center, territory and bank-cash account from mandatory 2015-07-28 15:12:54 +05:30
Nabin Hait
b2f354a614 Merge pull request #3731 from nabinhait/fix2
[fix] Contact section visibility in Warranty Claim
2015-07-28 15:12:22 +05:30
Rushabh Mehta
49a59c075f [minor] [setup-wizard] add check for sample data 2015-07-28 12:23:40 +05:30
Neil Trini Lasrado
ff3b220c79 Fixed gl_entry Validation 2015-07-28 12:23:14 +05:30
Neil Trini Lasrado
cc7cb2a70a Allowed frozen_accounts_modifier to create records against frozen customer/supplier 2015-07-28 12:17:03 +05:30
Neil Trini Lasrado
79bf233734 Test Cases added to check if customer is frozen 2015-07-28 12:17:03 +05:30
Neil Trini Lasrado
3698b84d7c Typo fixes in Supplier and Customer Document 2015-07-28 12:17:02 +05:30
Neil Trini Lasrado
3fbbb71afc Added ability to freeze Customer/Supplier 2015-07-28 12:17:02 +05:30
Nabin Hait
a2f18ba794 [fix] Contact section visibility in Warranty Claim 2015-07-28 12:00:45 +05:30
Nabin Hait
9088432f10 Fetch default expense account and cost center from item if company matches, otherwise fetch from company master 2015-07-28 11:16:22 +05:30
Nabin Hait
c80059e10e [fix] Ignore making SLE for opening stock reco with zero qty 2015-07-28 11:16:22 +05:30
Anand Doshi
8e8e9c61ca [minor] Show description in Sales Order 2015-07-28 10:46:14 +05:30
Rushabh Mehta
424f0c7b84 [fix] [setup wizard] ignore fiscal year 2015-07-28 10:36:33 +05:30
Rushabh Mehta
aa5fb5e50e [fix] [setup wizard] ignore if user is the primary user 2015-07-28 10:31:09 +05:30
Rushabh Mehta
08a60653ba [fix] [setup wizard] ignore if user is the primary user 2015-07-28 09:22:36 +05:30
Meatechsupport
8b96fdac12 Indentation Error
realligned
2015-07-27 16:55:54 +04:00
Meatechsupport
e319598c51 IndentationError
alligned code
2015-07-27 16:42:22 +04:00
Nabin Hait
0c7fd6cd94 Merge branch 'develop' 2015-07-27 17:11:16 +05:30
Nabin Hait
0b5260acf0 bumped to version 5.3.1 2015-07-27 17:41:16 +06:00
Nabin Hait
d4be82cf9b corrected typo 2015-07-27 17:09:54 +05:30
Nabin Hait
0166e9e47a Merge pull request #3726 from nabinhait/fix1
minor fix
2015-07-27 17:09:38 +05:30
Nabin Hait
b71471fcb5 minor fix 2015-07-27 17:09:07 +05:30
Nabin Hait
7e8d7d05ef Merge branch 'develop' 2015-07-27 15:55:57 +05:30
Nabin Hait
228ff87ea2 bumped to version 5.3.0 2015-07-27 16:25:56 +06:00
Nabin Hait
8d8655e1cd Change log added 2015-07-27 15:54:39 +05:30
Meatechsupport
5c73bafeaa Modifying the number of leave days calculation part.
we don't need to exclude the Holiday list (that comes in between) from the total number of leaves applied.

Add option in the leave type

added a field in the leave type to include and exclude the holidays from
the tolal leave applied days

Added the field

Added a field Include Holiday to leave Type doctype

changed the lable

changed the lable from "Include Holiday" to "Include holidays within leaves
as leaves"

Rearranged the function

moved holidays = leave_app.get_holidays() under if
Corrected 'total_leave_days' : flt(tot_days)-flt(holidays)

Adding test case

added the test case

Added test case

Added test case to test_leave_application.py

adding default value

added default value and corrected the syntax.

IndentationError

removed extra tabs after
2015-07-27 13:46:00 +04:00
Anand Doshi
14859faf17 [minor] Accounts Payable Report Type='Script Report' 2015-07-24 17:30:39 +05:30
Nabin Hait
2b7eda8135 Merge pull request #3683 from nabinhait/return
Sales / Purchase Return Enhancement
2015-07-24 16:53:01 +05:30
Anand Doshi
751d7ecd85 Merge pull request #3716 from tmimori/develop
Removed HTML from messages
2015-07-24 14:28:59 +05:30
Nabin Hait
6a09b3f7ef Merge pull request #3702 from neilLasrado/capacity-planning
Global switch to set capacity planning in manufacturing
2015-07-24 14:26:28 +05:30
Nabin Hait
21897e3c52 Merge pull request #3714 from nabinhait/fix4
[fix] gross profit report
2015-07-24 14:25:35 +05:30
Nabin Hait
15b4f6310c Merge pull request #3701 from neilLasrado/po
Disallowed End of Life Items from getting selected in Production Orders and Stock Reconciliation
2015-07-24 14:25:13 +05:30
Tsutomu Mimori
196a0bc675 Amend for frappe/erpnext/pull/3716 2015-07-24 17:06:00 +09:00
Tsutomu Mimori
7c011985f0 Merge remote-tracking branch 'frappe/develop' into develop 2015-07-24 17:02:13 +09:00
Nabin Hait
3cf67a462b Cleanup and test cases for serialized item 2015-07-24 13:26:54 +05:30
Nabin Hait
f061877b4f [fix] Stock Entry permissions 2015-07-24 13:26:54 +05:30
Nabin Hait
04d244a360 Credit Note print format 2015-07-24 13:26:54 +05:30
Nabin Hait
b74999da82 [testcase] Testcase for return purchase invoice 2015-07-24 13:26:53 +05:30
Nabin Hait
061f7079ed Test case for purchase return 2015-07-24 13:26:53 +05:30
Nabin Hait
246ed3f122 Test cases for sales return 2015-07-24 13:26:53 +05:30
Nabin Hait
6b25708b7a Minor fixes 2015-07-24 13:26:53 +05:30
Nabin Hait
623ed57663 Removed Sales/Purchase Return option from Stock Entry 2015-07-24 13:26:53 +05:30
Nabin Hait
1d21842f68 Sales / Purchase Return redesigned via negative DN / SI / PR / PI 2015-07-24 13:26:53 +05:30
Nabin Hait
ada485f096 Outgoing rate in Purchase Return based on reference/original Purchase Receipt rate 2015-07-24 13:26:53 +05:30
Neil Trini Lasrado
8a9d41a92e Modified Test Cases for Production Order 2015-07-24 13:18:45 +05:30
Neil Trini Lasrado
f965c5d203 now_datetime changed to nowdate 2015-07-24 13:14:57 +05:30
Neil Trini Lasrado
21647974c4 Test Cases Added to Production Order 2015-07-24 13:14:57 +05:30
Neil Trini Lasrado
9c3dca63fa Disallowed End of Life Items from getting selected in Production Orders and Stock Reconciliation 2015-07-24 13:14:56 +05:30
Tsutomu Mimori
c40b99be26 Merge remote-tracking branch 'frappe/develop' into develop 2015-07-23 22:10:40 +09:00
Tsutomu Mimori
982f4ae44d Removed HTML from messages 2015-07-23 22:09:35 +09:00
Anand Doshi
9257413b68 [minor] Added 'Import Data' in sample data 2015-07-23 18:16:44 +05:30
Neil Trini Lasrado
c723c8b5aa Disable Capacity Planning label changed to Disable Capacity Planning & Time Tracking in Manufacturing Settings 2015-07-23 17:43:27 +05:30
Neil Trini Lasrado
2771b7d828 Track Operations removed and Global Switch added to disable capacity planning in manufacturing settings 2015-07-23 17:39:35 +05:30
Anand Doshi
75ebed815f Merge pull request #3711 from nabinhait/budget
Validation on Account for assigning budget
2015-07-23 17:26:56 +05:30
Nabin Hait
975ef07c48 Merge pull request #3706 from neilLasrado/variant
Fetch Template Bom if no BOM is set against Item Variant in Production Order
2015-07-23 17:26:11 +05:30
Nabin Hait
f666535223 [fix] gross profit report 2015-07-23 17:08:44 +05:30
Nabin Hait
08fb19ac8c Validation on Account for assigning budget 2015-07-23 16:59:43 +05:30
Anand Doshi
db9762be3f Merge pull request #3712 from rmehta/setup-wizard-fix
[fix] contact name in setup wizard
2015-07-23 16:46:09 +05:30
Anand Doshi
03ae61afce Merge pull request #3681 from rmehta/sample-data
[enhancement] update to setup wizard, added users, employees, sample data
2015-07-23 16:45:28 +05:30
Anand Doshi
1847b705fe Merge pull request #3704 from nabinhait/fix2
[fix] SMS status and log
2015-07-23 16:45:00 +05:30
Anand Doshi
4a573a7e8b Merge pull request #3709 from nabinhait/contacts
[cleanup] Party Type deleted
2015-07-23 16:41:36 +05:30
Nabin Hait
f74b9b06f7 Merge pull request #3708 from neilLasrado/material-request
Fetch items from Packing List if Exists in Sales Order while raising …
2015-07-23 15:21:50 +05:30
Nabin Hait
2820a8749f Merge pull request #3710 from neilLasrado/stock-report
Opening Balance row added to Stock Ledger Report
2015-07-23 15:21:26 +05:30
Rushabh Mehta
41b4864f0c Merge pull request #3713 from neilLasrado/manage-variants
Fixes for Item Variants
2015-07-23 15:01:28 +05:30
Neil Trini Lasrado
13df8a40ef Validation added to prevent user to Manage Variants if Item Template is Unsaved. Prevented message stating variants updated while saving item template if there are no variants against that item Template 2015-07-23 12:46:59 +05:30
Rushabh Mehta
7cfa5f0508 [fix] contact name in setup wizard 2015-07-23 12:39:44 +05:30
Nabin Hait
bb274fce2e [cleanup] Party Type deleted 2015-07-23 11:45:30 +05:30
Rushabh Mehta
fec61fe33e [minor] fix report type for Accounts Payable 2015-07-23 10:39:13 +05:30
Neil Trini Lasrado
d0387f41df Opening Balance row added to Stock Ledger Report 2015-07-22 18:44:59 +05:30
Neil Trini Lasrado
05d8174696 Fetch items from Packing List if Exists in Sales Order while raising Material Request against SO 2015-07-22 16:31:34 +05:30
Rushabh Mehta
ba02ce6adc [docs] added description 2015-07-22 15:07:48 +05:30
Anand Doshi
886def0a69 [fix] convert Item and Item Grid images to absolute urls 2015-07-22 14:43:37 +05:30
Anand Doshi
7590aa2524 [minor] raise EmptyStockReconciliationItemsError when no change in any of the items 2015-07-22 14:43:36 +05:30
Neil Trini Lasrado
8b48ceab8c Removed logic for get_item_details in Production Planning Tool, Used get_item_details function of Production Order instead 2015-07-22 12:42:21 +05:30
Nabin Hait
d900e12ae7 Change log for sms 2015-07-22 12:21:55 +05:30
Nabin Hait
098760f0e2 [fix] SMS status and log 2015-07-22 12:17:48 +05:30
Neil Trini Lasrado
cc431716ed Fetch Template Bom if no BOM is set against Item Variant in Production Order 2015-07-22 12:13:47 +05:30
Anand Doshi
f5ea801b69 Merge pull request #3700 from nabinhait/fix1
[report] Letter Head option in General Ledger
2015-07-21 12:19:57 +05:30
Nabin Hait
e2b8ccf1bb [report] Letter Head option in General Ledger report 2015-07-21 12:02:36 +05:30
Anand Doshi
f447c8258a [minor] Newsletter Message should be mandatory 2015-07-20 16:10:04 +05:30
Nabin Hait
f78ffd84b4 Merge branch 'develop' 2015-07-20 15:22:10 +05:30
Nabin Hait
63d345c6ab bumped to version 5.2.1 2015-07-20 15:52:10 +06:00
Anand Doshi
d0d1af2072 Merge pull request #3696 from nabinhait/fix1
[fix][report] Show only active employee in Employee leave balance report
2015-07-20 13:27:47 +05:30
Anand Doshi
83694fd180 [minor] removed is_group from search fields of Account 2015-07-20 13:26:22 +05:30
Anand Doshi
fc353efeca Merge pull request #3670 from neilLasrado/expense-claim
Default Expense Account added to Expense Claim Type.
2015-07-20 13:04:33 +05:30
Anand Doshi
16edf8b478 Merge pull request #3685 from nabinhait/fix6
[fix] Fetch debit/credit from reference journal entry
2015-07-20 13:00:10 +05:30
Nabin Hait
c9e4fbeda0 [fix][report] Show only active employee in Employee leave balance report 2015-07-20 12:57:48 +05:30
Anand Doshi
46ae789f2f Merge pull request #3682 from anandpdoshi/anand-july-17
Remove 'Stopped' banner in Sales Order, show ERPNext icon instead of 'ERPNext'
2015-07-20 12:57:17 +05:30
Anand Doshi
a9a284a5ae Merge pull request #3693 from rmehta/close-task
[minor] close button for task and item not found error fix
2015-07-20 12:56:50 +05:30
Rushabh Mehta
823e88d5bd [minor] close button for task and item not found error fix 2015-07-20 10:56:39 +05:30
Nabin Hait
1be94efcfa [fix] Fetch debit/credit from reference journal entry 2015-07-17 17:25:52 +05:30
Anand Doshi
a5e9c71397 [ui] changed Learn icon 2015-07-17 15:55:10 +05:30
Anand Doshi
285135da8e [ui] Remove 'Stopped' alert banner in Sales Order 2015-07-17 15:14:40 +05:30
Anand Doshi
906c2babaa [ui] Show ERPNext icon instead of ERPNext in navbar 2015-07-17 15:14:39 +05:30
Nabin Hait
14a394cde1 Update fields_to_be_renamed.py 2015-07-17 15:14:19 +05:30
Nabin Hait
3c821c89f2 Update rename_table_fieldnames.py 2015-07-17 15:13:29 +05:30
Nabin Hait
a041297861 Update rename_total_fields.py 2015-07-17 15:12:52 +05:30
Rushabh Mehta
856ee10dc4 [enhancement] update to setup wizard, added users, employees, sample data 2015-07-17 15:03:18 +05:30
Nabin Hait
1401e3f679 Update rename_total_fields.py 2015-07-17 14:43:19 +05:30
Nabin Hait
dae29bf2d4 Update fields_to_be_renamed.py 2015-07-17 14:42:46 +05:30
Nabin Hait
0a3be6da27 Update rename_table_fieldnames.py 2015-07-17 14:39:41 +05:30
Nabin Hait
3631e9cbe0 Merge branch 'develop' 2015-07-16 17:15:41 +05:30
Nabin Hait
1c9a7d2a1b bumped to version 5.2.0 2015-07-16 17:45:40 +06:00
Anand Doshi
972f2f9194 [change-log] 2015-07-16 16:19:30 +05:30
Anand Doshi
239296d16a Merge pull request #3657 from nabinhait/fix4
Reserved warehouse should not be validated on cancellation of sales order
2015-07-16 15:57:59 +05:30
Anand Doshi
3210db9056 Merge pull request #3656 from rmehta/sms-log
[fix] create SMS Log
2015-07-16 15:56:08 +05:30
Neil Trini Lasrado
feda4f9bc9 Default Expense Account added to Expense Claim Type. Fetch account while making Bank Entry 2015-07-16 15:44:56 +05:30
Anand Doshi
f6954fb798 Merge pull request #3663 from neilLasrado/bom
Bom
2015-07-16 15:02:40 +05:30
Anand Doshi
c6656e68b8 Merge pull request #3666 from nabinhait/patch-fix
[patch][fix] Sales BOM should be renamed before rename_table_fields patch
2015-07-16 14:55:35 +05:30
Anand Doshi
a39387d352 Merge pull request #3664 from rmehta/develop
[cleanup] removed welcome emails
2015-07-16 14:25:24 +05:30
Rushabh Mehta
f3791797d6 [fix] [patch] 2015-07-16 14:17:59 +05:30
Rushabh Mehta
ea4d63cef3 [cleanup] removed welcome emails 2015-07-16 14:17:59 +05:30
Nabin Hait
5464ca8a73 [patch][fix] Sales BOM should be renamed before rename_table_fields patch 2015-07-16 12:19:57 +05:30
Rushabh Mehta
6c6875f503 [cleanup] removed welcome emails 2015-07-16 11:53:18 +05:30
Neil Trini Lasrado
20523c45c7 Patch for default BOM 2015-07-16 11:27:06 +05:30
Neil Trini Lasrado
0248811e53 Fixed deafault BOM problem 2015-07-16 11:26:40 +05:30
Rushabh Mehta
93416ee72c Update sponsors.md 2015-07-15 16:42:46 +05:30
Rushabh Mehta
51e7086a08 [patch] rename roles 2015-07-15 16:30:49 +05:30
Anand Doshi
5e849ae53e [help] added new links to Learn 2015-07-15 15:23:02 +05:30
Rushabh Mehta
de0db0d000 Merge pull request #3658 from anandpdoshi/anand-july-15
[fix] Mozilla hack for images in table for print
2015-07-15 12:58:19 +05:30
Anand Doshi
f3a67c4533 [fix] Mozilla hack for images in table for print 2015-07-15 12:37:45 +05:30
Nabin Hait
0847f9a074 Reserved warehouse should not be validated on cancellation of sales order 2015-07-14 18:23:05 +05:30
Anand Doshi
9490c21b8a Merge pull request #3641 from rmehta/role-rename
[rename] Material User > Stock User
2015-07-14 12:10:48 +05:30
Rushabh Mehta
bdb71bca4e [perm] added stock, project user for company 2015-07-14 11:54:42 +05:30
Anand Doshi
e8861e2871 Merge pull request #3649 from rmehta/purchase-invoice-fix
[fix] supplier invoice number fix
2015-07-14 11:50:07 +05:30
Anand Doshi
b084b5e449 Merge pull request #3651 from rmehta/pos-default-pay-fix
[fix] pos default payment #3631
2015-07-14 11:49:46 +05:30
Anand Doshi
41d3e57702 Merge pull request #3650 from rmehta/time-log-fix-2
[fix] overlap fix in time log #3647
2015-07-14 11:45:49 +05:30
Anand Doshi
9df2899f72 Merge pull request #3648 from rmehta/time-log-fix
[fixes] hours in time-log #3644, project buttons on condition, removed Guest permission in notification_control
2015-07-14 11:25:46 +05:30
Rushabh Mehta
dacf127f1b [fix] time log overlap condition, #SavedByATestCase 2015-07-14 11:06:28 +05:30
Rushabh Mehta
2b49f9b30a [fix] pos default payment #3631 2015-07-14 11:01:42 +05:30
Rushabh Mehta
533434e878 [fix] overlap fix in time log #3647 2015-07-14 10:39:33 +05:30
Rushabh Mehta
1956028ddc [fix] supplier invoice number fix 2015-07-14 10:26:50 +05:30
Rushabh Mehta
a87dc3b4e6 [minor] move position in accounts settings 2015-07-14 10:22:07 +05:30
Rushabh Mehta
97b3f750c9 [fixes] hours in time-log #3644, project buttons on condition, removed Guest permission in notification_control 2015-07-14 10:14:48 +05:30
Anand Doshi
c41b63eff1 Merge pull request #3642 from anandpdoshi/anand-july-13
Fixes to Cart
2015-07-13 16:56:37 +05:30
Anand Doshi
e6f7ac961f [fix] Add to Cart visibility, Customer's Price List in Shopping Cart and Address creation from Shopping Cart 2015-07-13 16:24:37 +05:30
Rushabh Mehta
cf26964deb Merge pull request #3640 from anandpdoshi/anand-july-13
Fixes to Issues
2015-07-13 15:37:11 +05:30
Rushabh Mehta
94157334a7 [rename] Material User > Stock User 2015-07-13 15:06:12 +05:30
Anand Doshi
c530161de0 [fix] Item image urls can now have paranthesis 2015-07-13 15:05:39 +05:30
Nabin Hait
2212ae12d8 Merge branch 'develop' 2015-07-13 14:26:23 +05:30
Nabin Hait
54ade0d26c bumped to version 5.1.6 2015-07-13 14:56:23 +06:00
Nabin Hait
f043760526 Merge pull request #3639 from neilLasrado/develop
Sales BOM to Product Bundle rename changes
2015-07-13 14:22:10 +05:30
Neil Trini Lasrado
1cd049d824 Sales BOM to Product Bundle rename changes 2015-07-13 14:17:42 +05:30
Nabin Hait
0a45260ed9 Merge branch 'develop' 2015-07-13 13:09:05 +05:30
Nabin Hait
1540ad12f9 bumped to version 5.1.5 2015-07-13 13:39:05 +06:00
Nabin Hait
76bd015b2c Merge pull request #3637 from rmehta/time-log-filter
[minor] [enhancement] added employee filter in timelog #3607
2015-07-13 13:04:03 +05:30
Rushabh Mehta
5054a3955b Update CONTRIBUTING.md 2015-07-13 12:54:08 +05:30
Nabin Hait
1a0713e4b9 Merge pull request #3584 from neilLasrado/develop
Minor fixes
2015-07-13 12:49:46 +05:30
Rushabh Mehta
e9604d8484 [minor] [enhancement] added employee filter in timelog #3607 2015-07-13 12:47:45 +05:30
Neil Trini Lasrado
008d1a0334 Fixes in Stock Entry 2015-07-13 12:41:28 +05:30
Neil Trini Lasrado
fe2ffaeafa Fixes in Production Planning Tool 2015-07-13 12:41:28 +05:30
Neil Trini Lasrado
dcef448f1e Planned Start Date added to Production Planning Tool 2015-07-13 12:41:28 +05:30
Neil Trini Lasrado
6224cfc414 Manage Variants added in Tools under Stock Module 2015-07-13 12:41:28 +05:30
Neil Trini Lasrado
700434ff37 has_variants made 'no copy' in Item Master 2015-07-13 12:41:28 +05:30
Neil Trini Lasrado
4089b3d376 Salary Slip renamed to Process Payroll 2015-07-13 12:41:28 +05:30
Neil Trini Lasrado
6cfab43d5f Renamed Depends on LWP field in the Earning and Deduction table of Salary Slip. 2015-07-13 12:41:27 +05:30
Neil Trini Lasrado
09a66c4201 Fixed issue with Customer Contacts in Transaction Documents 2015-07-13 12:41:27 +05:30
Neil Trini Lasrado
ed8cecbdd8 Sales BOM renamed to Product Bundle 2015-07-13 12:41:27 +05:30
Neil Trini Lasrado
c70109d0c5 Item table made mandatory in Stock Reconciliation 2015-07-13 12:40:57 +05:30
Neil Trini Lasrado
ccf8c337f7 Expected Delivery date validation changed to message 2015-07-13 12:40:57 +05:30
Nabin Hait
6809b4d86c Merge pull request #3636 from neilLasrado/po
Patch for Production Order Track Operation
2015-07-13 12:38:45 +05:30
Neil Trini Lasrado
cc08c68153 Patch for Production Order Track Operation 2015-07-13 12:35:20 +05:30
Nabin Hait
7daa7900ea Merge pull request #3614 from neilLasrado/po
Track Operations added to Production Order
2015-07-13 12:29:45 +05:30
Nabin Hait
7641f3fe53 Merge pull request #3635 from nabinhait/fix3
Reserved warehouse should not be validated on cancellation of sales order
2015-07-13 12:28:49 +05:30
Nabin Hait
fe2f51bbbc Merge pull request #3628 from nabinhait/sponsors
Change log and Sponsors page
2015-07-13 12:27:30 +05:30
Neil Trini Lasrado
4f33249e1c Fixes in Production Order 2015-07-13 12:26:33 +05:30
Nabin Hait
b95b606f25 sponsors page and change log 2015-07-13 12:26:24 +05:30
Nabin Hait
e690f245f2 Change log and Sponsors page 2015-07-13 12:26:24 +05:30
Neil Trini Lasrado
5da4d857c9 Track Operations added to Production Order 2015-07-13 12:01:57 +05:30
Nabin Hait
6e38e917eb Reserved warehouse should not be validated on cancellation of sales order 2015-07-13 11:36:36 +05:30
Rushabh Mehta
f3b0b95b15 [fix] [filter] for general ledger 2015-07-13 10:24:25 +05:30
Nabin Hait
7b0f1ffb2d Merge pull request #3627 from nabinhait/fix2
PP Tool: Create production order if applicable for item
2015-07-10 17:32:16 +05:30
Nabin Hait
97bb6bbaf4 Merge pull request #3621 from neilLasrado/batch
Validation added to prevent adding items with expired batch numbers t…
2015-07-10 17:31:52 +05:30
Neil Trini Lasrado
cb4b2ec52a Fixes in validate baatch function 2015-07-10 17:31:06 +05:30
Nabin Hait
f18bbcef86 PP Tool: Create production order if applicable for item 2015-07-10 17:31:03 +05:30
Nabin Hait
27976382d8 Merge pull request #3626 from nabinhait/credit_days
minor fix in due date validation
2015-07-10 17:13:15 +05:30
Nabin Hait
93d3c82737 minor fix in due date validation 2015-07-10 17:12:08 +05:30
Neil Trini Lasrado
03bf529622 Validation added to prevent adding items with expired batch numbers to stock ledger entry 2015-07-10 16:20:21 +05:30
Nabin Hait
6c4085fc0c Merge pull request #3616 from nabinhait/credit_days
Customer's credit days based on fixed days / last day of the next month
2015-07-10 16:16:14 +05:30
Nabin Hait
c37484c8da Merge pull request #3622 from rmehta/minor-fixes
[fix] cart and general leger report
2015-07-10 16:12:01 +05:30
Rushabh Mehta
b4ec294463 Merge pull request #3625 from neilLasrado/task
Validation added to prevent task being closed with open dependent tasks
2015-07-10 14:30:46 +05:30
Neil Trini Lasrado
58406a920c Validation added to prevent task being closed with open dependent tasks 2015-07-10 12:57:49 +05:30
Rushabh Mehta
98311f4394 Merge pull request #3624 from pdvyas/lang
Fix lang code for česky and update translations
2015-07-10 12:37:31 +05:30
Pratik Vyas
53829707ad Fix lang code for česky 2015-07-10 12:05:53 +05:30
Pratik Vyas
fcc31028c6 Update translations 2015-07-10 12:05:24 +05:30
Rushabh Mehta
fc3d87181a [fix] cart and general leger report 2015-07-10 10:11:07 +05:30
Nabin Hait
6336ff7323 minor fixes 2015-07-09 19:48:21 +05:30
Nabin Hait
fde13e666a Merge pull request #3609 from rmehta/address-link
[fix] link address via owner, if created in portal #3540
2015-07-09 19:09:39 +05:30
Nabin Hait
f80c09290e Merge pull request #3610 from nabinhait/variants
Adding rows not allowed in Variant table in Manage Variants and Item
2015-07-09 19:07:56 +05:30
Nabin Hait
b797963bd8 Merge pull request #3618 from neilLasrado/naming
Validation added in Production Order
2015-07-09 18:53:39 +05:30
Nabin Hait
03b42a7934 Merge pull request #3619 from neilLasrado/contact
Allowed same contact to be Linked to Customer AND Supplier AND Sales …
2015-07-09 18:52:22 +05:30
Nabin Hait
7e9ff99a6c Merge pull request #3620 from nabinhait/currency_symbol
Currency symbol fixed in sales invoice outstanding and advance amount
2015-07-09 18:51:38 +05:30
Nabin Hait
5cbe3441e8 Reload doctype in patch 2015-07-09 18:42:15 +05:30
Nabin Hait
0724449d0e [patch] Set 'Credit days based on' in existing customer, customer group and company 2015-07-09 17:49:50 +05:30
Neil Trini Lasrado
5a6ff218e8 Allowed same contact to be Linked to Customer AND Supplier AND Sales Partner 2015-07-09 17:49:40 +05:30
Nabin Hait
122e4e0a96 Currency symbol fixed in sales invoice outstanding and advance amount 2015-07-09 17:36:58 +05:30
Neil Trini Lasrado
e233f0e2ff Validation added in Production Order to prevent PO against Item Template or if Allow PO is No in Item Master 2015-07-09 17:35:51 +05:30
Nabin Hait
40e92b679b Posting date trigger function commonified 2015-07-09 17:12:23 +05:30
Nabin Hait
4770a1abb5 Customer's credit days based on fixed days / last day of the next month 2015-07-09 16:35:53 +05:30
Rushabh Mehta
ccb9117ba5 [minor] Added employees in Newsletter List 2015-07-09 13:56:02 +05:30
Nabin Hait
db938762c7 [fix] Adding rows not allowed in Variant table in Manage Variants and Item form 2015-07-09 11:55:38 +05:30
Nabin Hait
0910fc3b25 Merge pull request #3605 from nabinhait/testcases
Test case fixed
2015-07-09 11:28:36 +05:30
Rushabh Mehta
f0737667c6 [fix] link address via owner, if created in portal #3540 2015-07-09 11:09:01 +05:30
Nabin Hait
2d83122c6b removed client side test cases 2015-07-08 18:02:42 +05:30
Nabin Hait
e2b7f832cc Test case fixed 2015-07-08 17:56:06 +05:30
Nabin Hait
6a6958db5c Merge branch 'develop' 2015-07-08 16:53:55 +05:30
Nabin Hait
ab1acb460b bumped to version 5.1.4 2015-07-08 17:23:55 +06:00
Nabin Hait
48d71fa7f7 Merge pull request #3602 from nabinhait/develop
Change log
2015-07-08 16:47:14 +05:30
Nabin Hait
30960e6a06 Change log added 2015-07-08 16:46:28 +05:30
Nabin Hait
736000c223 Merge pull request #3600 from neilLasrado/batch
Fixed issues in Expired Batches while making Stock Entry
2015-07-08 16:10:21 +05:30
Nabin Hait
4017bfcd2e Merge pull request #3591 from rmehta/salary-manager-fix
[fixes] salary manager #3554
2015-07-08 15:39:33 +05:30
Nabin Hait
e594e5de49 Merge pull request #3596 from neilLasrado/pos
Mode of Payment added to POS Profile
2015-07-08 15:36:30 +05:30
Nabin Hait
1f1f14be39 Merge pull request #3599 from nabinhait/develop
Multiple fixes
2015-07-08 15:33:57 +05:30
Neil Trini Lasrado
ebb60f5dbc Fixed issues in Expired Batches while making Stock Entry 2015-07-08 15:24:02 +05:30
Neil Trini Lasrado
75b00e3958 Mode of Payment added to POS Profile 2015-07-08 14:43:47 +05:30
Nabin Hait
5e3646ad6e validation message fix 2015-07-08 14:39:03 +05:30
Nabin Hait
4439d8264f minor fix 2015-07-08 14:32:56 +05:30
Nabin Hait
00d79eb68d minor fix 2015-07-08 14:32:27 +05:30
Nabin Hait
28a9e35de9 Validate item rate with reference document with tolerance 0.009 2015-07-08 13:10:59 +05:30
Nabin Hait
c450536a2c [fix] Map values in Debit / Credit Note from Stock Entry 2015-07-08 13:10:59 +05:30
Nabin Hait
3b3c48c877 [fix] Set Customer name in opportunity as per company name in lead 2015-07-08 13:10:59 +05:30
Rushabh Mehta
621d6eac3c [minor] added calendar hooks 2015-07-08 12:39:27 +05:30
Rushabh Mehta
f9b356992a [fixes] salary manager #3554 2015-07-07 16:30:29 +05:30
Rushabh Mehta
9624bac3cf [fix] create SMS Log 2015-05-20 15:48:58 +05:30
721 changed files with 174090 additions and 72288 deletions

View File

@@ -15,7 +15,6 @@ install:
- wget https://raw.githubusercontent.com/frappe/bench/master/install_scripts/setup_frappe.sh
- sudo bash setup_frappe.sh --skip-setup-bench --mysql-root-password travis
- sudo pip install --upgrade pip
- sudo service redis-server start
- rm $TRAVIS_BUILD_DIR/.git/shallow
- cd ~/ && bench init frappe-bench --frappe-path https://github.com/frappe/frappe.git --frappe-branch develop
- cp -r $TRAVIS_BUILD_DIR/test_sites/test_site ~/frappe-bench/sites/
@@ -24,9 +23,13 @@ script:
- cd ~/frappe-bench
- bench get-app erpnext $TRAVIS_BUILD_DIR
- bench use test_site
- bench setup redis-cache
- bench setup redis-async-broker
- bench setup procfile --with-celery-broker
- bench reinstall
- bench build
- bench build-website
- bench serve &
- bench start &
- sleep 10
- bench --verbose run-tests --driver Firefox

View File

@@ -1,5 +1,9 @@
# Contributing to Frappe / ERPNext
## Questions
If you have questions on how to use ERPNext or want help in customization or debugging of your scripts, please post on https://discuss.erpnext.com. This is only for bug reports and feature requests.
## Reporting issues
We only accept issues that are bug reports or feature requests. Bugs must be isolated and reproducible problems. Please read the following guidelines before opening any issue.
@@ -45,6 +49,20 @@ DocTypes are easy to create but hard to maintain. If you find that there is a an
Tabs!
#### Release Checklist
- Describe, in detail, what is in the pull request
- How to use the new feature?
- Test cases
- Change log
- Manual Pull Request Link
- Screencast. Should include:
- New Forms
- Linked Forms
- Linked Reports
- Print Views
### Copyright
Please see README.md

View File

@@ -1,6 +1,6 @@
# ERPNext - Open source ERP for small and medium-size business [![Build Status](https://travis-ci.org/frappe/erpnext.png)](https://travis-ci.org/frappe/erpnext)
# ERPNext - ERP made simple
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/frappe/erpnext?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Build Status](https://travis-ci.org/frappe/erpnext.png)](https://travis-ci.org/frappe/erpnext) [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/frappe/erpnext?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[https://erpnext.com](https://erpnext.com)
@@ -10,13 +10,13 @@ ERPNext is built on the [Frappe](https://github.com/frappe/frappe) Framework, a
- [User Guide](https://manual.erpnext.com)
- [Getting Help](http://erpnext.org/getting-help.html)
- [Discussion Forum](https://discuss.frappe.io/)
- [Discussion Forum](https://discuss.erpnext.com/)
---
### Full Install
The Easy Way install script for bench will install all dependencies (e.g. MariaDB). See https://github.com/frappe/bench
The Easy Way: our install script for bench will install all dependencies (e.g. MariaDB). See https://github.com/frappe/bench for more details.
New passwords will be created for the ERPNext "Administrator" user, the MariaDB root user, and the frappe user (the script displays the passwords and saves them to ~/frappe_passwords.txt).
@@ -71,6 +71,6 @@ We do not allow the use of the trademark in advertising, including AdSense/AdWor
Please note that it is not the goal of this policy to limit commercial activity around ERPNext. We encourage ERPNext-based businesses, and we would love to see hundreds of them.
When in doubt about your use of the ERPNext name or logo, please contact the Frappe Technologies for clarification.
When in doubt about your use of the ERPNext name or logo, please contact Frappe Technologies for clarification.
(inspired from WordPress)
(inspired by WordPress)

View File

@@ -1,2 +1,2 @@
from __future__ import unicode_literals
__version__ = '5.1.3'
__version__ = '6.6.3'

View File

@@ -3,29 +3,63 @@
"allow_import": 1,
"allow_rename": 1,
"creation": "2013-01-30 12:49:46",
"custom": 0,
"description": "Heads (or groups) against which Accounting Entries are made and balances are maintained.",
"docstatus": 0,
"doctype": "DocType",
"document_type": "Master",
"document_type": "Setup",
"fields": [
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "properties",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "",
"no_copy": 0,
"oldfieldtype": "Section Break",
"permlevel": 0
"permlevel": 0,
"print_hide": 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_break0",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0,
"width": "50%"
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "account_name",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 1,
"in_list_view": 1,
"label": "Account Name",
@@ -33,147 +67,366 @@
"oldfieldname": "account_name",
"oldfieldtype": "Data",
"permlevel": 0,
"print_hide": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 1,
"search_index": 0
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"default": "0",
"fieldname": "is_group",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Is Group",
"no_copy": 0,
"permlevel": 0,
"precision": "",
"search_index": 0
"print_hide": 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": "company",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 1,
"in_list_view": 0,
"label": "Company",
"no_copy": 0,
"oldfieldname": "company",
"oldfieldtype": "Link",
"options": "Company",
"permlevel": 0,
"print_hide": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 1,
"search_index": 0
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "root_type",
"fieldtype": "Select",
"label": "Root Type",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Root Type",
"no_copy": 0,
"options": "\nAsset\nLiability\nIncome\nExpense\nEquity",
"permlevel": 0,
"read_only": 1
"print_hide": 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": "report_type",
"fieldtype": "Select",
"label": "Report Type",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Report Type",
"no_copy": 0,
"options": "\nBalance Sheet\nProfit and Loss",
"permlevel": 0,
"read_only": 1
"print_hide": 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,
"depends_on": "eval:doc.is_group==0",
"fieldname": "account_currency",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Currency",
"no_copy": 0,
"options": "Currency",
"permlevel": 0,
"precision": "",
"print_hide": 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_break1",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0,
"width": "50%"
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "parent_account",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 1,
"in_filter": 0,
"in_list_view": 0,
"label": "Parent Account",
"no_copy": 0,
"oldfieldname": "parent_account",
"oldfieldtype": "Link",
"options": "Account",
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 1
"search_index": 1,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "Setting Account Type helps in selecting this Account in transactions.",
"fieldname": "account_type",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 1,
"label": "Account Type",
"in_list_view": 0,
"label": "Account Type",
"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",
"permlevel": 0,
"search_index": 0
"print_hide": 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,
"description": "Rate at which this tax is applied",
"fieldname": "tax_rate",
"fieldtype": "Float",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Rate",
"no_copy": 0,
"oldfieldname": "tax_rate",
"oldfieldtype": "Currency",
"permlevel": 0,
"reqd": 0
"print_hide": 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,
"description": "If the account is frozen, entries are allowed to restricted users.",
"fieldname": "freeze_account",
"fieldtype": "Select",
"label": "Frozen",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Frozen",
"no_copy": 0,
"oldfieldname": "freeze_account",
"oldfieldtype": "Select",
"options": "No\nYes",
"permlevel": 0
"permlevel": 0,
"print_hide": 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": "warehouse",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Warehouse",
"no_copy": 0,
"options": "Warehouse",
"permlevel": 0
"permlevel": 0,
"print_hide": 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": "balance_must_be",
"fieldtype": "Select",
"label": "Balance must be",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Balance must be",
"no_copy": 0,
"options": "\nDebit\nCredit",
"permlevel": 0
"permlevel": 0,
"print_hide": 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": "lft",
"fieldtype": "Int",
"hidden": 1,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Lft",
"no_copy": 0,
"permlevel": 0,
"print_hide": 1,
"read_only": 1,
"search_index": 1
"report_hide": 0,
"reqd": 0,
"search_index": 1,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "rgt",
"fieldtype": "Int",
"hidden": 1,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Rgt",
"no_copy": 0,
"permlevel": 0,
"print_hide": 1,
"read_only": 1,
"search_index": 1
"report_hide": 0,
"reqd": 0,
"search_index": 1,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "old_parent",
"fieldtype": "Data",
"hidden": 1,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Old Parent",
"no_copy": 0,
"permlevel": 0,
"print_hide": 1,
"read_only": 1
"read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
}
],
"hide_heading": 0,
"hide_toolbar": 0,
"icon": "icon-money",
"idx": 1,
"in_create": 0,
"modified": "2015-06-14 20:57:55.471334",
"in_dialog": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 0,
"modified": "2015-10-02 07:38:37.436071",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Account",
@@ -181,70 +434,93 @@
"permissions": [
{
"amend": 0,
"apply_user_permissions": 1,
"apply_user_permissions": 0,
"cancel": 0,
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"if_owner": 0,
"import": 1,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Accounts User",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"write": 1
},
{
"amend": 0,
"apply_user_permissions": 1,
"apply_user_permissions": 0,
"cancel": 0,
"create": 0,
"delete": 0,
"email": 1,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Auditor",
"submit": 0,
"write": 0
},
{
"amend": 0,
"apply_user_permissions": 1,
"create": 0,
"delete": 0,
"email": 1,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Sales User",
"submit": 0,
"write": 0
},
{
"amend": 0,
"apply_user_permissions": 1,
"create": 0,
"delete": 0,
"email": 1,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Purchase User",
"set_user_permissions": 0,
"share": 0,
"submit": 0,
"write": 0
},
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 0,
"delete": 0,
"email": 1,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Sales User",
"set_user_permissions": 0,
"share": 0,
"submit": 0,
"write": 0
},
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 0,
"delete": 0,
"email": 1,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Purchase User",
"set_user_permissions": 0,
"share": 0,
"submit": 0,
"write": 0
},
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"if_owner": 0,
"import": 1,
"permlevel": 0,
"print": 1,
@@ -257,5 +533,7 @@
"write": 1
}
],
"search_fields": "is_group"
"read_only": 0,
"read_only_onload": 0,
"search_fields": ""
}

View File

@@ -7,6 +7,8 @@ from frappe.utils import cstr, cint
from frappe import throw, _
from frappe.model.document import Document
class RootNotEditable(frappe.ValidationError): pass
class Account(Document):
nsm_parent_field = 'parent_account'
@@ -23,16 +25,18 @@ class Account(Document):
def validate(self):
self.validate_parent()
self.validate_root_details()
self.set_root_and_report_type()
self.validate_mandatory()
self.validate_warehouse_account()
self.validate_frozen_accounts_modifier()
self.validate_balance_must_be_debit_or_credit()
self.validate_account_currency()
def validate_parent(self):
"""Fetch Parent Details and validate parent account"""
if self.parent_account:
par = frappe.db.get_value("Account", self.parent_account,
["name", "is_group", "report_type", "root_type", "company"], as_dict=1)
["name", "is_group", "company"], as_dict=1)
if not par:
throw(_("Account {0}: Parent account {1} does not exist").format(self.name, self.parent_account))
elif par.name == self.name:
@@ -43,16 +47,30 @@ class Account(Document):
throw(_("Account {0}: Parent account {1} does not belong to company: {2}")
.format(self.name, self.parent_account, self.company))
def set_root_and_report_type(self):
if self.parent_account:
par = frappe.db.get_value("Account", self.parent_account, ["report_type", "root_type"], as_dict=1)
if par.report_type:
self.report_type = par.report_type
if par.root_type:
self.root_type = par.root_type
if self.is_group:
db_value = frappe.db.get_value("Account", self.name, ["report_type", "root_type"], as_dict=1)
if db_value:
if self.report_type != db_value.report_type:
frappe.db.sql("update `tabAccount` set report_type=%s where lft > %s and rgt < %s",
(self.report_type, self.lft, self.rgt))
if self.root_type != db_value.root_type:
frappe.db.sql("update `tabAccount` set root_type=%s where lft > %s and rgt < %s",
(self.root_type, self.lft, self.rgt))
def validate_root_details(self):
#does not exists parent
# does not exists parent
if frappe.db.exists("Account", self.name):
if not frappe.db.get_value("Account", self.name, "parent_account"):
throw(_("Root cannot be edited."))
throw(_("Root cannot be edited."), RootNotEditable)
def validate_frozen_accounts_modifier(self):
old_value = frappe.db.get_value("Account", self.name, "freeze_account")
@@ -72,6 +90,14 @@ class Account(Document):
elif account_balance < 0 and self.balance_must_be == "Debit":
frappe.throw(_("Account balance already in Credit, you are not allowed to set 'Balance Must Be' as 'Debit'"))
def validate_account_currency(self):
if not self.account_currency:
self.account_currency = frappe.db.get_value("Company", self.company, "default_currency")
elif self.account_currency != frappe.db.get_value("Account", self.name, "account_currency"):
if frappe.db.get_value("GL Entry", {"account": self.name}):
frappe.throw(_("Currency can not be changed after making entries using some other currency"))
def convert_group_to_ledger(self):
if self.check_if_child_exists():
throw(_("Account with child nodes cannot be converted to ledger"))
@@ -181,3 +207,16 @@ def get_parent_account(doctype, txt, searchfield, start, page_len, filters):
and %s like %s order by name limit %s, %s""" %
("%s", searchfield, "%s", "%s", "%s"),
(filters["company"], "%%%s%%" % txt, start, page_len), as_list=1)
def get_account_currency(account):
"""Helper function to get account currency"""
if not account:
return
def generator():
account_currency, company = frappe.db.get_value("Account", account, ["account_currency", "company"])
if not account_currency:
account_currency = frappe.db.get_value("Company", company, "default_currency")
return account_currency
return frappe.local_cache("account_currency", account, generator)

View File

@@ -36,7 +36,8 @@ def create_charts(chart_name, company):
"is_group": is_group,
"root_type": root_type,
"report_type": report_type,
"account_type": child.get("account_type")
"account_type": child.get("account_type"),
"account_currency": frappe.db.get_value("Company", company, "default_currency")
})
if root_account:
@@ -92,13 +93,13 @@ def get_charts_for_country(country):
with open(os.path.join(path, fname), "r") as f:
_get_chart_name(f.read())
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())
# 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())
if len(charts) != 1:
charts.append("Standard")

View File

@@ -0,0 +1,90 @@
{
"country_code": "gt",
"name": "Cuentas de Guatemala",
"is_active": "Yes",
"tree": {
"Activos": {
"Activo Corriente": {
"Caja y Bancos": {},
"Cuentas por Cobrar": {},
"Impuestos por Cobrar": {
"IVA por Cobrar": {},
"Retenciones de IVA recibidas": {}
},
"Inventario": {}
},
"No Corriente": {
"Activos Fijos": {},
"Cargos Diferidos": {}
},
"root_type": "Asset"
},
"Pasivos": {
"Pasivo Corriente": {
"Proveedores": {
"Inventario Recibido pero No Cobrado": {
"account_type": "Stock Received But Not Billed"
}
},
"Impuestos por Pagar": {},
"Sueldos por Liquidar": {},
"Prestaciones": {},
"Cuentas por Pagar": {},
"Otras Cuentas por Pagar": {},
"Acreedores": {}
},
"Pasivo No Corriente": {
"Provisión para Indemnizaciones": {},
"Acreedores": {}
},
"root_type": "Liability"
},
"Patrimonio": {
"Capital": {},
"Utilidades Retenidas": {},
"Resultados del Ejercicio": {},
"root_type": "Asset"
},
"Costos": {
"Costo de Ventas": {},
"Costos Incluidos en la Valuación": {
"account_type": "Expenses Included In Valuation"
},
"Stock Adjustment": {
"account_type": "Stock Adjustment"
},
"root_type": "Expense"
},
"Gastos": {
"Gastos de Personal": {},
"Honorarios Profesionales": {},
"Servicios Básicos": {},
"Alquileres": {},
"Seguros": {},
"Mantenimiento": {},
"Depreciaciones": {},
"Gastos Diversos": {},
"root_type": "Expense"
},
"Ingresos": {
"Productos": {},
"Servicios": {},
"root_type": "Income"
},
"Otros Gastos y Productos Financieros": {
"Otros Ingresos": {
"Otros Gastos y Productos Financieros": {
"Intereses": {},
"Otros Gastos Financieros": {}
}
},
"Otros Gastos": {
"Otros Gastos y Productos Financieros": {
"Intereses": {},
"Otros Gastos Financieros": {}
}
},
"root_type": "Expense"
}
}
}

View File

@@ -9,36 +9,39 @@ def _make_test_records(verbose):
accounts = [
# [account_name, parent_account, is_group]
["_Test Account Bank Account", "Bank Accounts", 0, "Bank"],
["_Test Bank", "Bank Accounts", 0, "Bank", None],
["_Test Bank USD", "Bank Accounts", 0, "Bank", "USD"],
["_Test Bank EUR", "Bank Accounts", 0, "Bank", "EUR"],
["_Test Account Stock Expenses", "Direct Expenses", 1, None],
["_Test Account Shipping Charges", "_Test Account Stock Expenses", 0, "Chargeable"],
["_Test Account Customs Duty", "_Test Account Stock Expenses", 0, "Tax"],
["_Test Account Insurance Charges", "_Test Account Stock Expenses", 0, "Chargeable"],
["_Test Account Stock Adjustment", "_Test Account Stock Expenses", 0, "Stock Adjustment"],
["_Test Account Stock Expenses", "Direct Expenses", 1, None, None],
["_Test Account Shipping Charges", "_Test Account Stock Expenses", 0, "Chargeable", None],
["_Test Account Customs Duty", "_Test Account Stock Expenses", 0, "Tax", None],
["_Test Account Insurance Charges", "_Test Account Stock Expenses", 0, "Chargeable", None],
["_Test Account Stock Adjustment", "_Test Account Stock Expenses", 0, "Stock Adjustment", None],
["_Test Account Tax Assets", "Current Assets", 1, None, None],
["_Test Account VAT", "_Test Account Tax Assets", 0, "Tax", None],
["_Test Account Service Tax", "_Test Account Tax Assets", 0, "Tax", None],
["_Test Account Tax Assets", "Current Assets", 1, None],
["_Test Account VAT", "_Test Account Tax Assets", 0, "Tax"],
["_Test Account Service Tax", "_Test Account Tax Assets", 0, "Tax"],
["_Test Account Reserves and Surplus", "Current Liabilities", 0, None, None],
["_Test Account Reserves and Surplus", "Current Liabilities", 0, None],
["_Test Account Cost for Goods Sold", "Expenses", 0, None],
["_Test Account Excise Duty", "_Test Account Tax Assets", 0, "Tax"],
["_Test Account Education Cess", "_Test Account Tax Assets", 0, "Tax"],
["_Test Account S&H Education Cess", "_Test Account Tax Assets", 0, "Tax"],
["_Test Account CST", "Direct Expenses", 0, "Tax"],
["_Test Account Discount", "Direct Expenses", 0, None],
["_Test Write Off", "Indirect Expenses", 0, None],
["_Test Account Cost for Goods Sold", "Expenses", 0, None, None],
["_Test Account Excise Duty", "_Test Account Tax Assets", 0, "Tax", None],
["_Test Account Education Cess", "_Test Account Tax Assets", 0, "Tax", None],
["_Test Account S&H Education Cess", "_Test Account Tax Assets", 0, "Tax", None],
["_Test Account CST", "Direct Expenses", 0, "Tax", None],
["_Test Account Discount", "Direct Expenses", 0, None, None],
["_Test Write Off", "Indirect Expenses", 0, None, None],
# related to Account Inventory Integration
["_Test Account Stock In Hand", "Current Assets", 0, None],
["_Test Account Fixed Assets", "Current Assets", 0, None],
["_Test Account Stock In Hand", "Current Assets", 0, None, None],
["_Test Account Fixed Assets", "Current Assets", 0, None, None],
# Receivable / Payable Account
["_Test Receivable", "Current Assets", 0, "Receivable"],
["_Test Payable", "Current Liabilities", 0, "Payable"],
["_Test Receivable", "Current Assets", 0, "Receivable", None],
["_Test Payable", "Current Liabilities", 0, "Payable", None],
["_Test Receivable USD", "Current Assets", 0, "Receivable", "USD"],
["_Test Payable USD", "Current Liabilities", 0, "Payable", "USD"]
]
for company, abbr in [["_Test Company", "_TC"], ["_Test Company 1", "_TC1"]]:
@@ -48,7 +51,8 @@ def _make_test_records(verbose):
"parent_account": parent_account + " - " + abbr,
"company": company,
"is_group": is_group,
"account_type": account_type
} for account_name, parent_account, is_group, account_type in accounts])
"account_type": account_type,
"account_currency": currency
} for account_name, parent_account, is_group, account_type, currency in accounts])
return test_objects

View File

@@ -1,70 +1,163 @@
{
"allow_copy": 0,
"allow_import": 0,
"allow_rename": 0,
"creation": "2013-06-24 15:49:57",
"custom": 0,
"description": "Settings for Accounts",
"docstatus": 0,
"doctype": "DocType",
"fields": [
{
"fieldname": "check_supplier_invoice_uniqueness",
"fieldtype": "Check",
"label": "Check Supplier Invoice Number Uniqueness",
"permlevel": 0,
"precision": ""
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"default": "1",
"description": "If enabled, the system will post accounting entries for inventory automatically.",
"fieldname": "auto_accounting_for_stock",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Make Accounting Entry For Every Stock Movement",
"permlevel": 0
"no_copy": 0,
"permlevel": 0,
"print_hide": 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,
"description": "Accounting entry frozen up to this date, nobody can do / modify entry except role specified below.",
"fieldname": "acc_frozen_upto",
"fieldtype": "Date",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Accounts Frozen Upto",
"permlevel": 0
"no_copy": 0,
"permlevel": 0,
"print_hide": 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,
"description": "Users with this role are allowed to set frozen accounts and create / modify accounting entries against frozen accounts",
"fieldname": "frozen_accounts_modifier",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Role Allowed to Set Frozen Accounts & Edit Frozen Entries",
"no_copy": 0,
"options": "Role",
"permlevel": 0
"permlevel": 0,
"print_hide": 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,
"description": "Role that is allowed to submit transactions that exceed credit limits set.",
"fieldname": "credit_controller",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Credit Controller",
"no_copy": 0,
"options": "Role",
"permlevel": 0
"permlevel": 0,
"print_hide": 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": "check_supplier_invoice_uniqueness",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Check Supplier Invoice Number Uniqueness",
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
}
],
"hide_heading": 0,
"hide_toolbar": 0,
"icon": "icon-cog",
"idx": 1,
"in_create": 0,
"in_dialog": 0,
"is_submittable": 0,
"issingle": 1,
"modified": "2015-06-11 06:06:34.047890",
"istable": 0,
"modified": "2015-07-14 00:51:48.095525",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Accounts Settings",
"owner": "Administrator",
"permissions": [
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 1,
"delete": 0,
"email": 1,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 0,
"role": "Accounts Manager",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"write": 1
}
]
],
"read_only": 0,
"read_only_onload": 0
}

View File

@@ -16,7 +16,9 @@ class AccountsSettings(Document):
if cint(self.auto_accounting_for_stock):
# set default perpetual account in company
for company in frappe.db.sql("select name from tabCompany"):
frappe.get_doc("Company", company[0]).save()
company = frappe.get_doc("Company", company[0])
company.flags.ignore_permissions = True
company.save()
# Create account head for warehouses
warehouse_list = frappe.db.sql("select name, company from tabWarehouse", as_dict=1)
@@ -25,4 +27,5 @@ class AccountsSettings(Document):
frappe.throw(_("Company is missing in warehouses {0}").format(comma_and(warehouse_with_no_company)))
for wh in warehouse_list:
wh_doc = frappe.get_doc("Warehouse", wh.name)
wh_doc.flags.ignore_permissions = True
wh_doc.save()

View File

@@ -1,90 +1,218 @@
{
"allow_copy": 1,
"allow_email": 1,
"allow_print": 1,
"allow_import": 0,
"allow_rename": 0,
"creation": "2013-01-10 16:34:05",
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"fields": [
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "Select account head of the bank where cheque was deposited.",
"fieldname": "bank_account",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Bank Account",
"no_copy": 0,
"options": "Account",
"permlevel": 0,
"reqd": 1
"print_hide": 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": "company",
"fieldtype": "Link",
"hidden": 1,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Company",
"no_copy": 0,
"options": "Company",
"permlevel": 0,
"print_hide": 1,
"reqd": 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": "from_date",
"fieldtype": "Date",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "From Date",
"no_copy": 0,
"permlevel": 0,
"reqd": 1
"print_hide": 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": "to_date",
"fieldtype": "Date",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "To Date",
"no_copy": 0,
"permlevel": 0,
"reqd": 1
"print_hide": 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": "include_reconciled_entries",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Include Reconciled Entries",
"permlevel": 0
"no_copy": 0,
"permlevel": 0,
"print_hide": 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": "get_relevant_entries",
"fieldtype": "Button",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Get Relevant Entries",
"no_copy": 0,
"options": "",
"permlevel": 0
"permlevel": 0,
"print_hide": 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": "journal_entries",
"fieldtype": "Table",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Journal Entries",
"no_copy": 0,
"options": "Bank Reconciliation Detail",
"permlevel": 0
"permlevel": 0,
"print_hide": 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": "update_clearance_date",
"fieldtype": "Button",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Update Clearance Date",
"no_copy": 0,
"options": "",
"permlevel": 0
"permlevel": 0,
"print_hide": 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": "total_amount",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Total Amount",
"no_copy": 0,
"options": "Company:company:default_currency",
"permlevel": 0,
"read_only": 1
"print_hide": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
}
],
"hide_heading": 1,
"hide_toolbar": 1,
"icon": "icon-check",
"idx": 1,
"in_create": 0,
"in_dialog": 0,
"is_submittable": 0,
"issingle": 1,
"istable": 0,
"modified": "2015-02-05 05:11:34.776660",
"modified_by": "Administrator",
"module": "Accounts",
@@ -96,14 +224,22 @@
"apply_user_permissions": 0,
"cancel": 0,
"create": 1,
"delete": 0,
"email": 0,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 0,
"read": 1,
"report": 0,
"role": "Accounts User",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"write": 1
}
],
"read_only": 1
"read_only": 1,
"read_only_onload": 0
}

View File

@@ -19,7 +19,8 @@ class BankReconciliation(Document):
dl = frappe.db.sql("""select t1.name, t1.cheque_no, t1.cheque_date, t2.debit,
t2.credit, t1.posting_date, t2.against_account, t1.clearance_date
t2.credit, t1.posting_date, t2.against_account, t1.clearance_date,
t2.reference_type, t2.reference_name
from
`tabJournal Entry` t1, `tabJournal Entry Account` t2
where

View File

@@ -1,11 +1,21 @@
{
"allow_copy": 0,
"allow_import": 0,
"allow_rename": 0,
"creation": "2013-02-22 01:27:37",
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"fields": [
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "voucher_id",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Voucher ID",
"no_copy": 0,
@@ -13,46 +23,92 @@
"oldfieldtype": "Link",
"options": "Journal Entry",
"permlevel": 0,
"search_index": 0
"print_hide": 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": "clearance_date",
"fieldtype": "Date",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Clearance Date",
"no_copy": 0,
"oldfieldname": "clearance_date",
"oldfieldtype": "Date",
"permlevel": 0,
"search_index": 0
"print_hide": 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": "against_account",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Against Account",
"no_copy": 0,
"oldfieldname": "against_account",
"oldfieldtype": "Data",
"permlevel": 0,
"print_hide": 0,
"read_only": 1,
"search_index": 0
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "cheque_number",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Cheque Number",
"no_copy": 0,
"oldfieldname": "cheque_number",
"oldfieldtype": "Data",
"permlevel": 0,
"print_hide": 0,
"read_only": 1,
"search_index": 0
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "debit",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Debit",
"no_copy": 0,
@@ -60,12 +116,23 @@
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
"permlevel": 0,
"print_hide": 0,
"read_only": 1,
"search_index": 0
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "credit",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Credit",
"no_copy": 0,
@@ -73,40 +140,121 @@
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
"permlevel": 0,
"print_hide": 0,
"read_only": 1,
"search_index": 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_type",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Reference Type",
"no_copy": 0,
"options": "DocType",
"permlevel": 0,
"precision": "",
"print_hide": 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_name",
"fieldtype": "Dynamic Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Reference Name",
"no_copy": 0,
"options": "reference_type",
"permlevel": 0,
"precision": "",
"print_hide": 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": "posting_date",
"fieldtype": "Date",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Posting Date",
"no_copy": 0,
"oldfieldname": "posting_date",
"oldfieldtype": "Date",
"permlevel": 0,
"print_hide": 0,
"read_only": 1,
"search_index": 0
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "cheque_date",
"fieldtype": "Date",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Cheque Date",
"no_copy": 0,
"oldfieldname": "cheque_date",
"oldfieldtype": "Date",
"permlevel": 0,
"print_hide": 0,
"read_only": 1,
"search_index": 0
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
}
],
"hide_heading": 0,
"hide_toolbar": 0,
"idx": 1,
"in_create": 0,
"in_dialog": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 1,
"modified": "2015-04-21 01:29:29.570890",
"modified": "2015-10-02 07:38:39.149782",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Bank Reconciliation Detail",
"owner": "Administrator",
"permissions": []
"permissions": [],
"read_only": 0,
"read_only_onload": 0
}

View File

@@ -1,55 +1,102 @@
{
"allow_copy": 0,
"allow_import": 0,
"allow_rename": 0,
"autoname": "hash",
"creation": "2013-03-07 11:55:04",
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"fields": [
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "account",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 1,
"in_list_view": 1,
"label": "Account",
"no_copy": 0,
"oldfieldname": "account",
"oldfieldtype": "Link",
"options": "Account",
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 1
"search_index": 1,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "budget_allocated",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Budget Allocated",
"no_copy": 0,
"oldfieldname": "budget_allocated",
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
"permlevel": 0,
"reqd": 1
"print_hide": 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": "fiscal_year",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 1,
"in_list_view": 1,
"label": "Fiscal Year",
"no_copy": 0,
"oldfieldname": "fiscal_year",
"oldfieldtype": "Select",
"options": "Fiscal Year",
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 1
"search_index": 1,
"set_only_once": 0,
"unique": 0
}
],
"hide_heading": 0,
"hide_toolbar": 0,
"idx": 1,
"in_create": 0,
"in_dialog": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 1,
"modified": "2015-02-19 01:06:59.471417",
"modified": "2015-10-02 07:38:40.727468",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Budget Detail",
"owner": "Administrator",
"permissions": [],
"read_only": 0,
"read_only_onload": 0,
"sort_field": "modified",
"sort_order": "DESC"
}

View File

@@ -1,184 +1,416 @@
{
"allow_copy": 0,
"allow_import": 1,
"allow_rename": 0,
"autoname": "naming_series:",
"creation": "2013-03-07 11:55:06",
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"fields": [
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "column_break0",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_width": "50%",
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0,
"width": "50%"
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "naming_series",
"fieldtype": "Select",
"label": "Series",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Series",
"no_copy": 0,
"options": "C-FORM-",
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"reqd": 1
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "c_form_no",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "C-Form No",
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"reqd": 1
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "received_date",
"fieldtype": "Date",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Received Date",
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"reqd": 1
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "customer",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Customer",
"no_copy": 0,
"options": "Customer",
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"reqd": 1
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "column_break1",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_width": "50%",
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0,
"width": "50%"
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "company",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Company",
"no_copy": 0,
"options": "Company",
"permlevel": 0,
"read_only": 0
"print_hide": 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": "fiscal_year",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Fiscal Year",
"no_copy": 0,
"options": "Fiscal Year",
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"reqd": 1
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "quarter",
"fieldtype": "Select",
"label": "Quarter",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Quarter",
"no_copy": 0,
"options": "\nI\nII\nIII\nIV",
"permlevel": 0,
"read_only": 0
"print_hide": 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": "total_amount",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Total Amount",
"options": "Company:company:default_currency",
"permlevel": 0,
"read_only": 0,
"reqd": 1
},
{
"fieldname": "state",
"fieldtype": "Data",
"label": "State",
"permlevel": 0,
"read_only": 0,
"reqd": 1
},
{
"fieldname": "section_break0",
"fieldtype": "Section Break",
"permlevel": 0,
"read_only": 0
},
{
"fieldname": "invoices",
"fieldtype": "Table",
"label": "Invoices",
"options": "C-Form Invoice Detail",
"permlevel": 0,
"read_only": 0
},
{
"fieldname": "total_invoiced_amount",
"fieldtype": "Currency",
"label": "Total Invoiced Amount",
"no_copy": 0,
"options": "Company:company:default_currency",
"permlevel": 0,
"print_hide": 0,
"read_only": 1
"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": "state",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "State",
"no_copy": 0,
"permlevel": 0,
"print_hide": 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": "section_break0",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 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": "invoices",
"fieldtype": "Table",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Invoices",
"no_copy": 0,
"options": "C-Form Invoice Detail",
"permlevel": 0,
"print_hide": 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": "total_invoiced_amount",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Total Invoiced Amount",
"no_copy": 0,
"options": "Company:company:default_currency",
"permlevel": 0,
"print_hide": 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": "amended_from",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 1,
"in_filter": 0,
"in_list_view": 0,
"label": "Amended From",
"no_copy": 1,
"options": "C-Form",
"permlevel": 0,
"print_hide": 1,
"read_only": 1
"read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
}
],
"hide_heading": 0,
"hide_toolbar": 0,
"icon": "icon-file-text",
"idx": 1,
"in_create": 0,
"in_dialog": 0,
"is_submittable": 1,
"issingle": 0,
"istable": 0,
"max_attachments": 3,
"modified": "2015-02-05 05:11:35.427357",
"modified": "2015-10-02 07:38:40.926061",
"modified_by": "Administrator",
"module": "Accounts",
"name": "C-Form",
"owner": "Administrator",
"permissions": [
{
"apply_user_permissions": 1,
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 1,
"delete": 0,
"email": 1,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Accounts User",
"share": 1,
"submit": 0,
"write": 1
},
{
"create": 1,
"email": 1,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Accounts Manager",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"write": 1
},
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 1,
"delete": 0,
"email": 1,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Accounts Manager",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"write": 1
},
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 0,
"delete": 0,
"email": 0,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 1,
"print": 0,
"read": 1,
"report": 1,
"role": "All",
"submit": 0
"set_user_permissions": 0,
"share": 0,
"submit": 0,
"write": 0
}
]
],
"read_only": 0,
"read_only_onload": 0
}

View File

@@ -1,69 +1,147 @@
{
"allow_copy": 0,
"allow_import": 0,
"allow_rename": 0,
"creation": "2013-02-22 01:27:38",
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"fields": [
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "invoice_no",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Invoice No",
"no_copy": 0,
"options": "Sales Invoice",
"permlevel": 0,
"print_hide": 0,
"print_width": "160px",
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0,
"width": "160px"
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "invoice_date",
"fieldtype": "Date",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Invoice Date",
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_width": "120px",
"read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0,
"width": "120px"
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "",
"fieldname": "territory",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Territory",
"no_copy": 0,
"options": "Territory",
"permlevel": 0,
"print_hide": 0,
"print_width": "120px",
"read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0,
"width": "120px"
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "net_total",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Net Total",
"no_copy": 0,
"options": "Company:company:default_currency",
"permlevel": 0,
"print_hide": 0,
"print_width": "120px",
"read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0,
"width": "120px"
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "grand_total",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Grand Total",
"no_copy": 0,
"options": "Company:company:default_currency",
"permlevel": 0,
"print_hide": 0,
"print_width": "120px",
"read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0,
"width": "120px"
}
],
"hide_heading": 0,
"hide_toolbar": 0,
"idx": 1,
"in_create": 0,
"in_dialog": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 1,
"modified": "2015-01-01 14:29:58.597428",
"modified": "2015-10-02 07:38:41.105885",
"modified_by": "Administrator",
"module": "Accounts",
"name": "C-Form Invoice Detail",
"owner": "Administrator",
"permissions": []
"permissions": [],
"read_only": 0,
"read_only_onload": 0
}

View File

@@ -17,8 +17,7 @@ erpnext.accounts.CostCenterController = frappe.ui.form.Controller.extend({
return {
filters:[
['Account', 'company', '=', me.frm.doc.company],
['Account', 'report_type', '=', 'Profit and Loss'],
['Account', 'is_group', '=', '0'],
['Account', 'is_group', '=', '0']
]
}
});

View File

@@ -4,20 +4,41 @@
"allow_rename": 1,
"autoname": "field:cost_center_name",
"creation": "2013-01-23 19:57:17",
"custom": 0,
"description": "Track separate Income and Expense for product verticals or divisions.",
"docstatus": 0,
"doctype": "DocType",
"document_type": "Master",
"document_type": "Setup",
"fields": [
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "sb0",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "",
"permlevel": 0
"no_copy": 0,
"permlevel": 0,
"print_hide": 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": "cost_center_name",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Cost Center Name",
@@ -25,107 +46,234 @@
"oldfieldname": "cost_center_name",
"oldfieldtype": "Data",
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "parent_cost_center",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 1,
"in_filter": 0,
"in_list_view": 1,
"label": "Parent Cost Center",
"no_copy": 0,
"oldfieldname": "parent_cost_center",
"oldfieldtype": "Link",
"options": "Cost Center",
"permlevel": 0,
"reqd": 1
"print_hide": 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": "company",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Company",
"no_copy": 0,
"oldfieldname": "company_name",
"oldfieldtype": "Link",
"options": "Company",
"permlevel": 0,
"reqd": 1
"print_hide": 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": "cb0",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0,
"width": "50%"
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"default": "0",
"fieldname": "is_group",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Is Group",
"no_copy": 0,
"permlevel": 0,
"precision": ""
"precision": "",
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"description": "Define Budget for this Cost Center. To set budget action, see <a href=\"#!List/Company\">Company Master</a>",
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "Define Budget for this Cost Center. To set budget action, see \"Company List\"",
"fieldname": "sb1",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Budget",
"permlevel": 0
"no_copy": 0,
"permlevel": 0,
"print_hide": 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,
"description": "Select Monthly Distribution, if you want to track based on seasonality.",
"fieldname": "distribution_id",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Distribution Id",
"no_copy": 0,
"oldfieldname": "distribution_id",
"oldfieldtype": "Link",
"options": "Monthly Distribution",
"permlevel": 0
"permlevel": 0,
"print_hide": 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,
"description": "Add rows to set annual budgets on Accounts.",
"fieldname": "budgets",
"fieldtype": "Table",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Budgets",
"no_copy": 0,
"oldfieldname": "budget_details",
"oldfieldtype": "Table",
"options": "Budget Detail",
"permlevel": 0
"permlevel": 0,
"print_hide": 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": "lft",
"fieldtype": "Int",
"hidden": 1,
"ignore_user_permissions": 0,
"in_filter": 1,
"in_list_view": 0,
"label": "lft",
"no_copy": 1,
"oldfieldname": "lft",
"oldfieldtype": "Int",
"permlevel": 0,
"print_hide": 1,
"read_only": 0,
"report_hide": 1,
"search_index": 1
"reqd": 0,
"search_index": 1,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "rgt",
"fieldtype": "Int",
"hidden": 1,
"ignore_user_permissions": 0,
"in_filter": 1,
"in_list_view": 0,
"label": "rgt",
"no_copy": 1,
"oldfieldname": "rgt",
"oldfieldtype": "Int",
"permlevel": 0,
"print_hide": 1,
"read_only": 0,
"report_hide": 1,
"reqd": 0,
"search_index": 1
"search_index": 1,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "old_parent",
"fieldtype": "Link",
"hidden": 1,
"ignore_user_permissions": 1,
"in_filter": 0,
"in_list_view": 0,
"label": "old_parent",
"no_copy": 1,
"oldfieldname": "old_parent",
@@ -133,13 +281,24 @@
"options": "Cost Center",
"permlevel": 0,
"print_hide": 1,
"report_hide": 1
"read_only": 0,
"report_hide": 1,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
}
],
"hide_heading": 0,
"hide_toolbar": 0,
"icon": "icon-money",
"idx": 1,
"in_create": 0,
"modified": "2015-04-23 02:54:26.934607",
"in_dialog": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 0,
"modified": "2015-10-02 07:38:42.617993",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Cost Center",
@@ -147,50 +306,106 @@
"permissions": [
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 1,
"delete": 1,
"email": 1,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Accounts Manager",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"write": 1
},
{
"amend": 0,
"apply_user_permissions": 1,
"apply_user_permissions": 0,
"cancel": 0,
"create": 0,
"delete": 0,
"email": 1,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Accounts User",
"set_user_permissions": 0,
"share": 0,
"submit": 0,
"write": 0
},
{
"apply_user_permissions": 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,
"role": "Sales User"
"report": 0,
"role": "Sales User",
"set_user_permissions": 0,
"share": 0,
"submit": 0,
"write": 0
},
{
"apply_user_permissions": 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,
"role": "Purchase User"
"report": 0,
"role": "Purchase User",
"set_user_permissions": 0,
"share": 0,
"submit": 0,
"write": 0
},
{
"apply_user_permissions": 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,
"role": "Material User"
"report": 0,
"role": "Stock User",
"set_user_permissions": 0,
"share": 0,
"submit": 0,
"write": 0
}
],
"read_only": 0,
"read_only_onload": 0,
"search_fields": "parent_cost_center, is_group"
}

View File

@@ -3,9 +3,7 @@
from __future__ import unicode_literals
import frappe
from frappe import msgprint, _
from frappe import _
from frappe.utils.nestedset import NestedSet
class CostCenter(NestedSet):
@@ -14,18 +12,46 @@ class CostCenter(NestedSet):
def autoname(self):
self.name = self.cost_center_name.strip() + ' - ' + \
frappe.db.get_value("Company", self.company, "abbr")
def validate(self):
self.validate_mandatory()
self.validate_accounts()
def validate_mandatory(self):
if self.cost_center_name != self.company and not self.parent_cost_center:
msgprint(_("Please enter parent cost center"), raise_exception=1)
frappe.throw(_("Please enter parent cost center"))
elif self.cost_center_name == self.company and self.parent_cost_center:
msgprint(_("Root cannot have a parent cost center"), raise_exception=1)
frappe.throw(_("Root cannot have a parent cost center"))
def validate_accounts(self):
if self.is_group==1 and self.get("budgets"):
frappe.throw(_("Budget cannot be set for Group Cost Center"))
check_acc_list = []
for d in self.get('budgets'):
if d.account:
account_details = frappe.db.get_value("Account", d.account,
["is_group", "company", "report_type"], as_dict=1)
if account_details.is_group:
frappe.throw(_("Budget cannot be assigned against Group Account {0}").format(d.account))
elif account_details.company != self.company:
frappe.throw(_("Account {0} does not belongs to company {1}").format(d.account, self.company))
elif account_details.report_type != "Profit and Loss":
frappe.throw(_("Budget cannot be assigned against {0}, as it's not an Income or Expense account")
.format(d.account))
if [d.account, d.fiscal_year] in check_acc_list:
frappe.throw(_("Account {0} has been entered more than once for fiscal year {1}")
.format(d.account, d.fiscal_year))
else:
check_acc_list.append([d.account, d.fiscal_year])
def convert_group_to_ledger(self):
if self.check_if_child_exists():
msgprint(_("Cannot convert Cost Center to ledger as it has child nodes"), raise_exception=1)
frappe.throw(_("Cannot convert Cost Center to ledger as it has child nodes"))
elif self.check_gle_exists():
msgprint(_("Cost Center with existing transactions can not be converted to ledger"), raise_exception=1)
frappe.throw(_("Cost Center with existing transactions can not be converted to ledger"))
else:
self.is_group = 0
self.save()
@@ -33,7 +59,7 @@ class CostCenter(NestedSet):
def convert_ledger_to_group(self):
if self.check_gle_exists():
msgprint(_("Cost Center with existing transactions can not be converted to group"), raise_exception=1)
frappe.throw(_("Cost Center with existing transactions can not be converted to group"))
else:
self.is_group = 1
self.save()
@@ -46,21 +72,6 @@ class CostCenter(NestedSet):
return frappe.db.sql("select name from `tabCost Center` where \
parent_cost_center = %s and docstatus != 2", self.name)
def validate_budget_details(self):
check_acc_list = []
for d in self.get('budgets'):
if self.is_group==1:
msgprint(_("Budget cannot be set for Group Cost Centers"), raise_exception=1)
if [d.account, d.fiscal_year] in check_acc_list:
msgprint(_("Account {0} has been entered more than once for fiscal year {1}").format(d.account, d.fiscal_year), raise_exception=1)
else:
check_acc_list.append([d.account, d.fiscal_year])
def validate(self):
self.validate_mandatory()
self.validate_budget_details()
def before_rename(self, olddn, newdn, merge=False):
# Add company abbr if not provided
from erpnext.setup.doctype.company.company import get_name_with_abbr

View File

@@ -1,90 +1,267 @@
{
"allow_copy": 0,
"allow_import": 1,
"allow_rename": 0,
"autoname": "field:year",
"creation": "2013-01-22 16:50:25",
"custom": 0,
"description": "**Fiscal Year** represents a Financial Year. All accounting entries and other major transactions are tracked against **Fiscal Year**.",
"docstatus": 0,
"doctype": "DocType",
"document_type": "Master",
"document_type": "Setup",
"fields": [
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "For e.g. 2012, 2012-13",
"fieldname": "year",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Year Name",
"no_copy": 0,
"oldfieldname": "year",
"oldfieldtype": "Data",
"permlevel": 0,
"reqd": 1
"print_hide": 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": "disabled",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Disabled",
"no_copy": 0,
"permlevel": 0,
"precision": ""
"precision": "",
"print_hide": 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": "year_start_date",
"fieldtype": "Date",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Year Start Date",
"no_copy": 1,
"oldfieldname": "year_start_date",
"oldfieldtype": "Date",
"permlevel": 0,
"reqd": 1
"print_hide": 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": "year_end_date",
"fieldtype": "Date",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Year End Date",
"no_copy": 1,
"permlevel": 0,
"reqd": 1
"print_hide": 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": "companies",
"fieldtype": "Table",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Companies",
"no_copy": 0,
"options": "Fiscal Year Company",
"permlevel": 0,
"precision": ""
"precision": "",
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
}
],
"hide_heading": 0,
"hide_toolbar": 0,
"icon": "icon-calendar",
"idx": 1,
"modified": "2015-04-18 07:33:23.922518",
"in_create": 0,
"in_dialog": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 0,
"modified": "2015-10-02 07:38:50.942038",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Fiscal Year",
"owner": "Administrator",
"permissions": [
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 1,
"delete": 1,
"email": 1,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "System Manager",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"write": 1
},
{
"apply_user_permissions": 1,
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 0,
"delete": 0,
"email": 1,
"email": 0,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"print": 0,
"read": 1,
"role": "All"
"report": 0,
"role": "Sales User",
"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": "Purchase User",
"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 User",
"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": "Stock User",
"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": "Employee",
"set_user_permissions": 0,
"share": 0,
"submit": 0,
"write": 0
}
],
"read_only": 0,
"read_only_onload": 0,
"sort_field": "name",
"sort_order": "DESC"
}

View File

@@ -1,32 +1,38 @@
[
{
"doctype": "Fiscal Year",
"year": "_Test Fiscal Year 2012",
"year_end_date": "2012-12-31",
"doctype": "Fiscal Year",
"year": "_Test Fiscal Year 2012",
"year_end_date": "2012-12-31",
"year_start_date": "2012-01-01"
},
},
{
"doctype": "Fiscal Year",
"year": "_Test Fiscal Year 2013",
"year_end_date": "2013-12-31",
"doctype": "Fiscal Year",
"year": "_Test Fiscal Year 2013",
"year_end_date": "2013-12-31",
"year_start_date": "2013-01-01"
},
},
{
"doctype": "Fiscal Year",
"year": "_Test Fiscal Year 2014",
"year_end_date": "2014-12-31",
"doctype": "Fiscal Year",
"year": "_Test Fiscal Year 2014",
"year_end_date": "2014-12-31",
"year_start_date": "2014-01-01"
},
},
{
"doctype": "Fiscal Year",
"year": "_Test Fiscal Year 2015",
"year_end_date": "2015-12-31",
"doctype": "Fiscal Year",
"year": "_Test Fiscal Year 2015",
"year_end_date": "2015-12-31",
"year_start_date": "2015-01-01"
},
},
{
"doctype": "Fiscal Year",
"year": "_Test Fiscal Year 2016",
"year_end_date": "2016-12-31",
"doctype": "Fiscal Year",
"year": "_Test Fiscal Year 2016",
"year_end_date": "2016-12-31",
"year_start_date": "2016-01-01"
},
{
"doctype": "Fiscal Year",
"year": "_Test Fiscal Year 2017",
"year_end_date": "2017-12-31",
"year_start_date": "2017-01-01"
}
]
]

View File

@@ -6,10 +6,12 @@
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"document_type": "Master",
"document_type": "Setup",
"fields": [
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "company",
"fieldtype": "Link",
"hidden": 0,
@@ -37,7 +39,7 @@
"is_submittable": 0,
"issingle": 0,
"istable": 1,
"modified": "2014-10-02 13:35:44.155278",
"modified": "2015-10-02 07:38:51.045350",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Fiscal Year Company",

View File

@@ -1,199 +1,519 @@
{
"allow_copy": 0,
"allow_import": 0,
"allow_rename": 0,
"autoname": "GL.#######",
"creation": "2013-01-10 16:34:06",
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"fields": [
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "posting_date",
"fieldtype": "Date",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 1,
"in_list_view": 1,
"label": "Posting Date",
"no_copy": 0,
"oldfieldname": "posting_date",
"oldfieldtype": "Date",
"permlevel": 0,
"search_index": 1
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 1,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "transaction_date",
"fieldtype": "Date",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Transaction Date",
"no_copy": 0,
"oldfieldname": "transaction_date",
"oldfieldtype": "Date",
"permlevel": 0
"permlevel": 0,
"print_hide": 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": "account",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 1,
"in_list_view": 1,
"label": "Account",
"no_copy": 0,
"oldfieldname": "account",
"oldfieldtype": "Link",
"options": "Account",
"permlevel": 0,
"search_index": 1
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 1,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "party_type",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Party Type",
"no_copy": 0,
"options": "DocType",
"permlevel": 0
"permlevel": 0,
"print_hide": 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": "party",
"fieldtype": "Dynamic Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Party",
"no_copy": 0,
"options": "party_type",
"permlevel": 0,
"search_index": 1
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 1,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "cost_center",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 1,
"in_list_view": 1,
"label": "Cost Center",
"no_copy": 0,
"oldfieldname": "cost_center",
"oldfieldtype": "Link",
"options": "Cost Center",
"permlevel": 0,
"search_index": 0
"print_hide": 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": "debit",
"fieldtype": "Currency",
"label": "Debit Amt",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Debit Amount",
"no_copy": 0,
"oldfieldname": "debit",
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
"permlevel": 0
"permlevel": 0,
"precision": "",
"print_hide": 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": "credit",
"fieldtype": "Currency",
"label": "Credit Amt",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Credit Amount",
"no_copy": 0,
"oldfieldname": "credit",
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
"permlevel": 0
"permlevel": 0,
"precision": "",
"print_hide": 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": "account_currency",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Account Currency",
"no_copy": 0,
"options": "Currency",
"permlevel": 0,
"precision": "",
"print_hide": 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": "debit_in_account_currency",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Debit Amount in Account Currency",
"no_copy": 0,
"options": "currency",
"permlevel": 0,
"precision": "",
"print_hide": 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": "credit_in_account_currency",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Credit Amount in Account Currency",
"no_copy": 0,
"options": "currency",
"permlevel": 0,
"precision": "",
"print_hide": 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": "against",
"fieldtype": "Text",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 1,
"in_list_view": 0,
"label": "Against",
"no_copy": 0,
"oldfieldname": "against",
"oldfieldtype": "Text",
"permlevel": 0
"permlevel": 0,
"print_hide": 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": "against_voucher_type",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Against Voucher Type",
"no_copy": 0,
"oldfieldname": "against_voucher_type",
"oldfieldtype": "Data",
"options": "DocType",
"permlevel": 0,
"search_index": 0
"print_hide": 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": "against_voucher",
"fieldtype": "Dynamic Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 1,
"in_list_view": 0,
"label": "Against Voucher",
"no_copy": 0,
"oldfieldname": "against_voucher",
"oldfieldtype": "Data",
"options": "against_voucher_type",
"permlevel": 0,
"search_index": 0
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 1,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "voucher_type",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 1,
"in_list_view": 0,
"label": "Voucher Type",
"no_copy": 0,
"oldfieldname": "voucher_type",
"oldfieldtype": "Select",
"options": "DocType",
"permlevel": 0,
"search_index": 0
"print_hide": 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": "voucher_no",
"fieldtype": "Dynamic Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 1,
"in_list_view": 0,
"label": "Voucher No",
"no_copy": 0,
"oldfieldname": "voucher_no",
"oldfieldtype": "Data",
"options": "voucher_type",
"permlevel": 0,
"search_index": 1
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 1,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "remarks",
"fieldtype": "Text",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 1,
"in_list_view": 0,
"label": "Remarks",
"no_copy": 1,
"oldfieldname": "remarks",
"oldfieldtype": "Text",
"permlevel": 0,
"search_index": 0
"print_hide": 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": "is_opening",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 1,
"in_list_view": 0,
"label": "Is Opening",
"no_copy": 0,
"oldfieldname": "is_opening",
"oldfieldtype": "Select",
"options": "No\nYes",
"permlevel": 0,
"search_index": 0
"print_hide": 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": "is_advance",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Is Advance",
"no_copy": 0,
"oldfieldname": "is_advance",
"oldfieldtype": "Select",
"options": "No\nYes",
"permlevel": 0,
"search_index": 0
"print_hide": 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": "fiscal_year",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 1,
"in_list_view": 0,
"label": "Fiscal Year",
"no_copy": 0,
"oldfieldname": "fiscal_year",
"oldfieldtype": "Select",
"options": "Fiscal Year",
"permlevel": 0,
"search_index": 0
"print_hide": 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": "company",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 1,
"in_list_view": 0,
"label": "Company",
"no_copy": 0,
"oldfieldname": "company",
"oldfieldtype": "Link",
"options": "Company",
"permlevel": 0,
"search_index": 0
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
}
],
"hide_heading": 0,
"hide_toolbar": 0,
"icon": "icon-list",
"idx": 1,
"in_create": 1,
"modified": "2015-06-14 20:57:19.800276",
"in_dialog": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 0,
"modified": "2015-10-20 12:10:59.771050",
"modified_by": "Administrator",
"module": "Accounts",
"name": "GL Entry",
@@ -201,32 +521,67 @@
"permissions": [
{
"amend": 0,
"apply_user_permissions": 1,
"apply_user_permissions": 0,
"cancel": 0,
"create": 0,
"delete": 0,
"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": 0,
"submit": 0,
"write": 0
},
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 0,
"delete": 0,
"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": 0,
"submit": 0,
"write": 0
},
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 0,
"delete": 0,
"email": 0,
"export": 1,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 0,
"read": 1,
"report": 1,
"role": "Auditor",
"set_user_permissions": 0,
"share": 0,
"submit": 0,
"write": 0
}
],
"read_only": 0,
"read_only_onload": 0,
"search_fields": "voucher_no,account,posting_date,against_voucher",
"sort_field": "modified",
"sort_order": "DESC"

View File

@@ -3,11 +3,15 @@
from __future__ import unicode_literals
import frappe
from frappe.utils import flt, fmt_money, getdate, formatdate, cstr
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.utils import get_account_currency
from erpnext.setup.doctype.company.company import get_company_currency
from erpnext.exceptions import InvalidAccountCurrency, CustomerFrozen
exclude_from_linked_with = True
class GLEntry(Document):
def validate(self):
@@ -17,6 +21,8 @@ class GLEntry(Document):
self.validate_posting_date()
self.check_pl_account()
self.validate_cost_center()
self.validate_party()
self.validate_currency()
def on_update_with_args(self, adv_adj, update_outstanding = 'Yes'):
self.validate_account_details(adv_adj)
@@ -89,6 +95,27 @@ class GLEntry(Document):
if self.cost_center and _get_cost_center_company() != self.company:
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)
def validate_currency(self):
company_currency = get_company_currency(self.company)
account_currency = get_account_currency(self.account)
if not self.account_currency:
self.account_currency = company_currency
if account_currency != self.account_currency:
frappe.throw(_("Accounting Entry for {0} can only be made in currency: {1}")
.format(self.account, (account_currency or company_currency)), InvalidAccountCurrency)
if self.party_type and self.party:
validate_party_gle_currency(self.party_type, self.party, self.company, self.account_currency)
def validate_balance_type(account, adv_adj=False):
if not adv_adj and account:
balance_must_be = frappe.db.get_value("Account", account, "balance_must_be")
@@ -114,22 +141,28 @@ def check_freezing_date(posting_date, adv_adj=False):
frappe.throw(_("You are not authorized to add or update entries before {0}").format(formatdate(acc_frozen_upto)))
def update_outstanding_amt(account, party_type, party, against_voucher_type, against_voucher, on_cancel=False):
if party_type and party:
party_condition = " and ifnull(party_type, '')='{0}' and ifnull(party, '')='{1}'"\
.format(frappe.db.escape(party_type), frappe.db.escape(party))
else:
party_condition = ""
# get final outstanding amt
bal = flt(frappe.db.sql("""select sum(ifnull(debit, 0)) - sum(ifnull(credit, 0))
bal = flt(frappe.db.sql("""
select sum(ifnull(debit_in_account_currency, 0)) - sum(ifnull(credit_in_account_currency, 0))
from `tabGL Entry`
where against_voucher_type=%s and against_voucher=%s
and account = %s and ifnull(party_type, '')=%s and ifnull(party, '')=%s""",
(against_voucher_type, against_voucher, account, party_type, party))[0][0] or 0.0)
and account = %s {0}""".format(party_condition),
(against_voucher_type, against_voucher, account))[0][0] or 0.0)
if against_voucher_type == 'Purchase Invoice':
bal = -bal
elif against_voucher_type == "Journal Entry":
against_voucher_amount = flt(frappe.db.sql("""
select sum(ifnull(debit, 0)) - sum(ifnull(credit, 0))
select sum(ifnull(debit_in_account_currency, 0)) - sum(ifnull(credit_in_account_currency, 0))
from `tabGL Entry` where voucher_type = 'Journal Entry' and voucher_no = %s
and account = %s and ifnull(party_type, '')=%s and ifnull(party, '')=%s
and ifnull(against_voucher, '') = ''""",
(against_voucher, account, cstr(party_type), cstr(party)))[0][0])
and account = %s and ifnull(against_voucher, '') = '' {0}"""
.format(party_condition), (against_voucher, account))[0][0])
if not against_voucher_amount:
frappe.throw(_("Against Journal Entry {0} is already adjusted against some other voucher")
@@ -139,9 +172,9 @@ def update_outstanding_amt(account, party_type, party, against_voucher_type, aga
if against_voucher_amount < 0:
bal = -bal
# Validation : Outstanding can not be negative
if bal < 0 and not on_cancel:
frappe.throw(_("Outstanding for {0} cannot be less than zero ({1})").format(against_voucher, fmt_money(bal)))
# Validation : Outstanding can not be negative for JV
if bal < 0 and not on_cancel:
frappe.throw(_("Outstanding for {0} cannot be less than zero ({1})").format(against_voucher, fmt_money(bal)))
# Update outstanding amt on against voucher
if against_voucher_type in ["Sales Invoice", "Purchase Invoice"]:

View File

@@ -11,7 +11,7 @@ class TestGLEntry(unittest.TestCase):
frappe.db.set_value("Company", "_Test Company", "round_off_cost_center", "_Test Cost Center - _TC")
jv = make_journal_entry("_Test Account Cost for Goods Sold - _TC",
"_Test Account Bank Account - _TC", 100, "_Test Cost Center - _TC", submit=False)
"_Test Bank - _TC", 100, "_Test Cost Center - _TC", submit=False)
jv.get("accounts")[0].debit = 100.01
jv.flags.ignore_validate = True

View File

@@ -2,8 +2,42 @@
// License: GNU General Public License v3. See license.txt
frappe.provide("erpnext.accounts");
frappe.provide("erpnext.journal_entry");
frappe.require("assets/erpnext/js/utils.js");
frappe.ui.form.on("Journal Entry", {
refresh: function(frm) {
erpnext.toggle_naming_series();
frm.cscript.voucher_type(frm.doc);
if(frm.doc.docstatus==1) {
frm.add_custom_button(__('View Ledger'), function() {
frappe.route_options = {
"voucher_no": frm.doc.name,
"from_date": frm.doc.posting_date,
"to_date": frm.doc.posting_date,
"company": frm.doc.company,
group_by_voucher: 0
};
frappe.set_route("query-report", "General Ledger");
}, "icon-table");
}
if (frm.doc.__islocal) {
frm.add_custom_button(__('Quick Entry'), function() {
return erpnext.journal_entry.quick_entry(frm);
});
}
// hide /unhide fields based on currency
erpnext.journal_entry.toggle_fields_based_on_currency(frm);
},
multi_currency: function(frm) {
erpnext.journal_entry.toggle_fields_based_on_currency(frm);
}
})
erpnext.accounts.JournalEntry = frappe.ui.form.Controller.extend({
onload: function() {
this.load_defaults();
@@ -23,23 +57,24 @@ erpnext.accounts.JournalEntry = frappe.ui.form.Controller.extend({
}
);
if(!this.frm.doc.amended_from) this.frm.doc.posting_date = get_today();
if(!this.frm.doc.amended_from) this.frm.doc.posting_date = this.frm.posting_date || get_today();
}
},
setup_queries: function() {
var me = this;
$.each(["account", "cost_center"], function(i, fieldname) {
me.frm.set_query(fieldname, "accounts", function() {
frappe.model.validate_missing(me.frm.doc, "company");
return {
filters: {
company: me.frm.doc.company,
is_group: 0
}
};
});
me.frm.set_query("account", "accounts", function(doc, cdt, cdn) {
return erpnext.journal_entry.account_query(me.frm);
});
me.frm.set_query("cost_center", "accounts", function(doc, cdt, cdn) {
return {
filters: {
company: me.frm.doc.company,
is_group: 0
}
};
});
me.frm.set_query("party_type", "accounts", function(doc, cdt, cdn) {
@@ -48,34 +83,57 @@ erpnext.accounts.JournalEntry = frappe.ui.form.Controller.extend({
}
});
$.each([["against_voucher", "Purchase Invoice", "supplier"],
["against_invoice", "Sales Invoice", "customer"]], function(i, opts) {
me.frm.set_query(opts[0], "accounts", function(doc, cdt, cdn) {
var jvd = frappe.get_doc(cdt, cdn);
frappe.model.validate_missing(jvd, "party_type");
frappe.model.validate_missing(jvd, "party");
return {
filters: [
[opts[1], opts[2], "=", jvd.party],
[opts[1], "docstatus", "=", 1],
[opts[1], "outstanding_amount", ">", 0]
]
};
});
});
this.frm.set_query("against_jv", "accounts", function(doc, cdt, cdn) {
me.frm.set_query("reference_name", "accounts", function(doc, cdt, cdn) {
var jvd = frappe.get_doc(cdt, cdn);
frappe.model.validate_missing(jvd, "account");
return {
query: "erpnext.accounts.doctype.journal_entry.journal_entry.get_against_jv",
filters: {
account: jvd.account,
party: jvd.party
}
// expense claim
if(jvd.reference_type==="Expense Claim") {
return {};
}
// journal entry
if(jvd.reference_type==="Journal Entry") {
frappe.model.validate_missing(jvd, "account");
return {
query: "erpnext.accounts.doctype.journal_entry.journal_entry.get_against_jv",
filters: {
account: jvd.account,
party: jvd.party
}
};
}
var out = {
filters: [
[jvd.reference_type, "docstatus", "=", 1]
]
};
if(in_list(["Sales Invoice", "Purchase Invoice"], jvd.reference_type)) {
out.filters.push([jvd.reference_type, "outstanding_amount", "!=", 0]);
// account filter
frappe.model.validate_missing(jvd, "account");
party_account_field = jvd.reference_type==="Sales Invoice" ? "debit_to": "credit_to";
out.filters.push([jvd.reference_type, party_account_field, "=", jvd.account]);
} else {
// party_type and party mandatory
frappe.model.validate_missing(jvd, "party_type");
frappe.model.validate_missing(jvd, "party");
out.filters.push([jvd.reference_type, "per_billed", "<", 100]);
}
if(jvd.party_type && jvd.party) {
out.filters.push([jvd.reference_type,
(jvd.reference_type.indexOf("Sales")===0 ? "customer" : "supplier"), "=", jvd.party]);
}
return out;
});
},
setup_balance_formatter: function() {
@@ -93,41 +151,41 @@ erpnext.accounts.JournalEntry = frappe.ui.form.Controller.extend({
})
},
against_voucher: function(doc, cdt, cdn) {
reference_name: function(doc, cdt, cdn) {
var d = frappe.get_doc(cdt, cdn);
if (d.against_voucher && !flt(d.debit)) {
this.get_outstanding('Purchase Invoice', d.against_voucher, d);
if(d.reference_name) {
if (d.reference_type==="Purchase Invoice" && !flt(d.debit)) {
this.get_outstanding('Purchase Invoice', d.reference_name, doc.company, d);
}
if (d.reference_type==="Sales Invoice" && !flt(d.credit)) {
this.get_outstanding('Sales Invoice', d.reference_name, doc.company, d);
}
if (d.reference_type==="Journal Entry" && !flt(d.credit) && !flt(d.debit)) {
this.get_outstanding('Journal Entry', d.reference_name, doc.company, d);
}
}
},
against_invoice: function(doc, cdt, cdn) {
var d = frappe.get_doc(cdt, cdn);
if (d.against_invoice && !flt(d.credit)) {
this.get_outstanding('Sales Invoice', d.against_invoice, d);
}
},
against_jv: function(doc, cdt, cdn) {
var d = frappe.get_doc(cdt, cdn);
if (d.against_jv && d.party && !flt(d.credit) && !flt(d.debit)) {
this.get_outstanding('Journal Entry', d.against_jv, d);
}
},
get_outstanding: function(doctype, docname, child) {
get_outstanding: function(doctype, docname, company, child) {
var me = this;
var args = {
"doctype": doctype,
"docname": docname,
"party": child.party
"party": child.party,
"account": child.account,
"account_currency": child.account_currency,
"company": company
}
return this.frm.call({
child: child,
method: "get_outstanding",
return frappe.call({
method: "erpnext.accounts.doctype.journal_entry.journal_entry.get_outstanding",
args: { args: args},
callback: function(r) {
cur_frm.cscript.update_totals(me.frm.doc);
if(r.message) {
$.each(r.message, function(field, value) {
frappe.model.set_value(child.doctype, child.name, field, value);
})
}
}
});
},
@@ -145,50 +203,36 @@ erpnext.accounts.JournalEntry = frappe.ui.form.Controller.extend({
// set difference
if(doc.difference) {
if(doc.difference > 0) {
row.credit_in_account_currency = doc.difference;
row.credit = doc.difference;
} else {
row.debit_in_account_currency = -doc.difference;
row.debit = -doc.difference;
}
}
cur_frm.cscript.update_totals(doc);
},
});
cur_frm.script_manager.make(erpnext.accounts.JournalEntry);
cur_frm.cscript.refresh = function(doc) {
erpnext.toggle_naming_series();
cur_frm.cscript.voucher_type(doc);
if(doc.docstatus==1) {
cur_frm.add_custom_button(__('View Ledger'), function() {
frappe.route_options = {
"voucher_no": doc.name,
"from_date": doc.posting_date,
"to_date": doc.posting_date,
"company": doc.company,
group_by_voucher: 0
};
frappe.set_route("query-report", "General Ledger");
}, "icon-table");
}
}
cur_frm.cscript.company = function(doc, cdt, cdn) {
cur_frm.refresh_fields();
erpnext.get_fiscal_year(doc.company, doc.posting_date);
}
cur_frm.cscript.posting_date = function(doc, cdt, cdn){
cur_frm.posting_date = cur_frm.doc.posting_date;
erpnext.get_fiscal_year(doc.company, doc.posting_date);
}
cur_frm.cscript.update_totals = function(doc) {
var td=0.0; var tc =0.0;
var el = doc.accounts || [];
for(var i in el) {
td += flt(el[i].debit, precision("debit", el[i]));
tc += flt(el[i].credit, precision("credit", el[i]));
var accounts = doc.accounts || [];
for(var i in accounts) {
td += flt(accounts[i].debit, precision("debit", accounts[i]));
tc += flt(accounts[i].credit, precision("credit", accounts[i]));
}
var doc = locals[doc.doctype][doc.name];
doc.total_debit = td;
@@ -197,31 +241,12 @@ cur_frm.cscript.update_totals = function(doc) {
refresh_many(['total_debit','total_credit','difference']);
}
cur_frm.cscript.debit = function(doc,dt,dn) { cur_frm.cscript.update_totals(doc); }
cur_frm.cscript.credit = function(doc,dt,dn) { cur_frm.cscript.update_totals(doc); }
cur_frm.cscript.get_balance = function(doc,dt,dn) {
cur_frm.cscript.update_totals(doc);
return $c_obj(cur_frm.doc, 'get_balance', '', function(r, rt){
cur_frm.refresh();
});
}
// Get balance
// -----------
cur_frm.cscript.account = function(doc,dt,dn) {
var d = locals[dt][dn];
if(d.account) {
return frappe.call({
method: "erpnext.accounts.utils.get_balance_on",
args: {account: d.account, date: doc.posting_date},
callback: function(r) {
d.balance = r.message;
refresh_field('balance', d.name, 'accounts');
}
});
}
}
cur_frm.cscript.validate = function(doc,cdt,cdn) {
cur_frm.cscript.update_totals(doc);
@@ -286,18 +311,67 @@ cur_frm.cscript.voucher_type = function(doc, cdt, cdn) {
}
}
frappe.ui.form.on("Journal Entry Account", "party", function(frm, cdt, cdn) {
var d = frappe.get_doc(cdt, cdn);
if(!d.account && d.party_type && d.party) {
return frm.call({
method: "erpnext.accounts.doctype.journal_entry.journal_entry.get_party_account_and_balance",
child: d,
args: {
company: frm.doc.company,
party_type: d.party_type,
party: d.party
}
});
frappe.ui.form.on("Journal Entry Account", {
party: function(frm, cdt, cdn) {
var d = frappe.get_doc(cdt, cdn);
if(!d.account && d.party_type && d.party) {
if(!frm.doc.company) frappe.throw(__("Please select Company"));
return frm.call({
method: "erpnext.accounts.doctype.journal_entry.journal_entry.get_party_account_and_balance",
child: d,
args: {
company: frm.doc.company,
party_type: d.party_type,
party: d.party
}
});
}
},
account: function(frm, dt, dn) {
var d = locals[dt][dn];
if(d.account) {
if(!frm.doc.company) frappe.throw(__("Please select Company first"));
if(!frm.doc.posting_date) frappe.throw(__("Please select Posting Date first"));
return frappe.call({
method: "erpnext.accounts.doctype.journal_entry.journal_entry.get_account_balance_and_party_type",
args: {
account: d.account,
date: frm.doc.posting_date,
company: frm.doc.company,
debit: flt(d.debit_in_account_currency),
credit: flt(d.credit_in_account_currency),
exchange_rate: d.exchange_rate
},
callback: function(r) {
if(r.message) {
$.extend(d, r.message);
refresh_field('accounts');
}
}
});
}
},
debit_in_account_currency: function(frm, cdt, cdn) {
erpnext.journal_entry.set_debit_credit_in_company_currency(frm, cdt, cdn);
},
credit_in_account_currency: function(frm, cdt, cdn) {
erpnext.journal_entry.set_debit_credit_in_company_currency(frm, cdt, cdn);
},
debit: function(frm, dt, dn) {
cur_frm.cscript.update_totals(frm.doc);
},
credit: function(frm, dt, dn) {
cur_frm.cscript.update_totals(frm.doc);
},
exchange_rate: function(frm, cdt, cdn) {
erpnext.journal_entry.set_debit_credit_in_company_currency(frm, cdt, cdn);
}
})
@@ -305,3 +379,132 @@ frappe.ui.form.on("Journal Entry Account", "accounts_remove", function(frm) {
cur_frm.cscript.update_totals(frm.doc);
});
$.extend(erpnext.journal_entry, {
toggle_fields_based_on_currency: function(frm) {
var fields = ["currency_section", "account_currency", "exchange_rate", "debit", "credit"];
var grid = frm.get_field("accounts").grid;
if(grid) grid.set_column_disp(fields, frm.doc.multi_currency);
// dynamic label
var field_label_map = {
"debit_in_account_currency": "Debit",
"credit_in_account_currency": "Credit"
};
$.each(field_label_map, function (fieldname, label) {
var df = frappe.meta.get_docfield("Journal Entry Account", fieldname, frm.doc.name);
df.label = frm.doc.multi_currency ? (label + " in Account Currency") : label;
})
},
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",
flt(flt(row.debit_in_account_currency)*row.exchange_rate), precision("debit", row));
frappe.model.set_value(cdt, cdn, "credit",
flt(flt(row.credit_in_account_currency)*row.exchange_rate), precision("credit", row));
},
set_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);
} else if (!row.exchange_rate || row.account_type == "Bank") {
frappe.call({
method: "erpnext.accounts.doctype.journal_entry.journal_entry.get_exchange_rate",
args: {
account: row.account,
account_currency: row.account_currency,
company: frm.doc.company,
reference_type: cstr(row.reference_type),
reference_name: cstr(row.reference_name),
debit: flt(row.debit_in_account_currency),
credit: flt(row.credit_in_account_currency),
exchange_rate: row.exchange_rate
},
callback: function(r) {
if(r.message) {
frappe.model.set_value(cdt, cdn, "exchange_rate", r.message);
}
}
})
}
},
quick_entry: function(frm) {
var naming_series_options = frm.fields_dict.naming_series.df.options;
var naming_series_default = frm.fields_dict.naming_series.df.default || naming_series_options.split("\n")[0];
var dialog = new frappe.ui.Dialog({
title: __("Quick Journal Entry"),
fields: [
{fieldtype: "Currency", fieldname: "debit", label: __("Amount"), reqd: 1},
{fieldtype: "Link", fieldname: "debit_account", label: __("Debit Account"), reqd: 1,
options: "Account",
get_query: function() {
return erpnext.journal_entry.account_query(frm);
}
},
{fieldtype: "Link", fieldname: "credit_account", label: __("Credit Account"), reqd: 1,
options: "Account",
get_query: function() {
return erpnext.journal_entry.account_query(frm);
}
},
{fieldtype: "Date", fieldname: "posting_date", label: __("Date"), reqd: 1,
default: frm.doc.posting_date},
{fieldtype: "Select", fieldname: "naming_series", label: __("Series"), reqd: 1,
options: naming_series_options, default: naming_series_default},
]
});
dialog.set_primary_action(__("Save"), function() {
var btn = this;
var values = dialog.get_values();
frm.set_value("posting_date", values.posting_date);
frm.set_value("naming_series", values.naming_series);
// clear table is used because there might've been an error while adding child
// and cleanup didn't happen
frm.clear_table("accounts");
// using grid.add_new_row() to add a row in UI as well as locals
// this is required because triggers try to refresh the grid
var debit_row = frm.fields_dict.accounts.grid.add_new_row();
frappe.model.set_value(debit_row.doctype, debit_row.name, "account", values.debit_account);
frappe.model.set_value(debit_row.doctype, debit_row.name, "debit_in_account_currency", values.debit);
var credit_row = frm.fields_dict.accounts.grid.add_new_row();
frappe.model.set_value(credit_row.doctype, credit_row.name, "account", values.credit_account);
frappe.model.set_value(credit_row.doctype, credit_row.name, "credit_in_account_currency", values.debit);
frm.save();
dialog.hide();
});
dialog.show();
},
account_query: function(frm) {
var filters = {
company: frm.doc.company,
is_group: 0
};
if(!frm.doc.multi_currency) {
$.extend(filters, {
account_currency: frappe.get_doc(":Company", frm.doc.company).default_currency
});
}
return { filters: filters };
}
});

File diff suppressed because it is too large Load Diff

View File

@@ -3,11 +3,11 @@
from __future__ import unicode_literals
import frappe
from frappe.utils import cstr, flt, fmt_money, formatdate, getdate
from frappe.utils import cstr, flt, fmt_money, formatdate
from frappe import msgprint, _, scrub
from erpnext.setup.utils import get_company_currency
from erpnext.controllers.accounts_controller import AccountsController
from erpnext.accounts.utils import get_balance_on
from erpnext.accounts.utils import get_balance_on, get_account_currency
from erpnext.setup.utils import get_company_currency
class JournalEntry(AccountsController):
@@ -26,20 +26,19 @@ class JournalEntry(AccountsController):
self.validate_party()
self.validate_cheque_info()
self.validate_entries_for_advance()
self.validate_multi_currency()
self.validate_debit_and_credit()
self.validate_against_jv()
self.validate_against_sales_invoice()
self.validate_against_purchase_invoice()
self.validate_reference_doc()
self.set_against_account()
self.create_remarks()
self.set_print_format_fields()
self.validate_against_sales_order()
self.validate_against_purchase_order()
self.check_credit_days()
self.validate_expense_claim()
self.validate_credit_debit_note()
self.validate_empty_accounts_table()
self.set_title()
self.set_account_and_party_balance()
if not self.title:
self.title = self.get_title()
def on_submit(self):
self.check_credit_limit()
@@ -47,17 +46,15 @@ class JournalEntry(AccountsController):
self.update_advance_paid()
self.update_expense_claim()
def set_title(self):
self.title = self.pay_to_recd_from or self.accounts[0].account
def get_title(self):
return self.pay_to_recd_from or self.accounts[0].account
def update_advance_paid(self):
advance_paid = frappe._dict()
for d in self.get("accounts"):
if d.is_advance:
if d.against_sales_order:
advance_paid.setdefault("Sales Order", []).append(d.against_sales_order)
elif d.against_purchase_order:
advance_paid.setdefault("Purchase Order", []).append(d.against_purchase_order)
if d.reference_type in ("Sales Order", "Purchase Order"):
advance_paid.setdefault(d.reference_type, []).append(d.reference_name)
for voucher_type, order_list in advance_paid.items():
for voucher_no in list(set(order_list)):
@@ -65,7 +62,7 @@ class JournalEntry(AccountsController):
def on_cancel(self):
from erpnext.accounts.utils import remove_against_link_from_jv
remove_against_link_from_jv(self.doctype, self.name, "against_jv")
remove_against_link_from_jv(self.doctype, self.name)
self.make_gl_entries(1)
self.update_advance_paid()
@@ -88,24 +85,6 @@ class JournalEntry(AccountsController):
for customer in customers:
check_credit_limit(customer, self.company)
def check_credit_days(self):
from erpnext.accounts.party import get_credit_days
posting_date = None
if self.cheque_date:
for d in self.get("accounts"):
if d.party_type and d.party and d.get("credit" if d.party_type=="Customer" else "debit") > 0:
if d.against_invoice:
posting_date = frappe.db.get_value("Sales Invoice", d.against_invoice, "posting_date")
elif d.against_voucher:
posting_date = frappe.db.get_value("Purchase Invoice", d.against_voucher, "posting_date")
credit_days = get_credit_days(d.party_type, d.party, self.company)
if posting_date and credit_days:
date_diff = (getdate(self.cheque_date) - getdate(posting_date)).days
if date_diff > flt(credit_days):
msgprint(_("Note: Reference Date exceeds allowed credit days by {0} days for {1} {2}")
.format(date_diff - flt(credit_days), d.party_type, d.party))
def validate_cheque_info(self):
if self.voucher_type in ['Bank Entry']:
if not self.cheque_no or not self.cheque_date:
@@ -117,17 +96,17 @@ class JournalEntry(AccountsController):
def validate_entries_for_advance(self):
for d in self.get('accounts'):
if not (d.against_voucher and d.against_invoice and d.against_jv):
if d.reference_type not in ("Sales Invoice", "Purchase Invoice", "Journal Entry"):
if (d.party_type == 'Customer' and flt(d.credit) > 0) or \
(d.party_type == 'Supplier' and flt(d.debit) > 0):
if not d.is_advance:
if d.is_advance=="No":
msgprint(_("Row {0}: Please check 'Is Advance' against Account {1} if this is an advance entry.").format(d.idx, d.account))
elif (d.against_sales_order or d.against_purchase_order) and d.is_advance != "Yes":
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))
def validate_against_jv(self):
for d in self.get('accounts'):
if d.against_jv:
if d.reference_type=="Journal Entry":
account_root_type = frappe.db.get_value("Account", d.account, "root_type")
if account_root_type == "Asset" and flt(d.debit) > 0:
frappe.throw(_("For {0}, only credit accounts can be linked against another debit entry")
@@ -136,17 +115,17 @@ class JournalEntry(AccountsController):
frappe.throw(_("For {0}, only debit accounts can be linked against another credit entry")
.format(d.account))
if d.against_jv == self.name:
if d.reference_name == self.name:
frappe.throw(_("You can not enter current voucher in 'Against Journal Entry' column"))
against_entries = frappe.db.sql("""select * from `tabJournal Entry Account`
where account = %s and docstatus = 1 and parent = %s
and ifnull(against_jv, '') = '' and ifnull(against_invoice, '') = ''
and ifnull(against_voucher, '') = ''""", (d.account, d.against_jv), as_dict=True)
and ifnull(reference_type, '') in ("", "Sales Order", "Purchase Order")
""", (d.account, d.reference_name), as_dict=True)
if not against_entries:
frappe.throw(_("Journal Entry {0} does not have account {1} or already matched against other voucher")
.format(d.against_jv, d.account))
.format(d.reference_name, d.account))
else:
dr_or_cr = "debit" if d.credit > 0 else "credit"
valid = False
@@ -155,90 +134,109 @@ class JournalEntry(AccountsController):
valid = True
if not valid:
frappe.throw(_("Against Journal Entry {0} does not have any unmatched {1} entry")
.format(d.against_jv, dr_or_cr))
.format(d.reference_name, dr_or_cr))
def validate_against_sales_invoice(self):
payment_against_voucher = self.validate_account_in_against_voucher("against_invoice", "Sales Invoice")
self.validate_against_invoice_fields("Sales Invoice", payment_against_voucher)
def validate_against_purchase_invoice(self):
payment_against_voucher = self.validate_account_in_against_voucher("against_voucher", "Purchase Invoice")
self.validate_against_invoice_fields("Purchase Invoice", payment_against_voucher)
def validate_against_sales_order(self):
payment_against_voucher = self.validate_account_in_against_voucher("against_sales_order", "Sales Order")
self.validate_against_order_fields("Sales Order", payment_against_voucher)
def validate_against_purchase_order(self):
payment_against_voucher = self.validate_account_in_against_voucher("against_purchase_order", "Purchase Order")
self.validate_against_order_fields("Purchase Order", payment_against_voucher)
def validate_account_in_against_voucher(self, against_field, doctype):
payment_against_voucher = frappe._dict()
field_dict = {'Sales Invoice': ["Customer", "Debit To"],
def validate_reference_doc(self):
"""Validates reference document"""
field_dict = {
'Sales Invoice': ["Customer", "Debit To"],
'Purchase Invoice': ["Supplier", "Credit To"],
'Sales Order': ["Customer"],
'Purchase Order': ["Supplier"]
}
}
self.reference_totals = {}
self.reference_types = {}
self.reference_accounts = {}
for d in self.get("accounts"):
if d.get(against_field):
dr_or_cr = "credit" if against_field in ["against_invoice", "against_sales_order"] \
else "debit"
if against_field in ["against_invoice", "against_sales_order"] and flt(d.debit) > 0:
frappe.throw(_("Row {0}: Debit entry can not be linked with a {1}").format(d.idx, doctype))
if not d.reference_type:
d.reference_name = None
if not d.reference_name:
d.reference_type = None
if d.reference_type and d.reference_name and (d.reference_type in field_dict.keys()):
dr_or_cr = "credit_in_account_currency" \
if d.reference_type in ("Sales Order", "Sales Invoice") else "debit_in_account_currency"
if against_field in ["against_voucher", "against_purchase_order"] and flt(d.credit) > 0:
frappe.throw(_("Row {0}: Credit entry can not be linked with a {1}").format(d.idx, doctype))
# check debit or credit type Sales / Purchase Order
if d.reference_type=="Sales Order" and flt(d.debit) > 0:
frappe.throw(_("Row {0}: Debit entry can not be linked with a {1}").format(d.idx, d.reference_type))
against_voucher = frappe.db.get_value(doctype, d.get(against_field),
[scrub(dt) for dt in field_dict.get(doctype)])
if d.reference_type == "Purchase Order" and flt(d.credit) > 0:
frappe.throw(_("Row {0}: Credit entry can not be linked with a {1}").format(d.idx, d.reference_type))
if against_field in ["against_invoice", "against_voucher"]:
if (against_voucher[0] !=d.party or against_voucher[1] != d.account):
frappe.throw(_("Row {0}: Party / Account does not match with \
Customer / Debit To in {1}").format(d.idx, doctype))
else:
payment_against_voucher.setdefault(d.get(against_field), []).append(flt(d.get(dr_or_cr)))
# set totals
if not d.reference_name in self.reference_totals:
self.reference_totals[d.reference_name] = 0.0
self.reference_totals[d.reference_name] += flt(d.get(dr_or_cr))
self.reference_types[d.reference_name] = d.reference_type
self.reference_accounts[d.reference_name] = d.account
if against_field in ["against_sales_order", "against_purchase_order"]:
against_voucher = frappe.db.get_value(d.reference_type, d.reference_name,
[scrub(dt) for dt in field_dict.get(d.reference_type)])
# check if party and account match
if d.reference_type in ("Sales Invoice", "Purchase Invoice"):
if (against_voucher[0] != d.party or against_voucher[1] != d.account):
frappe.throw(_("Row {0}: Party / Account does not match with {1} / {2} in {3} {4}")
.format(d.idx, field_dict.get(d.reference_type)[0], field_dict.get(d.reference_type)[1],
d.reference_type, d.reference_name))
# check if party matches for Sales / Purchase Order
if d.reference_type in ("Sales Order", "Purchase Order"):
# set totals
if against_voucher != d.party:
frappe.throw(_("Row {0}: {1} {2} does not match with {3}") \
.format(d.idx, d.party_type, d.party, doctype))
elif d.is_advance == "Yes":
payment_against_voucher.setdefault(d.get(against_field), []).append(flt(d.get(dr_or_cr)))
.format(d.idx, d.party_type, d.party, d.reference_type))
return payment_against_voucher
self.validate_orders()
self.validate_invoices()
def validate_against_invoice_fields(self, doctype, payment_against_voucher):
for voucher_no, payment_list in payment_against_voucher.items():
voucher_properties = frappe.db.get_value(doctype, voucher_no,
["docstatus", "outstanding_amount"])
def validate_orders(self):
"""Validate totals, stopped and docstatus for orders"""
for reference_name, total in self.reference_totals.iteritems():
reference_type = self.reference_types[reference_name]
account = self.reference_accounts[reference_name]
if voucher_properties[0] != 1:
frappe.throw(_("{0} {1} is not submitted").format(doctype, voucher_no))
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)
if flt(voucher_properties[1]) < flt(sum(payment_list)):
frappe.throw(_("Payment against {0} {1} cannot be greater \
than Outstanding Amount {2}").format(doctype, voucher_no, voucher_properties[1]))
if order.docstatus != 1:
frappe.throw(_("{0} {1} is not submitted").format(reference_type, reference_name))
def validate_against_order_fields(self, doctype, payment_against_voucher):
for voucher_no, payment_list in payment_against_voucher.items():
voucher_properties = frappe.db.get_value(doctype, voucher_no,
["docstatus", "per_billed", "status", "advance_paid", "base_grand_total"])
if flt(order.per_billed) >= 100:
frappe.throw(_("{0} {1} is fully billed").format(reference_type, reference_name))
if voucher_properties[0] != 1:
frappe.throw(_("{0} {1} is not submitted").format(doctype, voucher_no))
if cstr(order.status) == "Stopped":
frappe.throw(_("{0} {1} is stopped").format(reference_type, reference_name))
if flt(voucher_properties[1]) >= 100:
frappe.throw(_("{0} {1} is fully billed").format(doctype, voucher_no))
account_currency = get_account_currency(account)
if account_currency == self.company_currency:
voucher_total = order.base_grand_total
else:
voucher_total = order.grand_total
if cstr(voucher_properties[2]) == "Stopped":
frappe.throw(_("{0} {1} is stopped").format(doctype, voucher_no))
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))
if flt(voucher_properties[4]) < flt(voucher_properties[3]) + flt(sum(payment_list)):
frappe.throw(_("Advance paid against {0} {1} cannot be greater \
than Grand Total {2}").format(doctype, voucher_no, voucher_properties[3]))
def validate_invoices(self):
"""Validate totals and docstatus for invoices"""
for reference_name, total in self.reference_totals.iteritems():
reference_type = self.reference_types[reference_name]
if reference_type in ("Sales Invoice", "Purchase Invoice"):
invoice = frappe.db.get_value(reference_type, reference_name,
["docstatus", "outstanding_amount"], as_dict=1)
if invoice.docstatus != 1:
frappe.throw(_("{0} {1} is not submitted").format(reference_type, reference_name))
if total and flt(invoice.outstanding_amount) < total:
frappe.throw(_("Payment against {0} {1} cannot be greater than Outstanding Amount {2}")
.format(reference_type, reference_name, invoice.outstanding_amount))
def set_against_account(self):
accounts_debited, accounts_credited = [], []
@@ -252,13 +250,12 @@ class JournalEntry(AccountsController):
def validate_debit_and_credit(self):
self.total_debit, self.total_credit, self.difference = 0, 0, 0
for d in self.get("accounts"):
if d.debit and d.credit:
frappe.throw(_("You cannot credit and debit same account at the same time"))
self.total_debit = flt(self.total_debit) + flt(d.debit, self.precision("debit", "accounts"))
self.total_credit = flt(self.total_credit) + flt(d.credit, self.precision("credit", "accounts"))
self.total_debit = flt(self.total_debit) + flt(d.debit, d.precision("debit"))
self.total_credit = flt(self.total_credit) + flt(d.credit, d.precision("credit"))
self.difference = flt(self.total_debit, self.precision("total_debit")) - \
flt(self.total_credit, self.precision("total_credit"))
@@ -267,6 +264,38 @@ class JournalEntry(AccountsController):
frappe.throw(_("Total Debit must be equal to Total Credit. The difference is {0}")
.format(self.difference))
def validate_multi_currency(self):
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 d.account_currency!=self.company_currency and d.account_currency not in alternate_currency:
alternate_currency.append(d.account_currency)
if alternate_currency:
if not self.multi_currency:
frappe.throw(_("Please check Multi Currency option to allow accounts with other currency"))
self.set_exchange_rate()
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"))
def set_exchange_rate(self):
for d in self.get("accounts"):
if d.account_currency == self.company_currency:
d.exchange_rate = 1
elif not d.exchange_rate or d.account_type=="Bank" or \
(d.reference_type in ("Sales Invoice", "Purchase Invoice") and d.reference_name):
d.exchange_rate = get_exchange_rate(d.account, d.account_currency, self.company,
d.reference_type, d.reference_name, d.debit, d.credit, d.exchange_rate)
if not d.exchange_rate:
frappe.throw(_("Row {0}: Exchange Rate is mandatory").format(d.idx))
def create_remarks(self):
r = []
if self.cheque_no:
@@ -275,28 +304,26 @@ class JournalEntry(AccountsController):
else:
msgprint(_("Please enter Reference date"), raise_exception=frappe.MandatoryError)
company_currency = get_company_currency(self.company)
for d in self.get('accounts'):
if d.against_invoice and d.credit:
r.append(_("{0} against Sales Invoice {1}").format(fmt_money(flt(d.credit), currency = company_currency), \
d.against_invoice))
if d.reference_type=="Sales Invoice" and d.credit:
r.append(_("{0} against Sales Invoice {1}").format(fmt_money(flt(d.credit), currency = self.company_currency), \
d.reference_name))
if d.against_sales_order and d.credit:
r.append(_("{0} against Sales Order {1}").format(fmt_money(flt(d.credit), currency = company_currency), \
d.against_sales_order))
if d.reference_type=="Sales Order" and d.credit:
r.append(_("{0} against Sales Order {1}").format(fmt_money(flt(d.credit), currency = self.company_currency), \
d.reference_name))
if d.against_voucher and d.debit:
if d.reference_type == "Purchase Invoice" and d.debit:
bill_no = frappe.db.sql("""select bill_no, bill_date
from `tabPurchase Invoice` where name=%s""", d.against_voucher)
from `tabPurchase Invoice` where name=%s""", d.reference_name)
if bill_no and bill_no[0][0] and bill_no[0][0].lower().strip() \
not in ['na', 'not applicable', 'none']:
r.append(_('{0} against Bill {1} dated {2}').format(fmt_money(flt(d.debit), currency=company_currency), bill_no[0][0],
r.append(_('{0} against Bill {1} dated {2}').format(fmt_money(flt(d.debit), currency=self.company_currency), bill_no[0][0],
bill_no[0][1] and formatdate(bill_no[0][1].strftime('%Y-%m-%d'))))
if d.against_purchase_order and d.debit:
r.append(_("{0} against Purchase Order {1}").format(fmt_money(flt(d.credit), currency = company_currency), \
d.against_purchase_order))
if d.reference_type == "Purchase Order" and d.debit:
r.append(_("{0} against Purchase Order {1}").format(fmt_money(flt(d.credit), currency = self.company_currency), \
d.reference_name))
if self.user_remark:
r.append(_("Note: {0}").format(self.user_remark))
@@ -316,10 +343,9 @@ class JournalEntry(AccountsController):
self.set_total_amount(d.debit or d.credit)
def set_total_amount(self, amt):
company_currency = get_company_currency(self.company)
self.total_amount = amt
from frappe.utils import money_in_words
self.total_amount_in_words = money_in_words(amt, company_currency)
self.total_amount_in_words = money_in_words(amt, self.company_currency)
def make_gl_entries(self, cancel=0, adv_adj=0):
from erpnext.accounts.general_ledger import make_gl_entries
@@ -333,15 +359,13 @@ class JournalEntry(AccountsController):
"party_type": d.party_type,
"party": d.party,
"against": d.against_account,
"debit": flt(d.debit, self.precision("debit", "accounts")),
"credit": flt(d.credit, self.precision("credit", "accounts")),
"against_voucher_type": (("Purchase Invoice" if d.against_voucher else None)
or ("Sales Invoice" if d.against_invoice else None)
or ("Journal Entry" if d.against_jv else None)
or ("Sales Order" if d.against_sales_order else None)
or ("Purchase Order" if d.against_purchase_order else None)),
"against_voucher": d.against_voucher or d.against_invoice or d.against_jv
or d.against_sales_order or d.against_purchase_order,
"debit": flt(d.debit, d.precision("debit")),
"credit": flt(d.credit, d.precision("credit")),
"account_currency": d.account_currency,
"debit_in_account_currency": flt(d.debit_in_account_currency, d.precision("debit_in_account_currency")),
"credit_in_account_currency": flt(d.credit_in_account_currency, d.precision("credit_in_account_currency")),
"against_voucher_type": d.reference_type,
"against_voucher": d.reference_name,
"remarks": self.remark,
"cost_center": d.cost_center
})
@@ -358,21 +382,22 @@ class JournalEntry(AccountsController):
diff = flt(self.difference, self.precision("difference"))
# If any row without amount, set the diff on that row
for d in self.get('accounts'):
if not d.credit and not d.debit and diff != 0:
if diff>0:
d.credit = diff
elif diff<0:
d.debit = diff
flag = 1
if diff:
blank_row = None
for d in self.get('accounts'):
if not d.credit_in_account_currency and not d.debit_in_account_currency and diff != 0:
blank_row = d
# Set the diff in a new row
if flag == 0 and diff != 0:
jd = self.append('accounts', {})
if not blank_row:
blank_row = self.append('accounts', {})
blank_row.exchange_rate = 1
if diff>0:
jd.credit = abs(diff)
blank_row.credit_in_account_currency = diff
blank_row.credit = diff
elif diff<0:
jd.debit = abs(diff)
blank_row.debit_in_account_currency = abs(diff)
blank_row.debit = abs(diff)
self.validate_debit_and_credit()
@@ -388,11 +413,13 @@ class JournalEntry(AccountsController):
if self.write_off_based_on == 'Accounts Receivable':
jd1.party_type = "Customer"
jd1.credit = flt(d.outstanding_amount, self.precision("credit", "accounts"))
jd1.against_invoice = cstr(d.name)
jd1.reference_type = "Sales Invoice"
jd1.reference_name = cstr(d.name)
elif self.write_off_based_on == 'Accounts Payable':
jd1.party_type = "Supplier"
jd1.debit = flt(d.outstanding_amount, self.precision("debit", "accounts"))
jd1.against_voucher = cstr(d.name)
jd1.reference_type = "Purchase Invoice"
jd1.reference_name = cstr(d.name)
jd2 = self.append('accounts', {})
if self.write_off_based_on == 'Accounts Receivable':
@@ -418,19 +445,20 @@ class JournalEntry(AccountsController):
def update_expense_claim(self):
for d in self.accounts:
if d.against_expense_claim:
if d.reference_type=="Expense Claim":
amt = frappe.db.sql("""select sum(debit) as amt from `tabJournal Entry Account`
where against_expense_claim = %s and docstatus = 1""", d.against_expense_claim ,as_dict=1)[0].amt
frappe.db.set_value("Expense Claim", d.against_expense_claim , "total_amount_reimbursed", amt)
where reference_type = "Expense Claim" and
reference_name = %s and docstatus = 1""", d.reference_name ,as_dict=1)[0].amt
frappe.db.set_value("Expense Claim", d.reference_name , "total_amount_reimbursed", amt)
def validate_expense_claim(self):
for d in self.accounts:
if d.against_expense_claim:
if d.reference_type=="Expense Claim":
sanctioned_amount, reimbursed_amount = frappe.db.get_value("Expense Claim",
d.against_expense_claim, ("total_sanctioned_amount", "total_amount_reimbursed"))
d.reference_name, ("total_sanctioned_amount", "total_amount_reimbursed"))
pending_amount = flt(sanctioned_amount) - flt(reimbursed_amount)
if d.debit > pending_amount:
frappe.throw(_("Row No {0}: Amount cannot be greater than Pending Amount against Expense Claim {1}. Pending Amount is {2}".format(d.idx, d.against_expense_claim, pending_amount)))
frappe.throw(_("Row No {0}: Amount cannot be greater than Pending Amount against Expense Claim {1}. Pending Amount is {2}".format(d.idx, d.reference_name, pending_amount)))
def validate_credit_debit_note(self):
if self.stock_entry:
@@ -444,6 +472,20 @@ class JournalEntry(AccountsController):
if not self.get('accounts'):
frappe.throw("Accounts table cannot be blank.")
def set_account_and_party_balance(self):
account_balance = {}
party_balance = {}
for d in self.get("accounts"):
if d.account not in account_balance:
account_balance[d.account] = get_balance_on(account=d.account, date=self.posting_date)
if (d.party_type, d.party) not in party_balance:
party_balance[(d.party_type, d.party)] = get_balance_on(party_type=d.party_type,
party=d.party, date=self.posting_date)
d.account_balance = account_balance[d.account]
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):
from erpnext.accounts.doctype.sales_invoice.sales_invoice import get_bank_cash_account
@@ -463,49 +505,192 @@ def get_default_bank_cash_account(company, voucher_type, mode_of_payment=None):
account = frappe.db.get_value("Account", {"company": company, "account_type": "Cash", "is_group": 0})
if account:
account_details = frappe.db.get_value("Account", account, ["account_currency", "account_type"], as_dict=1)
return {
"account": account,
"balance": get_balance_on(account)
"balance": get_balance_on(account),
"account_currency": account_details.account_currency,
"account_type": account_details.account_type
}
@frappe.whitelist()
def get_payment_entry_from_sales_invoice(sales_invoice):
"""Returns new Journal Entry document as dict for given Sales Invoice"""
from erpnext.accounts.utils import get_balance_on
si = frappe.get_doc("Sales Invoice", sales_invoice)
# exchange rate
exchange_rate = get_exchange_rate(si.debit_to, si.party_account_currency, si.company,
si.doctype, si.name)
jv = get_payment_entry(si)
jv.remark = 'Payment received against Sales Invoice {0}. {1}'.format(si.name, si.remarks)
# credit customer
jv.get("accounts")[0].account = si.debit_to
jv.get("accounts")[0].party_type = "Customer"
jv.get("accounts")[0].party = si.customer
jv.get("accounts")[0].balance = get_balance_on(si.debit_to)
jv.get("accounts")[0].party_balance = get_balance_on(party=si.customer, party_type="Customer")
jv.get("accounts")[0].credit = si.outstanding_amount
jv.get("accounts")[0].against_invoice = si.name
row1 = jv.get("accounts")[0]
row1.account = si.debit_to
row1.account_currency = si.party_account_currency
row1.party_type = "Customer"
row1.party = si.customer
row1.balance = get_balance_on(si.debit_to)
row1.party_balance = get_balance_on(party=si.customer, party_type="Customer")
row1.credit_in_account_currency = si.outstanding_amount
row1.reference_type = si.doctype
row1.reference_name = si.name
row1.exchange_rate = exchange_rate
row1.account_type = "Receivable" if si.customer else ""
# debit bank
jv.get("accounts")[1].debit = si.outstanding_amount
row2 = jv.get("accounts")[1]
if row2.account_currency == si.party_account_currency:
row2.debit_in_account_currency = si.outstanding_amount
else:
row2.debit_in_account_currency = si.outstanding_amount * exchange_rate
# set multi currency check
if row1.account_currency != si.company_currency or row2.account_currency != si.company_currency:
jv.multi_currency = 1
return jv.as_dict()
@frappe.whitelist()
def get_payment_entry_from_purchase_invoice(purchase_invoice):
"""Returns new Journal Entry document as dict for given Purchase Invoice"""
pi = frappe.get_doc("Purchase Invoice", purchase_invoice)
exchange_rate = get_exchange_rate(pi.credit_to, pi.party_account_currency, pi.company,
pi.doctype, pi.name)
jv = get_payment_entry(pi)
jv.remark = 'Payment against Purchase Invoice {0}. {1}'.format(pi.name, pi.remarks)
jv.exchange_rate = exchange_rate
# credit supplier
jv.get("accounts")[0].account = pi.credit_to
jv.get("accounts")[0].party_type = "Supplier"
jv.get("accounts")[0].party = pi.supplier
jv.get("accounts")[0].balance = get_balance_on(pi.credit_to)
jv.get("accounts")[0].party_balance = get_balance_on(party=pi.supplier, party_type="Supplier")
jv.get("accounts")[0].debit = pi.outstanding_amount
jv.get("accounts")[0].against_voucher = pi.name
row1 = jv.get("accounts")[0]
row1.account = pi.credit_to
row1.account_currency = pi.party_account_currency
row1.party_type = "Supplier"
row1.party = pi.supplier
row1.balance = get_balance_on(pi.credit_to)
row1.party_balance = get_balance_on(party=pi.supplier, party_type="Supplier")
row1.debit_in_account_currency = pi.outstanding_amount
row1.reference_type = pi.doctype
row1.reference_name = pi.name
row1.exchange_rate = exchange_rate
row1.account_type = "Payable" if pi.supplier else ""
# credit bank
jv.get("accounts")[1].credit = pi.outstanding_amount
row2 = jv.get("accounts")[1]
if row2.account_currency == pi.party_account_currency:
row2.credit_in_account_currency = pi.outstanding_amount
else:
row2.credit_in_account_currency = pi.outstanding_amount * exchange_rate
# set multi currency check
if row1.account_currency != pi.company_currency or row2.account_currency != pi.company_currency:
jv.multi_currency = 1
return jv.as_dict()
@frappe.whitelist()
def get_payment_entry_from_sales_order(sales_order):
"""Returns new Journal Entry document as dict for given Sales Order"""
from erpnext.accounts.utils import get_balance_on
from erpnext.accounts.party import get_party_account
so = frappe.get_doc("Sales Order", sales_order)
if flt(so.per_billed, 2) != 0.0:
frappe.throw(_("Can only make payment against unbilled Sales Order"))
jv = get_payment_entry(so)
jv.remark = 'Advance payment received against Sales Order {0}.'.format(so.name)
party_account = get_party_account("Customer", so.customer, so.company)
party_account_currency = get_account_currency(party_account)
exchange_rate = get_exchange_rate(party_account, party_account_currency, so.company)
if party_account_currency == so.company_currency:
amount = flt(so.base_grand_total) - flt(so.advance_paid)
else:
amount = flt(so.grand_total) - flt(so.advance_paid)
# credit customer
row1 = jv.get("accounts")[0]
row1.account = party_account
row1.account_currency = party_account_currency
row1.party_type = "Customer"
row1.party = so.customer
row1.balance = get_balance_on(party_account)
row1.party_balance = get_balance_on(party=so.customer, party_type="Customer")
row1.credit_in_account_currency = amount
row1.reference_type = so.doctype
row1.reference_name = so.name
row1.is_advance = "Yes"
row1.exchange_rate = exchange_rate
row1.account_type = "Receivable"
# debit bank
row2 = jv.get("accounts")[1]
if row2.account_currency == party_account_currency:
row2.debit_in_account_currency = amount
else:
row2.debit_in_account_currency = amount * exchange_rate
# set multi currency check
if row1.account_currency != so.company_currency or row2.account_currency != so.company_currency:
jv.multi_currency = 1
return jv.as_dict()
@frappe.whitelist()
def get_payment_entry_from_purchase_order(purchase_order):
"""Returns new Journal Entry document as dict for given Sales Order"""
from erpnext.accounts.utils import get_balance_on
from erpnext.accounts.party import get_party_account
po = frappe.get_doc("Purchase Order", purchase_order)
if flt(po.per_billed, 2) != 0.0:
frappe.throw(_("Can only make payment against unbilled Sales Order"))
jv = get_payment_entry(po)
jv.remark = 'Advance payment made against Purchase Order {0}.'.format(po.name)
party_account = get_party_account("Supplier", po.supplier, po.company)
party_account_currency = get_account_currency(party_account)
exchange_rate = get_exchange_rate(party_account, party_account_currency, po.company)
if party_account_currency == po.company_currency:
amount = flt(po.base_grand_total) - flt(po.advance_paid)
else:
amount = flt(po.grand_total) - flt(po.advance_paid)
# credit customer
row1 = jv.get("accounts")[0]
row1.account = party_account
row1.party_type = "Supplier"
row1.party = po.supplier
row1.balance = get_balance_on(party_account)
row1.party_balance = get_balance_on(party=po.supplier, party_type="Supplier")
row1.debit_in_account_currency = amount
row1.reference_type = po.doctype
row1.reference_name = po.name
row1.is_advance = "Yes"
row1.exchange_rate = exchange_rate
row1.account_type = "Payable"
# debit bank
row2 = jv.get("accounts")[1]
if row2.account_currency == party_account_currency:
row2.credit_in_account_currency = amount
else:
row2.credit_in_account_currency = amount * exchange_rate
# set multi currency check
if row1.account_currency != po.company_currency or row2.account_currency != po.company_currency:
jv.multi_currency = 1
return jv.as_dict()
@@ -523,6 +708,10 @@ def get_payment_entry(doc):
if bank_account:
d2.account = bank_account["account"]
d2.balance = bank_account["balance"]
d2.account_currency = bank_account["account_currency"]
d2.account_type = bank_account["account_type"]
d2.exchange_rate = get_exchange_rate(bank_account["account"],
bank_account["account_currency"], doc.company)
return jv
@@ -539,40 +728,55 @@ def get_against_jv(doctype, txt, searchfield, start, page_len, filters):
return frappe.db.sql("""select jv.name, jv.posting_date, jv.user_remark
from `tabJournal Entry` jv, `tabJournal Entry Account` jv_detail
where jv_detail.parent = jv.name and jv_detail.account = %s and ifnull(jv_detail.party, '') = %s
and (ifnull(jv_detail.against_invoice, '') = '' and ifnull(jv_detail.against_voucher, '') = ''
and ifnull(jv_detail.against_jv, '') = '' )
and ifnull(jv_detail.reference_type, '') = ''
and jv.docstatus = 1 and jv.{0} like %s order by jv.name desc limit %s, %s""".format(searchfield),
(filters.get("account"), cstr(filters.get("party")), "%{0}%".format(txt), start, page_len))
@frappe.whitelist()
def get_outstanding(args):
if not frappe.has_permission("Account"):
frappe.msgprint(_("No Permission"), raise_exception=1)
args = eval(args)
if args.get("doctype") == "Journal Entry" and args.get("party"):
company_currency = get_company_currency(args.get("company"))
if args.get("doctype") == "Journal Entry":
condition = " and party=%(party)s" if args.get("party") else ""
against_jv_amount = frappe.db.sql("""
select sum(ifnull(debit, 0)) - sum(ifnull(credit, 0))
from `tabJournal Entry Account` where parent=%s and party=%s
and ifnull(against_invoice, '')='' and ifnull(against_voucher, '')=''
and ifnull(against_jv, '')=''""", (args['docname'], args['party']))
select sum(ifnull(debit_in_account_currency, 0)) - sum(ifnull(credit_in_account_currency, 0))
from `tabJournal Entry Account` where parent=%(docname)s and account=%(account)s {0}
and ifnull(reference_type, '')=''""".format(condition), args)
against_jv_amount = flt(against_jv_amount[0][0]) if against_jv_amount else 0
if against_jv_amount > 0:
return {"credit": against_jv_amount}
else:
return {"debit": -1* against_jv_amount}
elif args.get("doctype") == "Sales Invoice":
amount_field = "credit_in_account_currency" if against_jv_amount > 0 else "debit_in_account_currency"
return {
"credit": flt(frappe.db.get_value("Sales Invoice", args["docname"], "outstanding_amount"))
amount_field: abs(against_jv_amount)
}
elif args.get("doctype") == "Purchase Invoice":
elif args.get("doctype") in ("Sales Invoice", "Purchase Invoice"):
invoice = frappe.db.get_value(args["doctype"], args["docname"],
["outstanding_amount", "conversion_rate"], as_dict=1)
exchange_rate = invoice.conversion_rate if (args.get("account_currency") != company_currency) else 1
if args["doctype"] == "Sales Invoice":
amount_field = "credit_in_account_currency" \
if flt(invoice.outstanding_amount) > 0 else "debit_in_account_currency"
else:
amount_field = "debit_in_account_currency" \
if flt(invoice.outstanding_amount) > 0 else "credit_in_account_currency"
return {
"debit": flt(frappe.db.get_value("Purchase Invoice", args["docname"], "outstanding_amount"))
amount_field: abs(flt(invoice.outstanding_amount)),
"exchange_rate": exchange_rate
}
@frappe.whitelist()
def get_party_account_and_balance(company, party_type, party):
if not frappe.has_permission("Account"):
frappe.msgprint(_("No Permission"), raise_exception=1)
from erpnext.accounts.party import get_party_account
account = get_party_account(company, party, party_type)
account = get_party_account(party_type, party, company)
account_balance = get_balance_on(account=account)
party_balance = get_balance_on(party_type=party_type, party=party)
@@ -582,3 +786,63 @@ def get_party_account_and_balance(company, party_type, party):
"balance": account_balance,
"party_balance": party_balance
}
@frappe.whitelist()
def get_account_balance_and_party_type(account, date, company, debit=None, credit=None, exchange_rate=None):
"""Returns dict of account balance and party type to be set in Journal Entry on selection of account."""
if not frappe.has_permission("Account"):
frappe.msgprint(_("No Permission"), raise_exception=1)
company_currency = get_company_currency(company)
account_details = frappe.db.get_value("Account", account, ["account_type", "account_currency"], as_dict=1)
if account_details.account_type == "Receivable":
party_type = "Customer"
elif account_details.account_type == "Payable":
party_type = "Supplier"
else:
party_type = ""
grid_values = {
"balance": get_balance_on(account, date),
"party_type": party_type,
"account_type": account_details.account_type,
"account_currency": account_details.account_currency or company_currency,
"exchange_rate": get_exchange_rate(account, account_details.account_currency,
company, debit=debit, credit=credit, exchange_rate=exchange_rate)
}
return grid_values
@frappe.whitelist()
def get_exchange_rate(account, account_currency, company,
reference_type=None, reference_name=None, debit=None, credit=None, exchange_rate=None):
from erpnext.setup.utils import get_exchange_rate
company_currency = get_company_currency(company)
account_details = frappe.db.get_value("Account", account, ["account_type", "root_type"], as_dict=1)
if account_currency != company_currency:
if reference_type in ("Sales Invoice", "Purchase Invoice") and reference_name:
exchange_rate = frappe.db.get_value(reference_type, reference_name, "conversion_rate")
elif account_details and account_details.account_type == "Bank" and \
((account_details.root_type == "Asset" and flt(credit) > 0) or
(account_details.root_type == "Liability" and debit)):
exchange_rate = get_average_exchange_rate(account)
if not exchange_rate and account_currency:
exchange_rate = get_exchange_rate(account_currency, company_currency)
else:
exchange_rate = 1
# don't return None or 0 as it is multipled with a value and that value could be lost
return exchange_rate or 1
def get_average_exchange_rate(account):
exchange_rate = 0
bank_balance_in_account_currency = get_balance_on(account)
if bank_balance_in_account_currency:
bank_balance_in_company_currency = get_balance_on(account, in_account_currency=False)
exchange_rate = bank_balance_in_company_currency / bank_balance_in_account_currency
return exchange_rate

View File

@@ -5,6 +5,7 @@ from __future__ import unicode_literals
import unittest, frappe
from frappe.utils import flt
from erpnext.accounts.utils import get_actual_expense, BudgetError, get_fiscal_year
from erpnext.exceptions import InvalidAccountCurrency
class TestJournalEntry(unittest.TestCase):
@@ -29,10 +30,6 @@ class TestJournalEntry(unittest.TestCase):
def jv_against_voucher_testcase(self, base_jv, test_voucher):
dr_or_cr = "credit" if test_voucher.doctype in ["Sales Order", "Journal Entry"] else "debit"
field_dict = {'Journal Entry': "against_jv",
'Sales Order': "against_sales_order",
'Purchase Order': "against_purchase_order"
}
test_voucher.insert()
test_voucher.submit()
@@ -42,21 +39,20 @@ class TestJournalEntry(unittest.TestCase):
where account = %s and docstatus = 1 and parent = %s""",
("_Test Receivable - _TC", test_voucher.name)))
self.assertTrue(not frappe.db.sql("""select name from `tabJournal Entry Account`
where %s=%s""" % (field_dict.get(test_voucher.doctype), '%s'), (test_voucher.name)))
self.assertFalse(frappe.db.sql("""select name from `tabJournal Entry Account`
where reference_type = %s and reference_name = %s""", (test_voucher.doctype, test_voucher.name)))
base_jv.get("accounts")[0].is_advance = "Yes" if (test_voucher.doctype in ["Sales Order", "Purchase Order"]) else "No"
base_jv.get("accounts")[0].set(field_dict.get(test_voucher.doctype), test_voucher.name)
base_jv.get("accounts")[0].set("reference_type", test_voucher.doctype)
base_jv.get("accounts")[0].set("reference_name", test_voucher.name)
base_jv.insert()
base_jv.submit()
submitted_voucher = frappe.get_doc(test_voucher.doctype, test_voucher.name)
self.assertTrue(frappe.db.sql("""select name from `tabJournal Entry Account`
where %s=%s""" % (field_dict.get(test_voucher.doctype), '%s'), (submitted_voucher.name)))
self.assertTrue(frappe.db.sql("""select name from `tabJournal Entry Account`
where %s=%s and %s=400""" % (field_dict.get(submitted_voucher.doctype), '%s', dr_or_cr), (submitted_voucher.name)))
where reference_type = %s and reference_name = %s and {0}=400""".format(dr_or_cr),
(submitted_voucher.doctype, submitted_voucher.name)))
if base_jv.get("accounts")[0].is_advance == "Yes":
self.advance_paid_testcase(base_jv, submitted_voucher, dr_or_cr)
@@ -74,8 +70,8 @@ class TestJournalEntry(unittest.TestCase):
if test_voucher.doctype == "Journal Entry":
# if test_voucher is a Journal Entry, test cancellation of test_voucher
test_voucher.cancel()
self.assertTrue(not frappe.db.sql("""select name from `tabJournal Entry Account`
where against_jv=%s""", test_voucher.name))
self.assertFalse(frappe.db.sql("""select name from `tabJournal Entry Account`
where reference_type='Journal Entry' and reference_name=%s""", test_voucher.name))
elif test_voucher.doctype in ["Sales Order", "Purchase Order"]:
# if test_voucher is a Sales Order/Purchase Order, test error on cancellation of test_voucher
@@ -102,23 +98,23 @@ class TestJournalEntry(unittest.TestCase):
def test_monthly_budget_crossed_ignore(self):
frappe.db.set_value("Company", "_Test Company", "monthly_bgt_flag", "Ignore")
self.set_total_expense_zero("2013-02-28")
jv = make_journal_entry("_Test Account Cost for Goods Sold - _TC",
"_Test Account Bank Account - _TC", 40000, "_Test Cost Center - _TC", submit=True)
jv = make_journal_entry("_Test Account Cost for Goods Sold - _TC",
"_Test Bank - _TC", 40000, "_Test Cost Center - _TC", submit=True)
self.assertTrue(frappe.db.get_value("GL Entry",
{"voucher_type": "Journal Entry", "voucher_no": jv.name}))
def test_monthly_budget_crossed_stop(self):
frappe.db.set_value("Company", "_Test Company", "monthly_bgt_flag", "Stop")
self.set_total_expense_zero("2013-02-28")
jv = make_journal_entry("_Test Account Cost for Goods Sold - _TC",
"_Test Account Bank Account - _TC", 40000, "_Test Cost Center - _TC")
jv = make_journal_entry("_Test Account Cost for Goods Sold - _TC",
"_Test Bank - _TC", 40000, "_Test Cost Center - _TC")
self.assertRaises(BudgetError, jv.submit)
frappe.db.set_value("Company", "_Test Company", "monthly_bgt_flag", "Ignore")
@@ -127,37 +123,37 @@ class TestJournalEntry(unittest.TestCase):
self.test_monthly_budget_crossed_ignore()
frappe.db.set_value("Company", "_Test Company", "yearly_bgt_flag", "Stop")
self.set_total_expense_zero("2013-02-28")
jv = make_journal_entry("_Test Account Cost for Goods Sold - _TC",
"_Test Account Bank Account - _TC", 150000, "_Test Cost Center - _TC")
jv = make_journal_entry("_Test Account Cost for Goods Sold - _TC",
"_Test Bank - _TC", 150000, "_Test Cost Center - _TC")
self.assertRaises(BudgetError, jv.submit)
frappe.db.set_value("Company", "_Test Company", "yearly_bgt_flag", "Ignore")
def test_monthly_budget_on_cancellation(self):
self.set_total_expense_zero("2013-02-28")
jv1 = make_journal_entry("_Test Account Cost for Goods Sold - _TC",
"_Test Account Bank Account - _TC", 20000, "_Test Cost Center - _TC", submit=True)
jv1 = make_journal_entry("_Test Account Cost for Goods Sold - _TC",
"_Test Bank - _TC", 20000, "_Test Cost Center - _TC", submit=True)
self.assertTrue(frappe.db.get_value("GL Entry",
{"voucher_type": "Journal Entry", "voucher_no": jv1.name}))
jv2 = make_journal_entry("_Test Account Cost for Goods Sold - _TC",
"_Test Account Bank Account - _TC", 20000, "_Test Cost Center - _TC", submit=True)
jv2 = make_journal_entry("_Test Account Cost for Goods Sold - _TC",
"_Test Bank - _TC", 20000, "_Test Cost Center - _TC", submit=True)
self.assertTrue(frappe.db.get_value("GL Entry",
{"voucher_type": "Journal Entry", "voucher_no": jv2.name}))
frappe.db.set_value("Company", "_Test Company", "monthly_bgt_flag", "Stop")
self.assertRaises(BudgetError, jv1.cancel)
frappe.db.set_value("Company", "_Test Company", "monthly_bgt_flag", "Ignore")
def get_actual_expense(self, monthly_end_date):
return get_actual_expense({
"account": "_Test Account Cost for Goods Sold - _TC",
@@ -166,38 +162,118 @@ class TestJournalEntry(unittest.TestCase):
"company": "_Test Company",
"fiscal_year": get_fiscal_year(monthly_end_date)[0]
})
def set_total_expense_zero(self, posting_date):
existing_expense = self.get_actual_expense(posting_date)
make_journal_entry("_Test Account Cost for Goods Sold - _TC",
"_Test Account Bank Account - _TC", -existing_expense, "_Test Cost Center - _TC", submit=True)
def make_journal_entry(account1, account2, amount, cost_center=None, submit=False):
make_journal_entry("_Test Account Cost for Goods Sold - _TC",
"_Test Bank - _TC", -existing_expense, "_Test Cost Center - _TC", submit=True)
def test_multi_currency(self):
jv = make_journal_entry("_Test Bank USD - _TC",
"_Test Bank - _TC", 100, exchange_rate=50, save=False)
jv.get("accounts")[1].credit_in_account_currency = 5000
jv.submit()
gl_entries = frappe.db.sql("""select account, account_currency, debit, credit,
debit_in_account_currency, credit_in_account_currency
from `tabGL Entry` where voucher_type='Journal Entry' and voucher_no=%s
order by account asc""", jv.name, as_dict=1)
self.assertTrue(gl_entries)
expected_values = {
"_Test Bank USD - _TC": {
"account_currency": "USD",
"debit": 5000,
"debit_in_account_currency": 100,
"credit": 0,
"credit_in_account_currency": 0
},
"_Test Bank - _TC": {
"account_currency": "INR",
"debit": 0,
"debit_in_account_currency": 0,
"credit": 5000,
"credit_in_account_currency": 5000
}
}
for field in ("account_currency", "debit", "debit_in_account_currency", "credit", "credit_in_account_currency"):
for i, gle in enumerate(gl_entries):
self.assertEquals(expected_values[gle.account][field], gle[field])
# cancel
jv.cancel()
gle = frappe.db.sql("""select name from `tabGL Entry`
where voucher_type='Sales Invoice' and voucher_no=%s""", jv.name)
self.assertFalse(gle)
def test_disallow_change_in_account_currency_for_a_party(self):
# create jv in USD
jv = make_journal_entry("_Test Bank USD - _TC",
"_Test Receivable USD - _TC", 100, save=False)
jv.accounts[1].update({
"party_type": "Customer",
"party": "_Test Customer USD"
})
jv.submit()
# create jv in USD, but account currency in INR
jv = make_journal_entry("_Test Bank - _TC",
"_Test Receivable - _TC", 100, save=False)
jv.accounts[1].update({
"party_type": "Customer",
"party": "_Test Customer USD"
})
self.assertRaises(InvalidAccountCurrency, jv.submit)
# back in USD
jv = make_journal_entry("_Test Bank USD - _TC",
"_Test Receivable USD - _TC", 100, save=False)
jv.accounts[1].update({
"party_type": "Customer",
"party": "_Test Customer USD"
})
jv.submit()
def make_journal_entry(account1, account2, amount, cost_center=None, exchange_rate=1, save=True, submit=False):
jv = frappe.new_doc("Journal Entry")
jv.posting_date = "2013-02-14"
jv.company = "_Test Company"
jv.fiscal_year = "_Test Fiscal Year 2013"
jv.user_remark = "test"
jv.multi_currency = 1
jv.set("accounts", [
{
"account": account1,
"cost_center": cost_center,
"debit": amount if amount > 0 else 0,
"credit": abs(amount) if amount < 0 else 0,
"debit_in_account_currency": amount if amount > 0 else 0,
"credit_in_account_currency": abs(amount) if amount < 0 else 0,
"exchange_rate": exchange_rate
}, {
"account": account2,
"cost_center": cost_center,
"credit": amount if amount > 0 else 0,
"debit": abs(amount) if amount < 0 else 0,
"credit_in_account_currency": amount if amount > 0 else 0,
"debit_in_account_currency": abs(amount) if amount < 0 else 0,
"exchange_rate": exchange_rate
}
])
jv.insert()
if submit:
jv.submit()
if save or submit:
jv.insert()
if submit:
jv.submit()
return jv
test_records = frappe.get_test_records('Journal Entry')

View File

@@ -9,15 +9,15 @@
"account": "_Test Receivable - _TC",
"party_type": "Customer",
"party": "_Test Customer",
"credit": 400.0,
"debit": 0.0,
"credit_in_account_currency": 400.0,
"debit_in_account_currency": 0.0,
"doctype": "Journal Entry Account",
"parentfield": "accounts"
},
{
"account": "_Test Account Bank Account - _TC",
"credit": 0.0,
"debit": 400.0,
"account": "_Test Bank - _TC",
"credit_in_account_currency": 0.0,
"debit_in_account_currency": 400.0,
"doctype": "Journal Entry Account",
"parentfield": "accounts"
}
@@ -40,15 +40,15 @@
"account": "_Test Payable - _TC",
"party_type": "Supplier",
"party": "_Test Supplier",
"credit": 0.0,
"debit": 400.0,
"credit_in_account_currency": 0.0,
"debit_in_account_currency": 400.0,
"doctype": "Journal Entry Account",
"parentfield": "accounts"
},
{
"account": "_Test Account Bank Account - _TC",
"credit": 400.0,
"debit": 0.0,
"account": "_Test Bank - _TC",
"credit_in_account_currency": 400.0,
"debit_in_account_currency": 0.0,
"doctype": "Journal Entry Account",
"parentfield": "accounts"
}
@@ -71,16 +71,16 @@
"account": "_Test Receivable - _TC",
"party_type": "Customer",
"party": "_Test Customer",
"credit": 0.0,
"debit": 400.0,
"credit_in_account_currency": 0.0,
"debit_in_account_currency": 400.0,
"doctype": "Journal Entry Account",
"parentfield": "accounts"
},
{
"account": "Sales - _TC",
"cost_center": "_Test Cost Center - _TC",
"credit": 400.0,
"debit": 0.0,
"credit_in_account_currency": 400.0,
"debit_in_account_currency": 0.0,
"doctype": "Journal Entry Account",
"parentfield": "accounts"
}

View File

@@ -1,215 +1,576 @@
{
"allow_copy": 0,
"allow_import": 0,
"allow_rename": 0,
"autoname": "hash",
"creation": "2013-02-22 01:27:39",
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"fields": [
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "account",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 1,
"in_list_view": 1,
"label": "Account",
"no_copy": 0,
"oldfieldname": "account",
"oldfieldtype": "Link",
"options": "Account",
"permlevel": 0,
"print_hide": 0,
"print_width": "250px",
"read_only": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 1,
"set_only_once": 0,
"unique": 0,
"width": "250px"
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "account_type",
"fieldtype": "Data",
"hidden": 1,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Account Type",
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 1,
"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": "balance",
"fieldtype": "Currency",
"in_list_view": 1,
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Account Balance",
"no_copy": 1,
"oldfieldname": "balance",
"oldfieldtype": "Data",
"options": "Company:company:default_currency",
"options": "account_currency",
"permlevel": 0,
"print_hide": 1,
"read_only": 1
"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,
"default": ":Company",
"description": "If Income or Expense",
"fieldname": "cost_center",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 1,
"in_list_view": 1,
"in_list_view": 0,
"label": "Cost Center",
"no_copy": 0,
"oldfieldname": "cost_center",
"oldfieldtype": "Link",
"options": "Cost Center",
"permlevel": 0,
"print_hide": 1,
"print_width": "180px",
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0,
"width": "180px"
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "col_break1",
"fieldtype": "Column Break",
"permlevel": 0
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 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": "party_type",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Party Type",
"no_copy": 0,
"options": "DocType",
"permlevel": 0
"permlevel": 0,
"print_hide": 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": "party",
"fieldtype": "Dynamic Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Party",
"no_copy": 0,
"options": "party_type",
"permlevel": 0
"permlevel": 0,
"print_hide": 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": "party_balance",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Party Balance",
"options": "Company:company:default_currency",
"no_copy": 0,
"options": "account_currency",
"permlevel": 0,
"precision": "",
"read_only": 1
"print_hide": 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,
"collapsible_depends_on": "",
"depends_on": "",
"fieldname": "currency_section",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Currency",
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 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": "account_currency",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Account Currency",
"no_copy": 1,
"options": "Currency",
"permlevel": 0,
"precision": "",
"print_hide": 1,
"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": "column_break_10",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 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": "exchange_rate",
"fieldtype": "Float",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Exchange Rate",
"no_copy": 0,
"permlevel": 0,
"precision": "6",
"print_hide": 1,
"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": "sec_break1",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Amount",
"permlevel": 0
"no_copy": 0,
"permlevel": 0,
"print_hide": 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": "debit_in_account_currency",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Debit in Account Currency",
"no_copy": 0,
"options": "account_currency",
"permlevel": 0,
"precision": "",
"print_hide": 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": "debit",
"fieldtype": "Currency",
"in_list_view": 1,
"label": "Debit",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Debit in Company Currency",
"no_copy": 1,
"oldfieldname": "debit",
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
"permlevel": 0
"permlevel": 0,
"precision": "",
"print_hide": 1,
"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": "col_break2",
"fieldtype": "Column Break",
"permlevel": 0
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 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": "credit_in_account_currency",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Credit in Account Currency",
"no_copy": 0,
"options": "account_currency",
"permlevel": 0,
"precision": "",
"print_hide": 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": "credit",
"fieldtype": "Currency",
"in_list_view": 1,
"label": "Credit",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Credit in Company Currency",
"no_copy": 1,
"oldfieldname": "credit",
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
"permlevel": 0
"permlevel": 0,
"precision": "",
"print_hide": 1,
"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",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Reference",
"permlevel": 0
},
{
"fieldname": "against_invoice",
"fieldtype": "Link",
"in_filter": 1,
"label": "Against Sales Invoice",
"no_copy": 1,
"oldfieldname": "against_invoice",
"oldfieldtype": "Link",
"options": "Sales Invoice",
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"search_index": 1
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"fieldname": "against_voucher",
"fieldtype": "Link",
"in_filter": 1,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "reference_type",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Reference Type",
"no_copy": 0,
"options": "\nSales Invoice\nPurchase Invoice\nJournal Entry\nSales Order\nPurchase Order\nExpense Claim",
"permlevel": 0,
"precision": "",
"print_hide": 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_name",
"fieldtype": "Dynamic Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Against Purchase Invoice",
"no_copy": 1,
"oldfieldname": "against_voucher",
"oldfieldtype": "Link",
"options": "Purchase Invoice",
"label": "Reference Name",
"no_copy": 0,
"options": "reference_type",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"search_index": 1
},
{
"fieldname": "against_jv",
"fieldtype": "Link",
"in_filter": 1,
"label": "Against Journal Entry",
"no_copy": 1,
"oldfieldname": "against_jv",
"oldfieldtype": "Link",
"options": "Journal Entry",
"permlevel": 0,
"print_hide": 0,
"search_index": 1
"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": "col_break3",
"fieldtype": "Column Break",
"permlevel": 0
},
{
"fieldname": "against_sales_order",
"fieldtype": "Link",
"label": "Against Sales Order",
"options": "Sales Order",
"permlevel": 0
},
{
"fieldname": "against_purchase_order",
"fieldtype": "Link",
"label": "Against Purchase Order",
"options": "Purchase Order",
"permlevel": 0
},
{
"fieldname": "against_expense_claim",
"fieldtype": "Link",
"label": "Against Expense Claim",
"options": "Expense Claim",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"permlevel": 0,
"precision": ""
"print_hide": 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": "is_advance",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Is Advance",
"no_copy": 1,
"oldfieldname": "is_advance",
"oldfieldtype": "Select",
"options": "No\nYes",
"permlevel": 0,
"print_hide": 1
"print_hide": 1,
"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": "against_account",
"fieldtype": "Text",
"hidden": 1,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Against Account",
"no_copy": 1,
"oldfieldname": "against_account",
"oldfieldtype": "Text",
"permlevel": 0,
"print_hide": 1
"print_hide": 1,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
}
],
"hide_heading": 0,
"hide_toolbar": 0,
"idx": 1,
"in_create": 0,
"in_dialog": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 1,
"modified": "2015-02-19 01:07:00.388689",
"modified": "2015-10-20 12:10:22.203395",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Journal Entry Account",
"owner": "Administrator",
"permissions": []
"permissions": [],
"read_only": 0,
"read_only_onload": 0
}

View File

@@ -1,58 +1,117 @@
{
"allow_copy": 0,
"allow_import": 1,
"allow_rename": 1,
"autoname": "field:mode_of_payment",
"creation": "2012-12-04 17:49:20",
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"document_type": "Master",
"document_type": "Setup",
"fields": [
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "mode_of_payment",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Mode of Payment",
"no_copy": 0,
"oldfieldname": "mode_of_payment",
"oldfieldtype": "Data",
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"reqd": 1
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "accounts",
"fieldtype": "Table",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Accounts",
"no_copy": 0,
"options": "Mode of Payment Account",
"permlevel": 0,
"precision": ""
"precision": "",
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
}
],
"hide_heading": 0,
"hide_toolbar": 0,
"icon": "icon-credit-card",
"idx": 1,
"modified": "2015-02-05 05:11:41.346436",
"in_create": 0,
"in_dialog": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 0,
"modified": "2015-10-02 07:38:57.318104",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Mode of Payment",
"owner": "harshada@webnotestech.com",
"permissions": [
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 1,
"delete": 0,
"email": 1,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Accounts Manager",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"write": 1
},
{
"apply_user_permissions": 1,
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 0,
"delete": 0,
"email": 0,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 0,
"read": 1,
"report": 1,
"role": "Accounts User"
"role": "Accounts User",
"set_user_permissions": 0,
"share": 0,
"submit": 0,
"write": 0
}
]
],
"read_only": 0,
"read_only_onload": 0
}

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('Mode of Payment')
class TestModeofPayment(unittest.TestCase):
pass

View File

@@ -10,6 +10,8 @@
"fields": [
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "company",
"fieldtype": "Link",
"hidden": 0,
@@ -26,10 +28,13 @@
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "Default Bank / Cash account will be automatically updated in POS Invoice when this mode is selected.",
"fieldname": "default_account",
"fieldtype": "Link",
@@ -47,7 +52,8 @@
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0
"set_only_once": 0,
"unique": 0
}
],
"hide_heading": 0,
@@ -57,7 +63,7 @@
"is_submittable": 0,
"issingle": 0,
"istable": 1,
"modified": "2015-01-06 17:26:57.053474",
"modified": "2015-10-02 07:38:57.388194",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Mode of Payment Account",

View File

@@ -1,46 +1,97 @@
{
"allow_copy": 0,
"allow_import": 0,
"allow_rename": 0,
"autoname": "field:distribution_id",
"creation": "2013-01-10 16:34:05",
"custom": 0,
"description": "**Monthly Distribution** helps you distribute your budget across months if you have seasonality in your business.\n\nTo distribute a budget using this distribution, set this **Monthly Distribution** in the **Cost Center**",
"docstatus": 0,
"doctype": "DocType",
"fields": [
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "Name of the Monthly Distribution",
"fieldname": "distribution_id",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Distribution Name",
"no_copy": 0,
"oldfieldname": "distribution_id",
"oldfieldtype": "Data",
"permlevel": 0,
"reqd": 1
"print_hide": 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": "fiscal_year",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 1,
"in_list_view": 1,
"label": "Fiscal Year",
"no_copy": 0,
"oldfieldname": "fiscal_year",
"oldfieldtype": "Select",
"options": "Fiscal Year",
"permlevel": 0,
"search_index": 1
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 1,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "percentages",
"fieldtype": "Table",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Monthly Distribution Percentages",
"no_copy": 0,
"oldfieldname": "budget_distribution_details",
"oldfieldtype": "Table",
"options": "Monthly Distribution Percentage",
"permlevel": 0
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
}
],
"hide_heading": 0,
"hide_toolbar": 0,
"icon": "icon-bar-chart",
"idx": 1,
"modified": "2015-02-05 05:11:41.429491",
"in_create": 0,
"in_dialog": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 0,
"modified": "2015-10-02 07:38:57.594541",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Monthly Distribution",
@@ -49,29 +100,47 @@
"permissions": [
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 1,
"delete": 1,
"email": 1,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Accounts Manager",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"write": 1
},
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 0,
"delete": 0,
"email": 0,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 2,
"print": 0,
"read": 1,
"report": 1,
"role": "Accounts Manager",
"submit": 0
"set_user_permissions": 0,
"share": 0,
"submit": 0,
"write": 0
}
],
"read_only": 0,
"read_only_onload": 0,
"sort_field": "modified",
"sort_order": "DESC"
}

View File

@@ -1,36 +1,74 @@
{
"allow_copy": 0,
"allow_import": 0,
"allow_rename": 0,
"autoname": "hash",
"creation": "2013-02-22 01:27:38",
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"fields": [
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "month",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Month",
"no_copy": 0,
"oldfieldname": "month",
"oldfieldtype": "Data",
"permlevel": 0,
"print_hide": 0,
"read_only": 1,
"reqd": 1
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "percentage_allocation",
"fieldtype": "Float",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Percentage Allocation",
"no_copy": 0,
"oldfieldname": "percentage_allocation",
"oldfieldtype": "Currency",
"permlevel": 0
"permlevel": 0,
"print_hide": 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": 1,
"in_create": 0,
"in_dialog": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 1,
"modified": "2015-02-19 01:07:00.800015",
"modified": "2015-10-02 07:38:57.670950",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Monthly Distribution Percentage",
"owner": "Administrator",
"permissions": []
"permissions": [],
"read_only": 0,
"read_only_onload": 0
}

View File

@@ -10,6 +10,8 @@
"fields": [
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "company",
"fieldtype": "Link",
"hidden": 0,
@@ -25,17 +27,35 @@
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "col_break1",
"fieldtype": "Column Break",
"label": "col_break1",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "",
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0,
"width": "50%"
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "account",
"fieldtype": "Link",
"hidden": 0,
@@ -51,7 +71,8 @@
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0
"set_only_once": 0,
"unique": 0
}
],
"hide_heading": 0,
@@ -61,7 +82,7 @@
"is_submittable": 0,
"issingle": 0,
"istable": 1,
"modified": "2014-08-29 16:08:49.388820",
"modified": "2015-10-02 07:38:59.582533",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Party Account",

View File

@@ -44,7 +44,7 @@ erpnext.accounts.PaymentReconciliationController = frappe.ui.form.Controller.ext
}
});
},
refresh: function() {
this.frm.disable_save();
},
@@ -74,21 +74,7 @@ erpnext.accounts.PaymentReconciliationController = frappe.ui.form.Controller.ext
doc: me.frm.doc,
method: 'get_unreconciled_entries',
callback: function(r, rt) {
var invoices = [];
$.each(me.frm.doc.invoices || [], function(i, row) {
if (row.invoice_number && !inList(invoices, row.invoice_number))
invoices.push(row.invoice_number);
});
frappe.meta.get_docfield("Payment Reconciliation Payment", "invoice_number",
me.frm.doc.name).options = invoices.join("\n");
$.each(me.frm.doc.payments || [], function(i, p) {
if(!inList(invoices, cstr(p.invoice_number))) p.invoice_number = null;
});
refresh_field("payments");
me.set_invoice_options();
}
});
@@ -98,8 +84,29 @@ erpnext.accounts.PaymentReconciliationController = frappe.ui.form.Controller.ext
var me = this;
return this.frm.call({
doc: me.frm.doc,
method: 'reconcile'
method: 'reconcile',
callback: function(r, rt) {
me.set_invoice_options();
}
});
},
set_invoice_options: function() {
var invoices = [];
$.each(me.frm.doc.invoices || [], function(i, row) {
if (row.invoice_number && !inList(invoices, row.invoice_number))
invoices.push(row.invoice_type + " | " + row.invoice_number);
});
frappe.meta.get_docfield("Payment Reconciliation Payment", "invoice_number",
me.frm.doc.name).options = invoices.join("\n");
$.each(me.frm.doc.payments || [], function(i, p) {
if(!inList(invoices, cstr(p.invoice_number))) p.invoice_number = null;
});
refresh_field("payments");
}
});

View File

@@ -1,5 +1,7 @@
{
"allow_copy": 1,
"allow_import": 0,
"allow_rename": 0,
"creation": "2014-07-09 12:04:51.681583",
"custom": 0,
"docstatus": 0,
@@ -7,132 +9,360 @@
"document_type": "",
"fields": [
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "company",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Company",
"no_copy": 0,
"options": "Company",
"permlevel": 0,
"reqd": 1
"print_hide": 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": "party_type",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Party Type",
"no_copy": 0,
"options": "DocType",
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"reqd": 1
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "",
"fieldname": "party",
"fieldtype": "Dynamic Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Party",
"no_copy": 0,
"options": "party_type",
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "receivable_payable_account",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Receivable / Payable Account",
"no_copy": 0,
"options": "Account",
"permlevel": 0,
"precision": "",
"reqd": 1
"print_hide": 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": "bank_cash_account",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Bank / Cash Account",
"no_copy": 0,
"options": "Account",
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "col_break1",
"fieldtype": "Column Break",
"label": "Column Break",
"permlevel": 0
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "",
"no_copy": 0,
"permlevel": 0,
"print_hide": 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": "from_date",
"fieldtype": "Date",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "From Date",
"no_copy": 0,
"permlevel": 0,
"search_index": 1
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 1,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "to_date",
"fieldtype": "Date",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "To Date",
"no_copy": 0,
"permlevel": 0,
"search_index": 1
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 1,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "minimum_amount",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Minimum Amount",
"permlevel": 0
"no_copy": 0,
"permlevel": 0,
"print_hide": 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": "maximum_amount",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Maximum Amount",
"permlevel": 0
"no_copy": 0,
"permlevel": 0,
"print_hide": 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": "get_unreconciled_entries",
"fieldtype": "Button",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Get Unreconciled Entries",
"permlevel": 0
"no_copy": 0,
"permlevel": 0,
"print_hide": 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": "sec_break1",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Unreconciled Payment Details",
"permlevel": 0
"no_copy": 0,
"permlevel": 0,
"print_hide": 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": "payments",
"fieldtype": "Table",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Payments",
"no_copy": 0,
"options": "Payment Reconciliation Payment",
"permlevel": 0
"permlevel": 0,
"print_hide": 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": "reconcile",
"fieldtype": "Button",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Reconcile",
"permlevel": 0
"no_copy": 0,
"permlevel": 0,
"print_hide": 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": "sec_break2",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Invoice/Journal Entry Details",
"permlevel": 0
"no_copy": 0,
"permlevel": 0,
"print_hide": 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": "invoices",
"fieldtype": "Table",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Invoices",
"no_copy": 0,
"options": "Payment Reconciliation Invoice",
"permlevel": 0,
"read_only": 1
"print_hide": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
}
],
"hide_heading": 0,
"hide_toolbar": 1,
"icon": "icon-resize-horizontal",
"in_create": 0,
"in_dialog": 0,
"is_submittable": 0,
"issingle": 1,
"modified": "2015-02-05 05:11:42.105088",
"istable": 0,
"modified": "2015-09-21 03:41:24.672227",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Payment Reconciliation",
@@ -140,28 +370,48 @@
"owner": "Administrator",
"permissions": [
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 1,
"delete": 1,
"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": 1,
"submit": 0,
"write": 1
},
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 1,
"delete": 1,
"email": 0,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 0,
"read": 1,
"report": 0,
"role": "Accounts User",
"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

@@ -3,11 +3,8 @@
from __future__ import unicode_literals
import frappe
from frappe.utils import flt
from frappe import msgprint, _
from frappe.model.document import Document
class PaymentReconciliation(Document):
@@ -17,7 +14,8 @@ class PaymentReconciliation(Document):
def get_jv_entries(self):
self.check_mandatory_to_fetch()
dr_or_cr = "credit" if self.party_type == "Customer" else "debit"
dr_or_cr = "credit_in_account_currency" if self.party_type == "Customer" \
else "debit_in_account_currency"
cond = self.check_condition(dr_or_cr)
@@ -34,8 +32,8 @@ class PaymentReconciliation(Document):
t1.name = t2.parent and t1.docstatus = 1 and t2.docstatus = 1
and t2.party_type = %(party_type)s and t2.party = %(party)s
and t2.account = %(account)s and {dr_or_cr} > 0
and ifnull(t2.against_voucher, '')='' and ifnull(t2.against_invoice, '')=''
and ifnull(t2.against_jv, '')='' {cond}
and ifnull(t2.reference_type, '') in ('', 'Sales Order', 'Purchase Order')
{cond}
and (CASE
WHEN t1.voucher_type in ('Debit Note', 'Credit Note')
THEN 1=1
@@ -68,7 +66,7 @@ class PaymentReconciliation(Document):
def get_invoice_entries(self):
#Fetch JVs, Sales and Purchase Invoices for 'invoices' to reconcile against
non_reconciled_invoices = []
dr_or_cr = "debit" if self.party_type == "Customer" else "credit"
dr_or_cr = "debit_in_account_currency" if self.party_type == "Customer" else "credit_in_account_currency"
cond = self.check_condition(dr_or_cr)
invoice_list = frappe.db.sql("""
@@ -80,6 +78,11 @@ class PaymentReconciliation(Document):
where
party_type = %(party_type)s and party = %(party)s
and account = %(account)s and {dr_or_cr} > 0 {cond}
and (CASE
WHEN voucher_type = 'Journal Entry'
THEN ifnull(against_voucher, '') = ''
ELSE 1=1
END)
group by voucher_type, voucher_no
""".format(**{
"cond": cond,
@@ -101,13 +104,15 @@ class PaymentReconciliation(Document):
and account = %(account)s and {0} > 0
and against_voucher_type = %(against_voucher_type)s
and ifnull(against_voucher, '') = %(against_voucher)s
""".format("credit" if self.party_type == "Customer" else "debit"), {
"party_type": self.party_type,
"party": self.party,
"account": self.receivable_payable_account,
"against_voucher_type": d.voucher_type,
"against_voucher": d.voucher_no
})
""".format("credit_in_account_currency" if self.party_type == "Customer"
else "debit_in_account_currency"), {
"party_type": self.party_type,
"party": self.party,
"account": self.receivable_payable_account,
"against_voucher_type": d.voucher_type,
"against_voucher": d.voucher_no
}
)
payment_amount = payment_amount[0][0] if payment_amount else 0
@@ -135,12 +140,18 @@ class PaymentReconciliation(Document):
ent.outstanding_amount = e.get('outstanding_amount')
def reconcile(self, args):
for e in self.get('payments'):
e.invoice_type = None
if e.invoice_number and " | " in e.invoice_number:
e.invoice_type, e.invoice_number = e.invoice_number.split(" | ")
self.get_invoice_entries()
self.validate_invoice()
dr_or_cr = "credit" if self.party_type == "Customer" else "debit"
dr_or_cr = "credit_in_account_currency" if self.party_type == "Customer" \
else "debit_in_account_currency"
lst = []
for e in self.get('payments'):
if e.invoice_type and e.invoice_number and e.allocated_amount:
if e.invoice_number and e.allocated_amount:
lst.append({
'voucher_no' : e.journal_entry,
'voucher_detail_no' : e.voucher_detail_number,
@@ -191,9 +202,10 @@ class PaymentReconciliation(Document):
frappe.throw(_("Row {0}: Allocated amount {1} must be less than or equals to JV amount {2}")
.format(p.idx, p.allocated_amount, p.amount))
if flt(p.allocated_amount) > unreconciled_invoices.get(p.invoice_type, {}).get(p.invoice_number):
invoice_outstanding = unreconciled_invoices.get(p.invoice_type, {}).get(p.invoice_number)
if flt(p.allocated_amount) - invoice_outstanding > 0.009:
frappe.throw(_("Row {0}: Allocated amount {1} must be less than or equals to invoice outstanding amount {2}")
.format(p.idx, p.allocated_amount, unreconciled_invoices.get(p.invoice_type, {}).get(p.invoice_number)))
.format(p.idx, p.allocated_amount, invoice_outstanding))
if not invoices_to_reconcile:
frappe.throw(_("Please select Allocated Amount, Invoice Type and Invoice Number in atleast one row"))

View File

@@ -1,66 +1,158 @@
{
"allow_copy": 0,
"allow_import": 0,
"allow_rename": 0,
"creation": "2014-07-09 16:14:23.672922",
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"document_type": "",
"fields": [
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "invoice_type",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Invoice Type",
"no_copy": 0,
"options": "Sales Invoice\nPurchase Invoice\nJournal Entry",
"permlevel": 0,
"read_only": 1
"print_hide": 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": "invoice_number",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Invoice Number",
"no_copy": 0,
"options": "",
"permlevel": 0,
"read_only": 1
"print_hide": 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": "invoice_date",
"fieldtype": "Date",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Invoice Date",
"no_copy": 0,
"permlevel": 0,
"read_only": 1
"print_hide": 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": "col_break1",
"fieldtype": "Column Break",
"label": "Column Break",
"permlevel": 0
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "",
"no_copy": 0,
"permlevel": 0,
"print_hide": 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": 1,
"label": "Amount",
"no_copy": 0,
"permlevel": 0,
"read_only": 1
"print_hide": 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": "outstanding_amount",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Outstanding Amount",
"no_copy": 0,
"permlevel": 0,
"read_only": 1
"print_hide": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
}
],
"hide_heading": 0,
"hide_toolbar": 0,
"in_create": 0,
"in_dialog": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 1,
"modified": "2014-07-18 12:20:51.269974",
"modified": "2015-10-16 06:14:07.460813",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Payment Reconciliation Invoice",
"name_case": "",
"owner": "Administrator",
"permissions": [],
"read_only": 0,
"read_only_onload": 0,
"sort_field": "modified",
"sort_order": "DESC"
}

View File

@@ -1,116 +1,243 @@
{
"allow_copy": 0,
"allow_import": 0,
"allow_rename": 0,
"creation": "2014-07-09 16:13:35.452759",
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"document_type": "",
"fields": [
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "journal_entry",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Journal Entry",
"no_copy": 0,
"options": "Journal Entry",
"permlevel": 0,
"print_hide": 0,
"read_only": 1,
"reqd": 0
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "posting_date",
"fieldtype": "Date",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Posting Date",
"no_copy": 0,
"permlevel": 0,
"read_only": 1
"print_hide": 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": "amount",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Amount",
"no_copy": 0,
"permlevel": 0,
"read_only": 1
"print_hide": 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": "is_advance",
"fieldtype": "Data",
"hidden": 1,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Is Advance",
"no_copy": 0,
"permlevel": 0,
"read_only": 1
"print_hide": 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": "voucher_detail_number",
"fieldtype": "Data",
"hidden": 1,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Voucher Detail Number",
"no_copy": 0,
"permlevel": 0,
"read_only": 1
"print_hide": 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": "col_break1",
"fieldtype": "Column Break",
"label": "Column Break",
"permlevel": 0
},
{
"fieldname": "allocated_amount",
"fieldtype": "Currency",
"in_list_view": 1,
"label": "Allocated amount",
"permlevel": 0,
"precision": "",
"reqd": 1
},
{
"default": "Sales Invoice",
"fieldname": "invoice_type",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Invoice Type",
"options": "\nSales Invoice\nPurchase Invoice\nJournal Entry",
"label": "",
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"reqd": 1
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "invoice_number",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Invoice Number",
"no_copy": 0,
"options": "",
"permlevel": 0,
"reqd": 1
"print_hide": 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": "allocated_amount",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Allocated amount",
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 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": "sec_break1",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "",
"permlevel": 0
"no_copy": 0,
"permlevel": 0,
"print_hide": 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": "remark",
"fieldtype": "Small Text",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Remark",
"no_copy": 0,
"permlevel": 0,
"read_only": 1
},
{
"fieldname": "col_break2",
"fieldtype": "Column Break",
"label": "Column Break",
"permlevel": 0
"print_hide": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
}
],
"hide_heading": 0,
"hide_toolbar": 0,
"in_create": 0,
"in_dialog": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 1,
"modified": "2014-12-25 16:26:48.345281",
"modified": "2015-10-02 07:38:59.835936",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Payment Reconciliation Payment",
"name_case": "",
"owner": "Administrator",
"permissions": [],
"read_only": 0,
"read_only_onload": 0,
"sort_field": "modified",
"sort_order": "DESC"
}

View File

@@ -25,8 +25,14 @@ frappe.ui.form.on("Payment Tool", "onload", function(frm) {
});
frm.set_query("against_voucher_type", "vouchers", function() {
if (frm.doc.party_type=="Customer") {
var doctypes = ["Sales Order", "Sales Invoice", "Journal Entry"];
} else {
var doctypes = ["Purchase Order", "Purchase Invoice", "Journal Entry"];
}
return {
filters: {"name": ["in", ["Sales Invoice", "Purchase Invoice", "Journal Entry", "Sales Order", "Purchase Order"]]}
filters: { "name": ["in", doctypes] }
};
});
});
@@ -55,6 +61,25 @@ frappe.ui.form.on("Payment Tool", "party", function(frm) {
}
})
frappe.ui.form.on("Payment Tool", "party_account", function(frm) {
if(frm.doc.party_account) {
frm.call({
method: "frappe.client.get_value",
args: {
doctype: "Account",
fieldname: "account_currency",
filters: { name: frm.doc.party_account },
},
callback: function(r, rt) {
if(r.message) {
frm.set_value("party_account_currency", r.message.account_currency);
erpnext.payment_tool.check_mandatory_to_set_button(frm);
}
}
});
}
})
frappe.ui.form.on("Payment Tool", "company", function(frm) {
erpnext.payment_tool.check_mandatory_to_set_button(frm);
});
@@ -63,10 +88,6 @@ frappe.ui.form.on("Payment Tool", "received_or_paid", function(frm) {
erpnext.payment_tool.check_mandatory_to_set_button(frm);
});
frappe.ui.form.on("Payment Tool", "party", function(frm) {
erpnext.payment_tool.check_mandatory_to_set_button(frm);
});
// Fetch bank/cash account based on payment mode
frappe.ui.form.on("Payment Tool", "payment_mode", function(frm) {
return frappe.call({
@@ -75,7 +96,7 @@ frappe.ui.form.on("Payment Tool", "payment_mode", function(frm) {
"mode_of_payment": frm.doc.payment_mode,
"company": frm.doc.company
},
callback: function(r, rt) {
callback: function(r, rt) {
if(r.message) {
cur_frm.set_value("payment_account", r.message['account']);
}
@@ -120,6 +141,10 @@ frappe.ui.form.on("Payment Tool", "get_outstanding_vouchers", function(frm) {
c.against_voucher_no = d.voucher_no;
c.total_amount = d.invoice_amount;
c.outstanding_amount = d.outstanding_amount;
if (frm.doc.set_payment_amount) {
c.payment_amount = d.outstanding_amount;
}
});
}
refresh_field("vouchers");
@@ -130,41 +155,63 @@ frappe.ui.form.on("Payment Tool", "get_outstanding_vouchers", function(frm) {
});
// validate against_voucher_type
frappe.ui.form.on("Payment Tool Detail", "against_voucher_type", function(frm) {
erpnext.payment_tool.validate_against_voucher(frm);
frappe.ui.form.on("Payment Tool Detail", "against_voucher_type", function(frm, cdt, cdn) {
var row = frappe.model.get_doc(cdt, cdn);
erpnext.payment_tool.validate_against_voucher(frm, row);
});
erpnext.payment_tool.validate_against_voucher = function(frm) {
$.each(frm.doc.vouchers || [], function(i, row) {
erpnext.payment_tool.validate_against_voucher = function(frm, row) {
var _validate = function(i, row) {
if (!row.against_voucher_type) {
return;
}
if(frm.doc.party_type=="Customer"
&& !in_list(["Sales Order", "Sales Invoice", "Journal Entry"], row.against_voucher_type)) {
frappe.model.set_value(row.doctype, row.name, "against_voucher_type", "");
frappe.throw(__("Against Voucher Type must be one of Sales Order, Sales Invoice or Journal Entry"))
frappe.msgprint(__("Against Voucher Type must be one of Sales Order, Sales Invoice or Journal Entry"));
return false;
}
if(frm.doc.party_type=="Supplier"
&& !in_list(["Purchase Order", "Purchase Invoice", "Journal Entry"], row.against_voucher_type)) {
frappe.model.set_value(row.doctype, row.name, "against_voucher_type", "");
frappe.throw(__("Against Voucher Type must be one of Purchase Order, Purchase Invoice or Journal Entry"))
frappe.msgprint(__("Against Voucher Type must be one of Purchase Order, Purchase Invoice or Journal Entry"));
return false;
}
});
}
if (row) {
_validate(0, row);
} else {
$.each(frm.doc.vouchers || [], _validate);
}
}
// validate against_voucher_type
frappe.ui.form.on("Payment Tool Detail", "against_voucher_no", function(frm, cdt, cdn) {
var row = locals[cdt][cdn];
if (!row.against_voucher_no) {
return;
}
frappe.call({
method: 'erpnext.accounts.doctype.payment_tool.payment_tool.get_against_voucher_amount',
args: {
"against_voucher_type": row.against_voucher_type,
"against_voucher_no": row.against_voucher_no
"against_voucher_no": row.against_voucher_no,
"party_account": frm.doc.party_account,
"company": frm.doc.company
},
callback: function(r) {
if(!r.exc) {
$.each(r.message, function(k, v) {
frappe.model.set_value(cdt, cdn, k, v);
});
frappe.model.set_value(cdt, cdn, "payment_amount", r.message.outstanding_amount);
}
}
});
@@ -187,7 +234,7 @@ erpnext.payment_tool.set_total_payment_amount = function(frm) {
} else {
if(row.payment_amount < 0)
msgprint(__("Row {0}: Payment amount can not be negative", [row.idx]));
else if(row.payment_amount >= row.outstanding_amount)
else if(row.payment_amount > row.outstanding_amount)
msgprint(__("Row {0}: Payment Amount cannot be greater than Outstanding Amount", [__(row.idx)]));
frappe.model.set_value(row.doctype, row.name, "payment_amount", 0.0);

View File

@@ -9,21 +9,52 @@
"document_type": "",
"fields": [
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "sec_break1",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Find Invoices to Match",
"permlevel": 0
},
{
"fieldname": "company",
"fieldtype": "Link",
"label": "Company",
"options": "Company",
"no_copy": 0,
"permlevel": 0,
"reqd": 1
"print_hide": 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": "company",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Company",
"no_copy": 0,
"options": "Company",
"permlevel": 0,
"print_hide": 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,
"default": "Customer",
"fieldname": "party_type",
"fieldtype": "Link",
@@ -40,10 +71,13 @@
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "received_or_paid",
"fieldtype": "Select",
"hidden": 0,
@@ -59,17 +93,20 @@
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "col_break1",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Column Break 1",
"label": "",
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
@@ -77,10 +114,13 @@
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "",
"fieldname": "party",
"fieldtype": "Dynamic Link",
@@ -97,21 +137,80 @@
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "party_account",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Party Account",
"no_copy": 1,
"options": "Account",
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"reqd": 1
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "party_account_currency",
"fieldtype": "Link",
"hidden": 1,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Party Account Currency",
"no_copy": 1,
"options": "Currency",
"permlevel": 0,
"precision": "",
"print_hide": 1,
"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": "set_payment_amount",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Set Payment Amount = Outstanding Amount",
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 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": "get_outstanding_vouchers",
"fieldtype": "Button",
"hidden": 0,
@@ -126,10 +225,13 @@
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "eval:(doc.company && doc.party_type && doc.received_or_paid && doc.party_account)",
"fieldname": "sec_break3",
"fieldtype": "Section Break",
@@ -145,10 +247,13 @@
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "vouchers",
"fieldtype": "Table",
"hidden": 0,
@@ -164,18 +269,36 @@
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0
},
{
"depends_on": "eval:(doc.company && doc.party_type && doc.received_or_paid && doc.party_account)",
"fieldname": "section_break_19",
"fieldtype": "Section Break",
"label": "Make Payment Entry",
"permlevel": 0,
"precision": ""
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "eval:(doc.company && doc.party_type && doc.received_or_paid && doc.party_account)",
"fieldname": "section_break_19",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Make Payment Entry",
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 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_mode",
"fieldtype": "Link",
"hidden": 0,
@@ -191,10 +314,13 @@
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "payment_account",
"fieldtype": "Link",
"hidden": 0,
@@ -210,23 +336,56 @@
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0
},
{
"fieldname": "total_payment_amount",
"fieldtype": "Currency",
"label": "Total Payment Amount",
"permlevel": 0,
"read_only": 1
},
{
"fieldname": "data_22",
"fieldtype": "Column Break",
"permlevel": 0,
"precision": ""
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "total_payment_amount",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Total Payment Amount",
"no_copy": 0,
"options": "party_account_currency",
"permlevel": 0,
"print_hide": 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": "data_22",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 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_date",
"fieldtype": "Date",
"hidden": 0,
@@ -241,10 +400,13 @@
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "reference_no",
"fieldtype": "Data",
"hidden": 0,
@@ -259,10 +421,13 @@
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "make_journal_entry",
"fieldtype": "Button",
"hidden": 0,
@@ -277,17 +442,35 @@
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0
},
{
"depends_on": "eval:(doc.company && doc.party_type && doc.received_or_paid && doc.party_account)",
"fieldname": "section_break_21",
"fieldtype": "Section Break",
"permlevel": 0,
"precision": ""
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "eval:(doc.company && doc.party_type && doc.received_or_paid && doc.party_account)",
"fieldname": "section_break_21",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 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": "make_jv_help",
"fieldtype": "Small Text",
"hidden": 0,
@@ -301,7 +484,8 @@
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0
"set_only_once": 0,
"unique": 0
}
],
"hide_heading": 0,
@@ -312,7 +496,7 @@
"is_submittable": 0,
"issingle": 1,
"istable": 0,
"modified": "2015-06-05 11:17:33.843334",
"modified": "2015-10-01 09:43:24.199025",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Payment Tool",
@@ -327,6 +511,7 @@
"delete": 0,
"email": 0,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 0,
@@ -346,6 +531,7 @@
"delete": 0,
"email": 0,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 0,

View File

@@ -3,22 +3,16 @@
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe import _, scrub
from frappe.utils import flt
from frappe.model.document import Document
import json
from erpnext.accounts.utils import get_account_currency
class PaymentTool(Document):
def make_journal_entry(self):
from erpnext.accounts.utils import get_balance_on
total_payment_amount = 0.00
invoice_voucher_type = {
'Sales Invoice': 'against_invoice',
'Purchase Invoice': 'against_voucher',
'Journal Entry': 'against_jv',
'Sales Order': 'against_sales_order',
'Purchase Order': 'against_purchase_order',
}
jv = frappe.new_doc('Journal Entry')
jv.voucher_type = 'Journal Entry'
@@ -40,14 +34,18 @@ class PaymentTool(Document):
d1.party_type = self.party_type
d1.party = self.party
d1.balance = get_balance_on(self.party_account)
d1.set("debit" if self.received_or_paid=="Paid" else "credit", flt(v.payment_amount))
d1.set(invoice_voucher_type.get(v.against_voucher_type), v.against_voucher_no)
d1.set("debit_in_account_currency" if self.received_or_paid=="Paid" \
else "credit_in_account_currency", flt(v.payment_amount))
d1.set("reference_type", v.against_voucher_type)
d1.set("reference_name", v.against_voucher_no)
d1.set('is_advance', 'Yes' if v.against_voucher_type in ['Sales Order', 'Purchase Order'] else 'No')
total_payment_amount = flt(total_payment_amount) + flt(d1.debit) - flt(d1.credit)
total_payment_amount = flt(total_payment_amount) + \
flt(d1.debit_in_account_currency) - flt(d1.credit_in_account_currency)
d2 = jv.append("accounts")
d2.account = self.payment_account
d2.set('debit' if total_payment_amount < 0 else 'credit', abs(total_payment_amount))
d2.set('debit_in_account_currency' if total_payment_amount < 0 \
else 'credit_in_account_currency', abs(total_payment_amount))
if self.payment_account:
d2.balance = get_balance_on(self.payment_account)
@@ -62,10 +60,13 @@ def get_outstanding_vouchers(args):
args = json.loads(args)
party_account_currency = get_account_currency(args.get("party_account"))
company_currency = frappe.db.get_value("Company", args.get("company"), "default_currency")
if args.get("party_type") == "Customer" and args.get("received_or_paid") == "Received":
amount_query = "ifnull(debit, 0) - ifnull(credit, 0)"
amount_query = "ifnull(debit_in_account_currency, 0) - ifnull(credit_in_account_currency, 0)"
elif args.get("party_type") == "Supplier" and args.get("received_or_paid") == "Paid":
amount_query = "ifnull(credit, 0) - ifnull(debit, 0)"
amount_query = "ifnull(credit_in_account_currency, 0) - ifnull(debit_in_account_currency, 0)"
else:
frappe.throw(_("Please enter the Against Vouchers manually"))
@@ -74,27 +75,34 @@ def get_outstanding_vouchers(args):
args.get("party_type"), args.get("party"))
# Get all SO / PO which are not fully billed or aginst which full advance not paid
orders_to_be_billed = get_orders_to_be_billed(args.get("party_type"), args.get("party"))
orders_to_be_billed = get_orders_to_be_billed(args.get("party_type"), args.get("party"),
party_account_currency, company_currency)
return outstanding_invoices + orders_to_be_billed
def get_orders_to_be_billed(party_type, party):
def get_orders_to_be_billed(party_type, party, party_account_currency, company_currency):
voucher_type = 'Sales Order' if party_type == "Customer" else 'Purchase Order'
ref_field = "base_grand_total" if party_account_currency == company_currency else "grand_total"
orders = frappe.db.sql("""
select
name as voucher_no,
ifnull(base_grand_total, 0) as invoice_amount,
(ifnull(base_grand_total, 0) - ifnull(advance_paid, 0)) as outstanding_amount,
ifnull({ref_field}, 0) as invoice_amount,
(ifnull({ref_field}, 0) - ifnull(advance_paid, 0)) as outstanding_amount,
transaction_date as posting_date
from
`tab%s`
`tab{voucher_type}`
where
%s = %s
{party_type} = %s
and docstatus = 1
and ifnull(status, "") != "Stopped"
and ifnull(base_grand_total, 0) > ifnull(advance_paid, 0)
and ifnull({ref_field}, 0) > ifnull(advance_paid, 0)
and abs(100 - ifnull(per_billed, 0)) > 0.01
""" % (voucher_type, 'customer' if party_type == "Customer" else 'supplier', '%s'),
party, as_dict = True)
""".format(**{
"ref_field": ref_field,
"voucher_type": voucher_type,
"party_type": scrub(party_type)
}), party, as_dict = True)
order_list = []
for d in orders:
@@ -104,13 +112,19 @@ def get_orders_to_be_billed(party_type, party):
return order_list
@frappe.whitelist()
def get_against_voucher_amount(against_voucher_type, against_voucher_no):
def get_against_voucher_amount(against_voucher_type, against_voucher_no, party_account, company):
party_account_currency = get_account_currency(party_account)
company_currency = frappe.db.get_value("Company", company, "default_currency")
ref_field = "base_grand_total" if party_account_currency == company_currency else "grand_total"
if against_voucher_type in ["Sales Order", "Purchase Order"]:
select_cond = "base_grand_total as total_amount, ifnull(base_grand_total, 0) - ifnull(advance_paid, 0) as outstanding_amount"
select_cond = "{0} as total_amount, ifnull({0}, 0) - ifnull(advance_paid, 0) as outstanding_amount"\
.format(ref_field)
elif against_voucher_type in ["Sales Invoice", "Purchase Invoice"]:
select_cond = "base_grand_total as total_amount, outstanding_amount"
select_cond = "{0} as total_amount, outstanding_amount".format(ref_field)
elif against_voucher_type == "Journal Entry":
select_cond = "total_debit as total_amount"
ref_field = "total_debit" if party_account_currency == company_currency else "total_debit/exchange_rate"
select_cond = "{0} as total_amount".format(ref_field)
details = frappe.db.sql("""select {0} from `tab{1}` where name = %s"""
.format(select_cond, against_voucher_type), against_voucher_no, as_dict=1)

View File

@@ -23,10 +23,11 @@ class TestPaymentTool(unittest.TestCase):
# Create SO with partial outstanding
so1 = make_sales_order(customer="_Test Customer 3", qty=10, rate=100)
self.create_against_jv(jv_test_records[0], {
"party": "_Test Customer 3",
"against_sales_order": so1.name,
"reference_type": "Sales Order",
"reference_name": so1.name,
"is_advance": "Yes"
})
@@ -36,8 +37,9 @@ class TestPaymentTool(unittest.TestCase):
self.create_against_jv(jv_test_records[0], {
"party": "_Test Customer 3",
"against_sales_order": so2.name,
"credit": 1000,
"reference_type": "Sales Order",
"reference_name": so2.name,
"credit_in_account_currency": 1000,
"is_advance": "Yes"
})
@@ -52,7 +54,8 @@ class TestPaymentTool(unittest.TestCase):
self.create_against_jv(jv_test_records[0], {
"party": "_Test Customer 3",
"against_invoice": si1.name
"reference_type": si1.doctype,
"reference_name": si1.name
})
#Create SI with no outstanding
si2 = self.create_voucher(si_test_records[0], {
@@ -62,8 +65,9 @@ class TestPaymentTool(unittest.TestCase):
self.create_against_jv(jv_test_records[0], {
"party": "_Test Customer 3",
"against_invoice": si2.name,
"credit": 561.80
"reference_type": si2.doctype,
"reference_name": si2.name,
"credit_in_account_currency": 561.80
})
pi = self.create_voucher(pi_test_records[0], {
@@ -87,7 +91,7 @@ class TestPaymentTool(unittest.TestCase):
"party": "_Test Customer 3",
"party_account": "_Test Receivable - _TC",
"payment_mode": "Cheque",
"payment_account": "_Test Account Bank Account - _TC",
"payment_account": "_Test Bank - _TC",
"reference_no": "123456",
"reference_date": "2013-02-14"
}
@@ -113,10 +117,10 @@ class TestPaymentTool(unittest.TestCase):
def create_against_jv(self, test_record, args):
jv = frappe.copy_doc(test_record)
jv.get("accounts")[0].update(args)
if args.get("debit"):
jv.get("accounts")[1].credit = args["debit"]
elif args.get("credit"):
jv.get("accounts")[1].debit = args["credit"]
if args.get("debit_in_account_currency"):
jv.get("accounts")[1].credit_in_account_currency = args["debit_in_account_currency"]
elif args.get("credit_in_account_currency"):
jv.get("accounts")[1].debit_in_account_currency = args["credit_in_account_currency"]
jv.insert()
jv.submit()
@@ -125,7 +129,7 @@ class TestPaymentTool(unittest.TestCase):
def make_voucher_for_party(self, args, expected_outstanding):
#Make Journal Entry for Party
payment_tool_doc = frappe.new_doc("Payment Tool")
for k, v in args.items():
payment_tool_doc.set(k, v)
@@ -137,7 +141,8 @@ class TestPaymentTool(unittest.TestCase):
outstanding_entries = get_outstanding_vouchers(json.dumps(args))
for d in outstanding_entries:
self.assertEquals(flt(d.get("outstanding_amount"), 2), expected_outstanding.get(d.get("voucher_type"))[1])
self.assertEquals(flt(d.get("outstanding_amount"), 2),
expected_outstanding.get(d.get("voucher_type"))[1])
self.check_jv_entries(doc, outstanding_entries, expected_outstanding)
@@ -152,30 +157,12 @@ class TestPaymentTool(unittest.TestCase):
paytool.total_payment_amount = 300
new_jv = paytool.make_journal_entry()
#Create a list of expected values as [party account, payment against, against_jv, against_invoice,
#against_voucher, against_sales_order, against_purchase_order]
expected_values = [
[paytool.party_account, paytool.party, 100.00, expected_outstanding.get("Journal Entry")[0], None, None, None, None],
[paytool.party_account, paytool.party, 100.00, None, expected_outstanding.get("Sales Invoice")[0], None, None, None],
[paytool.party_account, paytool.party, 100.00, None, None, expected_outstanding.get("Purchase Invoice")[0], None, None],
[paytool.party_account, paytool.party, 100.00, None, None, None, expected_outstanding.get("Sales Order")[0], None],
[paytool.party_account, paytool.party, 100.00, None, None, None, None, expected_outstanding.get("Purchase Order")[0]]
]
for jv_entry in new_jv.get("accounts"):
if paytool.party_account == jv_entry.get("account") and paytool.party == jv_entry.get("party"):
row = [
jv_entry.get("account"),
jv_entry.get("party"),
jv_entry.get("debit" if paytool.party_type=="Supplier" else "credit"),
jv_entry.get("against_jv"),
jv_entry.get("against_invoice"),
jv_entry.get("against_voucher"),
jv_entry.get("against_sales_order"),
jv_entry.get("against_purchase_order"),
]
self.assertTrue(row in expected_values)
self.assertEquals(100.00, jv_entry.get("debit_in_account_currency"
if paytool.party_type=="Supplier" else "credit_in_account_currency"))
self.assertEquals(jv_entry.reference_name,
expected_outstanding[jv_entry.reference_type][0])
self.assertEquals(new_jv.get("cheque_no"), paytool.reference_no)
self.assertEquals(new_jv.get("cheque_date"), paytool.reference_date)
@@ -183,4 +170,6 @@ class TestPaymentTool(unittest.TestCase):
def clear_table_entries(self):
frappe.db.sql("""delete from `tabGL Entry` where party in ("_Test Customer 3", "_Test Supplier 1")""")
frappe.db.sql("""delete from `tabSales Order` where customer = "_Test Customer 3" """)
frappe.db.sql("""delete from `tabSales Invoice` where customer = "_Test Customer 3" """)
frappe.db.sql("""delete from `tabPurchase Order` where supplier = "_Test Supplier 1" """)
frappe.db.sql("""delete from `tabPurchase Invoice` where supplier = "_Test Supplier 1" """)

View File

@@ -10,6 +10,8 @@
"fields": [
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "against_voucher_type",
"fieldtype": "Link",
"hidden": 0,
@@ -27,10 +29,13 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0,
"width": ""
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "against_voucher_no",
"fieldtype": "Dynamic Link",
"hidden": 0,
@@ -46,16 +51,34 @@
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0
},
{
"fieldname": "column_break_3",
"fieldtype": "Column Break",
"permlevel": 0,
"precision": ""
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "column_break_3",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 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": "total_amount",
"fieldtype": "Currency",
"hidden": 0,
@@ -64,16 +87,20 @@
"in_list_view": 1,
"label": "Total Amount",
"no_copy": 0,
"options": "party_account_currency",
"permlevel": 0,
"print_hide": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "outstanding_amount",
"fieldtype": "Currency",
"hidden": 0,
@@ -82,16 +109,20 @@
"in_list_view": 1,
"label": "Outstanding Amount",
"no_copy": 0,
"options": "party_account_currency",
"permlevel": 0,
"print_hide": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "payment_amount",
"fieldtype": "Currency",
"hidden": 0,
@@ -100,13 +131,15 @@
"in_list_view": 1,
"label": "Payment Amount",
"no_copy": 0,
"options": "party_account_currency",
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0
"set_only_once": 0,
"unique": 0
}
],
"hide_heading": 0,
@@ -116,7 +149,7 @@
"is_submittable": 0,
"issingle": 0,
"istable": 1,
"modified": "2014-09-11 08:55:34.384017",
"modified": "2015-10-02 07:38:59.950506",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Payment Tool Detail",

View File

@@ -13,7 +13,7 @@ cur_frm.fields_dict['closing_account_head'].get_query = function(doc, cdt, cdn)
return{
filters:{
"company": doc.company,
"report_type": "Balance Sheet",
"root_type": "Liability",
"freeze_account": "No",
"is_group": 0
}

View File

@@ -1,50 +1,114 @@
{
"allow_copy": 0,
"allow_import": 0,
"allow_rename": 0,
"autoname": "PCE/.###",
"creation": "2013-01-10 16:34:07",
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"fields": [
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "column_break0",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"oldfieldtype": "Column Break",
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0,
"width": "50%"
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "transaction_date",
"fieldtype": "Date",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Transaction Date",
"no_copy": 0,
"oldfieldname": "transaction_date",
"oldfieldtype": "Date",
"permlevel": 0
"permlevel": 0,
"print_hide": 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": "posting_date",
"fieldtype": "Date",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Posting Date",
"no_copy": 0,
"oldfieldname": "posting_date",
"oldfieldtype": "Date",
"permlevel": 0,
"reqd": 1
"print_hide": 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": "fiscal_year",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Closing Fiscal Year",
"no_copy": 0,
"oldfieldname": "fiscal_year",
"oldfieldtype": "Select",
"options": "Fiscal Year",
"permlevel": 0,
"reqd": 1
"print_hide": 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": "amended_from",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 1,
"in_filter": 0,
"in_list_view": 0,
"label": "Amended From",
"no_copy": 1,
@@ -52,58 +116,118 @@
"oldfieldtype": "Data",
"options": "Period Closing Voucher",
"permlevel": 0,
"read_only": 1
"print_hide": 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": "company",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Company",
"no_copy": 0,
"oldfieldname": "company",
"oldfieldtype": "Select",
"options": "Company",
"permlevel": 0,
"reqd": 1
"print_hide": 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": "column_break1",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"oldfieldtype": "Column Break",
"permlevel": 0
"permlevel": 0,
"print_hide": 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,
"description": "The account head under Liability, in which Profit/Loss will be booked",
"fieldname": "closing_account_head",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Closing Account Head",
"no_copy": 0,
"oldfieldname": "closing_account_head",
"oldfieldtype": "Link",
"options": "Account",
"permlevel": 0,
"reqd": 1
},
{
"fieldname": "coa_help",
"fieldtype": "HTML",
"label": "CoA Help",
"oldfieldtype": "HTML",
"options": "<a href=\"#!Accounts Browser/Account\">To manage Account Head, click here</a>",
"permlevel": 0
"print_hide": 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": "remarks",
"fieldtype": "Small Text",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Remarks",
"no_copy": 0,
"oldfieldname": "remarks",
"oldfieldtype": "Small Text",
"permlevel": 0,
"reqd": 1
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0
}
],
"hide_heading": 0,
"hide_toolbar": 0,
"icon": "icon-file-text",
"idx": 1,
"in_create": 0,
"in_dialog": 0,
"is_submittable": 1,
"modified": "2015-02-05 05:11:42.268561",
"issingle": 0,
"istable": 0,
"modified": "2015-10-21 12:40:58.278256",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Period Closing Voucher",
@@ -111,35 +235,47 @@
"permissions": [
{
"amend": 1,
"apply_user_permissions": 0,
"cancel": 1,
"create": 1,
"delete": 1,
"email": 1,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "System 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": 0,
"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
}
],
"read_only": 0,
"read_only_onload": 0,
"search_fields": "posting_date, fiscal_year",
"sort_field": "modified",
"sort_order": "DESC",

View File

@@ -5,6 +5,7 @@ from __future__ import unicode_literals
import frappe
from frappe.utils import flt
from frappe import _
from erpnext.accounts.utils import get_account_currency
from erpnext.controllers.accounts_controller import AccountsController
class PeriodClosingVoucher(AccountsController):
@@ -20,51 +21,75 @@ class PeriodClosingVoucher(AccountsController):
where voucher_type = 'Period Closing Voucher' and voucher_no=%s""", self.name)
def validate_account_head(self):
if frappe.db.get_value("Account", self.closing_account_head, "report_type") \
!= "Balance Sheet":
frappe.throw(_("Closing Account {0} must be of type 'Liability'").format(self.closing_account_head))
closing_account_type = frappe.db.get_value("Account", self.closing_account_head, "root_type")
if closing_account_type != "Liability":
frappe.throw(_("Closing Account {0} must be of type 'Liability'")
.format(self.closing_account_head))
account_currency = get_account_currency(self.closing_account_head)
company_currency = frappe.db.get_value("Company", self.company, "default_currency")
if account_currency != company_currency:
frappe.throw(_("Currency of the Closing Account must be {0}").format(company_currency))
def validate_posting_date(self):
from erpnext.accounts.utils import get_fiscal_year
from erpnext.accounts.utils import get_fiscal_year, validate_fiscal_year
validate_fiscal_year(self.posting_date, self.fiscal_year, label=_("Posting Date"), doc=self)
self.year_start_date = get_fiscal_year(self.posting_date, self.fiscal_year)[1]
pce = frappe.db.sql("""select name from `tabPeriod Closing Voucher`
where posting_date > %s and fiscal_year = %s and docstatus = 1""",
(self.posting_date, self.fiscal_year))
if pce and pce[0][0]:
frappe.throw(_("Another Period Closing Entry {0} has been made after {1}").format(pce[0][0], self.posting_date))
def get_pl_balances(self):
"""Get balance for pl accounts"""
return frappe.db.sql("""
select t1.account, sum(ifnull(t1.debit,0))-sum(ifnull(t1.credit,0)) as balance
from `tabGL Entry` t1, `tabAccount` t2
where t1.account = t2.name and ifnull(t2.report_type, '') = 'Profit and Loss'
and t2.docstatus < 2 and t2.company = %s
and t1.posting_date between %s and %s
group by t1.account
""", (self.company, self.get("year_start_date"), self.posting_date), as_dict=1)
frappe.throw(_("Another Period Closing Entry {0} has been made after {1}")
.format(pce[0][0], self.posting_date))
def make_gl_entries(self):
gl_entries = []
net_pl_balance = 0
pl_accounts = self.get_pl_balances()
for acc in pl_accounts:
if flt(acc.balance):
if flt(acc.balance_in_company_currency):
gl_entries.append(self.get_gl_dict({
"account": acc.account,
"debit": abs(flt(acc.balance)) if flt(acc.balance) < 0 else 0,
"credit": abs(flt(acc.balance)) if flt(acc.balance) > 0 else 0,
"account_currency": acc.account_currency,
"debit_in_account_currency": abs(flt(acc.balance_in_account_currency)) \
if flt(acc.balance_in_account_currency) < 0 else 0,
"debit": abs(flt(acc.balance_in_company_currency)) \
if flt(acc.balance_in_company_currency) < 0 else 0,
"credit_in_account_currency": abs(flt(acc.balance_in_account_currency)) \
if flt(acc.balance_in_account_currency) > 0 else 0,
"credit": abs(flt(acc.balance_in_company_currency)) \
if flt(acc.balance_in_company_currency) > 0 else 0
}))
net_pl_balance += flt(acc.balance)
net_pl_balance += flt(acc.balance_in_company_currency)
if net_pl_balance:
gl_entries.append(self.get_gl_dict({
"account": self.closing_account_head,
"debit_in_account_currency": abs(net_pl_balance) if net_pl_balance > 0 else 0,
"debit": abs(net_pl_balance) if net_pl_balance > 0 else 0,
"credit_in_account_currency": abs(net_pl_balance) if net_pl_balance < 0 else 0,
"credit": abs(net_pl_balance) if net_pl_balance < 0 else 0
}))
from erpnext.accounts.general_ledger import make_gl_entries
make_gl_entries(gl_entries)
def get_pl_balances(self):
"""Get balance for pl accounts"""
return frappe.db.sql("""
select
t1.account, t2.account_currency, sum(ifnull(t1.debit_in_account_currency,0))-sum(ifnull(t1.credit_in_account_currency,0))
as balance_in_account_currency,
sum(ifnull(t1.debit,0))-sum(ifnull(t1.credit,0)) as balance_in_company_currency
from `tabGL Entry` t1, `tabAccount` t2
where t1.account = t2.name and ifnull(t2.report_type, '') = 'Profit and Loss'
and t2.docstatus < 2 and t2.company = %s
and t1.posting_date between %s and %s
group by t1.account
""", (self.company, self.get("year_start_date"), self.posting_date), as_dict=1)

View File

@@ -5,42 +5,74 @@
from __future__ import unicode_literals
import unittest
import frappe
from frappe.utils import flt
from frappe.utils import flt, today
from erpnext.accounts.utils import get_fiscal_year
from erpnext.accounts.doctype.journal_entry.test_journal_entry import make_journal_entry
class TestPeriodClosingVoucher(unittest.TestCase):
def test_closing_entry(self):
make_journal_entry("_Test Account Bank Account - _TC", "Sales - _TC", 400,
year_start_date = get_fiscal_year(today())[1]
make_journal_entry("_Test Bank - _TC", "Sales - _TC", 400,
"_Test Cost Center - _TC", submit=True)
make_journal_entry("_Test Account Cost for Goods Sold - _TC",
"_Test Account Bank Account - _TC", 600, "_Test Cost Center - _TC", submit=True)
"_Test Bank - _TC", 600, "_Test Cost Center - _TC", submit=True)
random_expense_account = frappe.db.sql("""
select t1.account,
sum(ifnull(t1.debit,0))-sum(ifnull(t1.credit,0)) as balance,
sum(ifnull(t1.debit_in_account_currency,0))-sum(ifnull(t1.credit_in_account_currency,0)) \
as balance_in_account_currency
from `tabGL Entry` t1, `tabAccount` t2
where t1.account = t2.name and ifnull(t2.root_type, '') = 'Expense'
and t2.docstatus < 2 and t2.company = '_Test Company'
and t1.posting_date between %s and %s
group by t1.account
having sum(ifnull(t1.debit,0)) > sum(ifnull(t1.credit,0))
limit 1""", (year_start_date, today()), as_dict=True)
profit_or_loss = frappe.db.sql("""select sum(ifnull(t1.debit,0))-sum(ifnull(t1.credit,0)) as balance
from `tabGL Entry` t1, `tabAccount` t2
where t1.account = t2.name and ifnull(t2.report_type, '') = 'Profit and Loss'
and t2.docstatus < 2 and t2.company = '_Test Company'
and t1.posting_date between '2013-01-01' and '2013-12-31'""")
and t1.posting_date between %s and %s""", (year_start_date, today()))
profit_or_loss = flt(profit_or_loss[0][0]) if profit_or_loss else 0
pcv = self.make_period_closing_voucher()
gle_value = frappe.db.sql("""select ifnull(debit, 0) - ifnull(credit, 0)
# Check value for closing account
gle_amount_for_closing_account = frappe.db.sql("""select ifnull(debit, 0) - ifnull(credit, 0)
from `tabGL Entry` where voucher_type='Period Closing Voucher' and voucher_no=%s
and account = '_Test Account Reserves and Surplus - _TC'""", pcv.name)
gle_value = flt(gle_value[0][0]) if gle_value else 0
gle_amount_for_closing_account = flt(gle_amount_for_closing_account[0][0]) \
if gle_amount_for_closing_account else 0
self.assertEqual(gle_value, profit_or_loss)
self.assertEqual(gle_amount_for_closing_account, profit_or_loss)
if random_expense_account:
# Check posted value for teh above random_expense_account
gle_for_random_expense_account = frappe.db.sql("""
select ifnull(debit, 0) - ifnull(credit, 0) as amount,
ifnull(debit_in_account_currency, 0) - ifnull(credit_in_account_currency, 0)
as amount_in_account_currency
from `tabGL Entry`
where voucher_type='Period Closing Voucher' and voucher_no=%s and account =%s""",
(pcv.name, random_expense_account[0].account), as_dict=True)
self.assertEqual(gle_for_random_expense_account[0].amount, -1*random_expense_account[0].balance)
self.assertEqual(gle_for_random_expense_account[0].amount_in_account_currency,
-1*random_expense_account[0].balance_in_account_currency)
def make_period_closing_voucher(self):
pcv = frappe.get_doc({
"doctype": "Period Closing Voucher",
"closing_account_head": "_Test Account Reserves and Surplus - _TC",
"company": "_Test Company",
"fiscal_year": "_Test Fiscal Year 2013",
"posting_date": "2013-12-31",
"fiscal_year": get_fiscal_year(today())[0],
"posting_date": today(),
"remarks": "test"
})
pcv.insert()

View File

@@ -6,6 +6,14 @@ frappe.ui.form.on("POS Profile", "onload", function(frm) {
return { filter: { selling: 1 } };
});
frm.set_query("print_format", function() {
return { filter: { doc_type: "Sales Invoice" } };
});
erpnext.queries.setup_queries(frm, "Warehouse", function() {
return erpnext.queries.warehouse(frm.doc);
});
frm.call({
method: "erpnext.accounts.doctype.pos_profile.pos_profile.get_series",
callback: function(r) {

View File

@@ -1,37 +1,46 @@
{
"allow_copy": 0,
"allow_import": 0,
"allow_rename": 0,
"autoname": "hash",
"creation": "2013-05-24 12:15:51",
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"fields": [
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "user",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "User",
"label": "Applicable for User",
"no_copy": 0,
"oldfieldname": "user",
"oldfieldtype": "Link",
"options": "User",
"permlevel": 0,
"read_only": 0
},
{
"description": "",
"fieldname": "territory",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Territory",
"oldfieldname": "territory",
"oldfieldtype": "Link",
"options": "Territory",
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"reqd": 1
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "naming_series",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Series",
"no_copy": 1,
@@ -39,224 +48,629 @@
"oldfieldtype": "Select",
"options": "[Select]",
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"reqd": 1
},
{
"fieldname": "currency",
"fieldtype": "Link",
"in_list_view": 0,
"label": "Currency",
"oldfieldname": "currency",
"oldfieldtype": "Select",
"options": "Currency",
"permlevel": 0,
"read_only": 0,
"reqd": 1
},
{
"fieldname": "selling_price_list",
"fieldtype": "Link",
"label": "Price List",
"oldfieldname": "price_list_name",
"oldfieldtype": "Select",
"options": "Price List",
"permlevel": 0,
"read_only": 0,
"reqd": 0
},
{
"fieldname": "company",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Company",
"oldfieldname": "company",
"oldfieldtype": "Link",
"options": "Company",
"permlevel": 0,
"read_only": 0,
"reqd": 1
},
{
"fieldname": "column_break0",
"fieldtype": "Column Break",
"oldfieldtype": "Column Break",
"permlevel": 0,
"read_only": 0
},
{
"default": "1",
"description": "Create Stock Ledger Entries when you submit a Sales Invoice",
"fieldname": "update_stock",
"fieldtype": "Check",
"label": "Update Stock",
"permlevel": 0,
"reqd": 0
},
{
"fieldname": "customer",
"fieldtype": "Link",
"in_list_view": 0,
"label": "Customer",
"oldfieldname": "customer_account",
"oldfieldtype": "Link",
"options": "Customer",
"permlevel": 0,
"read_only": 0,
"reqd": 0
},
{
"fieldname": "cash_bank_account",
"fieldtype": "Link",
"label": "Cash/Bank Account",
"oldfieldname": "cash_bank_account",
"oldfieldtype": "Link",
"options": "Account",
"permlevel": 0,
"read_only": 0,
"reqd": 1
},
{
"fieldname": "income_account",
"fieldtype": "Link",
"label": "Income Account",
"oldfieldname": "income_account",
"oldfieldtype": "Link",
"options": "Account",
"permlevel": 0,
"read_only": 0,
"reqd": 1
},
{
"depends_on": "eval:cint(sys_defaults.auto_accounting_for_stock)",
"fieldname": "expense_account",
"fieldtype": "Link",
"hidden": 0,
"label": "Expense Account",
"options": "Account",
"permlevel": 0,
"print_hide": 1,
"read_only": 0,
"reqd": 0
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "warehouse",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Warehouse",
"no_copy": 0,
"oldfieldname": "warehouse",
"oldfieldtype": "Link",
"options": "Warehouse",
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"reqd": 0
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"fieldname": "cost_center",
"fieldtype": "Link",
"label": "Cost Center",
"oldfieldname": "cost_center",
"oldfieldtype": "Link",
"options": "Cost Center",
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"default": "1",
"description": "",
"fieldname": "update_stock",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Update Stock",
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"reqd": 1
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"fieldname": "taxes_and_charges",
"fieldtype": "Link",
"label": "Taxes and Charges",
"oldfieldname": "charge",
"oldfieldtype": "Link",
"options": "Sales Taxes and Charges Template",
"permlevel": 0,
"read_only": 0
},
{
"fieldname": "write_off_account",
"fieldtype": "Link",
"label": "Write Off Account",
"options": "Account",
"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,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"reqd": 1
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"fieldname": "write_off_cost_center",
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "customer",
"fieldtype": "Link",
"label": "Write Off Cost Center",
"options": "Cost Center",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Customer",
"no_copy": 0,
"oldfieldname": "customer_account",
"oldfieldtype": "Link",
"options": "Customer",
"permlevel": 0,
"print_hide": 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": "company",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Company",
"no_copy": 0,
"oldfieldname": "company",
"oldfieldtype": "Link",
"options": "Company",
"permlevel": 0,
"print_hide": 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": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Currency",
"no_copy": 0,
"oldfieldname": "currency",
"oldfieldtype": "Select",
"options": "Currency",
"permlevel": 0,
"print_hide": 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": "mode_of_payment",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Mode of Payment",
"no_copy": 0,
"options": "Mode of Payment",
"permlevel": 0,
"precision": "",
"reqd": 1
"print_hide": 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": "section_break_16",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 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": "print_format",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Print Format",
"no_copy": 0,
"options": "Print Format",
"permlevel": 0,
"precision": "",
"print_hide": 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": "letter_head",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Letter Head",
"no_copy": 0,
"oldfieldname": "letter_head",
"oldfieldtype": "Select",
"options": "Letter Head",
"permlevel": 0,
"print_hide": 1,
"read_only": 0
},
{
"fieldname": "tc_name",
"fieldtype": "Link",
"label": "Terms and Conditions",
"oldfieldname": "tc_name",
"oldfieldtype": "Link",
"options": "Terms and Conditions",
"permlevel": 0,
"read_only": 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": "select_print_heading",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Print Heading",
"no_copy": 0,
"oldfieldname": "select_print_heading",
"oldfieldtype": "Select",
"options": "Print Heading",
"permlevel": 0,
"read_only": 0
"print_hide": 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": "tc_name",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Terms and Conditions",
"no_copy": 0,
"oldfieldname": "tc_name",
"oldfieldtype": "Link",
"options": "Terms and Conditions",
"permlevel": 0,
"print_hide": 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_break0",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"oldfieldtype": "Column Break",
"permlevel": 0,
"print_hide": 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,
"description": "",
"fieldname": "territory",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Territory",
"no_copy": 0,
"oldfieldname": "territory",
"oldfieldtype": "Link",
"options": "Territory",
"permlevel": 0,
"print_hide": 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": "selling_price_list",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Price List",
"no_copy": 0,
"oldfieldname": "price_list_name",
"oldfieldtype": "Select",
"options": "Price List",
"permlevel": 0,
"print_hide": 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": "section_break_19",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 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": "write_off_account",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Write Off Account",
"no_copy": 0,
"options": "Account",
"permlevel": 0,
"precision": "",
"print_hide": 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": "write_off_cost_center",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Write Off Cost Center",
"no_copy": 0,
"options": "Cost Center",
"permlevel": 0,
"precision": "",
"print_hide": 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": "taxes_and_charges",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Taxes and Charges",
"no_copy": 0,
"oldfieldname": "charge",
"oldfieldtype": "Link",
"options": "Sales Taxes and Charges Template",
"permlevel": 0,
"print_hide": 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_23",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 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": "cash_bank_account",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Cash/Bank Account",
"no_copy": 0,
"oldfieldname": "cash_bank_account",
"oldfieldtype": "Link",
"options": "Account",
"permlevel": 0,
"print_hide": 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": "income_account",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Income Account",
"no_copy": 0,
"oldfieldname": "income_account",
"oldfieldtype": "Link",
"options": "Account",
"permlevel": 0,
"print_hide": 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:cint(sys_defaults.auto_accounting_for_stock)",
"fieldname": "expense_account",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Expense Account",
"no_copy": 0,
"options": "Account",
"permlevel": 0,
"print_hide": 1,
"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": "cost_center",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Cost Center",
"no_copy": 0,
"oldfieldname": "cost_center",
"oldfieldtype": "Link",
"options": "Cost Center",
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
}
],
"hide_heading": 0,
"hide_toolbar": 0,
"icon": "icon-cog",
"idx": 1,
"modified": "2015-05-20 05:38:44.482696",
"in_create": 0,
"in_dialog": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 0,
"modified": "2015-10-02 07:39:00.196535",
"modified_by": "Administrator",
"module": "Accounts",
"name": "POS Profile",
"owner": "Administrator",
"permissions": [
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 1,
"delete": 1,
"email": 1,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Accounts Manager",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"write": 1
},
{
"apply_user_permissions": 1,
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 0,
"delete": 0,
"email": 1,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Accounts User",
"submit": 0
"set_user_permissions": 0,
"share": 0,
"submit": 0,
"write": 0
}
],
"read_only": 0,
"read_only_onload": 0,
"sort_field": "modified",
"sort_order": "DESC",
"title_field": "user"

View File

@@ -11,7 +11,6 @@ from frappe.model.document import Document
class POSProfile(Document):
def validate(self):
self.check_for_duplicate()
self.validate_expense_account()
self.validate_all_link_fields()
def check_for_duplicate(self):
@@ -26,11 +25,6 @@ class POSProfile(Document):
msgprint(_("Global POS Profile {0} already created for company {1}").format(res[0][0],
self.company), raise_exception=1)
def validate_expense_account(self):
if cint(frappe.defaults.get_global_default("auto_accounting_for_stock")) \
and not self.expense_account:
msgprint(_("Expense Account is mandatory"), raise_exception=1)
def validate_all_link_fields(self):
accounts = {"Account": [self.cash_bank_account, self.income_account,
self.expense_account], "Cost Center": [self.cost_center],

File diff suppressed because it is too large Load Diff

View File

@@ -130,7 +130,11 @@ def get_pricing_rule_for_item(args):
return item_details
if not (args.item_group and args.brand):
args.item_group, args.brand = frappe.db.get_value("Item", args.item_code, ["item_group", "brand"])
try:
args.item_group, args.brand = frappe.db.get_value("Item", args.item_code, ["item_group", "brand"])
except TypeError:
# invalid item_code
return item_details
if not args.item_group:
frappe.throw(_("Item Group not mentioned in item master for item {0}").format(args.item_code))
@@ -147,6 +151,7 @@ def get_pricing_rule_for_item(args):
if pricing_rule:
item_details.pricing_rule = pricing_rule.name
item_details.pricing_rule_for = pricing_rule.price_or_discount
if pricing_rule.price_or_discount == "Price":
item_details.update({
"price_list_rate": pricing_rule.price/flt(args.conversion_rate) \
@@ -170,7 +175,7 @@ def get_pricing_rules(args):
if parent_groups:
if allow_blank: parent_groups.append('')
condition = " ifnull("+field+", '') in ('" + \
"', '".join([d.replace("'", "\\'").replace('"', '\\"') for d in parent_groups])+"')"
"', '".join([d.replace("'", "\\'").replace('"', '\\"').replace("%", "%%") for d in parent_groups])+"')"
return condition

View File

@@ -20,26 +20,18 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({
this._super();
// Show / Hide button
if(doc.docstatus==1 && doc.outstanding_amount > 0)
this.frm.add_custom_button(__('Make Payment Entry'), this.make_bank_entry,
frappe.boot.doctype_icons["Journal Entry"]);
this.show_general_ledger();
if(doc.docstatus==1) {
cur_frm.add_custom_button(__('View Ledger'), function() {
frappe.route_options = {
"voucher_no": doc.name,
"from_date": doc.posting_date,
"to_date": doc.posting_date,
"company": doc.company,
group_by_voucher: 0
};
frappe.set_route("query-report", "General Ledger");
}, "icon-table");
}
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");
}
cur_frm.add_custom_button(__('Debit Note'), this.make_debit_note);
}
if(doc.docstatus===0) {
cur_frm.add_custom_button(__('From Purchase Order'),
function() {
if(doc.docstatus===0) {
cur_frm.add_custom_button(__('From Purchase Order'), function() {
frappe.model.map_current_doc({
method: "erpnext.buying.doctype.purchase_order.purchase_order.make_purchase_invoice",
source_doctype: "Purchase Order",
@@ -51,10 +43,9 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({
company: cur_frm.doc.company
}
})
}, "icon-download", "btn-default");
});
cur_frm.add_custom_button(__('From Purchase Receipt'),
function() {
cur_frm.add_custom_button(__('From Purchase Receipt'), function() {
frappe.model.map_current_doc({
method: "erpnext.stock.doctype.purchase_receipt.purchase_receipt.make_purchase_invoice",
source_doctype: "Purchase Receipt",
@@ -64,8 +55,8 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({
company: cur_frm.doc.company
}
})
}, "icon-download", "btn-default");
});
}
}
},
@@ -84,8 +75,29 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({
me.apply_pricing_rule();
})
},
credit_to: function() {
var me = this;
if(this.frm.doc.credit_to) {
me.frm.call({
method: "frappe.client.get_value",
args: {
doctype: "Account",
fieldname: "account_currency",
filters: { name: me.frm.doc.credit_to },
},
callback: function(r, rt) {
if(r.message) {
me.frm.set_value("party_account_currency", r.message.account_currency);
me.set_dynamic_labels();
}
}
});
}
},
write_off_amount: function() {
this.set_in_company_currency(this.frm.doc, ["write_off_amount"]);
this.calculate_outstanding_amount();
this.frm.refresh_fields();
},
@@ -109,7 +121,14 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({
$.each(this.frm.doc["items"] || [], function(i, row) {
if(row.purchase_receipt) frappe.model.clear_doc("Purchase Receipt", row.purchase_receipt)
})
}
},
make_debit_note: function() {
frappe.model.open_mapped_doc({
method: "erpnext.accounts.doctype.purchase_invoice.purchase_invoice.make_debit_note",
frm: cur_frm
})
},
});
cur_frm.script_manager.make(erpnext.accounts.PurchaseInvoice);
@@ -144,18 +163,28 @@ cur_frm.fields_dict['items'].grid.get_field("item_code").get_query = function(do
return {
query: "erpnext.controllers.queries.item_query",
filters:{
'is_purchase_item': 'Yes'
'is_purchase_item': 1
}
}
}
cur_frm.fields_dict['credit_to'].get_query = function(doc) {
return{
filters:{
'account_type': 'Payable',
'root_type': 'Liability',
'is_group': 0,
'company': doc.company
// filter on Account
if (doc.supplier) {
return {
filters: {
'account_type': 'Payable',
'is_group': 0,
'company': doc.company
}
}
} else {
return {
filters: {
'report_type': 'Balance Sheet',
'is_group': 0,
'company': doc.company
}
}
}
}
@@ -224,4 +253,3 @@ cur_frm.cscript.select_print_heading = function(doc,cdt,cdn){
else
cur_frm.pformat.print_heading = __("Purchase Invoice");
}

File diff suppressed because it is too large Load Diff

View File

@@ -10,6 +10,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
form_grid_templates = {
"items": "templates/form_grid/item_grid.html"
@@ -37,14 +38,16 @@ class PurchaseInvoice(BuyingController):
super(PurchaseInvoice, self).validate()
self.po_required()
self.pr_required()
self.validate_supplier_invoice()
if not self.is_return:
self.po_required()
self.pr_required()
self.validate_supplier_invoice()
self.validate_advance_jv("Purchase Order")
self.check_active_purchase_items()
self.check_conversion_rate()
self.validate_credit_to_acc()
self.clear_unallocated_advances("Purchase Invoice Advance", "advances")
self.validate_advance_jv("advances", "purchase_order")
self.check_for_stopped_status()
self.validate_with_previous_doc()
self.validate_uom_is_integer("uom", "qty")
@@ -64,20 +67,21 @@ class PurchaseInvoice(BuyingController):
def set_missing_values(self, for_validate=False):
if not self.credit_to:
self.credit_to = get_party_account(self.company, self.supplier, "Supplier")
self.credit_to = get_party_account("Supplier", self.supplier, self.company)
if not self.due_date:
self.due_date = get_due_date(self.posting_date, "Supplier", self.supplier, self.company)
super(PurchaseInvoice, self).set_missing_values(for_validate)
def get_advances(self):
super(PurchaseInvoice, self).get_advances(self.credit_to, "Supplier", self.supplier,
"Purchase Invoice Advance", "advances", "debit", "purchase_order")
if not self.is_return:
super(PurchaseInvoice, self).get_advances(self.credit_to, "Supplier", self.supplier,
"Purchase Invoice Advance", "advances", "debit_in_account_currency", "purchase_order")
def check_active_purchase_items(self):
for d in self.get('items'):
if d.item_code: # extra condn coz item_code is not mandatory in PV
if frappe.db.get_value("Item", d.item_code, "is_purchase_item") != 'Yes':
if frappe.db.get_value("Item", d.item_code, "is_purchase_item") != 1:
msgprint(_("Item {0} is not Purchase Item").format(d.item_code), raise_exception=True)
def check_conversion_rate(self):
@@ -88,10 +92,17 @@ class PurchaseInvoice(BuyingController):
throw(_("Conversion rate cannot be 0 or 1"))
def validate_credit_to_acc(self):
account_type = frappe.db.get_value("Account", self.credit_to, "account_type")
if account_type != "Payable":
account = frappe.db.get_value("Account", self.credit_to,
["account_type", "report_type", "account_currency"], as_dict=True)
if account.report_type != "Balance Sheet":
frappe.throw(_("Credit To account must be a Balance Sheet account"))
if self.supplier and account.account_type != "Payable":
frappe.throw(_("Credit To account must be a Payable account"))
self.party_account_currency = account.account_currency
def check_for_stopped_status(self):
check_list = []
for d in self.get('items'):
@@ -124,20 +135,11 @@ class PurchaseInvoice(BuyingController):
}
})
if cint(frappe.defaults.get_global_default('maintain_same_rate')):
super(PurchaseInvoice, self).validate_with_previous_doc({
"Purchase Order Item": {
"ref_dn_field": "po_detail",
"compare_fields": [["rate", "="]],
"is_child_table": True,
"allow_duplicate_prev_row_id": True
},
"Purchase Receipt Item": {
"ref_dn_field": "pr_detail",
"compare_fields": [["rate", "="]],
"is_child_table": True
}
})
if cint(frappe.db.get_single_value('Buying Settings', 'maintain_same_rate')) and not self.is_return:
self.validate_rate_with_reference_doc([
["Purchase Order", "purchase_order", "po_detail"],
["Purchase Receipt", "purchase_receipt", "pr_detail"]
])
def set_against_expense_account(self):
auto_accounting_for_stock = cint(frappe.defaults.get_global_default("auto_accounting_for_stock"))
@@ -215,7 +217,7 @@ class PurchaseInvoice(BuyingController):
'party_type': 'Supplier',
'party': self.supplier,
'is_advance' : 'Yes',
'dr_or_cr' : 'debit',
'dr_or_cr' : 'debit_in_account_currency',
'unadjusted_amt' : flt(d.advance_amount),
'allocated_amt' : flt(d.allocated_amount)
}
@@ -235,9 +237,11 @@ class PurchaseInvoice(BuyingController):
# this sequence because outstanding may get -negative
self.make_gl_entries()
self.update_against_document_in_jv()
self.update_prevdoc_status()
self.update_billing_status_for_zero_amount_refdoc("Purchase Order")
if not self.is_return:
self.update_against_document_in_jv()
self.update_prevdoc_status()
self.update_billing_status_for_zero_amount_refdoc("Purchase Order")
self.update_project()
def make_gl_entries(self):
@@ -257,26 +261,32 @@ class PurchaseInvoice(BuyingController):
"party_type": "Supplier",
"party": self.supplier,
"against": self.against_expense_account,
"credit": self.total_amount_to_pay,
"remarks": self.remarks,
"against_voucher": self.name,
"credit": self.base_grand_total,
"credit_in_account_currency": self.base_grand_total \
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,
})
}, self.party_account_currency)
)
# tax table gl entries
valuation_tax = {}
for tax in self.get("taxes"):
if tax.category in ("Total", "Valuation and Total") and flt(tax.base_tax_amount_after_discount_amount):
account_currency = get_account_currency(tax.account_head)
dr_or_cr = "debit" if tax.add_deduct_tax == "Add" else "credit"
gl_entries.append(
self.get_gl_dict({
"account": tax.account_head,
"against": self.supplier,
"debit": tax.add_deduct_tax == "Add" and tax.base_tax_amount_after_discount_amount or 0,
"credit": tax.add_deduct_tax == "Deduct" and tax.base_tax_amount_after_discount_amount or 0,
"remarks": self.remarks,
dr_or_cr: tax.base_tax_amount_after_discount_amount,
dr_or_cr + "_in_account_currency": tax.base_tax_amount_after_discount_amount \
if account_currency==self.company_currency \
else tax.tax_amount_after_discount_amount,
"cost_center": tax.cost_center
})
}, account_currency)
)
# accumulate valuation tax
@@ -292,36 +302,37 @@ class PurchaseInvoice(BuyingController):
stock_items = self.get_stock_items()
for item in self.get("items"):
if flt(item.base_net_amount):
account_currency = get_account_currency(item.expense_account)
gl_entries.append(
self.get_gl_dict({
"account": item.expense_account,
"against": self.supplier,
"debit": item.base_net_amount,
"remarks": self.remarks,
"debit_in_account_currency": item.base_net_amount \
if account_currency==self.company_currency else item.net_amount,
"cost_center": item.cost_center
})
}, account_currency)
)
if auto_accounting_for_stock and self.is_opening == "No" and \
item.item_code in stock_items and item.item_tax_amount:
# Post reverse entry for Stock-Received-But-Not-Billed if it is booked in Purchase Receipt
negative_expense_booked_in_pi = None
if item.purchase_receipt:
negative_expense_booked_in_pi = frappe.db.sql("""select name from `tabGL Entry`
negative_expense_booked_in_pr = frappe.db.sql("""select name from `tabGL Entry`
where voucher_type='Purchase Receipt' and voucher_no=%s and account=%s""",
(item.purchase_receipt, expenses_included_in_valuation))
if not negative_expense_booked_in_pi:
gl_entries.append(
self.get_gl_dict({
"account": stock_received_but_not_billed,
"against": self.supplier,
"debit": flt(item.item_tax_amount, self.precision("item_tax_amount", item)),
"remarks": self.remarks or "Accounting Entry for Stock"
})
)
if not negative_expense_booked_in_pr:
gl_entries.append(
self.get_gl_dict({
"account": stock_received_but_not_billed,
"against": self.supplier,
"debit": flt(item.item_tax_amount, self.precision("item_tax_amount", item)),
"remarks": self.remarks or "Accounting Entry for Stock"
})
)
negative_expense_to_be_booked += flt(item.item_tax_amount, self.precision("item_tax_amount", item))
negative_expense_to_be_booked += flt(item.item_tax_amount, self.precision("item_tax_amount", item))
if self.is_opening == "No" and negative_expense_to_be_booked and valuation_tax:
# credit valuation tax amount in "Expenses Included In Valuation"
@@ -352,12 +363,28 @@ class PurchaseInvoice(BuyingController):
# writeoff account includes petty difference in the invoice amount
# and the amount that is paid
if self.write_off_account and flt(self.write_off_amount):
write_off_account_currency = get_account_currency(self.write_off_account)
gl_entries.append(
self.get_gl_dict({
"account": self.credit_to,
"party_type": "Supplier",
"party": self.supplier,
"against": self.write_off_account,
"debit": self.base_write_off_amount,
"debit_in_account_currency": self.base_write_off_amount \
if self.party_account_currency==self.company_currency else self.write_off_amount,
"against_voucher": self.return_against if cint(self.is_return) else self.name,
"against_voucher_type": self.doctype,
}, self.party_account_currency)
)
gl_entries.append(
self.get_gl_dict({
"account": self.write_off_account,
"against": self.supplier,
"credit": flt(self.write_off_amount),
"remarks": self.remarks,
"credit": flt(self.base_write_off_amount),
"credit_in_account_currency": self.base_write_off_amount \
if write_off_account_currency==self.company_currency else self.write_off_amount,
"cost_center": self.write_off_cost_center
})
)
@@ -367,11 +394,12 @@ class PurchaseInvoice(BuyingController):
make_gl_entries(gl_entries, cancel=(self.docstatus == 2))
def on_cancel(self):
from erpnext.accounts.utils import remove_against_link_from_jv
remove_against_link_from_jv(self.doctype, self.name, "against_voucher")
if not self.is_return:
from erpnext.accounts.utils import remove_against_link_from_jv
remove_against_link_from_jv(self.doctype, self.name)
self.update_prevdoc_status()
self.update_billing_status_for_zero_amount_refdoc("Purchase Order")
self.update_prevdoc_status()
self.update_billing_status_for_zero_amount_refdoc("Purchase Order")
self.make_gl_entries_on_cancel()
self.update_project()
@@ -391,7 +419,8 @@ class PurchaseInvoice(BuyingController):
frappe.throw("Supplier Invoice Date cannot be greater than Posting Date")
if self.bill_no:
if cint(frappe.db.get_single_value("Accounts Settings", "check_supplier_invoice_uniqueness")):
pi = frappe.db.exists("Purchase Invoice", {"bill_no": self.bill_no, "fiscal_year": self.fiscal_year})
pi = frappe.db.exists("Purchase Invoice", {"bill_no": self.bill_no,
"fiscal_year": self.fiscal_year, "name": ("!=", self.name), "docstatus": ("<", 2)})
if pi:
frappe.throw("Supplier Invoice No exists in Purchase Invoice {0}".format(pi))
@@ -411,3 +440,8 @@ def get_expense_account(doctype, txt, searchfield, start, page_len, filters):
and tabAccount.%(key)s LIKE '%(txt)s'
%(mcond)s""" % {'company': filters['company'], 'key': searchfield,
'txt': "%%%s%%" % frappe.db.escape(txt), 'mcond':get_match_cond(doctype)})
@frappe.whitelist()
def make_debit_note(source_name, target_doc=None):
from erpnext.controllers.sales_and_purchase_return import make_return_doc
return make_return_doc("Purchase Invoice", source_name, target_doc)

View File

@@ -4,9 +4,11 @@
// render
frappe.listview_settings['Purchase Invoice'] = {
add_fields: ["supplier", "supplier_name", "base_grand_total", "outstanding_amount", "due_date", "company",
"currency"],
"currency", "is_return"],
get_indicator: function(doc) {
if(flt(doc.outstanding_amount) > 0 && doc.docstatus==1) {
if(cint(doc.is_return)==1) {
return [__("Return"), "darkgrey", "is_return,=,Yes"];
} else if(flt(doc.outstanding_amount) > 0 && doc.docstatus==1) {
if(frappe.datetime.get_diff(doc.due_date) < 0) {
return [__("Overdue"), "red", "outstanding_amount,>,0|due_date,<,Today"];
} else {

View File

@@ -10,6 +10,7 @@ from frappe.utils import cint
import frappe.defaults
from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import set_perpetual_inventory, \
test_records as pr_test_records
from erpnext.exceptions import InvalidCurrency
test_dependencies = ["Item", "Cost Center"]
test_ignore = ["Serial No"]
@@ -48,25 +49,9 @@ class TestPurchaseInvoice(unittest.TestCase):
pi = frappe.copy_doc(test_records[1])
pi.insert()
pi.submit()
gl_entries = frappe.db.sql("""select account, debit, credit
from `tabGL Entry` where voucher_type='Purchase Invoice' and voucher_no=%s
order by account asc""", pi.name, as_dict=1)
self.assertTrue(gl_entries)
expected_values = dict((d[0], d) for d in [
["_Test Payable - _TC", 0, 720],
["Stock Received But Not Billed - _TC", 750.0, 0],
["Expenses Included In Valuation - _TC", 0.0, 250.0],
["_Test Account Shipping Charges - _TC", 100.0, 0],
["_Test Account VAT - _TC", 120.0, 0],
])
for i, gle in enumerate(gl_entries):
self.assertEquals(expected_values[gle.account][0], gle.account)
self.assertEquals(expected_values[gle.account][1], gle.debit)
self.assertEquals(expected_values[gle.account][2], gle.credit)
self.check_gle_for_pi(pi.name)
set_perpetual_inventory(0)
def test_gl_entries_with_auto_accounting_for_stock_against_pr(self):
@@ -82,9 +67,14 @@ class TestPurchaseInvoice(unittest.TestCase):
pi.insert()
pi.submit()
self.check_gle_for_pi(pi.name)
set_perpetual_inventory(0)
def check_gle_for_pi(self, pi):
gl_entries = frappe.db.sql("""select account, debit, credit
from `tabGL Entry` where voucher_type='Purchase Invoice' and voucher_no=%s
order by account asc""", pi.name, as_dict=1)
order by account asc""", pi, as_dict=1)
self.assertTrue(gl_entries)
expected_values = dict((d[0], d) for d in [
@@ -99,8 +89,6 @@ class TestPurchaseInvoice(unittest.TestCase):
self.assertEquals(expected_values[gle.account][1], gle.debit)
self.assertEquals(expected_values[gle.account][2], gle.credit)
set_perpetual_inventory(0)
def test_gl_entries_with_aia_for_non_stock_items(self):
set_perpetual_inventory()
self.assertEqual(cint(frappe.defaults.get_global_default("auto_accounting_for_stock")), 1)
@@ -218,62 +206,144 @@ class TestPurchaseInvoice(unittest.TestCase):
pi.load_from_db()
self.assertTrue(frappe.db.sql("""select name from `tabJournal Entry Account`
where against_voucher=%s""", pi.name))
self.assertTrue(frappe.db.sql("""select name from `tabJournal Entry Account`
where against_voucher=%s and debit=300""", pi.name))
where reference_type='Purchase Invoice'
and reference_name=%s and debit_in_account_currency=300""", pi.name))
self.assertEqual(pi.outstanding_amount, 1212.30)
pi.cancel()
self.assertTrue(not frappe.db.sql("""select name from `tabJournal Entry Account`
where against_voucher=%s""", pi.name))
self.assertFalse(frappe.db.sql("""select name from `tabJournal Entry Account`
where reference_type='Purchase Invoice' and reference_name=%s""", pi.name))
def test_recurring_invoice(self):
from erpnext.controllers.tests.test_recurring_document import test_recurring_document
test_recurring_document(self, test_records)
def test_total_purchase_cost_for_project(self):
purchase_invoice = frappe.new_doc('Purchase Invoice')
purchase_invoice.update({
"credit_to": "_Test Payable - _TC",
"supplier": "_Test Supplier",
"company": "_Test Company",
"items": [
{
"rate": 500,
"qty": 1,
"project_name": "_Test Project",
"item_code": "_Test Item Home Desktop 100",
"expense_account": "_Test Account Cost for Goods Sold - _TC",
"cost_center": "_Test Cost Center - _TC"
},
{
"rate": 1500,
"qty": 1,
"project_name": "_Test Project",
"item_code": "_Test Item Home Desktop 200",
"expense_account": "_Test Account Cost for Goods Sold - _TC",
"cost_center": "_Test Cost Center - _TC"
}
]
})
purchase_invoice.save()
purchase_invoice.submit()
self.assertEqual(frappe.db.get_value("Project", "_Test Project", "total_purchase_cost"), 2000)
purchase_invoice1 = frappe.copy_doc(purchase_invoice)
purchase_invoice1.save()
purchase_invoice1.submit()
self.assertEqual(frappe.db.get_value("Project", "_Test Project", "total_purchase_cost"), 4000)
purchase_invoice1.cancel()
self.assertEqual(frappe.db.get_value("Project", "_Test Project", "total_purchase_cost"), 2000)
purchase_invoice.cancel()
self.assertEqual(frappe.db.get_value("Project", "_Test Project", "total_purchase_cost"), 0)
def test_total_purchase_cost_for_project(self):
existing_purchase_cost = frappe.db.sql("""select sum(ifnull(base_net_amount, 0))
from `tabPurchase Invoice Item` where project_name = '_Test Project' and docstatus=1""")
existing_purchase_cost = existing_purchase_cost and existing_purchase_cost[0][0] or 0
pi = make_purchase_invoice(currency="USD", conversion_rate=60, project_name="_Test Project")
self.assertEqual(frappe.db.get_value("Project", "_Test Project", "total_purchase_cost"),
existing_purchase_cost + 15000)
pi1 = make_purchase_invoice(qty=10, project_name="_Test Project")
self.assertEqual(frappe.db.get_value("Project", "_Test Project", "total_purchase_cost"),
existing_purchase_cost + 15500)
pi1.cancel()
self.assertEqual(frappe.db.get_value("Project", "_Test Project", "total_purchase_cost"),
existing_purchase_cost + 15000)
pi.cancel()
self.assertEqual(frappe.db.get_value("Project", "_Test Project", "total_purchase_cost"), existing_purchase_cost)
def test_return_purchase_invoice(self):
set_perpetual_inventory()
pi = make_purchase_invoice()
return_pi = make_purchase_invoice(is_return=1, return_against=pi.name, qty=-2)
# check gl entries for return
gl_entries = frappe.db.sql("""select account, debit, credit
from `tabGL Entry` where voucher_type=%s and voucher_no=%s
order by account desc""", ("Purchase Invoice", return_pi.name), as_dict=1)
self.assertTrue(gl_entries)
expected_values = {
"Creditors - _TC": [100.0, 0.0],
"Stock Received But Not Billed - _TC": [0.0, 100.0],
}
for gle in gl_entries:
self.assertEquals(expected_values[gle.account][0], gle.debit)
self.assertEquals(expected_values[gle.account][1], gle.credit)
set_perpetual_inventory(0)
def test_multi_currency_gle(self):
set_perpetual_inventory(0)
pi = make_purchase_invoice(supplier="_Test Supplier USD", credit_to="_Test Payable USD - _TC",
currency="USD", conversion_rate=50)
gl_entries = frappe.db.sql("""select account, account_currency, debit, credit,
debit_in_account_currency, credit_in_account_currency
from `tabGL Entry` where voucher_type='Purchase Invoice' and voucher_no=%s
order by account asc""", pi.name, as_dict=1)
self.assertTrue(gl_entries)
expected_values = {
"_Test Payable USD - _TC": {
"account_currency": "USD",
"debit": 0,
"debit_in_account_currency": 0,
"credit": 12500,
"credit_in_account_currency": 250
},
"_Test Account Cost for Goods Sold - _TC": {
"account_currency": "INR",
"debit": 12500,
"debit_in_account_currency": 12500,
"credit": 0,
"credit_in_account_currency": 0
}
}
for field in ("account_currency", "debit", "debit_in_account_currency", "credit", "credit_in_account_currency"):
for i, gle in enumerate(gl_entries):
self.assertEquals(expected_values[gle.account][field], gle[field])
# Check for valid currency
pi1 = make_purchase_invoice(supplier="_Test Supplier USD", credit_to="_Test Payable USD - _TC",
do_not_save=True)
self.assertRaises(InvalidCurrency, pi1.save)
# cancel
pi.cancel()
gle = frappe.db.sql("""select name from `tabGL Entry`
where voucher_type='Sales Invoice' and voucher_no=%s""", pi.name)
self.assertFalse(gle)
def make_purchase_invoice(**args):
pi = frappe.new_doc("Purchase Invoice")
args = frappe._dict(args)
if args.posting_date:
pi.posting_date = args.posting_date
if args.posting_time:
pi.posting_time = args.posting_time
pi.company = args.company or "_Test Company"
pi.supplier = args.supplier or "_Test Supplier"
pi.currency = args.currency or "INR"
pi.conversion_rate = args.conversion_rate or 1
pi.is_return = args.is_return
pi.return_against = args.return_against
pi.append("items", {
"item_code": args.item or args.item_code or "_Test Item",
"warehouse": args.warehouse or "_Test Warehouse - _TC",
"qty": args.qty or 5,
"rate": args.rate or 50,
"conversion_factor": 1.0,
"serial_no": args.serial_no,
"stock_uom": "_Test UOM",
"cost_center": "_Test Cost Center - _TC",
"project_name": args.project_name
})
if not args.do_not_save:
pi.insert()
if not args.do_not_submit:
pi.submit()
return pi
test_records = frappe.get_test_records('Purchase Invoice')

View File

@@ -141,6 +141,9 @@
"supplier": "_Test Supplier",
"supplier_name": "_Test Supplier"
},
{
"bill_no": "NA",
"buying_price_list": "_Test Price List",

View File

@@ -1,89 +1,175 @@
{
"creation": "2013-03-08 15:36:46",
"docstatus": 0,
"doctype": "DocType",
"allow_copy": 0,
"allow_import": 0,
"allow_rename": 0,
"creation": "2013-03-08 15:36:46",
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"fields": [
{
"fieldname": "journal_entry",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Journal Entry",
"no_copy": 1,
"oldfieldname": "journal_voucher",
"oldfieldtype": "Link",
"options": "Journal Entry",
"permlevel": 0,
"print_width": "180px",
"read_only": 1,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "journal_entry",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Journal Entry",
"no_copy": 1,
"oldfieldname": "journal_voucher",
"oldfieldtype": "Link",
"options": "Journal Entry",
"permlevel": 0,
"print_hide": 0,
"print_width": "180px",
"read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0,
"width": "180px"
},
},
{
"fieldname": "jv_detail_no",
"fieldtype": "Data",
"hidden": 1,
"in_list_view": 0,
"label": "Journal Entry Detail No",
"no_copy": 1,
"oldfieldname": "jv_detail_no",
"oldfieldtype": "Date",
"permlevel": 0,
"print_hide": 1,
"print_width": "80px",
"read_only": 1,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "jv_detail_no",
"fieldtype": "Data",
"hidden": 1,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Journal Entry Detail No",
"no_copy": 1,
"oldfieldname": "jv_detail_no",
"oldfieldtype": "Date",
"permlevel": 0,
"print_hide": 1,
"print_width": "80px",
"read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0,
"width": "80px"
},
},
{
"fieldname": "remarks",
"fieldtype": "Small Text",
"in_list_view": 1,
"label": "Remarks",
"no_copy": 1,
"oldfieldname": "remarks",
"oldfieldtype": "Small Text",
"permlevel": 0,
"print_width": "150px",
"read_only": 1,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "remarks",
"fieldtype": "Small Text",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Remarks",
"no_copy": 1,
"oldfieldname": "remarks",
"oldfieldtype": "Small Text",
"permlevel": 0,
"print_hide": 0,
"print_width": "150px",
"read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0,
"width": "150px"
},
},
{
"fieldname": "col_break1",
"fieldtype": "Column Break",
"permlevel": 0
},
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "col_break1",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"fieldname": "advance_amount",
"fieldtype": "Currency",
"in_list_view": 1,
"label": "Advance Amount",
"no_copy": 1,
"oldfieldname": "advance_amount",
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
"permlevel": 0,
"print_width": "100px",
"read_only": 1,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "advance_amount",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Advance Amount",
"no_copy": 1,
"oldfieldname": "advance_amount",
"oldfieldtype": "Currency",
"options": "party_account_currency",
"permlevel": 0,
"print_hide": 0,
"print_width": "100px",
"read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0,
"width": "100px"
},
},
{
"fieldname": "allocated_amount",
"fieldtype": "Currency",
"in_list_view": 1,
"label": "Allocated Amount",
"no_copy": 1,
"oldfieldname": "allocated_amount",
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
"permlevel": 0,
"print_width": "100px",
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "allocated_amount",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Allocated Amount",
"no_copy": 1,
"oldfieldname": "allocated_amount",
"oldfieldtype": "Currency",
"options": "party_account_currency",
"permlevel": 0,
"print_hide": 0,
"print_width": "100px",
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0,
"width": "100px"
}
],
"idx": 1,
"istable": 1,
"modified": "2014-12-25 16:29:15.176476",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Purchase Invoice Advance",
"owner": "Administrator",
"permissions": []
}
],
"hide_heading": 0,
"hide_toolbar": 0,
"idx": 1,
"in_create": 0,
"in_dialog": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 1,
"modified": "2015-10-02 07:39:03.538046",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Purchase Invoice Advance",
"owner": "Administrator",
"permissions": [],
"read_only": 0,
"read_only_onload": 0
}

View File

@@ -1,231 +1,515 @@
{
"allow_copy": 0,
"allow_import": 0,
"allow_rename": 0,
"autoname": "hash",
"creation": "2013-05-21 16:16:04",
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"fields": [
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"default": "Valuation and Total",
"fieldname": "category",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Consider Tax or Charge for",
"label": "Consider Tax or Charge for",
"no_copy": 0,
"oldfieldname": "category",
"oldfieldtype": "Select",
"options": "Valuation and Total\nValuation\nTotal",
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"reqd": 1
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"default": "Add",
"fieldname": "add_deduct_tax",
"fieldtype": "Select",
"label": "Add or Deduct",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Add or Deduct",
"no_copy": 0,
"oldfieldname": "add_deduct_tax",
"oldfieldtype": "Select",
"options": "Add\nDeduct",
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"reqd": 1
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "charge_type",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Type",
"label": "Type",
"no_copy": 0,
"oldfieldname": "charge_type",
"oldfieldtype": "Select",
"options": "\nActual\nOn Net Total\nOn Previous Row Amount\nOn Previous Row Total",
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"reqd": 1
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "eval:[\"On Previous Row Amount\", \"On Previous Row Total\"].indexOf(doc.charge_type)!==-1",
"fieldname": "row_id",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Reference Row #",
"no_copy": 0,
"oldfieldname": "row_id",
"oldfieldtype": "Data",
"permlevel": 0,
"read_only": 0
"print_hide": 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,
"description": "If checked, the tax amount will be considered as already included in the Print Rate / Print Amount",
"fieldname": "included_in_print_rate",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Is this Tax included in Basic Rate?",
"no_copy": 0,
"permlevel": 0,
"precision": "",
"report_hide": 1
"print_hide": 0,
"read_only": 0,
"report_hide": 1,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "col_break1",
"fieldtype": "Column Break",
"permlevel": 0
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 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": "account_head",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Account Head",
"no_copy": 0,
"oldfieldname": "account_head",
"oldfieldtype": "Link",
"options": "Account",
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"reqd": 1
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"default": ":Company",
"fieldname": "cost_center",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Cost Center",
"no_copy": 0,
"oldfieldname": "cost_center",
"oldfieldtype": "Link",
"options": "Cost Center",
"permlevel": 0,
"read_only": 0
"print_hide": 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": "description",
"fieldtype": "Small Text",
"fieldtype": "Text Editor",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Description",
"no_copy": 0,
"oldfieldname": "description",
"oldfieldtype": "Small Text",
"permlevel": 0,
"print_hide": 0,
"print_width": "300px",
"read_only": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0,
"width": "300px"
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "section_break_10",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"permlevel": 0,
"precision": ""
"precision": "",
"print_hide": 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": "rate",
"fieldtype": "Float",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Rate",
"no_copy": 0,
"oldfieldname": "rate",
"oldfieldtype": "Currency",
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"reqd": 0
"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_9",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"permlevel": 0,
"precision": ""
"precision": "",
"print_hide": 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": "tax_amount",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Amount",
"no_copy": 0,
"oldfieldname": "tax_amount",
"oldfieldtype": "Currency",
"options": "currency",
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"reqd": 0
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "tax_amount_after_discount_amount",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Tax Amount After Discount Amount",
"no_copy": 0,
"options": "currency",
"permlevel": 0,
"precision": "",
"print_hide": 1,
"read_only": 1
"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": "total",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Total",
"no_copy": 0,
"oldfieldname": "total",
"oldfieldtype": "Currency",
"options": "currency",
"permlevel": 0,
"read_only": 1
"print_hide": 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": "column_break_14",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"permlevel": 0,
"precision": ""
"precision": "",
"print_hide": 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": "base_tax_amount",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Amount (Company Currency)",
"no_copy": 0,
"options": "Company:company:default_currency",
"permlevel": 0,
"precision": "",
"print_hide": 1,
"read_only": 1
"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": "base_total",
"fieldtype": "Currency",
"hidden": 1,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Total (Company Currency)",
"options": "Company:company:default_currency",
"permlevel": 0,
"precision": "",
"print_hide": 1
},
{
"fieldname": "base_tax_amount_after_discount_amount",
"fieldtype": "Currency",
"label": "Tax Amount After Discount Amount",
"no_copy": 0,
"options": "Company:company:default_currency",
"permlevel": 0,
"precision": "",
"print_hide": 1,
"read_only": 1
"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": "base_tax_amount_after_discount_amount",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Tax Amount After Discount Amount",
"no_copy": 0,
"options": "Company:company:default_currency",
"permlevel": 0,
"precision": "",
"print_hide": 1,
"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": "item_wise_tax_detail",
"fieldtype": "Small Text",
"hidden": 1,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Item Wise Tax Detail ",
"no_copy": 0,
"oldfieldname": "item_wise_tax_detail",
"oldfieldtype": "Small Text",
"permlevel": 0,
"print_hide": 1,
"read_only": 1
"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": "parenttype",
"fieldtype": "Data",
"hidden": 1,
"ignore_user_permissions": 0,
"in_filter": 1,
"in_list_view": 0,
"label": "Parenttype",
"no_copy": 0,
"oldfieldname": "parenttype",
"oldfieldtype": "Data",
"permlevel": 0,
"print_hide": 1,
"read_only": 0,
"search_index": 0
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
}
],
"hide_heading": 1,
"hide_toolbar": 0,
"idx": 1,
"in_create": 0,
"in_dialog": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 1,
"modified": "2015-04-03 13:49:24.719442",
"modified": "2015-10-02 07:39:06.372275",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Purchase Taxes and Charges",
"owner": "Administrator",
"permissions": []
"permissions": [],
"read_only": 0,
"read_only_onload": 0
}

View File

@@ -1,77 +1,182 @@
{
"allow_copy": 0,
"allow_import": 1,
"allow_rename": 1,
"autoname": "field:title",
"creation": "2013-01-10 16:34:08",
"custom": 0,
"description": "Standard tax template that can be applied to all Purchase Transactions. This template can contain list of tax heads and also other expense heads like \"Shipping\", \"Insurance\", \"Handling\" etc.\n\n#### Note\n\nThe tax rate you define here will be the standard tax rate for all **Items**. If there are **Items** that have different rates, they must be added in the **Item Tax** table in the **Item** master.\n\n#### Description of Columns\n\n1. Calculation Type: \n - This can be on **Net Total** (that is the sum of basic amount).\n - **On Previous Row Total / Amount** (for cumulative taxes or charges). If you select this option, the tax will be applied as a percentage of the previous row (in the tax table) amount or total.\n - **Actual** (as mentioned).\n2. Account Head: The Account ledger under which this tax will be booked\n3. Cost Center: If the tax / charge is an income (like shipping) or expense it needs to be booked against a Cost Center.\n4. Description: Description of the tax (that will be printed in invoices / quotes).\n5. Rate: Tax rate.\n6. Amount: Tax amount.\n7. Total: Cumulative total to this point.\n8. Enter Row: If based on \"Previous Row Total\" you can select the row number which will be taken as a base for this calculation (default is the previous row).\n9. Consider Tax or Charge for: In this section you can specify if the tax / charge is only for valuation (not a part of total) or only for total (does not add value to the item) or for both.\n10. Add or Deduct: Whether you want to add or deduct the tax.",
"docstatus": 0,
"doctype": "DocType",
"document_type": "Master",
"document_type": "Setup",
"fields": [
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "title",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 1,
"in_list_view": 0,
"label": "Title",
"no_copy": 1,
"oldfieldname": "title",
"oldfieldtype": "Data",
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0
"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": 1,
"label": "Default",
"permlevel": 0
"no_copy": 0,
"permlevel": 0,
"print_hide": 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": "disabled",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Disabled",
"no_copy": 0,
"permlevel": 0,
"precision": ""
"precision": "",
"print_hide": 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_break4",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "",
"no_copy": 0,
"permlevel": 0,
"precision": ""
"precision": "",
"print_hide": 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": "company",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 1,
"in_list_view": 1,
"label": "Company",
"no_copy": 0,
"options": "Company",
"permlevel": 0,
"reqd": 1
"print_hide": 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": "section_break6",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "",
"no_copy": 0,
"permlevel": 0,
"precision": ""
"precision": "",
"print_hide": 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": "taxes",
"fieldtype": "Table",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Purchase Taxes and Charges",
"no_copy": 0,
"oldfieldname": "purchase_tax_details",
"oldfieldtype": "Table",
"options": "Purchase Taxes and Charges",
"permlevel": 0
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
}
],
"hide_heading": 0,
"hide_toolbar": 0,
"icon": "icon-money",
"idx": 1,
"modified": "2015-05-06 08:52:01.499434",
"in_create": 0,
"in_dialog": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 0,
"modified": "2015-10-02 07:39:06.563868",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Purchase Taxes and Charges Template",
@@ -79,44 +184,65 @@
"permissions": [
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 0,
"delete": 0,
"email": 1,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Purchase Manager",
"set_user_permissions": 0,
"share": 0,
"submit": 0,
"write": 0
},
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 1,
"delete": 1,
"email": 1,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Purchase Master Manager",
"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": "Purchase User",
"set_user_permissions": 0,
"share": 0,
"submit": 0,
"write": 0
}
]
],
"read_only": 0,
"read_only_onload": 0
}

View File

@@ -4,10 +4,9 @@
from __future__ import unicode_literals
from frappe.model.document import Document
from erpnext.controllers.accounts_controller import validate_taxes_and_charges, validate_inclusive_tax
from erpnext.accounts.doctype.sales_taxes_and_charges_template.sales_taxes_and_charges_template \
import valdiate_taxes_and_charges_template
class PurchaseTaxesandChargesTemplate(Document):
def validate(self):
for tax in self.get("taxes"):
validate_taxes_and_charges(tax)
validate_inclusive_tax(tax, self)
valdiate_taxes_and_charges_template(self)

View File

@@ -11,9 +11,9 @@ def get_items(price_list, sales_or_purchase, item=None):
args = {"price_list": price_list}
if sales_or_purchase == "Sales":
condition = "i.is_sales_item='Yes'"
condition = "i.is_sales_item=1"
else:
condition = "i.is_purchase_item='Yes'"
condition = "i.is_purchase_item=1"
if item:
# search serial no

View File

@@ -28,33 +28,30 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
}
}
// if document is POS then change default print format to "POS Invoice" if no default is specified
if(cur_frm.doc.is_pos && cur_frm.doc.docstatus===1 && cint(frappe.defaults.get_user_defaults("fs_pos_view"))===1
&& !locals.DocType[cur_frm.doctype].default_print_format) {
locals.DocType[cur_frm.doctype].default_print_format = "POS Invoice";
cur_frm.setup_print_layout();
}
erpnext.queries.setup_queries(this.frm, "Warehouse", function() {
return erpnext.queries.warehouse(me.frm.doc);
});
},
refresh: function(doc, dt, dn) {
this._super();
if(cur_frm.msgbox && cur_frm.msgbox.$wrapper.is(":visible")) {
// hide new msgbox
cur_frm.msgbox.hide();
}
cur_frm.dashboard.reset();
if(doc.docstatus==1) {
cur_frm.add_custom_button('View Ledger', function() {
frappe.route_options = {
"voucher_no": doc.name,
"from_date": doc.posting_date,
"to_date": doc.posting_date,
"company": doc.company,
group_by_voucher: 0
};
frappe.set_route("query-report", "General Ledger");
}, "icon-table");
this.frm.toggle_reqd("due_date", !this.frm.doc.is_return);
// var percent_paid = cint(flt(doc.base_grand_total - doc.outstanding_amount) / flt(doc.base_grand_total) * 100);
// cur_frm.dashboard.add_progress(percent_paid + "% Paid", percent_paid);
this.show_general_ledger();
if(doc.update_stock) this.show_stock_ledger();
if(doc.docstatus==1 && !doc.is_return) {
cur_frm.add_custom_button(doc.update_stock ? __('Sales Return') : __('Credit Note'),
this.make_sales_return);
if(cint(doc.update_stock)!=1) {
// show Make Delivery Note button only if Sales Invoice is not created from Delivery Note
@@ -65,20 +62,38 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
});
if(!from_delivery_note) {
cur_frm.add_custom_button(__('Make Delivery'), cur_frm.cscript['Make Delivery Note'], "icon-truck")
cur_frm.add_custom_button(__('Delivery'), cur_frm.cscript['Make Delivery Note']).addClass("btn-primary");
}
}
if(doc.outstanding_amount!=0) {
cur_frm.add_custom_button(__('Make Payment Entry'), cur_frm.cscript.make_bank_entry, "icon-money");
if(doc.outstanding_amount!=0 && !cint(doc.is_return)) {
cur_frm.add_custom_button(__('Payment'), cur_frm.cscript.make_bank_entry).addClass("btn-primary");
}
}
// Show buttons only when pos view is active
if (cint(doc.docstatus==0) && cur_frm.page.current_view_name!=="pos") {
if (cint(doc.docstatus==0) && cur_frm.page.current_view_name!=="pos" && !doc.is_return) {
cur_frm.cscript.sales_order_btn();
cur_frm.cscript.delivery_note_btn();
}
this.set_default_print_format();
},
set_default_print_format: function() {
// set default print format to POS type
if(cur_frm.doc.is_pos) {
if(cur_frm.pos_print_format) {
cur_frm.meta._default_print_format = cur_frm.meta.default_print_format;
cur_frm.meta.default_print_format = cur_frm.pos_print_format;
}
} else {
if(cur_frm.meta._default_print_format) {
cur_frm.meta.default_print_format = cur_frm.meta._default_print_format;
cur_frm.meta._default_print_format = null;
}
}
},
sales_order_btn: function() {
@@ -124,6 +139,7 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
is_pos: function(doc, dt, dn, callback_fn) {
cur_frm.cscript.hide_fields(this.frm.doc);
if(cur_frm.doc.__missing_values_set) return;
if(cint(this.frm.doc.is_pos)) {
if(!this.frm.doc.company) {
this.frm.set_value("is_pos", 0);
@@ -135,6 +151,10 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
method: "set_missing_values",
callback: function(r) {
if(!r.exc) {
if(r.message && r.message.print_format) {
cur_frm.pos_print_format = r.message.print_format;
}
cur_frm.doc.__missing_values_set = true;
me.frm.script_manager.trigger("update_stock");
frappe.model.set_default_values(me.frm.doc);
me.set_dynamic_labels();
@@ -163,6 +183,26 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
})
},
debit_to: function() {
var me = this;
if(this.frm.doc.debit_to) {
me.frm.call({
method: "frappe.client.get_value",
args: {
doctype: "Account",
fieldname: "account_currency",
filters: { name: me.frm.doc.debit_to },
},
callback: function(r, rt) {
if(r.message) {
me.frm.set_value("party_account_currency", r.message.account_currency);
me.set_dynamic_labels();
}
}
});
}
},
allocated_amount: function() {
this.calculate_total_advance();
this.frm.refresh_fields();
@@ -170,10 +210,10 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
write_off_outstanding_amount_automatically: function() {
if(cint(this.frm.doc.write_off_outstanding_amount_automatically)) {
frappe.model.round_floats_in(this.frm.doc, ["base_grand_total", "paid_amount"]);
frappe.model.round_floats_in(this.frm.doc, ["grand_total", "paid_amount"]);
// this will make outstanding amount 0
this.frm.set_value("write_off_amount",
flt(this.frm.doc.base_grand_total - this.frm.doc.paid_amount - this.frm.doc.total_advance, precision("write_off_amount"))
flt(this.frm.doc.grand_total - this.frm.doc.paid_amount - this.frm.doc.total_advance, precision("write_off_amount"))
);
this.frm.toggle_enable("write_off_amount", false);
@@ -186,10 +226,12 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
},
write_off_amount: function() {
this.set_in_company_currency(this.frm.doc, ["write_off_amount"]);
this.write_off_outstanding_amount_automatically();
},
paid_amount: function() {
this.set_in_company_currency(this.frm.doc, ["paid_amount"]);
this.write_off_outstanding_amount_automatically();
},
@@ -205,8 +247,14 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
items_on_form_rendered: function() {
erpnext.setup_serial_no();
}
},
make_sales_return: function() {
frappe.model.open_mapped_doc({
method: "erpnext.accounts.doctype.sales_invoice.sales_invoice.make_sales_return",
frm: cur_frm
})
}
});
// for backward compatibility: combine new and previous states
@@ -283,16 +331,6 @@ cur_frm.cscript.make_bank_entry = function() {
});
}
cur_frm.fields_dict.debit_to.get_query = function(doc) {
return{
filters: {
'report_type': 'Balance Sheet',
'is_group': 0,
'company': doc.company
}
}
}
cur_frm.fields_dict.cash_bank_account.get_query = function(doc) {
return {
filters: [
@@ -338,7 +376,7 @@ cur_frm.fields_dict['project_name'].get_query = function(doc, cdt, cdn) {
// --------------------------------
cur_frm.set_query("income_account", "items", function(doc) {
return{
query: "erpnext.accounts.doctype.sales_invoice.sales_invoice.get_income_account",
query: "erpnext.controllers.queries.get_income_account",
filters: {'company': doc.company}
}
});
@@ -369,15 +407,15 @@ cur_frm.fields_dict["items"].grid.get_field("cost_center").get_query = function(
}
cur_frm.cscript.income_account = function(doc, cdt, cdn) {
cur_frm.cscript.copy_account_in_all_row(doc, cdt, cdn, "income_account");
erpnext.utils.copy_value_in_all_row(doc, cdt, cdn, "items", "income_account");
}
cur_frm.cscript.expense_account = function(doc, cdt, cdn) {
cur_frm.cscript.copy_account_in_all_row(doc, cdt, cdn, "expense_account");
erpnext.utils.copy_value_in_all_row(doc, cdt, cdn, "items", "expense_account");
}
cur_frm.cscript.cost_center = function(doc, cdt, cdn) {
cur_frm.cscript.copy_account_in_all_row(doc, cdt, cdn, "cost_center");
erpnext.utils.copy_value_in_all_row(doc, cdt, cdn, "items", "cost_center");
}
cur_frm.cscript.on_submit = function(doc, cdt, cdn) {
@@ -385,18 +423,33 @@ cur_frm.cscript.on_submit = function(doc, cdt, cdn) {
if(row.delivery_note) frappe.model.clear_doc("Delivery Note", row.delivery_note)
})
if(cint(frappe.boot.notification_settings.sales_invoice)) {
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>');
} else if(cint(frappe.boot.notification_settings.sales_invoice)) {
cur_frm.email_doc(frappe.boot.notification_settings.sales_invoice_message);
} else if(cur_frm.doc.is_pos) {
new_doc("Sales Invoice");
}
}
cur_frm.set_query("debit_to", function(doc) {
return{
filters: [
['Account', 'root_type', '=', 'Asset'],
['Account', 'account_type', '=', 'Receivable']
]
// filter on Account
if (doc.customer) {
return {
filters: {
'account_type': 'Receivable',
'is_group': 0,
'company': doc.company
}
}
} else {
return {
filters: {
'report_type': 'Balance Sheet',
'is_group': 0,
'company': doc.company
}
}
}
});

File diff suppressed because it is too large Load Diff

View File

@@ -4,13 +4,14 @@
from __future__ import unicode_literals
import frappe
import frappe.defaults
from frappe.utils import cint, cstr, flt
from frappe.utils import cint, flt
from frappe import _, msgprint, throw
from erpnext.accounts.party import get_party_account, get_due_date
from erpnext.controllers.stock_controller import update_gl_entries_after
from frappe.model.mapper import get_mapped_doc
from erpnext.controllers.selling_controller import SellingController
from erpnext.accounts.utils import get_account_currency
form_grid_templates = {
"items": "templates/form_grid/item_grid.html"
@@ -35,6 +36,15 @@ class SalesInvoice(SellingController):
'overflow_type': 'billing'
}]
def set_indicator(self):
"""Set indicator for portal"""
if self.outstanding_amount > 0:
self.indicator_color = "orange"
self.indicator_title = _("Unpaid")
else:
self.indicator_color = "green"
self.indicator_title = _("Paid")
def validate(self):
super(SalesInvoice, self).validate()
self.validate_posting_time()
@@ -46,7 +56,7 @@ class SalesInvoice(SellingController):
self.validate_debit_to_acc()
self.validate_fixed_asset_account()
self.clear_unallocated_advances("Sales Invoice Advance", "advances")
self.validate_advance_jv("advances", "sales_order")
self.validate_advance_jv("Sales Order")
self.add_remarks()
self.validate_write_off_account()
@@ -66,6 +76,7 @@ class SalesInvoice(SellingController):
self.validate_c_form()
self.validate_time_logs_are_submitted()
self.validate_multiple_billing("Delivery Note", "dn_detail", "amount", "items")
self.update_packing_list()
def on_submit(self):
super(SalesInvoice, self).on_submit()
@@ -80,14 +91,21 @@ class SalesInvoice(SellingController):
self.check_prev_docstatus()
if self.is_return:
# NOTE status updating bypassed for is_return
self.status_updater = []
self.update_status_updater_args()
self.update_prevdoc_status()
self.update_billing_status_for_zero_amount_refdoc("Sales Order")
self.check_credit_limit()
# this sequence because outstanding may get -ve
self.make_gl_entries()
if not cint(self.is_pos) == 1:
if not self.is_return:
self.update_billing_status_for_zero_amount_refdoc("Sales Order")
self.check_credit_limit()
if not cint(self.is_pos) == 1 and not self.is_return:
self.update_against_document_in_jv()
self.update_time_log_batch(self.name)
@@ -102,18 +120,25 @@ class SalesInvoice(SellingController):
self.check_stop_sales_order("sales_order")
from erpnext.accounts.utils import remove_against_link_from_jv
remove_against_link_from_jv(self.doctype, self.name, "against_invoice")
remove_against_link_from_jv(self.doctype, self.name)
if self.is_return:
# NOTE status updating bypassed for is_return
self.status_updater = []
self.update_status_updater_args()
self.update_prevdoc_status()
self.update_billing_status_for_zero_amount_refdoc("Sales Order")
if not self.is_return:
self.update_billing_status_for_zero_amount_refdoc("Sales Order")
self.validate_c_form_on_cancel()
self.make_gl_entries_on_cancel()
def update_status_updater_args(self):
if cint(self.update_stock):
self.status_updater.append({
self.status_updater.extend([{
'source_dt':'Sales Invoice Item',
'target_dt':'Sales Order Item',
'target_parent_dt':'Sales Order',
@@ -131,18 +156,46 @@ class SalesInvoice(SellingController):
'overflow_type': 'delivery',
'extra_cond': """ and exists(select name from `tabSales Invoice`
where name=`tabSales Invoice Item`.parent and ifnull(update_stock, 0) = 1)"""
})
},
{
'source_dt': 'Sales Invoice Item',
'target_dt': 'Sales Order Item',
'join_field': 'so_detail',
'target_field': 'returned_qty',
'target_parent_dt': 'Sales Order',
# 'target_parent_field': 'per_delivered',
# 'target_ref_field': 'qty',
'source_field': '-1 * qty',
# 'percent_join_field': 'sales_order',
# 'overflow_type': 'delivery',
'extra_cond': """ and exists (select name from `tabSales Invoice` where name=`tabSales Invoice Item`.parent and update_stock=1 and is_return=1)"""
}
])
def check_credit_limit(self):
from erpnext.selling.doctype.customer.customer import check_credit_limit
validate_against_credit_limit = False
for d in self.get("items"):
if not (d.sales_order or d.delivery_note):
validate_against_credit_limit = True
break
if validate_against_credit_limit:
check_credit_limit(self.customer, self.company)
def set_missing_values(self, for_validate=False):
self.set_pos_fields(for_validate)
pos = self.set_pos_fields(for_validate)
if not self.debit_to:
self.debit_to = get_party_account(self.company, self.customer, "Customer")
if not self.due_date:
self.debit_to = get_party_account("Customer", self.customer, self.company)
if not self.due_date and self.customer:
self.due_date = get_due_date(self.posting_date, "Customer", self.customer, self.company)
super(SalesInvoice, self).set_missing_values(for_validate)
if pos:
return {"print_format": pos.get("print_format") }
def update_time_log_batch(self, sales_invoice):
for d in self.get("items"):
if d.time_log_batch:
@@ -154,8 +207,8 @@ class SalesInvoice(SellingController):
def validate_time_logs_are_submitted(self):
for d in self.get("items"):
if d.time_log_batch:
status = frappe.db.get_value("Time Log Batch", d.time_log_batch, "status")
if status!="Submitted":
docstatus = frappe.db.get_value("Time Log Batch", d.time_log_batch, "docstatus")
if docstatus!=1:
frappe.throw(_("Time Log Batch {0} must be 'Submitted'").format(d.time_log_batch))
def set_pos_fields(self, for_validate=False):
@@ -163,12 +216,13 @@ class SalesInvoice(SellingController):
if cint(self.is_pos) != 1:
return
from erpnext.stock.get_item_details import get_pos_profiles_item_details, get_pos_profiles
pos = get_pos_profiles(self.company)
from erpnext.stock.get_item_details import get_pos_profile_item_details, get_pos_profile
pos = get_pos_profile(self.company)
if pos:
if not for_validate and not self.customer:
self.customer = pos.customer
self.mode_of_payment = pos.mode_of_payment
# self.set_customer_defaults()
for fieldname in ('territory', 'naming_series', 'currency', 'taxes_and_charges', 'letter_head', 'tc_name',
@@ -183,7 +237,7 @@ class SalesInvoice(SellingController):
# set pos values in items
for item in self.get("items"):
if item.get('item_code'):
for fname, val in get_pos_profiles_item_details(pos,
for fname, val in get_pos_profile_item_details(pos,
frappe._dict(item.as_dict()), pos).items():
if (not for_validate) or (for_validate and not item.get(fname)):
@@ -197,9 +251,12 @@ class SalesInvoice(SellingController):
if self.taxes_and_charges and not len(self.get("taxes")):
self.set_taxes()
return pos
def get_advances(self):
super(SalesInvoice, self).get_advances(self.debit_to, "Customer", self.customer,
"Sales Invoice Advance", "advances", "credit", "sales_order")
if not self.is_return:
super(SalesInvoice, self).get_advances(self.debit_to, "Customer", self.customer,
"Sales Invoice Advance", "advances", "credit_in_account_currency", "sales_order")
def get_company_abbr(self):
return frappe.db.sql("select abbr from tabCompany where name=%s", self.company)[0][0]
@@ -224,7 +281,7 @@ class SalesInvoice(SellingController):
'party_type': 'Customer',
'party': self.customer,
'is_advance' : 'Yes',
'dr_or_cr' : 'credit',
'dr_or_cr' : 'credit_in_account_currency',
'unadjusted_amt' : flt(d.advance_amount),
'allocated_amt' : flt(d.allocated_amount)
}
@@ -235,19 +292,24 @@ class SalesInvoice(SellingController):
reconcile_against_document(lst)
def validate_debit_to_acc(self):
account_type = frappe.db.get_value("Account", self.debit_to, "account_type")
if account_type != "Receivable":
account = frappe.db.get_value("Account", self.debit_to,
["account_type", "report_type", "account_currency"], as_dict=True)
if account.report_type != "Balance Sheet":
frappe.throw(_("Debit To account must be a Balance Sheet account"))
if self.customer and account.account_type != "Receivable":
frappe.throw(_("Debit To account must be a Receivable account"))
self.party_account_currency = account.account_currency
def validate_fixed_asset_account(self):
"""Validate Fixed Asset and whether Income Account Entered Exists"""
for d in self.get('items'):
item = frappe.db.sql("""select name,is_asset_item,is_sales_item from `tabItem`
where name = %s""", d.item_code)
acc = frappe.db.sql("""select account_type from `tabAccount`
where name = %s and docstatus != 2""", d.income_account)
if item and item[0][1] == 'Yes' and acc and acc[0][0] != 'Fixed Asset':
msgprint(_("Account {0} must be of type 'Fixed Asset' as Item {1} is an Asset Item").format(acc[0][0], d.item_code), raise_exception=True)
is_asset_item = frappe.db.get_value("Item", d.item_code, "is_asset_item")
account_type = frappe.db.get_value("Account", d.income_account, "account_type")
if is_asset_item == 1 and account_type != 'Fixed Asset':
msgprint(_("Account {0} must be of type 'Fixed Asset' as Item {1} is an Asset Item").format(d.income_account, d.item_code), raise_exception=True)
def validate_with_previous_doc(self):
super(SalesInvoice, self).validate_with_previous_doc({
@@ -263,20 +325,11 @@ class SalesInvoice(SellingController):
},
})
if cint(frappe.defaults.get_global_default('maintain_same_sales_rate')):
super(SalesInvoice, self).validate_with_previous_doc({
"Sales Order Item": {
"ref_dn_field": "so_detail",
"compare_fields": [["rate", "="]],
"is_child_table": True,
"allow_duplicate_prev_row_id": True
},
"Delivery Note Item": {
"ref_dn_field": "dn_detail",
"compare_fields": [["rate", "="]],
"is_child_table": True
}
})
if cint(frappe.db.get_single_value('Selling Settings', 'maintain_same_sales_rate')) and not self.is_return:
self.validate_rate_with_reference_doc([
["Sales Order", "sales_order", "so_detail"],
["Delivery Note", "delivery_note", "dn_detail"]
])
def set_against_income_account(self):
"""Set against account for debit to account"""
@@ -297,7 +350,7 @@ class SalesInvoice(SellingController):
for i in dic:
if frappe.db.get_value('Selling Settings', None, dic[i]) == 'Yes':
for d in self.get('items'):
if frappe.db.get_value('Item', d.item_code, 'is_stock_item') == 'Yes' \
if frappe.db.get_value('Item', d.item_code, 'is_stock_item') == 1 \
and not d.get(i.lower().replace(' ','_')):
msgprint(_("{0} is mandatory for Item {1}").format(i,d.item_code), raise_exception=1)
@@ -366,6 +419,13 @@ class SalesInvoice(SellingController):
d.actual_qty = bin and flt(bin[0]['actual_qty']) or 0
d.projected_qty = bin and flt(bin[0]['projected_qty']) or 0
def update_packing_list(self):
if cint(self.update_stock) == 1:
from erpnext.stock.doctype.packed_item.packed_item import make_packing_list
make_packing_list(self)
else:
self.set('packed_items', [])
def get_warehouse(self):
user_pos_profile = frappe.db.sql("""select name, warehouse from `tabPOS Profile`
@@ -384,25 +444,11 @@ class SalesInvoice(SellingController):
return warehouse
def on_update(self):
if cint(self.update_stock) == 1:
# Set default warehouse from POS Profile
if cint(self.is_pos) == 1:
w = self.get_warehouse()
if w:
for d in self.get('items'):
if not d.warehouse:
d.warehouse = cstr(w)
from erpnext.stock.doctype.packed_item.packed_item import make_packing_list
make_packing_list(self, 'items')
else:
self.set('packed_items', [])
if cint(self.is_pos) == 1:
if flt(self.paid_amount) == 0:
if self.cash_bank_account:
frappe.db.set(self, 'paid_amount',
(flt(self.base_grand_total) - flt(self.write_off_amount)))
flt(flt(self.grand_total) - flt(self.write_off_amount), self.precision("paid_amount")))
else:
# show message that the amount is not paid
frappe.db.set(self,'paid_amount',0)
@@ -410,31 +456,16 @@ class SalesInvoice(SellingController):
else:
frappe.db.set(self,'paid_amount',0)
frappe.db.set(self, 'base_paid_amount',
flt(self.paid_amount*self.conversion_rate, self.precision("base_paid_amount")))
def check_prev_docstatus(self):
for d in self.get('items'):
if d.sales_order:
submitted = frappe.db.sql("""select name from `tabSales Order`
where docstatus = 1 and name = %s""", d.sales_order)
if not submitted:
frappe.throw(_("Sales Order {0} is not submitted").format(d.sales_order))
if d.sales_order and frappe.db.get_value("Sales Order", d.sales_order, "docstatus") != 1:
frappe.throw(_("Sales Order {0} is not submitted").format(d.sales_order))
if d.delivery_note:
submitted = frappe.db.sql("""select name from `tabDelivery Note`
where docstatus = 1 and name = %s""", d.delivery_note)
if not submitted:
throw(_("Delivery Note {0} is not submitted").format(d.delivery_note))
def update_stock_ledger(self):
sl_entries = []
for d in self.get_item_list():
if frappe.db.get_value("Item", d.item_code, "is_stock_item") == "Yes" \
and d.warehouse:
sl_entries.append(self.get_sl_entries(d, {
"actual_qty": -1*flt(d.qty),
"stock_uom": frappe.db.get_value("Item", d.item_code, "stock_uom")
}))
self.make_sl_entries(sl_entries)
if d.delivery_note and frappe.db.get_value("Delivery Note", d.delivery_note, "docstatus") != 1:
throw(_("Delivery Note {0} is not submitted").format(d.delivery_note))
def make_gl_entries(self, repost_future_gle=True):
gl_entries = self.get_gl_entries()
@@ -442,16 +473,16 @@ class SalesInvoice(SellingController):
if gl_entries:
from erpnext.accounts.general_ledger import make_gl_entries
# if POS and amount is written off, there's no outstanding and hence no need to update it
update_outstanding = cint(self.is_pos) and self.write_off_account \
and 'No' or 'Yes'
# if POS and amount is written off, updating outstanding amt after posting all gl entries
update_outstanding = "No" if (cint(self.is_pos) or self.write_off_account) else "Yes"
make_gl_entries(gl_entries, cancel=(self.docstatus == 2),
update_outstanding=update_outstanding, merge_entries=False)
if update_outstanding == "No":
from erpnext.accounts.doctype.gl_entry.gl_entry import update_outstanding_amt
update_outstanding_amt(self.debit_to, "Customer", self.customer, self.doctype, self.name)
update_outstanding_amt(self.debit_to, "Customer", self.customer,
self.doctype, self.return_against if cint(self.is_return) else self.name)
if repost_future_gle and cint(self.update_stock) \
and cint(frappe.defaults.get_global_default("auto_accounting_for_stock")):
@@ -483,7 +514,7 @@ class SalesInvoice(SellingController):
return gl_entries
def make_customer_gl_entry(self, gl_entries):
if self.base_grand_total:
if self.grand_total:
gl_entries.append(
self.get_gl_dict({
"account": self.debit_to,
@@ -491,47 +522,52 @@ class SalesInvoice(SellingController):
"party": self.customer,
"against": self.against_income_account,
"debit": self.base_grand_total,
"remarks": self.remarks,
"against_voucher": self.name,
"debit_in_account_currency": self.base_grand_total \
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
})
}, self.party_account_currency)
)
def make_tax_gl_entries(self, gl_entries):
for tax in self.get("taxes"):
if flt(tax.base_tax_amount_after_discount_amount):
account_currency = get_account_currency(tax.account_head)
gl_entries.append(
self.get_gl_dict({
"account": tax.account_head,
"against": self.customer,
"credit": flt(tax.base_tax_amount_after_discount_amount),
"remarks": self.remarks,
"credit_in_account_currency": flt(tax.base_tax_amount_after_discount_amount) \
if account_currency==self.company_currency else flt(tax.tax_amount_after_discount_amount),
"cost_center": tax.cost_center
})
}, account_currency)
)
def make_item_gl_entries(self, gl_entries):
# income account gl entries
for item in self.get("items"):
if flt(item.base_net_amount):
account_currency = get_account_currency(item.income_account)
gl_entries.append(
self.get_gl_dict({
"account": item.income_account,
"against": self.customer,
"credit": item.base_net_amount,
"remarks": self.remarks,
"credit_in_account_currency": item.base_net_amount \
if account_currency==self.company_currency else item.net_amount,
"cost_center": item.cost_center
})
}, account_currency)
)
# expense account gl entries
if cint(frappe.defaults.get_global_default("auto_accounting_for_stock")) \
and cint(self.update_stock):
gl_entries += super(SalesInvoice, self).get_gl_entries()
def make_pos_gl_entries(self, gl_entries):
if cint(self.is_pos) and self.cash_bank_account and self.paid_amount:
bank_account_currency = get_account_currency(self.cash_bank_account)
# POS, make payment entries
gl_entries.append(
self.get_gl_dict({
@@ -539,44 +575,50 @@ class SalesInvoice(SellingController):
"party_type": "Customer",
"party": self.customer,
"against": self.cash_bank_account,
"credit": self.paid_amount,
"remarks": self.remarks,
"against_voucher": self.name,
"credit": self.base_paid_amount,
"credit_in_account_currency": self.base_paid_amount \
if self.party_account_currency==self.company_currency else self.paid_amount,
"against_voucher": self.return_against if cint(self.is_return) else self.name,
"against_voucher_type": self.doctype,
})
}, self.party_account_currency)
)
gl_entries.append(
self.get_gl_dict({
"account": self.cash_bank_account,
"against": self.customer,
"debit": self.paid_amount,
"remarks": self.remarks,
})
"debit": self.base_paid_amount,
"debit_in_account_currency": self.base_paid_amount \
if bank_account_currency==self.company_currency else self.paid_amount
}, bank_account_currency)
)
def make_write_off_gl_entry(self, gl_entries):
# write off entries, applicable if only pos
if self.write_off_account and self.write_off_amount:
write_off_account_currency = get_account_currency(self.write_off_account)
gl_entries.append(
self.get_gl_dict({
"account": self.debit_to,
"party_type": "Customer",
"party": self.customer,
"against": self.write_off_account,
"credit": self.write_off_amount,
"remarks": self.remarks,
"against_voucher": self.name,
"against_voucher_type": self.doctype,
})
"credit": self.base_write_off_amount,
"credit_in_account_currency": self.base_write_off_amount \
if self.party_account_currency==self.company_currency else self.write_off_amount,
"against_voucher": self.return_against if cint(self.is_return) else self.name,
"against_voucher_type": self.doctype
}, self.party_account_currency)
)
gl_entries.append(
self.get_gl_dict({
"account": self.write_off_account,
"against": self.customer,
"debit": self.write_off_amount,
"remarks": self.remarks,
"debit": self.base_write_off_amount,
"debit_in_account_currency": self.base_write_off_amount \
if write_off_account_currency==self.company_currency else self.write_off_amount,
"cost_center": self.write_off_cost_center
})
}, write_off_account_currency)
)
def get_list_context(context=None):
@@ -595,24 +637,6 @@ def get_bank_cash_account(mode_of_payment, company):
"account": account
}
@frappe.whitelist()
def get_income_account(doctype, txt, searchfield, start, page_len, filters):
from erpnext.controllers.queries import get_match_cond
# income account can be any Credit account,
# but can also be a Asset account with account_type='Income Account' in special circumstances.
# Hence the first condition is an "OR"
return frappe.db.sql("""select tabAccount.name from `tabAccount`
where (tabAccount.report_type = "Profit and Loss"
or tabAccount.account_type in ("Income Account", "Temporary"))
and tabAccount.is_group=0
and tabAccount.docstatus!=2
and tabAccount.company = '%(company)s'
and tabAccount.%(key)s LIKE '%(txt)s'
%(mcond)s""" % {'company': filters['company'], 'key': searchfield,
'txt': "%%%s%%" % frappe.db.escape(txt), 'mcond':get_match_cond(doctype)})
@frappe.whitelist()
def make_delivery_note(source_name, target_doc=None):
def set_missing_values(source, target):
@@ -659,3 +683,9 @@ def make_delivery_note(source_name, target_doc=None):
}, target_doc, set_missing_values)
return doclist
@frappe.whitelist()
def make_sales_return(source_name, target_doc=None):
from erpnext.controllers.sales_and_purchase_return import make_return_doc
return make_return_doc("Sales Invoice", source_name, target_doc)

View File

@@ -4,9 +4,11 @@
// render
frappe.listview_settings['Sales Invoice'] = {
add_fields: ["customer", "customer_name", "base_grand_total", "outstanding_amount", "due_date", "company",
"currency"],
"currency", "is_return"],
get_indicator: function(doc) {
if(flt(doc.outstanding_amount)==0) {
if(cint(doc.is_return)==1) {
return [__("Return"), "darkgrey", "is_return,=,Yes"];
} else if(flt(doc.outstanding_amount)==0) {
return [__("Paid"), "green", "outstanding_amount,=,0"]
} else if (flt(doc.outstanding_amount) > 0 && doc.due_date > frappe.datetime.get_today()) {
return [__("Unpaid"), "orange", "outstanding_amount,>,0|due_date,>,Today"]

View File

@@ -4,11 +4,12 @@ from __future__ import unicode_literals
import frappe
import unittest, copy
import time
from erpnext.accounts.utils import get_stock_and_account_difference
from frappe.utils import nowdate, add_days, flt
from erpnext.stock.doctype.stock_entry.test_stock_entry import make_stock_entry, get_qty_after_transaction
from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import set_perpetual_inventory
from erpnext.projects.doctype.time_log_batch.test_time_log_batch import *
from erpnext.exceptions import InvalidAccountCurrency, InvalidCurrency
from erpnext.stock.doctype.serial_no.serial_no import SerialNoWarehouseError
from frappe.model.naming import make_autoname
class TestSalesInvoice(unittest.TestCase):
def make(self):
@@ -393,7 +394,8 @@ class TestSalesInvoice(unittest.TestCase):
import test_records as jv_test_records
jv = frappe.get_doc(frappe.copy_doc(jv_test_records[0]))
jv.get("accounts")[0].against_invoice = w.name
jv.get("accounts")[0].reference_type = w.doctype
jv.get("accounts")[0].reference_name = w.name
jv.insert()
jv.submit()
@@ -402,33 +404,7 @@ class TestSalesInvoice(unittest.TestCase):
jv.cancel()
self.assertEquals(frappe.db.get_value("Sales Invoice", w.name, "outstanding_amount"), 561.8)
def test_time_log_batch(self):
delete_time_log_and_batch()
time_log = create_time_log()
tlb = create_time_log_batch(time_log)
tlb = frappe.get_doc("Time Log Batch", tlb.name)
tlb.submit()
si = frappe.get_doc(frappe.copy_doc(test_records[0]))
si.get("items")[0].time_log_batch = tlb.name
si.insert()
si.submit()
self.assertEquals(frappe.db.get_value("Time Log Batch", tlb.name, "status"), "Billed")
self.assertEquals(frappe.db.get_value("Time Log", time_log, "status"), "Billed")
si.cancel()
self.assertEquals(frappe.db.get_value("Time Log Batch", tlb.name, "status"), "Submitted")
self.assertEquals(frappe.db.get_value("Time Log", time_log, "status"), "Batched for Billing")
frappe.delete_doc("Sales Invoice", si.name)
delete_time_log_and_batch()
def test_sales_invoice_gl_entry_without_aii(self):
def test_sales_invoice_gl_entry_without_perpetual_inventory(self):
set_perpetual_inventory(0)
si = frappe.copy_doc(test_records[1])
si.insert()
@@ -460,7 +436,7 @@ class TestSalesInvoice(unittest.TestCase):
self.assertFalse(gle)
def test_pos_gl_entry_with_aii(self):
def test_pos_gl_entry_with_perpetual_inventory(self):
set_perpetual_inventory()
self.make_pos_profile()
@@ -469,8 +445,7 @@ class TestSalesInvoice(unittest.TestCase):
pos = copy.deepcopy(test_records[1])
pos["is_pos"] = 1
pos["update_stock"] = 1
# pos["posting_time"] = "12:05"
pos["cash_bank_account"] = "_Test Account Bank Account - _TC"
pos["cash_bank_account"] = "_Test Bank - _TC"
pos["paid_amount"] = 600.0
si = frappe.copy_doc(pos)
@@ -501,7 +476,7 @@ class TestSalesInvoice(unittest.TestCase):
[stock_in_hand, 0.0, abs(sle.stock_value_difference)],
[pos["items"][0]["expense_account"], abs(sle.stock_value_difference), 0.0],
[si.debit_to, 0.0, 600.0],
["_Test Account Bank Account - _TC", 600.0, 0.0]
["_Test Bank - _TC", 600.0, 0.0]
])
for i, gle in enumerate(sorted(gl_entries, key=lambda gle: gle.account)):
@@ -521,7 +496,7 @@ class TestSalesInvoice(unittest.TestCase):
def make_pos_profile(self):
pos_profile = frappe.get_doc({
"cash_bank_account": "_Test Account Bank Account - _TC",
"cash_bank_account": "_Test Bank - _TC",
"company": "_Test Company",
"cost_center": "_Test Cost Center - _TC",
"currency": "INR",
@@ -540,7 +515,7 @@ class TestSalesInvoice(unittest.TestCase):
if not frappe.db.exists("POS Profile", "_Test POS Profile"):
pos_profile.insert()
def test_si_gl_entry_with_aii_and_update_stock_with_warehouse_but_no_account(self):
def test_si_gl_entry_with_perpetual_inventory_and_update_stock_with_warehouse_but_no_account(self):
set_perpetual_inventory()
frappe.delete_doc("Account", "_Test Warehouse No Account - _TC")
@@ -594,7 +569,7 @@ class TestSalesInvoice(unittest.TestCase):
self.assertFalse(gle)
set_perpetual_inventory(0)
def test_sales_invoice_gl_entry_with_aii_no_item_code(self):
def test_sales_invoice_gl_entry_with_perpetual_inventory_no_item_code(self):
set_perpetual_inventory()
si = frappe.get_doc(test_records[1])
@@ -620,7 +595,7 @@ class TestSalesInvoice(unittest.TestCase):
set_perpetual_inventory(0)
def test_sales_invoice_gl_entry_with_aii_non_stock_item(self):
def test_sales_invoice_gl_entry_with_perpetual_inventory_non_stock_item(self):
set_perpetual_inventory()
si = frappe.get_doc(test_records[1])
si.get("items")[0].item_code = "_Test Non Stock Item"
@@ -684,17 +659,17 @@ class TestSalesInvoice(unittest.TestCase):
si.load_from_db()
self.assertTrue(frappe.db.sql("""select name from `tabJournal Entry Account`
where against_invoice=%s""", si.name))
where reference_name=%s""", si.name))
self.assertTrue(frappe.db.sql("""select name from `tabJournal Entry Account`
where against_invoice=%s and credit=300""", si.name))
where reference_name=%s and credit_in_account_currency=300""", si.name))
self.assertEqual(si.outstanding_amount, 261.8)
si.cancel()
self.assertTrue(not frappe.db.sql("""select name from `tabJournal Entry Account`
where against_invoice=%s""", si.name))
where reference_name=%s""", si.name))
def test_recurring_invoice(self):
from erpnext.controllers.tests.test_recurring_document import test_recurring_document
@@ -715,7 +690,6 @@ class TestSalesInvoice(unittest.TestCase):
si.insert()
si.submit()
self.assertEquals(frappe.db.get_value("Serial No", serial_nos[0], "status"), "Delivered")
self.assertFalse(frappe.db.get_value("Serial No", serial_nos[0], "warehouse"))
self.assertEquals(frappe.db.get_value("Serial No", serial_nos[0],
"delivery_document_no"), si.name)
@@ -729,53 +703,235 @@ class TestSalesInvoice(unittest.TestCase):
serial_nos = get_serial_nos(si.get("items")[0].serial_no)
self.assertEquals(frappe.db.get_value("Serial No", serial_nos[0], "status"), "Available")
self.assertEquals(frappe.db.get_value("Serial No", serial_nos[0], "warehouse"), "_Test Warehouse - _TC")
self.assertFalse(frappe.db.get_value("Serial No", serial_nos[0],
"delivery_document_no"))
def test_serialize_status(self):
from erpnext.stock.doctype.serial_no.serial_no import SerialNoStatusError, get_serial_nos, SerialNoDuplicateError
from erpnext.stock.doctype.stock_entry.test_stock_entry import make_serialized_item
se = make_serialized_item()
serial_nos = get_serial_nos(se.get("items")[0].serial_no)
sr = frappe.get_doc("Serial No", serial_nos[0])
sr.status = "Not Available"
sr.save()
serial_no = frappe.get_doc({
"doctype": "Serial No",
"item_code": "_Test Serialized Item With Series",
"serial_no": make_autoname("SR", "Serial No")
})
serial_no.save()
si = frappe.copy_doc(test_records[0])
si.update_stock = 1
si.get("items")[0].item_code = "_Test Serialized Item With Series"
si.get("items")[0].qty = 1
si.get("items")[0].serial_no = serial_nos[0]
si.get("items")[0].serial_no = serial_no.name
si.insert()
self.assertRaises(SerialNoStatusError, si.submit)
self.assertRaises(SerialNoWarehouseError, si.submit)
# hack! because stock ledger entires are already inserted and are not rolled back!
self.assertRaises(SerialNoDuplicateError, si.cancel)
def test_invoice_due_date_against_customers_credit_days(self):
# set customer's credit days
frappe.db.set_value("Customer", "_Test Customer", "credit_days_based_on", "Fixed Days")
frappe.db.set_value("Customer", "_Test Customer", "credit_days", 10)
si = create_sales_invoice()
self.assertEqual(si.due_date, add_days(nowdate(), 10))
# set customer's credit days is last day of the next month
frappe.db.set_value("Customer", "_Test Customer", "credit_days_based_on", "Last Day of the Next Month")
si1 = create_sales_invoice(posting_date="2015-07-05")
self.assertEqual(si1.due_date, "2015-08-31")
def test_return_sales_invoice(self):
set_perpetual_inventory()
make_stock_entry(item_code="_Test Item", target="_Test Warehouse - _TC", qty=50, basic_rate=100)
actual_qty_0 = get_qty_after_transaction()
si = create_sales_invoice(qty=5, rate=500, update_stock=1)
actual_qty_1 = get_qty_after_transaction()
self.assertEquals(actual_qty_0 - 5, actual_qty_1)
# outgoing_rate
outgoing_rate = frappe.db.get_value("Stock Ledger Entry", {"voucher_type": "Sales Invoice",
"voucher_no": si.name}, "stock_value_difference") / 5
# return entry
si1 = create_sales_invoice(is_return=1, return_against=si.name, qty=-2, rate=500, update_stock=1)
actual_qty_2 = get_qty_after_transaction()
self.assertEquals(actual_qty_1 + 2, actual_qty_2)
incoming_rate, stock_value_difference = frappe.db.get_value("Stock Ledger Entry",
{"voucher_type": "Sales Invoice", "voucher_no": si1.name},
["incoming_rate", "stock_value_difference"])
self.assertEquals(flt(incoming_rate, 3), abs(flt(outgoing_rate, 3)))
# Check gl entry
gle_warehouse_amount = frappe.db.get_value("GL Entry", {"voucher_type": "Sales Invoice",
"voucher_no": si1.name, "account": "_Test Warehouse - _TC"}, "debit")
self.assertEquals(gle_warehouse_amount, stock_value_difference)
party_credited = frappe.db.get_value("GL Entry", {"voucher_type": "Sales Invoice",
"voucher_no": si1.name, "account": "Debtors - _TC", "party": "_Test Customer"}, "credit")
self.assertEqual(party_credited, 1000)
# Check outstanding amount
self.assertFalse(si1.outstanding_amount)
self.assertEqual(frappe.db.get_value("Sales Invoice", si.name, "outstanding_amount"), 1500)
set_perpetual_inventory(0)
def test_discount_on_net_total(self):
si = frappe.copy_doc(test_records[2])
si.apply_discount_on = "Net Total"
si.discount_amount = 625
si.insert()
expected_values = {
"keys": ["price_list_rate", "discount_percentage", "rate", "amount",
"base_price_list_rate", "base_rate", "base_amount",
"net_rate", "base_net_rate", "net_amount", "base_net_amount"],
"_Test Item Home Desktop 100": [50, 0, 50, 500, 50, 50, 500, 25, 25, 250, 250],
"_Test Item Home Desktop 200": [150, 0, 150, 750, 150, 150, 750, 75, 75, 375, 375],
}
# check if children are saved
self.assertEquals(len(si.get("items")),
len(expected_values)-1)
# check if item values are calculated
for d in si.get("items"):
for i, k in enumerate(expected_values["keys"]):
self.assertEquals(d.get(k), expected_values[d.item_code][i])
# check net total
self.assertEquals(si.base_total, 1250)
self.assertEquals(si.total, 1250)
self.assertEquals(si.base_net_total, 625)
self.assertEquals(si.net_total, 625)
# check tax calculation
expected_values = {
"keys": ["tax_amount", "tax_amount_after_discount_amount",
"base_tax_amount_after_discount_amount"],
"_Test Account Shipping Charges - _TC": [100, 100, 100],
"_Test Account Customs Duty - _TC": [62.5, 62.5, 62.5],
"_Test Account Excise Duty - _TC": [70, 70, 70],
"_Test Account Education Cess - _TC": [1.4, 1.4, 1.4],
"_Test Account S&H Education Cess - _TC": [.7, 0.7, 0.7],
"_Test Account CST - _TC": [17.2, 17.2, 17.2],
"_Test Account VAT - _TC": [78.13, 78.13, 78.13],
"_Test Account Discount - _TC": [-95.49, -95.49, -95.49]
}
for d in si.get("taxes"):
for i, k in enumerate(expected_values["keys"]):
self.assertEquals(d.get(k), expected_values[d.account_head][i])
self.assertEquals(si.total_taxes_and_charges, 234.44)
self.assertEquals(si.base_grand_total, 859.44)
self.assertEquals(si.grand_total, 859.44)
def test_multi_currency_gle(self):
set_perpetual_inventory(0)
si = create_sales_invoice(customer="_Test Customer USD", debit_to="_Test Receivable USD - _TC",
currency="USD", conversion_rate=50)
gl_entries = frappe.db.sql("""select account, account_currency, debit, credit,
debit_in_account_currency, credit_in_account_currency
from `tabGL Entry` where voucher_type='Sales Invoice' and voucher_no=%s
order by account asc""", si.name, as_dict=1)
self.assertTrue(gl_entries)
expected_values = {
"_Test Receivable USD - _TC": {
"account_currency": "USD",
"debit": 5000,
"debit_in_account_currency": 100,
"credit": 0,
"credit_in_account_currency": 0
},
"Sales - _TC": {
"account_currency": "INR",
"debit": 0,
"debit_in_account_currency": 0,
"credit": 5000,
"credit_in_account_currency": 5000
}
}
for field in ("account_currency", "debit", "debit_in_account_currency", "credit", "credit_in_account_currency"):
for i, gle in enumerate(gl_entries):
self.assertEquals(expected_values[gle.account][field], gle[field])
# cancel
si.cancel()
gle = frappe.db.sql("""select name from `tabGL Entry`
where voucher_type='Sales Invoice' and voucher_no=%s""", si.name)
self.assertFalse(gle)
def test_invalid_currency(self):
# Customer currency = USD
# Transaction currency cannot be INR
si1 = create_sales_invoice(customer="_Test Customer USD", debit_to="_Test Receivable USD - _TC",
do_not_save=True)
self.assertRaises(InvalidCurrency, si1.save)
# Transaction currency cannot be EUR
si2 = create_sales_invoice(customer="_Test Customer USD", debit_to="_Test Receivable USD - _TC",
currency="EUR", conversion_rate=80, do_not_save=True)
self.assertRaises(InvalidCurrency, si2.save)
# Transaction currency only allowed in USD
si3 = create_sales_invoice(customer="_Test Customer USD", debit_to="_Test Receivable USD - _TC",
currency="USD", conversion_rate=50)
# Party Account currency must be in USD, as there is existing GLE with USD
si4 = create_sales_invoice(customer="_Test Customer USD", debit_to="_Test Receivable - _TC",
currency="USD", conversion_rate=50, do_not_submit=True)
self.assertRaises(InvalidAccountCurrency, si4.submit)
# Party Account currency must be in USD, force customer currency as there is no GLE
si3.cancel()
si5 = create_sales_invoice(customer="_Test Customer USD", debit_to="_Test Receivable - _TC",
currency="USD", conversion_rate=50, do_not_submit=True)
self.assertRaises(InvalidAccountCurrency, si5.submit)
def create_sales_invoice(**args):
si = frappe.new_doc("Sales Invoice")
args = frappe._dict(args)
if args.posting_date:
si.posting_date = args.posting_date
if args.posting_time:
si.posting_time = args.posting_time
si.posting_date = args.posting_date or nowdate()
si.company = args.company or "_Test Company"
si.customer = args.customer or "_Test Customer"
si.debit_to = args.debit_to or "Debtors - _TC"
si.update_stock = args.update_stock
si.is_pos = args.is_pos
si.is_return = args.is_return
si.return_against = args.return_against
si.currency=args.currency or "INR"
si.conversion_rate = args.conversion_rate or 1
si.append("items", {
"item_code": args.item or args.item_code or "_Test Item",
"warehouse": args.warehouse or "_Test Warehouse - _TC",
"qty": args.qty or 1,
"rate": args.rate or 100,
"income_account": "Sales - _TC",
"expense_account": "Cost of Goods Sold - _TC",
"cost_center": "_Test Cost Center - _TC",
"serial_no": args.serial_no

View File

@@ -1,89 +1,175 @@
{
"creation": "2013-02-22 01:27:41",
"docstatus": 0,
"doctype": "DocType",
"allow_copy": 0,
"allow_import": 0,
"allow_rename": 0,
"creation": "2013-02-22 01:27:41",
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"fields": [
{
"fieldname": "journal_entry",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Journal Entry",
"no_copy": 1,
"oldfieldname": "journal_voucher",
"oldfieldtype": "Link",
"options": "Journal Entry",
"permlevel": 0,
"print_width": "250px",
"read_only": 1,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "journal_entry",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Journal Entry",
"no_copy": 1,
"oldfieldname": "journal_voucher",
"oldfieldtype": "Link",
"options": "Journal Entry",
"permlevel": 0,
"print_hide": 0,
"print_width": "250px",
"read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0,
"width": "250px"
},
},
{
"fieldname": "remarks",
"fieldtype": "Small Text",
"in_list_view": 1,
"label": "Remarks",
"no_copy": 1,
"oldfieldname": "remarks",
"oldfieldtype": "Small Text",
"permlevel": 0,
"print_width": "150px",
"read_only": 1,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "remarks",
"fieldtype": "Small Text",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Remarks",
"no_copy": 1,
"oldfieldname": "remarks",
"oldfieldtype": "Small Text",
"permlevel": 0,
"print_hide": 0,
"print_width": "150px",
"read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0,
"width": "150px"
},
},
{
"fieldname": "jv_detail_no",
"fieldtype": "Data",
"hidden": 1,
"in_list_view": 0,
"label": "Journal Entry Detail No",
"no_copy": 1,
"oldfieldname": "jv_detail_no",
"oldfieldtype": "Data",
"permlevel": 0,
"print_hide": 1,
"print_width": "120px",
"read_only": 1,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "jv_detail_no",
"fieldtype": "Data",
"hidden": 1,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Journal Entry Detail No",
"no_copy": 1,
"oldfieldname": "jv_detail_no",
"oldfieldtype": "Data",
"permlevel": 0,
"print_hide": 1,
"print_width": "120px",
"read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0,
"width": "120px"
},
},
{
"fieldname": "col_break1",
"fieldtype": "Column Break",
"permlevel": 0
},
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "col_break1",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"fieldname": "advance_amount",
"fieldtype": "Currency",
"in_list_view": 1,
"label": "Advance amount",
"no_copy": 1,
"oldfieldname": "advance_amount",
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
"permlevel": 0,
"print_width": "120px",
"read_only": 1,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "advance_amount",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Advance amount",
"no_copy": 1,
"oldfieldname": "advance_amount",
"oldfieldtype": "Currency",
"options": "party_account_currency",
"permlevel": 0,
"print_hide": 0,
"print_width": "120px",
"read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0,
"width": "120px"
},
},
{
"fieldname": "allocated_amount",
"fieldtype": "Currency",
"in_list_view": 1,
"label": "Allocated amount",
"no_copy": 1,
"oldfieldname": "allocated_amount",
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
"permlevel": 0,
"print_width": "120px",
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "allocated_amount",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Allocated amount",
"no_copy": 1,
"oldfieldname": "allocated_amount",
"oldfieldtype": "Currency",
"options": "party_account_currency",
"permlevel": 0,
"print_hide": 0,
"print_width": "120px",
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0,
"width": "120px"
}
],
"idx": 1,
"istable": 1,
"modified": "2014-12-25 16:30:19.446500",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Sales Invoice Advance",
"owner": "Administrator",
"permissions": []
}
],
"hide_heading": 0,
"hide_toolbar": 0,
"idx": 1,
"in_create": 0,
"in_dialog": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 1,
"modified": "2015-10-02 07:39:09.979547",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Sales Invoice Advance",
"owner": "Administrator",
"permissions": [],
"read_only": 0,
"read_only_onload": 0
}

View File

@@ -1,201 +1,467 @@
{
"allow_copy": 0,
"allow_import": 0,
"allow_rename": 0,
"autoname": "INVTD.######",
"creation": "2013-04-24 11:39:32",
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"fields": [
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "charge_type",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Type",
"label": "Type",
"no_copy": 0,
"oldfieldname": "charge_type",
"oldfieldtype": "Select",
"options": "\nActual\nOn Net Total\nOn Previous Row Amount\nOn Previous Row Total",
"permlevel": 0,
"reqd": 1
"print_hide": 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,
"depends_on": "eval:[\"On Previous Row Amount\", \"On Previous Row Total\"].indexOf(doc.charge_type)!==-1",
"fieldname": "row_id",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Reference Row #",
"no_copy": 0,
"oldfieldname": "row_id",
"oldfieldtype": "Data",
"permlevel": 0
"permlevel": 0,
"print_hide": 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": "account_head",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Account Head",
"no_copy": 0,
"oldfieldname": "account_head",
"oldfieldtype": "Link",
"options": "Account",
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 1
"search_index": 1,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"default": ":Company",
"fieldname": "cost_center",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Cost Center",
"no_copy": 0,
"oldfieldname": "cost_center_other_charges",
"oldfieldtype": "Link",
"options": "Cost Center",
"permlevel": 0
"permlevel": 0,
"print_hide": 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": "col_break_1",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0,
"width": "50%"
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "description",
"fieldtype": "Small Text",
"fieldtype": "Text Editor",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Description",
"no_copy": 0,
"oldfieldname": "description",
"oldfieldtype": "Small Text",
"permlevel": 0,
"print_hide": 0,
"print_width": "300px",
"read_only": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0,
"width": "300px"
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "If checked, the tax amount will be considered as already included in the Print Rate / Print Amount",
"fieldname": "included_in_print_rate",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Is this Tax included in Basic Rate?",
"no_copy": 0,
"permlevel": 0,
"print_hide": 1,
"print_width": "150px",
"read_only": 0,
"report_hide": 1,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0,
"width": "150px"
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "section_break_8",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"permlevel": 0,
"precision": ""
"precision": "",
"print_hide": 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": "rate",
"fieldtype": "Float",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Rate",
"no_copy": 0,
"oldfieldname": "rate",
"oldfieldtype": "Currency",
"permlevel": 0,
"reqd": 0
"print_hide": 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": "section_break_9",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"permlevel": 0,
"precision": ""
"precision": "",
"print_hide": 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": "tax_amount",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Amount",
"no_copy": 0,
"options": "currency",
"permlevel": 0,
"precision": ""
"precision": "",
"print_hide": 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": "total",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Total",
"no_copy": 0,
"options": "currency",
"permlevel": 0,
"precision": "",
"read_only": 1
"print_hide": 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": "tax_amount_after_discount_amount",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Tax Amount After Discount Amount",
"no_copy": 0,
"options": "currency",
"permlevel": 0,
"precision": "",
"read_only": 1
"print_hide": 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": "column_break_13",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"permlevel": 0,
"precision": ""
"precision": "",
"print_hide": 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": "base_tax_amount",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Amount (Company Currency)",
"no_copy": 0,
"oldfieldname": "tax_amount",
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
"permlevel": 0,
"print_hide": 0,
"read_only": 1,
"reqd": 0
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "base_total",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Total (Company Currency)",
"no_copy": 0,
"oldfieldname": "total",
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
"permlevel": 0,
"read_only": 1
"print_hide": 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,
"depends_on": "eval:parent.discount_amount",
"fieldname": "base_tax_amount_after_discount_amount",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Tax Amount After Discount Amount (Company Currency)",
"no_copy": 0,
"options": "Company:company:default_currency",
"permlevel": 0,
"read_only": 1
"print_hide": 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": "item_wise_tax_detail",
"fieldtype": "Small Text",
"hidden": 1,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Item Wise Tax Detail",
"no_copy": 0,
"oldfieldname": "item_wise_tax_detail",
"oldfieldtype": "Small Text",
"permlevel": 0,
"read_only": 1
"print_hide": 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": "parenttype",
"fieldtype": "Data",
"hidden": 1,
"ignore_user_permissions": 0,
"in_filter": 1,
"in_list_view": 0,
"label": "Parenttype",
"no_copy": 0,
"oldfieldname": "parenttype",
"oldfieldtype": "Data",
"permlevel": 0,
"print_hide": 1,
"search_index": 1
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 1,
"set_only_once": 0,
"unique": 0
}
],
"hide_heading": 1,
"hide_toolbar": 0,
"idx": 1,
"in_create": 0,
"in_dialog": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 1,
"modified": "2015-03-04 15:16:30.732876",
"modified": "2015-10-02 07:39:11.977789",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Sales Taxes and Charges",
"owner": "Administrator",
"permissions": []
"permissions": [],
"read_only": 0,
"read_only_onload": 0
}

View File

@@ -5,6 +5,3 @@ cur_frm.cscript.tax_table = "Sales Taxes and Charges";
{% include "public/js/controllers/accounts.js" %}
frappe.ui.form.on("Sales Taxes and Charges Template", "onload", function(frm) {
erpnext.add_applicable_territory();
});

View File

@@ -1,86 +1,181 @@
{
"allow_copy": 0,
"allow_import": 1,
"allow_rename": 1,
"autoname": "field:title",
"creation": "2013-01-10 16:34:09",
"custom": 0,
"description": "Standard tax template that can be applied to all Sales Transactions. This template can contain list of tax heads and also other expense / income heads like \"Shipping\", \"Insurance\", \"Handling\" etc.\n\n#### Note\n\nThe tax rate you define here will be the standard tax rate for all **Items**. If there are **Items** that have different rates, they must be added in the **Item Tax** table in the **Item** master.\n\n#### Description of Columns\n\n1. Calculation Type: \n - This can be on **Net Total** (that is the sum of basic amount).\n - **On Previous Row Total / Amount** (for cumulative taxes or charges). If you select this option, the tax will be applied as a percentage of the previous row (in the tax table) amount or total.\n - **Actual** (as mentioned).\n2. Account Head: The Account ledger under which this tax will be booked\n3. Cost Center: If the tax / charge is an income (like shipping) or expense it needs to be booked against a Cost Center.\n4. Description: Description of the tax (that will be printed in invoices / quotes).\n5. Rate: Tax rate.\n6. Amount: Tax amount.\n7. Total: Cumulative total to this point.\n8. Enter Row: If based on \"Previous Row Total\" you can select the row number which will be taken as a base for this calculation (default is the previous row).\n9. Is this Tax included in Basic Rate?: If you check this, it means that this tax will not be shown below the item table, but will be included in the Basic Rate in your main item table. This is useful where you want give a flat price (inclusive of all taxes) price to customers.",
"docstatus": 0,
"doctype": "DocType",
"document_type": "Master",
"document_type": "Setup",
"fields": [
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "title",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 1,
"in_list_view": 0,
"label": "Title",
"no_copy": 1,
"oldfieldname": "title",
"oldfieldtype": "Data",
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0
"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": 1,
"label": "Default",
"permlevel": 0
"no_copy": 0,
"permlevel": 0,
"print_hide": 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": "disabled",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Disabled",
"no_copy": 0,
"permlevel": 0,
"precision": ""
"precision": "",
"print_hide": 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_3",
"fieldtype": "Column Break",
"permlevel": 0
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 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": "company",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 1,
"in_list_view": 1,
"label": "Company",
"no_copy": 0,
"oldfieldname": "company",
"oldfieldtype": "Link",
"options": "Company",
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "section_break_5",
"fieldtype": "Section Break",
"permlevel": 0
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 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,
"description": "* Will be calculated in the transaction.",
"fieldname": "taxes",
"fieldtype": "Table",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Sales Taxes and Charges",
"no_copy": 0,
"oldfieldname": "other_charges",
"oldfieldtype": "Table",
"options": "Sales Taxes and Charges",
"permlevel": 0
},
{
"description": "Specify a list of Territories, for which, this Taxes Master is valid",
"fieldname": "territories",
"fieldtype": "Table",
"label": "Valid for Territories",
"options": "Applicable Territory",
"permlevel": 0,
"reqd": 1
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
}
],
"hide_heading": 0,
"hide_toolbar": 0,
"icon": "icon-money",
"idx": 1,
"modified": "2015-05-06 08:51:54.662853",
"in_create": 0,
"in_dialog": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 0,
"modified": "2015-10-02 07:39:12.157257",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Sales Taxes and Charges Template",
@@ -89,44 +184,64 @@
{
"amend": 0,
"apply_user_permissions": 1,
"cancel": 0,
"create": 0,
"delete": 0,
"email": 1,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Sales User",
"set_user_permissions": 0,
"share": 0,
"submit": 0,
"write": 0
},
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 1,
"delete": 1,
"email": 1,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Accounts Manager",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"write": 1
},
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 1,
"delete": 1,
"email": 1,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Sales Master Manager",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"write": 1
}
]
],
"read_only": 0,
"read_only_onload": 0
}

View File

@@ -8,18 +8,17 @@ from erpnext.controllers.accounts_controller import validate_taxes_and_charges,
class SalesTaxesandChargesTemplate(Document):
def validate(self):
if self.is_default == 1:
frappe.db.sql("""update `tabSales Taxes and Charges Template`
set is_default = 0
where ifnull(is_default,0) = 1
and name != %s and company = %s""",
(self.name, self.company))
valdiate_taxes_and_charges_template(self)
# at least one territory
self.validate_table_has_rows("territories")
for tax in self.get("taxes"):
validate_taxes_and_charges(tax)
validate_inclusive_tax(tax, self)
def valdiate_taxes_and_charges_template(doc):
if not doc.is_default and not frappe.get_all(doc.doctype, filters={"is_default": 1}):
doc.is_default = 1
if doc.is_default == 1:
frappe.db.sql("""update `tab{0}` set is_default = 0
where ifnull(is_default,0) = 1 and name != %s and company = %s""".format(doc.doctype),
(doc.name, doc.company))
for tax in doc.get("taxes"):
validate_taxes_and_charges(tax)
validate_inclusive_tax(tax, doc)

View File

@@ -20,19 +20,7 @@
"rate": 6.36
}
],
"title": "_Test Sales Taxes and Charges Template",
"territories": [
{
"doctype": "Applicable Territory",
"parentfield": "territories",
"territory": "All Territories"
},
{
"doctype": "Applicable Territory",
"parentfield": "territories",
"territory": "_Test Territory Rest Of The World"
}
]
"title": "_Test Sales Taxes and Charges Template"
},
{
"company": "_Test Company",
@@ -115,14 +103,7 @@
"row_id": 7
}
],
"title": "_Test India Tax Master",
"territories": [
{
"doctype": "Applicable Territory",
"parentfield": "territories",
"territory": "_Test Territory India"
}
]
"title": "_Test India Tax Master"
},
{
"company": "_Test Company",
@@ -145,13 +126,76 @@
"rate": 4
}
],
"title": "_Test Sales Taxes and Charges Template - Rest of the World",
"territories": [
"title": "_Test Sales Taxes and Charges Template - Rest of the World"
},
{
"company": "_Test Company",
"doctype": "Sales Taxes and Charges Template",
"taxes": [
{
"doctype": "Applicable Territory",
"parentfield": "territories",
"territory": "_Test Territory Rest Of The World"
"account_head": "_Test Account VAT - _TC",
"charge_type": "On Net Total",
"description": "VAT",
"doctype": "Sales Taxes and Charges",
"parentfield": "taxes",
"rate": 12
},
{
"account_head": "_Test Account Service Tax - _TC",
"charge_type": "On Net Total",
"description": "Service Tax",
"doctype": "Sales Taxes and Charges",
"parentfield": "taxes",
"rate": 4
}
]
],
"title": "_Test Sales Taxes and Charges Template 1"
},
{
"company": "_Test Company",
"doctype": "Sales Taxes and Charges Template",
"taxes": [
{
"account_head": "_Test Account VAT - _TC",
"charge_type": "On Net Total",
"description": "VAT",
"doctype": "Sales Taxes and Charges",
"parentfield": "taxes",
"rate": 12
},
{
"account_head": "_Test Account Service Tax - _TC",
"charge_type": "On Net Total",
"description": "Service Tax",
"doctype": "Sales Taxes and Charges",
"parentfield": "taxes",
"rate": 4
}
],
"title": "_Test Sales Taxes and Charges Template 2"
},
{
"doctype" : "Sales Taxes and Charges Template",
"title": "_Test Tax 1",
"company": "_Test Company",
"taxes":[{
"charge_type": "Actual",
"account_head": "Sales Expenses - _TC",
"cost_center": "Main - _TC",
"description": "Test Shopping cart taxes with Tax Rule",
"tax_amount": 1000
}]
},
{
"doctype" : "Sales Taxes and Charges Template",
"title": "_Test Tax 2",
"company": "_Test Company",
"taxes":[{
"charge_type": "Actual",
"account_head": "Sales Expenses - _TC",
"cost_center": "Main - _TC",
"description": "Test Shopping cart taxes with Tax Rule",
"tax_amount": 200
}]
}
]

View File

@@ -1,8 +1,3 @@
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt
$.extend(cur_frm.cscript, {
onload: function() {
erpnext.add_applicable_territory();
}
});

View File

@@ -1,156 +1,397 @@
{
"allow_copy": 0,
"allow_import": 0,
"allow_rename": 0,
"autoname": "field:label",
"creation": "2013-06-25 11:48:03",
"custom": 0,
"description": "Specify conditions to calculate shipping amount",
"docstatus": 0,
"doctype": "DocType",
"fields": [
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "example: Next Day Shipping",
"fieldname": "label",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Shipping Rule Label",
"no_copy": 0,
"permlevel": 0,
"reqd": 1
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"fieldname": "column_break_2",
"fieldtype": "Column Break",
"permlevel": 0
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "disabled",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Disabled",
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 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": "Net Total",
"fieldname": "calculate_based_on",
"fieldtype": "Select",
"hidden": 1,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Calculate Based On",
"label": "Calculate Based On",
"no_copy": 0,
"options": "Net Total\nNet Weight",
"permlevel": 0,
"print_hide": 0,
"read_only": 1,
"reqd": 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.disabled",
"fieldname": "rule_conditions_section",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Shipping Rule Conditions",
"permlevel": 0
"no_copy": 0,
"permlevel": 0,
"print_hide": 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": "conditions",
"fieldtype": "Table",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Shipping Rule Conditions",
"no_copy": 0,
"options": "Shipping Rule Condition",
"permlevel": 0,
"reqd": 1
"print_hide": 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,
"depends_on": "eval:!doc.disabled",
"fieldname": "section_break_6",
"fieldtype": "Section Break",
"permlevel": 0
},
{
"description": "Specify a list of Territories, for which, this Shipping Rule is valid",
"fieldname": "territories",
"fieldtype": "Table",
"label": "Valid For Territories",
"options": "Applicable Territory",
"permlevel": 0,
"reqd": 1
},
{
"fieldname": "column_break_8",
"fieldtype": "Column Break",
"permlevel": 0
},
{
"fieldname": "company",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Company",
"options": "Company",
"label": "Valid for Countries",
"no_copy": 0,
"permlevel": 0,
"reqd": 1
"print_hide": 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": "worldwide_shipping",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Worldwide Shipping",
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 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.worldwide_shipping",
"fieldname": "countries",
"fieldtype": "Table",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Valid for Countries",
"no_copy": 0,
"options": "Shipping Rule Country",
"permlevel": 0,
"precision": "",
"print_hide": 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.disabled",
"fieldname": "section_break_10",
"fieldtype": "Section Break",
"permlevel": 0
},
{
"fieldname": "account",
"fieldtype": "Link",
"label": "Shipping Account",
"options": "Account",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"permlevel": 0,
"reqd": 1
"print_hide": 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": "company",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Company",
"no_copy": 0,
"options": "Company",
"permlevel": 0,
"print_hide": 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": "column_break_12",
"fieldtype": "Column Break",
"permlevel": 0
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 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": "account",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Shipping Account",
"no_copy": 0,
"options": "Account",
"permlevel": 0,
"print_hide": 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": "cost_center",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Cost Center",
"no_copy": 0,
"options": "Cost Center",
"permlevel": 0,
"reqd": 1
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0
}
],
"hide_heading": 0,
"hide_toolbar": 0,
"icon": "icon-truck",
"idx": 1,
"modified": "2015-02-05 05:11:46.634371",
"in_create": 0,
"in_dialog": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 0,
"modified": "2015-10-02 07:39:12.778062",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Shipping Rule",
"owner": "Administrator",
"permissions": [
{
"amend": 0,
"apply_user_permissions": 1,
"cancel": 0,
"create": 0,
"delete": 0,
"email": 1,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Accounts User"
"role": "Accounts User",
"set_user_permissions": 0,
"share": 0,
"submit": 0,
"write": 0
},
{
"amend": 0,
"apply_user_permissions": 1,
"cancel": 0,
"create": 0,
"delete": 0,
"email": 1,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Sales User"
"role": "Sales User",
"set_user_permissions": 0,
"share": 0,
"submit": 0,
"write": 0
},
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 1,
"delete": 1,
"email": 1,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Accounts Manager",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"write": 1
},
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 1,
"delete": 1,
"email": 1,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Sales Master Manager",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"write": 1
}
]
],
"read_only": 0,
"read_only_onload": 0
}

View File

@@ -22,6 +22,12 @@ class ShippingRule(Document):
self.sort_shipping_rule_conditions()
self.validate_overlapping_shipping_rule_conditions()
if self.worldwide_shipping:
self.countries = []
elif not len([d.country for d in self.countries if d.country]):
frappe.throw(_("Please specify a country for this Shipping Rule or check Worldwide Shipping"))
def validate_from_to_values(self):
zero_to_values = []

View File

@@ -1,116 +1,100 @@
[
{
"account": "_Test Account Shipping Charges - _TC",
"calculate_based_on": "Net Total",
"company": "_Test Company",
"cost_center": "_Test Cost Center - _TC",
"doctype": "Shipping Rule",
"label": "_Test Shipping Rule",
"name": "_Test Shipping Rule",
"account": "_Test Account Shipping Charges - _TC",
"calculate_based_on": "Net Total",
"company": "_Test Company",
"cost_center": "_Test Cost Center - _TC",
"doctype": "Shipping Rule",
"label": "_Test Shipping Rule",
"name": "_Test Shipping Rule",
"conditions": [
{
"doctype": "Shipping Rule Condition",
"from_value": 0,
"parentfield": "conditions",
"shipping_amount": 50.0,
"doctype": "Shipping Rule Condition",
"from_value": 0,
"parentfield": "conditions",
"shipping_amount": 50.0,
"to_value": 100
},
},
{
"doctype": "Shipping Rule Condition",
"from_value": 101,
"parentfield": "conditions",
"shipping_amount": 100.0,
"doctype": "Shipping Rule Condition",
"from_value": 101,
"parentfield": "conditions",
"shipping_amount": 100.0,
"to_value": 200
},
},
{
"doctype": "Shipping Rule Condition",
"from_value": 201,
"parentfield": "conditions",
"doctype": "Shipping Rule Condition",
"from_value": 201,
"parentfield": "conditions",
"shipping_amount": 0.0
}
],
"territories": [
{
"doctype": "Applicable Territory",
"parentfield": "territories",
"territory": "_Test Territory"
}
]
},
],
"worldwide_shipping": 1
},
{
"account": "_Test Account Shipping Charges - _TC",
"calculate_based_on": "Net Total",
"company": "_Test Company",
"cost_center": "_Test Cost Center - _TC",
"doctype": "Shipping Rule",
"label": "_Test Shipping Rule - India",
"name": "_Test Shipping Rule - India",
"account": "_Test Account Shipping Charges - _TC",
"calculate_based_on": "Net Total",
"company": "_Test Company",
"cost_center": "_Test Cost Center - _TC",
"doctype": "Shipping Rule",
"label": "_Test Shipping Rule - India",
"name": "_Test Shipping Rule - India",
"conditions": [
{
"doctype": "Shipping Rule Condition",
"from_value": 0,
"parentfield": "conditions",
"shipping_amount": 50.0,
"doctype": "Shipping Rule Condition",
"from_value": 0,
"parentfield": "conditions",
"shipping_amount": 50.0,
"to_value": 100
},
},
{
"doctype": "Shipping Rule Condition",
"from_value": 101,
"parentfield": "conditions",
"shipping_amount": 100.0,
"doctype": "Shipping Rule Condition",
"from_value": 101,
"parentfield": "conditions",
"shipping_amount": 100.0,
"to_value": 200
},
},
{
"doctype": "Shipping Rule Condition",
"from_value": 201,
"parentfield": "conditions",
"doctype": "Shipping Rule Condition",
"from_value": 201,
"parentfield": "conditions",
"shipping_amount": 0.0
}
],
"territories": [
{
"doctype": "Applicable Territory",
"parentfield": "territories",
"territory": "_Test Territory India"
}
],
"countries": [
{"country": "India"}
]
},
},
{
"account": "_Test Account Shipping Charges - _TC",
"calculate_based_on": "Net Total",
"company": "_Test Company",
"cost_center": "_Test Cost Center - _TC",
"doctype": "Shipping Rule",
"label": "_Test Shipping Rule - Rest of the World",
"name": "_Test Shipping Rule - Rest of the World",
"account": "_Test Account Shipping Charges - _TC",
"calculate_based_on": "Net Total",
"company": "_Test Company",
"cost_center": "_Test Cost Center - _TC",
"doctype": "Shipping Rule",
"label": "_Test Shipping Rule - Rest of the World",
"name": "_Test Shipping Rule - Rest of the World",
"conditions": [
{
"doctype": "Shipping Rule Condition",
"from_value": 0,
"parentfield": "conditions",
"shipping_amount": 500.0,
"doctype": "Shipping Rule Condition",
"from_value": 0,
"parentfield": "conditions",
"shipping_amount": 500.0,
"to_value": 1000
},
},
{
"doctype": "Shipping Rule Condition",
"from_value": 1001,
"parentfield": "conditions",
"shipping_amount": 1000.0,
"doctype": "Shipping Rule Condition",
"from_value": 1001,
"parentfield": "conditions",
"shipping_amount": 1000.0,
"to_value": 2000
},
},
{
"doctype": "Shipping Rule Condition",
"from_value": 2001,
"parentfield": "conditions",
"doctype": "Shipping Rule Condition",
"from_value": 2001,
"parentfield": "conditions",
"shipping_amount": 1500.0
}
],
"territories": [
{
"doctype": "Applicable Territory",
"parentfield": "territories",
"territory": "_Test Territory Rest Of The World"
}
]
],
"worldwide_shipping": 1
}
]
]

View File

@@ -1,40 +1,92 @@
{
"creation": "2013-06-25 11:54:50.000000",
"allow_copy": 0,
"allow_import": 0,
"allow_rename": 0,
"creation": "2013-06-25 11:54:50",
"custom": 0,
"description": "A condition for a Shipping Rule",
"docstatus": 0,
"doctype": "DocType",
"fields": [
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "from_value",
"fieldtype": "Float",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "From Value",
"no_copy": 0,
"permlevel": 0,
"reqd": 1
"print_hide": 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": "to_value",
"fieldtype": "Float",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "To Value",
"no_copy": 0,
"permlevel": 0,
"reqd": 0
"print_hide": 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": "shipping_amount",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Shipping Amount",
"no_copy": 0,
"options": "Company:company:default_currency",
"permlevel": 0,
"reqd": 1
"print_hide": 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": 1,
"in_create": 0,
"in_dialog": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 1,
"modified": "2013-12-20 19:21:46.000000",
"modified": "2015-10-02 07:39:12.974539",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Shipping Rule Condition",
"owner": "Administrator"
"owner": "Administrator",
"permissions": [],
"read_only": 0,
"read_only_onload": 0
}

View File

@@ -0,0 +1,53 @@
{
"allow_copy": 0,
"allow_import": 0,
"allow_rename": 0,
"creation": "2015-09-17 06:43:22.767534",
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"document_type": "Other",
"fields": [
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "country",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Country",
"no_copy": 0,
"options": "Country",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0
}
],
"hide_heading": 0,
"hide_toolbar": 0,
"in_create": 0,
"in_dialog": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 1,
"modified": "2015-10-02 07:39:13.035775",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Shipping Rule Country",
"name_case": "",
"owner": "Administrator",
"permissions": [],
"read_only": 0,
"read_only_onload": 0,
"sort_field": "modified",
"sort_order": "DESC"
}

View File

@@ -1,12 +1,10 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
# -*- 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 ApplicableTerritory(Document):
pass
class ShippingRuleCountry(Document):
pass

View File

@@ -0,0 +1,60 @@
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt
cur_frm.add_fetch("customer", "customer_group", "customer_group" );
cur_frm.add_fetch("supplier", "supplier_type", "supplier_type" );
cur_frm.toggle_reqd("sales_tax_template", cur_frm.doc.tax_type=="Sales");
cur_frm.toggle_reqd("purchase_tax_template", cur_frm.doc.tax_type=="Purchase");
frappe.ui.form.on("Tax Rule", "onload", function(frm) {
if(frm.doc.__islocal){
frm.set_value("use_for_shopping_cart", 1);
}
})
frappe.ui.form.on("Tax Rule", "use_for_shopping_cart", function(frm) {
if(!frm.doc.use_for_shopping_cart && (frappe.get_list("Tax Rule", {"use_for_shopping_cart":1}).length == 0)){
frappe.model.get_value("Shopping Cart Settings", "Shopping Cart Settings", "enabled", function(docfield) {
if(docfield.enabled){
frm.set_value("use_for_shopping_cart", 1);
frappe.throw(__("Shopping Cart is enabled"));
}
});
}
})
frappe.ui.form.on("Tax Rule", "customer", function(frm) {
frappe.call({
method:"erpnext.accounts.doctype.tax_rule.tax_rule.get_party_details",
args: {
"party": frm.doc.customer,
"party_type": "customer"
},
callback: function(r) {
if(!r.exc) {
$.each(r.message, function(k, v) {
frm.set_value(k, v);
});
}
}
});
});
frappe.ui.form.on("Tax Rule", "supplier", function(frm) {
frappe.call({
method:"erpnext.accounts.doctype.tax_rule.tax_rule.get_party_details",
args: {
"party": frm.doc.supplier,
"party_type": "supplier"
},
callback: function(r) {
if(!r.exc) {
$.each(r.message, function(k, v) {
frm.set_value(k, v);
});
}
}
});
});

View File

@@ -0,0 +1,615 @@
{
"allow_copy": 0,
"allow_import": 1,
"allow_rename": 0,
"autoname": "TR.####",
"creation": "2015-08-07 02:33:52.670866",
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"document_type": "Setup",
"fields": [
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"default": "Sales",
"fieldname": "tax_type",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Tax Type",
"no_copy": 0,
"options": "Sales\nPurchase",
"permlevel": 0,
"precision": "",
"print_hide": 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": "use_for_shopping_cart",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Use for Shopping Cart",
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 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_1",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 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.tax_type==\"Sales\"",
"fieldname": "sales_tax_template",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Sales Tax Template",
"no_copy": 0,
"options": "Sales Taxes and Charges Template",
"permlevel": 0,
"precision": "",
"print_hide": 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.tax_type==\"Purchase\"",
"fieldname": "purchase_tax_template",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Purchase Tax Template",
"no_copy": 0,
"options": "Purchase Taxes and Charges Template",
"permlevel": 0,
"precision": "",
"print_hide": 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": "filters",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Filters",
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 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.tax_type==\"Sales\"",
"fieldname": "customer",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Customer",
"no_copy": 0,
"options": "Customer",
"permlevel": 0,
"precision": "",
"print_hide": 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.tax_type==\"Purchase\"",
"fieldname": "supplier",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Supplier",
"no_copy": 0,
"options": "Supplier",
"permlevel": 0,
"precision": "",
"print_hide": 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": "billing_city",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Billing City",
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 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": "billing_state",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Billing State",
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 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": "billing_country",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Billing Country",
"no_copy": 0,
"options": "Country",
"permlevel": 0,
"precision": "",
"print_hide": 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_2",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 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.tax_type==\"Sales\"",
"fieldname": "customer_group",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Customer Group",
"no_copy": 0,
"options": "Customer Group",
"permlevel": 0,
"precision": "",
"print_hide": 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.tax_type==\"Purchase\"",
"fieldname": "supplier_type",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Supplier Type",
"no_copy": 0,
"options": "Supplier Type",
"permlevel": 0,
"precision": "",
"print_hide": 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": "shipping_city",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Shipping City",
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 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": "shipping_state",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Shipping State",
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 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": "shipping_country",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Shipping Country",
"no_copy": 0,
"options": "Country",
"permlevel": 0,
"precision": "",
"print_hide": 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": "section_break_4",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Validity",
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 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": "from_date",
"fieldtype": "Date",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "From Date",
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 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_7",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 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": "to_date",
"fieldtype": "Date",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "To Date",
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 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": "section_break_6",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 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": "1",
"fieldname": "priority",
"fieldtype": "Int",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Priority",
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 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_20",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 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": "company",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Company",
"no_copy": 0,
"options": "Company",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
}
],
"hide_heading": 0,
"hide_toolbar": 0,
"in_create": 0,
"in_dialog": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 0,
"modified": "2015-10-02 07:39:16.298546",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Tax Rule",
"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 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,132 @@
# -*- 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 cstr
class IncorrectCustomerGroup(frappe.ValidationError): pass
class IncorrectSupplierType(frappe.ValidationError): pass
class ConflictingTaxRule(frappe.ValidationError): pass
class TaxRule(Document):
def __setup__(self):
self.flags.ignore_these_exceptions_in_test = [ConflictingTaxRule]
def validate(self):
self.validate_tax_template()
self.validate_date()
self.validate_filters()
def validate_tax_template(self):
if self.tax_type== "Sales":
self.purchase_tax_template = self.supplier = self.supplier_type= None
if self.customer:
self.customer_group = None
else:
self.sales_tax_template= self.customer = self.customer_group= None
if self.supplier:
self.supplier_type = None
if not (self.sales_tax_template or self.purchase_tax_template):
frappe.throw(_("Tax Template is mandatory."))
def validate_date(self):
if self.from_date and self.to_date and self.from_date > self.to_date:
frappe.throw(_("From Date cannot be greater than To Date"))
def validate_filters(self):
filters = {
"tax_type": self.tax_type,
"customer": self.customer,
"customer_group": self.customer_group,
"supplier": self.supplier,
"supplier_type": self.supplier_type,
"billing_city": self.billing_city,
"billing_state": self.billing_state,
"billing_country": self.billing_country,
"shipping_city": self.shipping_city,
"shipping_state": self.shipping_state,
"shipping_country": self.shipping_country,
"company": self.company
}
conds=""
for d in filters:
if conds:
conds += " and "
conds += """ifnull({0}, '') = '{1}'""".format(d, frappe.db.escape(cstr(filters[d])))
if self.from_date and self.to_date:
conds += """ and ((from_date > '{from_date}' and from_date < '{to_date}') or
(to_date > '{from_date}' and to_date < '{to_date}') or
('{from_date}' > from_date and '{from_date}' < to_date) or
('{from_date}' = from_date and '{to_date}' = to_date))""".format(from_date=self.from_date, to_date=self.to_date)
elif self.from_date and not self.to_date:
conds += """ and to_date > '{from_date}'""".format(from_date = self.from_date)
elif self.to_date and not self.from_date:
conds += """ and from_date < '{to_date}'""".format(to_date = self.to_date)
tax_rule = frappe.db.sql("select name, priority \
from `tabTax Rule` where {0} and name != '{1}'".format(conds, self.name), as_dict=1)
if tax_rule:
if tax_rule[0].priority == self.priority:
frappe.throw(_("Tax Rule Conflicts with {0}".format(tax_rule[0].name)), ConflictingTaxRule)
@frappe.whitelist()
def get_party_details(party, party_type, args=None):
out = {}
if args:
billing_filters= {"name": args.get("billing_address")}
shipping_filters= {"name": args.get("shipping_address")}
else:
billing_filters= {party_type: party, "is_primary_address": 1}
shipping_filters= {party_type:party, "is_shipping_address": 1}
billing_address= frappe.get_all("Address", fields=["city", "state", "country"], filters= billing_filters)
shipping_address= frappe.get_all("Address", fields=["city", "state", "country"], filters= shipping_filters)
if billing_address:
out["billing_city"]= billing_address[0].city
out["billing_state"]= billing_address[0].state
out["billing_country"]= billing_address[0].country
if shipping_address:
out["shipping_city"]= shipping_address[0].city
out["shipping_state"]= shipping_address[0].state
out["shipping_country"]= shipping_address[0].country
return out
def get_tax_template(posting_date, args):
"""Get matching tax rule"""
args = frappe._dict(args)
conditions = []
for key, value in args.iteritems():
if key in "use_for_shopping_cart":
conditions.append("use_for_shopping_cart = {0}".format(1 if value else 0))
else:
conditions.append("ifnull({0}, '') in ('', '{1}')".format(key, frappe.db.escape(cstr(value))))
matching = frappe.db.sql("""select * from `tabTax Rule`
where {0}""".format(" and ".join(conditions)), as_dict = True)
if not matching:
return None
for rule in matching:
rule.no_of_keys_matched = 0
for key in args:
if rule.get(key): rule.no_of_keys_matched += 1
rule = sorted(matching, lambda b, a: cmp(a.no_of_keys_matched, b.no_of_keys_matched) or cmp(a.priority, b.priority))[0]
return rule.sales_tax_template or rule.purchase_tax_template

View File

@@ -0,0 +1,28 @@
[
{
"doctype": "Tax Rule",
"tax_type" : "Sales",
"sales_tax_template": "_Test Tax 1",
"use_for_shopping_cart": 1,
"billing_city": "_Test City",
"billing_state": "Test State",
"billing_country": "India",
"shipping_city": "_Test City",
"shipping_country": "India",
"priority": 1,
"company": "_Test Company"
},
{
"doctype": "Tax Rule",
"tax_type" : "Sales",
"sales_tax_template": "_Test Tax 2",
"use_for_shopping_cart": 0,
"billing_city": "_Test City",
"billing_country": "India",
"shipping_city": "_Test City",
"shipping_state": "Test State",
"shipping_country": "India",
"priority": 2,
"company": "_Test Company"
}
]

View File

@@ -0,0 +1,130 @@
# -*- 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.accounts.doctype.tax_rule.tax_rule import IncorrectCustomerGroup, IncorrectSupplierType, ConflictingTaxRule, get_tax_template
test_records = frappe.get_test_records('Tax Rule')
class TestTaxRule(unittest.TestCase):
def setUp(self):
frappe.db.sql("delete from `tabTax Rule` where use_for_shopping_cart <> 1")
def test_conflict(self):
tax_rule1 = make_tax_rule(customer= "_Test Customer",
sales_tax_template = "_Test Sales Taxes and Charges Template", priority = 1)
tax_rule1.save()
tax_rule2 = make_tax_rule(customer= "_Test Customer",
sales_tax_template = "_Test Sales Taxes and Charges Template", priority = 1)
self.assertRaises(ConflictingTaxRule, tax_rule2.save)
def test_conflict_with_non_overlapping_dates(self):
tax_rule1 = make_tax_rule(customer= "_Test Customer",
sales_tax_template = "_Test Sales Taxes and Charges Template", priority = 1, from_date = "2015-01-01")
tax_rule1.save()
tax_rule2 = make_tax_rule(customer= "_Test Customer",
sales_tax_template = "_Test Sales Taxes and Charges Template", priority = 1, to_date = "2013-01-01")
tax_rule2.save()
self.assertTrue(tax_rule2.name)
def test_conflict_with_overlapping_dates(self):
tax_rule1 = make_tax_rule(customer= "_Test Customer",
sales_tax_template = "_Test Sales Taxes and Charges Template", priority = 1, from_date = "2015-01-01", to_date = "2015-01-05")
tax_rule1.save()
tax_rule2 = make_tax_rule(customer= "_Test Customer",
sales_tax_template = "_Test Sales Taxes and Charges Template", priority = 1, from_date = "2015-01-03", to_date = "2015-01-09")
self.assertRaises(ConflictingTaxRule, tax_rule2.save)
def test_tax_template(self):
tax_rule = make_tax_rule()
self.assertEquals(tax_rule.purchase_tax_template, None)
def test_select_tax_rule_based_on_customer(self):
make_tax_rule(customer= "_Test Customer",
sales_tax_template = "_Test Sales Taxes and Charges Template", save=1)
make_tax_rule(customer= "_Test Customer 1",
sales_tax_template = "_Test Sales Taxes and Charges Template 1", save=1)
make_tax_rule(customer= "_Test Customer 2",
sales_tax_template = "_Test Sales Taxes and Charges Template 2", save=1)
self.assertEquals(get_tax_template("2015-01-01", {"customer":"_Test Customer 2"}),
"_Test Sales Taxes and Charges Template 2")
def test_select_tax_rule_based_on_better_match(self):
make_tax_rule(customer= "_Test Customer", billing_city = "Test City", billing_state = "Test State",
sales_tax_template = "_Test Sales Taxes and Charges Template", save=1)
make_tax_rule(customer= "_Test Customer", billing_city = "Test City1", billing_state = "Test State",
sales_tax_template = "_Test Sales Taxes and Charges Template 1", save=1)
self.assertEquals(get_tax_template("2015-01-01", {"customer":"_Test Customer", "billing_city": "Test City", "billing_state": "Test State"}),
"_Test Sales Taxes and Charges Template")
def test_select_tax_rule_based_on_state_match(self):
make_tax_rule(customer= "_Test Customer", shipping_state = "Test State",
sales_tax_template = "_Test Sales Taxes and Charges Template", save=1)
make_tax_rule(customer= "_Test Customer", shipping_state = "Test State12",
sales_tax_template = "_Test Sales Taxes and Charges Template 1", priority=2, save=1)
self.assertEquals(get_tax_template("2015-01-01", {"customer":"_Test Customer", "shipping_state": "Test State"}),
"_Test Sales Taxes and Charges Template")
def test_select_tax_rule_based_on_better_priority(self):
make_tax_rule(customer= "_Test Customer", billing_city = "Test City",
sales_tax_template = "_Test Sales Taxes and Charges Template", priority=1, save=1)
make_tax_rule(customer= "_Test Customer", billing_city = "Test City",
sales_tax_template = "_Test Sales Taxes and Charges Template 1", priority=2, save=1)
self.assertEquals(get_tax_template("2015-01-01", {"customer":"_Test Customer", "billing_city": "Test City"}),
"_Test Sales Taxes and Charges Template 1")
def test_select_tax_rule_based_cross_matching_keys(self):
make_tax_rule(customer= "_Test Customer", billing_city = "Test City",
sales_tax_template = "_Test Sales Taxes and Charges Template", save=1)
make_tax_rule(customer= "_Test Customer 1", billing_city = "Test City 1",
sales_tax_template = "_Test Sales Taxes and Charges Template 1", save=1)
self.assertEquals(get_tax_template("2015-01-01", {"customer":"_Test Customer", "billing_city": "Test City 1"}),
None)
def test_select_tax_rule_based_cross_partially_keys(self):
make_tax_rule(customer= "_Test Customer", billing_city = "Test City",
sales_tax_template = "_Test Sales Taxes and Charges Template", save=1)
make_tax_rule(billing_city = "Test City 1",
sales_tax_template = "_Test Sales Taxes and Charges Template 1", save=1)
self.assertEquals(get_tax_template("2015-01-01", {"customer":"_Test Customer", "billing_city": "Test City 1"}),
"_Test Sales Taxes and Charges Template 1")
def make_tax_rule(**args):
args = frappe._dict(args)
tax_rule = frappe.new_doc("Tax Rule")
for key, val in args.iteritems():
if key != "save":
tax_rule.set(key, val)
tax_rule.company = args.company or "_Test Company"
if args.save:
tax_rule.insert()
return tax_rule

View File

@@ -11,8 +11,7 @@ from erpnext.accounts.utils import validate_expense_against_budget
class StockAccountInvalidTransaction(frappe.ValidationError): pass
def make_gl_entries(gl_map, cancel=False, adv_adj=False, merge_entries=True,
update_outstanding='Yes'):
def make_gl_entries(gl_map, cancel=False, adv_adj=False, merge_entries=True, update_outstanding='Yes'):
if gl_map:
if not cancel:
gl_map = process_gl_map(gl_map, merge_entries)
@@ -28,14 +27,25 @@ def process_gl_map(gl_map, merge_entries=True):
gl_map = merge_similar_entries(gl_map)
for entry in gl_map:
# toggle debit, credit if negative entry
# toggle debit, credit if negative entry
if flt(entry.debit) < 0:
entry.credit = flt(entry.credit) - flt(entry.debit)
entry.debit = 0.0
if flt(entry.debit_in_account_currency) < 0:
entry.credit_in_account_currency = \
flt(entry.credit_in_account_currency) - flt(entry.debit_in_account_currency)
entry.debit_in_account_currency = 0.0
if flt(entry.credit) < 0:
entry.debit = flt(entry.debit) - flt(entry.credit)
entry.credit = 0.0
if flt(entry.credit_in_account_currency) < 0:
entry.debit_in_account_currency = \
flt(entry.debit_in_account_currency) - flt(entry.credit_in_account_currency)
entry.credit_in_account_currency = 0.0
return gl_map
def merge_similar_entries(gl_map):
@@ -46,12 +56,16 @@ def merge_similar_entries(gl_map):
same_head = check_if_in_list(entry, merged_gl_map)
if same_head:
same_head.debit = flt(same_head.debit) + flt(entry.debit)
same_head.debit_in_account_currency = \
flt(same_head.debit_in_account_currency) + flt(entry.debit_in_account_currency)
same_head.credit = flt(same_head.credit) + flt(entry.credit)
same_head.credit_in_account_currency = \
flt(same_head.credit_in_account_currency) + flt(entry.credit_in_account_currency)
else:
merged_gl_map.append(entry)
# filter zero debit and credit entries
merged_gl_map = filter(lambda x: flt(x.debit)!=0 or flt(x.credit)!=0, merged_gl_map)
merged_gl_map = filter(lambda x: flt(x.debit, 9)!=0 or flt(x.credit, 9)!=0, merged_gl_map)
return merged_gl_map
def check_if_in_list(gle, gl_map):

View File

@@ -42,13 +42,13 @@ frappe.pages["Accounts Browser"].on_page_load = function(wrapper){
wrapper.page.add_menu_item(__('New Company'), function() { newdoc('Company'); }, true);
}
wrapper.page.set_secondary_action(__('Refresh'), function() {
wrapper.page.add_menu_item(__('Refresh'), function() {
wrapper.$company_select.change();
});
wrapper.page.set_primary_action(__('New'), function() {
erpnext.account_chart && erpnext.account_chart.make_new();
});
}, "octicon octicon-plus");
// company-select
wrapper.$company_select = wrapper.page.add_select("Company", [])
@@ -121,7 +121,8 @@ erpnext.AccountsChart = Class.extend({
label: __("Add Child"),
click: function() {
me.make_new()
}
},
btnClass: "hidden-xs"
},
{
condition: function(node) {
@@ -137,8 +138,8 @@ erpnext.AccountsChart = Class.extend({
"company": me.company
};
frappe.set_route("query-report", "General Ledger");
}
},
btnClass: "hidden-xs"
},
{
condition: function(node) { return !node.root && me.can_write },
@@ -147,7 +148,8 @@ erpnext.AccountsChart = Class.extend({
frappe.model.rename_doc(me.ctype, node.label, function(new_name) {
node.reload();
});
}
},
btnClass: "hidden-xs"
},
{
condition: function(node) { return !node.root && me.can_delete },
@@ -156,14 +158,15 @@ erpnext.AccountsChart = Class.extend({
frappe.model.delete_doc(me.ctype, node.label, function() {
node.parent.remove();
});
}
},
btnClass: "hidden-xs"
}
],
onrender: function(node) {
var dr_or_cr = node.data.balance < 0 ? "Cr" : "Dr";
if (me.ctype == 'Account' && node.data && node.data.balance!==undefined) {
$('<span class="balance-area pull-right text-muted small">'
+ format_currency(Math.abs(node.data.balance), node.data.currency)
+ format_currency(Math.abs(node.data.balance), node.data.account_currency)
+ " " + dr_or_cr
+ '</span>').insertBefore(node.$ul);
}
@@ -202,7 +205,7 @@ erpnext.AccountsChart = Class.extend({
title:__('New Account'),
fields: [
{fieldtype:'Data', fieldname:'account_name', label:__('New Account Name'), reqd:true,
description: __("Name of new Account. Note: Please don't create accounts for Customers and Suppliers, they are created automatically from the Customer and Supplier master")},
description: __("Name of new Account. Note: Please don't create accounts for Customers and Suppliers")},
{fieldtype:'Check', fieldname:'is_group', label:__('Is Group'),
description: __('Further accounts can be made under Groups, but entries can be made against non-Groups')},
{fieldtype:'Select', fieldname:'account_type', label:__('Account Type'),
@@ -211,7 +214,8 @@ erpnext.AccountsChart = Class.extend({
'Income Account', 'Tax', 'Chargeable', 'Temporary'].join('\n'),
description: __("Optional. This setting will be used to filter in various transactions.") },
{fieldtype:'Float', fieldname:'tax_rate', label:__('Tax Rate')},
{fieldtype:'Link', fieldname:'warehouse', label:__('Warehouse'), options:"Warehouse"}
{fieldtype:'Link', fieldname:'warehouse', label:__('Warehouse'), options:"Warehouse"},
{fieldtype:'Link', fieldname:'account_currency', label:__('Currency'), options:"Currency"}
]
})

View File

@@ -21,8 +21,7 @@ def get_children():
# root
if args['parent'] in ("Accounts", "Cost Centers"):
select_cond = ", root_type, report_type" if args["parent"]=="Accounts" else ""
select_cond = ", root_type, report_type, account_currency" if ctype=="Account" else ""
acc = frappe.db.sql(""" select
name as value, is_group as expandable %s
from `tab%s`
@@ -35,19 +34,17 @@ def get_children():
sort_root_accounts(acc)
else:
# other
select_cond = ", account_currency" if ctype=="Account" else ""
acc = frappe.db.sql("""select
name as value, is_group as expandable
name as value, is_group as expandable %s
from `tab%s`
where ifnull(parent_%s,'') = %s
and docstatus<2
order by name""" % (ctype, ctype.lower().replace(' ','_'), '%s'),
order by name""" % (select_cond, ctype, ctype.lower().replace(' ','_'), '%s'),
args['parent'], as_dict=1)
if ctype == 'Account':
currency = frappe.db.sql("select default_currency from `tabCompany` where name = %s", company)[0][0]
for each in acc:
bal = get_balance_on(each.get("value"))
each["currency"] = currency
each["balance"] = flt(bal)
each["balance"] = flt(get_balance_on(each.get("value")))
return acc

View File

@@ -4,11 +4,15 @@
from __future__ import unicode_literals
import frappe
import datetime
from frappe import _, msgprint, scrub
from frappe.defaults import get_user_permissions
from frappe.utils import add_days, getdate, formatdate, flt
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
class DuplicatePartyAccountError(frappe.ValidationError): pass
@frappe.whitelist()
def get_party_details(party=None, account=None, party_type="Customer", company=None,
@@ -16,7 +20,7 @@ def get_party_details(party=None, account=None, party_type="Customer", company=N
if not party:
return {}
if not frappe.db.exists(party_type, party):
frappe.throw(_("{0}: {1} does not exists").format(party_type, party))
@@ -25,7 +29,7 @@ def get_party_details(party=None, account=None, party_type="Customer", company=N
def _get_party_details(party=None, account=None, party_type="Customer", company=None,
posting_date=None, price_list=None, currency=None, doctype=None, ignore_permissions=False):
out = frappe._dict(set_account_and_due_date(party, account, party_type, company, posting_date, doctype))
party = out[party_type.lower()]
@@ -39,6 +43,7 @@ def _get_party_details(party=None, account=None, party_type="Customer", company=
set_contact_details(out, party, party_type)
set_other_values(out, party, party_type)
set_price_list(out, party, party_type, price_list)
out["taxes_and_charges"] = set_taxes(party.name, party_type, posting_date, company, out.customer_group, out.supplier_type)
if not out.get("currency"):
out["currency"] = currency
@@ -47,8 +52,7 @@ def _get_party_details(party=None, account=None, party_type="Customer", company=
if party_type=="Customer":
out["sales_team"] = [{
"sales_person": d.sales_person,
"sales_designation": d.sales_designation,
"allocated_percentage": d.allocated_percentage
"allocated_percentage": d.allocated_percentage or None
} for d in party.get("sales_team")]
return out
@@ -73,9 +77,17 @@ def set_contact_details(out, party, party_type):
{party_type.lower(): party.name, "is_primary_contact":1}, "name")
if not out.contact_person:
return
out.update(get_contact_details(out.contact_person))
out.update({
"contact_person": None,
"contact_display": None,
"contact_email": None,
"contact_mobile": None,
"contact_phone": None,
"contact_designation": None,
"contact_department": None
})
else:
out.update(get_contact_details(out.contact_person))
def set_other_values(out, party, party_type):
# copy
@@ -87,11 +99,24 @@ def set_other_values(out, party, party_type):
out[f] = party.get(f)
# fields prepended with default in Customer doctype
for f in ['currency', 'taxes_and_charges'] \
for f in ['currency'] \
+ (['sales_partner', 'commission_rate'] if party_type=="Customer" else []):
if party.get("default_" + f):
out[f] = party.get("default_" + f)
def get_default_price_list(party):
"""Return default price list for party (Document object)"""
if party.default_price_list:
return party.default_price_list
if party.doctype == "Customer":
price_list = frappe.db.get_value("Customer Group",
party.customer_group, "default_price_list")
if price_list:
return price_list
return None
def set_price_list(out, party, party_type, given_price_list):
# price list
price_list = filter(None, get_user_permissions().get("Price List", []))
@@ -99,11 +124,7 @@ def set_price_list(out, party, party_type, given_price_list):
price_list = price_list[0] if len(price_list)==1 else None
if not price_list:
price_list = party.default_price_list
if not price_list and party_type=="Customer":
price_list = frappe.db.get_value("Customer Group",
party.customer_group, "default_price_list")
price_list = get_default_price_list(party)
if not price_list:
price_list = given_price_list
@@ -122,7 +143,7 @@ def set_account_and_due_date(party, account, party_type, company, posting_date,
}
if party:
account = get_party_account(company, party, party_type)
account = get_party_account(party_type, party, company)
account_fieldname = "debit_to" if party_type=="Customer" else "credit_to"
@@ -133,14 +154,21 @@ def set_account_and_due_date(party, account, party_type, company, posting_date,
}
return out
def get_company_currency():
company_currency = frappe._dict()
for d in frappe.get_all("Company", fields=["name", "default_currency"]):
company_currency.setdefault(d.name, d.default_currency)
return company_currency
@frappe.whitelist()
def get_party_account(company, party, party_type):
def get_party_account(party_type, party, company):
"""Returns the account for the given `party`.
Will first search in party (Customer / Supplier) record, if not found,
will search in group (Customer Group / Supplier Type),
finally will return default."""
if not company:
frappe.throw(_("Please select company first."))
frappe.throw(_("Please select a Company"))
if party:
account = frappe.db.get_value("Party Account",
@@ -158,43 +186,129 @@ def get_party_account(company, party, party_type):
return account
def get_party_account_currency(party_type, party, company):
def generator():
party_account = get_party_account(party_type, party, company)
return frappe.db.get_value("Account", party_account, "account_currency")
return frappe.local_cache("party_account_currency", (party_type, party, company), generator)
def get_party_gle_currency(party_type, party, company):
def generator():
existing_gle_currency = frappe.db.sql("""select account_currency from `tabGL Entry`
where docstatus=1 and company=%(company)s and party_type=%(party_type)s and party=%(party)s
limit 1""", { "company": company, "party_type": party_type, "party": party })
return existing_gle_currency[0][0] if existing_gle_currency else None
return frappe.local_cache("party_gle_currency", (party_type, party, company), generator,
regenerate_if_none=True)
def validate_party_gle_currency(party_type, party, company, party_account_currency=None):
"""Validate party account currency with existing GL Entry's currency"""
if not party_account_currency:
party_account_currency = get_party_account_currency(party_type, party, company)
existing_gle_currency = get_party_gle_currency(party_type, party, company)
if existing_gle_currency and party_account_currency != existing_gle_currency:
frappe.throw(_("Accounting Entry for {0}: {1} can only be made in currency: {2}")
.format(party_type, party, existing_gle_currency), InvalidAccountCurrency)
def validate_party_accounts(doc):
companies = []
for account in doc.get("accounts"):
if account.company in companies:
frappe.throw(_("There can only be 1 Account per Company in {0} {1}")
.format(doc.doctype, doc.name), DuplicatePartyAccountError)
else:
companies.append(account.company)
party_account_currency = frappe.db.get_value("Account", account.account, "account_currency")
existing_gle_currency = get_party_gle_currency(doc.doctype, doc.name, account.company)
if existing_gle_currency and party_account_currency != existing_gle_currency:
frappe.throw(_("Accounting entries have already been made in currency {0} for company {1}. Please select a receivable or payable account with currency {0}.").format(existing_gle_currency, account.company))
@frappe.whitelist()
def get_due_date(posting_date, party_type, party, company):
"""Set Due Date = Posting Date + Credit Days"""
due_date = None
if posting_date:
credit_days = get_credit_days(party_type, party, company)
due_date = add_days(posting_date, credit_days) if credit_days else posting_date
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)
return due_date
def get_credit_days(party_type, party, company):
if not party:
return None
if party_type and party:
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"])
party_group_doctype = "Customer Group" if party_type=="Customer" else "Supplier Type"
credit_days, party_group = frappe.db.get_value(party_type, party, ["credit_days", frappe.scrub(party_group_doctype)])
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"])
if not credit_days:
credit_days = frappe.db.get_value(party_group_doctype, party_group, "credit_days") or \
frappe.db.get_value("Company", company, "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")
return credit_days
return credit_days
def validate_due_date(posting_date, due_date, party_type, party, company):
credit_days = get_credit_days(party_type, party, company)
posting_date, due_date = getdate(posting_date), getdate(due_date)
diff = (due_date - posting_date).days
if diff < 0:
if getdate(due_date) < getdate(posting_date):
frappe.throw(_("Due Date cannot be before Posting Date"))
elif credit_days is not None and diff > flt(credit_days):
is_credit_controller = frappe.db.get_value("Accounts Settings", None,
"credit_controller") in frappe.get_roles()
else:
default_due_date = get_due_date(posting_date, party_type, party, company)
if not default_due_date:
return
if is_credit_controller:
msgprint(_("Note: Due / Reference Date exceeds allowed customer credit days by {0} day(s)")
.format(diff - flt(credit_days)))
else:
max_due_date = formatdate(add_days(posting_date, credit_days))
frappe.throw(_("Due / Reference Date cannot be after {0}").format(max_due_date))
if default_due_date != posting_date and getdate(due_date) > getdate(default_due_date):
is_credit_controller = frappe.db.get_single_value("Accounts Settings", "credit_controller") in frappe.get_roles()
if is_credit_controller:
msgprint(_("Note: Due / Reference Date exceeds allowed customer credit days by {0} day(s)")
.format(date_diff(due_date, default_due_date)))
else:
frappe.throw(_("Due / Reference Date cannot be after {0}").format(formatdate(default_due_date)))
@frappe.whitelist()
def set_taxes(party, party_type, posting_date, company, customer_group=None, supplier_type=None,
billing_address=None, shipping_address=None, use_for_shopping_cart=None):
from erpnext.accounts.doctype.tax_rule.tax_rule import get_tax_template, get_party_details
args = {
party_type.lower(): party,
"customer_group": customer_group,
"supplier_type": supplier_type,
"company": company
}
if billing_address or shipping_address:
args.update(get_party_details(party, party_type, {"billing_address": billing_address, \
"shipping_address": shipping_address }))
else:
args.update(get_party_details(party, party_type))
if party_type=="Customer":
args.update({"tax_type": "Sales"})
else:
args.update({"tax_type": "Purchase"})
if use_for_shopping_cart:
args.update({"use_for_shopping_cart": use_for_shopping_cart})
return get_tax_template(posting_date, args)

View File

@@ -1,19 +1,19 @@
{
"creation": "2014-08-28 11:11:39.796473",
"disabled": 0,
"doc_type": "Journal Entry",
"docstatus": 0,
"doctype": "Print Format",
"html": "{%- from \"templates/print_formats/standard_macros.html\" import add_header -%}\n\n<div class=\"page-break\">\n {%- if not doc.get(\"print_heading\") and not doc.get(\"select_print_heading\") \n and doc.set(\"select_print_heading\", _(\"Credit Note\")) -%}{%- endif -%}\n {{ add_header(0, 1, doc, letter_head, no_letterhead) }}\n\n {%- for label, value in (\n (_(\"Credit To\"), doc.pay_to_recd_from),\n (_(\"Date\"), frappe.utils.formatdate(doc.voucher_date)),\n (_(\"Amount\"), \"<strong>\" + doc.get_formatted(\"total_amount\") + \"</strong><br>\" + (doc.total_amount_in_words or \"\") + \"<br>\"),\n (_(\"Remarks\"), doc.remark)\n ) -%}\n\n <div class=\"row\">\n <div class=\"col-xs-3\"><label class=\"text-right\">{{ label }}</label></div>\n <div class=\"col-xs-9\">{{ value }}</div>\n </div>\n\n {%- endfor -%}\n\n <hr>\n <br>\n <p class=\"strong\">\n {{ _(\"For\") }} {{ doc.company }},<br>\n <br>\n <br>\n <br>\n {{ _(\"Authorized Signatory\") }}\n </p>\n</div>\n\n\n",
"idx": 2,
"modified": "2015-01-12 11:02:25.716825",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Credit Note",
"owner": "Administrator",
"parent": "Journal Entry",
"parentfield": "__print_formats",
"parenttype": "DocType",
"print_format_type": "Server",
"creation": "2014-08-28 11:11:39.796473",
"custom_format": 0,
"disabled": 0,
"doc_type": "Journal Entry",
"docstatus": 0,
"doctype": "Print Format",
"html": "{%- from \"templates/print_formats/standard_macros.html\" import add_header -%}\n\n<div class=\"page-break\">\n {%- if not doc.get(\"print_heading\") and not doc.get(\"select_print_heading\") \n and doc.set(\"select_print_heading\", _(\"Credit Note\")) -%}{%- endif -%}\n {{ add_header(0, 1, doc, letter_head, no_letterhead) }}\n\n {%- for label, value in (\n (_(\"Credit To\"), doc.pay_to_recd_from),\n (_(\"Date\"), frappe.utils.formatdate(doc.voucher_date)),\n (_(\"Amount\"), \"<strong>\" + doc.get_formatted(\"total_amount\") + \"</strong><br>\" + (doc.total_amount_in_words or \"\") + \"<br>\"),\n (_(\"Remarks\"), doc.remark)\n ) -%}\n\n <div class=\"row\">\n <div class=\"col-xs-3\"><label class=\"text-right\">{{ label }}</label></div>\n <div class=\"col-xs-9\">{{ value }}</div>\n </div>\n\n {%- endfor -%}\n\n <hr>\n <br>\n <p class=\"strong\">\n {{ _(\"For\") }} {{ doc.company }},<br>\n <br>\n <br>\n <br>\n {{ _(\"Authorized Signatory\") }}\n </p>\n</div>\n\n\n",
"idx": 2,
"modified": "2015-07-22 17:42:01.560817",
"modified_by": "Administrator",
"name": "Credit Note",
"owner": "Administrator",
"parent": "Journal Entry",
"parentfield": "__print_formats",
"parenttype": "DocType",
"print_format_type": "Server",
"standard": "Yes"
}
}

Some files were not shown because too many files have changed in this diff Show More