Compare commits

..

199 Commits

Author SHA1 Message Date
Saurabh
c3fbc04aab Merge branch 'hotfix' 2018-04-17 12:00:19 +05:30
Saurabh
5b866db6bc bumped to version 10.1.23 2018-04-17 12:30:19 +06:00
Saurabh
9fbb8192e1 [fix] do not escape % while using clause (#13677) 2018-04-17 11:56:46 +05:30
Saurabh
ea1408f2e0 [fix] enqueue salary slip print email after completing accounting entries (#13633) 2018-04-15 21:38:49 -08:00
Saurabh
f2a941b1a4 [fix] check if supplier value exists (#13616) 2018-04-15 21:37:14 -08:00
Saurabh
ca1cfd91ea Merge branch 'hotfix' 2018-04-15 12:54:49 +05:30
Saurabh
c3d43e672b bumped to version 10.1.22 2018-04-15 13:24:49 +06:00
Saurabh
e141fdcfcc Merge pull request #13661 from codingCoffee/pip10
Compatibility for pip 10
2018-04-15 12:43:28 +05:30
Ameya Shenoy
7cb8f890bc Compatibility for pip 10
- also some spaces and tabs fixes
2018-04-15 03:43:21 +05:30
Nabin Hait
d6aadef395 Merge branch 'hotfix' 2018-04-13 14:38:23 +05:30
Nabin Hait
11c899bc1f bumped to version 10.1.21 2018-04-13 15:08:22 +06:00
Nabin Hait
00efeb26f4 Email Account field added in Issue 2018-04-13 14:30:26 +05:30
rohitwaghchaure
1129ac711e [Fix] Patch (#13610) 2018-04-12 14:48:23 +05:30
rohitwaghchaure
2ea593bdd8 [Fix] POS Profile data not set in the sales invoice (#13568) 2018-04-12 13:37:08 +05:30
Ahmed Madi
02fd6f56d6 Update leave_application.py (#13575)
Make get_holidays function white listed
2018-04-12 13:31:50 +05:30
rohitwaghchaure
098b444f6f [minor] Toggle required opportunity item table based on with items field (#13584) 2018-04-12 13:26:50 +05:30
rohitwaghchaure
e72bde5159 Removed expired items from the list of POS items (#13582) 2018-04-12 13:26:11 +05:30
Nabin Hait
c10e106f8f Optimization related to large number of items (#13606) 2018-04-12 13:25:03 +05:30
rohitwaghchaure
2c111b7b14 Minor fix (#13600) 2018-04-11 02:20:06 -08:00
Nabin Hait
f92fcdbac4 Merge branch 'hotfix' 2018-04-06 15:06:09 +05:30
Nabin Hait
1ff9e0432a bumped to version 10.1.20 2018-04-06 15:36:09 +06:00
rohitwaghchaure
c0f149a3be [Fix] Delivery notification for delivery trip (#13543) 2018-04-06 14:26:26 +05:30
rohitwaghchaure
2ae6cfda5f [Fix] Item variant details report (#13545) 2018-04-06 11:49:04 +05:30
rohitwaghchaure
22d9f0a4aa [Fix] Bin not deleted on delete of an item (#13539) 2018-04-06 10:29:07 +05:30
rohitwaghchaure
aa7cddef5c Merge pull request #13511 from rohitwaghchaure/table_styling
[Fix] Width and margin for account receivable pdc print format
2018-04-04 16:34:21 +05:30
Rohit Waghchaure
3d2b3d37d4 [Fix] Width and margin for account receivable pdc print format 2018-04-04 16:01:33 +05:30
Nabin Hait
821222653b Merge branch 'hotfix' 2018-04-04 11:26:19 +05:30
Nabin Hait
adddb15380 bumped to version 10.1.19 2018-04-04 11:56:19 +06:00
Nabin Hait
5fd79f7f77 Update stock_ledger.py 2018-04-04 11:20:16 +05:30
Vishal Dhayagude
2505c74d64 Place of Supply set on save Delivery Note if Customer Address Present (#13492) 2018-04-04 11:05:21 +05:30
Rushabh Mehta
d5f9ebd008 [optimize] item queries (#13480) 2018-04-02 23:37:33 +05:30
Shreya Shah
d021e45301 exclude current doc while validating (#13450) 2018-04-02 10:43:19 +05:30
Zarrar
e9ca5e81d2 hide add_child for root node (#13444) 2018-04-02 10:40:39 +05:30
Manas Solanki
a7f5589564 fix for the update button in the sales invoice (#13435) 2018-04-02 10:32:00 +05:30
Shreya Shah
a8df73c263 typo in landed cost voucher doc (#13472) 2018-04-02 10:16:27 +05:30
rohitwaghchaure
40a5a3063c [Fix] Allow zero valuation rate if previous sle has zero valuation rate (#13432) 2018-04-02 10:14:49 +05:30
Shreya Shah
d17c24f969 set query in payment account (#13446) 2018-04-02 10:13:48 +05:30
Manas Solanki
0289ad285f fix the route filters and payment account (#13447) 2018-04-02 10:13:22 +05:30
Shreya Shah
562227db8f db escape as single quote in address causes error (#13451) 2018-04-02 10:12:37 +05:30
Achilles Rasquinha
9c1cac80fe Merge pull request #13445 from shreyashah115/typo-in-payroll
Typo in Payroll Entry
2018-04-01 10:29:16 +05:30
Gaurav Naik
03016e5000 Exploded view for BOM Stock Report (#12506)
* Multilevel BOM Stock Report prototype

* Rechristened multilevel to exploded view

* Removed trailing whitespace in line 16. Replaced spaces with tabs for indentation

* Used BOM Explosion item in query for exploded view

* Removed trailing whitespaces for Codacy compliance
2018-03-30 13:03:19 +05:30
Shreya
9240eaa0a6 typo for accrual journal entry 2018-03-30 12:19:11 +05:30
Manas Solanki
618940b5c9 Merge pull request #13433 from manassolanki/fix-pe
minor fix for the program enrollment tool
2018-03-29 16:37:54 +05:30
Manas Solanki
ccf2b7b08b minor fix for the program enrollment tool 2018-03-29 16:36:59 +05:30
Nabin Hait
1e989b35ad Merge branch 'hotfix' 2018-03-29 13:53:00 +05:30
Nabin Hait
cae2723920 bumped to version 10.1.18 2018-03-29 14:23:00 +06:00
rohitwaghchaure
badc855400 [Fix] BOM validation issue for scrap item (#13429) 2018-03-29 13:48:38 +05:30
Manas Solanki
a4502c4f6b Merge pull request #13430 from codingCoffee/child_doc_perm_fix
Permisssion fixes for child table
2018-03-29 13:27:08 +05:30
Manas Solanki
1f02c62339 Merge pull request #13431 from manassolanki/fix-22
fix the item varint details
2018-03-29 13:26:14 +05:30
Manas Solanki
ef770b593a fix the item varint details 2018-03-29 13:25:00 +05:30
Manas Solanki
a9c90c96a9 Merge pull request #13428 from frappe/manassolanki-patch-3
Update get_item_details.py
2018-03-29 13:16:40 +05:30
Ameya Shenoy
c5d222253a Permisssion fixes for child table
Related to commit 595929eb2432140a27dc262d4d78aca4ec5455c3
frappe.client.[get_list, get, get_value] when called on child table
needs parent as an argument or it throws an error by default
2018-03-29 13:16:08 +05:30
Manas Solanki
94769d81a8 Update get_item_details.py 2018-03-29 11:15:05 +05:30
rohitwaghchaure
edd63a178f Merge pull request #13418 from rohitwaghchaure/pdf_and_alignment_issue
[Fix] Alignment and date issue in PDC report
2018-03-28 17:17:37 +05:30
Rohit Waghchaure
ace68cd283 [Fix] Alignment and date issue in PDC report 2018-03-28 15:53:29 +05:30
Nabin Hait
d3bd151c30 Merge branch 'hotfix' 2018-03-28 15:51:16 +05:30
Nabin Hait
0794816527 bumped to version 10.1.17 2018-03-28 16:21:16 +06:00
Nabin Hait
7041a45294 Update fix_reserved_qty_for_sub_contract.py 2018-03-28 15:50:14 +05:30
Nabin Hait
a6746407e5 Fixed waiting qty in item dashboard data 2018-03-28 11:16:12 +05:30
Nabin Hait
e3407083fe Merge branch 'hotfix' 2018-03-28 10:40:12 +05:30
Nabin Hait
63e40b52af bumped to version 10.1.16 2018-03-28 11:10:12 +06:00
Nabin Hait
2e203e53c6 Update fix_reserved_qty_for_sub_contract.py 2018-03-28 10:38:55 +05:30
Shreya Shah
c0201877dd fixed column fieldnames for translations (#13406) 2018-03-27 18:45:42 +05:30
Nabin Hait
745292ce98 Merge branch 'hotfix' 2018-03-27 14:22:28 +05:30
Nabin Hait
00279f27f3 bumped to version 10.1.15 2018-03-27 14:52:27 +06:00
Nabin Hait
f620dae8ca Null issue fixed in gstr reports 2018-03-27 14:15:36 +05:30
Nabin Hait
9d7fe1f7cd Indicator fix for stock entry item table 2018-03-27 13:30:11 +05:30
Shreya Shah
ba4f32be5c set default warehouse instead of product bundle's warehouse for packed_items in delivery note (#13398) 2018-03-27 11:32:10 +05:30
rohitwaghchaure
85f63a3866 [Fix] Showing to bill even if per deliverd in sales order is 99.9996 (#13392) 2018-03-27 11:31:44 +05:30
Shreya Shah
149f7ee875 [Fix] General Ledger Report (#13374)
* error fix if party_type = student or shareholder

* clear party filter when party_type changes to avoid error throw

* dict with values of party_name in utils.js

* fetch party_name from erpnext.utils.get_party_name

* Update general_ledger.py
2018-03-27 11:29:25 +05:30
rohitwaghchaure
c9a1eb1081 [Fix] Not able to delete row in modal table (#13377) 2018-03-27 11:26:43 +05:30
rohitwaghchaure
2e560cb25d [Fix] Same serial no returned two times (#13378) 2018-03-27 11:24:50 +05:30
Nabin Hait
651b612909 Fixed logic for reserved qty for subcontract and production and written a patch (#13396)
* Fixed logic for reserved qty for subcontract and production and written a patch

* repost reserved qty for filtered bins
2018-03-27 11:24:20 +05:30
Manas Solanki
398eac3f4c message in the program enrollment tool (#13393) 2018-03-27 11:21:47 +05:30
Shreya Shah
f3025f1596 operation time in grid view (#13400) 2018-03-27 10:34:05 +05:30
Nabin Hait
0712013960 Merge branch 'hotfix' 2018-03-23 16:05:06 +05:30
Nabin Hait
3fdda7a9b7 bumped to version 10.1.14 2018-03-23 16:35:06 +06:00
Shreya Shah
9bcadf8126 Tax Id in some reports and print formats (#13373)
* tax-id in sales and purchase registers

* tax-id in general ledger print_format

* tax-id in accounts payable

* tax-id in accounts receivable
2018-03-23 15:04:37 +05:30
rohitwaghchaure
492de67d7b Added consumed material cost in project (#13365) 2018-03-23 15:02:04 +05:30
Nabin Hait
80a9f523d5 Minor fix AR/AP summary report 2018-03-23 13:02:27 +05:30
Nabin Hait
e3f0412570 Pass doc while autonaming item 2018-03-22 12:13:21 +05:30
rohitwaghchaure
23fa8893a8 [Fix] Division by zero issue (#13362) 2018-03-22 11:16:00 +05:30
Manas Solanki
a3714e1678 Merge pull request #13360 from frappe/manassolanki-patch-3
Update update_project_in_sle.py
2018-03-21 18:25:26 +05:30
Manas Solanki
0f6c35d63f Update update_project_in_sle.py 2018-03-21 18:24:45 +05:30
rohitwaghchaure
93779c21a7 [Fix] Project not set in the stock ledger entry (#13357) 2018-03-21 17:52:41 +05:30
Manas Solanki
e010ddf65f Student Report Card (#13346)
* finalise the assessment report

* minor fixes for button

* fix the travis and codacy
2018-03-21 17:50:42 +05:30
Zarrar
969c8aaf52 [Enhance] Fetch Customer's Item code based on Customer Name or Customer Group (#13198)
* customer code can be assigned based on customer group

* improvise customer group selection

* requested changes made
2018-03-21 11:17:49 +05:30
Manas Solanki
c711445b91 add the student as party type (#13348) 2018-03-21 10:12:27 +05:30
rohitwaghchaure
2b88ac948e [Fix] Special character issue (#13350) 2018-03-21 10:04:47 +05:30
Siddhi Sawant
c672530210 [hotfix] Added 'Paid Amount' and 'Change Amount' in POS print formats (#13316)
* Added 'Paid Amount' and 'Change Amount' in GST POS Invoice and POS Invoice print formats

* Update gst_pos_invoice.json

Updated its 'disabled' property.

* Update pos_invoice.json

Updated its 'disabled' property.

* Shows change amount only if it exists

* Updated disable property of print formats
2018-03-20 14:31:14 +05:30
Zarrar
c5b061834b doctype dropdown rectify, validate series is set (#13305) 2018-03-20 13:06:18 +05:30
Nabin Hait
8a8966ce9b minor fix 2018-03-20 11:19:57 +05:30
Achilles Rasquinha
54f3a0f7c6 Merge pull request #13333 from achillesrasquinha/hotfixes
Check Set Sales Target Item exists in User Slides
2018-03-19 22:23:11 +05:30
Achilles Rasquinha
ecc4fdd3ef Check Set Sales Target Item exists in User Slides 2018-03-19 22:21:45 +05:30
Achilles Rasquinha
60da37b502 Merge pull request #13329 from shreyashah115/travis-fix
[Fix] Travis
2018-03-19 19:10:21 +05:30
Saurabh
2777fd4332 [fix] validate minimum transaction amount in Payment Request for selected payment gateway (#13328) 2018-03-19 18:29:01 +05:30
Shreya
9602bf4ba3 patch fix 2018-03-19 18:17:54 +05:30
Shreya
5042dd32da undefined args error 2018-03-19 17:45:39 +05:30
Shreya
4d347b1ca0 travis fix 2018-03-19 17:31:19 +05:30
Achilles Rasquinha
3d85951c1f Merge pull request #13304 from achillesrasquinha/hotfix-hub
[HOTFIX] Hub Domain Change
2018-03-19 11:54:13 +05:30
Manas Solanki
7b91042ae6 Merge pull request #13310 from manassolanki/student-report-card
addition of student report card generation tool
2018-03-16 02:00:07 +05:30
Manas Solanki
633a39144d addition of student report card generation tool 2018-03-16 01:57:45 +05:30
Achilles Rasquinha
94b41ea4f6 removed debugging 2018-03-15 12:53:22 +05:30
Achilles Rasquinha
d8f7de9946 fixed patch for hub 2018-03-15 12:48:32 +05:30
Nabin Hait
b2d318ec48 Merge branch 'hotfix' 2018-03-15 12:38:41 +05:30
Nabin Hait
60200eaf0d bumped to version 10.1.13 2018-03-15 13:08:41 +06:00
Nabin Hait
1e4cfb4bf5 Fixes in setting po nos manually in sales invoice 2018-03-15 12:27:24 +05:30
Nabin Hait
70abac0061 Get territory from sales invoice 2018-03-15 12:19:16 +05:30
Nabin Hait
d7f32e492f Merge branch 'hotfix' 2018-03-14 13:33:36 +05:30
Nabin Hait
6c09297bcd bumped to version 10.1.12 2018-03-14 14:03:36 +06:00
Nabin Hait
363cedde76 Fixed minor issue 2018-03-14 13:32:14 +05:30
Nabin Hait
f5ad339cae Merge branch 'hotfix' 2018-03-13 18:13:43 +05:30
Nabin Hait
c8c733bc54 bumped to version 10.1.11 2018-03-13 18:43:42 +06:00
Shreya Shah
7acc8cb747 fix else condition (#13295) 2018-03-13 18:12:19 +05:30
Nabin Hait
9a398b4742 Merge branch 'hotfix' 2018-03-13 17:11:49 +05:30
Nabin Hait
56882033bf bumped to version 10.1.10 2018-03-13 17:41:49 +06:00
Nabin Hait
74c817e7f9 Update update_reserved_qty_for_purchase_order.py 2018-03-13 17:10:14 +05:30
Nabin Hait
d98a6d81eb Merge branch 'hotfix' 2018-03-13 16:14:02 +05:30
Nabin Hait
baac05955b bumped to version 10.1.9 2018-03-13 16:44:02 +06:00
Nabin Hait
89346967da Reverted #13259 (#13291) 2018-03-13 16:01:11 +05:30
Nabin Hait
97e890d0b3 Fix in unallocated amount calc in payment entry (#13288) 2018-03-13 15:57:34 +05:30
Ameya Shenoy
95763bc233 Purchase Order fixes (#13287)
- Reason: If Item Code was changed in Item Master, it didn't used to reflect on the 'Purchase Order Item Supplied' and 'Purchase Reciept Item Supplied'
- Data field in 'Production Order Item Supplied' and 'Production Reciept Item Supplied' converted to Link Field.
2018-03-13 15:51:56 +05:30
Nabin Hait
96f4b22589 Set po nos in DN and SI (#13290) 2018-03-13 15:46:59 +05:30
rohitwaghchaure
13460f023d [Fix] Batch value showing as item value while making batch (#13281) 2018-03-12 17:20:50 +05:30
Nabin Hait
3907eae83f Merge branch 'hotfix' 2018-03-12 15:31:03 +05:30
Nabin Hait
04f50be306 bumped to version 10.1.8 2018-03-12 16:01:03 +06:00
Ameya Shenoy
b34ab7549a fixed subject to task_name (#13278) 2018-03-12 15:24:01 +05:30
Shreya Shah
aa54d934b8 make stock qty negative (#13276) 2018-03-12 15:23:28 +05:30
Nabin Hait
2c7a6e6b43 Reserve for subcontracting (#13195)
* [fix] #8427

* review comments changes

* Validation for reserved warhouse

* code improvements

* alignment

* test case

* message changes

* default warehouse / remove validation / change sql

* fix

* patch

* Fixed merge conflict

* Fixes and cleanups of reserve qty for subcontracting

* set from_warehouse only if purchase_order and purpose found (#12398)

* [HotFix] Validation issue for subcontract stock entry (#12127)

* [Fix] Validation issue for subcontract stock entry

* Update stock_entry.py

* Fixes and cleanups of reserve qty for subcontracting

* patch fixed

* Reload bin in patch

* [fix] set source warehouse in stock entry for manufacture

* [fix] #8540

* code alignment

* code alignment

* Move target warehouse validation to submit

* validation code improvement

* code changes for single stock entry

* validation fix

* call make_rm_stock_entry

* remove old stock entry method/rewrite test case

* Don't set bom_no against raw materials while trasferring items for sub-contracting

* minor fix
2018-03-12 14:12:12 +05:30
Shreya Shah
58797481f0 uncheck report hide (#13256) 2018-03-12 13:08:01 +05:30
rohitwaghchaure
12aa4265ff Don't allow to set negative quantity if transaction is not return entry (#13255) 2018-03-12 11:20:30 +05:30
Shreya Shah
69d9f51dbb if price list not found, set default selling/ buying price list from settings (#13259) 2018-03-12 11:15:49 +05:30
Nabin Hait
3dea6589d7 Merge branch 'hotfix' 2018-03-09 16:38:51 +05:30
Nabin Hait
096d136460 bumped to version 10.1.7 2018-03-09 17:08:50 +06:00
Nabin Hait
c3889d85a1 Update shopping_cart.js 2018-03-09 16:28:25 +05:30
Nabin Hait
052333ea63 subctracting stock entry should also be considered as consumed qty 2018-03-09 14:30:32 +05:30
Shreya Shah
aadd30d194 fetch delivery date on add-row only if item_code exists (#13250) 2018-03-09 12:19:35 +05:30
Harsh Patel
22e6f8d4c2 Fixes for #13071 (#13234) 2018-03-08 16:23:59 +05:30
rohitwaghchaure
acd3479269 Bank POS transactions in bank reconciliation (#13225) 2018-03-08 16:22:39 +05:30
rohitwaghchaure
a32e57ae82 [Fix] Discount in offline POS is enabled even is it's disabled in POS Profile (#13233) 2018-03-08 16:21:13 +05:30
Ranjith Kurungadam
a3a63177a1 fix- cannot cancel consultation, remove updating age (#13226) 2018-03-08 16:20:22 +05:30
tundebabzy
1643cce479 fetch journal entry details (#13218) 2018-03-08 11:17:17 +05:30
Manas Solanki
bb42e3b411 Merge pull request #13214 from manassolanki/assessment-report-fix
minor fix for key error in assessment reports
2018-03-07 16:30:35 +05:30
Manas Solanki
586e9400b1 minor fix for key error 2018-03-07 16:28:21 +05:30
Vishal Dhayagude
668ec25d19 Allow Item variant Rename (#13161)
* [WIP] Item varient rename

* [wip] Item Variant

* [fix] Item Varient Rename

* [fix] Item Attribution Rename

* removed unwanted code
2018-03-07 15:31:08 +05:30
Nabin Hait
f0543a9765 Merge branch 'hotfix' 2018-03-07 13:09:06 +05:30
Nabin Hait
36b4faab48 bumped to version 10.1.6 2018-03-07 13:39:05 +06:00
Saurabh
2b59a851c4 Merge pull request #13166 from saurabh6790/patches_fixes
[fix] use join instead of subquery
2018-03-07 12:59:03 +05:30
Manas Solanki
857d4f7a0b Merge pull request #13209 from manassolanki/guardian-fix
allow renaming of the guardian
2018-03-07 12:53:40 +05:30
Manas Solanki
12d7bfb658 allow renaming of the guardian 2018-03-07 12:52:31 +05:30
Saurabh
ca6e223694 [fix] use join instead of subquery 2018-03-07 12:13:32 +05:30
rohitwaghchaure
343ba85e3a Merge pull request #13203 from saurabh6790/pe_fix
[fix] setup_party_account_field on init
2018-03-07 12:11:46 +05:30
Manas Solanki
16c324f699 Merge pull request #13207 from manassolanki/course-schedule-fix
fix the desktop icon for course schedule
2018-03-07 12:10:36 +05:30
Manas Solanki
1fa992564a fix the desktop icon for course schedule 2018-03-07 12:08:52 +05:30
Saurabh
a65b28772f [fix] setup_party_account_field on init 2018-03-06 18:22:01 +05:30
Nabin Hait
ba6003ece7 Merge branch 'hotfix' 2018-03-05 14:47:19 +05:30
Nabin Hait
491ce05b8d bumped to version 10.1.5 2018-03-05 15:17:18 +06:00
Saurabh
2cfcbf933d Patches fixes (#13163)
* [fix] if serialised items not found then return

* [fix] unicode encoding in patch
2018-03-05 13:01:15 +05:30
Zarrar
2550180a05 remove updating territory for customers on change (#13162) 2018-03-05 12:32:41 +05:30
Manas Solanki
5fd7b3bb80 Fix status updater (#13033)
* fix the status updater for multiple sources

* patch for updating the status

* patch for updating the sales order item

* Update update_status_for_multiple_source_in_po.py
2018-03-05 11:28:29 +05:30
Vishal Dhayagude
35b665cb26 [new] Create multiple warehouse address and fetch address to stock entry (#13109)
* [new] Create multiple warehouse address and fetch address to stock entry

* [fix] Deleted unwanted field and added patch to link warehouse details to Address

* [fix] Codacy fixed

* [fix] Modified patch for warehouse address

* [fix] Modified patch for warehouse address

* [fix] Patch updated and removed contact details from stock entry

* [fix] Patch Updated
2018-03-05 11:10:01 +05:30
rohitwaghchaure
a6a4e86dc8 [Fix] System only shows 20 attribute values while making variants (#13155) 2018-03-05 11:03:59 +05:30
rohitwaghchaure
0eb8bb2511 [Fix] Wrong salary slips showing when click on view salary slips from payroll entry (#13152) 2018-03-05 11:03:27 +05:30
rohitwaghchaure
67cfa81de2 [Fix] Stock Ageing report does not work with group warehouse (#13151) 2018-03-05 11:00:42 +05:30
rohitwaghchaure
a942722619 [Fix] Timeout issue while saving multilevel BOM (#13118) 2018-03-01 13:15:25 +05:30
Nabin Hait
c10bbd6aa7 Editable unallocated amount in pe (#13130)
* editable unallocated amount in payment entry to handle multi currency

* set unallocated amount on server side

* some minor fixes

* Fixes in territory patch

* removed print

* minor fixes
2018-03-01 13:14:14 +05:30
rohitwaghchaure
4badb45ee5 Merge pull request #13139 from rohitwaghchaure/sales_invoice_email_propmt_issue
[Fix] Sales invoice email prompt not working
2018-03-01 13:07:31 +05:30
Rohit Waghchaure
855d843e55 [Fix] Sales invoice email prompt not working 2018-03-01 13:06:01 +05:30
rohitwaghchaure
0df95fa781 Multi-UOM for sales/purchase return (#13132)
* Multi-UOM for sales/purchase return

* Update sales_and_purchase_return.py
2018-03-01 11:31:33 +05:30
Zarrar
6578bc11b6 wrong query formed to delete events (#13119) 2018-03-01 10:54:55 +05:30
Nabin Hait
f68dc69078 Set auto created serial nos in incoming transactions in case of multi UOM (#13112)
* Create user from Employee

* Set auto created serial nos in incoming transactions in case of multi uom
2018-03-01 10:54:24 +05:30
Zarrar
502af4dd67 display image fnd description for root BOM also (#13099) 2018-03-01 10:44:47 +05:30
rohitwaghchaure
db9fa78ee8 Do not validate payment schedule for POS (#13115) 2018-03-01 10:32:29 +05:30
Nabin Hait
a645f36b2b Get valuation rate from historical SLE even if it is zero (#13129)
* Don't overwrite start and end date comes from payroll entry

* Get valuation rate from historical SLE even if it is zero, if records exists

* Valid till should be autoset if not any default value

* Set status of expense claim based on is_paid check
2018-03-01 10:31:24 +05:30
rohitwaghchaure
332a17ee86 [Fix] Test case for serial no (#13136) 2018-03-01 10:28:04 +05:30
Shreya Shah
a310cc7156 order by modified instead of item name (#13113) 2018-02-28 18:59:55 +05:30
Nabin Hait
3b43c0d160 Update territory and customer_group patch optimization (#13076)
* Update territory and customer_group patch optimization

* Update update_territory_and_customer_group.py
2018-02-27 15:57:14 +05:30
Zarrar
96002c28bd optimize patch for faster execution (#13068) 2018-02-27 15:57:01 +05:30
Zarrar
91fc1a8fbe Update Territory & Customer Group across all transaction (#13004)
* added method for update query based on changes

* patch added

* updated function, moved util function
2018-02-27 15:56:38 +05:30
rohitwaghchaure
f1755fb5b1 Merge pull request #13094 from rohitwaghchaure/pos_discount_v10_1
[Hotfix] POS discount issue
2018-02-27 11:58:33 +05:30
Manas Solanki
be841ccc53 Merge pull request #13096 from manassolanki/fix-fee-schedule
Fixes in the Fees Schedule
2018-02-27 11:23:38 +05:30
Manas Solanki
51dfba749b filter students on basis of category and button to show fees 2018-02-26 19:32:26 +05:30
Nabin Hait
3799f8bec9 Don't validate serial nos while cancelling the transaction 2018-02-26 16:39:06 +05:30
Rohit Waghchaure
3edc101957 [Fix] POS discount issue 2018-02-26 13:25:58 +05:30
Nabin Hait
127c61e930 Fixed logic in itemwise recommended reorder level 2018-02-26 12:43:17 +05:30
Nabin Hait
e55831a89c Projected Qty in Auto reorder email 2018-02-26 11:38:40 +05:30
Nabin Hait
4ff4d185f7 Merge branch 'hotfix' 2018-02-23 16:59:42 +05:30
Nabin Hait
d54953e419 bumped to version 10.1.4 2018-02-23 17:29:42 +06:00
Zarrar
339426c926 fix permission issue for stock balance report - Item Group (#13069) 2018-02-23 16:58:55 +05:30
Nabin Hait
489ff6e21c Merge branch 'hotfix' 2018-02-23 16:49:41 +05:30
Nabin Hait
d12fb58c12 bumped to version 10.1.3 2018-02-23 17:19:40 +06:00
Ameya Shenoy
82048cf3ce verify payment entry amount is positive (#13066)
* verify payment entry amount is positive

* Update sales_invoice.py

* Update sales_invoice.py
2018-02-23 16:33:28 +05:30
rohitwaghchaure
4d76269eeb [Fix] Item wise sales register report (#13055) 2018-02-23 16:25:30 +05:30
Shreya Shah
d5b2e39f45 improve validation (#13058) 2018-02-23 16:23:57 +05:30
rohitwaghchaure
dd0fc1084e [Fix] PDC amount, PDC print layout issue (#13062) 2018-02-23 16:20:46 +05:30
Nabin Hait
d283ee73f3 Fetch timesheet based on project 2018-02-23 12:58:39 +05:30
Nabin Hait
93f138eece Merge branch 'hotfix' 2018-02-22 18:18:34 +05:30
Nabin Hait
2b2cf13408 bumped to version 10.1.2 2018-02-22 18:48:34 +06:00
Nabin Hait
7f49b57aaa Update added_extra_gst_custom_field_in_gstr2.py 2018-02-22 18:17:57 +05:30
178 changed files with 4159 additions and 813 deletions

View File

@@ -5,7 +5,7 @@ import frappe
from erpnext.hooks import regional_overrides
from frappe.utils import getdate
__version__ = '10.1.1'
__version__ = '10.1.23'
def get_default_company(user=None):
'''Get default company for user'''

View File

@@ -169,10 +169,10 @@ class Account(NestedSet):
# Add company abbr if not provided
from erpnext.setup.doctype.company.company import get_name_with_abbr
new_account = get_name_with_abbr(new, self.company)
new_account = get_name_with_number(new_account, self.account_number)
# Validate properties before merging
if merge:
if not merge:
new_account = get_name_with_number(new_account, self.account_number)
else:
# Validate properties before merging
if not frappe.db.exists("Account", new):
throw(_("Account {0} does not exist").format(new))

View File

@@ -159,6 +159,36 @@
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "include_pos_transactions",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Include POS Transactions",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
@@ -292,7 +322,7 @@
"istable": 0,
"max_attachments": 0,
"menu_index": 0,
"modified": "2017-04-21 16:58:26.902732",
"modified": "2018-03-07 18:58:48.658687",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Bank Reconciliation",

View File

@@ -53,10 +53,26 @@ class BankReconciliation(Document):
posting_date ASC, name DESC
""".format(condition),
{"account":self.bank_account, "from":self.from_date, "to":self.to_date}, as_dict=1)
entries = sorted(list(payment_entries)+list(journal_entries),
pos_entries = []
if self.include_pos_transactions:
pos_entries = frappe.db.sql("""
select
"Sales Invoice Payment" as payment_document, sip.name as payment_entry, sip.amount as debit,
si.posting_date, si.debit_to as against_account, sip.clearance_date,
account.account_currency, 0 as credit
from `tabSales Invoice Payment` sip, `tabSales Invoice` si, `tabAccount` account
where
sip.account=%(account)s and si.docstatus=1 and sip.parent = si.name
and account.name = sip.account and si.posting_date >= %(from)s and si.posting_date <= %(to)s {0}
order by
si.posting_date ASC, si.name DESC
""".format(condition),
{"account":self.bank_account, "from":self.from_date, "to":self.to_date}, as_dict=1)
entries = sorted(list(payment_entries)+list(journal_entries+list(pos_entries)),
key=lambda k: k['posting_date'] or getdate(nowdate()))
self.set('payment_entries', [])
self.total_amount = 0.0

View File

@@ -0,0 +1,8 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
import unittest
class TestBankReconciliation(unittest.TestCase):
pass

View File

@@ -48,5 +48,10 @@ frappe.treeview_settings["Cost Center"] = {
}, __('Budget'));
},
onrender: function(node) {
if(node.is_root){
node.hide_add = true;
}
}
}

View File

@@ -145,13 +145,13 @@ frappe.ui.form.on('Payment Entry', {
frm.doc.paid_amount : frm.doc.received_amount;
frm.toggle_display("write_off_difference_amount", (frm.doc.difference_amount && frm.doc.party &&
(frm.doc.paid_from_account_currency == frm.doc.paid_to_account_currency) &&
(frm.doc.total_allocated_amount > party_amount)));
frm.toggle_display("set_exchange_gain_loss",
(frm.doc.paid_amount && frm.doc.received_amount && frm.doc.difference_amount &&
(frm.doc.paid_from_account_currency != company_currency ||
frm.doc.paid_to_account_currency != company_currency)));
((frm.doc.paid_from_account_currency != company_currency ||
frm.doc.paid_to_account_currency != company_currency) &&
frm.doc.paid_from_account_currency != frm.doc.paid_to_account_currency)));
frm.refresh_fields();
},
@@ -300,7 +300,15 @@ frappe.ui.form.on('Payment Entry', {
if(frm.doc.payment_type == "Pay") {
frm.events.get_outstanding_documents(frm);
} else if (frm.doc.payment_type == "Receive") {
frm.events.received_amount(frm);
if(frm.doc.paid_from_account_currency == frm.doc.paid_to_account_currency) {
if(frm.doc.source_exchange_rate) {
frm.set_value("target_exchange_rate", frm.doc.source_exchange_rate);
}
frm.set_value("received_amount", frm.doc.paid_amount);
} else {
frm.events.received_amount(frm);
}
}
}
);
@@ -317,26 +325,31 @@ frappe.ui.form.on('Payment Entry', {
},
callback: function(r, rt) {
if(r.message) {
frm.set_value(currency_field, r.message['account_currency']);
frm.set_value(balance_field, r.message['account_balance']);
frappe.run_serially([
() => frm.set_value(currency_field, r.message['account_currency']),
() => {
frm.set_value(balance_field, r.message['account_balance']);
if(frm.doc.payment_type=="Receive" && currency_field=="paid_to_account_currency") {
frm.toggle_reqd(["reference_no", "reference_date"],
(r.message['account_type'] == "Bank" ? 1 : 0));
if(!frm.doc.received_amount && frm.doc.paid_amount)
frm.events.paid_amount(frm);
} else if(frm.doc.payment_type=="Pay" && currency_field=="paid_from_account_currency") {
frm.toggle_reqd(["reference_no", "reference_date"],
(r.message['account_type'] == "Bank" ? 1 : 0));
if(frm.doc.payment_type=="Receive" && currency_field=="paid_to_account_currency") {
frm.toggle_reqd(["reference_no", "reference_date"],
(r.message['account_type'] == "Bank" ? 1 : 0));
if(!frm.doc.received_amount && frm.doc.paid_amount)
frm.events.paid_amount(frm);
} else if(frm.doc.payment_type=="Pay" && currency_field=="paid_from_account_currency") {
frm.toggle_reqd(["reference_no", "reference_date"],
(r.message['account_type'] == "Bank" ? 1 : 0));
if(!frm.doc.paid_amount && frm.doc.received_amount)
frm.events.received_amount(frm);
}
if(!frm.doc.paid_amount && frm.doc.received_amount)
frm.events.received_amount(frm);
}
},
() => {
if(callback_function) callback_function(frm);
if(callback_function) callback_function(frm);
frm.events.hide_unhide_fields(frm);
frm.events.set_dynamic_labels(frm);
frm.events.hide_unhide_fields(frm);
frm.events.set_dynamic_labels(frm);
}
]);
}
}
});
@@ -405,7 +418,7 @@ frappe.ui.form.on('Payment Entry', {
frm.set_value("base_received_amount", frm.doc.base_paid_amount);
}
frm.events.set_difference_amount(frm);
frm.events.set_unallocated_amount(frm);
}
// Make read only if Accounts Settings doesn't allow stale rates
@@ -425,7 +438,7 @@ frappe.ui.form.on('Payment Entry', {
frm.set_value("base_paid_amount", frm.doc.base_received_amount);
}
frm.events.set_difference_amount(frm);
frm.events.set_unallocated_amount(frm);
}
frm.set_paid_amount_based_on_received_amount = false;
@@ -456,7 +469,7 @@ frappe.ui.form.on('Payment Entry', {
if(frm.doc.payment_type == "Pay")
frm.events.allocate_party_amount_against_ref_docs(frm, frm.doc.received_amount);
else
frm.events.set_difference_amount(frm);
frm.events.set_unallocated_amount(frm);
frm.set_paid_amount_based_on_received_amount = false;
},
@@ -476,7 +489,7 @@ frappe.ui.form.on('Payment Entry', {
if(frm.doc.payment_type == "Receive")
frm.events.allocate_party_amount_against_ref_docs(frm, frm.doc.paid_amount);
else
frm.events.set_difference_amount(frm);
frm.events.set_unallocated_amount(frm);
},
get_outstanding_documents: function(frm) {
@@ -565,8 +578,11 @@ frappe.ui.form.on('Payment Entry', {
if(frm.doc.references.length == 0){
frm.events.get_outstanding_documents(frm);
}
frm.events.allocate_party_amount_against_ref_docs(frm, frm.doc.received_amount);
if(frm.doc.payment_type == 'Internal Transfer') {
frm.events.allocate_party_amount_against_ref_docs(frm, frm.doc.paid_amount);
} else {
frm.events.allocate_party_amount_against_ref_docs(frm, frm.doc.received_amount);
}
},
allocate_party_amount_against_ref_docs: function(frm, paid_amount) {
@@ -651,28 +667,32 @@ frappe.ui.form.on('Payment Entry', {
frm.set_value("total_allocated_amount", Math.abs(total_allocated_amount));
frm.set_value("base_total_allocated_amount", Math.abs(base_total_allocated_amount));
frm.events.set_difference_amount(frm);
frm.events.set_unallocated_amount(frm);
},
set_difference_amount: function(frm) {
set_unallocated_amount: function(frm) {
var unallocated_amount = 0;
var total_deductions = frappe.utils.sum($.map(frm.doc.deductions || [],
function(d) { return flt(d.amount) }));
if(frm.doc.party) {
var party_amount = frm.doc.payment_type=="Receive" ?
frm.doc.paid_amount : frm.doc.received_amount;
if(frm.doc.total_allocated_amount < party_amount) {
if(frm.doc.payment_type == "Receive") {
unallocated_amount = party_amount - (frm.doc.total_allocated_amount - total_deductions);
} else {
unallocated_amount = party_amount - (frm.doc.total_allocated_amount + total_deductions);
}
if(frm.doc.payment_type == "Receive"
&& frm.doc.base_total_allocated_amount < frm.doc.base_received_amount + total_deductions
&& frm.doc.total_allocated_amount < frm.doc.paid_amount + (total_deductions / frm.doc.source_exchange_rate)) {
unallocated_amount = (frm.doc.base_received_amount + total_deductions
- frm.doc.base_total_allocated_amount) / frm.doc.source_exchange_rate;
} else if (frm.doc.payment_type == "Pay"
&& frm.doc.base_total_allocated_amount < frm.doc.base_paid_amount - total_deductions
&& frm.doc.total_allocated_amount < frm.doc.received_amount + (total_deductions / frm.doc.target_exchange_rate)) {
unallocated_amount = (frm.doc.base_paid_amount - (total_deductions
+ frm.doc.base_total_allocated_amount)) / frm.doc.target_exchange_rate;
}
}
frm.set_value("unallocated_amount", unallocated_amount);
frm.trigger("set_difference_amount");
},
set_difference_amount: function(frm) {
var difference_amount = 0;
var base_unallocated_amount = flt(frm.doc.unallocated_amount) *
(frm.doc.payment_type=="Receive" ? frm.doc.source_exchange_rate : frm.doc.target_exchange_rate);
@@ -687,11 +707,18 @@ frappe.ui.form.on('Payment Entry', {
difference_amount = flt(frm.doc.base_paid_amount) - flt(frm.doc.base_received_amount);
}
var total_deductions = frappe.utils.sum($.map(frm.doc.deductions || [],
function(d) { return flt(d.amount) }));
frm.set_value("difference_amount", difference_amount - total_deductions);
frm.events.hide_unhide_fields(frm);
},
unallocated_amount: function(frm) {
frm.trigger("set_difference_amount");
},
check_mandatory_to_fetch: function(frm) {
$.each(["Company", "Party Type", "Party", "payment_type"], function(i, field) {
if(!frm.doc[frappe.model.scrub(field)]) {
@@ -771,7 +798,7 @@ frappe.ui.form.on('Payment Entry', {
row.amount = flt(row.amount) + flt(frm.doc.difference_amount);
refresh_field("deductions");
frm.events.set_difference_amount(frm);
frm.events.set_unallocated_amount(frm);
}
}
})
@@ -818,10 +845,10 @@ frappe.ui.form.on('Payment Entry Reference', {
frappe.ui.form.on('Payment Entry Deduction', {
amount: function(frm) {
frm.events.set_difference_amount(frm);
frm.events.set_unallocated_amount(frm);
},
deductions_remove: function(frm) {
frm.events.set_difference_amount(frm);
frm.events.set_unallocated_amount(frm);
}
})

View File

@@ -40,6 +40,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -71,6 +72,7 @@
"reqd": 1,
"search_index": 0,
"set_only_once": 1,
"translatable": 0,
"unique": 0
},
{
@@ -102,6 +104,7 @@
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -131,6 +134,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -162,6 +166,7 @@
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -193,6 +198,7 @@
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -224,6 +230,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -255,6 +262,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -288,6 +296,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -320,6 +329,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -349,6 +359,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -381,6 +392,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -411,6 +423,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -442,6 +455,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -474,6 +488,7 @@
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -506,6 +521,7 @@
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -538,6 +554,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -567,6 +584,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -599,6 +617,7 @@
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -631,6 +650,7 @@
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -663,6 +683,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -695,6 +716,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -727,6 +749,7 @@
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -758,6 +781,7 @@
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -790,6 +814,7 @@
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -819,6 +844,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -851,6 +877,7 @@
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -882,6 +909,7 @@
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -914,6 +942,7 @@
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -946,6 +975,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -978,6 +1008,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -1010,6 +1041,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -1041,6 +1073,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -1072,6 +1105,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -1104,6 +1138,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -1134,6 +1169,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -1163,6 +1199,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -1188,12 +1225,13 @@
"precision": "",
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 1,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -1226,6 +1264,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -1257,6 +1296,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -1289,6 +1329,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -1320,6 +1361,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -1350,6 +1392,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -1381,6 +1424,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -1410,6 +1454,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -1441,6 +1486,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -1472,6 +1518,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -1504,6 +1551,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -1536,6 +1584,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -1566,6 +1615,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -1595,6 +1645,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -1626,6 +1677,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -1657,6 +1709,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -1687,6 +1740,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -1718,6 +1772,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -1748,6 +1803,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -1778,6 +1834,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
}
],
@@ -1791,7 +1848,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2017-08-31 11:20:37.578469",
"modified": "2018-02-19 16:58:23.899015",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Payment Entry",

View File

@@ -20,6 +20,11 @@ class InvalidPaymentEntry(ValidationError):
class PaymentEntry(AccountsController):
def __init__(self, *args, **kwargs):
super(PaymentEntry, self).__init__(*args, **kwargs)
if not self.is_new():
self.setup_party_account_field()
def setup_party_account_field(self):
self.party_account_field = None
self.party_account = None
@@ -286,17 +291,19 @@ class PaymentEntry(AccountsController):
self.base_total_allocated_amount = abs(base_total_allocated_amount)
def set_unallocated_amount(self):
self.unallocated_amount = 0;
self.unallocated_amount = 0
if self.party:
party_amount = self.paid_amount if self.payment_type=="Receive" else self.received_amount
total_deductions = sum([flt(d.amount) for d in self.get("deductions")])
if self.total_allocated_amount < party_amount:
if self.payment_type == "Receive":
self.unallocated_amount = party_amount - (self.total_allocated_amount - total_deductions)
else:
self.unallocated_amount = party_amount - (self.total_allocated_amount + total_deductions)
if self.payment_type == "Receive" \
and self.base_total_allocated_amount < self.base_received_amount + total_deductions \
and self.total_allocated_amount < self.paid_amount + (total_deductions / self.source_exchange_rate):
self.unallocated_amount = (self.base_received_amount + total_deductions -
self.base_total_allocated_amount) / self.source_exchange_rate
elif self.payment_type == "Pay" \
and self.base_total_allocated_amount < (self.base_paid_amount - total_deductions) \
and self.total_allocated_amount < self.received_amount + (total_deductions / self.target_exchange_rate):
self.unallocated_amount = (self.base_paid_amount - (total_deductions +
self.base_total_allocated_amount)) / self.target_exchange_rate
def set_difference_amount(self):
base_unallocated_amount = flt(self.unallocated_amount) * (flt(self.source_exchange_rate)
@@ -665,6 +672,24 @@ def get_company_defaults(company):
return ret
def get_outstanding_on_journal_entry(name):
res = frappe.db.sql(
'SELECT '
'CASE WHEN party_type IN ("Customer", "Student") '
'THEN ifnull(sum(debit_in_account_currency - credit_in_account_currency), 0) '
'ELSE ifnull(sum(credit_in_account_currency - debit_in_account_currency), 0) '
'END as outstanding_amount '
'FROM `tabGL Entry` WHERE (voucher_no=%s OR against_voucher=%s) '
'AND party_type IS NOT NULL '
'AND party_type != ""',
(name, name), as_dict=1
)
outstanding_amount = res[0].get('outstanding_amount', 0) if res else 0
return outstanding_amount
@frappe.whitelist()
def get_reference_details(reference_doctype, reference_name, party_account_currency):
total_amount = outstanding_amount = exchange_rate = None
@@ -675,6 +700,13 @@ def get_reference_details(reference_doctype, reference_name, party_account_curre
total_amount = ref_doc.get("grand_total")
exchange_rate = 1
outstanding_amount = ref_doc.get("outstanding_amount")
elif reference_doctype == "Journal Entry" and ref_doc.docstatus == 1:
total_amount = ref_doc.get("total_amount")
if ref_doc.multi_currency:
exchange_rate = get_exchange_rate(party_account_currency, company_currency, ref_doc.posting_date)
else:
exchange_rate = 1
outstanding_amount = get_outstanding_on_journal_entry(reference_name)
elif reference_doctype != "Journal Entry":
if party_account_currency == company_currency:
if ref_doc.doctype == "Expense Claim":
@@ -736,6 +768,8 @@ def get_payment_entry(dt, dn, party_amount=None, bank_account=None, bank_amount=
party_account = doc.receivable_account
elif dt == "Employee Advance":
party_account = doc.advance_account
elif dt == "Expense Claim":
party_account = doc.payable_account
else:
party_account = get_party_account(party_type, doc.get(party_type.lower()), doc.company)

View File

@@ -141,7 +141,6 @@ class TestPaymentEntry(unittest.TestCase):
def test_payment_entry_retrieves_last_exchange_rate(self):
from erpnext.setup.doctype.currency_exchange.test_currency_exchange import test_records, save_new_records
test_records = test_records
save_new_records(test_records)
pe = frappe.new_doc("Payment Entry")
@@ -151,6 +150,7 @@ class TestPaymentEntry(unittest.TestCase):
pe.paid_from = "_Test Bank USD - _TC"
pe.paid_to = "_Test Bank - _TC"
pe.paid_amount = 100
pe.received_amount = 100
pe.reference_no = "3"
pe.reference_date = "2016-01-10"
pe.party_type = "Supplier"

View File

@@ -98,7 +98,7 @@
"issingle": 0,
"istable": 1,
"max_attachments": 0,
"modified": "2016-07-11 03:28:03.420683",
"modified": "2018-02-21 03:28:03.420683",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Payment Entry Deduction",

View File

@@ -78,6 +78,9 @@ class PaymentRequest(Document):
controller = get_payment_gateway_controller(self.payment_gateway)
controller.validate_transaction_currency(self.currency)
if hasattr(controller, 'validate_minimum_transaction_amount'):
controller.validate_minimum_transaction_amount(self.currency, self.grand_total)
return controller.get_payment_url(**{
"amount": flt(self.grand_total, self.precision("grand_total")),
"title": data.company.encode("utf-8"),

View File

@@ -61,13 +61,11 @@ class TestPaymentRequest(unittest.TestCase):
self.assertEquals(pr.currency, "USD")
def test_payment_entry(self):
frappe.db.set_value("Company", "_Test Company",
frappe.db.set_value("Company", "_Test Company",
"exchange_gain_loss_account", "_Test Exchange Gain/Loss - _TC")
frappe.db.set_value("Company", "_Test Company",
"write_off_account", "_Test Write Off - _TC")
frappe.db.set_value("Company", "_Test Company",
"cost_center", "_Test Cost Center - _TC")
frappe.db.set_value("Company", "_Test Company", "write_off_account", "_Test Write Off - _TC")
frappe.db.set_value("Company", "_Test Company", "cost_center", "_Test Cost Center - _TC")
so_inr = make_sales_order(currency="INR")
pr = make_payment_request(dt="Sales Order", dn=so_inr.name, recipient_id="saurabh@erpnext.com",
mute_email=1, submit_doc=1, return_doc=1)
@@ -82,15 +80,15 @@ class TestPaymentRequest(unittest.TestCase):
pr = make_payment_request(dt="Sales Invoice", dn=si_usd.name, recipient_id="saurabh@erpnext.com",
mute_email=1, payment_gateway="_Test Gateway - USD", submit_doc=1, return_doc=1)
pe = pr.set_as_paid()
expected_gle = dict((d[0], d) for d in [
["_Test Receivable USD - _TC", 0, 5000, si_usd.name],
[pr.payment_account, 6290.0, 0, None],
["_Test Exchange Gain/Loss - _TC", 0, 1290, None]
])
gl_entries = frappe.db.sql("""select account, debit, credit, against_voucher
from `tabGL Entry` where voucher_type='Payment Entry' and voucher_no=%s
order by account asc""", pe.name, as_dict=1)

View File

@@ -131,7 +131,7 @@ def get_serial_no_for_item(args):
"name": args.name,
"serial_no": args.serial_no
})
if args.get("parenttype") in ("Sales Invoice", "Delivery Note") and args.stock_qty > 0:
if args.get("parenttype") in ("Sales Invoice", "Delivery Note") and flt(args.stock_qty) > 0:
item_details.serial_no = get_serial_no(args)
return item_details

View File

@@ -350,7 +350,6 @@ class PurchaseInvoice(BuyingController):
self.negative_expense_to_be_booked = 0.0
gl_entries = []
self.make_supplier_gl_entry(gl_entries)
self.make_item_gl_entries(gl_entries)
self.make_tax_gl_entries(gl_entries)
@@ -424,7 +423,10 @@ class PurchaseInvoice(BuyingController):
# sub-contracting warehouse
if flt(item.rm_supp_cost):
supplier_warehouse_account = warehouse_account[self.supplier_warehouse]["name"]
supplier_warehouse_account = warehouse_account[self.supplier_warehouse]["account"]
if not supplier_warehouse_account:
frappe.throw(_("Please set account in Warehouse {0}")
.format(self.supplier_warehouse))
gl_entries.append(self.get_gl_dict({
"account": supplier_warehouse_account,
"against": item.expense_account,

View File

@@ -106,7 +106,7 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
on_submit: function(doc, dt, dn) {
var me = this;
if (frappe.get_route()[0] != 'Sales Invoice') {
if (frappe.get_route()[0] != 'Form') {
return
}

View File

@@ -687,12 +687,12 @@
"in_standard_filter": 0,
"label": "Customer's Purchase Order",
"length": 0,
"no_copy": 0,
"no_copy": 1,
"permlevel": 0,
"precision": "",
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 1,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
@@ -751,7 +751,7 @@
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
@@ -4683,7 +4683,7 @@
"istable": 0,
"max_attachments": 0,
"menu_index": 0,
"modified": "2018-01-12 15:19:54.711885",
"modified": "2018-03-16 15:19:54.711885",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Sales Invoice",

View File

@@ -101,6 +101,8 @@ class SalesInvoice(SellingController):
self.set_billing_hours_and_amount()
self.update_timesheet_billing_for_project()
self.set_status()
if self.is_pos and not self.is_return:
self.verify_payment_amount_is_positive()
def before_save(self):
set_account_for_mode_of_payment(self)
@@ -332,7 +334,7 @@ class SalesInvoice(SellingController):
for item in self.get("items"):
if item.get('item_code'):
for fname, val in get_pos_profile_item_details(pos,
frappe._dict(item.as_dict()), pos).items():
frappe._dict(item.as_dict()), pos, True).items():
if (not for_validate) or (for_validate and not item.get(fname)):
item.set(fname, val)
@@ -903,6 +905,11 @@ class SalesInvoice(SellingController):
project.update_billed_amount()
project.save()
def verify_payment_amount_is_positive(self):
for entry in self.payments:
if entry.amount < 0:
frappe.throw(_("Row #{0} (Payment Table): Amount must be positive").format(entry.idx))
def get_list_context(context=None):
from erpnext.controllers.website_list_for_contact import get_list_context
list_context = get_list_context(context)

View File

@@ -227,6 +227,36 @@
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "clearance_date",
"fieldtype": "Date",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Clearance Date",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
}
],
"has_web_view": 0,
@@ -239,7 +269,7 @@
"issingle": 0,
"istable": 1,
"max_attachments": 0,
"modified": "2017-07-24 17:25:03.765856",
"modified": "2018-03-07 18:34:39.552769",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Sales Invoice Payment",

View File

@@ -39,18 +39,20 @@ frappe.ui.form.on("Tax Rule", "customer", function(frm) {
});
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);
});
if(frm.doc.supplier) {
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

@@ -393,7 +393,8 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
this.frm = {}
this.frm.doc = this.doc
this.set_transaction_defaults("Customer");
this.frm.doc["allow_user_to_edit_rate"] = this.pos_profile_data["allow_user_to_edit_rate"] ? true : false,
this.frm.doc["allow_user_to_edit_rate"] = this.pos_profile_data["allow_user_to_edit_rate"] ? true : false;
this.frm.doc["allow_user_to_edit_discount"] = this.pos_profile_data["allow_user_to_edit_discount"] ? true : false;
this.wrapper.html(frappe.render_template("pos", this.frm.doc));
this.make_search();
this.make_customer();
@@ -1256,6 +1257,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
$(this.wrapper).find('.selected-item').empty();
if(this.child_doc.length) {
this.child_doc[0]["allow_user_to_edit_rate"] = this.pos_profile_data["allow_user_to_edit_rate"] ? true : false,
this.child_doc[0]["allow_user_to_edit_discount"] = this.pos_profile_data["allow_user_to_edit_discount"] ? true : false;
this.selected_row = $(frappe.render_template("pos_selected_item", this.child_doc[0]))
$(this.wrapper).find('.selected-item').html(this.selected_row)
}
@@ -1683,7 +1685,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
setInterval(function () {
me.freeze_screen = false;
me.sync_sales_invoice()
}, 60000)
}, 180000)
},
sync_sales_invoice: function () {

View File

@@ -4,12 +4,11 @@
from __future__ import unicode_literals
import frappe
import datetime
from frappe import _, msgprint, scrub
from frappe.defaults import get_user_permissions
from frappe.model.utils import get_fetch_values
from frappe.utils import (add_days, getdate, formatdate, get_first_day, date_diff,
add_years, get_timestamp, nowdate, flt, add_months, get_last_day)
from frappe.utils import (add_days, getdate, formatdate, date_diff,
add_years, get_timestamp, nowdate, flt, add_months, get_last_day)
from frappe.contacts.doctype.address.address import (get_address_display,
get_default_address, get_company_address)
from frappe.contacts.doctype.contact.contact import get_contact_details, get_default_contact

View File

@@ -7,10 +7,10 @@
"docstatus": 0,
"doctype": "Print Format",
"font": "Default",
"html": "<style>\n\t.print-format table, .print-format tr, \n\t.print-format td, .print-format div, .print-format p {\n\t\tfont-family: Monospace;\n\t\tline-height: 200%;\n\t\tvertical-align: middle;\n\t}\n\t@media screen {\n\t\t.print-format {\n\t\t\twidth: 4in;\n\t\t\tpadding: 0.25in;\n\t\t\tmin-height: 8in;\n\t\t}\n\t}\n</style>\n\n<p class=\"text-center\">\n\t{{ doc.company }}<br>\n\t{% if doc.company_address_display %}\n\t\t{% set company_address = doc.company_address_display.replace(\"\\n\", \" \").replace(\"<br>\", \" \") %}\n\t\t{% if \"GSTIN\" not in company_address %}\n\t\t\t{{ company_address }}\n\t\t\t<b>{{ _(\"GSTIN\") }}:</b>{{ doc.company_gstin }}\n\t\t{% else %}\n\t\t\t{{ company_address.replace(\"GSTIN\", \"<br>GSTIN\") }}\n\t\t{% endif %}\n\t{% endif %}\n\t<br>\n\t<b>{{ doc.select_print_heading or _(\"Invoice\") }}</b><br>\n</p>\n<p>\n\t<b>{{ _(\"Receipt No\") }}:</b> {{ doc.name }}<br>\n\t<b>{{ _(\"Date\") }}:</b> {{ doc.get_formatted(\"posting_date\") }}<br>\n\t{% if doc.grand_total > 50000 %}\n\t\t{% set customer_address = doc.address_display.replace(\"\\n\", \" \").replace(\"<br>\", \" \") %}\n\t\t<b>{{ _(\"Customer\") }}:</b><br>\n\t\t{{ doc.customer_name }}<br>\n\t\t{{ customer_address }}\n\t{% endif %}\n</p>\n\n<hr>\n<table class=\"table table-condensed cart no-border\">\n\t<thead>\n\t\t<tr>\n\t\t\t<th width=\"40%\">{{ _(\"Item\") }}</b></th>\n\t\t\t<th width=\"30%\" class=\"text-right\">{{ _(\"Qty\") }}</th>\n\t\t\t<th width=\"30%\" class=\"text-right\">{{ _(\"Amount\") }}</th>\n\t\t</tr>\n\t</thead>\n\t<tbody>\n\t\t{%- for item in doc.items -%}\n\t\t<tr>\n\t\t\t<td>\n\t\t\t\t{{ item.item_code }}\n\t\t\t\t{%- if item.item_name != item.item_code -%}\n\t\t\t\t\t<br>{{ item.item_name }}\n\t\t\t\t{%- endif -%}\n\t\t\t\t{%- if item.gst_hsn_code -%}\n\t\t\t\t\t<br><b>{{ _(\"HSN/SAC\") }}:</b> {{ item.gst_hsn_code }}\n\t\t\t\t{%- endif -%}\n\t\t\t\t{%- if item.serial_no -%}\n\t\t\t\t\t<br><b>{{ _(\"Serial No\") }}:</b> {{ item.serial_no }}\n\t\t\t\t{%- endif -%}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">{{ item.qty }}<br>@ {{ item.rate }}</td>\n\t\t\t<td class=\"text-right\">{{ item.get_formatted(\"amount\") }}</td>\n\t\t</tr>\n\t\t{%- endfor -%}\n\t</tbody>\n</table>\n<table class=\"table table-condensed no-border\">\n\t<tbody>\n\t\t<tr>\n\t\t\t{% if doc.flags.show_inclusive_tax_in_print %}\n\t\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t\t{{ _(\"Total Excl. Tax\") }}\n\t\t\t\t</td>\n\t\t\t\t<td class=\"text-right\">\n\t\t\t\t\t{{ doc.get_formatted(\"net_total\", doc) }}\n\t\t\t\t</td>\n\t\t\t{% else %}\n\t\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t\t{{ _(\"Total\") }}\n\t\t\t\t</td>\n\t\t\t\t<td class=\"text-right\">\n\t\t\t\t\t{{ doc.get_formatted(\"total\", doc) }}\n\t\t\t\t</td>\n\t\t\t{% endif %}\n\t\t</tr>\n\t\t{%- for row in doc.taxes -%}\n\t\t {%- if not row.included_in_print_rate or doc.flags.show_inclusive_tax_in_print -%}\n\t\t\t<tr>\n\t\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t\t{{ row.description }}\n\t\t\t\t</td>\n\t\t\t\t<td class=\"text-right\">\n\t\t\t\t\t{{ row.get_formatted(\"tax_amount\", doc) }}\n\t\t\t\t</td>\n\t\t\t<tr>\n\t\t {%- endif -%}\n\t\t{%- endfor -%}\n\t\t{%- if doc.discount_amount -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t{{ _(\"Discount\") }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"discount_amount\") }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{%- endif -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t<b>{{ _(\"Grand Total\") }}</b>\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"grand_total\") }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{%- if doc.rounded_total -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t<b>{{ _(\"Rounded Total\") }}</b>\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"rounded_total\") }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{%- endif -%}\n\t</tbody>\n</table>\n<p><b>Tax Breakup:</b></p>\n<div style=\"font-size: 8px\">\n\t{{ doc.other_charges_calculation }}\n</div>\n<p>{{ doc.terms or \"\" }}</p>\n<p class=\"text-center\">{{ _(\"Thank you, please visit again.\") }}</p>",
"html": "<style>\n\t.print-format table, .print-format tr, \n\t.print-format td, .print-format div, .print-format p {\n\t\tfont-family: Monospace;\n\t\tline-height: 200%;\n\t\tvertical-align: middle;\n\t}\n\t@media screen {\n\t\t.print-format {\n\t\t\twidth: 4in;\n\t\t\tpadding: 0.25in;\n\t\t\tmin-height: 8in;\n\t\t}\n\t}\n</style>\n\n<p class=\"text-center\">\n\t{{ doc.company }}<br>\n\t{% if doc.company_address_display %}\n\t\t{% set company_address = doc.company_address_display.replace(\"\\n\", \" \").replace(\"<br>\", \" \") %}\n\t\t{% if \"GSTIN\" not in company_address %}\n\t\t\t{{ company_address }}\n\t\t\t<b>{{ _(\"GSTIN\") }}:</b>{{ doc.company_gstin }}\n\t\t{% else %}\n\t\t\t{{ company_address.replace(\"GSTIN\", \"<br>GSTIN\") }}\n\t\t{% endif %}\n\t{% endif %}\n\t<br>\n\t<b>{{ doc.select_print_heading or _(\"Invoice\") }}</b><br>\n</p>\n<p>\n\t<b>{{ _(\"Receipt No\") }}:</b> {{ doc.name }}<br>\n\t<b>{{ _(\"Date\") }}:</b> {{ doc.get_formatted(\"posting_date\") }}<br>\n\t{% if doc.grand_total > 50000 %}\n\t\t{% set customer_address = doc.address_display.replace(\"\\n\", \" \").replace(\"<br>\", \" \") %}\n\t\t<b>{{ _(\"Customer\") }}:</b><br>\n\t\t{{ doc.customer_name }}<br>\n\t\t{{ customer_address }}\n\t{% endif %}\n</p>\n\n<hr>\n<table class=\"table table-condensed cart no-border\">\n\t<thead>\n\t\t<tr>\n\t\t\t<th width=\"40%\">{{ _(\"Item\") }}</b></th>\n\t\t\t<th width=\"30%\" class=\"text-right\">{{ _(\"Qty\") }}</th>\n\t\t\t<th width=\"30%\" class=\"text-right\">{{ _(\"Amount\") }}</th>\n\t\t</tr>\n\t</thead>\n\t<tbody>\n\t\t{%- for item in doc.items -%}\n\t\t<tr>\n\t\t\t<td>\n\t\t\t\t{{ item.item_code }}\n\t\t\t\t{%- if item.item_name != item.item_code -%}\n\t\t\t\t\t<br>{{ item.item_name }}\n\t\t\t\t{%- endif -%}\n\t\t\t\t{%- if item.gst_hsn_code -%}\n\t\t\t\t\t<br><b>{{ _(\"HSN/SAC\") }}:</b> {{ item.gst_hsn_code }}\n\t\t\t\t{%- endif -%}\n\t\t\t\t{%- if item.serial_no -%}\n\t\t\t\t\t<br><b>{{ _(\"Serial No\") }}:</b> {{ item.serial_no }}\n\t\t\t\t{%- endif -%}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">{{ item.qty }}<br>@ {{ item.rate }}</td>\n\t\t\t<td class=\"text-right\">{{ item.get_formatted(\"amount\") }}</td>\n\t\t</tr>\n\t\t{%- endfor -%}\n\t</tbody>\n</table>\n<table class=\"table table-condensed no-border\">\n\t<tbody>\n\t\t<tr>\n\t\t\t{% if doc.flags.show_inclusive_tax_in_print %}\n\t\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t\t{{ _(\"Total Excl. Tax\") }}\n\t\t\t\t</td>\n\t\t\t\t<td class=\"text-right\">\n\t\t\t\t\t{{ doc.get_formatted(\"net_total\", doc) }}\n\t\t\t\t</td>\n\t\t\t{% else %}\n\t\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t\t{{ _(\"Total\") }}\n\t\t\t\t</td>\n\t\t\t\t<td class=\"text-right\">\n\t\t\t\t\t{{ doc.get_formatted(\"total\", doc) }}\n\t\t\t\t</td>\n\t\t\t{% endif %}\n\t\t</tr>\n\t\t{%- for row in doc.taxes -%}\n\t\t {%- if not row.included_in_print_rate or doc.flags.show_inclusive_tax_in_print -%}\n\t\t\t<tr>\n\t\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t\t{{ row.description }}\n\t\t\t\t</td>\n\t\t\t\t<td class=\"text-right\">\n\t\t\t\t\t{{ row.get_formatted(\"tax_amount\", doc) }}\n\t\t\t\t</td>\n\t\t\t<tr>\n\t\t {%- endif -%}\n\t\t{%- endfor -%}\n\t\t{%- if doc.discount_amount -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t{{ _(\"Discount\") }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"discount_amount\") }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{%- endif -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t<b>{{ _(\"Grand Total\") }}</b>\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"grand_total\") }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{%- if doc.rounded_total -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t<b>{{ _(\"Rounded Total\") }}</b>\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"rounded_total\") }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{%- endif -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t<b>{{ _(\"Paid Amount\") }}</b>\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"paid_amount\") }}\n\t\t\t</td>\n\t\t</tr>\n\t{%- if doc.change_amount -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t<b>{{ _(\"Change Amount\") }}</b>\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"change_amount\") }}\n\t\t\t</td>\n\t\t</tr>\n\t{%- endif -%}\n\t</tbody>\n</table>\n<p><b>Tax Breakup:</b></p>\n<div style=\"font-size: 8px\">\n\t{{ doc.other_charges_calculation }}\n</div>\n<p>{{ doc.terms or \"\" }}</p>\n<p class=\"text-center\">{{ _(\"Thank you, please visit again.\") }}</p>",
"idx": 0,
"line_breaks": 0,
"modified": "2018-01-12 11:19:17.432600",
"modified": "2018-03-20 14:24:08.167930",
"modified_by": "Administrator",
"module": "Accounts",
"name": "GST POS Invoice",

View File

@@ -6,10 +6,10 @@
"doc_type": "Sales Invoice",
"docstatus": 0,
"doctype": "Print Format",
"html": "<style>\n\t.print-format table, .print-format tr, \n\t.print-format td, .print-format div, .print-format p {\n\t\tfont-family: Monospace;\n\t\tline-height: 200%;\n\t\tvertical-align: middle;\n\t}\n\t@media screen {\n\t\t.print-format {\n\t\t\twidth: 4in;\n\t\t\tpadding: 0.25in;\n\t\t\tmin-height: 8in;\n\t\t}\n\t}\n</style>\n\n<p class=\"text-center\">\n\t{{ doc.company }}<br>\n\t{{ doc.select_print_heading or _(\"Invoice\") }}<br>\n</p>\n<p>\n\t<b>{{ _(\"Receipt No\") }}:</b> {{ doc.name }}<br>\n\t<b>{{ _(\"Date\") }}:</b> {{ doc.get_formatted(\"posting_date\") }}<br>\n\t<b>{{ _(\"Customer\") }}:</b> {{ doc.customer_name }}\n</p>\n\n<hr>\n<table class=\"table table-condensed cart no-border\">\n\t<thead>\n\t\t<tr>\n\t\t\t<th width=\"50%\">{{ _(\"Item\") }}</b></th>\n\t\t\t<th width=\"25%\" class=\"text-right\">{{ _(\"Qty\") }}</th>\n\t\t\t<th width=\"25%\" class=\"text-right\">{{ _(\"Amount\") }}</th>\n\t\t</tr>\n\t</thead>\n\t<tbody>\n\t\t{%- for item in doc.items -%}\n\t\t<tr>\n\t\t\t<td>\n\t\t\t\t{{ item.item_code }}\n\t\t\t\t{%- if item.item_name != item.item_code -%}\n\t\t\t\t\t<br>{{ item.item_name }}{%- endif -%}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">{{ item.qty }}<br>@ {{ item.get_formatted(\"rate\") }}</td>\n\t\t\t<td class=\"text-right\">{{ item.get_formatted(\"amount\") }}</td>\n\t\t</tr>\n\t\t{%- endfor -%}\n\t</tbody>\n</table>\n<table class=\"table table-condensed no-border\">\n\t<tbody>\n\t\t<tr>\n\t\t\t{% if doc.flags.show_inclusive_tax_in_print %}\n\t\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t\t{{ _(\"Total Excl. Tax\") }}\n\t\t\t\t</td>\n\t\t\t\t<td class=\"text-right\">\n\t\t\t\t\t{{ doc.get_formatted(\"net_total\", doc) }}\n\t\t\t\t</td>\n\t\t\t{% else %}\n\t\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t\t{{ _(\"Total\") }}\n\t\t\t\t</td>\n\t\t\t\t<td class=\"text-right\">\n\t\t\t\t\t{{ doc.get_formatted(\"total\", doc) }}\n\t\t\t\t</td>\n\t\t\t{% endif %}\n\t\t</tr>\n\t\t{%- for row in doc.taxes -%}\n\t\t {%- if not row.included_in_print_rate or doc.flags.show_inclusive_tax_in_print -%}\n\t\t\t<tr>\n\t\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t\t{{ row.description }}\n\t\t\t\t</td>\n\t\t\t\t<td class=\"text-right\">\n\t\t\t\t\t{{ row.get_formatted(\"tax_amount\", doc) }}\n\t\t\t\t</td>\n\t\t\t<tr>\n\t\t {%- endif -%}\n\t\t{%- endfor -%}\n\n\t\t{%- if doc.discount_amount -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t{{ _(\"Discount\") }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"discount_amount\") }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{%- endif -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t<b>{{ _(\"Grand Total\") }}</b>\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"grand_total\") }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{%- if doc.rounded_total -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t<b>{{ _(\"Rounded Total\") }}</b>\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"rounded_total\") }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{%- endif -%}\n\t</tbody>\n</table>\n<hr>\n<p>{{ doc.terms or \"\" }}</p>\n<p class=\"text-center\">{{ _(\"Thank you, please visit again.\") }}</p>",
"html": "<style>\n\t.print-format table, .print-format tr, \n\t.print-format td, .print-format div, .print-format p {\n\t\tfont-family: Monospace;\n\t\tline-height: 200%;\n\t\tvertical-align: middle;\n\t}\n\t@media screen {\n\t\t.print-format {\n\t\t\twidth: 4in;\n\t\t\tpadding: 0.25in;\n\t\t\tmin-height: 8in;\n\t\t}\n\t}\n</style>\n\n<p class=\"text-center\">\n\t{{ doc.company }}<br>\n\t{{ doc.select_print_heading or _(\"Invoice\") }}<br>\n</p>\n<p>\n\t<b>{{ _(\"Receipt No\") }}:</b> {{ doc.name }}<br>\n\t<b>{{ _(\"Date\") }}:</b> {{ doc.get_formatted(\"posting_date\") }}<br>\n\t<b>{{ _(\"Customer\") }}:</b> {{ doc.customer_name }}\n</p>\n\n<hr>\n<table class=\"table table-condensed cart no-border\">\n\t<thead>\n\t\t<tr>\n\t\t\t<th width=\"50%\">{{ _(\"Item\") }}</b></th>\n\t\t\t<th width=\"25%\" class=\"text-right\">{{ _(\"Qty\") }}</th>\n\t\t\t<th width=\"25%\" class=\"text-right\">{{ _(\"Amount\") }}</th>\n\t\t</tr>\n\t</thead>\n\t<tbody>\n\t\t{%- for item in doc.items -%}\n\t\t<tr>\n\t\t\t<td>\n\t\t\t\t{{ item.item_code }}\n\t\t\t\t{%- if item.item_name != item.item_code -%}\n\t\t\t\t\t<br>{{ item.item_name }}{%- endif -%}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">{{ item.qty }}<br>@ {{ item.get_formatted(\"rate\") }}</td>\n\t\t\t<td class=\"text-right\">{{ item.get_formatted(\"amount\") }}</td>\n\t\t</tr>\n\t\t{%- endfor -%}\n\t</tbody>\n</table>\n<table class=\"table table-condensed no-border\">\n\t<tbody>\n\t\t<tr>\n\t\t\t{% if doc.flags.show_inclusive_tax_in_print %}\n\t\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t\t{{ _(\"Total Excl. Tax\") }}\n\t\t\t\t</td>\n\t\t\t\t<td class=\"text-right\">\n\t\t\t\t\t{{ doc.get_formatted(\"net_total\", doc) }}\n\t\t\t\t</td>\n\t\t\t{% else %}\n\t\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t\t{{ _(\"Total\") }}\n\t\t\t\t</td>\n\t\t\t\t<td class=\"text-right\">\n\t\t\t\t\t{{ doc.get_formatted(\"total\", doc) }}\n\t\t\t\t</td>\n\t\t\t{% endif %}\n\t\t</tr>\n\t\t{%- for row in doc.taxes -%}\n\t\t {%- if not row.included_in_print_rate or doc.flags.show_inclusive_tax_in_print -%}\n\t\t\t<tr>\n\t\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t\t{{ row.description }}\n\t\t\t\t</td>\n\t\t\t\t<td class=\"text-right\">\n\t\t\t\t\t{{ row.get_formatted(\"tax_amount\", doc) }}\n\t\t\t\t</td>\n\t\t\t<tr>\n\t\t {%- endif -%}\n\t\t{%- endfor -%}\n\n\t\t{%- if doc.discount_amount -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t{{ _(\"Discount\") }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"discount_amount\") }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{%- endif -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t<b>{{ _(\"Grand Total\") }}</b>\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"grand_total\") }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{%- if doc.rounded_total -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t<b>{{ _(\"Rounded Total\") }}</b>\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"rounded_total\") }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{%- endif -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t<b>{{ _(\"Paid Amount\") }}</b>\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"paid_amount\") }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{%- if doc.change_amount -%}\n\t\t\t<tr>\n\t\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t\t<b>{{ _(\"Change Amount\") }}</b>\n\t\t\t\t</td>\n\t\t\t\t<td class=\"text-right\">\n\t\t\t\t\t{{ doc.get_formatted(\"change_amount\") }}\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t{%- endif -%}\n\t</tbody>\n</table>\n<hr>\n<p>{{ doc.terms or \"\" }}</p>\n<p class=\"text-center\">{{ _(\"Thank you, please visit again.\") }}</p>",
"idx": 1,
"line_breaks": 0,
"modified": "2018-01-12 11:18:54.229254",
"modified": "2018-03-20 14:24:12.394354",
"modified_by": "Administrator",
"module": "Accounts",
"name": "POS Invoice",

View File

@@ -14,7 +14,13 @@ frappe.query_reports["Accounts Payable"] = {
"fieldname":"supplier",
"label": __("Supplier"),
"fieldtype": "Link",
"options": "Supplier"
"options": "Supplier",
on_change: () => {
var supplier = frappe.query_report_filters_by_name.supplier.get_value();
frappe.db.get_value('Supplier', supplier, "tax_id", function(value) {
frappe.query_report_filters_by_name.tax_id.set_value(value["tax_id"]);
});
}
},
{
"fieldname":"report_date",
@@ -52,6 +58,12 @@ frappe.query_reports["Accounts Payable"] = {
"fieldtype": "Int",
"default": "90",
"reqd": 1
},
{
"fieldname":"tax_id",
"label": __("Tax Id"),
"fieldtype": "Data",
"hidden": 1
}
],
onload: function(report) {

View File

@@ -1,13 +1,30 @@
{% if(filters.show_pdc_in_print) { %}
<style>
@media screen {
.print-format {
padding: 4mm;
font-size: 8.0pt !important;
font-family: Tahoma, sans-serif;
}
}
</style>
{% } %}
<style>
@media screen {
.print-format {
padding: 8mm;
}
}
.print-format {
padding: 4mm;
font-size: 8.0pt !important;
font-family: Tahoma, sans-serif;
}
</style>
<h2 class="text-center">{%= __(report.report_name) %}</h2>
<h4 class="text-center">{%= filters.customer || filters.supplier %} </h4>
<h6 class="text-center">
{% if (filters.tax_id) { %}
{%= __("Tax Id: ")%} {%= filters.tax_id %}
{% } %}
</h6>
<h5 class="text-center">
{%= __(filters.ageing_based_on) %}
{%= __("Until") %}
@@ -22,7 +39,7 @@
var range4 = report.columns[14].label;
%}
{% if(balance_row) { %}
<table class="table table-bordered table-condensed table-sm small">
<table class="table table-bordered table-condensed">
<caption class="text-right">(Amount in {%= data[0][__("currency")] || "" %})</caption>
<colgroup>
<col style="width: 30mm;">
@@ -81,22 +98,25 @@
<thead>
<tr>
{% if(report.report_name === "Accounts Receivable" || report.report_name === "Accounts Payable") { %}
<th style="width: 10%">{%= __("Date") %}</th>
<th style="width: 10%">{%= __("Ref") %}</th>
<th style="width: 18%">{%= __("Date") %}</th>
<th style="width: 17%">{%= __("Reference") %}</th>
{% if(!filters.show_pdc_in_print) { %}
<th style="width: 20%">{%= (filters.customer || filters.supplier) ? __("Remarks"): __("Party") %}</th>
{% } %}
<th style="width: 10%">{%= __("Invoiced Amount") %}</th>
{% if(!filters.show_pdc_in_print) { %}
<th style="width: 10%">{%= __("Paid Amount") %}</th>
<th style="width: 10%">{%= report.report_name === "Accounts Receivable" ? __('Credit Note') : __('Debit Note') %}</th>
{% } %}
<th style="width: 6%">{%= __("Outstanding Amount") %}</th>
<th style="width: 15%">{%= __("Outstanding Amount") %}</th>
{% if(filters.show_pdc_in_print) { %}
{% if(report.report_name === "Accounts Receivable") { %}
<th style="width: 6%">{%= __("Customer LPO No.") %}</th>
<th style="width: 10%">{%= __("Customer LPO No.") %}</th>
{% } %}
<th style="width: 6%">{%= __("PDC/LC Date") %}</th>
<th style="width: 6%">{%= __("PDC/LC Ref") %}</th>
<th style="width: 6%">{%= __("PDC/LC Amount") %}</th>
<th style="width: 10%">{%= __("PDC/LC Date") %}</th>
<th style="width: 10%">{%= __("PDC/LC Ref") %}</th>
<th style="width: 10%">{%= __("PDC/LC Amount") %}</th>
<th style="width: 10%">{%= __("Remaining Balance") %}</th>
{% } %}
{% } else { %}
<th style="width: 40%">{%= (filters.customer || filters.supplier) ? __("Remarks"): __("Party") %}</th>
@@ -112,9 +132,15 @@
<tr>
{% if(report.report_name === "Accounts Receivable" || report.report_name === "Accounts Payable") { %}
{% if(data[i][__("Customer")] || data[i][__("Supplier")]) { %}
<td>{%= dateutil.str_to_user(data[i][__("Posting Date")]) %}</td>
<td>{%= data[i][__("Voucher Type")] %}
<br>{%= data[i][__("Voucher No")] %}</td>
<td>{%= dateutil.str_to_user(data[i]["posting_date"]) %}</td>
<td>
{% if(!filters.show_pdc_in_print) { %}
{%= data[i]["voucher_type"] %}
<br>
{% } %}
{%= data[i]["voucher_no"] %}
</td>
{% if(!filters.show_pdc_in_print) { %}
<td>
{% if(!(filters.customer || filters.supplier)) { %}
{%= data[i][__("Customer")] || data[i][__("Supplier")] %}
@@ -127,6 +153,7 @@
<br>{%= __("Remarks") %}:
{%= data[i][__("Remarks")] %}
</td>
{% } %}
<td style="text-align: right">
{%= format_currency(data[i]["Invoiced Amount"], data[i]["currency"]) %}</td>
@@ -147,10 +174,13 @@
<td style="text-align: right">{%= frappe.datetime.str_to_user(data[i][__("PDC/LC Date")]) %}</td>
<td style="text-align: right">{%= data[i][__("PDC/LC Ref")] %}</td>
<td style="text-align: right">{%= format_currency(data[i][__("PDC/LC Amount")], data[i]["currency"]) %}</td>
<td style="text-align: right">{%= format_currency(data[i][__("Remaining Balance")], data[i]["currency"]) %}</td>
{% } %}
{% } else { %}
<td></td>
{% if(!filters.show_pdc_in_print) { %}
<td></td>
{% } %}
<td><b>{%= __("Total") %}</b></td>
<td style="text-align: right">
{%= format_currency(data[i]["Invoiced Amount"], data[i]["currency"] ) %}</td>
@@ -171,6 +201,7 @@
<td style="text-align: right">{%= frappe.datetime.str_to_user(data[i][__("PDC/LC Date")]) %}</td>
<td style="text-align: right">{%= data[i][__("PDC/LC Ref")] %}</td>
<td style="text-align: right">{%= format_currency(data[i][__("PDC/LC Amount")], data[i]["currency"]) %}</td>
<td style="text-align: right">{%= format_currency(data[i][__("Remaining Balance")], data[i]["currency"]) %}</td>
{% } %}
{% } %}
{% } else { %}
@@ -201,4 +232,4 @@
{% } %}
</tbody>
</table>
<p class="text-right text-muted">{{ __("Printed On") }}{%= dateutil.str_to_user(dateutil.get_datetime_as_string()) %}</p>
<p class="text-right text-muted">{{ __("Printed On ") }}{%= dateutil.str_to_user(dateutil.get_datetime_as_string()) %}</p>

View File

@@ -14,7 +14,13 @@ frappe.query_reports["Accounts Receivable"] = {
"fieldname":"customer",
"label": __("Customer"),
"fieldtype": "Link",
"options": "Customer"
"options": "Customer",
on_change: () => {
var customer = frappe.query_report_filters_by_name.customer.get_value();
frappe.db.get_value('Customer', customer, "tax_id", function(value) {
frappe.query_report_filters_by_name.tax_id.set_value(value["tax_id"]);
});
}
},
{
"fieldname":"customer_group",
@@ -69,6 +75,12 @@ frappe.query_reports["Accounts Receivable"] = {
"fieldname":"show_pdc_in_print",
"label": __("Show PDC in Print"),
"fieldtype": "Check",
},
{
"fieldname":"tax_id",
"label": __("Tax Id"),
"fieldtype": "Data",
"hidden": 1
}
],

View File

@@ -22,13 +22,35 @@ class ReceivablePayableReport(object):
return columns, data, None, chart
def get_columns(self, party_naming_by, args):
columns = [_("Posting Date") + ":Date:80", _(args.get("party_type")) + ":Link/" + args.get("party_type") + ":200"]
columns = []
columns.append({
"label": _("Posting Date"),
"fieldtype": "Date",
"fieldname": "posting_date",
"width": 90
})
columns += [_(args.get("party_type")) + ":Link/" + args.get("party_type") + ":200"]
if party_naming_by == "Naming Series":
columns += [args.get("party_type") + " Name::110"]
columns += [_("Voucher Type") + "::110", _("Voucher No") + ":Dynamic Link/"+_("Voucher Type")+":120",
_("Due Date") + ":Date:80"]
columns.append({
"label": _("Voucher Type"),
"fieldtype": "Data",
"fieldname": "voucher_type",
"width": 110
})
columns.append({
"label": _("Voucher No"),
"fieldtype": "Dynamic Link",
"fieldname": "voucher_no",
"width": 110,
"options": "voucher_type",
})
columns += [_("Due Date") + ":Date:80"]
if args.get("party_type") == "Supplier":
columns += [_("Bill No") + "::80", _("Bill Date") + ":Date:80"]
@@ -114,7 +136,7 @@ class ReceivablePayableReport(object):
return_entries = self.get_return_entries(args.get("party_type"))
data = []
pdc_details = get_pdc_details(args.get("party_type"))
pdc_details = get_pdc_details(args.get("party_type"), self.filters.report_date)
for gle in self.get_entries_till(self.filters.report_date, args.get("party_type")):
if self.is_receivable_or_payable(gle, dr_or_cr, future_vouchers):
@@ -159,7 +181,8 @@ class ReceivablePayableReport(object):
else:
row.append(company_currency)
pdc = pdc_details.get(gle.voucher_no, {})
pdc = pdc_details.get((gle.voucher_no, gle.party), {})
remaining_balance = outstanding_amount - flt(pdc.get("pdc_amount"))
row += [pdc.get("pdc_date"), pdc.get("pdc_ref"),
flt(pdc.get("pdc_amount")), remaining_balance]
@@ -376,7 +399,7 @@ def get_ageing_data(first_range, second_range, third_range, age_as_on, entry_dat
return [age] + outstanding_range
def get_pdc_details(party_type):
def get_pdc_details(party_type, report_date):
pdc_details = frappe._dict()
for pdc in frappe.db.sql("""
@@ -389,25 +412,34 @@ def get_pdc_details(party_type):
on
(pref.parent = pent.name)
where
pent.docstatus = 0 and pent.reference_date > pent.posting_date
pent.docstatus < 2 and pent.reference_date >= %s
and pent.party_type = %s
group by pref.reference_name""", party_type, as_dict=1):
pdc_details.setdefault(pdc.invoice_no, pdc)
group by pent.party, pref.reference_name""", (report_date, party_type), as_dict=1):
pdc_details.setdefault((pdc.invoice_no, pdc.party), pdc)
if scrub(party_type):
amount_field = ("jea.debit_in_account_currency"
if party_type == 'Supplier' else "jea.credit_in_account_currency")
else:
amount_field = "jea.debit + jea.credit"
for pdc in frappe.db.sql("""
select
jea.reference_name as invoice_no, jea.party, jea.party_type,
max(je.cheque_date) as pdc_date, sum(ifnull(je.total_amount,0)) as pdc_amount,
max(je.cheque_date) as pdc_date, sum(ifnull({0},0)) as pdc_amount,
GROUP_CONCAT(je.cheque_no SEPARATOR ', ') as pdc_ref
from
`tabJournal Entry` as je inner join `tabJournal Entry Account` as jea
on
(jea.parent = je.name)
where
je.docstatus = 0 and je.cheque_date > je.posting_date
je.docstatus < 2 and je.cheque_date >= %s
and jea.party_type = %s
group by jea.reference_name""", party_type, as_dict=1):
pdc_details.setdefault(pdc.invoice_no, pdc)
group by jea.party, jea.reference_name""".format(amount_field), (report_date, party_type), as_dict=1):
if (pdc.invoice_no, pdc.party) in pdc_details:
pdc_details[(pdc.invoice_no, pdc.party)]["pdc_amount"] += pdc.pdc_amount
else:
pdc_details.setdefault((pdc.invoice_no, pdc.party), pdc)
return pdc_details

View File

@@ -4,6 +4,7 @@
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.utils import flt
from erpnext.accounts.report.accounts_receivable.accounts_receivable import ReceivablePayableReport
class AccountsReceivableSummary(ReceivablePayableReport):
@@ -88,7 +89,8 @@ class AccountsReceivableSummary(ReceivablePayableReport):
})
)
for k in party_total[d.party].keys():
party_total[d.party][k] += d.get(k, 0)
if k != "currency":
party_total[d.party][k] += flt(d.get(k, 0))
party_total[d.party].currency = d.currency

View File

@@ -28,5 +28,10 @@ frappe.query_reports["Bank Reconciliation Statement"] = {
"default": frappe.datetime.get_today(),
"reqd": 1
},
{
"fieldname":"include_pos_transactions",
"label": __("Include POS Transactions"),
"fieldtype": "Check"
},
]
}
}

View File

@@ -138,7 +138,23 @@ def get_entries(filters):
and ifnull(clearance_date, '4000-01-01') > %(report_date)s
""", filters, as_dict=1)
return sorted(list(payment_entries)+list(journal_entries),
pos_entries = []
if filters.include_pos_transactions:
pos_entries = frappe.db.sql("""
select
"Sales Invoice Payment" as payment_document, sip.name as payment_entry, sip.amount as debit,
si.posting_date, si.debit_to as against_account, sip.clearance_date,
account.account_currency, 0 as credit
from `tabSales Invoice Payment` sip, `tabSales Invoice` si, `tabAccount` account
where
sip.account=%(account)s and si.docstatus=1 and sip.parent = si.name
and account.name = sip.account and si.posting_date <= %(report_date)s and
ifnull(sip.clearance_date, '4000-01-01') > %(report_date)s
order by
si.posting_date ASC, si.name DESC
""", filters, as_dict=1)
return sorted(list(payment_entries)+list(journal_entries+list(pos_entries)),
key=lambda k: k['posting_date'] or getdate(nowdate()))
def get_amounts_not_reflected_in_system(filters):

View File

@@ -8,6 +8,13 @@
{%= filters.account %}
{% } %}
</h4>
<h6 class="text-center">
{% if (filters.tax_id) { %}
{%= __("Tax Id: ")%} {%= filters.tax_id %}
{% } %}
</h6>
<h5 class="text-center">
{%= dateutil.str_to_user(filters.from_date) %}
{%= __("to") %}

View File

@@ -61,7 +61,10 @@ frappe.query_reports["General Ledger"] = {
"label": __("Party Type"),
"fieldtype": "Link",
"options": "Party Type",
"default": ""
"default": "",
on_change: function() {
frappe.query_report_filters_by_name.party.set_value("");
}
},
{
"fieldname":"party",
@@ -82,11 +85,16 @@ frappe.query_reports["General Ledger"] = {
frappe.query_report_filters_by_name.party_name.set_value("");
return;
}
var fieldname = frappe.scrub(party_type) + "_name";
var fieldname = erpnext.utils.get_party_name(party_type) || "name";
frappe.db.get_value(party_type, party, fieldname, function(value) {
frappe.query_report_filters_by_name.party_name.set_value(value[fieldname]);
});
if (party_type === "Customer" || party_type === "Supplier") {
frappe.db.get_value(party_type, party, "tax_id", function(value) {
frappe.query_report_filters_by_name.tax_id.set_value(value["tax_id"]);
});
}
}
},
{
@@ -95,6 +103,12 @@ frappe.query_reports["General Ledger"] = {
"fieldtype": "Data",
"hidden": 1
},
{
"fieldname":"tax_id",
"label": __("Tax Id"),
"fieldtype": "Data",
"hidden": 1
},
{
"fieldname":"group_by_voucher",
"label": __("Group by Voucher"),

View File

@@ -71,7 +71,7 @@ def set_account_currency(filters):
if gle_currency:
account_currency = gle_currency
else:
account_currency = None if filters.party_type == "Employee" else \
account_currency = None if filters.party_type in ["Employee", "Student", "Shareholder"] else \
frappe.db.get_value(filters.party_type, filters.party, "default_currency")
filters["account_currency"] = account_currency or filters.company_currency

View File

@@ -105,7 +105,7 @@ def get_conditions(filters):
if filters.get("mode_of_payment"):
conditions += """ and exists(select name from `tabSales Invoice Payment`
where parent=si.name
where parent=`tabSales Invoice`.name
and ifnull(`tabSales Invoice Payment`.mode_of_payment, '') = %(mode_of_payment)s)"""
return conditions

View File

@@ -43,7 +43,7 @@ def _execute(filters=None, additional_table_columns=None, additional_query_colum
row += [
supplier_details.get(inv.supplier), # supplier_type
inv.credit_to, inv.mode_of_payment, ", ".join(project),
inv.tax_id, inv.credit_to, inv.mode_of_payment, ", ".join(project),
inv.bill_no, inv.bill_date, inv.remarks,
", ".join(purchase_order), ", ".join(purchase_receipt), company_currency
]
@@ -83,7 +83,7 @@ def get_columns(invoice_list, additional_table_columns):
columns += additional_table_columns
columns += [
_("Supplier Type") + ":Link/Supplier Type:120", _("Payable Account") + ":Link/Account:120",
_("Supplier Type") + ":Link/Supplier Type:120", _("Tax Id") + "::80", _("Payable Account") + ":Link/Account:120",
_("Mode of Payment") + ":Link/Mode of Payment:80", _("Project") + ":Link/Project:80",
_("Bill No") + "::120", _("Bill Date") + ":Date:80", _("Remarks") + "::150",
_("Purchase Order") + ":Link/Purchase Order:100",
@@ -143,7 +143,7 @@ def get_invoices(filters, additional_query_columns):
conditions = get_conditions(filters)
return frappe.db.sql("""
select
name, posting_date, credit_to, supplier, supplier_name, bill_no, bill_date,
name, posting_date, credit_to, supplier, supplier_name, tax_id, bill_no, bill_date,
remarks, base_net_total, base_grand_total, outstanding_amount,
mode_of_payment {0}
from `tabPurchase Invoice`

View File

@@ -25,8 +25,6 @@ def _execute(filters, additional_table_columns=None, additional_query_columns=No
#Cost Center & Warehouse Map
invoice_cc_wh_map = get_invoice_cc_wh_map(invoice_list)
invoice_so_dn_map = get_invoice_so_dn_map(invoice_list)
customers = list(set([inv.customer for inv in invoice_list]))
customer_map = get_customer_details(customers)
company_currency = frappe.db.get_value("Company", filters.get("company"), "default_currency")
mode_of_payments = get_mode_of_payments([inv.name for inv in invoice_list])
@@ -38,7 +36,6 @@ def _execute(filters, additional_table_columns=None, additional_query_columns=No
cost_center = list(set(invoice_cc_wh_map.get(inv.name, {}).get("cost_center", [])))
warehouse = list(set(invoice_cc_wh_map.get(inv.name, {}).get("warehouse", [])))
customer_details = customer_map.get(inv.customer, {})
row = [
inv.name, inv.posting_date, inv.customer, inv.customer_name
]
@@ -48,8 +45,9 @@ def _execute(filters, additional_table_columns=None, additional_query_columns=No
row.append(inv.get(col))
row +=[
customer_details.get("customer_group"),
customer_details.get("territory"),
inv.get("customer_group"),
inv.get("territory"),
inv.get("tax_id"),
inv.debit_to, ", ".join(mode_of_payments.get(inv.name, [])),
inv.project, inv.owner, inv.remarks,
", ".join(sales_order), ", ".join(delivery_note),", ".join(cost_center),
@@ -92,7 +90,7 @@ def get_columns(invoice_list, additional_table_columns):
columns +=[
_("Customer Group") + ":Link/Customer Group:120", _("Territory") + ":Link/Territory:80",
_("Receivable Account") + ":Link/Account:120", _("Mode of Payment") + "::120",
_("Tax Id") + "::80", _("Receivable Account") + ":Link/Account:120", _("Mode of Payment") + "::120",
_("Project") +":Link/Project:80", _("Owner") + "::150", _("Remarks") + "::150",
_("Sales Order") + ":Link/Sales Order:100", _("Delivery Note") + ":Link/Delivery Note:100",
_("Cost Center") + ":Link/Cost Center:100", _("Warehouse") + ":Link/Warehouse:100",
@@ -162,7 +160,9 @@ def get_invoices(filters, additional_query_columns):
additional_query_columns = ', ' + ', '.join(additional_query_columns)
conditions = get_conditions(filters)
return frappe.db.sql("""select name, posting_date, debit_to, project, customer, customer_name, owner, remarks,
return frappe.db.sql("""
select name, posting_date, debit_to, project, customer,
customer_name, owner, remarks, territory, tax_id, customer_group,
base_net_total, base_grand_total, base_rounded_total, outstanding_amount {0}
from `tabSales Invoice`
where docstatus = 1 %s order by posting_date desc, name desc""".format(additional_query_columns or '') %
@@ -241,15 +241,6 @@ def get_invoice_cc_wh_map(invoice_list):
return invoice_cc_wh_map
def get_customer_details(customers):
customer_map = {}
for cust in frappe.db.sql("""select name, territory, customer_group from `tabCustomer`
where name in (%s)""" % ", ".join(["%s"]*len(customers)), tuple(customers), as_dict=1):
customer_map.setdefault(cust.name, cust)
return customer_map
def get_mode_of_payments(invoice_list):
mode_of_payments = {}
if invoice_list:

View File

@@ -5,6 +5,7 @@
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from frappe import _
class Crop(Document):
def validate(self):
@@ -12,7 +13,7 @@ class Crop(Document):
for task in self.agriculture_task:
# validate start_day is not > end_day
if task.start_day > task.end_day:
frappe.throw("Start day is greater than end day in task '{0}'".format(task.subject))
frappe.throw(_("Start day is greater than end day in task '{0}'").format(task.task_name))
# to calculate the period of the Crop Cycle
if task.end_day > max_period: max_period = task.end_day
if max_period > self.period: self.period = max_period

View File

@@ -5,6 +5,7 @@
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from frappe import _
class Disease(Document):
def validate(self):
@@ -12,7 +13,7 @@ class Disease(Document):
for task in self.treatment_task:
# validate start_day is not > end_day
if task.start_day > task.end_day:
frappe.throw("Start day is greater than end day in task '{0}'".format(task.task_name))
frappe.throw(_("Start day is greater than end day in task '{0}'").format(task.task_name))
# to calculate the period of the Crop Cycle
if task.end_day > max_period: max_period = task.end_day
self.treatment_period = max_period

View File

@@ -6,6 +6,7 @@ from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from frappe.utils import flt, cint
from frappe import _
class SoilTexture(Document):
soil_edit_order = [2, 1, 0]
@@ -20,9 +21,9 @@ class SoilTexture(Document):
self.update_soil_edit('sand_composition')
for soil_type in self.soil_types:
if self.get(soil_type) > 100 or self.get(soil_type) < 0:
frappe.throw("{0} should be a value between 0 and 100".format(soil_type))
frappe.throw(_("{0} should be a value between 0 and 100").format(soil_type))
if sum(self.get(soil_type) for soil_type in self.soil_types) != 100:
frappe.throw('Soil compositions do not add up to 100')
frappe.throw(_('Soil compositions do not add up to 100'))
def update_soil_edit(self, soil_type):
self.soil_edit_order[self.soil_types.index(soil_type)] = max(self.soil_edit_order)+1

View File

@@ -5,6 +5,7 @@
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from frappe import _
class WaterAnalysis(Document):
def load_contents(self):
@@ -18,6 +19,6 @@ class WaterAnalysis(Document):
def validate(self):
if self.collection_datetime > self.laboratory_testing_datetime:
frappe.throw('Lab testing datetime cannot be before collection datetime')
frappe.throw(_('Lab testing datetime cannot be before collection datetime'))
if self.laboratory_testing_datetime > self.result_datetime:
frappe.throw('Lab result datetime cannot be before testing datetime')
frappe.throw(_('Lab result datetime cannot be before testing datetime'))

View File

@@ -15,6 +15,15 @@ frappe.ui.form.on("Purchase Order", {
frm.set_indicator_formatter('item_code',
function(doc) { return (doc.qty<=doc.received_qty) ? "green" : "orange" })
frm.set_query("reserve_warehouse", "supplied_items", function() {
return {
filters: {
"company": frm.doc.company,
"is_group": 0
}
}
});
},
onload: function(frm) {
@@ -134,23 +143,124 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend(
var items = $.map(cur_frm.doc.items, function(d) { return d.bom ? d.item_code : false; });
var me = this;
if(items.length===1) {
me._make_stock_entry(items[0]);
return;
if(items.length >= 1){
me.raw_material_data = [];
me.show_dialog = 1;
let title = "";
let fields = [
{fieldtype:'Section Break', label: __('Raw Materials')},
{fieldname: 'sub_con_rm_items', fieldtype: 'Table',
fields: [
{
fieldtype:'Data',
fieldname:'item_code',
label: __('Item'),
read_only:1,
in_list_view:1
},
{
fieldtype:'Data',
fieldname:'rm_item_code',
label: __('Raw Material'),
read_only:1,
in_list_view:1
},
{
fieldtype:'Float',
read_only:1,
fieldname:'qty',
label: __('Quantity'),
read_only:1,
in_list_view:1
},
{
fieldtype:'Data',
read_only:1,
fieldname:'warehouse',
label: __('Reserve Warehouse'),
in_list_view:1
},
{
fieldtype:'Float',
read_only:1,
fieldname:'rate',
label: __('Rate'),
hidden:1
},
{
fieldtype:'Float',
read_only:1,
fieldname:'amount',
label: __('Amount'),
hidden:1
},
{
fieldtype:'Link',
read_only:1,
fieldname:'uom',
label: __('UOM'),
hidden:1
}
],
data: me.raw_material_data,
get_data: function() {
return me.raw_material_data;
}
}
]
me.dialog = new frappe.ui.Dialog({
title: title, fields: fields
});
if (me.frm.doc['supplied_items']) {
me.frm.doc['supplied_items'].forEach((item, index) => {
if (item.rm_item_code && item.main_item_code) {
me.raw_material_data.push ({
'name':item.name,
'item_code': item.main_item_code,
'rm_item_code': item.rm_item_code,
'item_name': item.rm_item_code,
'qty': item.required_qty,
'warehouse':item.reserve_warehouse,
'rate':item.rate,
'amount':item.amount,
'stock_uom':item.stock_uom
});
me.dialog.fields_dict.sub_con_rm_items.grid.refresh();
}
})
}
frappe.prompt({fieldname:"item", options: items, fieldtype:"Select",
label: __("Select Item for Transfer"), reqd: 1}, function(data) {
me._make_stock_entry(data.item);
}, __("Select Item"), __("Make"));
me.dialog.show()
this.dialog.set_primary_action(__('Transfer'), function() {
me.values = me.dialog.get_values();
if(me.values) {
me.values.sub_con_rm_items.map((row,i) => {
if (!row.item_code || !row.rm_item_code || !row.warehouse || !row.qty || row.qty === 0) {
frappe.throw(__("Item Code, warehouse, quantity are required on row" + (i+1)));
}
})
me._make_rm_stock_entry(me.dialog.fields_dict.sub_con_rm_items.grid.get_selected_children())
me.dialog.hide()
}
});
}
me.dialog.get_close_btn().on('click', () => {
me.dialog.hide();
});
},
_make_stock_entry: function(item) {
_make_rm_stock_entry: function(rm_items) {
frappe.call({
method:"erpnext.buying.doctype.purchase_order.purchase_order.make_stock_entry",
method:"erpnext.buying.doctype.purchase_order.purchase_order.make_rm_stock_entry",
args: {
purchase_order: cur_frm.doc.name,
item_code: item
},
rm_items: rm_items
}
,
callback: function(r) {
var doclist = frappe.model.sync(r.message);
frappe.set_route("Form", doclist[0].doctype, doclist[0].name);
@@ -284,7 +394,8 @@ cur_frm.fields_dict['items'].grid.get_field('bom').get_query = function(doc, cdt
filters: [
['BOM', 'item', '=', d.item_code],
['BOM', 'is_active', '=', '1'],
['BOM', 'docstatus', '=', '1']
['BOM', 'docstatus', '=', '1'],
['BOM', 'company', '=', doc.company]
]
}
}

View File

@@ -3133,6 +3133,38 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.is_subcontracted",
"fieldname": "supplied_items_section",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Supplied Items",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "",
"fieldname": "supplied_items",
"fieldtype": "Table",
"hidden": 0,

View File

@@ -12,7 +12,7 @@ from erpnext.stock.doctype.item.item import get_last_purchase_details
from erpnext.stock.stock_balance import update_bin_qty, get_ordered_qty
from frappe.desk.notifications import clear_doctype_notifications
from erpnext.buying.utils import validate_for_items, check_for_closed_status
from erpnext.stock.utils import get_bin
form_grid_templates = {
"items": "templates/form_grid/item_grid.html"
@@ -30,8 +30,7 @@ class PurchaseOrder(BuyingController):
'target_parent_field': 'per_ordered',
'target_ref_field': 'stock_qty',
'source_field': 'stock_qty',
'percent_join_field': 'material_request',
'overflow_type': 'order'
'percent_join_field': 'material_request'
}]
def onload(self):
@@ -81,8 +80,10 @@ class PurchaseOrder(BuyingController):
def validate_supplier(self):
prevent_po = frappe.db.get_value("Supplier", self.supplier, 'prevent_pos')
if prevent_po:
standing = frappe.db.get_value("Supplier Scorecard",self.supplier, 'status')
frappe.throw(_("Purchase Orders are not allowed for {0} due to a scorecard standing of {1}.").format(self.supplier, standing))
standing = frappe.db.get_value("Supplier Scorecard", self.supplier, 'status')
if standing:
frappe.throw(_("Purchase Orders are not allowed for {0} due to a scorecard standing of {1}.")
.format(self.supplier, standing))
warn_po = frappe.db.get_value("Supplier", self.supplier, 'warn_pos')
if warn_po:
@@ -193,6 +194,9 @@ class PurchaseOrder(BuyingController):
self.set_status(update=True, status=status)
self.update_requested_qty()
self.update_ordered_qty()
if self.is_subcontracted == "Yes":
self.update_reserved_qty_for_subcontract()
self.notify_update()
clear_doctype_notifications(self)
@@ -205,6 +209,8 @@ class PurchaseOrder(BuyingController):
self.update_prevdoc_status()
self.update_requested_qty()
self.update_ordered_qty()
if self.is_subcontracted == "Yes":
self.update_reserved_qty_for_subcontract()
frappe.get_doc('Authorization Control').validate_approving_authority(self.doctype,
self.company, self.base_grand_total)
@@ -218,6 +224,9 @@ class PurchaseOrder(BuyingController):
if self.has_drop_ship_item():
self.update_delivered_qty_in_sales_order()
if self.is_subcontracted == "Yes":
self.update_reserved_qty_for_subcontract()
self.check_for_closed_status()
frappe.db.set(self,'status','Cancelled')
@@ -232,12 +241,16 @@ class PurchaseOrder(BuyingController):
pass
def update_status_updater(self):
self.status_updater[0].update({
"target_parent_dt": "Sales Order",
"target_dt": "Sales Order Item",
self.status_updater.append({
'source_dt': 'Purchase Order Item',
'target_dt': 'Sales Order Item',
'target_field': 'ordered_qty',
"join_field": "sales_order_item",
"target_parent_field": ''
'target_parent_dt': 'Sales Order',
'target_parent_field': '',
'join_field': 'sales_order_item',
'source_dt': 'Purchase Order Item',
'target_ref_field': 'stock_qty',
'source_field': 'stock_qty'
})
def update_delivered_qty_in_sales_order(self):
@@ -265,6 +278,12 @@ class PurchaseOrder(BuyingController):
if item.delivered_by_supplier == 1:
item.received_qty = item.qty
def update_reserved_qty_for_subcontract(self):
for d in self.supplied_items:
if d.rm_item_code:
stock_bin = get_bin(d.rm_item_code, d.reserve_warehouse)
stock_bin.update_reserved_qty_for_sub_contracting()
def item_last_purchase_rate(name, conversion_rate, item_code, conversion_factor= 1.0):
"""get last purchase rate for an item"""
if cint(frappe.db.get_single_value("Buying Settings", "disable_fetch_last_purchase_rate")): return
@@ -385,23 +404,52 @@ def make_purchase_invoice(source_name, target_doc=None):
return doc
@frappe.whitelist()
def make_stock_entry(purchase_order, item_code):
purchase_order = frappe.get_doc("Purchase Order", purchase_order)
def make_rm_stock_entry(purchase_order, rm_items):
if isinstance(rm_items, basestring):
rm_items_list = json.loads(rm_items)
else:
frappe.throw(_("No Items available for transfer"))
stock_entry = frappe.new_doc("Stock Entry")
stock_entry.purpose = "Subcontract"
stock_entry.purchase_order = purchase_order.name
stock_entry.supplier = purchase_order.supplier
stock_entry.supplier_name = purchase_order.supplier_name
stock_entry.supplier_address = purchase_order.supplier_address
stock_entry.address_display = purchase_order.address_display
stock_entry.company = purchase_order.company
stock_entry.from_bom = 1
po_item = [d for d in purchase_order.items if d.item_code == item_code][0]
stock_entry.fg_completed_qty = po_item.qty
stock_entry.bom_no = po_item.bom
stock_entry.get_items()
return stock_entry.as_dict()
if rm_items_list:
fg_items = list(set(d["item_code"] for d in rm_items_list))
else:
frappe.throw(_("No Items selected for transfer"))
if purchase_order:
purchase_order = frappe.get_doc("Purchase Order", purchase_order)
if fg_items:
items = tuple(set(d["rm_item_code"] for d in rm_items_list))
item_wh = frappe._dict(frappe.db.sql("""
select item_code, description
from `tabItem` where name in ({0})
""".format(", ".join(["%s"] * len(items))), items))
stock_entry = frappe.new_doc("Stock Entry")
stock_entry.purpose = "Subcontract"
stock_entry.purchase_order = purchase_order.name
stock_entry.supplier = purchase_order.supplier
stock_entry.supplier_name = purchase_order.supplier_name
stock_entry.supplier_address = purchase_order.supplier_address
stock_entry.address_display = purchase_order.address_display
stock_entry.company = purchase_order.company
for item_code in fg_items:
for rm_item_data in rm_items_list:
if rm_item_data["item_code"] == item_code:
items_dict = {
rm_item_data["rm_item_code"]: {
"item_name":rm_item_data["item_name"],
"description":item_wh.get(rm_item_data["rm_item_code"]),
'qty':rm_item_data["qty"],
'from_warehouse':rm_item_data["warehouse"],
'stock_uom':rm_item_data["stock_uom"]
}
}
stock_entry.add_to_stock_entry_detail(items_dict)
return stock_entry.as_dict()
else:
frappe.throw(_("No Items selected for transfer"))
return purchase_order.name
@frappe.whitelist()
def update_status(status, name):

View File

@@ -6,8 +6,9 @@ import unittest
import frappe
import frappe.defaults
from frappe.utils import flt, add_days, nowdate
from erpnext.buying.doctype.purchase_order.purchase_order import make_purchase_receipt, make_purchase_invoice
from erpnext.buying.doctype.purchase_order.purchase_order import (make_purchase_receipt, make_purchase_invoice, make_rm_stock_entry as make_subcontract_transfer_entry)
from erpnext.stock.doctype.stock_entry.test_stock_entry import make_stock_entry
import json
class TestPurchaseOrder(unittest.TestCase):
def test_make_purchase_receipt(self):
@@ -182,24 +183,129 @@ class TestPurchaseOrder(unittest.TestCase):
pi.insert()
self.assertTrue(pi.get('payment_schedule'))
def test_reserved_qty_subcontract_po(self):
# Make stock available for raw materials
make_stock_entry(target="_Test Warehouse - _TC", qty=10, basic_rate=100)
make_stock_entry(target="_Test Warehouse - _TC", item_code="_Test Item Home Desktop 100",
qty=20, basic_rate=100)
bin1 = frappe.db.get_value("Bin",
filters={"warehouse": "_Test Warehouse - _TC", "item_code": "_Test Item"},
fieldname=["reserved_qty_for_sub_contract", "projected_qty"], as_dict=1)
# Submit PO
po = create_purchase_order(item_code="_Test FG Item", is_subcontracted="Yes")
bin2 = frappe.db.get_value("Bin",
filters={"warehouse": "_Test Warehouse - _TC", "item_code": "_Test Item"},
fieldname=["reserved_qty_for_sub_contract", "projected_qty"], as_dict=1)
self.assertEquals(bin2.reserved_qty_for_sub_contract, bin1.reserved_qty_for_sub_contract + 10)
self.assertEquals(bin2.projected_qty, bin1.projected_qty - 10)
# Create stock transfer
rm_item = [{"item_code":"_Test FG Item","rm_item_code":"_Test Item","item_name":"_Test Item",
"qty":6,"warehouse":"_Test Warehouse - _TC","rate":100,"amount":600,"stock_uom":"Nos"}]
rm_item_string = json.dumps(rm_item)
se = frappe.get_doc(make_subcontract_transfer_entry(po.name, rm_item_string))
se.to_warehouse = "_Test Warehouse 1 - _TC"
se.save()
se.submit()
bin3 = frappe.db.get_value("Bin",
filters={"warehouse": "_Test Warehouse - _TC", "item_code": "_Test Item"},
fieldname="reserved_qty_for_sub_contract", as_dict=1)
self.assertEquals(bin3.reserved_qty_for_sub_contract, bin2.reserved_qty_for_sub_contract - 6)
# close PO
po.update_status("Closed")
bin4 = frappe.db.get_value("Bin",
filters={"warehouse": "_Test Warehouse - _TC", "item_code": "_Test Item"},
fieldname="reserved_qty_for_sub_contract", as_dict=1)
self.assertEquals(bin4.reserved_qty_for_sub_contract, bin1.reserved_qty_for_sub_contract)
# Re-open PO
po.update_status("Submitted")
bin5 = frappe.db.get_value("Bin",
filters={"warehouse": "_Test Warehouse - _TC", "item_code": "_Test Item"},
fieldname="reserved_qty_for_sub_contract", as_dict=1)
self.assertEquals(bin5.reserved_qty_for_sub_contract, bin2.reserved_qty_for_sub_contract - 6)
# make Purchase Receipt against PO
pr = make_purchase_receipt(po.name)
pr.supplier_warehouse = "_Test Warehouse 1 - _TC"
pr.save()
pr.submit()
bin6 = frappe.db.get_value("Bin",
filters={"warehouse": "_Test Warehouse - _TC", "item_code": "_Test Item"},
fieldname="reserved_qty_for_sub_contract", as_dict=1)
self.assertEquals(bin6.reserved_qty_for_sub_contract, bin1.reserved_qty_for_sub_contract)
# Cancel PR
pr.cancel()
bin7 = frappe.db.get_value("Bin",
filters={"warehouse": "_Test Warehouse - _TC", "item_code": "_Test Item"},
fieldname="reserved_qty_for_sub_contract", as_dict=1)
self.assertEquals(bin7.reserved_qty_for_sub_contract, bin2.reserved_qty_for_sub_contract - 6)
# Make Purchase Invoice
pi = make_purchase_invoice(po.name)
pi.update_stock = 1
pi.supplier_warehouse = "_Test Warehouse 1 - _TC"
pi.insert()
pi.submit()
bin8 = frappe.db.get_value("Bin",
filters={"warehouse": "_Test Warehouse - _TC", "item_code": "_Test Item"},
fieldname="reserved_qty_for_sub_contract", as_dict=1)
self.assertEquals(bin8.reserved_qty_for_sub_contract, bin1.reserved_qty_for_sub_contract)
# Cancel PR
pi.cancel()
bin9 = frappe.db.get_value("Bin",
filters={"warehouse": "_Test Warehouse - _TC", "item_code": "_Test Item"},
fieldname="reserved_qty_for_sub_contract", as_dict=1)
self.assertEquals(bin9.reserved_qty_for_sub_contract, bin2.reserved_qty_for_sub_contract - 6)
# Cancel Stock Entry
se.cancel()
bin10 = frappe.db.get_value("Bin",
filters={"warehouse": "_Test Warehouse - _TC", "item_code": "_Test Item"},
fieldname="reserved_qty_for_sub_contract", as_dict=1)
self.assertEquals(bin10.reserved_qty_for_sub_contract, bin1.reserved_qty_for_sub_contract + 10)
# Cancel PO
po.reload()
po.cancel()
bin11 = frappe.db.get_value("Bin",
filters={"warehouse": "_Test Warehouse - _TC", "item_code": "_Test Item"},
fieldname="reserved_qty_for_sub_contract", as_dict=1)
self.assertEquals(bin11.reserved_qty_for_sub_contract, bin1.reserved_qty_for_sub_contract)
def get_same_items():
return [
{
"item_code": "_Test FG Item",
"warehouse": "_Test Warehouse - _TC",
"qty": 1,
"rate": 500,
"schedule_date": add_days(nowdate(), 1)
},
{
"item_code": "_Test FG Item",
"warehouse": "_Test Warehouse - _TC",
"qty": 4,
"rate": 500,
"schedule_date": add_days(nowdate(), 1)
}
]
{
"item_code": "_Test FG Item",
"warehouse": "_Test Warehouse - _TC",
"qty": 1,
"rate": 500,
"schedule_date": add_days(nowdate(), 1)
},
{
"item_code": "_Test FG Item",
"warehouse": "_Test Warehouse - _TC",
"qty": 4,
"rate": 500,
"schedule_date": add_days(nowdate(), 1)
}
]
def create_purchase_order(**args):
po = frappe.new_doc("Purchase Order")
@@ -224,6 +330,10 @@ def create_purchase_order(**args):
if not args.do_not_save:
po.insert()
if not args.do_not_submit:
if po.is_subcontracted == "Yes":
supp_items = po.get("supplied_items")
for d in supp_items:
d.reserve_warehouse = args.warehouse or "_Test Warehouse - _TC"
po.submit()
return po

View File

@@ -1,5 +1,6 @@
{
"allow_copy": 0,
"allow_guest_to_view": 0,
"allow_import": 0,
"allow_rename": 0,
"beta": 0,
@@ -10,68 +11,86 @@
"editable_grid": 1,
"fields": [
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 2,
"fieldname": "main_item_code",
"fieldtype": "Data",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Item Code",
"length": 0,
"no_copy": 0,
"oldfieldname": "main_item_code",
"oldfieldtype": "Data",
"options": "Item",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 2,
"fieldname": "rm_item_code",
"fieldtype": "Data",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Raw Material Item Code",
"length": 0,
"no_copy": 0,
"oldfieldname": "rm_item_code",
"oldfieldtype": "Data",
"options": "Item",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 2,
"fieldname": "required_qty",
"fieldtype": "Float",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Supplied Qty",
"length": 0,
"no_copy": 0,
@@ -81,23 +100,29 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 2,
"fieldname": "rate",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Rate",
"length": 0,
"no_copy": 0,
@@ -108,23 +133,29 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "amount",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Amount",
"length": 0,
"no_copy": 0,
@@ -135,23 +166,59 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "column_break_6",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "bom_detail_no",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "BOM Detail No",
"length": 0,
"no_copy": 0,
@@ -161,23 +228,29 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "reference_name",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Reference Name",
"length": 0,
"no_copy": 0,
@@ -187,23 +260,29 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "conversion_factor",
"fieldtype": "Float",
"hidden": 1,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Conversion Factor",
"length": 0,
"no_copy": 0,
@@ -213,23 +292,29 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "stock_uom",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Stock Uom",
"length": 0,
"no_copy": 0,
@@ -240,24 +325,58 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 2,
"fieldname": "reserve_warehouse",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Reserve Warehouse",
"length": 0,
"no_copy": 0,
"options": "Warehouse",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
}
],
"has_web_view": 0,
"hide_heading": 0,
"hide_toolbar": 1,
"idx": 1,
"image_view": 0,
"in_create": 0,
"in_dialog": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 1,
"max_attachments": 0,
"modified": "2016-07-11 03:28:05.533063",
"modified": "2018-03-13 12:37:57.150914",
"modified_by": "Administrator",
"module": "Buying",
"name": "Purchase Order Item Supplied",
@@ -266,5 +385,7 @@
"quick_entry": 0,
"read_only": 0,
"read_only_onload": 0,
"show_name_in_global_search": 0,
"track_changes": 0,
"track_seen": 0
}

View File

@@ -1,5 +1,6 @@
{
"allow_copy": 0,
"allow_guest_to_view": 0,
"allow_import": 0,
"allow_rename": 0,
"beta": 0,
@@ -11,12 +12,13 @@
"engine": "InnoDB",
"fields": [
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "main_item_code",
"fieldtype": "Data",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
@@ -29,6 +31,7 @@
"no_copy": 0,
"oldfieldname": "main_item_code",
"oldfieldtype": "Data",
"options": "Item",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
@@ -38,15 +41,17 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "rm_item_code",
"fieldtype": "Data",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
@@ -59,6 +64,7 @@
"no_copy": 0,
"oldfieldname": "rm_item_code",
"oldfieldtype": "Data",
"options": "Item",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
@@ -68,9 +74,11 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -99,10 +107,12 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0,
"width": "300px"
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -129,9 +139,11 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -157,9 +169,11 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -184,9 +198,11 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -214,9 +230,11 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -244,9 +262,11 @@
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -275,9 +295,11 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -306,9 +328,11 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -337,9 +361,11 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -367,9 +393,11 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -397,9 +425,11 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -427,9 +457,11 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -457,20 +489,21 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
}
],
"has_web_view": 0,
"hide_heading": 0,
"hide_toolbar": 0,
"idx": 1,
"image_view": 0,
"in_create": 0,
"in_dialog": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 1,
"max_attachments": 0,
"modified": "2017-02-17 16:43:21.668443",
"modified": "2018-03-13 12:38:40.807453",
"modified_by": "Administrator",
"module": "Buying",
"name": "Purchase Receipt Item Supplied",

View File

@@ -126,6 +126,11 @@ def get_data():
"link": "Tree/Sales Person",
"description": _("Manage Sales Person Tree."),
},
{
"type": "doctype",
"name": "Lead Source",
"description": _("Track Leads by Lead Source.")
},
]
},
{

View File

@@ -200,7 +200,7 @@ def get_data():
"color": "#fd784f",
"icon": "octicon octicon-calendar",
"label": _("Course Schedule"),
"link": "Calendar/Course Schedule",
"link": "List/Course Schedule/Calendar",
"_doctype": "Course Schedule",
"type": "list",
"hidden": 1

View File

@@ -135,6 +135,10 @@ def get_data():
"name": "Assessment Plan Status",
"doctype": "Assessment Plan"
},
{
"type": "doctype",
"name": "Student Report Generation Tool"
}
]
},
{

View File

@@ -173,6 +173,11 @@ def get_data():
"name": "Industry Type",
"description": _("Track Leads by Industry Type.")
},
{
"type": "doctype",
"name": "Lead Source",
"description": _("Track Leads by Lead Source.")
},
]
},
{

View File

@@ -666,6 +666,10 @@ class AccountsController(TransactionBase):
self.remove(item)
def set_payment_schedule(self):
if self.doctype == 'Sales Invoice' and self.is_pos:
self.payment_terms_template = ''
return
posting_date = self.get("bill_date") or self.get("posting_date") or self.get("transaction_date")
date = self.get("due_date")
due_date = date or posting_date
@@ -695,6 +699,8 @@ class AccountsController(TransactionBase):
dates = []
li = []
if self.doctype == 'Sales Invoice' and self.is_pos: return
for d in self.get("payment_schedule"):
if self.doctype == "Sales Order" and getdate(d.due_date) < getdate(self.transaction_date):
frappe.throw(_("Row {0}: Due Date cannot be before posting date").format(d.idx))
@@ -708,6 +714,8 @@ class AccountsController(TransactionBase):
.format(list=duplicates))
def validate_payment_schedule_amount(self):
if self.doctype == 'Sales Invoice' and self.is_pos: return
if self.get("payment_schedule"):
total = 0
for d in self.get("payment_schedule"):

View File

@@ -163,6 +163,11 @@ class BuyingController(StockController):
if item in self.sub_contracted_items and not item.bom:
frappe.throw(_("Please select BOM in BOM field for Item {0}").format(item.item_code))
if self.doctype == "Purchase Order":
for supplied_item in self.get("supplied_items"):
if not supplied_item.reserve_warehouse:
frappe.throw(_("Reserved Warehouse is mandatory for Item {0} in Raw Materials supplied").format(frappe.bold(supplied_item.rm_item_code)))
else:
for item in self.get("items"):
if item.bom:
@@ -192,8 +197,16 @@ class BuyingController(StockController):
def update_raw_materials_supplied(self, item, raw_material_table):
bom_items = self.get_items_from_bom(item.item_code, item.bom)
raw_materials_cost = 0
items = list(set([d.item_code for d in bom_items]))
item_wh = frappe._dict(frappe.db.sql("""select item_code, default_warehouse
from `tabItem` where name in ({0})""".format(", ".join(["%s"] * len(items))), items))
for bom_item in bom_items:
if self.doctype == "Purchase Order":
reserve_warehouse = bom_item.source_warehouse or item_wh.get(bom_item.item_code)
if frappe.db.get_value("Warehouse", reserve_warehouse, "company") != self.company:
reserve_warehouse = None
# check if exists
exists = 0
for d in self.get(raw_material_table):
@@ -213,6 +226,8 @@ class BuyingController(StockController):
rm.rm_item_code = bom_item.item_code
rm.stock_uom = bom_item.stock_uom
rm.required_qty = required_qty
if self.doctype == "Purchase Order" and not rm.reserve_warehouse:
rm.reserve_warehouse = reserve_warehouse
rm.conversion_factor = item.conversion_factor
@@ -264,7 +279,7 @@ class BuyingController(StockController):
def get_items_from_bom(self, item_code, bom):
bom_items = frappe.db.sql("""select t2.item_code,
t2.stock_qty / ifnull(t1.quantity, 1) as qty_consumed_per_unit,
t2.rate, t2.stock_uom, t2.name, t2.description
t2.rate, t2.stock_uom, t2.name, t2.description, t2.source_warehouse
from `tabBOM` t1, `tabBOM Item` t2, tabItem t3
where t2.parent = t1.name and t1.item = %s
and t1.docstatus = 1 and t1.is_active = 1 and t1.name = %s
@@ -339,7 +354,7 @@ class BuyingController(StockController):
frappe.get_meta(item_row.doctype).get_label(fieldname), item_row['item_code'])))
def update_stock_ledger(self, allow_negative_stock=False, via_landed_cost_voucher=False):
self.update_ordered_qty()
self.update_ordered_and_reserved_qty()
sl_entries = []
stock_items = self.get_stock_items()
@@ -381,7 +396,7 @@ class BuyingController(StockController):
self.make_sl_entries(sl_entries, allow_negative_stock=allow_negative_stock,
via_landed_cost_voucher=via_landed_cost_voucher)
def update_ordered_qty(self):
def update_ordered_and_reserved_qty(self):
po_map = {}
for d in self.get("items"):
if self.doctype=="Purchase Receipt" \
@@ -400,6 +415,8 @@ class BuyingController(StockController):
frappe.InvalidStatusError)
po_obj.update_ordered_qty(po_item_rows)
if self.is_subcontracted:
po_obj.update_reserved_qty_for_subcontract()
def make_sl_entries_for_supplier_warehouse(self, sl_entries):
if hasattr(self, 'supplied_items'):

View File

@@ -92,7 +92,10 @@ def validate_is_incremental(numeric_attribute, attribute, value, item):
InvalidItemAttributeValueError, title=_('Invalid Attribute'))
def validate_item_attribute_value(attributes_list, attribute, attribute_value, item):
if attribute_value not in attributes_list:
allow_rename_attribute_value = frappe.db.get_single_value('Item Variant Settings', 'allow_rename_attribute_value')
if allow_rename_attribute_value:
pass
elif attribute_value not in attributes_list:
frappe.throw(_("Value {0} for Attribute {1} does not exist in the list of valid Item Attribute Values for Item {2}").format(
attribute_value, attribute, item), InvalidItemAttributeValueError, title=_('Invalid Attribute'))

View File

@@ -152,6 +152,11 @@ def tax_account_query(doctype, txt, searchfield, start, page_len, filters):
def item_query(doctype, txt, searchfield, start, page_len, filters, as_dict=False):
conditions = []
description_cond = ''
if frappe.db.count('Item', cache=True) < 50000:
# scan description only if items are less than 50000
description_cond = 'or tabItem.description LIKE %(txt)s'
return frappe.db.sql("""select tabItem.name, tabItem.item_group,
if(length(tabItem.item_name) > 40,
concat(substr(tabItem.item_name, 1, 40), "..."), item_name) as item_name,
@@ -166,7 +171,7 @@ def item_query(doctype, txt, searchfield, start, page_len, filters, as_dict=Fals
or tabItem.item_group LIKE %(txt)s
or tabItem.item_name LIKE %(txt)s
or tabItem.barcode LIKE %(txt)s
or tabItem.description LIKE %(txt)s)
{description_cond})
{fcond} {mcond}
order by
if(locate(%(_txt)s, name), locate(%(_txt)s, name), 99999),
@@ -176,7 +181,8 @@ def item_query(doctype, txt, searchfield, start, page_len, filters, as_dict=Fals
limit %(start)s, %(page_len)s """.format(
key=searchfield,
fcond=get_filters_cond(doctype, filters, conditions).replace('%', '%%'),
mcond=get_match_cond(doctype).replace('%', '%%')),
mcond=get_match_cond(doctype).replace('%', '%%'),
description_cond = description_cond),
{
"today": nowdate(),
"txt": "%%%s%%" % txt,

View File

@@ -53,8 +53,9 @@ def validate_returned_items(doc):
valid_items = frappe._dict()
select_fields = "item_code, qty, rate, parenttype" if doc.doctype=="Purchase Invoice" \
else "item_code, qty, rate, serial_no, batch_no, parenttype"
select_fields = "item_code, qty, stock_qty, rate, parenttype, conversion_factor"
if doc.doctype != 'Purchase Invoice':
select_fields += ",serial_no, batch_no"
if doc.doctype in ['Purchase Invoice', 'Purchase Receipt']:
select_fields += ",rejected_qty, received_qty"
@@ -111,7 +112,7 @@ def validate_returned_items(doc):
frappe.throw(_("Atleast one item should be entered with negative quantity in return document"))
def validate_quantity(doc, args, ref, valid_items, already_returned_items):
fields = ['qty']
fields = ['stock_qty']
if doc.doctype in ['Purchase Receipt', 'Purchase Invoice']:
fields.extend(['received_qty', 'rejected_qty'])
@@ -119,16 +120,19 @@ def validate_quantity(doc, args, ref, valid_items, already_returned_items):
for column in fields:
returned_qty = flt(already_returned_data.get(column, 0)) if len(already_returned_data) > 0 else 0
reference_qty = ref.get(column)
reference_qty = (ref.get(column) if column == 'stock_qty'
else ref.get(column) * ref.get("conversion_factor", 1.0))
max_returnable_qty = flt(reference_qty) - returned_qty
label = column.replace('_', ' ').title()
if reference_qty:
if flt(args.get(column)) > 0:
frappe.throw(_("{0} must be negative in return document").format(label))
elif returned_qty >= reference_qty and args.get(column):
frappe.throw(_("Item {0} has already been returned")
.format(args.item_code), StockOverReturnError)
elif abs(args.get(column)) > max_returnable_qty:
elif (abs(args.get(column)) * args.get("conversion_factor", 1.0)) > max_returnable_qty:
frappe.throw(_("Row # {0}: Cannot return more than {1} for Item {2}")
.format(args.idx, reference_qty, args.item_code), StockOverReturnError)
@@ -138,6 +142,7 @@ def get_ref_item_dict(valid_items, ref_item_row):
valid_items.setdefault(ref_item_row.item_code, frappe._dict({
"qty": 0,
"rate": 0,
"stock_qty": 0,
"rejected_qty": 0,
"received_qty": 0,
"serial_no": [],
@@ -145,6 +150,7 @@ def get_ref_item_dict(valid_items, ref_item_row):
}))
item_dict = valid_items[ref_item_row.item_code]
item_dict["qty"] += ref_item_row.qty
item_dict["stock_qty"] += ref_item_row.get('stock_qty', 0)
if ref_item_row.get("rate", 0) > item_dict["rate"]:
item_dict["rate"] = ref_item_row.get("rate", 0)
@@ -161,9 +167,10 @@ def get_ref_item_dict(valid_items, ref_item_row):
return valid_items
def get_already_returned_items(doc):
column = 'child.item_code, sum(abs(child.qty)) as qty'
column = 'child.item_code, sum(abs(child.qty)) as qty, sum(abs(child.stock_qty)) as stock_qty'
if doc.doctype in ['Purchase Invoice', 'Purchase Receipt']:
column += ', sum(abs(child.rejected_qty)) as rejected_qty, sum(abs(child.received_qty)) as received_qty'
column += """, sum(abs(child.rejected_qty) * child.conversion_factor) as rejected_qty,
sum(abs(child.received_qty) * child.conversion_factor) as received_qty"""
data = frappe.db.sql("""
select {0}
@@ -180,6 +187,7 @@ def get_already_returned_items(doc):
for d in data:
items.setdefault(d.item_code, frappe._dict({
"qty": d.get("qty"),
"stock_qty": d.get("stock_qty"),
"received_qty": d.get("received_qty"),
"rejected_qty": d.get("rejected_qty")
}))
@@ -231,6 +239,7 @@ def make_return_doc(doctype, source_name, target_doc=None):
target_doc.received_qty = -1* source_doc.received_qty
target_doc.rejected_qty = -1* source_doc.rejected_qty
target_doc.qty = -1* source_doc.qty
target_doc.stock_qty = -1 * source_doc.stock_qty
target_doc.purchase_order = source_doc.purchase_order
target_doc.purchase_order_item = source_doc.purchase_order_item
target_doc.rejected_warehouse = source_doc.rejected_warehouse
@@ -238,6 +247,7 @@ def make_return_doc(doctype, source_name, target_doc=None):
target_doc.received_qty = -1* source_doc.received_qty
target_doc.rejected_qty = -1* source_doc.rejected_qty
target_doc.qty = -1* source_doc.qty
target_doc.stock_qty = -1 * source_doc.stock_qty
target_doc.purchase_order = source_doc.purchase_order
target_doc.purchase_receipt = source_doc.purchase_receipt
target_doc.rejected_warehouse = source_doc.rejected_warehouse

View File

@@ -38,6 +38,7 @@ class SellingController(StockController):
self.validate_max_discount()
self.validate_selling_price()
self.set_qty_as_per_stock_uom()
self.set_po_nos()
check_active_sales_items(self)
def set_missing_values(self, for_validate=False):
@@ -326,9 +327,16 @@ class SellingController(StockController):
"actual_qty": -1*flt(d.qty),
"incoming_rate": return_rate
}))
self.make_sl_entries(sl_entries)
def set_po_nos(self):
if self.doctype in ("Delivery Note", "Sales Invoice") and hasattr(self, "items"):
ref_fieldname = "against_sales_order" if self.doctype == "Delivery Note" else "sales_order"
sales_orders = list(set([d.get(ref_fieldname) for d in self.items if d.get(ref_fieldname)]))
if sales_orders:
po_nos = frappe.get_all('Sales Order', 'po_no', filters = {'name': ('in', sales_orders)})
self.po_no = ', '.join(list(set([d.po_no for d in po_nos if d.po_no])))
def check_active_sales_items(obj):
for d in obj.get("items"):
if d.item_code:

View File

@@ -156,6 +156,9 @@ class StatusUpdater(Document):
# get unique transactions to update
for d in self.get_all_children():
if hasattr(d, 'qty') and d.qty < 0 and not self.get('is_return'):
frappe.throw(_("For an item {0}, quantity must be positive number").format(d.item_code))
if d.doctype == args['source_dt'] and d.get(args["join_field"]):
args['name'] = d.get(args['join_field'])
@@ -250,7 +253,7 @@ class StatusUpdater(Document):
if args['detail_id']:
if not args.get("extra_cond"): args["extra_cond"] = ""
frappe.db.sql("""update `tab%(target_dt)s`
set %(target_field)s = (
(select ifnull(sum(%(source_field)s), 0)
@@ -275,14 +278,14 @@ class StatusUpdater(Document):
"""Update percent field in parent transaction"""
self._update_modified(args, update_modified)
if args.get('target_parent_field'):
frappe.db.sql("""update `tab%(target_parent_dt)s`
set %(target_parent_field)s = round(
ifnull((select
ifnull(sum(if(%(target_ref_field)s > %(target_field)s, abs(%(target_field)s), abs(%(target_ref_field)s))), 0)
/ sum(abs(%(target_ref_field)s)) * 100
from `tab%(target_dt)s` where parent="%(name)s"), 0), 2)
from `tab%(target_dt)s` where parent="%(name)s" having sum(abs(%(target_ref_field)s)) > 0), 0), 6)
%(update_modified)s
where name='%(name)s'""" % args)
@@ -290,7 +293,7 @@ class StatusUpdater(Document):
if args.get('status_field'):
frappe.db.sql("""update `tab%(target_parent_dt)s`
set %(status_field)s = if(%(target_parent_field)s<0.001,
'Not %(keyword)s', if(%(target_parent_field)s>=99.99,
'Not %(keyword)s', if(%(target_parent_field)s>=99.999999,
'Fully %(keyword)s', 'Partly %(keyword)s'))
where name='%(name)s'""" % args)

View File

@@ -252,7 +252,7 @@ class StockController(AccountsController):
"company": self.company,
"batch_no": cstr(d.get("batch_no")).strip(),
"serial_no": d.get("serial_no"),
"project": d.get("project"),
"project": d.get("project") or self.get('project'),
"is_cancelled": self.docstatus==2 and "Yes" or "No"
})

View File

@@ -20,6 +20,10 @@ frappe.ui.form.on("Opportunity", {
frm.trigger('set_contact_link');
},
with_items: function(frm) {
frm.trigger('toggle_mandatory');
},
customer_address: function(frm, cdt, cdn) {
erpnext.utils.get_address_display(frm, 'customer_address', 'address_display', false);
},
@@ -35,6 +39,7 @@ frappe.ui.form.on("Opportunity", {
var doc = frm.doc;
frm.events.enquiry_from(frm);
frm.trigger('set_contact_link');
frm.trigger('toggle_mandatory');
erpnext.toggle_naming_series();
if(!doc.__islocal && doc.status!=="Lost") {
@@ -84,6 +89,10 @@ frappe.ui.form.on("Opportunity", {
method: "erpnext.crm.doctype.opportunity.opportunity.make_supplier_quotation",
frm: cur_frm
})
},
toggle_mandatory: function(frm) {
frm.toggle_reqd("items", frm.doc.with_items ? 1:0);
}
})

View File

@@ -34,14 +34,14 @@ def work():
payroll_entry.salary_slip_based_on_timesheet = 0
payroll_entry.create_salary_slips()
payroll_entry.submit_salary_slips()
payroll_entry.make_accural_jv_entry()
payroll_entry.make_accrual_jv_entry()
# payroll_entry.make_journal_entry(reference_date=frappe.flags.current_date,
# reference_number=random_string(10))
payroll_entry.salary_slip_based_on_timesheet = 1
payroll_entry.create_salary_slips()
payroll_entry.submit_salary_slips()
payroll_entry.make_accural_jv_entry()
payroll_entry.make_accrual_jv_entry()
# payroll_entry.make_journal_entry(reference_date=frappe.flags.current_date,
# reference_number=random_string(10))

View File

@@ -24,7 +24,7 @@ In the document, you can select multiple Purchase Receipts and fetch all items f
<img class="screenshot" alt="Landed Cost Vouher" src="/docs/assets/img/stock/landed-cost.png">
### What happend on submission?
### What happens on submission?
1. On submission of Landed Cost Voucher, the applicable landed cost charges are updated in Purchase Receipt Item table.

View File

@@ -38,9 +38,6 @@ frappe.ui.form.on('Fee Schedule', {
if (data.reload && data.reload === 1) {
frm.reload_doc();
}
if (data.progress && data.progress === "0") {
frappe.msgprint(__("Fee records will be created in the background. In case of any error the error message will be updated in the Schedule."));
}
if (data.progress) {
let progress_bar = $(cur_frm.dashboard.progress_area).find(".progress-bar");
if (progress_bar) {
@@ -74,6 +71,15 @@ frappe.ui.form.on('Fee Schedule', {
});
}, "fa fa-play", "btn-success");
}
if (frm.doc.fee_creation_status == "Successful") {
frm.add_custom_button(__("View Fees Records"), function() {
frappe.route_options = {
fee_schedule: frm.doc.name
};
frappe.set_route("List", "Fees");
});
}
},
fee_structure: function(frm) {

View File

@@ -4,7 +4,7 @@
"allow_import": 1,
"allow_rename": 0,
"autoname": "naming_series:",
"beta": 1,
"beta": 0,
"creation": "2017-07-18 15:21:21.527136",
"custom": 0,
"docstatus": 0,
@@ -1029,7 +1029,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2017-12-04 13:08:27.727709",
"modified": "2018-02-26 13:59:36.560780",
"modified_by": "Administrator",
"module": "Education",
"name": "Fee Schedule",

View File

@@ -56,8 +56,15 @@ class FeeSchedule(Document):
self.db_set("fee_creation_status", "In Process")
frappe.publish_realtime("fee_schedule_progress",
{"progress": "0", "reload": 1}, user=frappe.session.user)
enqueue(generate_fee, queue='default', timeout=6000, event='generate_fee',
fee_schedule=self.name)
total_records = sum([int(d.total_students) for d in self.student_groups])
if total_records > 10:
frappe.msgprint(_('''Fee records will be created in the background.
In case of any error the error message will be updated in the Schedule.'''))
enqueue(generate_fee, queue='default', timeout=6000, event='generate_fee',
fee_schedule=self.name)
else:
generate_fee(self.name)
def generate_fee(fee_schedule):
doc = frappe.get_doc("Fee Schedule", fee_schedule)
@@ -69,10 +76,7 @@ def generate_fee(fee_schedule):
frappe.throw(_("Please setup Students under Student Groups"))
for d in doc.student_groups:
students = frappe.db.sql(""" select sg.program, sg.batch, sgs.student, sgs.student_name
from `tabStudent Group` sg, `tabStudent Group Student` sgs
where sg.name=%s and sg.name=sgs.parent and sgs.active=1""", d.student_group, as_dict=1)
students = get_students(d.student_group, doc.academic_year, doc.academic_term, doc.student_category)
for student in students:
try:
fees_doc = get_mapped_doc("Fee Schedule", fee_schedule, {
@@ -86,7 +90,7 @@ def generate_fee(fee_schedule):
fees_doc.student = student.student
fees_doc.student_name = student.student_name
fees_doc.program = student.program
fees_doc.student_batch = student.batch
fees_doc.student_batch = student.student_batch_name
fees_doc.send_payment_request = doc.send_email
fees_doc.save()
fees_doc.submit()
@@ -110,6 +114,30 @@ def generate_fee(fee_schedule):
{"progress": "100", "reload": 1}, user=frappe.session.user)
def get_students(student_group, academic_year, academic_term=None, student_category=None):
conditions = ""
if student_category:
conditions = " and pe.student_category='{}'".format(frappe.db.escape(student_category))
if academic_term:
conditions = " and pe.academic_term='{}'".format(frappe.db.escape(academic_term))
students = frappe.db.sql("""
select pe.student, pe.student_name, pe.program, pe.student_batch_name
from `tabStudent Group Student` sgs, `tabProgram Enrollment` pe
where
pe.student = sgs.student and pe.academic_year = %s
and sgs.parent = %s and sgs.active = 1
{conditions}
""".format(conditions=conditions), (academic_year, student_group), as_dict=1)
return students
@frappe.whitelist()
def get_total_students(student_group, academic_year, academic_term=None, student_category=None):
total_students = get_students(student_group, academic_year, academic_term, student_category)
return len(total_students)
@frappe.whitelist()
def get_fee_structure(source_name,target_doc=None):
fee_request = get_mapped_doc("Fee Structure", source_name,
@@ -117,23 +145,3 @@ def get_fee_structure(source_name,target_doc=None):
"doctype": "Fee Schedule"
}}, ignore_permissions=True)
return fee_request
@frappe.whitelist()
def get_total_students(student_group, academic_year, academic_term=None, student_category=None):
conditions = ""
if student_category:
conditions = " and pe.student_category='{}'".format(frappe.db.escape(student_category))
if academic_term:
conditions = " and pe.academic_term='{}'".format(frappe.db.escape(academic_term))
return frappe.db.sql("""
select count(pe.name)
from `tabStudent Group Student` sgs, `tabProgram Enrollment` pe
where
pe.student = sgs.student
and pe.academic_year = %s
and sgs.parent = %s
and sgs.active = 1
{conditions}
""".format(conditions=conditions), (academic_year, student_group))[0][0]

View File

@@ -2,7 +2,7 @@
"allow_copy": 0,
"allow_guest_to_view": 0,
"allow_import": 1,
"allow_rename": 0,
"allow_rename": 1,
"autoname": "GARD.####",
"beta": 0,
"creation": "2016-07-21 15:32:51.163292",
@@ -507,7 +507,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2017-12-06 18:17:38.090252",
"modified": "2018-03-07 12:51:06.941609",
"modified_by": "Administrator",
"module": "Education",
"name": "Guardian",

View File

@@ -16,6 +16,12 @@ frappe.ui.form.on("Program Enrollment Tool", {
});
},
get_students_from: function(frm) {
if (frm.doc.get_students_from == "Student Applicant") {
frm.dashboard.add_comment(__('Only the Student Applicant with the status "Approved" will be selected in the table below.'));
}
},
"get_students": function(frm) {
frm.set_value("students",[]);
frappe.call({

View File

@@ -26,7 +26,7 @@ class ProgramEnrollmentTool(Document):
elif self.get_students_from == "Program Enrollment":
condition2 = 'and student_batch_name=%(student_batch)s' if self.student_batch else " "
students = frappe.db.sql('''select student, student_name, student_batch_name from `tabProgram Enrollment`
where program=%(program)s and academic_year=%(academic_year)s {0} {1}'''
where program=%(program)s and academic_year=%(academic_year)s {0} {1} and docstatus != 2'''
.format(condition, condition2), self.as_dict(), as_dict=1)
student_list = [d.student for d in students]

View File

@@ -22,14 +22,16 @@ class Student(Document):
def update_student_name_in_linked_doctype(self):
linked_doctypes = get_linked_doctypes("Student")
for d in linked_doctypes:
if "student_name" in [f.fieldname for f in frappe.get_meta(d).fields]:
frappe.db.sql("""UPDATE `tab{0}` set student_name = %s where {1} = %s"""
.format(d, linked_doctypes[d]["fieldname"]),(self.title, self.name))
meta = frappe.get_meta(d)
if not meta.issingle:
if "student_name" in [f.fieldname for f in meta.fields]:
frappe.db.sql("""UPDATE `tab{0}` set student_name = %s where {1} = %s"""
.format(d, linked_doctypes[d]["fieldname"]),(self.title, self.name))
if "child_doctype" in linked_doctypes[d].keys() and "student_name" in \
[f.fieldname for f in frappe.get_meta(linked_doctypes[d]["child_doctype"]).fields]:
frappe.db.sql("""UPDATE `tab{0}` set student_name = %s where {1} = %s"""
.format(linked_doctypes[d]["child_doctype"], linked_doctypes[d]["fieldname"]),(self.title, self.name))
if "child_doctype" in linked_doctypes[d].keys() and "student_name" in \
[f.fieldname for f in frappe.get_meta(linked_doctypes[d]["child_doctype"]).fields]:
frappe.db.sql("""UPDATE `tab{0}` set student_name = %s where {1} = %s"""
.format(linked_doctypes[d]["child_doctype"], linked_doctypes[d]["fieldname"]),(self.title, self.name))
def check_unique(self):
"""Validates if the Student Applicant is Unique"""

View File

@@ -0,0 +1,371 @@
<style>
@media screen {
.print-format-gutter {
background-color: #ddd;
padding: 15px 0px;
}
.print-format {
background-color: white;
box-shadow: 0px 0px 9px rgba(0,0,0,0.5);
max-width: 8.3in;
min-height: 11.69in;
padding: 0.75in;
margin: auto;
}
.print-format.landscape {
max-width: 11.69in;
padding: 0.2in;
}
.page-break {
padding: 30px 0px;
border-bottom: 1px dashed #888;
}
.page-break:first-child {
padding-top: 0px;
}
.page-break:last-child {
border-bottom: 0px;
}
/* mozilla hack for images in table */
body:last-child .print-format td img {
width: 100% !important;
}
@media(max-width: 767px) {
.print-format {
padding: 0.2in;
}
}
}
@media print {
.print-format p {
margin-left: 1px;
margin-right: 1px;
}
}
.data-field {
margin-top: 5px;
margin-bottom: 5px;
}
.data-field .value {
word-wrap: break-word;
}
.important .value {
font-size: 120%;
font-weight: bold;
}
.important label {
line-height: 1.8;
margin: 0px;
}
.table {
margin: 20px 0px;
}
.square-image {
width: 100%;
height: 0;
padding: 50% 0;
background-size: contain;
/*background-size: cover;*/
background-repeat: no-repeat !important;
background-position: center center;
border-radius: 4px;
}
.print-item-image {
object-fit: contain;
}
.pdf-variables,
.pdf-variable,
.visible-pdf {
display: none !important;
}
.print-format {
font-size: 9pt;
font-family: "Helvetica Neue", Helvetica, Arial, "Open Sans", sans-serif;
-webkit-print-color-adjust:exact;
}
.page-break {
page-break-after: always;
}
.print-heading {
border-bottom: 1px solid #aaa;
margin-bottom: 10px;
}
.print-heading h2 {
margin: 0px;
}
.print-heading h4 {
margin-top: 5px;
}
table.no-border, table.no-border td {
border: 0px;
}
.print-format label {
/* wkhtmltopdf breaks label into multiple lines when it is inline-block */
display: block;
}
.print-format img {
max-width: 100%;
}
.print-format table td > .primary:first-child {
font-weight: bold;
}
.print-format td, .print-format th {
vertical-align: top !important;
padding: 6px !important;
}
.print-format p {
margin: 3px 0px 3px;
}
table td div {
/* needed to avoid partial cutting of text between page break in wkhtmltopdf */
page-break-inside: avoid !important;
}
/* hack for webkit specific browser */
@media (-webkit-min-device-pixel-ratio:0) {
thead, tfoot { display: table-row-group; }
}
[document-status] {
margin-bottom: 5mm;
}
.signature-img {
background: #fff;
border-radius: 3px;
margin-top: 5px;
max-height: 150px;
}
.print-heading {
text-align: right;
text-transform: uppercase;
color: #666;
padding-bottom: 20px;
margin-bottom: 20px;
border-bottom: 1px solid #d1d8dd;
}
.print-heading h2 {
font-size: 24px;
}
.print-format th {
background-color: #eee !important;
border-bottom: 0px !important;
}
/* modern format: for-test */
.pbi_avoid {
page-break-inside: avoid !important;
}
.pb_before {
page-break-before: always !important;
}
</style>
<div class="page-break">
<div id="header-html" class="hidden-pdf">
{% if letterhead and add_letterhead %}
<div class="">{{ letterhead }}</div>
{% endif %}
<div class="print-heading">
<h2>{{ _("Student Report Card") }}<br>
<small>{{ doc.student_name }}</small>
</h2>
</div>
</div>
<div class="row section-break">
<div class="col-xs-6 column-break">
<div class="row data-field">
<div class="col-xs-5">
<label>{{ _("Student ID: ") }}</label>
</div>
<div class="col-xs-7">
{{ doc.students[0] }}
</div>
</div>
<div class="row data-field">
<div class="col-xs-5">
<label>{{ _("Student Name: ") }}</label>
</div>
<div class="col-xs-7">
{{ doc.student_name }}
</div>
</div>
<div class="row data-field">
<div class="col-xs-5">
<label>{{ _("Program: ") }}</label>
</div>
<div class="col-xs-7">
{{ doc.program }}
</div>
</div>
<div class="row data-field">
<div class="col-xs-5">
<label>{{ _("Batch: ") }}</label>
</div>
<div class="col-xs-7">
{{ doc.student_batch }}
</div>
</div>
</div>
<div class="col-xs-6 column-break">
<div class="row data-field">
<div class="col-xs-5">
<label>{{ _("Academic Year: ") }}</label>
</div>
<div class="col-xs-7">
{{ doc.academic_year }}
</div>
</div>
{% if doc.academic_term %}
<div class="row data-field">
<div class="col-xs-5">
<label>{{ _("Academic Term: ") }}</label>
</div>
<div class="col-xs-7">
{{ doc.academic_term }}
</div>
</div>
{% endif %}
<div class="row data-field">
<div class="col-xs-5">
<label>{{ _("Assessment Group: ") }}</label>
</div>
<div class="col-xs-7">
{{ doc.assessment_group }}
</div>
</div>
</div>
</div>
{% if doc.show_marks | int %}
{% set result_data = 'score' %}
{% else %}
{% set result_data = 'grade' %}
{% endif %}
{% for course in courses %}
<div class="row section-break pbi_avoid">
<div class="col-xs-12 column-break">
<div>
<table class="table table-bordered table-condensed">
<caption>
<div class="row">
<div class="col-xs-1">
<label>{{ _("Course: ") }}</label>
</div>
<div class="col-xs-11">
{{ course }} ({{ frappe.db.get_value("Course", course, "course_name") }})
</div>
</div>
</caption>
<thead>
<tr>
<th style="width: {{ 650//(assessment_groups|length + 1) }}px">{{ _("Assessment Criteria") }}</th>
{% for assessment_group in assessment_groups %}
<th> {{ assessment_group }}</th>
{% endfor %}
</tr>
</thead>
<tbody>
{% for criteria in course_criteria[course] %}
<tr>
<td>{{ criteria }}</td>
{% for assessment_group in assessment_groups %}
{% if (assessment_result.get(course) and assessment_result.get(course).get(assessment_group) and assessment_result.get(course).get(assessment_group).get(criteria)) %}
<td>
{{ assessment_result.get(course).get(assessment_group).get(criteria).get(result_data) }}
{% if result_data == 'score' %}
({{ assessment_result.get(course).get(assessment_group).get(criteria).get('maximum_score') }})
{% endif %}
</td>
{% else %}
<td></td>
{% endif %}
{% endfor %}
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
{% endfor %}
<br>
<div class="row section-break pbi_avoid">
<div class="col-xs-6 column-break">
<h4>{{ _("Student Attendance")}}</h4> <br>
<div>
Present {{ doc.attendance.get("Present") if doc.attendance.get("Present") != None else '0' }} days
out of {{ doc.attendance.get("Present") + doc.attendance.get("Absent") }}
</div>
</div>
<div class="col-xs-6 column-break">
<h4>{{ _("Parents Teacher Meeting Attendance")}}</h4> <br>
<div>
Present {{ doc.parents_attendance if doc.parents_attendance != None else '0' }}
out of {{ doc.parents_meeting if doc.parents_meeting != None else '0' }}
</div>
</div>
</div>
{% if doc.assessment_terms %}
<div class="row section-break pb_before">
<div class="col-xs-12">
<p> {{ doc.assessment_terms }} </p>
</div>
</div>
{% endif %}
</div>

View File

@@ -0,0 +1,66 @@
// Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt
frappe.ui.form.on('Student Report Generation Tool', {
onload: function(frm) {
frm.set_query("academic_term",function(){
return{
"filters":{
"academic_year": frm.doc.academic_year
}
};
});
frm.set_query("assessment_group", function() {
return{
filters: {
"is_group": 1
}
};
});
},
refresh: function(frm) {
frm.disable_save();
frm.page.clear_indicator();
frm.page.set_primary_action(__('Print Report Card'), () => {
let url = "/api/method/erpnext.education.doctype.student_report_generation_tool.student_report_generation_tool.preview_report_card";
open_url_post(url, frm.doc, true);
});
},
student: function(frm) {
if (frm.doc.student) {
frappe.call({
method:"erpnext.education.api.get_current_enrollment",
args: {
"student": frm.doc.student,
"academic_year": frm.doc.academic_year
},
callback: function(r) {
if(r){
$.each(r.message, function(i, d) {
if (frm.fields_dict.hasOwnProperty(i)) {
frm.set_value(i, d);
}
});
}
}
});
}
},
terms: function(frm) {
if(frm.doc.terms) {
return frappe.call({
method: 'erpnext.setup.doctype.terms_and_conditions.terms_and_conditions.get_terms_and_conditions',
args: {
template_name: frm.doc.terms,
doc: frm.doc
},
callback: function(r) {
frm.set_value("assessment_terms", r.message);
}
});
}
}
});

View File

@@ -0,0 +1,582 @@
{
"allow_copy": 0,
"allow_guest_to_view": 0,
"allow_import": 0,
"allow_rename": 0,
"beta": 0,
"creation": "2018-01-15 15:36:32.830069",
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"document_type": "",
"editable_grid": 1,
"engine": "InnoDB",
"fields": [
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "student",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Student",
"length": 0,
"no_copy": 0,
"options": "Student",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "student_name",
"fieldtype": "Read Only",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Student Name",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "program",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Program",
"length": 0,
"no_copy": 0,
"options": "Program",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "student_batch",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Batch",
"length": 0,
"no_copy": 0,
"options": "Student Batch Name",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "include_all_assessment",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Include All Assessment Group",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "show_marks",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Show Marks",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"default": "1",
"fieldname": "add_letterhead",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Add letterhead",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "column_break_3",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "assessment_group",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Assessment Group",
"length": 0,
"no_copy": 0,
"options": "Assessment Group",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "academic_year",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Academic Year",
"length": 0,
"no_copy": 0,
"options": "Academic Year",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "academic_term",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Academic Term",
"length": 0,
"no_copy": 0,
"options": "Academic Term",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "add_letterhead",
"fieldname": "letter_head",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Letter Head",
"length": 0,
"no_copy": 0,
"options": "Letter Head",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "section_break_5",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Print Section",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "parents_meeting",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Total Parents Teacher Meeting",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "parents_attendance",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Attended by Parents",
"length": 0,
"no_copy": 0,
"options": "",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "terms",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Terms",
"length": 0,
"no_copy": 0,
"options": "Terms and Conditions",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "assessment_terms",
"fieldtype": "Text Editor",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Assessment Terms",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
}
],
"has_web_view": 0,
"hide_heading": 0,
"hide_toolbar": 1,
"idx": 0,
"image_view": 0,
"in_create": 0,
"is_submittable": 0,
"issingle": 1,
"istable": 0,
"max_attachments": 0,
"modified": "2018-03-20 17:57:53.936119",
"modified_by": "Administrator",
"module": "Education",
"name": "Student Report Generation Tool",
"name_case": "",
"owner": "Administrator",
"permissions": [
{
"amend": 0,
"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": "System Manager",
"set_user_permissions": 0,
"share": 0,
"submit": 0,
"write": 1
}
],
"quick_entry": 1,
"read_only": 0,
"read_only_onload": 0,
"show_name_in_global_search": 0,
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1,
"track_seen": 0
}

View File

@@ -0,0 +1,91 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2018, 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
from erpnext.education.api import get_grade
from frappe.utils.pdf import get_pdf
from erpnext.education.report.course_wise_assessment_report.course_wise_assessment_report import get_formatted_result
from erpnext.education.report.course_wise_assessment_report.course_wise_assessment_report import get_child_assessment_groups
class StudentReportGenerationTool(Document):
pass
@frappe.whitelist()
def preview_report_card(**kwargs):
doc = frappe._dict(**kwargs)
doc.students = [doc.student]
if not (doc.student_name and doc.student_batch):
program_enrollment = frappe.get_all("Program Enrollment", fields=["student_batch_name", "student_name"],
filters={"student": doc.student, "docstatus": ('!=', 2), "academic_year": doc.academic_year})
if program_enrollment:
doc.batch = program_enrollment[0].student_batch_name
doc.student_name = program_enrollment[0].student_name
# get the assessment result of the selected student
values = get_formatted_result(doc, get_course=True, get_all_assessment_groups=doc.include_all_assessment)
assessment_result = values.get("assessment_result").get(doc.student)
courses = values.get("course_dict")
course_criteria = get_courses_criteria(courses)
# get the assessment group as per the user selection
if int(doc.include_all_assessment):
assessment_groups = get_child_assessment_groups(doc.assessment_group)
else:
assessment_groups = [doc.assessment_group]
# get the attendance of the student for that peroid of time.
doc.attendance = get_attendance_count(doc.students[0], doc.academic_year, doc.academic_term)
template = "erpnext/education/doctype/student_report_generation_tool/student_report_generation_tool.html"
base_template_path = "frappe/www/printview.html"
from frappe.www.printview import get_letter_head
letterhead = get_letter_head(frappe._dict({"letter_head": doc.letterhead}), not doc.add_letterhead)
html = frappe.render_template(template,
{
"doc": doc,
"assessment_result": assessment_result,
"courses": courses,
"assessment_groups": assessment_groups,
"course_criteria": course_criteria,
"letterhead": letterhead.content,
"add_letterhead": int(doc.add_letterhead) if int(doc.add_letterhead) else 0
})
final_template = frappe.render_template(base_template_path, {"body": html, "title": "Report Card"})
frappe.response.filename = "Report Card " + doc.students[0] + ".pdf"
frappe.response.filecontent = get_pdf(final_template)
frappe.response.type = "download"
def get_courses_criteria(courses):
course_criteria = frappe._dict()
for course in courses:
course_criteria[course] = [d.assessment_criteria for d in frappe.get_all("Course Assessment Criteria",
fields=["assessment_criteria"], filters={"parent": course})]
return course_criteria
def get_attendance_count(student, academic_year, academic_term=None):
if academic_year:
from_date, to_date = frappe.db.get_value("Academic Year", academic_year, ["year_start_date", "year_end_date"])
elif academic_term:
from_date, to_date = frappe.db.get_value("Academic Term", academic_term, ["term_start_date", "term_end_date"])
if from_date and to_date:
attendance = dict(frappe.db.sql('''select status, count(student) as no_of_days
from `tabStudent Attendance` where student = %s
and date between %s and %s group by status''',
(student, from_date, to_date)))
if "Absent" not in attendance.keys():
attendance["Absent"] = 0
if "Present" not in attendance.keys():
attendance["Present"] = 0
return attendance
else:
frappe.throw("Provide the academic year and set the starting and ending date.")

View File

@@ -0,0 +1,23 @@
/* eslint-disable */
// rename this file from _test_[name] to test_[name] to activate
// and remove above this line
QUnit.test("test: Student Report Generation Tool", function (assert) {
let done = assert.async();
// number of asserts
assert.expect(1);
frappe.run_serially([
// insert a new Student Report Generation Tool
() => frappe.tests.make('Student Report Generation Tool', [
// values to be set
{key: 'value'}
]),
() => {
assert.equal(cur_frm.doc.key, 'value');
},
() => done()
]);
});

View File

@@ -0,0 +1,10 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
import frappe
import unittest
class TestStudentReportGenerationTool(unittest.TestCase):
pass

View File

@@ -60,7 +60,7 @@ def execute(filters=None):
return columns, data, None, chart
def get_formatted_result(args, get_assessment_criteria=False, get_course=False):
def get_formatted_result(args, get_assessment_criteria=False, get_course=False, get_all_assessment_groups=False):
cond, cond1, cond2, cond3, cond4 = " ", " ", " ", " ", " "
args_list = [args.academic_year]
@@ -77,15 +77,9 @@ def get_formatted_result(args, get_assessment_criteria=False, get_course=False):
args_list.append(args.student_group)
create_total_dict = False
group_type = frappe.get_value("Assessment Group", args.assessment_group, "is_group")
if group_type:
from frappe.desk.treeview import get_children
assessment_groups = [d.get("value") for d in get_children("Assessment Group",
args.assessment_group) if d.get("value") and not d.get("expandable")]
cond3 = " and ar.assessment_group in (%s)"%(', '.join(['%s']*len(assessment_groups)))
else:
assessment_groups = [args.assessment_group]
cond3 = " and ar.assessment_group=%s"
assessment_groups = get_child_assessment_groups(args.assessment_group)
cond3 = " and ar.assessment_group in (%s)"%(', '.join(['%s']*len(assessment_groups)))
args_list += assessment_groups
if args.students:
@@ -156,6 +150,9 @@ def get_formatted_result(args, get_assessment_criteria=False, get_course=False):
# create the total of all the assessment groups criteria-wise
elif create_total_dict:
if get_all_assessment_groups:
formatted_assessment_result[result.student][result.course][result.assessment_group]\
[result.assessment_criteria] = assessment_criteria_details
if not formatted_assessment_result[result.student][result.course][args.assessment_group]:
formatted_assessment_result[result.student][result.course][args.assessment_group] = defaultdict(dict)
formatted_assessment_result[result.student][result.course][args.assessment_group]\
@@ -238,3 +235,15 @@ def get_chart_data(grades, criteria_list, kounter):
},
"type": 'bar',
}
def get_child_assessment_groups(assessment_group):
assessment_groups = []
group_type = frappe.get_value("Assessment Group", assessment_group, "is_group")
if group_type:
from frappe.desk.treeview import get_children
assessment_groups = [d.get("value") for d in get_children("Assessment Group",
assessment_group) if d.get("value") and not d.get("expandable")]
else:
assessment_groups = [assessment_group]
return assessment_groups

View File

@@ -27,26 +27,27 @@ def execute(filters=None):
course_dict = values.get("course_dict")
for student in args.students:
student_row = {}
student_row["student"] = student
student_row["student_name"] = student_details[student]
for course in course_dict:
scrub_course = frappe.scrub(course)
if assessment_group in assessment_result[student][course]:
student_row["grade_" + scrub_course] = assessment_result[student][course][assessment_group]["Total Score"]["grade"]
student_row["score_" + scrub_course] = assessment_result[student][course][assessment_group]["Total Score"]["score"]
if student_details.get(student):
student_row = {}
student_row["student"] = student
student_row["student_name"] = student_details[student]
for course in course_dict:
scrub_course = frappe.scrub(course)
if assessment_group in assessment_result[student][course]:
student_row["grade_" + scrub_course] = assessment_result[student][course][assessment_group]["Total Score"]["grade"]
student_row["score_" + scrub_course] = assessment_result[student][course][assessment_group]["Total Score"]["score"]
# create the list of possible grades
if student_row["grade_" + scrub_course] not in grades:
grades.append(student_row["grade_" + scrub_course])
# create the list of possible grades
if student_row["grade_" + scrub_course] not in grades:
grades.append(student_row["grade_" + scrub_course])
# create the dict of for gradewise analysis
if student_row["grade_" + scrub_course] not in course_wise_analysis[course]:
course_wise_analysis[course][student_row["grade_" + scrub_course]] = 1
else:
course_wise_analysis[course][student_row["grade_" + scrub_course]] += 1
# create the dict of for gradewise analysis
if student_row["grade_" + scrub_course] not in course_wise_analysis[course]:
course_wise_analysis[course][student_row["grade_" + scrub_course]] = 1
else:
course_wise_analysis[course][student_row["grade_" + scrub_course]] += 1
data.append(student_row)
data.append(student_row)
course_list = [d for d in course_dict]
columns = get_column(course_dict)

View File

@@ -23,11 +23,6 @@ frappe.ui.form.on('Consultation', {
patient: frm.doc.patient
},
callback: function (data) {
var age = null;
if(data.message.dob){
age = calculate_age(data.message.dob);
}
frappe.model.set_value(frm.doctype,frm.docname, "patient_age", age);
show_details(data.message);
}
});

View File

@@ -40,6 +40,7 @@
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -70,6 +71,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -100,6 +102,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -126,10 +129,11 @@
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -161,6 +165,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -192,6 +197,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -223,6 +229,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -254,6 +261,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -283,6 +291,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -313,6 +322,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -343,6 +353,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -373,6 +384,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -403,6 +415,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -433,6 +446,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -464,6 +478,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -493,6 +508,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -524,6 +540,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -554,6 +571,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -585,6 +603,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -615,6 +634,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -645,6 +665,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -674,6 +695,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -704,6 +726,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -734,6 +757,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -765,6 +789,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@@ -796,6 +821,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
}
],
@@ -810,7 +836,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2017-10-05 16:08:24.624644",
"modified": "2018-03-09 07:05:24.984224",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "Physician",

View File

@@ -204,7 +204,7 @@ doc_events = {
'Address': {
'validate': 'erpnext.regional.india.utils.validate_gstin_for_india'
},
('Sales Invoice', 'Purchase Invoice'): {
('Sales Invoice', 'Purchase Invoice', 'Delivery Note'): {
'validate': 'erpnext.regional.india.utils.set_place_of_supply'
}
}

View File

@@ -81,7 +81,7 @@ frappe.ui.form.on('Employee',{
}
frappe.call({
method: "erpnext.hr.doctype.employee.employee.create_user",
args: { employee: cur_frm.doc.name },
args: { employee: frm.doc.name, email: frm.doc.prefered_email },
callback: function(r)
{
frm.set_value("user_id", r.message)

View File

@@ -263,7 +263,7 @@ def deactivate_sales_person(status = None, employee = None):
frappe.db.set_value("Sales Person", sales_person, "enabled", 0)
@frappe.whitelist()
def create_user(employee, user = None):
def create_user(employee, user = None, email=None):
emp = frappe.get_doc("Employee", employee)
employee_name = emp.employee_name.split(" ")
@@ -277,6 +277,9 @@ def create_user(employee, user = None):
first_name = employee_name[0]
if email:
emp.prefered_email = email
user = frappe.new_doc("User")
user.update({
"name": emp.employee_name,

View File

@@ -98,9 +98,9 @@ cur_frm.cscript.refresh = function(doc) {
if (cint(doc.total_amount_reimbursed) > 0 && frappe.model.can_read(entry_doctype)) {
cur_frm.add_custom_button(__('Bank Entries'), function() {
frappe.route_options = {
entry_route_doctype: me.frm.doc.doctype,
entry_route_name: me.frm.doc.name,
company: me.frm.doc.company
party_type: "Employee",
party: doc.employee,
company: doc.company
};
frappe.set_route("List", entry_doctype);
}, __("View"));
@@ -205,7 +205,7 @@ frappe.ui.form.on("Expense Claim", {
make_payment_entry: function(frm) {
var method = "erpnext.accounts.doctype.payment_entry.payment_entry.get_payment_entry";
if(frm.doc.__onload && frm.doc.__onload.make_payment_via_journal_entry) {
method = "erpnext.hr.doctype.expense_claim.expense_claim.make_bank_entry"
method = "erpnext.hr.doctype.expense_claim.expense_claim.make_bank_entry";
}
return frappe.call({
method: method,

View File

@@ -45,10 +45,11 @@ class ExpenseClaim(AccountsController):
}[cstr(self.docstatus or 0)]
paid_amount = flt(self.total_amount_reimbursed) + flt(self.total_advance_amount)
if self.total_sanctioned_amount > 0 and self.total_sanctioned_amount == paid_amount\
if (self.is_paid or (flt(self.total_sanctioned_amount) > 0
and flt(self.total_sanctioned_amount) == paid_amount)) \
and self.docstatus == 1 and self.approval_status == 'Approved':
self.status = "Paid"
elif self.total_sanctioned_amount > 0 and self.docstatus == 1 and self.approval_status == 'Approved':
self.status = "Paid"
elif flt(self.total_sanctioned_amount) > 0 and self.docstatus == 1 and self.approval_status == 'Approved':
self.status = "Unpaid"
elif self.docstatus == 1 and self.approval_status == 'Rejected':
self.status = 'Rejected'

View File

@@ -384,7 +384,7 @@ def get_leave_allocation_records(date, employee=None):
return allocated_leaves
@frappe.whitelist()
def get_holidays(employee, from_date, to_date):
'''get holidays between two dates for the given employee'''
holiday_list = get_holiday_list_for_employee(employee)

View File

@@ -5,7 +5,10 @@ var in_progress = false;
frappe.ui.form.on('Payroll Entry', {
onload: function (frm) {
frm.doc.posting_date = frappe.datetime.nowdate();
if (!frm.doc.posting_date) {
frm.doc.posting_date = frappe.datetime.nowdate();
}
frm.toggle_reqd(['payroll_frequency'], !frm.doc.salary_slip_based_on_timesheet);
},

View File

@@ -146,6 +146,7 @@ class PayrollEntry(Document):
ss_list = self.get_sal_slip_list(ss_status=0)
submitted_ss = []
not_submitted_ss = []
frappe.flags.via_payroll_entry = True
for ss in ss_list:
ss_obj = frappe.get_doc("Salary Slip",ss[0])
ss_dict = {}
@@ -159,23 +160,30 @@ class PayrollEntry(Document):
else:
try:
ss_obj.submit()
submitted_ss.append(ss_dict)
submitted_ss.append(ss_obj)
except frappe.ValidationError:
not_submitted_ss.append(ss_dict)
if submitted_ss:
jv_name = self.make_accural_jv_entry()
jv_name = self.make_accrual_jv_entry()
frappe.msgprint(_("Salary Slip submitted for period from {0} to {1}")
.format(ss_obj.start_date, ss_obj.end_date))
self.email_salary_slip(submitted_ss)
return create_submit_log(submitted_ss, not_submitted_ss, jv_name)
def email_salary_slip(self, submitted_ss):
if frappe.db.get_single_value("HR Settings", "email_salary_slip_to_employee"):
for ss in submitted_ss:
ss.email_salary_slip()
def get_loan_details(self):
"""
Get loan details from submitted salary slip based on selected criteria
"""
cond = self.get_filter_condition()
return frappe.db.sql(""" select eld.employee_loan_account,
return frappe.db.sql(""" select eld.employee_loan_account, eld.employee_loan,
eld.interest_income_account, eld.principal_amount, eld.interest_amount, eld.total_payment
from
`tabSalary Slip` t1, `tabSalary Slip Loan` eld
@@ -237,7 +245,7 @@ class PayrollEntry(Document):
return payroll_payable_account
def make_accural_jv_entry(self):
def make_accrual_jv_entry(self):
self.check_permission('write')
earnings = self.get_salary_component_total(component_type = "earnings") or {}
deductions = self.get_salary_component_total(component_type = "deductions") or {}
@@ -249,7 +257,7 @@ class PayrollEntry(Document):
if earnings or deductions:
journal_entry = frappe.new_doc('Journal Entry')
journal_entry.voucher_type = 'Journal Entry'
journal_entry.user_remark = _('Accural Journal Entry for salaries from {0} to {1}')\
journal_entry.user_remark = _('Accrual Journal Entry for salaries from {0} to {1}')\
.format(self.start_date, self.end_date)
journal_entry.company = self.company
journal_entry.posting_date = self.posting_date
@@ -283,7 +291,12 @@ class PayrollEntry(Document):
"account": data.employee_loan_account,
"credit_in_account_currency": data.principal_amount
})
accounts.append({
if data.interest_amount and not data.interest_income_account:
frappe.throw(_("Select interest income account in employee loan {0}").format(data.employee_loan))
if data.interest_income_account and data.interest_amount:
accounts.append({
"account": data.interest_income_account,
"credit_in_account_currency": data.interest_amount,
"cost_center": self.cost_center,

View File

@@ -17,6 +17,5 @@ class SalaryComponent(Document):
self.salary_component.split()]).upper()
self.salary_component_abbr = self.salary_component_abbr.strip()
self.salary_component_abbr = append_number_if_name_exists('Salary Component',
self.salary_component_abbr, 'salary_component_abbr', separator='_')
self.salary_component_abbr = append_number_if_name_exists('Salary Component', self.salary_component_abbr,
'salary_component_abbr', separator='_', filters={"name": ["!=", self.name]})

View File

@@ -156,9 +156,10 @@ class SalarySlip(TransactionBase):
})
def get_date_details(self):
date_details = get_start_end_dates(self.payroll_frequency, self.start_date or self.posting_date)
self.start_date = date_details.start_date
self.end_date = date_details.end_date
if not self.end_date:
date_details = get_start_end_dates(self.payroll_frequency, self.start_date or self.posting_date)
self.start_date = date_details.start_date
self.end_date = date_details.end_date
def check_sal_struct(self, joining_date, relieving_date):
cond = ''
@@ -410,7 +411,7 @@ class SalarySlip(TransactionBase):
else:
self.set_status()
self.update_status(self.name)
if(frappe.db.get_single_value("HR Settings", "email_salary_slip_to_employee")):
if(frappe.db.get_single_value("HR Settings", "email_salary_slip_to_employee")) and not frappe.flags.via_payroll_entry:
self.email_salary_slip()
def on_cancel(self):

View File

@@ -39,6 +39,16 @@ frappe.ui.form.on('Salary Structure', {
}
}
});
frm.set_query("payment_account", function () {
var account_types = ["Bank", "Cash"];
return {
filters: {
"account_type": ["in", account_types],
"is_group": 0,
"company": frm.doc.company
}
};
});
},
refresh: function(frm) {

View File

@@ -47,7 +47,6 @@ class BOM(WebsiteGenerator):
self.validate_currency()
self.set_conversion_rate()
self.validate_uom_is_interger()
self.update_stock_qty()
self.set_bom_material_details()
self.validate_materials()
self.validate_operations()
@@ -247,14 +246,12 @@ class BOM(WebsiteGenerator):
set_default(self, "item")
item = frappe.get_doc("Item", self.item)
if item.default_bom != self.name:
item.default_bom = self.name
item.save(ignore_permissions = True)
frappe.db.set_value('Item', self.item, 'default_bom', self.name)
else:
frappe.db.set(self, "is_default", 0)
item = frappe.get_doc("Item", self.item)
if item.default_bom == self.name:
item.default_bom = None
item.save(ignore_permissions = True)
frappe.db.set_value('Item', self.item, 'default_bom', None)
def clear_operations(self):
if not self.with_operations:
@@ -291,6 +288,8 @@ class BOM(WebsiteGenerator):
m.uom = m.stock_uom
m.qty = m.stock_qty
m.db_update()
def validate_uom_is_interger(self):
from erpnext.utilities.transaction_base import validate_uom_is_integer
validate_uom_is_integer(self, "uom", "qty", "BOM Item")
@@ -333,19 +332,23 @@ class BOM(WebsiteGenerator):
def check_recursion(self):
""" Check whether recursion occurs in any bom"""
bom_list = self.traverse_tree()
bom_nos = frappe.get_all('BOM Item', fields=["bom_no"],
filters={'parent': ('in', bom_list), 'parenttype': 'BOM'})
check_list = [['parent', 'bom_no', 'parent'], ['bom_no', 'parent', 'child']]
for d in check_list:
bom_list, count = [self.name], 0
while (len(bom_list) > count ):
boms = frappe.db.sql(" select %s from `tabBOM Item` where %s = %s and parenttype='BOM'" %
(d[0], d[1], '%s'), cstr(bom_list[count]))
count = count + 1
for b in boms:
if b[0] == self.name:
frappe.throw(_("BOM recursion: {0} cannot be parent or child of {2}").format(b[0], self.name))
if b[0]:
bom_list.append(b[0])
raise_exception = False
if bom_nos and self.name in [d.bom_no for d in bom_nos]:
raise_exception = True
if not raise_exception:
bom_nos = frappe.get_all('BOM Item', fields=["parent"],
filters={'bom_no': self.name, 'parenttype': 'BOM'})
if self.name in [d.parent for d in bom_nos]:
raise_exception = True
if raise_exception:
frappe.throw(_("BOM recursion: {0} cannot be parent or child of {2}").format(self.name, self.name))
def update_cost_and_exploded_items(self, bom_list=[]):
bom_list = self.traverse_tree(bom_list)
@@ -594,9 +597,19 @@ def validate_bom_no(item, bom_no):
if bom.docstatus != 1:
if not getattr(frappe.flags, "in_test", False):
frappe.throw(_("BOM {0} must be submitted").format(bom_no))
if item and not (bom.item.lower() == item.lower() or \
bom.item.lower() == cstr(frappe.db.get_value("Item", item, "variant_of")).lower()):
frappe.throw(_("BOM {0} does not belong to Item {1}").format(bom_no, item))
if item:
rm_item_exists = False
for d in bom.items:
if (d.item_code.lower() == item.lower()):
rm_item_exists = True
for d in bom.scrap_items:
if (d.item_code.lower() == item.lower()):
rm_item_exists = True
if bom.item.lower() == item.lower() or \
bom.item.lower() == cstr(frappe.db.get_value("Item", item, "variant_of")).lower():
rm_item_exists = True
if not rm_item_exists:
frappe.throw(_("BOM {0} does not belong to Item {1}").format(bom_no, item))
@frappe.whitelist()
def get_children(doctype, parent=None, is_root=False, **filters):

View File

@@ -60,5 +60,14 @@ frappe.treeview_settings["BOM"] = {
condition: 'frappe.boot.user.can_create.indexOf("BOM") !== -1'
}
],
onrender: function(node) {
if(node.is_root && node.data.value!="BOM") {
frappe.model.with_doc("BOM", node.data.value, function() {
var bom = frappe.model.get_doc("BOM", node.data.value);
node.data.image = bom.image || "";
node.data.description = bom.description || "";
});
}
},
view_template: 'bom_item_preview'
}

View File

@@ -1,5 +1,6 @@
{
"allow_copy": 0,
"allow_guest_to_view": 0,
"allow_import": 0,
"allow_rename": 0,
"beta": 0,
@@ -12,6 +13,7 @@
"engine": "InnoDB",
"fields": [
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -21,6 +23,8 @@
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Operation",
@@ -38,9 +42,11 @@
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -50,6 +56,8 @@
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Workstation",
@@ -67,9 +75,11 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -79,6 +89,8 @@
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Description",
@@ -95,9 +107,11 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -107,6 +121,8 @@
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
@@ -120,9 +136,11 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -132,6 +150,8 @@
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Hour Rate",
@@ -149,9 +169,11 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -162,7 +184,9 @@
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_list_view": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Operation Time ",
"length": 0,
@@ -179,9 +203,11 @@
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -191,6 +217,8 @@
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Operating Cost",
@@ -208,9 +236,11 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -220,6 +250,8 @@
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Base Hour Rate(Company Currency)",
@@ -236,9 +268,11 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -249,6 +283,8 @@
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Operating Cost(Company Currency)",
@@ -265,9 +301,11 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -277,6 +315,8 @@
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Image",
@@ -292,20 +332,21 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
}
],
"has_web_view": 0,
"hide_heading": 0,
"hide_toolbar": 0,
"idx": 1,
"image_view": 0,
"in_create": 0,
"in_dialog": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 1,
"max_attachments": 0,
"modified": "2017-02-10 07:12:41.255544",
"modified": "2018-03-26 09:55:28.107451",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "BOM Operation",
@@ -314,6 +355,7 @@
"quick_entry": 0,
"read_only": 0,
"read_only_onload": 0,
"show_name_in_global_search": 0,
"track_changes": 0,
"track_seen": 0
}

View File

@@ -12,6 +12,10 @@ frappe.query_reports["BOM Stock Report"] = {
"fieldtype": "Link",
"options": "Warehouse",
"reqd": 1
}, {
"fieldname": "show_exploded_view",
"label": __("Show exploded view"),
"fieldtype": "Check"
}
]
}

View File

@@ -6,52 +6,61 @@ import frappe
from frappe import _
def execute(filters=None):
if not filters: filters = {}
columns = get_columns()
data = get_bom_stock(filters)
return columns, data
if not filters: filters = {}
columns = get_columns()
data = get_bom_stock(filters)
return columns, data
def get_columns():
"""return columns"""
columns = [
_("Item") + ":Link/Item:150",
_("Description") + "::500",
_("Required Qty") + ":Float:100",
_("In Stock Qty") + ":Float:100",
_("Enough Parts to Build") + ":Float:200",
]
"""return columns"""
columns = [
_("Item") + ":Link/Item:150",
_("Description") + "::500",
_("Required Qty") + ":Float:100",
_("In Stock Qty") + ":Float:100",
_("Enough Parts to Build") + ":Float:200",
]
return columns
return columns
def get_bom_stock(filters):
conditions = ""
bom = filters.get("bom")
conditions = ""
bom = filters.get("bom")
if filters.get("warehouse"):
warehouse_details = frappe.db.get_value("Warehouse", filters.get("warehouse"), ["lft", "rgt"], as_dict=1)
if warehouse_details:
conditions += " and exists (select name from `tabWarehouse` wh \
where wh.lft >= %s and wh.rgt <= %s and ledger.warehouse = wh.name)" % (warehouse_details.lft,
warehouse_details.rgt)
else:
conditions += " and ledger.warehouse = '%s'" % frappe.db.escape(filters.get("warehouse"))
table = "`tabBOM Item`"
qty_field = "qty"
else:
conditions += ""
if filters.get("show_exploded_view"):
table = "`tabBOM Explosion Item`"
qty_field = "stock_qty"
return frappe.db.sql("""
SELECT
bom_item.item_code ,
bom_item.description ,
bom_item.qty,
sum(ledger.actual_qty) as actual_qty,
sum(FLOOR(ledger.actual_qty /bom_item.qty))as to_build
FROM
`tabBOM Item` AS bom_item
LEFT JOIN `tabBin` AS ledger
ON bom_item.item_code = ledger.item_code
%s
WHERE
bom_item.parent = '%s' and bom_item.parenttype='BOM'
if filters.get("warehouse"):
warehouse_details = frappe.db.get_value("Warehouse", filters.get("warehouse"), ["lft", "rgt"], as_dict=1)
if warehouse_details:
conditions += " and exists (select name from `tabWarehouse` wh \
where wh.lft >= %s and wh.rgt <= %s and ledger.warehouse = wh.name)" % (warehouse_details.lft,
warehouse_details.rgt)
else:
conditions += " and ledger.warehouse = '%s'" % frappe.db.escape(filters.get("warehouse"))
GROUP BY bom_item.item_code""" % (conditions, bom))
else:
conditions += ""
return frappe.db.sql("""
SELECT
bom_item.item_code ,
bom_item.description ,
bom_item.{qty_field},
sum(ledger.actual_qty) as actual_qty,
sum(FLOOR(ledger.actual_qty / bom_item.{qty_field}))as to_build
FROM
{table} AS bom_item
LEFT JOIN `tabBin` AS ledger
ON bom_item.item_code = ledger.item_code
{conditions}
WHERE
bom_item.parent = '{bom}' and bom_item.parenttype='BOM'
GROUP BY bom_item.item_code""".format(qty_field=qty_field, table=table, conditions=conditions, bom=bom))

View File

@@ -490,3 +490,12 @@ erpnext.patches.v10_0.set_default_payment_terms_based_on_company
erpnext.patches.v10_0.update_sales_order_link_to_purchase_order
erpnext.patches.v10_0.added_extra_gst_custom_field_in_gstr2 #2018-02-13
erpnext.patches.v10_0.set_b2c_limit
erpnext.patches.v10_0.update_status_for_multiple_source_in_po
erpnext.patches.v10_0.set_auto_created_serial_no_in_stock_entry
erpnext.patches.v10_0.update_territory_and_customer_group
erpnext.patches.v10_0.update_warehouse_address_details
erpnext.patches.v10_0.update_reserved_qty_for_purchase_order
erpnext.patches.v10_0.update_hub_connector_domain
erpnext.patches.v10_0.set_student_party_type
erpnext.patches.v10_0.update_project_in_sle
erpnext.patches.v10_0.fix_reserved_qty_for_sub_contract

View File

@@ -6,6 +6,10 @@ def execute():
if not company:
return
for doctype in ["Sales Invoice", "Delivery Note", "Purchase Invoice"]:
frappe.db.sql("""delete from `tabCustom Field` where dt = %s
and fieldname in ('port_code', 'shipping_bill_number', 'shipping_bill_date')""", doctype)
make_custom_fields()
frappe.db.sql("""
@@ -14,6 +18,4 @@ def execute():
where fieldname = 'reason_for_issuing_document'
""")
for doctype in ["Sales Invoice", "Delivery Note", "Purchase Invoice"]:
frappe.db.sql("""delete from `tabCustom Field` where dt = %s
and fieldname in ('port_code', 'shipping_bill_number', 'shipping_bill_date')""", doctype)

View File

@@ -0,0 +1,31 @@
# Copyright (c) 2017, Frappe and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from erpnext.stock.utils import get_bin
def execute():
frappe.reload_doc("stock", "doctype", "bin")
frappe.reload_doc("buying", "doctype", "purchase_order_item_supplied")
for d in frappe.db.sql("""
select distinct rm_item_code, reserve_warehouse
from `tabPurchase Order Item Supplied`
where docstatus=1 and reserve_warehouse is not null and reserve_warehouse != ''"""):
try:
bin_doc = get_bin(d[0], d[1])
bin_doc.update_reserved_qty_for_sub_contracting()
except:
pass
for d in frappe.db.sql("""select distinct item_code, source_warehouse
from `tabProduction Order Item`
where docstatus=1 and transferred_qty > required_qty
and source_warehouse is not null and source_warehouse != ''""", as_list=1):
try:
bin_doc = get_bin(d[0], d[1])
bin_doc.update_reserved_qty_for_production()
except:
pass

View File

@@ -0,0 +1,56 @@
# Copyright (c) 2017, Frappe and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
def execute():
serialised_items = [d.name for d in frappe.get_all("Item", filters={"has_serial_no": 1})]
if not serialised_items:
return
for dt in ["Stock Entry Detail", "Purchase Receipt Item", "Purchase Invoice Item"]:
cond = ""
if dt=="Purchase Invoice Item":
cond = """ and parent in (select name from `tabPurchase Invoice`
where `tabPurchase Invoice`.name = `tabPurchase Invoice Item`.parent and update_stock=1)"""
item_rows = frappe.db.sql("""
select name
from `tab{0}`
where conversion_factor != 1
and docstatus = 1
and ifnull(serial_no, '') = ''
and item_code in ({1})
{2}
""".format(dt, ', '.join(['%s']*len(serialised_items)), cond), tuple(serialised_items))
if item_rows:
sle_serial_nos = dict(frappe.db.sql("""
select voucher_detail_no, serial_no
from `tabStock Ledger Entry`
where ifnull(serial_no, '') != ''
and voucher_detail_no in (%s)
""".format(', '.join(['%s']*len(item_rows))),
tuple([d[0] for d in item_rows])))
batch_size = 100
for i in range(0, len(item_rows), batch_size):
batch_item_rows = item_rows[i:i + batch_size]
when_then = []
for item_row in batch_item_rows:
when_then.append('WHEN `name` = "{row_name}" THEN "{value}"'.format(
row_name=item_row[0],
value=sle_serial_nos.get(item_row[0])))
frappe.db.sql("""
update
`tab{doctype}`
set
serial_no = CASE {when_then_cond} ELSE `serial_no` END
""".format(
doctype = dt,
when_then_cond=" ".join(when_then)
))

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