Skip to content

Commit 8db4bca

Browse files
committed
initial commit
0 parents  commit 8db4bca

17 files changed

+1007
-0
lines changed

.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.DS_Store
2+
*.pyc
3+
*.egg-info
4+
*.swp
5+
tags
6+
add_enroll/docs/current

MANIFEST.in

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
include MANIFEST.in
2+
include requirements.txt
3+
include *.json
4+
include *.md
5+
include *.py
6+
include *.txt
7+
recursive-include add_enroll *.css
8+
recursive-include add_enroll *.csv
9+
recursive-include add_enroll *.html
10+
recursive-include add_enroll *.ico
11+
recursive-include add_enroll *.js
12+
recursive-include add_enroll *.json
13+
recursive-include add_enroll *.md
14+
recursive-include add_enroll *.png
15+
recursive-include add_enroll *.py
16+
recursive-include add_enroll *.svg
17+
recursive-include add_enroll *.txt
18+
recursive-exclude add_enroll *.pyc

README.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
## Add Enroll
2+
3+
Augments Program Enrollment
4+
5+
#### License
6+
7+
MIT

add_enroll/__init__.py

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# -*- coding: utf-8 -*-
2+
from __future__ import unicode_literals
3+
4+
__version__ = '0.0.1'
5+

add_enroll/add_enroll/__init__.py

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# -*- coding: utf-8 -*-
2+
# Copyright (c) 2015, Frappe and contributors
3+
# For license information, please see license.txt
4+
from __future__ import unicode_literals
5+
import frappe
6+
from frappe import msgprint, _
7+
from frappe.model.document import Document
8+
from frappe.desk.reportview import get_match_cond, get_filters_cond
9+
from erpnext.education.doctype.program_enrollment.program_enrollment import ProgramEnrollment
10+
from frappe.utils import comma_and
11+
from frappe import utils
12+
import json
13+
14+
15+
@frappe.whitelist()
16+
def make_inv(customer, customer_name, due_date, courses, fees):
17+
count = 0
18+
#courses and fees are lists that have the docnames from the front end
19+
courses = json.loads(courses)
20+
fees = json.loads(fees)
21+
udoc = frappe.new_doc("Sales Invoice")
22+
udoc.naming_series = "ACC-SINV-.YYYY.-"
23+
udoc.customer = customer
24+
udoc.customer_name = customer_name
25+
#Fees
26+
if(fees):
27+
for d in fees:
28+
#fetch fee_structure, it has the amount for the sales invoice, as well as..
29+
fee_structure = frappe.get_doc("Fee Structure", d)
30+
for e in fee_structure.components:
31+
fee_amount = e.amount
32+
#The fee category. This is have a new field for
33+
#"Items" doctype, which will make sure each
34+
#course correlates to a proper item for identification
35+
fetched_item = frappe.get_doc("Fee Category", e.fees_category)
36+
if(fetched_item.item):
37+
udoc.append('items', {
38+
'item_code': fetched_item.item,
39+
'qty': '1',
40+
'rate': fee_amount,
41+
'amount': fee_amount,
42+
})
43+
count = count + 1
44+
#Only for checking if the sales invoice will turn out empty
45+
#In case none of the fee category or the Course doctypes
46+
#Have any items listed
47+
#For course
48+
if(courses):
49+
for i in range(len(courses)):
50+
fdata = frappe.get_doc('Course', courses[i])
51+
if(fdata.item):
52+
count= count + 1
53+
udoc.append('items', {
54+
'item_code': fdata.item,
55+
'qty': '1',
56+
})
57+
udoc.posting_date = frappe.utils.nowdate()
58+
#Due date = enrollment date
59+
udoc.due_date = due_date
60+
#saves only if there is at least one potential tx
61+
if( count > 0 ):
62+
udoc.save()
63+
return frappe.get_last_doc("Sales Invoice");
64+
else:
65+
msgprint(_("Invoice couldn't be generated : None of your courses or fee structures have an item group assigned."))
66+
return
67+
68+
69+
70+
def suppress(self):
71+
self.update_student_joining_date()
72+
if not self.invoice:
73+
self.make_fee_records()
74+
75+
76+
def submit(doc, method):
77+
msgprint(_("Overridden!"))
78+
ProgramEnrollment.on_submit = suppress

add_enroll/config/__init__.py

Whitespace-only changes.

add_enroll/config/desktop.py

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# -*- coding: utf-8 -*-
2+
from __future__ import unicode_literals
3+
from frappe import _
4+
5+
def get_data():
6+
return [
7+
{
8+
"module_name": "Add Enroll",
9+
"color": "black",
10+
"icon": "icon-paper-clip",
11+
"type": "module",
12+
"label": _("Add Enroll")
13+
}
14+
]

add_enroll/config/docs.py

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
"""
2+
Configuration for docs
3+
"""
4+
5+
# source_link = "https://github.com/[org_name]/add_enroll"
6+
# docs_base_url = "https://[org_name].github.io/add_enroll"
7+
# headline = "App that does everything"
8+
# sub_heading = "Yes, you got that right the first time, everything"
9+
10+
def get_context(context):
11+
context.brand_html = "Add Enroll"

0 commit comments

Comments
 (0)