fix: date validation on student form, instructor duplicate fix on student grp, instructor with same employee id fix (#20072)
* fix: date validation on inpatient record, else condition removing on clinical prcd templ which is not req * fix:Pricing Rule error AttributeError: 'str' object has no attribute 'get' #19770 * fix:Pricing Rule error AttributeError: 'str' object has no attribute 'get' #19770 * fix: joining and relieving Date can be on same date as valid use case * fix-education: date of birth validation * fix:Sibling child table filtering for duplacacy on student form * fix:Sibling child table filtering for duplacacy on student form * fix:Sibling child table filtering for duplacacy on student form * fix: date validation on student form, instructor duplicacy fix on student grp, instructor with same employee id fix * fix: date validation on student form, instructor duplicacy fix on student grp, instructor with same employee id fix * fix: Exclude current record while validating duplicate employee Co-authored-by: Nabin Hait <nabinhait@gmail.com>
This commit is contained in:
parent
fee8340f98
commit
dd42dbc6a3
@ -22,3 +22,12 @@ class Instructor(Document):
|
|||||||
self.name = self.employee
|
self.name = self.employee
|
||||||
elif naming_method == 'Full Name':
|
elif naming_method == 'Full Name':
|
||||||
self.name = self.instructor_name
|
self.name = self.instructor_name
|
||||||
|
|
||||||
|
def validate(self):
|
||||||
|
self.validate_duplicate_employee()
|
||||||
|
|
||||||
|
def validate_duplicate_employee(self):
|
||||||
|
if self.employee and frappe.db.get_value("Instructor", {'employee': self.employee, 'name': ['!=', self.name]}, 'name'):
|
||||||
|
frappe.throw(_("Employee ID is linked with another instructor"))
|
||||||
|
|
||||||
|
|
||||||
|
@ -25,6 +25,9 @@ class Student(Document):
|
|||||||
if self.date_of_birth and getdate(self.date_of_birth) >= getdate(today()):
|
if self.date_of_birth and getdate(self.date_of_birth) >= getdate(today()):
|
||||||
frappe.throw(_("Date of Birth cannot be greater than today."))
|
frappe.throw(_("Date of Birth cannot be greater than today."))
|
||||||
|
|
||||||
|
if self.joining_date and self.date_of_leaving and getdate(self.joining_date) > getdate(self.date_of_leaving):
|
||||||
|
frappe.throw(_("Joining Date can not be greater than Leaving Date"))
|
||||||
|
|
||||||
def update_student_name_in_linked_doctype(self):
|
def update_student_name_in_linked_doctype(self):
|
||||||
linked_doctypes = get_linked_doctypes("Student")
|
linked_doctypes = get_linked_doctypes("Student")
|
||||||
for d in linked_doctypes:
|
for d in linked_doctypes:
|
||||||
|
@ -122,3 +122,15 @@ frappe.ui.form.on("Student Group", {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
frappe.ui.form.on('Student Group Instructor', {
|
||||||
|
instructors_add: function(frm){
|
||||||
|
frm.fields_dict['instructors'].grid.get_field('instructor').get_query = function(doc){
|
||||||
|
let instructor_list = [];
|
||||||
|
$.each(doc.instructors, function(idx, val){
|
||||||
|
instructor_list.push(val.instructor);
|
||||||
|
});
|
||||||
|
return { filters: [['Instructor', 'name', 'not in', instructor_list]] };
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
Loading…
Reference in New Issue
Block a user