Skip to content

Commit 84e50fe

Browse files
committed
Merge branch 'hotfix'
2 parents 50835cb + 2ef20a9 commit 84e50fe

File tree

5 files changed

+49
-37
lines changed

5 files changed

+49
-37
lines changed

erpnext/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from __future__ import unicode_literals
33
import frappe
44

5-
__version__ = '8.0.33'
5+
__version__ = '8.0.34'
66

77

88
def get_default_company(user=None):

erpnext/crm/doctype/opportunity/opportunity.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def make_new_lead_if_required(self):
7575
self.lead = lead_name
7676

7777
def declare_enquiry_lost(self,arg):
78-
if not self.has_lost_quotation():
78+
if not self.has_active_quotation():
7979
frappe.db.set(self, 'status', 'Lost')
8080
frappe.db.set(self, 'order_lost_reason', arg)
8181
else:

erpnext/patches/v8_0/merge_student_batch_and_student_group.py

+43-31
Original file line numberDiff line numberDiff line change
@@ -11,43 +11,55 @@ def execute():
1111

1212
# for converting student batch into student group
1313
frappe.reload_doctype("Student Group")
14-
student_batches = frappe.db.sql('''select name as student_group_name, student_batch_name as batch,
15-
program, academic_year, academic_term from `tabStudent Batch`''', as_dict=1)
16-
17-
for student_batch in student_batches:
18-
# create student batch name if does not exists !!
19-
if student_batch.get("batch") and not frappe.db.exists("Student Batch Name", student_batch.get("batch")):
20-
frappe.get_doc({
21-
"doctype": "Student Batch Name",
22-
"batch_name": student_batch.get("batch")
23-
}).insert(ignore_permissions=True)
24-
25-
student_batch.update({"doctype":"Student Group", "group_based_on": "Batch"})
26-
doc = frappe.get_doc(student_batch)
27-
student_list = frappe.db.sql('''select student, student_name, active from `tabStudent Batch Student`
28-
where parent=%s''', (doc.name), as_dict=1)
29-
for i, student in enumerate(student_list):
30-
student.update({"group_roll_number": i+1})
31-
32-
if student_list:
33-
doc.extend("students", student_list)
34-
35-
instructor_list = frappe.db.sql('''select instructor, instructor_name from `tabStudent Batch Instructor`
36-
where parent=%s''', (doc.name), as_dict=1)
37-
if instructor_list:
38-
doc.extend("instructors", instructor_list)
39-
doc.save()
14+
15+
if frappe.db.table_exists("Student Batch"):
16+
student_batches = frappe.db.sql('''select name as student_group_name, student_batch_name as batch,
17+
program, academic_year, academic_term from `tabStudent Batch`''', as_dict=1)
18+
19+
for student_batch in student_batches:
20+
# create student batch name if does not exists !!
21+
if student_batch.get("batch") and not frappe.db.exists("Student Batch Name", student_batch.get("batch")):
22+
frappe.get_doc({
23+
"doctype": "Student Batch Name",
24+
"batch_name": student_batch.get("batch")
25+
}).insert(ignore_permissions=True)
26+
27+
student_batch.update({"doctype":"Student Group", "group_based_on": "Batch"})
28+
doc = frappe.get_doc(student_batch)
29+
30+
if frappe.db.sql("SHOW COLUMNS FROM `tabStudent Batch Student` LIKE 'active'"):
31+
cond = ", active"
32+
else:
33+
cond = " "
34+
student_list = frappe.db.sql('''select student, student_name {cond} from `tabStudent Batch Student`
35+
where parent=%s'''.format(cond=cond), (doc.name), as_dict=1)
36+
37+
if student_list:
38+
for i, student in enumerate(student_list):
39+
student.update({"group_roll_number": i+1})
40+
doc.extend("students", student_list)
41+
42+
instructor_list = frappe.db.sql('''select instructor, instructor_name from `tabStudent Batch Instructor`
43+
where parent=%s''', (doc.name), as_dict=1)
44+
if instructor_list:
45+
doc.extend("instructors", instructor_list)
46+
doc.save()
4047

4148
# delete the student batch and child-table
42-
frappe.delete_doc("DocType", "Student Batch", force=1)
43-
frappe.delete_doc("DocType", "Student Batch Student", force=1)
44-
frappe.delete_doc("DocType", "Student Batch Instructor", force=1)
49+
if frappe.db.table_exists("Student Batch"):
50+
frappe.delete_doc("DocType", "Student Batch", force=1)
51+
if frappe.db.table_exists("Student Batch Student"):
52+
frappe.delete_doc("DocType", "Student Batch Student", force=1)
53+
if frappe.db.table_exists("Student Batch Instructor"):
54+
frappe.delete_doc("DocType", "Student Batch Instructor", force=1)
4555

4656
# delete the student batch creation tool
47-
frappe.delete_doc("DocType", "Student Batch Creation Tool", force=1)
57+
if frappe.db.table_exists("Student Batch Creation Tool"):
58+
frappe.delete_doc("DocType", "Student Batch Creation Tool", force=1)
4859

4960
# delete the student batch creation tool
50-
frappe.delete_doc("DocType", "Attendance Tool Student", force=1)
61+
if frappe.db.table_exists("Attendance Tool Student"):
62+
frappe.delete_doc("DocType", "Attendance Tool Student", force=1)
5163

5264
# change the student batch to student group in the student attendance
5365
frappe.reload_doctype("Student Attendance")

erpnext/schools/doctype/student_group/student_group.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def validate_students(self):
3333
program_enrollment = get_program_enrollment(self.academic_year, self.academic_term, self.program, self.batch, self.course)
3434
students = [d.student for d in program_enrollment] if program_enrollment else None
3535
for d in self.students:
36-
if self.group_based_on != "Activity" and d.student not in students and d.active == 1:
36+
if self.group_based_on != "Activity" and students and d.student not in students and d.active == 1:
3737
frappe.throw(_("{0} - {1} is not enrolled in the given {2}".format(d.group_roll_number, d.student_name, self.group_based_on)))
3838
if not frappe.db.get_value("Student", d.student, "enabled") and d.active:
3939
frappe.throw(_("{0} - {1} is inactive student".format(d.group_roll_number, d.student_name)))

erpnext/templates/generators/item_group.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@
3333
</div>
3434
<div class="text-center item-group-nav-buttons">
3535
{% if frappe.form_dict.start|int > 0 %}
36-
<a class="btn btn-default" href="/{{ pathname }}?start={{ frappe.form_dict.start|int - page_length }}">{{ __("Prev") }}</a>
36+
<a class="btn btn-default" href="/{{ pathname }}?start={{ frappe.form_dict.start|int - page_length }}">{{ _("Prev") }}</a>
3737
{% endif %}
3838
{% if items|length > page_length %}
39-
<a class="btn btn-default" href="/{{ pathname }}?start={{ frappe.form_dict.start|int + page_length }}">{{ __("Next") }}</a>
39+
<a class="btn btn-default" href="/{{ pathname }}?start={{ frappe.form_dict.start|int + page_length }}">{{ _("Next") }}</a>
4040
{% endif %}
4141
</div>
4242
{% else %}
43-
<div class="text-muted">{{ __("No items listed") }}.</div>
43+
<div class="text-muted">{{ _("No items listed") }}.</div>
4444
{% endif %}
4545
</div>
4646
</div>

0 commit comments

Comments
 (0)