-
Notifications
You must be signed in to change notification settings - Fork 7.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merge the student group and student batch #8663
Conversation
manassolanki
commented
May 3, 2017
- Change the student group doctype
- Delete the student batch doctype
- Patch to map the student batch data on the student group
- Changes in the linked doctype
- Cleanup for deprecated doctype
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Screenshot please
for student_batch in student_batches: | ||
student_batch.update({"doctype":"Student Group", "group_based_on": "Batch"}) | ||
doc = frappe.get_doc(student_batch) | ||
doc.save() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why saving doc here? you can save after adding child records.
|
||
# for converting student batch into student group | ||
frappe.reload_doctype("Student Group") | ||
student_batches = frappe.db.sql('''select name as student_group_name, student_batch_name as batch, program, academic_year, academic_term |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use multilines after 80 chars
|
||
# delete the student batch and child-table | ||
frappe.delete_doc("DocType", "Student Batch", force=1) | ||
# frappe.db.sql("drop table if exists `tabStudent Batch`") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove commented lines
|
||
def validate_course(self): | ||
if self.student_group: | ||
if self.student_group and frappe.db.get_value("Student Group", self.student_group, "group_based_on") == "Course": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why 2 queries? It should be like this:
if self.student_group:
group_based_on, course = frappe.db.get_value("Student Group", self.student_group, ["group_based_on", "course"])
if group_based_on == "Course":
self.course = course
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't know this method
if self.student_group: | ||
|
||
if self.student_group and frappe.db.get_value("Student Group", self.student_group, "group_based_on") == "Course": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
- Absent student report - Student Batch-wise attendance - Student monthly attendance sheet